MpdZdc.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*************************************************************************************
  2. *
  3. * Class MpdZdc
  4. *
  5. * Adopted for MPD by: Elena Litvinenko
  6. * e-mail: litvin@nf.jinr.ru
  7. * Version: 8-Apr-2008
  8. *
  9. ************************************************************************************/
  10. #ifndef MPDZDC_H
  11. #define MPDZDC_H
  12. #include "TClonesArray.h"
  13. #include "TVector3.h"
  14. #include "TLorentzVector.h"
  15. #include "FairDetector.h"
  16. #include "MpdZdcGeoPar.h"
  17. using namespace std;
  18. class TClonesArray;
  19. class MpdZdcPoint;
  20. class FairVolume;
  21. class MpdZdc : public FairDetector
  22. {
  23. public:
  24. /** Default constructor **/
  25. MpdZdc();
  26. /** Standard constructor.
  27. *@param name detetcor name
  28. *@param active sensitivity flag
  29. **/
  30. MpdZdc(const char* name, Bool_t active);
  31. /** Destructor **/
  32. virtual ~MpdZdc();
  33. /** Virtual method Initialize
  34. ** Initialises detector. Stores volume IDs for MUO detector and mirror.
  35. **/
  36. virtual void Initialize();
  37. /** Virtual method ProcessHits
  38. **
  39. ** Defines the action to be taken when a step is inside the
  40. ** active volume. Creates MpdZdcPoints and MpdZdcMirrorPoints and adds
  41. ** them to the collections.
  42. *@param vol Pointer to the active volume
  43. **/
  44. virtual Bool_t ProcessHits(FairVolume* vol = 0);
  45. /** Virtual method EndOfEvent
  46. **
  47. ** If verbosity level is set, print hit collection at the
  48. ** end of the event and resets it afterwards.
  49. **/
  50. virtual void EndOfEvent();
  51. virtual void BeginEvent();
  52. /** Virtual method Register
  53. **
  54. ** Registers the hit collection in the ROOT manager.
  55. **/
  56. virtual void Register();
  57. /** Accessor to the hit collection **/
  58. virtual TClonesArray* GetCollection(Int_t iColl) const;
  59. /** Virtual method Print
  60. **
  61. ** Screen output of hit collection.
  62. **/
  63. virtual void Print() const;
  64. /** Virtual method Reset
  65. **
  66. ** Clears the hit collection
  67. **/
  68. virtual void Reset();
  69. /** Virtual method CopyClones
  70. **
  71. ** Copies the hit collection with a given track index offset
  72. *@param cl1 Origin
  73. *@param cl2 Target
  74. *@param offset Index offset
  75. **/
  76. virtual void CopyClones(TClonesArray* cl1, TClonesArray* cl2,
  77. Int_t offset);
  78. /** Virtual method Construct geometry
  79. **
  80. **/
  81. virtual void ConstructGeometry();
  82. // Check whether a volume is sensitive.
  83. // The decision is based on the volume name. Only used in case
  84. // of GDML and ROOT geometry.
  85. // @param name Volume name
  86. // @value kTRUE if volume is sensitive, else kFALSE
  87. virtual Bool_t CheckIfSensitive(std::string name);
  88. MpdZdcPoint* GetHit(Int_t i) const;
  89. MpdZdcPoint* GetHit(Int_t vsc, Int_t mod, Int_t zdc) const;
  90. //MpdZdcPoint* GetHitH(Int_t vsch, Int_t modh) const;
  91. Int_t GetVSCVolId() { return fVSCVolId; }
  92. Int_t GetVSCHVolId() { return fVSCHVolId; }
  93. MpdZdcPoint* AddHit(Int_t trackID, Int_t detID, Int_t copyNo, Int_t copyNoMother, Int_t copyNoZdc,
  94. TVector3 pos, TVector3 mom,
  95. Double_t tof, Double_t length, Double_t eLoss);
  96. private:
  97. Int_t fTrackID; //! track index
  98. Int_t fVolumeID; //! volume id
  99. Int_t fEventID; //! event id
  100. TLorentzVector fPos; //! position
  101. TLorentzVector fMom; //! momentum
  102. Double32_t fTime; //! time
  103. Double32_t fLength; //! length
  104. Int_t fHitNb;
  105. Int_t fVSCVolId;
  106. Int_t fVSCHVolId;
  107. Double32_t fELoss; //! energy loss
  108. Int_t fPosIndex; //!
  109. Int_t volDetector; //! MC volume ID of MUO
  110. TClonesArray* fZdcCollection; //! Hit collection
  111. // reset all parameters
  112. void ResetParameters();
  113. ClassDef(MpdZdc,2)
  114. };
  115. //------------------------------------------------------------------------------------------------------------------------
  116. inline void MpdZdc::ResetParameters()
  117. {
  118. fTrackID = fVolumeID = 0;
  119. fPos.SetXYZM(0.0, 0.0, 0.0, 0.0);
  120. fMom.SetXYZM(0.0, 0.0, 0.0, 0.0);
  121. fTime = fLength = fELoss = 0;
  122. fPosIndex = 0;
  123. };
  124. //------------------------------------------------------------------------------------------------------------------------
  125. #endif