NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Rich.h
Go to the documentation of this file.
1 
8 #ifndef NAIA_RICH_H
9 #define NAIA_RICH_H
10 
11 // gbatch headers
12 #ifdef ENABLE_PRODUCTION_CODE
13 #include "root.h"
14 #endif
15 
17 #include "Containers/Tof.h"
18 #include "Containers/Utils.h"
19 
20 #include <array>
21 #include <map>
22 #include <vector>
23 
24 namespace NAIA {
25 
29 template <class T> using RichBetaVariable = std::map<Rich::BetaType, T>;
30 
38 class RichBaseData : public TObject {
39 public:
44  bool IsNaF() const;
45 
50  bool HasBetaLIP() const;
51 
58 
65 
66 #ifdef ENABLE_PRODUCTION_CODE
67  bool Fill(RichRingR *ringPtr, RichRingBR *ringBPtr);
68 
69  // void SetMC(bool isMC) { _isMC = isMC; }
70 #endif
71 
76  void Clear();
77 
82  void Dump() const;
83 
91  double BetaConsistency() const;
92 
101  double BetaConsistencyTof(const TofBaseData &tofData) const;
102 
108  int GetTileIndex() const; //< Radiator tile generating the ring
109 
118  bool RingGeomTest() const;
119 
129  struct RichBaseDataR {
131  RichBetaVariable<float> ebeta; //< Error on Measured beta of type defined by Rich::BetaType
132  bool isNaF = false; //< Ring on NaF radiator (true) or AGL (false)
133  bool isGood = false; //< IsClean (i.e. (Status&2)!=0) && getExpectedPhotoelectrons(false)>1e-6
134  std::array<float, 2> Pos{0.0f, 0.0f}; //< (X,Y) postion on the radiator where the ring is generated
135  bool hasBetaLIP = false; //< RICH LIP standalone Reconstruction is available
136  };
137 
138 private:
139  // ugly empty-object optimization trick
140  std::vector<RichBaseDataR> m_beta;
141 
142  ClassDef(RichBaseData, 1)
143 };
144 
153 class RichBase : public OnDemandContainer<RichBase>, public RichBaseData {
154 public:
155  static const std::string BranchName;
156 
158 };
159 
165 class RichPlusData : public TObject {
166 public:
177  // clang-format off
178  short NHitsTot = 0;
179  float NPETotUncorr = 0.0f;
180 
181  short NHitsUsed = 0;
182  float NPEExpUncorr = 0;
183  float NPEExpCorr = 0;
184  float NPEMeasUncorr = 0;
185  float NPEMeasCorr = 0;
186  double Probability = 0.0;
187  short RingPMTs = 0;
188  short RingPMTs2 = 0;
189  short RichPMTs = 0;
190  double ChargeConsistency = 0.0f;
191  float RichCharge = 0.0f;
192  float RichCharge2 = 0.0f;
193 
194  float LIP_ringProb = 0.0f;
195 
196  short NBadClusters = 0;
197  short NSecondaryHits = 0;
198  float NPEHyp1UncorrTot = 0.0f;
199 
200  std::array<short, 2> NHitsHyp1Tot{0, 0};
201  std::array<short, 2> NHitsHyp1OutOfRing{0, 0};
203  // clang-format on
204  };
205 
210  bool IsAvailable() const { return !m_data.empty(); }
211 
217  const RichAdditionalData &GetData() const { return m_data.at(0); }
218 #ifdef ENABLE_PRODUCTION_CODE
219  bool Fill(AMSEventR *evPtr, RichRingR *ringPtr, RichRingBR *ringPtrB, TrTrackR *trackPtr);
220  void FillHyp1Data(RichAdditionalData &data, AMSEventR *evPtr, RichRingR *ringPtr, TrTrackR *trackPtr);
221 
222  void SetMC(bool isMC) { m_isMC = isMC; }
223 #endif
224 
229  void Clear();
230 
235  void Dump() const;
236 
237 private:
238  bool m_isMC = false;
239  std::vector<RichAdditionalData> m_data;
240 
241  ClassDef(RichPlusData, 1)
242 };
243 
252 class RichPlus : public OnDemandContainer<RichPlus>, public RichPlusData {
253 public:
254  static const std::string BranchName;
255 
257 };
258 
259 } // namespace NAIA
260 
261 #endif
void Dump() const
Dump on screen container content.
Definition: Rich.cpp:110
float RichCharge2
Rich Charge ring-&gt;NpExp&gt;0?sqrt(ring-&gt;NpCol/ring-&gt;NpExp):-1;.
Definition: Rich.h:192
int GetTileIndex() const
Get the ID of the radiator tile where the ring is generated.
Definition: Rich.cpp:60
Container class for base Rich info.
Definition: Rich.h:38
std::vector< RichAdditionalData > m_data
Definition: Rich.h:239
float RichCharge
Rich Charge ringPtr-&gt;getCharge2Estimate();.
Definition: Rich.h:191
OnDemandContainer container class description.
float NPEExpUncorr
Expected number of photoelectrons (no correction) ringPtr-&gt;getExpectedPhotoElectrons(false);.
Definition: Rich.h:182
std::array< short, 2 > NHitsHyp1Tot
Number of hits associated with hypothesys (direct, reflected)
Definition: Rich.h:200
double BetaConsistencyTof(const TofBaseData &tofData) const
Get the estimator for beta consistency between Rich and Tof.
Definition: Rich.cpp:51
RichBetaVariable< float > ebeta
Definition: Rich.h:131
void Clear()
Clear container content.
Definition: Rich.cpp:109
Container class for base Tof info.
Definition: Tof.h:46
Container class for additional Rich info.
Definition: Rich.h:165
const RichAdditionalData & GetData() const
Get the Rich additional data.
Definition: Rich.h:217
static const std::string BranchName
Definition: Rich.h:155
double ChargeConsistency
PMT charge consistency.
Definition: Rich.h:190
float NPEHyp1UncorrOutOfRing
Number of photoelectrons associated with hypothesys outside of the ring.
Definition: Rich.h:202
Handy struct for collecting Rich variables.
Definition: Rich.h:176
float NPEExpCorr
Expected number of photoelectrons (with correction) ringPtr-&gt;getExpectedPhotoElectrons();.
Definition: Rich.h:183
short NSecondaryHits
Number of secondary hits.
Definition: Rich.h:197
bool HasBetaLIP() const
Returns true if Standalone LIP beta measurement is available.
Definition: Rich.cpp:11
Mixin class to add &quot;read-on-demand&quot; behavior to an existing container class.
float LIP_ringProb
LIP Standalone: Ring Kolmogorov Prob.
Definition: Rich.h:194
float NPETotUncorr
Total number of photoelectrons (no correction) RichHitR::getCollectedPhotoElectrons() ...
Definition: Rich.h:179
double BetaConsistency() const
Get the estimator for beta consistency between CIEMAT and LIP reconstructions.
Definition: Rich.cpp:43
bool IsAvailable() const
Check if Rich data is actually available for this event. Use before accessing data ...
Definition: Rich.h:210
short RingPMTs
Total number of fired in the ring PMTs ringPtr-&gt;NpColPMT.size();.
Definition: Rich.h:187
float NPEMeasUncorr
Measured number of photoelectrons (no correction)ringPtr-&gt;getPhotoElectrons(false);.
Definition: Rich.h:184
bool RingGeomTest() const
Checks if the track impact point on the radiator falls on the on the edge of the radiator (absolute o...
Definition: Rich.cpp:78
Accessor class for base Rich info.
Definition: Rich.h:153
Measured beta of type defined by Rich::BetaType,.
Definition: Rich.h:129
short NBadClusters
Number of bad Rich clusters.
Definition: Rich.h:196
float NPEHyp1UncorrTot
Number of photoelectrons associated with hypothesys.
Definition: Rich.h:198
short NHitsUsed
Total number of Rich hits used for ring reconstruction RichRingR::getUsedHits()
Definition: Rich.h:181
std::array< short, 2 > NHitsHyp1OutOfRing
Number of hits associated with hypothesys outside of the ring (direct, reflected) ...
Definition: Rich.h:201
bool IsNaF() const
Returns true if the radiator is NaF; false if it is AGL.
Definition: Rich.cpp:19
static const std::string BranchName
Definition: Rich.h:254
std::array< float, 2 > Pos
Definition: Rich.h:134
RichBetaVariable< float > GetBetaError() const
Get the Beta error.
Definition: Rich.cpp:35
Tof container class description.
std::vector< RichBaseDataR > m_beta
Definition: Rich.h:140
short RingPMTs2
Total number of fired in the ring PMTs ringPtr-&gt;getPMTs();.
Definition: Rich.h:188
RichBetaVariable< float > GetBeta() const
Get the Beta measurements.
Definition: Rich.cpp:27
void Dump() const
Dump on screen container content.
Definition: Rich.cpp:9
double Probability
Rich reconstruction Kolmogorov probability.
Definition: Rich.h:186
RichBetaVariable< float > beta
Definition: Rich.h:130
short RichPMTs
Total number of RICH fired PMTs excluded thoese traversed by a track.
Definition: Rich.h:189
short NHitsTot
Total number of Rich hits NRichHit()
Definition: Rich.h:178
std::map< Rich::BetaType, T > RichBetaVariable
Definition: Rich.h:29
float NPEMeasCorr
Measured number of photoelectrons (with correction) ringPtr-&gt;getPhotoElectrons();.
Definition: Rich.h:185
Accessor class for additional Rich info.
Definition: Rich.h:252
void Clear()
Clear container content.
Definition: Rich.cpp:8