EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicCalorimeterDigiHit.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicCalorimeterDigiHit.h
1 //
2 // AYK (ayk@bnl.gov), 2013/06/13
3 //
4 // Calorimeter digi hit classes;
5 //
6 
7 #include <map>
8 
9 #include <TObject.h>
10 
11 #include <EicGeoParData.h>
12 
13 #ifndef _EIC_CALORIMETER_DIGI_HIT_
14 #define _EIC_CALORIMETER_DIGI_HIT_
15 
17  public:
20 
21  // This counter makes sense only if fOneStepOneHit is set to kFALSE (?);
22  UInt_t mHitNum; // number of hits in this Z-bin
23 
24  Double32_t mEnergyDeposit; // energy deposit in this Z-bin
25  Double32_t mTime; // average time when energy deposit happened
26  Double32_t mZ; // average Z coordinate; may differ from Z-bin middle
27 
29 };
30 
31 class EnergyDeposit: public TObject
32 {
34 
35  public:
38 
39  private:
40  Double32_t mPassive; // energy deposit in passive material
41  Double32_t mSensitive; // energy deposit in sensitive material
42  Double32_t mSensitiveBirk; // "effective" energy deposit after Birk's correction
43 
45 };
46 
48  public:
51 
52  void InitializeZCoordSpectrum(UInt_t nBins) {
53  mZCoordDim = nBins;
55  };
56 
57  // Well, consider to retain this array in the output even if dim=1 (default);
58  // 'mEnergyDeposit' is clearly redundant then, but 'mZ' gives average shower
59  // depth estimate, and 'mTime' may also be useful;
60  UInt_t mZCoordDim;
61  // Figure out why ROOT streaming does not work here;
63 
64  // Yes, for now just want to count photons; if ever come to something like
65  // smearing due to electronic effects, can introduce a different transient variable
66  // in the reconstruction code; NB: want it signed because APD noise may send
67  // this value negative for "too low" cells, whatever that means for now;
68  Long64_t mSignalPhotonCount; // number of photons produced in this cell from this parent
69 
71 };
72 
73 class CalorimeterCell: public TObject {
74  public:
75  CalorimeterCell(): mTimeDim(0), mTimeSpectrum(0)/*, mPhotonCountSum(0)*/, mNoisePhotonCount(0) {};
77  if (mTimeSpectrum) delete[] mTimeSpectrum;
78 
79  mEnergyDeposits.clear();
80  };
81 
82  void InitializeTimeSpectrum(UInt_t nBins) {
83  mTimeDim = nBins;
84  mTimeSpectrum = new UInt_t[nBins];
85 
86  // Clang does not like this memset();
87  //memset(mTimeSpectrum, 0x00, sizeof(mTimeSpectrum));
88  for(unsigned iq=0; iq<nBins; iq++)
89  mTimeSpectrum[iq] = 0;
90  };
91 
92  std::map<std::string, EnergyDeposit> mEnergyDeposits; // energy deposit map in cell passive & sensitive material(s); [GeV]
93 
94  // Transient variable used in the reconstruction code;
95  mutable Double_t mEstimatedEnergyDeposit;
96 
97  // Basically number of registered photons in [ns] time bins;
98  UInt_t mTimeDim; // time spectrum array dimension
99  UInt_t *mTimeSpectrum; //[mTimeDim] time distribution of registered photons
100 
101  // Noise contribution;
102  Long64_t mNoisePhotonCount; // noise photons collected in this cell
103 
104  // Sum over all parent's mPhotonCount and noise contribution; transient;
105  //Long64_t mPhotonCountSum; //!
106 
107  // Index is <primary mother ID, secondary mother ID>;
108  std::map<std::pair<UInt_t, UInt_t>, CalorimeterCellParent> mCellParents; // inputs from different parent particles
109 
110  Long64_t GetPhotonCountSum() const {
111  Long64_t sum = 0;
112 
113  // There was a clear bug fixed here on 2016/07/14 ('return' in a wrong place); check performance!!!;
114  //assert(0);
115 
116  for (std::map<std::pair<UInt_t, UInt_t>, CalorimeterCellParent>::const_iterator jt=mCellParents.begin();
117  jt!=mCellParents.end(); ++jt) {
118  const CalorimeterCellParent *parent = &jt->second;
119 
120  sum += parent->mSignalPhotonCount;
121 
122  //return sum + mNoisePhotonCount;
123  } //for jt (parents)
124 
125  return sum + mNoisePhotonCount;
126  };
127 
129 };
130 
131 //
132 // Try to go without FairHit inheritance first; also no big reason
133 // to inherit from EicDigiHit (used for tracking); think later;
134 //
136 {
138 
139  public:
141  EicCalorimeterDigiHit(ULogicalIndex_t xy, /*UInt_t primaryMother,*/ const CalorimeterCell *cell): mUsed(0) {
142  mCoord = xy;
143  //mPrimaryMother = primaryMother;
144  mPtrCell = cell;
145  };
147 
148  private:
149  // A working variable used in reconstruction code;
150  UInt_t mUsed;
151 
152  ULogicalIndex_t mCoord; // encoded XY coordinates of the respective calorimeter cell
153  //UInt_t mPrimaryMother; // primary mother ID
154  const CalorimeterCell *mPtrCell; //-> pointer to cell frame
155 
157 };
158 
159 #endif