MpdTgem.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //------------------------------------------------------------------------------------------------------------------------
  2. // -------------------------------------------------------------------------
  3. // ----- MpdTgem header file -----
  4. // -------------------------------------------------------------------------
  5. /** Tgem.h
  6. **
  7. ** Defines the active detector Tgem. Constructs the geometry and
  8. ** registeres MCPoints.
  9. **/
  10. #ifndef MPDTgem_H
  11. #define MPDTgem_H
  12. #include "TClonesArray.h"
  13. #include "TLorentzVector.h"
  14. #include "TVector3.h"
  15. #include "FairDetector.h"
  16. class MpdTgemPoint;
  17. class FairVolume;
  18. //------------------------------------------------------------------------------------------------------------------------
  19. class MpdTgem : public FairDetector
  20. {
  21. public:
  22. // *@param name detector name
  23. // *@param active sensitivity flag
  24. MpdTgem(const char* name, Bool_t active);
  25. MpdTgem();
  26. virtual ~MpdTgem();
  27. // Defines the action to be taken when a step is inside the
  28. // active volume. Creates MpdTgemPoints and adds them to the collection.
  29. // @param vol Pointer to the active volume
  30. virtual Bool_t ProcessHits(FairVolume* vol = 0);
  31. // If verbosity level is set, print hit collection at the
  32. // end of the event and resets it afterwards.
  33. virtual void EndOfEvent();
  34. // Registers the hit collection in the ROOT manager.
  35. virtual void Register();
  36. // Accessor to the hit collection
  37. virtual TClonesArray* GetCollection(Int_t iColl) const;
  38. // Screen output of hit collection.
  39. virtual void Print() const;
  40. // Clears the hit collection
  41. virtual void Reset();
  42. // *@param cl1 Origin
  43. // *@param cl2 Target
  44. // *@param offset Index offset
  45. virtual void CopyClones(TClonesArray* cl1, TClonesArray* cl2, Int_t offset);
  46. // Constructs the Tgem geometry
  47. virtual void ConstructGeometry();
  48. private:
  49. // Track information to be stored until the track leaves the active volume.
  50. Int_t fTrackID; //! track index
  51. Int_t fVolumeID; //! volume id
  52. TVector3 fPos; //! position
  53. TVector3 fPosLocal; //! position local to gas chamber
  54. TLorentzVector fMom; //! momentum
  55. Double32_t fTime; //! time
  56. Double32_t fLength; //! length
  57. Double32_t fELoss; //! energy loss
  58. Int_t fIsPrimary; //! is track primary?
  59. Double_t fCharge; //! track charge
  60. Double_t fRadius; //! hit radius
  61. Int_t fPdgId; //! pdg id of particle
  62. Int_t fwheel;
  63. TVector3 fPosIn; //! entry position in global frame
  64. TVector3 fPosOut; //! exit position in global frame
  65. TVector3 fPosInTmp; //! entry position in global frame
  66. Int_t fTrackIDTmp; //! track index
  67. Int_t fwheelTmp;
  68. Int_t fPosIndex; //!
  69. TClonesArray* fTgemCollection; //! Hit collection
  70. int DistAndPoints(TVector3 p3, TVector3 p4, TVector3& pa, TVector3& pb);
  71. TVector3 GlobalToLocal(TVector3& global);
  72. TVector3 LocalToGlobal(TVector3& local);
  73. // Adds a MpdTgemPoint to the HitCollection
  74. MpdTgemPoint* AddHit(Int_t trackID, Int_t detID, TVector3 pos, Double_t radius, TVector3 mom, Double_t time,
  75. Double_t length, Double_t eLoss, Int_t isPrimary, Double_t charge, Int_t fPdgId, TVector3 trackPos);
  76. // Resets the private members for the track parameters
  77. void ResetParameters();
  78. ClassDef(MpdTgem,1)
  79. };
  80. //------------------------------------------------------------------------------------------------------------------------
  81. inline void MpdTgem::ResetParameters()
  82. {
  83. fTrackID = -1;
  84. fVolumeID = fwheel = 0;
  85. fPos.SetXYZ(0.0, 0.0, 0.0);
  86. fMom.SetXYZM(0.0, 0.0, 0.0, 0.0);
  87. fTime = fLength = fELoss = 0;
  88. fPosIndex = 0;
  89. fPosInTmp.SetXYZ(0.0, 0.0, 0.0);
  90. fTrackIDTmp=-1;
  91. fwheelTmp=-1;
  92. };
  93. //------------------------------------------------------------------------------------------------------------------------
  94. #endif