MpdStrawendcap.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //------------------------------------------------------------------------------------------------------------------------
  2. // -------------------------------------------------------------------------
  3. // ----- MpdStrawendcap header file -----
  4. // -------------------------------------------------------------------------
  5. /** MpdStrawendcap.h
  6. **
  7. ** Defines the active detector Strawendcap. Constructs the geometry and
  8. ** registeres MCPoints.
  9. **/
  10. #ifndef MPDStrawendcap_H
  11. #define MPDStrawendcap_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 MpdStrawendcapPoint;
  20. class FairVolume;
  21. //------------------------------------------------------------------------------------------------------------------------
  22. class MpdStrawendcap : public FairDetector {
  23. public:
  24. // *@param name detector name
  25. // *@param active sensitivity flag
  26. MpdStrawendcap(const char* name, Bool_t active);
  27. MpdStrawendcap();
  28. virtual ~MpdStrawendcap();
  29. // Defines the action to be taken when a step is inside the
  30. // active volume. Creates MpdStrawendcapPoints 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. TVector3 fPosLocal; //! position local to gas chamber
  68. TLorentzVector fMom; //! momentum
  69. Double32_t fTime; //! time
  70. Double32_t fLength; //! length
  71. Double32_t fELoss; //! energy loss
  72. Int_t fIsPrimary; //! is track primary?
  73. Double_t fCharge; //! track charge
  74. Double_t fRadius; //! hit radius
  75. Int_t fPdgId; //! pdg id of particle
  76. TVector3 fPosIn; //! entry position in global frame
  77. TVector3 fPosOut; //! exit position in global frame
  78. Int_t fPosIndex; //!
  79. TClonesArray* fStrawendcapCollection; //! Hit collection
  80. int DistAndPoints(TVector3 p1, TVector3 p2, TVector3 p3, TVector3 p4, TVector3& pa, TVector3& pb);
  81. TVector3 GlobalToLocal(TVector3& global);
  82. TVector3 LocalToGlobal(TVector3& local);
  83. // Adds a MpdStrawendcapPoint to the HitCollection
  84. MpdStrawendcapPoint* AddHit(Int_t trackID, Int_t detID, TVector3 pos, Double_t radius, TVector3 mom, Double_t time,
  85. Double_t length, Double_t eLoss, Int_t isPrimary, Double_t charge, Int_t fPdgId, TVector3 trackPos);
  86. // Resets the private members for the track parameters
  87. void ResetParameters();
  88. ClassDef(MpdStrawendcap,1)
  89. };
  90. //------------------------------------------------------------------------------------------------------------------------
  91. inline void MpdStrawendcap::ResetParameters() {
  92. fTrackID = fVolumeID = 0;
  93. fPos.SetXYZ(0.0, 0.0, 0.0);
  94. fMom.SetXYZM(0.0, 0.0, 0.0, 0.0);
  95. fTime = fLength = fELoss = 0;
  96. fPosIndex = 0;
  97. };
  98. //------------------------------------------------------------------------------------------------------------------------
  99. #endif