MpdFfdHitProducer.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //------------------------------------------------------------------------------------------------------------------------
  2. /// \class MpdFfdHitProducer
  3. ///
  4. /// \brief
  5. /// \author Sergei Lobastov (LHE, JINR, Dubna)
  6. //------------------------------------------------------------------------------------------------------------------------
  7. #ifndef __HH_MPDFFDHITPRODUCER_H
  8. #define __HH_MPDFFDHITPRODUCER_H 1
  9. #include <map>
  10. #include <TList.h>
  11. #include <TString.h>
  12. #include <TVector3.h>
  13. #include <TH2D.h>
  14. #include <TH1D.h>
  15. #include <TEfficiency.h>
  16. #include "FairTask.h"
  17. //------------------------------------------------------------------------------------------------------------------------
  18. class TClonesArray;
  19. class TGraph;
  20. class MpdFfdPoint;
  21. class MpdFfdHit;
  22. //------------------------------------------------------------------------------------------------------------------------
  23. class MpdFfdHitProducer : public FairTask
  24. {
  25. public:
  26. struct PointData
  27. {
  28. size_t pointIndex;
  29. const MpdFfdPoint* pPoint;
  30. size_t nPe;
  31. PointData(size_t index, const MpdFfdPoint* ptr, size_t npe) : pointIndex(index), pPoint(ptr), nPe(npe){};
  32. PointData() : pointIndex(-1), pPoint(nullptr), nPe(0){};
  33. };
  34. typedef std::map<size_t, PointData> Tintegrals;
  35. private:
  36. TClonesArray *aMcPoints = nullptr; //! <--- MC input
  37. TClonesArray *aMcTracks = nullptr; //! <--- MC input
  38. TClonesArray *aExpDigits = nullptr; //! <--- Exp input
  39. TClonesArray *aFfdHits = nullptr; //! ---> output
  40. Bool_t fUseMCData = true, fUseTimeWindow = true;
  41. Bool_t fDoTest = false;
  42. size_t fNpeThresh = 80.; // default value = 80 photo electrons
  43. Double_t fErrXY = 4./sqrt(12.), fErrZ = 1.5/sqrt(12.); // 4x4x1.5 [cm]
  44. TList fList;
  45. TString fFlnm;
  46. std::multimap<size_t, const MpdFfdHit*> mmOccup; //!
  47. Double_t fTimeWindow = 1.; // [ns] channel time window for pe integration
  48. static const size_t fRoIBins = 1000;
  49. const double fRoISize = 10; // Region of Interest = [0,10] ns
  50. // 160 channels(quartz SV), key = timebin
  51. std::multimap<size_t, PointData> fData[160];
  52. TH1D *hSuids = nullptr;
  53. TH2D *hOpYield = nullptr, *hOpYieldPion = nullptr, *hOpYieldProton = nullptr, *hOpYieldElectron = nullptr;
  54. TH2D *hPeYield = nullptr, *hPeYieldPion = nullptr, *hPeYieldProton = nullptr, *hPeYieldElectron = nullptr;
  55. TH2D *hOpTrash = nullptr, *hXY = nullptr, *hXmap = nullptr, *hYmap = nullptr, *hZmap = nullptr;
  56. TH2D *hXcenter = nullptr, *hYcenter = nullptr, *hCenter = nullptr, *hOccup = nullptr, *hChannelsEW = nullptr;
  57. TH2D *hTimeWindows = nullptr, *hTimeSize = nullptr;
  58. TEfficiency *hPMTeff = nullptr;
  59. static TGraph *gPMTeff_pdf; // PDF for PMT yield
  60. virtual void SetParContainers();
  61. void Add(TEfficiency *hist){ hist->SetDirectory(nullptr); fList.Add(hist);}
  62. void Add(TH1 *hist){ hist->SetDirectory(nullptr); fList.Add(hist);}
  63. MpdFfdHit* AddHit(const MpdFfdPoint *point, const TVector3& pos, const TVector3& dpos, Int_t refIndex, size_t npe, Int_t flag);
  64. MpdFfdHit* AddHit(const MpdFfdPoint *point, const TVector3& pos, const TVector3& dpos, Int_t refIndex, size_t npe, Int_t flag, const Tintegrals&);
  65. TVector3 GetPadCenter(Int_t suid); // [1,161]
  66. void AddEntry(double time, size_t suid, const MpdFfdPoint* ptr, size_t index);
  67. inline bool GetTimeBin(double time, size_t& bin) // [ns]
  68. {
  69. time -= 1.8; // shift to 0
  70. if(0 < time && time < fRoISize) // time inside RoI
  71. {
  72. bin = (size_t) (time * fRoIBins/fRoISize); // bin size = fRoISize/fRoIBins
  73. return true;
  74. }
  75. return false;
  76. }
  77. inline double GetTime(size_t bin) // [ns]
  78. {
  79. assert(0 <= bin && bin < fRoIBins);
  80. double time = bin *fRoISize / fRoIBins;
  81. time += 1.8; // shift from 0
  82. return time;
  83. }
  84. public:
  85. MpdFfdHitProducer(const char* name = "FFD hit Producer", bool useMCdata = true, bool useTimeWindow = true, Int_t verbose = 1, const char* QAflnm = nullptr);
  86. virtual ~MpdFfdHitProducer();
  87. virtual InitStatus Init();
  88. virtual void Exec(Option_t* opt);
  89. virtual void Finish();
  90. void SetErrors(double XYerr, double Zerr){ fErrXY = XYerr; fErrZ = Zerr;};
  91. void SetPeThresh(size_t n) {fNpeThresh = n;};
  92. void SetTimeWindow(Double_t v) {fTimeWindow = v;};
  93. static bool IsPeCreated(double energy); // [eV]
  94. ClassDef(MpdFfdHitProducer,3);
  95. };
  96. //------------------------------------------------------------------------------------------------------------------------
  97. #endif