Belle II Software development

Modules

 klm data objects
 
 klm modules
 

Classes

class  BKLMDatabaseImporter
 This module writes BKLM data to database. More...
 
class  KLMCalibrationChecker
 KLM calibration checker. More...
 
class  KLMChannelStatusAlgorithm
 KLM channel status calibration algorithm. More...
 
class  KLMDatabaseImporter
 KLM database importer. More...
 
class  KLMDisplacementGenerator
 Module for generation of KLM displacement or alignment data. More...
 
class  KLMElectronicsMapImporter
 KLM database importer. More...
 
class  KLMLikelihoodParametersImporter
 This class imports KLMLikelihoodParameters into the database. More...
 
class  KLMStripEfficiencyAlgorithm
 KLM channel status calibration algorithm. More...
 
class  KLMTimeAlgorithm
 KLM time calibration algorithm. More...
 
class  BKLMAlignment
 Class to store BKLM alignment data in the database. More...
 
class  BKLMGeometryPar
 The Class for BKLM geometry. More...
 
class  BKLMSimulationPar
 Provides BKLM simulation parameters. More...
 
class  EKLMAlignment
 Class to store EKLM alignment data in the database. More...
 
class  EKLMGeometry
 Class to store EKLM geometry data in the database. More...
 
class  EKLMSegmentAlignment
 Class to store EKLM alignment data in the database. More...
 
class  KLMAlignmentData
 KLM Alignment data. More...
 
class  KLMChannelStatus
 KLM channel status. More...
 
class  KLMElectronicsChannel
 BKLM electronics channel. More...
 
class  KLMElectronicsMap
 BKLM electronics map. More...
 
class  KLMLikelihoodParameters
 Database object used to store the parameters for KLM likelihood computation. More...
 
class  KLMReconstructionParameters
 Class to store KLM reconstruction parameters in the database. More...
 
class  KLMScintillatorDigitizationParameters
 Class to store KLM scintillator simulation parameters in the database. More...
 
class  KLMScintillatorFEEData
 EKLM channel data. More...
 
class  KLMScintillatorFEEParameters
 Class to store EKLM alignment data in the database. More...
 
class  KLMScintillatorFirmware
 KLM scintillator firmware. More...
 
class  KLMStripEfficiency
 DBObject used to store the efficiencies of KLM strips. More...
 
class  KLMTimeCableDelay
 Class to store BKLM delay time coused by cable in the database. More...
 
class  KLMTimeConstants
 Class to store KLM constants related to time. More...
 
class  KLMTimeConversion
 KLM time conversion. More...
 
class  KLMTimeResolution
 Class to store KLM time resolution in the database. More...
 
class  KLMTimeWindow
 DBObject containing KLM time window parameters used in KLMReconstructor module. More...
 
class  EKLMAlignmentAlongStripsAlgorithm
 EKLM time calibration algorithm. More...
 
class  G4TriangularPrism
 Triangular prism. More...
 
class  MuidBuilder
 Build the Muid likelihoods starting from the hit pattern and the transverse scattering in the KLM. More...
 
class  MuidElementNumbers
 Muid element numbers. More...
 
class  KLMMuidLikelihoodTest
 Test class for the KLMMuidLikelihood object. More...
 
class  MuidBuilderTest
 Test for the MuidBuilder class, using the payloads in the default Global Tag. More...
 
class  KLMTime
 KLM time conversion. More...
 

Functions

 TEST_F (KLMMuidLikelihoodTest, KLMMuidLikelihood)
 Test some setters and getters.
 
 TEST_F (MuidBuilderTest, MuidBuilder01)
 Test for a muon with 14 hits in the barrel.
 
 TEST_F (MuidBuilderTest, MuidBuilder02)
 Test for a muon with some discrepancies between hit and ext.
 
 TEST_F (MuidBuilderTest, MuidBuilder03)
 Test for a muon with large discrepancies between hit and ext.
 
 TEST_F (MuidBuilderTest, MuidBuilder04)
 Test for a muon with hits in both barrel and endcaps.
 
 TEST_F (MuidBuilderTest, MuidBuilder05)
 Test for a muon with hits in both barrel and endcaps.
 

Detailed Description

Function Documentation

◆ TEST_F() [1/6]

Test some setters and getters.

Definition at line 53 of file KLMMuidLikelihoodTest.cc.

