Belle II Software  release-06-01-15
ECLShower.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/datastore/RelationsObject.h>
12 #include <TVector3.h>
13 #include <math.h>
14 #include <TMatrixDSym.h>
15 
16 namespace Belle2 {
25  class ECLShower : public RelationsObject {
26  public:
27 
29  enum Hypothesis : unsigned int {
41  c_mergedPi0 = 7
42  };
43 
45  enum StatusBit : unsigned int {
47  c_hasDeadCrystal = 1 << 0,
48 
50  c_hasHotCrystal = 1 << 1,
51 
54 
57 
58  };
59 
62  m_isTrk(false),
63  m_status(0),
64  m_showerId(0),
66  m_hypothesisId(0),
67  m_centralCellId(0),
68  m_energy(0.0),
69  m_energyRaw(0.0),
70  m_theta(0.0),
71  m_phi(0.0),
72  m_r(0.0),
73  m_Error{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
74  m_time(0),
75  m_deltaTime99(0),
77  m_lateralEnergy(0.0),
78  m_minTrkDistance(0.0),
79  m_trkDepth(0.0),
80  m_showerDepth(0.0),
81  m_numberOfCrystals(0.0),
82  m_absZernike40(0.0),
83  m_absZernike51(0.0),
84  m_zernikeMVA(0.0),
85  m_secondMoment(0.0),
86  m_E1oE9(0.0),
87  m_E9oE21(0.0),
97  { }
98 
101  void setIsTrack(bool val) { m_isTrk = val; }
102 
105  void setStatus(int Status) { m_status = Status; }
106 
109  void setShowerId(int ShowerId) { m_showerId = ShowerId; }
110 
113  void setConnectedRegionId(int connectedRegionId) { m_connectedRegionId = connectedRegionId; }
114 
117  void setHypothesisId(int hypothesisId) { m_hypothesisId = hypothesisId; }
118 
121  void setCentralCellId(int centralCellId) { m_centralCellId = centralCellId; }
122 
125  void setEnergy(double Energy) { m_energy = Energy; }
126 
129  void setEnergyRaw(double EnergySum) { m_energyRaw = EnergySum; }
130 
133  void setTheta(double Theta) { m_theta = Theta; }
134 
137  void setPhi(double Phi) { m_phi = Phi; }
138 
141  void setR(double R) { m_r = R; }
142 
148  void setCovarianceMatrix(double covArray[6])
149  {
150  for (unsigned int i = 0; i < 6; i++) {
151  m_Error[i] = covArray[i];
152  }
153  }
154 
157  void setTime(double Time) { m_time = Time; }
158 
161  void setDeltaTime99(double TimeReso) { m_deltaTime99 = TimeReso; }
162 
165  void setEnergyHighestCrystal(double HighestEnergy) { m_energyHighestCrystal = HighestEnergy; }
166 
169  void setLateralEnergy(double lateralEnergy) { m_lateralEnergy = lateralEnergy; }
170 
173  void setMinTrkDistance(double dist) { m_minTrkDistance = dist; }
174 
177  void setTrkDepth(double trkDepth) { m_trkDepth = trkDepth; }
178 
181  void setShowerDepth(double showerDepth) { m_showerDepth = showerDepth; }
182 
185  void setNumberOfCrystals(double nofCrystals) { m_numberOfCrystals = nofCrystals; }
186 
189  void setAbsZernike40(double absZernike40) { m_absZernike40 = absZernike40; }
190 
193  void setAbsZernike51(double absZernike51) { m_absZernike51 = absZernike51; }
194 
197  void setZernikeMVA(double zernikeMVA) {m_zernikeMVA = zernikeMVA; }
198 
201  void setSecondMoment(double secondMoment) { m_secondMoment = secondMoment; }
202 
205  void setE1oE9(double E1oE9) { m_E1oE9 = E1oE9; }
206 
209  void setE9oE21(double E9oE21) { m_E9oE21 = E9oE21; }
210 
213  void setShowerHadronIntensity(double hadronIntensity) { m_ShowerHadronIntensity = hadronIntensity; }
214 
218 
221  void setNumberOfHadronDigits(double NumberOfHadronDigits) { m_NumberOfHadronDigits = NumberOfHadronDigits; }
222 
225  void setNumberOfCrystalsForEnergy(double numberOfCrystalsForEnergy) { m_numberOfCrystalsForEnergy = numberOfCrystalsForEnergy; }
226 
229  void setNominalNumberOfCrystalsForEnergy(double nominalNumberOfCrystalsForEnergy) { m_nominalNumberOfCrystalsForEnergy = nominalNumberOfCrystalsForEnergy; }
230 
233  void setListOfCrystalsForEnergy(const std::vector<unsigned int>& listofcrystals) { m_listOfCrystalsForEnergy = listofcrystals;}
234 
235 
239  bool getIsTrack() const { return m_isTrk; }
240 
244  int getStatus() const { return m_status; }
245 
249  int getShowerId() const { return m_showerId; }
250 
255 
259  int getHypothesisId() const { return m_hypothesisId; }
260 
264  int getCentralCellId() const { return m_centralCellId; }
265 
269  double getEnergy() const { return m_energy; }
270 
274  double getEnergyRaw() const { return m_energyRaw; }
275 
279  double getTheta() const { return m_theta; }
280 
284  double getPhi() const { return m_phi; }
285 
289  double getR() const { return m_r; }
290 
294  void getCovarianceMatrixAsArray(double covArray[6]) const
295  {
296  for (unsigned int i = 0; i < 6; i++) {
297  covArray[i] = m_Error[i];
298  }
299  }
300 
304  double getUncertaintyEnergy() const { return sqrt(m_Error[0]);}
305 
309  double getUncertaintyTheta() const { return sqrt(m_Error[5]);}
310 
314  double getUncertaintyPhi() const {return sqrt(m_Error[2]);}
315 
319  double getTime() const { return m_time; }
320 
324  double getDeltaTime99() const { return m_deltaTime99; }
325 
330 
334  double getLateralEnergy() const { return m_lateralEnergy; }
335 
339  double getMinTrkDistance() const { return m_minTrkDistance; }
340 
344  double getTrkDepth() const { return m_trkDepth; }
345 
349  double getShowerDepth() const { return m_showerDepth; }
350 
354  double getNumberOfCrystals() const { return m_numberOfCrystals; }
355 
359  double getAbsZernike40() const { return m_absZernike40; }
360 
364  double getAbsZernike51() const { return m_absZernike51; }
365 
369  double getZernikeMVA() const {return m_zernikeMVA; }
370 
374  double getSecondMoment() const { return m_secondMoment; }
375 
379  double getE1oE9() const { return m_E1oE9; }
380 
384  double getE9oE21() const { return m_E9oE21; }
385 
390 
395 
400 
405 
410 
414  std::vector<unsigned int>& getListOfCrystalsForEnergy() { return m_listOfCrystalsForEnergy; }
415 
416 
417 
419  TVector3 getMomentum() const
420  {
421  return TVector3(
422  m_energy * sin(m_theta) * cos(m_phi),
423  m_energy * sin(m_theta) * sin(m_phi),
424  m_energy * cos(m_theta)
425  );
426  }
427 
429  TMatrixDSym getCovarianceMatrix3x3() const
430  {
431  TMatrixDSym covmatecl(3);
432  covmatecl(0, 0) = m_Error[0];
433  covmatecl(1, 0) = m_Error[1];
434  covmatecl(1, 1) = m_Error[2];
435  covmatecl(2, 0) = m_Error[3];
436  covmatecl(2, 1) = m_Error[4];
437  covmatecl(2, 2) = m_Error[5];
438 
439  //make symmetric
440  for (int i = 0; i < 3; i++)
441  for (int j = 0; j < i ; j++)
442  covmatecl(j, i) = covmatecl(i, j);
443  return covmatecl;
444  }
445 
447  int getDetectorRegion() const
448  {
449  const double theta = getTheta();
450 
451  if (theta < 0.2164208) return 0; // < 12.4deg
452  if (theta < 0.5480334) return 1; // < 31.4deg
453  if (theta < 0.561996) return 11; // < 32.2deg
454  if (theta < 2.2462387) return 2; // < 128.7deg
455  if (theta < 2.2811453) return 13; // < 130.7deg
456  if (theta < 2.7070057) return 3; // < 155.1deg
457  else return 0;
458  }
459 
465  bool hasStatus(unsigned short int bitmask) const { return (m_status & bitmask) == bitmask; }
466 
471  void addStatus(unsigned short int bitmask) { m_status |= bitmask; }
472 
475  bool hasHotCrystal() const;
476 
479  bool hasDeadCrystal() const;
480 
483  bool hasProblematicCrystal() const;
484 
487  bool hasPulseShapeDiscrimination() const;
488 
490  int getUniqueId() const
491  {
492  return 100000 * m_connectedRegionId + 1000 * m_hypothesisId + m_showerId;
493  }
494 
495 
496  private:
497  bool m_isTrk;
499  int m_status;
505  Double32_t m_energy;
506  Double32_t m_energyRaw;
507  Double32_t m_theta;
508  Double32_t m_phi;
509  Double32_t m_r;
510  Double32_t m_Error[6];
511  Double32_t m_time;
512  Double32_t m_deltaTime99;
514  Double32_t m_lateralEnergy;
515  Double32_t m_minTrkDistance;
516  Double32_t m_trkDepth;
517  Double32_t m_showerDepth;
518  Double32_t m_numberOfCrystals;
519  Double32_t m_absZernike40;
520  Double32_t m_absZernike51;
521  Double32_t m_zernikeMVA;
522  Double32_t m_secondMoment;
523  Double32_t m_E1oE9;
524  Double32_t m_E9oE21;
525  Double32_t
527  Double32_t
529  Double32_t
533  std::vector<unsigned int> m_listOfCrystalsForEnergy;
535  // 2: added uniqueID and highestE (TF)
536  // 3: added LAT and distance to closest track and trk match flag (GDN)
537  // 4: added time resolution (TF)
538  // 5: clean up, float to Double32_t, and new variables (TF)
539  // 6: changed names of Zernike moment variables/getters/setters to indicate that they are the absolute values of the moments (TF and AH)
540  // 7: added centralCellId (TF)
541  // 8: added zernikeMVA, removed absZernike20, 42, 53 (AH)
542  // 9: renamed variables according to the new mdst scheme (TF)
543  // 10: added getUniqueId()
544  // 11: added m_ShowerHadronIntensity and m_NumberOfHadronDigits variables (SL)
545  // 12: added m_PulseShapeDiscriminationMVA. Noted m_ShowerHadronIntensity will be removed in release-04 (SL)
546  // 13: made enums strongly typed
547  // 14: added m_numberOfCrystalsForEnergy of crystals for energy determination
548  // 15: added m_listOfCrystalsForEnergy, m_nominalNumberOfCrystalsForEnergy
551  };
552 
553  inline bool ECLShower::hasHotCrystal() const
554  {
555  return hasStatus(c_hasHotCrystal);
556  }
557 
558  inline bool ECLShower::hasDeadCrystal() const
559  {
560  return hasStatus(c_hasDeadCrystal);
561  }
562 
564  {
566  }
567 
569  {
571  }
572 
574 } // end namespace Belle2
575 
Class to store ECL Showers.
Definition: ECLShower.h:25
ECLShower()
Default constructor for ROOT.
Definition: ECLShower.h:61
Double32_t m_absZernike40
Shower shape variable, absolute value of Zernike Moment 40 (TF)
Definition: ECLShower.h:519
int getStatus() const
Get Status.
Definition: ECLShower.h:244
void setE9oE21(double E9oE21)
Set energy ration E9 over E21.
Definition: ECLShower.h:209
bool m_isTrk
Match with track (GDN)
Definition: ECLShower.h:497
void setEnergyRaw(double EnergySum)
Set Raw Energy Sum.
Definition: ECLShower.h:129
Double32_t m_r
R (cm)
Definition: ECLShower.h:509
Double32_t m_absZernike51
Shower shape variable, absolute value of Zernike Moment 51 (TF)
Definition: ECLShower.h:520
void setPulseShapeDiscriminationMVA(double mvaVal)
Set shower hadron intensity.
Definition: ECLShower.h:217
Double32_t m_zernikeMVA
Shower shape variable, zernike MVA output.
Definition: ECLShower.h:521
void setLateralEnergy(double lateralEnergy)
Set Lateral Energy.
Definition: ECLShower.h:169
void setShowerId(int ShowerId)
Set Shower ID.
Definition: ECLShower.h:109
int m_showerId
Shower ID.
Definition: ECLShower.h:500
ClassDef(ECLShower, 15)
ClassDef.
void setEnergy(double Energy)
Set Energy.
Definition: ECLShower.h:125
void setPhi(double Phi)
Set Phi (rad)
Definition: ECLShower.h:137
int getHypothesisId() const
Get Hypothesis Id.
Definition: ECLShower.h:259
int m_centralCellId
Central cell ID (TF)
Definition: ECLShower.h:503
void setConnectedRegionId(int connectedRegionId)
Set Connected region ID.
Definition: ECLShower.h:113
void addStatus(unsigned short int bitmask)
Add bitmask to current status.
Definition: ECLShower.h:471
void setNumberOfCrystals(double nofCrystals)
Set sum of weights of crystals.
Definition: ECLShower.h:185
double getPulseShapeDiscriminationMVA() const
Get shower hadron intensity.
Definition: ECLShower.h:394
TMatrixDSym getCovarianceMatrix3x3() const
Return TMatrixDsym 3x3 covariance matrix for E, Phi and Theta.
Definition: ECLShower.h:429
void setEnergyHighestCrystal(double HighestEnergy)
Set Highest Energy.
Definition: ECLShower.h:165
double getPhi() const
Get Phi.
Definition: ECLShower.h:284
Double32_t m_numberOfCrystals
Sum of weights of crystals (~number of crystals) (TF)
Definition: ECLShower.h:518
double getLateralEnergy() const
Get Lateral Energy in Shower.
Definition: ECLShower.h:334
Double32_t m_time
Time.
Definition: ECLShower.h:511
Double32_t m_ShowerHadronIntensity
Shower Hadron Component Intensity (pulse shape discrimination variable).
Definition: ECLShower.h:526
double getE1oE9() const
Get energy ratio E1oE9.
Definition: ECLShower.h:379
void setShowerDepth(double showerDepth)
Set path on the average cluster direction.
Definition: ECLShower.h:181
void setAbsZernike51(double absZernike51)
Set absolute value of Zernike moment 51.
Definition: ECLShower.h:193
int getShowerId() const
Get Shower Id.
Definition: ECLShower.h:249
double getEnergy() const
Get Energy.
Definition: ECLShower.h:269
void getCovarianceMatrixAsArray(double covArray[6]) const
Get Error Array for Energy->[0], Phi->[2], Theta->[5].
Definition: ECLShower.h:294
bool hasStatus(unsigned short int bitmask) const
Return if specific status bit is set.
Definition: ECLShower.h:465
void setSecondMoment(double secondMoment)
Set second moment.
Definition: ECLShower.h:201
Double32_t m_E1oE9
Shower shape variable, E1oE9 (TF)
Definition: ECLShower.h:523
TVector3 getMomentum() const
The method to get return TVector3 Momentum.
Definition: ECLShower.h:419
double getShowerDepth() const
path on track extrapolation to POCA to average cluster direction
Definition: ECLShower.h:349
void setCovarianceMatrix(double covArray[6])
Set symmetric Error Array(3x3) for [0]->Error on Energy [2]->Error on Phi [5]->Error on Theta.
Definition: ECLShower.h:148
Double32_t m_trkDepth
Path on track ext.
Definition: ECLShower.h:516
Double32_t m_theta
Theta (rad)
Definition: ECLShower.h:507
int getConnectedRegionId() const
Get Connected region Id.
Definition: ECLShower.h:254
double getR() const
Get R.
Definition: ECLShower.h:289
double getEnergyRaw() const
Get Energy Sum.
Definition: ECLShower.h:274
std::vector< unsigned int > m_listOfCrystalsForEnergy
list of cell ids used for energy calculation (TF)
Definition: ECLShower.h:533
Double32_t m_showerDepth
Same as above, but on the cluster average direction (GDN)
Definition: ECLShower.h:517
void setHypothesisId(int hypothesisId)
Set Hypothesis identifier.
Definition: ECLShower.h:117
StatusBit
The status information for the ECLShowers.
Definition: ECLShower.h:45
@ c_hasDeadCrystal
bit 0: Dead crystal within nominal shower neighbour region.
Definition: ECLShower.h:47
@ c_hasHotCrystal
bit 1: Hot crystal within nominal shower neighbour region.
Definition: ECLShower.h:50
@ c_hasProblematicCrystal
combined flag to test whether the shower is 'problematic'
Definition: ECLShower.h:53
@ c_hasPulseShapeDiscrimination
bit 2: Shower has pulse shape discrimination variables.
Definition: ECLShower.h:56
void setListOfCrystalsForEnergy(const std::vector< unsigned int > &listofcrystals)
Set list of cell ids used for energy calculation.
Definition: ECLShower.h:233
void setTheta(double Theta)
Set Theta (rad)
Definition: ECLShower.h:133
double getUncertaintyTheta() const
Get Error of theta.
Definition: ECLShower.h:309
void setAbsZernike40(double absZernike40)
Set absolute value of Zernike moment 40.
Definition: ECLShower.h:189
int m_connectedRegionId
Connected Region ID (TF)
Definition: ECLShower.h:501
double getNominalNumberOfCrystalsForEnergy() const
Get nominal number of crystals used for energy calculation.
Definition: ECLShower.h:409
void setIsTrack(bool val)
Set Match with Track.
Definition: ECLShower.h:101
double getE9oE21() const
Get energy ratio E9oE21.
Definition: ECLShower.h:384
void setTrkDepth(double trkDepth)
Set path on track extrapolation line to POCA to average cluster direction.
Definition: ECLShower.h:177
double getNumberOfCrystalsForEnergy() const
Get number of crystals used for energy calculation.
Definition: ECLShower.h:404
Double32_t m_PulseShapeDiscriminationMVA
MVA classifier that uses pulse shape discrimination to identify electromagnetic vs hadronic showers.
Definition: ECLShower.h:528
int getUniqueId() const
Return unique identifier.
Definition: ECLShower.h:490
void setCentralCellId(int centralCellId)
Set central cell id.
Definition: ECLShower.h:121
int m_status
Status.
Definition: ECLShower.h:499
int getDetectorRegion() const
Return detector region: 0: below acceptance, 1: FWD, 2: BRL, 3: BWD, 11: FWDGAP, 13: BWDGAP.
Definition: ECLShower.h:447
Hypothesis
The hypothesis ID for ECLShowers.
Definition: ECLShower.h:29
@ c_mergedPi0
CR is reconstructed as merged pi0 (N3)
Definition: ECLShower.h:41
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
Definition: ECLShower.h:39
@ c_chargedHadron
CR is reconstructed as a charged hadron (T2)
Definition: ECLShower.h:33
@ c_muonNPhotons
CR is split into a muon and n photons (T1)
Definition: ECLShower.h:31
@ c_electronNPhotons
CR is split into an electron and n photons (T3)
Definition: ECLShower.h:35
@ c_nPhotons
CR is split into n photons (N1)
Definition: ECLShower.h:37
void setR(double R)
Set R.
Definition: ECLShower.h:141
Double32_t m_minTrkDistance
Distance between shower and closest track (GDN)
Definition: ECLShower.h:515
Double32_t m_deltaTime99
Time that contains 99% of signal crystals.
Definition: ECLShower.h:512
Double32_t m_Error[6]
Error of Energy, Theta and Phi.
Definition: ECLShower.h:510
void setDeltaTime99(double TimeReso)
Set Time Resolution.
Definition: ECLShower.h:161
Double32_t m_secondMoment
Shower shape variable, second moment (for merged pi0) (TF)
Definition: ECLShower.h:522
Double32_t m_E9oE21
Shower shape variable, E9oE25.
Definition: ECLShower.h:524
Double32_t m_lateralEnergy
Lateral Energy in Shower (GDN)
Definition: ECLShower.h:514
std::vector< unsigned int > & getListOfCrystalsForEnergy()
Get list of cellids used for energy calculation.
Definition: ECLShower.h:414
void setNominalNumberOfCrystalsForEnergy(double nominalNumberOfCrystalsForEnergy)
Set nominal number of crystals used for energy calculation.
Definition: ECLShower.h:229
Double32_t m_NumberOfHadronDigits
Number of hadron digits in shower (pulse shape discrimination variable).
Definition: ECLShower.h:530
void setNumberOfCrystalsForEnergy(double numberOfCrystalsForEnergy)
Set number of crystals used for energy calculation.
Definition: ECLShower.h:225
double getUncertaintyEnergy() const
Get Error of Energy.
Definition: ECLShower.h:304
void setShowerHadronIntensity(double hadronIntensity)
Set shower hadron intensity.
Definition: ECLShower.h:213
double getTrkDepth() const
path on track extrapolation to POCA to average cluster direction
Definition: ECLShower.h:344
double getNumberOfHadronDigits() const
Get number of hadron digits.
Definition: ECLShower.h:399
Double32_t m_energyHighestCrystal
Highest Energy in Shower (GeV) (TF)
Definition: ECLShower.h:513
double getMinTrkDistance() const
Get distance to closest Track.
Definition: ECLShower.h:339
double getNumberOfCrystals() const
Get NofCrystals.
Definition: ECLShower.h:354
Double32_t m_nominalNumberOfCrystalsForEnergy
number of crystals used for energy calculation (TF)
Definition: ECLShower.h:532
double getEnergyHighestCrystal() const
Get Highest Energy in Shower.
Definition: ECLShower.h:329
double getZernikeMVA() const
Get Zernike MVA.
Definition: ECLShower.h:369
bool getIsTrack() const
Get if matched with a Track.
Definition: ECLShower.h:239
double getUncertaintyPhi() const
Get Error of phi.
Definition: ECLShower.h:314
double getAbsZernike40() const
Get absolute value of Zernike moment 40.
Definition: ECLShower.h:359
void setTime(double Time)
Set Time.
Definition: ECLShower.h:157
double getShowerHadronIntensity() const
Get shower hadron intensity.
Definition: ECLShower.h:389
int getCentralCellId() const
Get central cell Id.
Definition: ECLShower.h:264
Double32_t m_phi
Phi (rad)
Definition: ECLShower.h:508
Double32_t m_numberOfCrystalsForEnergy
number of crystals used for energy calculation (TF)
Definition: ECLShower.h:531
Double32_t m_energy
Energy (GeV)
Definition: ECLShower.h:505
void setE1oE9(double E1oE9)
Set energy ration E1 over E9.
Definition: ECLShower.h:205
void setNumberOfHadronDigits(double NumberOfHadronDigits)
Set numver of hadron digits.
Definition: ECLShower.h:221
void setStatus(int Status)
Set Status.
Definition: ECLShower.h:105
double getSecondMoment() const
Get second moment.
Definition: ECLShower.h:374
void setZernikeMVA(double zernikeMVA)
SetZernike MVA value.
Definition: ECLShower.h:197
double getTheta() const
Get Theta.
Definition: ECLShower.h:279
double getDeltaTime99() const
Get Time Resolution.
Definition: ECLShower.h:324
Double32_t m_energyRaw
Raw Energy Sum(GeV)
Definition: ECLShower.h:506
void setMinTrkDistance(double dist)
Set Distance to closest track.
Definition: ECLShower.h:173
double getTime() const
Get Time.
Definition: ECLShower.h:319
double getAbsZernike51() const
Get absolute value of Zernike moment 51.
Definition: ECLShower.h:364
int m_hypothesisId
Hypothesis ID (TF)
Definition: ECLShower.h:502
Defines interface for accessing relations of objects in StoreArray.
bool hasProblematicCrystal() const
Check if shower contains a problematic crystal.
Definition: ECLShower.h:563
bool hasPulseShapeDiscrimination() const
Check if shower contains pulse shape discrimination information.
Definition: ECLShower.h:568
bool hasHotCrystal() const
Check if shower contains a hot crystal.
Definition: ECLShower.h:553
bool hasDeadCrystal() const
Check if shower contains a dead crystal.
Definition: ECLShower.h:558
Abstract base class for different kinds of events.