Belle II Software light-2406-ragdoll
eclCluster.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 <mdst/dataobjects/ECLCluster.h>
9#include <gtest/gtest.h>
10#include <cmath>
11#include <TMatrixD.h>
12
13using namespace std;
14
15namespace Belle2 {
24 class ECLClusterTest : public ::testing::Test {
25 protected:
26 };
27
29 TEST_F(ECLClusterTest, Constructors)
30 {
31 ECLCluster myECLCluster;
32
33 EXPECT_EQ(exp(-5.), myECLCluster.getEnergy(ECLCluster::EHypothesisBit::c_nPhotons));
34 EXPECT_EQ(exp(-5.), myECLCluster.getEnergyRaw());
35 EXPECT_EQ(exp(-5.), myECLCluster.getEnergyHighestCrystal());
36 EXPECT_EQ(0, myECLCluster.getTheta());
37 EXPECT_EQ(0, myECLCluster.getPhi());
38 EXPECT_EQ(0, myECLCluster.getR());
39 EXPECT_EQ(0, myECLCluster.getTime());
40 EXPECT_EQ(0, myECLCluster.getDeltaTime99());
41 EXPECT_EQ(0, myECLCluster.getStatus());
42 EXPECT_EQ(0, myECLCluster.getNumberOfCrystals());
43 EXPECT_EQ(0, myECLCluster.getLAT());
44 EXPECT_EQ(0, myECLCluster.getAbsZernike40());
45 EXPECT_EQ(0, myECLCluster.getAbsZernike51());
46 EXPECT_EQ(0, myECLCluster.getZernikeMVA());
47 EXPECT_EQ(0, myECLCluster.getE1oE9());
48 EXPECT_EQ(0, myECLCluster.getE9oE21());
49
50 EXPECT_EQ(0, myECLCluster.getUncertaintyEnergy());
51 EXPECT_EQ(0, myECLCluster.getUncertaintyTheta());
52 EXPECT_EQ(0, myECLCluster.getUncertaintyPhi());
53
54 EXPECT_FALSE(myECLCluster.isTrack());
55 EXPECT_TRUE(myECLCluster.isNeutral());
56
57 double x = myECLCluster.getClusterPosition().X();
58 double y = myECLCluster.getClusterPosition().Y();
59 double z = myECLCluster.getClusterPosition().Z();
60 EXPECT_EQ(0, x);
61 EXPECT_EQ(0, y);
62 EXPECT_EQ(0, z);
63
64 const auto error3x3 = myECLCluster.getCovarianceMatrix3x3();
65 EXPECT_EQ(0, error3x3(0, 0));
66 EXPECT_EQ(0, error3x3(0, 1));
67 EXPECT_EQ(0, error3x3(0, 2));
68 EXPECT_EQ(0, error3x3(1, 0));
69 EXPECT_EQ(0, error3x3(1, 1));
70 EXPECT_EQ(0, error3x3(1, 2));
71 EXPECT_EQ(0, error3x3(2, 0));
72 EXPECT_EQ(0, error3x3(2, 1));
73 EXPECT_EQ(0, error3x3(2, 2));
74
75 } // default constructor
76
78 TEST_F(ECLClusterTest, SettersAndGetters)
79 {
80 ECLCluster myECLCluster;
81 // Pick some arbitrary numbers to test with
82 const bool isTrack = true;
83 const double energy = 1.165;
84 const float theta = 1.2;
85 const float phi = 1.2;
86 const double r = 1.2;
87 const double energyDepSum = 12.3;
88 const double time = 17.2;
89 const double deltaTime99 = 1.1;
90 const double E9oE21 = 0.1;
91 const double highestEnergy = 32.1;
92 const double lat = 0.5;
93 const double nOfCrystals = 4;
95 // Energy->[0], Phi->[2], Theta->[5]
96 double error[6] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6};
97
98 myECLCluster.setEnergy(energy);
99 myECLCluster.setE9oE21(E9oE21);
100 myECLCluster.setEnergyRaw(energyDepSum);
101 myECLCluster.setTheta(theta);
102 myECLCluster.setPhi(phi);
103 myECLCluster.setR(r);
104 myECLCluster.setTime(time);
105 myECLCluster.setDeltaTime99(deltaTime99);
106 myECLCluster.setEnergyHighestCrystal(highestEnergy);
107 myECLCluster.setStatus(status);
108 myECLCluster.setNumberOfCrystals(nOfCrystals);
109 myECLCluster.setLAT(lat);
110 myECLCluster.setCovarianceMatrix(error);
111 myECLCluster.setIsTrack(isTrack);
113
114 EXPECT_FLOAT_EQ(energy, myECLCluster.getEnergy(ECLCluster::EHypothesisBit::c_nPhotons));
115 EXPECT_FLOAT_EQ(E9oE21, myECLCluster.getE9oE21());
116 EXPECT_FLOAT_EQ(energyDepSum, myECLCluster.getEnergyRaw());
117 EXPECT_FLOAT_EQ(theta, myECLCluster.getTheta());
118 EXPECT_FLOAT_EQ(phi, myECLCluster.getPhi());
119 EXPECT_FLOAT_EQ(r, myECLCluster.getR());
120 EXPECT_FLOAT_EQ(time, myECLCluster.getTime());
121 EXPECT_FLOAT_EQ(deltaTime99, myECLCluster.getDeltaTime99());
122 EXPECT_FLOAT_EQ(highestEnergy, myECLCluster.getEnergyHighestCrystal());
123 EXPECT_TRUE(myECLCluster.hasStatus(status));
124 EXPECT_FLOAT_EQ(nOfCrystals, myECLCluster.getNumberOfCrystals());
125 EXPECT_FLOAT_EQ(lat, myECLCluster.getLAT());
126
127 EXPECT_FLOAT_EQ(error[0], myECLCluster.getUncertaintyEnergy()*myECLCluster.getUncertaintyEnergy());
128 EXPECT_FLOAT_EQ(error[5], myECLCluster.getUncertaintyTheta()*myECLCluster.getUncertaintyTheta());
129 EXPECT_FLOAT_EQ(error[2], myECLCluster.getUncertaintyPhi()*myECLCluster.getUncertaintyPhi());
130
131 EXPECT_TRUE(myECLCluster.isTrack());
132 EXPECT_FALSE(myECLCluster.isNeutral());
133
134 const auto error3x3 = myECLCluster.getCovarianceMatrix3x3();
135 EXPECT_FLOAT_EQ(error[0], error3x3(0, 0));
136 EXPECT_FLOAT_EQ(error[1], error3x3(0, 1));
137 EXPECT_FLOAT_EQ(error[3], error3x3(0, 2));
138 EXPECT_FLOAT_EQ(error[1], error3x3(1, 0));
139 EXPECT_FLOAT_EQ(error[2], error3x3(1, 1));
140 EXPECT_FLOAT_EQ(error[4], error3x3(1, 2));
141 EXPECT_FLOAT_EQ(error[3], error3x3(2, 0));
142 EXPECT_FLOAT_EQ(error[4], error3x3(2, 1));
143 EXPECT_FLOAT_EQ(error[5], error3x3(2, 2));
144
145 } // default constructor
146
147
149} // namespace
Test class for the Track object.
Definition: eclCluster.cc:24
ECL cluster data.
Definition: ECLCluster.h:27
void setE9oE21(double E9oE21)
Set E9/E21 energy ratio.
Definition: ECLCluster.h:193
bool isTrack() const
Return true if the cluster matches with track.
Definition: ECLCluster.h:235
void setTheta(double theta)
Set Theta of Shower (radian).
Definition: ECLCluster.h:217
EStatusBit
The status information for the ECLCluster.
Definition: ECLCluster.h:49
@ c_PulseShapeDiscrimination
bit 2: ECLCluster has pulse shape discrimination variables.
void setPhi(double phi)
Set Phi of Shower (radian).
Definition: ECLCluster.h:220
TMatrixDSym getCovarianceMatrix3x3() const
Return TMatrixDsym 3x3 covariance matrix for E, Phi and Theta.
Definition: ECLCluster.cc:52
double getPhi() const
Return Corrected Phi of Shower (radian).
Definition: ECLCluster.h:304
void setEnergyHighestCrystal(double energyhighestcrystal)
Set energy of highest energetic crystal (GeV).
Definition: ECLCluster.h:232
void setEnergyRaw(double energyraw)
Set Uncorrect Energy deposited (GeV).
Definition: ECLCluster.h:229
double getE1oE9() const
Return E1/E9 (shower shape variable).
Definition: ECLCluster.h:277
void setTime(double time)
Set time information.
Definition: ECLCluster.h:211
void setCovarianceMatrix(double covArray[6])
Set covariance matrix (3x3), i.e.
Definition: ECLCluster.h:152
double getR() const
Return R.
Definition: ECLCluster.h:310
double getEnergyRaw() const
Return Uncorrected Energy deposited (GeV)
Definition: ECLCluster.h:316
double getUncertaintyTheta() const
Return Uncertainty on Theta of Shower.
Definition: ECLCluster.h:325
double getLAT() const
Return LAT (shower shape variable).
Definition: ECLCluster.h:292
bool hasStatus(EStatusBit bitmask) const
Return if specific status bit is set.
Definition: ECLCluster.h:344
double getE9oE21() const
Return E9/E21 (shower shape variable).
Definition: ECLCluster.h:280
void setDeltaTime99(double dtime99)
Set 99% time containment range.
Definition: ECLCluster.h:214
void setStatus(EStatusBit status)
Set status.
Definition: ECLCluster.h:107
unsigned short getStatus() const
Return status.
Definition: ECLCluster.h:241
void setLAT(double LAT)
Set Lateral distribution parameter.
Definition: ECLCluster.h:205
double getEnergy(EHypothesisBit hypothesis) const
Return Energy (GeV).
Definition: ECLCluster.cc:23
void setHypothesis(EHypothesisBit hypothesis)
Set hypotheses.
Definition: ECLCluster.h:123
double getUncertaintyEnergy() const
Return Uncertainty on Energy of Shower.
Definition: ECLCluster.h:322
void setNumberOfCrystals(double noc)
Set number of crystals (sum of weights).
Definition: ECLCluster.h:208
void setEnergy(double energy)
Set Corrected Energy (GeV).
Definition: ECLCluster.h:226
double getNumberOfCrystals() const
Return number of a crystals in a shower (sum of weights).
Definition: ECLCluster.h:295
double getEnergyHighestCrystal() const
Return energy of highest energetic crystal in cluster (GeV)
Definition: ECLCluster.h:319
double getZernikeMVA() const
Return MVA based hadron/photon value based on Zernike moments (shower shape variable).
Definition: ECLCluster.h:274
ROOT::Math::XYZVector getClusterPosition() const
Return ROOT::Math::XYZVector on cluster position (x,y,z)
Definition: ECLCluster.cc:44
double getUncertaintyPhi() const
Return Uncertainty on Phi of Shower.
Definition: ECLCluster.h:328
double getAbsZernike40() const
Return Zernike moment 40 (shower shape variable).
Definition: ECLCluster.h:268
bool isNeutral() const
Return true if cluster has no match with track.
Definition: ECLCluster.h:238
double getTheta() const
Return Corrected Theta of Shower (radian).
Definition: ECLCluster.h:307
double getDeltaTime99() const
Return cluster delta time 99.
Definition: ECLCluster.h:301
void setIsTrack(bool istrack)
Set m_isTrack true if the cluster matches with a track.
Definition: ECLCluster.h:104
double getTime() const
Return cluster time.
Definition: ECLCluster.h:298
@ c_nPhotons
CR is split into n photons (N1)
void setR(double r)
Set R (in cm).
Definition: ECLCluster.h:223
double getAbsZernike51() const
Return Zernike moment 51 (shower shape variable).
Definition: ECLCluster.h:271
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24
STL namespace.