Belle II Software  release-06-02-00
eclShower.cc
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 #include <ecl/dataobjects/ECLShower.h>
9 
10 #include <gtest/gtest.h>
11 
12 using namespace std;
13 
14 namespace Belle2 {
21  class ECLShowerTest : public ::testing::Test {
22  };
23 
25  TEST_F(ECLShowerTest, Constructors)
26  {
27  ECLShower myECLShower;
28  EXPECT_EQ(myECLShower.getIsTrack(), 0);
29 
30  EXPECT_EQ(myECLShower.getStatus(), 0);
31  EXPECT_EQ(myECLShower.getShowerId(), 0);
32  EXPECT_EQ(myECLShower.getConnectedRegionId(), 0);
33  EXPECT_EQ(myECLShower.getHypothesisId(), 0);
34  EXPECT_EQ(myECLShower.getEnergy(), 0);
35  EXPECT_EQ(myECLShower.getTheta(), 0);
36  EXPECT_EQ(myECLShower.getPhi(), 0);
37  EXPECT_EQ(myECLShower.getR(), 0);
38  EXPECT_EQ(myECLShower.getUncertaintyEnergy(), 0);
39  EXPECT_EQ(myECLShower.getUncertaintyTheta(), 0);
40  EXPECT_EQ(myECLShower.getUncertaintyPhi(), 0);
41  EXPECT_EQ(myECLShower.getTime(), 0);
42  EXPECT_EQ(myECLShower.getDeltaTime99(), 0);
43  EXPECT_EQ(myECLShower.getEnergyHighestCrystal(), 0);
44  EXPECT_EQ(myECLShower.getLateralEnergy(), 0);
45  EXPECT_EQ(myECLShower.getMinTrkDistance(), 0);
46  EXPECT_EQ(myECLShower.getTrkDepth(), 0);
47  EXPECT_EQ(myECLShower.getShowerDepth(), 0);
48  EXPECT_EQ(myECLShower.getNumberOfCrystals(), 0);
49  EXPECT_EQ(myECLShower.getAbsZernike40(), 0);
50  EXPECT_EQ(myECLShower.getAbsZernike51(), 0);
51  EXPECT_EQ(myECLShower.getZernikeMVA(), 0);
52  EXPECT_EQ(myECLShower.getSecondMoment(), 0);
53  EXPECT_EQ(myECLShower.getE1oE9(), 0);
54  EXPECT_EQ(myECLShower.getE9oE21(), 0);
55 
56  double errorArray[6];
57  myECLShower.getCovarianceMatrixAsArray(errorArray);
58  EXPECT_EQ(errorArray[0], 0);
59  EXPECT_EQ(errorArray[1], 0);
60  EXPECT_EQ(errorArray[2], 0);
61  EXPECT_EQ(errorArray[3], 0);
62  EXPECT_EQ(errorArray[4], 0);
63  EXPECT_EQ(errorArray[5], 0);
64 
65  TVector3 momentum(myECLShower.getMomentum());
66  EXPECT_EQ(momentum.X(), 0);
67  EXPECT_EQ(momentum.Y(), 0);
68  EXPECT_EQ(momentum.Z(), 0);
69  } // Testcases for Something
70 
72  TEST_F(ECLShowerTest, SettersAndGetters)
73  {
74  const bool isTrk = true;
75 
76  const int status = 5;
77  const int showerId = 6;
78  const int connectedRegionId = 7;
79  const int hypothesisId = 8;
80 
81  const double energy = 1.1;
82  const double theta = 1.2;
83  const double phi = 1.3;
84  const double r = 1.4;
85  double error[6] = {2.1, 2.2, 2.3, 2.4, 2.5, 2.6};
86  const double time = 1.5;
87  const double timeResolution = 1.6;
88  const double highestEnergy = 1.7;
89  const double lateralEnergy = 1.8;
90  const double minTrkDistance = 1.9;
91  const double trkDepth = 4.1;
92  const double showerDepth = 3.1;
93  const double NofCrystals = 3.2;
94  const double absZernike40 = 1.1;
95  const double absZernike51 = 0.1;
96  const double zernikeMVA = 0.5;
97  const double secondMoment = 5.1;
98  const double E1oE9 = 3.8;
99  const double E9oE21 = 3.9;
100 
101  ECLShower myECLShower;
102  myECLShower.setIsTrack(isTrk);
103  myECLShower.setStatus(status);
104  myECLShower.setShowerId(showerId);
105  myECLShower.setConnectedRegionId(connectedRegionId);
106  myECLShower.setHypothesisId(hypothesisId);
107  myECLShower.setEnergy(energy);
108  myECLShower.setTheta(theta);
109  myECLShower.setPhi(phi);
110  myECLShower.setR(r);
111  myECLShower.setCovarianceMatrix(error);
112  myECLShower.setTime(time);
113  myECLShower.setDeltaTime99(timeResolution);
114  myECLShower.setEnergyHighestCrystal(highestEnergy);
115  myECLShower.setLateralEnergy(lateralEnergy);
116  myECLShower.setMinTrkDistance(minTrkDistance);
117  myECLShower.setTrkDepth(trkDepth);
118  myECLShower.setShowerDepth(showerDepth);
119  myECLShower.setNumberOfCrystals(NofCrystals);
120  myECLShower.setAbsZernike40(absZernike40);
121  myECLShower.setAbsZernike51(absZernike51);
122  myECLShower.setZernikeMVA(zernikeMVA);
123  myECLShower.setSecondMoment(secondMoment);
124  myECLShower.setE1oE9(E1oE9);
125  myECLShower.setE9oE21(E9oE21);
126 
127  EXPECT_EQ(myECLShower.getIsTrack(), isTrk);
128  EXPECT_EQ(myECLShower.getStatus(), status);
129  EXPECT_EQ(myECLShower.getShowerId(), showerId);
130  EXPECT_EQ(myECLShower.getConnectedRegionId(), connectedRegionId);
131  EXPECT_EQ(myECLShower.getHypothesisId(), hypothesisId);
132  EXPECT_EQ(myECLShower.getEnergy(), energy);
133  EXPECT_EQ(myECLShower.getTheta(), theta);
134  EXPECT_EQ(myECLShower.getPhi(), phi);
135  EXPECT_EQ(myECLShower.getUncertaintyEnergy(), sqrt(error[0]));
136  EXPECT_EQ(myECLShower.getUncertaintyTheta(), sqrt(error[5]));
137  EXPECT_EQ(myECLShower.getUncertaintyPhi(), sqrt(error[2]));
138  EXPECT_EQ(myECLShower.getTime(), time);
139  EXPECT_EQ(myECLShower.getDeltaTime99(), timeResolution);
140  EXPECT_EQ(myECLShower.getEnergyHighestCrystal(), highestEnergy);
141  EXPECT_EQ(myECLShower.getLateralEnergy(), lateralEnergy);
142  EXPECT_EQ(myECLShower.getMinTrkDistance(), minTrkDistance);
143  EXPECT_EQ(myECLShower.getTrkDepth(), trkDepth);
144  EXPECT_EQ(myECLShower.getShowerDepth(), showerDepth);
145  EXPECT_EQ(myECLShower.getMinTrkDistance(), minTrkDistance);
146  EXPECT_EQ(myECLShower.getTrkDepth(), trkDepth);
147  EXPECT_EQ(myECLShower.getNumberOfCrystals(), NofCrystals);
148  EXPECT_EQ(myECLShower.getAbsZernike40(), absZernike40);
149  EXPECT_EQ(myECLShower.getAbsZernike51(), absZernike51);
150  EXPECT_EQ(myECLShower.getZernikeMVA(), zernikeMVA);
151  EXPECT_EQ(myECLShower.getSecondMoment(), secondMoment);
152  EXPECT_EQ(myECLShower.getE1oE9(), E1oE9);
153  EXPECT_EQ(myECLShower.getE9oE21(), E9oE21);
154 
155 
156  double errorArray[6];
157  myECLShower.getCovarianceMatrixAsArray(errorArray);
158  EXPECT_EQ(errorArray[0], error[0]);
159  EXPECT_EQ(errorArray[1], error[1]);
160  EXPECT_EQ(errorArray[2], error[2]);
161  EXPECT_EQ(errorArray[3], error[3]);
162  EXPECT_EQ(errorArray[4], error[4]);
163  EXPECT_EQ(errorArray[5], error[5]);
164 
165  TVector3 momentum(myECLShower.getMomentum());
166  EXPECT_FLOAT_EQ(momentum.X(), energy * sin(theta) * cos(phi));
167  EXPECT_FLOAT_EQ(momentum.Y(), energy * sin(theta) * sin(phi));
168  EXPECT_FLOAT_EQ(momentum.Z(), energy * cos(theta));
169  } // Testcases for Setters and Getters
170 
172 } // namespace
Set up a few arrays and objects in the datastore.
Definition: eclShower.cc:21
Class to store ECL Showers.
Definition: ECLShower.h:25
int getStatus() const
Get Status.
Definition: ECLShower.h:244
void setE9oE21(double E9oE21)
Set energy ration E9 over E21.
Definition: ECLShower.h:209
void setLateralEnergy(double lateralEnergy)
Set Lateral Energy.
Definition: ECLShower.h:169
void setShowerId(int ShowerId)
Set Shower ID.
Definition: ECLShower.h:109
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
void setConnectedRegionId(int connectedRegionId)
Set Connected region ID.
Definition: ECLShower.h:113
void setNumberOfCrystals(double nofCrystals)
Set sum of weights of crystals.
Definition: ECLShower.h:185
void setEnergyHighestCrystal(double HighestEnergy)
Set Highest Energy.
Definition: ECLShower.h:165
double getPhi() const
Get Phi.
Definition: ECLShower.h:284
double getLateralEnergy() const
Get Lateral Energy in Shower.
Definition: ECLShower.h:334
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
void setSecondMoment(double secondMoment)
Set second moment.
Definition: ECLShower.h:201
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
int getConnectedRegionId() const
Get Connected region Id.
Definition: ECLShower.h:254
double getR() const
Get R.
Definition: ECLShower.h:289
void setHypothesisId(int hypothesisId)
Set Hypothesis identifier.
Definition: ECLShower.h:117
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
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
void setR(double R)
Set R.
Definition: ECLShower.h:141
void setDeltaTime99(double TimeReso)
Set Time Resolution.
Definition: ECLShower.h:161
double getUncertaintyEnergy() const
Get Error of Energy.
Definition: ECLShower.h:304
double getTrkDepth() const
path on track extrapolation to POCA to average cluster direction
Definition: ECLShower.h:344
double getMinTrkDistance() const
Get distance to closest Track.
Definition: ECLShower.h:339
double getNumberOfCrystals() const
Get NofCrystals.
Definition: ECLShower.h:354
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
void setE1oE9(double E1oE9)
Set energy ration E1 over E9.
Definition: ECLShower.h:205
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
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
TEST_F(ECLShowerTest, SettersAndGetters)
Test Setters and Getter.
Definition: eclShower.cc:72
Abstract base class for different kinds of events.