BmdDetector.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. //-----------------------------------------------------------
  2. // File and Version Information:
  3. // $Id$
  4. //
  5. // Description:
  6. // Detector class - sensitive detector for VMC
  7. //
  8. //
  9. // Environment:
  10. // Software developed for the PANDA Detector at FAIR.
  11. //
  12. // Author List:
  13. // Pedro Gonzalez Zamora (original author)
  14. //
  15. //
  16. //-----------------------------------------------------------
  17. #ifndef BMDDETECTOR_HH
  18. #define BMDDETECTOR_HH
  19. // Base Class Headers ----------------
  20. #include "FairDetector.h"
  21. // Collaborating Class Headers -------
  22. #include <TLorentzVector.h>
  23. #include <ostream> // remove if you do not need streaming op
  24. #include "TVector3.h"
  25. #include "TGeoMedium.h"
  26. #include <map>
  27. using namespace std;
  28. // Collaborating Class Declarations --
  29. class TClonesArray;
  30. class FairVolume;
  31. class BmdPoint;
  32. class BmdDetector : public FairDetector {
  33. public:
  34. // Constructors/Destructors ---------
  35. /** Name : Detector Name
  36. Active: kTRUE for active detectors
  37. (ProcessHits() will be called)
  38. kFALSE for inactive detectors */
  39. BmdDetector(const char * Name, Bool_t Active);
  40. /** default constructor */
  41. BmdDetector();
  42. /** destructor */
  43. virtual ~BmdDetector();
  44. /** Initialization of the detector is done here */
  45. //virtual void Initialize();
  46. /** this method is called for each step
  47. during simulation (see FairMCApplication::Stepping()) */
  48. virtual Bool_t ProcessHits( FairVolume *v=0);
  49. /** Registers the produced collections in CBMRootManager. */
  50. virtual void Register();
  51. virtual void Print() const;
  52. /** Gets the produced collections */
  53. virtual TClonesArray* GetCollection(Int_t iColl) const ;
  54. /** has to be called after each event
  55. to reset the containers */
  56. virtual void Reset();
  57. /** Create the detector geometry */
  58. virtual void ConstructGeometry();
  59. // Construct the geometry from an ASCII geometry file
  60. virtual void ConstructAsciiGeometry();
  61. // Construct the geometry from a GDML geometry file
  62. virtual void ConstructGDMLGeometry();
  63. void ExpandNodeForGdml(TGeoNode* node);
  64. map<TString, TGeoMedium*> fFixedMedia; // List of media "repaired" after importing GMDL
  65. // Check whether a volume is sensitive.
  66. // The decision is based on the volume name. Only used in case
  67. // of GDML and ROOT geometry.
  68. // @param name Volume name
  69. // @value kTRUE if volume is sensitive, else kFALSE
  70. virtual Bool_t CheckIfSensitive(std::string name);
  71. void EndOfEvent();
  72. BmdPoint* AddHit(Int_t trackID, Int_t detID, TVector3 pos,
  73. TVector3 mom, Double_t time, Double_t length,
  74. Double_t eLoss);
  75. Int_t GetVolumeID(TString volname);
  76. // Operators
  77. // Accessors -----------------------
  78. // Modifiers -----------------------
  79. // Operations ----------------------
  80. private:
  81. // Private Data Members ------------
  82. TClonesArray *fBmdPointCollection;
  83. Int_t fTrackID; //! track index
  84. Int_t fVolumeID; //! volume id
  85. TLorentzVector fPos; //! position
  86. TLorentzVector fMom; //! momentum
  87. Double_t fTime; //! time
  88. Double_t fLength; //! length
  89. Double_t fELoss; //! energy loss
  90. Int_t currentTrackID; //!
  91. Int_t currentEvent; //! current event
  92. Bool_t fNewTrack;
  93. const double nan; //!
  94. void ResetParameters();
  95. // Private Methods -----------------
  96. public:
  97. ClassDef(BmdDetector,1)
  98. };
  99. //------------------------------------------------------------------------------------------------------------------------
  100. inline void BmdDetector::ResetParameters()
  101. {
  102. fTrackID = fVolumeID = 0;
  103. fPos.SetXYZM(nan, nan, nan, nan);
  104. fMom.SetXYZM(nan, nan, nan, nan);
  105. fTime = fLength = fELoss = nan;
  106. //fPosIndex = 0;
  107. };
  108. //-------------------------
  109. #endif
  110. //--------------------------------------------------------------
  111. // $Log$
  112. //--------------------------------------------------------------