MpdFfd.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //------------------------------------------------------------------------------------------------------------------------
  2. /// \class MpdFfd
  3. ///
  4. /// \brief
  5. /// \author Sergei Lobastov (LHE, JINR, Dubna)
  6. //------------------------------------------------------------------------------------------------------------------------
  7. #ifndef __HH_MPDFFD_H
  8. #define __HH_MPDFFD_H 1
  9. #include <iostream>
  10. #include <vector>
  11. #include <map>
  12. #include "TClonesArray.h"
  13. #include "TLorentzVector.h"
  14. #include "TVector3.h"
  15. #include "FairDetector.h"
  16. #include "MpdFfdPoint.h"
  17. //class MpdFfdPoint;
  18. class FairVolume;
  19. //------------------------------------------------------------------------------------------------------------------------
  20. class MpdFfd : public FairDetector
  21. {
  22. public:
  23. // *@param name detector name
  24. // *@param active sensitivity flag
  25. MpdFfd(const char* name, Bool_t active, Int_t verbose = 1);
  26. MpdFfd();
  27. virtual ~MpdFfd();
  28. // Defines the action to be taken when a step is inside the
  29. // active volume. Creates MpdFfdPoints and adds them to the collection.
  30. // @param vol Pointer to the active volume
  31. virtual Bool_t ProcessHits(FairVolume* vol = 0);
  32. // If verbosity level is set, print hit collection at the
  33. // end of the event and resets it afterwards.
  34. virtual void EndOfEvent();
  35. // Registers the hit collection in the ROOT manager.
  36. virtual void Register();
  37. // Accessor to the hit collection
  38. virtual TClonesArray* GetCollection(Int_t iColl) const;
  39. // Screen output of hit collection.
  40. virtual void Print() const;
  41. // Clears the hit collection
  42. virtual void Reset();
  43. // *@param cl1 Origin
  44. // *@param cl2 Target
  45. // *@param offset Index offset
  46. virtual void CopyClones(TClonesArray* cl1, TClonesArray* cl2, Int_t offset);
  47. // Constructs the FFD geometry
  48. virtual void ConstructGeometry();
  49. // Construct the geometry from an ASCII geometry file
  50. virtual void ConstructAsciiGeometry();
  51. // Check whether a volume is sensitive.
  52. // The decision is based on the volume name. Only used in case
  53. // of GDML and ROOT geometry.
  54. // @param name Volume name
  55. // @value kTRUE if volume is sensitive, else kFALSE
  56. virtual Bool_t CheckIfSensitive(std::string name);
  57. private:
  58. TLorentzVector fPos = {}; //! position
  59. TLorentzVector fMom = {}; //! momentum
  60. // cached looking for
  61. MpdFfdPoint *cPoint = nullptr;
  62. Int_t cPtid = -1, cSuid = -1;
  63. Int_t fPosIndex; //!
  64. TClonesArray* aFfdPoints; //! Hit collection
  65. MpdFfdPoint* FindPoint(Int_t ptid, Int_t suid);
  66. MpdFfdPoint* CreatePoint(Int_t ptid, Int_t suid);
  67. // Resets the private members for the track parameters
  68. void ResetParameters();
  69. struct TrackParam
  70. {
  71. TrackParam(Int_t id, const TVector3& in, const TLorentzVector& P, Double_t t, Double_t l) // init params at track enter to SV
  72. { suid = id; posIn = in; mom = P; time = t; length = l;}
  73. Int_t suid = -1;
  74. TVector3 posIn = {}, posOut = {};
  75. TLorentzVector mom = {};
  76. Double_t time = 0., length = 0.;
  77. };
  78. typedef std::multimap<Int_t, TrackParam> Tparams;
  79. Tparams params; //! key = tid
  80. std::pair <Tparams::iterator, bool> FindTrackParams(Int_t tid, Int_t suid);
  81. ClassDef(MpdFfd,3)
  82. };
  83. //------------------------------------------------------------------------------------------------------------------------
  84. inline void MpdFfd::ResetParameters()
  85. {
  86. fPos = fMom = {};
  87. fPosIndex = {};
  88. };
  89. //------------------------------------------------------------------------------------------------------------------------
  90. #endif