54 {
55 StoreArray<KLMMuidLikelihood> muids;
56
57 // Test the non-default constructor
58 int pdg = Const::muon.getPDGCode();
59 m_muid = muids.appendNew();
60 m_muid->setPDGCode(pdg);
61 EXPECT_EQ(m_muid->getPDGCode(), pdg);
62 EXPECT_EQ(m_muid->getOutcome(), 0);
63 EXPECT_EQ(m_muid->getHitLayer(), -1);
64 EXPECT_FLOAT_EQ(m_muid->getLogL_mu(), -1.0E20);
65
66 // Test the efficiency methods
67 int layer = 4;
68 float efficiency = 0.2;
69 m_muid->setExtBKLMEfficiencyValue(layer, efficiency);
70 EXPECT_FLOAT_EQ(m_muid->getExtBKLMEfficiencyValue(layer), efficiency);
71 m_muid->setExtEKLMEfficiencyValue(layer, efficiency);
72 EXPECT_FLOAT_EQ(m_muid->getExtEKLMEfficiencyValue(layer), efficiency);
73
74 // Test the methods to count the hits and to check the crossed layer
75 // 111111
76 // it means 6 hits in BKLM and 0 in EKLM
77 std::bitset<30> bitPattern(std::string("111111"));
78 unsigned int pattern = static_cast<unsigned int>(bitPattern.to_ulong());
79 m_muid->setHitLayerPattern(pattern);
80 EXPECT_EQ(m_muid->getHitLayerPattern(), pattern);
81 EXPECT_EQ(m_muid->getTotalBarrelHits(), 6);
82 EXPECT_EQ(m_muid->getTotalEndcapHits(), 0);
83 m_muid->setExtLayerPattern(pattern);
84 EXPECT_TRUE(m_muid->isExtrapolatedBarrelLayerCrossed(5));
85 EXPECT_FALSE(m_muid->isExtrapolatedBarrelLayerCrossed(6));
86 EXPECT_FALSE(m_muid->isExtrapolatedEndcapLayerCrossed(0));
87 // 1000000000000000
88 // it means 0 hits in BKLM and 1 in EKLM
89 bitPattern = std::bitset<30>(std::string("1000000000000000"));
90 pattern = static_cast<unsigned int>(bitPattern.to_ulong());
91 m_muid->setHitLayerPattern(pattern);
92 EXPECT_EQ(m_muid->getHitLayerPattern(), pattern);
93 EXPECT_EQ(m_muid->getTotalBarrelHits(), 0);
94 EXPECT_EQ(m_muid->getTotalEndcapHits(), 1);
95 m_muid->setExtLayerPattern(pattern);
96 EXPECT_FALSE(m_muid->isExtrapolatedBarrelLayerCrossed(0));
97 EXPECT_TRUE(m_muid->isExtrapolatedEndcapLayerCrossed(0));
98 EXPECT_FALSE(m_muid->isExtrapolatedEndcapLayerCrossed(1));
99 // 10101000000000111000
100 // it means 3 hits in BKLM and 3 in EKLM
101 bitPattern = std::bitset<30>(std::string("10101000000000111000"));
102 pattern = static_cast<unsigned int>(bitPattern.to_ulong());
103 m_muid->setHitLayerPattern(pattern);
104 EXPECT_EQ(m_muid->getHitLayerPattern(), pattern);
105 EXPECT_EQ(m_muid->getTotalBarrelHits(), 3);
106 EXPECT_EQ(m_muid->getTotalEndcapHits(), 3);
107 m_muid->setExtLayerPattern(pattern);
108 EXPECT_TRUE(m_muid->isExtrapolatedBarrelLayerCrossed(4));
109 EXPECT_TRUE(m_muid->isExtrapolatedEndcapLayerCrossed(0));
110 EXPECT_FALSE(m_muid->isExtrapolatedEndcapLayerCrossed(10));
111 // 11111111111111111111111111111
112 // it means 15 hits in BKLM, 14 in EKLM and 1 "fake" hit
113 bitPattern = std::bitset<30>(std::string("11111111111111111111111111111"));
114 pattern = static_cast<unsigned int>(bitPattern.to_ulong());
115 m_muid->setHitLayerPattern(pattern);
116 EXPECT_EQ(m_muid->getHitLayerPattern(), pattern);
117 EXPECT_EQ(m_muid->getTotalBarrelHits(), 15);
118 EXPECT_EQ(m_muid->getTotalEndcapHits(), 14);
119 m_muid->setExtLayerPattern(pattern);
120 EXPECT_TRUE(m_muid->isExtrapolatedBarrelLayerCrossed(14));
121 EXPECT_FALSE(m_muid->isExtrapolatedBarrelLayerCrossed(15));
122 EXPECT_TRUE(m_muid->isExtrapolatedEndcapLayerCrossed(13));
123 }

