MpdEmcClusterKI.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. #ifndef MPDEMCCLUSTERKI_H
  2. #define MPDEMCCLUSTERKI_H 1
  3. #include <map>
  4. #include "TMath.h"
  5. #include "TObject.h"
  6. class MpdEmcDigitKI;
  7. class TLorentzVector;
  8. class TVector3;
  9. using namespace std;
  10. class MpdEmcClusterKI : public TObject
  11. {
  12. public:
  13. /** Default constructor **/
  14. MpdEmcClusterKI();
  15. /** Constructor with hit parameters **/
  16. MpdEmcClusterKI(const MpdEmcDigitKI* digit);
  17. /** Destructor **/
  18. virtual ~MpdEmcClusterKI();
  19. // Returm momentum of photon assuming it came from the provided vertex
  20. void GetMomentum(TLorentzVector& p, const TVector3* vertex) const;
  21. void AddDigit(const MpdEmcDigitKI* digit, Double_t edep = 0);
  22. void EvalAll(); // Evaluate cluster parameters
  23. void Print(const Option_t* opt = 0) const;
  24. void Purify(); // Remove digits below threshold
  25. void CorrectVertex(double vZ);
  26. int GetNumberOfLocalMax(int* maxAt, float* maxAtEnergy) const; // Finds local maxima
  27. int GetDigitTowerId(int i) const { return fDigitIDEnergy.at(i).first; } // detectorId of i-th digit
  28. // Get tower ID and energy of i-th cotributing digit
  29. void GetDigitParams(int i, int& detId, float& eDigit) const
  30. {
  31. if (i >= 0 && i < fNDigits) {
  32. detId = fDitisId[i];
  33. eDigit = fDigitsE[i];
  34. } else {
  35. detId = -1;
  36. eDigit = 0;
  37. }
  38. }
  39. // Method used in unfolding and should not be used by analysers
  40. void GetTransientDigitParams(int i, int& detId, float& eDigit) const
  41. {
  42. std::pair<int, float> p = fDigitIDEnergy.at(i);
  43. detId = p.first;
  44. eDigit = p.second;
  45. }
  46. // Number of MC tracks
  47. int GetNumberOfTracks() const { return fNPrimaries; }
  48. void GetMCTrack(Int_t i, Int_t& trackId, Float_t& trackEdep) const
  49. {
  50. if (i >= 0 && i < fNPrimaries) {
  51. trackId = fPrimId[i];
  52. trackEdep = fPrimE[i];
  53. } else {
  54. trackId = -1;
  55. trackEdep = 0;
  56. }
  57. }
  58. Float_t GetE() const { return fE; };
  59. Float_t GetEcore() const { return fEcore; };
  60. Float_t GetEcore_1p() const { return fEcore1p; };
  61. Float_t GetEcore_2p() const { return fEcore2p; };
  62. Float_t GetChi2() const { return fChi2; };
  63. Float_t GetTime() const { return fTime; };
  64. Float_t GetPhi() const { return TMath::ATan2(fY, fX); };
  65. Float_t GetRho() const { return TMath::Sqrt(fX * fX + fY * fY); };
  66. Float_t GetX() const { return fX; };
  67. Float_t GetY() const { return fY; };
  68. Float_t GetZ() const { return fZ; };
  69. Float_t GetDPhi() const { return fdPhi; };
  70. Float_t GetDZ() const { return fdZ; };
  71. Float_t GetRad() const { return TMath::Sqrt(fX * fX + fY * fY + fZ * fZ); };
  72. Int_t GetMultiplicity() const
  73. {
  74. return TMath::Max((int)fDigitIDEnergy.size(), fNDigits); // either from std::vector or in final cluster - from array
  75. };
  76. Float_t GetTrackIndex() const { return fTrackId; };
  77. Int_t GetNLM() const { return fNExLM; }
  78. void SetNLM(int n) { fNExLM = n; }
  79. /* void SetFlag(Int_t flag) {
  80. fFlag = flag;
  81. };
  82. */
  83. void SetTime(Float_t time) { fTime = time; };
  84. void SetTrackIndex(Int_t ind) { fTrackId = ind; }
  85. // Distance to track extrapolation
  86. void SetTrackDxDz(Float_t dphi, Float_t dz)
  87. {
  88. fdPhi = dphi;
  89. fdZ = dz;
  90. }
  91. // Dispersion parameters
  92. void GetLambdas(Float_t& l1, Float_t& l2)
  93. {
  94. l1 = fLambda1;
  95. l2 = fLambda2;
  96. }
  97. protected:
  98. void FillArrays(); // Fill arrays to store to disk
  99. protected:
  100. // Parameters used for re-calibration if necessary
  101. std::vector<std::pair<int, float>> fDigitIDEnergy; //! transient list of contributed digits with energies
  102. std::map<int, float> fMCTracks; //! transient trackID and energy deposit
  103. Int_t fNDigits; // Digit multiplicity
  104. Int_t* fDitisId; //[fNDigits] cellId
  105. Float_t* fDigitsE; //[fNDigits] deposited energy
  106. Int_t fNPrimaries; // Number of primaries
  107. Int_t* fPrimId; //[fNPrimaries] cellId
  108. Float_t* fPrimE; //[fNPrimaries] deposited energy per cell
  109. Float_t fE; // cluster energy
  110. Float_t fEcore; // cluster energy core
  111. Float_t fEcore1p; // cluster energy core
  112. Float_t fEcore2p; // cluster energy core
  113. Float_t fTime; // cluster time
  114. // cluster coordinates in global system
  115. Float_t fX; // x-coordinate of cluster
  116. Float_t fY; // y-coordinate of cluster
  117. Float_t fZ; // z-coordinate of cluster
  118. // Distance to closest track
  119. Float_t fdPhi; // dPhi
  120. Float_t fdZ; // dZed
  121. Int_t fTrackId; // Index of matched (closest) track if any
  122. // Dispersion and shower shape parameters
  123. Float_t fDisp; // Dispersion
  124. Float_t fChi2; // Chi2 of a fit with EM shape
  125. Float_t fLambda1; // smaller Disp axis
  126. Float_t fLambda2; // larger Disp axis
  127. Int_t fNExLM; // Number of local maxima or NLM in parent cluster before unfolding
  128. ClassDef(MpdEmcClusterKI, 1)
  129. };
  130. #endif