MpdStrawECT.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //------------------------------------------------------------------------------------------------------------------------
  2. // -------------------------------------------------------------------------
  3. // ----- MpdStrawECT header file -----
  4. // -------------------------------------------------------------------------
  5. /** MpdStrawECT.h
  6. **
  7. ** Defines the active detector StrawECT. Constructs the geometry and
  8. ** registeres MCPoints.
  9. **/
  10. #ifndef MPDStrawECT_H
  11. #define MPDStrawECT_H
  12. #include "TClonesArray.h"
  13. #include "TLorentzVector.h"
  14. #include "TVector3.h"
  15. #include "FairDetector.h"
  16. #include "TGeoMedium.h"
  17. #include <map>
  18. using namespace std;
  19. class MpdStrawECTPoint;
  20. class FairVolume;
  21. //------------------------------------------------------------------------------------------------------------------------
  22. class MpdStrawECT : public FairDetector {
  23. public:
  24. // *@param name detector name
  25. // *@param active sensitivity flag
  26. MpdStrawECT(const char* name, Bool_t active);
  27. MpdStrawECT();
  28. virtual ~MpdStrawECT();
  29. // Defines the action to be taken when a step is inside the
  30. // active volume. Creates MpdStrawECTPoints and adds them to the collection.
  31. // @param vol Pointer to the active volume
  32. virtual Bool_t ProcessHits(FairVolume* vol = 0);
  33. // If verbosity level is set, print hit collection at the
  34. // end of the event and resets it afterwards.
  35. virtual void EndOfEvent();
  36. // Registers the hit collection in the ROOT manager.
  37. virtual void Register();
  38. // Accessor to the hit collection
  39. virtual TClonesArray* GetCollection(Int_t iColl) const;
  40. // Screen output of hit collection.
  41. virtual void Print() const;
  42. // Clears the hit collection
  43. virtual void Reset();
  44. // *@param cl1 Origin
  45. // *@param cl2 Target
  46. // *@param offset Index offset
  47. virtual void CopyClones(TClonesArray* cl1, TClonesArray* cl2, Int_t offset);
  48. // Create the detector geometry
  49. virtual void ConstructGeometry();
  50. // Construct the geometry from an ASCII geometry file
  51. virtual void ConstructAsciiGeometry();
  52. // Construct the geometry from a GDML geometry file
  53. virtual void ConstructGDMLGeometry();
  54. void ExpandNodeForGdml(TGeoNode* node);
  55. map<TString, TGeoMedium*> fFixedMedia; // List of media "repaired" after importing GMDL
  56. // Check whether a volume is sensitive.
  57. // The decision is based on the volume name. Only used in case
  58. // of GDML and ROOT geometry.
  59. // @param name Volume name
  60. // @value kTRUE if volume is sensitive, else kFALSE
  61. virtual Bool_t CheckIfSensitive(std::string name);
  62. private:
  63. // Track information to be stored until the track leaves the active volume.
  64. Int_t fTrackID; //! track index
  65. Int_t fVolumeID; //! volume id
  66. TVector3 fPos; //! position
  67. TLorentzVector fMom; //! momentum
  68. Double32_t fTime; //! time
  69. Double32_t fLength; //! length
  70. Double32_t fELoss; //! energy loss
  71. Int_t fIsPrimary; //! is track primary?
  72. Double_t fCharge; //! track charge
  73. Double_t fRadius; //! hit radius
  74. Int_t fPdgId; //! pdg id of particle
  75. TVector3 fPosIn; //! entry position in global frame
  76. TVector3 fPosOut; //! exit position in global frame
  77. Int_t fPosIndex; //!
  78. TClonesArray* fStrawECTCollection; //! Hit collection
  79. int DistAndPoints(TVector3 p1, TVector3 p2, TVector3 p3, TVector3 p4, TVector3& pa, TVector3& pb);
  80. TVector3 GlobalToLocal(TVector3& global);
  81. TVector3 LocalToGlobal(TVector3& local);
  82. // Adds a MpdStrawECTPoint to the HitCollection
  83. MpdStrawECTPoint* AddHit(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time,
  84. Double_t length, Double_t eLoss);
  85. // Resets the private members for the track parameters
  86. void ResetParameters();
  87. ClassDef(MpdStrawECT,1)
  88. };
  89. //------------------------------------------------------------------------------------------------------------------------
  90. inline void MpdStrawECT::ResetParameters() {
  91. fTrackID = fVolumeID = 0;
  92. fPos.SetXYZ(0.0, 0.0, 0.0);
  93. fMom.SetXYZM(0.0, 0.0, 0.0, 0.0);
  94. fTime = fLength = fELoss = 0;
  95. fPosIndex = 0;
  96. };
  97. //------------------------------------------------------------------------------------------------------------------------
  98. #endif