◆ TEST_F() [2/6]

TEST_F ( MuidBuilderTest  ,
MuidBuilder01   
)

Test for a muon with 14 hits in the barrel.

Definition at line 80 of file MuidBuilderTest.cc.

81 {
82 StoreArray<KLMMuidLikelihood> muids;
83 int pdg = Const::muon.getPDGCode();
84 std::bitset<30> bitExtPattern(std::string("11111111111111"));
85 unsigned int extPattern = static_cast<unsigned int>(bitExtPattern.to_ulong());
86 unsigned int hitPattern = static_cast<unsigned int>(bitExtPattern.to_ulong());
87 bool isForward = true;
88 bool escaped = false;
89 int lastBarrelLayer = 13;
90 int lastEndcapLayer = -1;
91 unsigned int outcome = MuidElementNumbers::calculateExtrapolationOutcome(isForward, escaped, lastBarrelLayer, lastEndcapLayer);
92 double chiSquared = 29.5;
93 int degreesOfFreedom = 28;
94 m_muid = muids.appendNew();
95 m_muid->setPDGCode(pdg);
96 m_muid->setExtLayerPattern(extPattern);
97 m_muid->setHitLayerPattern(hitPattern);
98 m_muid->setIsForward(isForward);
99 m_muid->setBarrelExtLayer(lastBarrelLayer);
100 m_muid->setEndcapExtLayer(lastBarrelLayer);
101 m_muid->setOutcome(outcome);
102 m_muid->setChiSquared(chiSquared);
103 m_muid->setDegreesOfFreedom(degreesOfFreedom);
104 std::vector<float> logLVector = { -169.215, -0.288937, -46.5124, -49.7292, -72.7715, -96.2517};
105 for (size_t i = 0; i < m_pdgVectorMinus.size(); ++i) {
106 m_muidBuilder = new MuidBuilder(m_pdgVectorMinus.at(i));
107 float logL = std::log(m_muidBuilder->getPDF(m_muid));
108 EXPECT_LT(std::abs(logL - logLVector.at(i)), 10E-4);
109 delete m_muidBuilder;
110 }
111 logLVector.clear();
112 /* Test for the positive-charged hypotheses. */
113 m_pdgVectorPlus = MuidElementNumbers::getPDGVector(1);
114 logLVector = { -169.215, -0.284881, -45.7914, -42.7717, -95.9839, -118.769};
115 for (size_t i = 0; i < m_pdgVectorPlus.size(); ++i) {
116 m_muidBuilder = new MuidBuilder(m_pdgVectorPlus.at(i));
117 float logL = std::log(m_muidBuilder->getPDF(m_muid));
118 EXPECT_LT(std::abs(logL - logLVector.at(i)), 10E-4);
119 delete m_muidBuilder;
120 }
121 }
R E
internal precision of FFTW codelets
bool isForward(int cellId)
Check whether the crystal is in forward ECL.

◆ TEST_F() [3/6]

TEST_F ( MuidBuilderTest  ,
MuidBuilder02   
)

Test for a muon with some discrepancies between hit and ext.

patterns.

Definition at line 124 of file MuidBuilderTest.cc.

125 {
126 StoreArray<KLMMuidLikelihood> muids;
127 int pdg = Const::muon.getPDGCode();
128 std::bitset<30> bitExtPattern(std::string("11111111111111"));
129 unsigned int extPattern = static_cast<unsigned int>(bitExtPattern.to_ulong());
130 std::bitset<30> bitHitPattern(std::string("11011111111101"));
131 unsigned int hitPattern = static_cast<unsigned int>(bitHitPattern.to_ulong());
132 bool isForward = true;
133 bool escaped = false;
134 int lastBarrelLayer = 13;
135 int lastEndcapLayer = -1;
136 unsigned int outcome = MuidElementNumbers::calculateExtrapolationOutcome(isForward, escaped, lastBarrelLayer, lastEndcapLayer);
137 double chiSquared = 23.5;
138 int degreesOfFreedom = 24;
139 m_muid = muids.appendNew();
140 m_muid->setPDGCode(pdg);
141 m_muid->setExtLayerPattern(extPattern);
142 m_muid->setHitLayerPattern(hitPattern);
143 m_muid->setIsForward(isForward);
144 m_muid->setBarrelExtLayer(lastBarrelLayer);
145 m_muid->setEndcapExtLayer(lastBarrelLayer);
146 m_muid->setOutcome(outcome);
147 m_muid->setChiSquared(chiSquared);
148 m_muid->setDegreesOfFreedom(degreesOfFreedom);
149 std::vector<float> logLVector = { -147.07, -6.37567, -40.9424, -43.8204, -63.8973, -84.6684};
150 for (size_t i = 0; i < m_pdgVectorMinus.size(); ++i) {
151 m_muidBuilder = new MuidBuilder(m_pdgVectorMinus.at(i));
152 float logL = std::log(m_muidBuilder->getPDF(m_muid));
153 EXPECT_LT(std::abs(logL - logLVector.at(i)), 10E-4);
154 delete m_muidBuilder;
155 }
156 }

