MpdCpc.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //------------------------------------------------------------------------------------------------------------------------
  2. // -------------------------------------------------------------------------
  3. // ----- MpdCpc header file -----
  4. // -------------------------------------------------------------------------
  5. /** MpdCpc.h
  6. **
  7. ** Defines the active detector CPC. Constructs the geometry and
  8. ** registeres MCPoints.
  9. **/
  10. #ifndef MPDCPC_H
  11. #define MPDCPC_H
  12. #include "TClonesArray.h"
  13. #include "TLorentzVector.h"
  14. #include "TVector3.h"
  15. #include "FairDetector.h"
  16. class MpdCpcPoint;
  17. class FairVolume;
  18. //------------------------------------------------------------------------------------------------------------------------
  19. class MpdCpc : public FairDetector
  20. {
  21. public:
  22. // *@param name detector name
  23. // *@param active sensitivity flag
  24. MpdCpc(const char* name, Bool_t active);
  25. MpdCpc();
  26. virtual ~MpdCpc();
  27. // Defines the action to be taken when a step is inside the
  28. // active volume. Creates MpdCpcPoints 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 CPC geometry
  47. virtual void ConstructGeometry();
  48. // Construct the geometry from an ASCII geometry file
  49. virtual void ConstructAsciiGeometry();
  50. // Check whether a volume is sensitive.
  51. // The decision is based on the volume name. Only used in case
  52. // of GDML and ROOT geometry.
  53. // @param name Volume name
  54. // @value kTRUE if volume is sensitive, else kFALSE
  55. virtual Bool_t CheckIfSensitive(std::string name);
  56. private:
  57. // Track information to be stored until the track leaves the active volume.
  58. Int_t fTrackID; //! track index
  59. Int_t fVolumeID; //! volume id
  60. TLorentzVector fPos; //! position
  61. TLorentzVector fMom; //! momentum
  62. Double32_t fTime; //! time
  63. Double32_t fLength; //! length
  64. Double32_t fELoss; //! energy loss
  65. Int_t fPosIndex; //!
  66. TClonesArray* fCpcCollection; //! Hit collection
  67. // Adds a MpdCpcPoint to the HitCollection
  68. MpdCpcPoint* AddHit(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss);
  69. // Resets the private members for the track parameters
  70. void ResetParameters();
  71. ClassDef(MpdCpc,1)
  72. };
  73. //------------------------------------------------------------------------------------------------------------------------
  74. inline void MpdCpc::ResetParameters()
  75. {
  76. fTrackID = fVolumeID = 0;
  77. fPos.SetXYZM(0.0, 0.0, 0.0, 0.0);
  78. fMom.SetXYZM(0.0, 0.0, 0.0, 0.0);
  79. fTime = fLength = fELoss = 0;
  80. fPosIndex = 0;
  81. };
  82. //------------------------------------------------------------------------------------------------------------------------
  83. #endif