◆ TEST_F() [4/6]

TEST_F ( MuidBuilderTest  ,
MuidBuilder03   
)

Test for a muon with large discrepancies between hit and ext.

patterns.

Definition at line 159 of file MuidBuilderTest.cc.

160 {
161 StoreArray<KLMMuidLikelihood> muids;
162 int pdg = Const::muon.getPDGCode();
163 std::bitset<30> bitExtPattern(std::string("11111111111111"));
164 unsigned int extPattern = static_cast<unsigned int>(bitExtPattern.to_ulong());
165 std::bitset<30> bitHitPattern(std::string("11"));
166 unsigned int hitPattern = static_cast<unsigned int>(bitHitPattern.to_ulong());
167 bool isForward = true;
168 bool escaped = false;
169 int lastBarrelLayer = 1;
170 int lastEndcapLayer = -1;
171 unsigned int outcome = MuidElementNumbers::calculateExtrapolationOutcome(isForward, escaped, lastBarrelLayer, lastEndcapLayer);
172 double chiSquared = 7.5;
173 int degreesOfFreedom = 4;
174 m_muid = muids.appendNew();
175 m_muid->setPDGCode(pdg);
176 m_muid->setExtLayerPattern(extPattern);
177 m_muid->setHitLayerPattern(hitPattern);
178 m_muid->setIsForward(isForward);
179 m_muid->setBarrelExtLayer(lastBarrelLayer);
180 m_muid->setEndcapExtLayer(lastBarrelLayer);
181 m_muid->setOutcome(outcome);
182 m_muid->setChiSquared(chiSquared);
183 m_muid->setDegreesOfFreedom(degreesOfFreedom);
184 std::vector<float> logLVector = { -13.0068, -1.82853, -4.78739, -6.44048, -6.67272, -6.8342};
185 for (size_t i = 0; i < m_pdgVectorMinus.size(); ++i) {
186 m_muidBuilder = new MuidBuilder(m_pdgVectorMinus.at(i));
187 float logL = std::log(m_muidBuilder->getPDF(m_muid));
188 EXPECT_LT(std::abs(logL - logLVector.at(i)), 10E-4);
189 delete m_muidBuilder;
190 }
191 }

◆ TEST_F() [5/6]

TEST_F ( MuidBuilderTest  ,
MuidBuilder04   
)

Test for a muon with hits in both barrel and endcaps.

Definition at line 194 of file MuidBuilderTest.cc.

195 {
196 StoreArray<KLMMuidLikelihood> muids;
197 int pdg = Const::muon.getPDGCode();
198 std::bitset<30> bitExtPattern(std::string("1111111000000000000111"));
199 unsigned int extPattern = static_cast<unsigned int>(bitExtPattern.to_ulong());
200 unsigned int hitPattern = static_cast<unsigned int>(bitExtPattern.to_ulong());
201 /* Test the forward endcap. */
202 bool isForward = true;
203 bool escaped = false;
204 int lastBarrelLayer = 2;
205 int lastEndcapLayer = 6;
206 unsigned int outcome = MuidElementNumbers::calculateExtrapolationOutcome(isForward, escaped, lastBarrelLayer, lastEndcapLayer);
207 double chiSquared = 19.5;
208 int degreesOfFreedom = 20;
209 m_muid = muids.appendNew();
210 m_muid->setPDGCode(pdg);
211 m_muid->setExtLayerPattern(extPattern);
212 m_muid->setHitLayerPattern(hitPattern);
213 m_muid->setIsForward(isForward);
214 m_muid->setBarrelExtLayer(lastBarrelLayer);
215 m_muid->setEndcapExtLayer(lastBarrelLayer);
216 m_muid->setOutcome(outcome);
217 m_muid->setChiSquared(chiSquared);
218 m_muid->setDegreesOfFreedom(degreesOfFreedom);
219 std::vector<float> logLVector = { -44.4325, -0.746618, -17.3903, -18.7434, -25.4178, -34.7886};
220 for (size_t i = 0; i < m_pdgVectorMinus.size(); ++i) {
221 m_muidBuilder = new MuidBuilder(m_pdgVectorMinus.at(i));
222 float logL = std::log(m_muidBuilder->getPDF(m_muid));
223 EXPECT_LT(std::abs(logL - logLVector.at(i)), 10E-4);
224 delete m_muidBuilder;
225 }
226 logLVector.clear();
227 /* Test the backward endcap. */
228 isForward = false;
229 outcome = MuidElementNumbers::calculateExtrapolationOutcome(isForward, escaped, lastBarrelLayer, lastEndcapLayer);
230 m_muid->setIsForward(isForward);
231 m_muid->setOutcome(outcome);
232 logLVector = { -50.7005, -1.11268, -18.3302, -20.7392, -26.5815, -33.6206};
233 for (size_t i = 0; i < m_pdgVectorMinus.size(); ++i) {
234 m_muidBuilder = new MuidBuilder(m_pdgVectorMinus.at(i));
235 float logL = std::log(m_muidBuilder->getPDF(m_muid));
236 EXPECT_LT(std::abs(logL - logLVector.at(i)), 10E-4);
237 delete m_muidBuilder;
238 }
239 }

◆ TEST_F() [6/6]

TEST_F ( MuidBuilderTest  ,
MuidBuilder05   
)

Test for a muon with hits in both barrel and endcaps.

Definition at line 242 of file MuidBuilderTest.cc.

243 {
244 StoreArray<KLMMuidLikelihood> muids;
245 int pdg = Const::muon.getPDGCode();
246 std::bitset<30> bitExtPattern(std::string("1111111000000000000111"));
247 unsigned int extPattern = static_cast<unsigned int>(bitExtPattern.to_ulong());
248 std::bitset<30> bitHitPattern(std::string("1100111000000000000101"));
249 unsigned int hitPattern = static_cast<unsigned int>(bitHitPattern.to_ulong());
250 /* Test the forward endcap. */
251 bool isForward = true;
252 bool escaped = false;
253 int lastBarrelLayer = 2;
254 int lastEndcapLayer = 6;
255 unsigned int outcome = MuidElementNumbers::calculateExtrapolationOutcome(isForward, escaped, lastBarrelLayer, lastEndcapLayer);
256 double chiSquared = 15.5;
257 int degreesOfFreedom = 14;
258 float efficiency = 0.8437;
259 m_muid = muids.appendNew();
260 m_muid->setPDGCode(pdg);
261 m_muid->setExtLayerPattern(extPattern);
262 m_muid->setHitLayerPattern(hitPattern);
263 m_muid->setIsForward(isForward);
264 m_muid->setBarrelExtLayer(lastBarrelLayer);
265 m_muid->setEndcapExtLayer(lastBarrelLayer);
266 m_muid->setOutcome(outcome);
267 m_muid->setChiSquared(chiSquared);
268 m_muid->setDegreesOfFreedom(degreesOfFreedom);
269 for (int layer = 0; layer < BKLMElementNumbers::getMaximalLayerNumber(); ++layer)
270 m_muid->setExtBKLMEfficiencyValue(layer, efficiency);
271 for (int layer = 0; layer < EKLMElementNumbers::getMaximalLayerNumber(); ++layer)
272 m_muid->setExtEKLMEfficiencyValue(layer, efficiency);
273 std::vector<float> logLVector = { -38.1205, -2.43391, -16.0512, -17.094, -23.4617, -31.9516};
274 for (size_t i = 0; i < m_pdgVectorMinus.size(); ++i) {
275 m_muidBuilder = new MuidBuilder(m_pdgVectorMinus.at(i));
276 float logL = std::log(m_muidBuilder->getPDF(m_muid));
277 EXPECT_LT(std::abs(logL - logLVector.at(i)), 10E-4);
278 delete m_muidBuilder;
279 }
280 logLVector.clear();
281 /* Test the backward endcap. */
282 isForward = false;
283 outcome = MuidElementNumbers::calculateExtrapolationOutcome(isForward, escaped, lastBarrelLayer, lastEndcapLayer);
284 m_muid->setIsForward(isForward);
285 m_muid->setOutcome(outcome);
286 logLVector = { -43.7474, -2.51744, -16.6359, -18.5523, -23.8643, -29.9728};
287 for (size_t i = 0; i < m_pdgVectorMinus.size(); ++i) {
288 m_muidBuilder = new MuidBuilder(m_pdgVectorMinus.at(i));
289 float logL = std::log(m_muidBuilder->getPDF(m_muid));
290 EXPECT_LT(std::abs(logL - logLVector.at(i)), 10E-4);
291 delete m_muidBuilder;
292 }
293 }