Belle II Software development
DataWriterModule.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
9
10
11#include <reconstruction/modules/KlId/DataWriter/DataWriterModule.h>
12#include <mdst/dataobjects/KlId.h>
13
14#include <framework/datastore/StoreArray.h>
15
16#include <tracking/dataobjects/TrackClusterSeparation.h>
17
18#include <analysis/ClusterUtility/ClusterUtils.h>
19
20#include <TTree.h>
21#include <TFile.h>
22#include <utility>
23#include <Math/VectorUtil.h>
24
25#include "reconstruction/modules/KlId/KLMExpert/KlId.h"
26
27using namespace std;
28using namespace Belle2;
29using namespace Belle2::KlongId;
30
31
32// --------------------------------------Module----------------------------------------------
33
34
35REG_MODULE(DataWriter);
36
38{
39 setDescription("Used to write flat ntuple for KlId classifier trainings for both ECL and KLM KlID. Output is a root file.");
40
41 addParam("outPath", m_outPath, "Output path - where you want your root files to be placed.", m_outPath);
42 addParam("useKLM", m_useKLM, "Write KLM data.", m_useKLM);
43 addParam("useECL", m_useECL, "Write ECL data.", m_useECL);
44}
45
46
47
49{
50}
51
52
54{
55 // require existence of necessary datastore obj
56
57 m_eclClusters.isRequired();
58 m_klmClusters.isRequired();
60
61 m_klmClusters.requireRelationTo(m_mcParticles);
62 m_klmClusters.registerRelationTo(m_eclClusters);
63
64 m_f = new TFile(m_outPath.c_str(), "recreate");
65
66 m_treeECLhadron = new TTree("ECLdataHadron", "ECLdataHadron");
67 m_treeECLgamma = new TTree("ECLdataGamma", "ECLdataGamma");
68
69 // KLM
70 if (m_useKLM) {
71 m_treeKLM = new TTree("KLMdata", "KLMdata");
72 m_treeKLM -> Branch("KLMMCMom", & m_KLMMCMom);
73 m_treeKLM -> Branch("KLMMCPhi", & m_KLMMCPhi);
74 m_treeKLM -> Branch("KLMMCTheta", & m_KLMMCTheta);
75 m_treeKLM -> Branch("KLMMom", & m_KLMMom);
76 m_treeKLM -> Branch("KLMPhi", & m_KLMPhi);
77 m_treeKLM -> Branch("KLMTheta", & m_KLMTheta);
78 m_treeKLM -> Branch("KLMMCLifetime", & m_KLMMCLifetime);
79 m_treeKLM -> Branch("KLMMCPDG", & m_KLMMCPDG);
80 m_treeKLM -> Branch("KLMMCPrimaryPDG", & m_KLMMCPrimaryPDG);
81 m_treeKLM -> Branch("KLMMCStatus", & m_KLMMCStatus);
82 m_treeKLM -> Branch("KLMnCluster", & m_KLMnCluster);
83 m_treeKLM -> Branch("KLMnLayer", & m_KLMnLayer);
84 m_treeKLM -> Branch("KLMnInnermostlayer", & m_KLMnInnermostLayer);
85 m_treeKLM -> Branch("KLMglobalZ", & m_KLMglobalZ);
86 m_treeKLM -> Branch("KLMtime", & m_KLMtime);
87 m_treeKLM -> Branch("KLMinvM", & m_KLMinvM);
88 m_treeKLM -> Branch("KLMTruth", & m_KLMTruth);
89 m_treeKLM -> Branch("KLMdistToNextCl", & m_KLMnextCluster);
90 m_treeKLM -> Branch("KLMenergy", & m_KLMenergy);
91 m_treeKLM -> Branch("KLMaverageInterClusterDist", & m_KLMavInterClusterDist);
92 m_treeKLM -> Branch("KLMhitDepth", & m_KLMhitDepth);
93
94 m_treeKLM -> Branch("KLMECLHypo", & m_KLMECLHypo);
95 m_treeKLM -> Branch("KLMECLZMVA", & m_KLMECLZMVA);
96 m_treeKLM -> Branch("KLMECLZ40", & m_KLMECLZ40);
97 m_treeKLM -> Branch("KLMECLZ51", & m_KLMECLZ51);
98 m_treeKLM -> Branch("KLMECLUncertaintyPhi", & m_KLMECLUncertaintyPhi);
99 m_treeKLM -> Branch("KLMECLUncertaintyTheta", & m_KLMECLUncertaintyTheta);
100 m_treeKLM -> Branch("KLMdistToNextECL", & m_KLMECLDist);
101 m_treeKLM -> Branch("KLMtrackToECL", & m_KLMtrackToECL);
102 m_treeKLM -> Branch("KLMECLEerror", & m_KLMECLEerror);
103 m_treeKLM -> Branch("KLMECLenergy", & m_KLMECLE);
104 m_treeKLM -> Branch("KLMECLE9oE25", & m_KLMECLE9oE25);
105 m_treeKLM -> Branch("KLMECLtiming", & m_KLMECLTiming);
106 m_treeKLM -> Branch("KLMECLTerror", & m_KLMECLTerror);
107 m_treeKLM -> Branch("KLMECLdeltaL", & m_KLMECLdeltaL);
108 m_treeKLM -> Branch("KLMECLmintrackDist", & m_KLMECLminTrackDist);
109 m_treeKLM -> Branch("KLMTrackSepDist", & m_KLMTrackSepDist);
110 m_treeKLM -> Branch("KLMTrackSepAngle", & m_KLMTrackSepAngle);
111 m_treeKLM -> Branch("KLMInitialtrackSepAngle", & m_KLMInitialTrackSepAngle);
112 m_treeKLM -> Branch("KLMTrackRotationAngle", & m_KLMTrackRotationAngle);
113 m_treeKLM -> Branch("KLMTrackClusterSepAngle", & m_KLMTrackClusterSepAngle);
114 m_treeKLM -> Branch("isBeamBKG", & m_isBeamBKG);
115 m_treeKLM -> Branch("KLMKlId", & m_KLMKLid);
116 m_treeKLM -> Branch("KLMAngleToMC", & m_KLMAngleToMC);
117 m_treeKLM -> Branch("KLMMCWeight", & m_KLMMCWeight);
118 m_treeKLM -> Branch("KLMtrackFlag", & m_KLMtrackFlag);
119 m_treeKLM -> Branch("KLMeclFlag", & m_KLMeclFlag);
120 m_treeKLM -> Branch("isSignal", & m_isSignal);
121 }//useKLM
122
123 //ECL
124 if (m_useECL) {
125 m_treeECLhadron = new TTree("ECLdataHadron", "ECLdataHadron");
126 m_treeECLgamma = new TTree("ECLdataGamma", "ECLdataGamma");
127
128 m_treeECLhadron -> Branch("ECLMCMom", & m_ECLMCMom);
129 m_treeECLhadron -> Branch("ECLMCPhi", & m_ECLMCPhi);
130 m_treeECLhadron -> Branch("ECLMCLifetime", & m_ECLMCLifetime);
131 m_treeECLhadron -> Branch("ECLMCPDG", & m_ECLMCPDG);
132 m_treeECLhadron -> Branch("ECLMCTheta", & m_ECLMCTheta);
133 m_treeECLhadron -> Branch("ECLMCLifetime", & m_ECLMCLifetime);
134 m_treeECLhadron -> Branch("ECLMCPDG", & m_ECLMCPDG);
135 m_treeECLhadron -> Branch("ECLMCStatus", & m_ECLMCStatus);
136 m_treeECLhadron -> Branch("ECLMCPrimaryPDG", & m_ECLMCPrimaryPDG);
137 m_treeECLhadron -> Branch("ECLUncertaintyEnergy", & m_ECLUncertaintyEnergy);
138 m_treeECLhadron -> Branch("ECLUncertaintyTheta", & m_ECLUncertaintyTheta);
139 m_treeECLhadron -> Branch("ECLUncertaintyPhi", & m_ECLUncertaintyPhi);
140 m_treeECLhadron -> Branch("ECLMom", & m_ECLMom);
141 m_treeECLhadron -> Branch("ECLPhi", & m_ECLPhi);
142 m_treeECLhadron -> Branch("ECLTheta", & m_ECLTheta);
143 m_treeECLhadron -> Branch("ECLZ", & m_ECLZ);
144 m_treeECLhadron -> Branch("ECLenergy", & m_ECLE);
145 m_treeECLhadron -> Branch("ECLE9oE25", & m_ECLE9oE25);
146 m_treeECLhadron -> Branch("ECLtiming", & m_ECLTiming);
147 m_treeECLhadron -> Branch("ECLR", & m_ECLR);
148 m_treeECLhadron -> Branch("ECLTruth", & m_ECLTruth);
149 m_treeECLhadron -> Branch("ECLZ51", & m_ECLZ51);
150 m_treeECLhadron -> Branch("ECLZ40", & m_ECLZ40);
151 m_treeECLhadron -> Branch("ECLE1oE9", & m_ECLE1oE9);
152 m_treeECLhadron -> Branch("ECL2ndMom", & m_ECL2ndMom);
153 m_treeECLhadron -> Branch("ECLnumChrystals", & m_ECLnumChrystals);
154 m_treeECLhadron -> Branch("ECLLAT", & m_ECLLAT);
155 m_treeECLhadron -> Branch("ECLZMVA", & m_ECLZMVA);
156 m_treeECLhadron -> Branch("ECLKlId", & m_ECLKLid);
157 m_treeECLhadron -> Branch("ECLdeltaL", & m_ECLdeltaL);
158 m_treeECLhadron -> Branch("ECLmintrackDist", & m_ECLminTrkDistance);
159 m_treeECLhadron -> Branch("isBeamBKG", & m_isBeamBKG);
160 m_treeECLhadron -> Branch("ECLMCWeight", & m_ECLMCWeight);
161 m_treeECLhadron -> Branch("isSignal", & m_isSignal);
162
163
164 m_treeECLgamma -> Branch("ECLMCMom", & m_ECLMCMom);
165 m_treeECLgamma -> Branch("ECLMCPhi", & m_ECLMCPhi);
166 m_treeECLgamma -> Branch("ECLMCTheta", & m_ECLMCTheta);
167 m_treeECLgamma -> Branch("ECLMCLifetime", & m_ECLMCLifetime);
168 m_treeECLgamma -> Branch("ECLMCPDG", & m_ECLMCPDG);
169 m_treeECLgamma -> Branch("ECLMCStatus", & m_ECLMCStatus);
170 m_treeECLgamma -> Branch("ECLMCPrimaryPDG", & m_ECLMCPrimaryPDG);
171 m_treeECLgamma -> Branch("ECLUncertaintyEnergy", & m_ECLUncertaintyEnergy);
172 m_treeECLgamma -> Branch("ECLUncertaintyTheta", & m_ECLUncertaintyTheta);
173 m_treeECLgamma -> Branch("ECLUncertaintyPhi", & m_ECLUncertaintyPhi);
174 m_treeECLgamma -> Branch("ECLMom", & m_ECLMom);
175 m_treeECLgamma -> Branch("ECLPhi", & m_ECLPhi);
176 m_treeECLgamma -> Branch("ECLTheta", & m_ECLTheta);
177 m_treeECLgamma -> Branch("ECLZ", & m_ECLZ);
178 m_treeECLgamma -> Branch("ECLenergy", & m_ECLE);
179 m_treeECLgamma -> Branch("ECLE9oE25", & m_ECLE9oE25);
180 m_treeECLgamma -> Branch("ECLtiming", & m_ECLTiming);
181 m_treeECLgamma -> Branch("ECLR", & m_ECLR);
182 m_treeECLgamma -> Branch("ECLTruth", & m_ECLTruth);
183 m_treeECLgamma -> Branch("ECLZ51", & m_ECLZ51);
184 m_treeECLgamma -> Branch("ECLZ40", & m_ECLZ40);
185 m_treeECLgamma -> Branch("ECLE1oE9", & m_ECLE1oE9);
186 m_treeECLgamma -> Branch("ECL2ndMom", & m_ECL2ndMom);
187 m_treeECLgamma -> Branch("ECLnumChrystals", & m_ECLnumChrystals);
188 m_treeECLgamma -> Branch("ECLLAT", & m_ECLLAT);
189 m_treeECLgamma -> Branch("ECLZMVA", & m_ECLZMVA);
190 m_treeECLgamma -> Branch("ECLKlId", & m_ECLKLid);
191 m_treeECLgamma -> Branch("ECLdeltaL", & m_ECLdeltaL);
192 m_treeECLgamma -> Branch("ECLmintrackDist", & m_ECLminTrkDistance);
193 m_treeECLgamma -> Branch("isBeamBKG", & m_isBeamBKG);
194 m_treeECLgamma -> Branch("ECLMCWeight", & m_ECLMCWeight);
195 m_treeECLgamma -> Branch("isSignal", & m_isSignal);
196 }//useECL
197}//init
198
199
201{
202}
203
205{
206}
207
209{
210 // Use the neutralHadron hypothesis for the ECL
212
213 for (const KLMCluster& cluster : m_klmClusters) {
214
215 if (!m_useKLM) {continue;}
216
217 const ROOT::Math::XYZVector& clusterPos = cluster.getClusterPosition();
218
219 m_KLMPhi = clusterPos.Phi();
220 m_KLMTheta = clusterPos.Theta();
221
222 m_KLMglobalZ = clusterPos.Z();
223 m_KLMnCluster = m_klmClusters.getEntries();
224 m_KLMnLayer = cluster.getLayers();
225 m_KLMnInnermostLayer = cluster.getInnermostLayer();
226 m_KLMtime = cluster.getTime();
227 m_KLMinvM = cluster.getMomentum().M2();
228 m_KLMenergy = cluster.getEnergy();
229 m_KLMhitDepth = cluster.getClusterPosition().R();
230 m_KLMtrackFlag = cluster.getAssociatedTrackFlag();
231 m_KLMeclFlag = cluster.getAssociatedEclClusterFlag();
232
233 m_KLMTrackSepDist = -999;
234 m_KLMTrackSepAngle = -999;
238 auto trackSeperations = cluster.getRelationsTo<TrackClusterSeparation>();
239 TrackClusterSeparation* trackSep;
240 float best_dist = 100000000;
241 for (auto trackSeperation : trackSeperations) {
242 float dist = trackSeperation.getDistance();
243 if (dist < best_dist) {
244 best_dist = dist;
245 trackSep = &trackSeperation;
246 m_KLMTrackSepDist = trackSep->getDistance();
247 m_KLMTrackSepAngle = trackSep->getTrackClusterAngle();
248 m_KLMInitialTrackSepAngle = trackSep->getTrackClusterInitialSeparationAngle();
249 m_KLMTrackRotationAngle = trackSep->getTrackRotationAngle();
250 m_KLMTrackClusterSepAngle = trackSep->getTrackClusterSeparationAngle();
251 }
252 }
253
254
255 if (isnan(m_KLMglobalZ)) { m_KLMglobalZ = -999;}
256 if (isnan(m_KLMnCluster)) { m_KLMnCluster = -999;}
257 if (isnan(m_KLMnLayer)) { m_KLMnLayer = -999;}
258 if (isnan(m_KLMnInnermostLayer)) { m_KLMnInnermostLayer = -999;}
259 if (isnan(m_KLMtime)) { m_KLMtime = -999;}
260 if (isnan(m_KLMinvM)) { m_KLMinvM = -999;}
261 if (isnan(m_KLMenergy)) { m_KLMenergy = -999;}
262 if (isnan(m_KLMhitDepth)) { m_KLMhitDepth = -999;}
263 if (isnan(m_KLMTrackSepDist)) { m_KLMTrackSepDist = -999;}
264 if (isnan(m_KLMTrackSepAngle)) { m_KLMTrackSepAngle = -999;}
268
269 // findClosestECLCluster with the c_neutralHadron hypothesis
270 pair<ECLCluster*, double> closestECLAndDist = findClosestECLCluster(clusterPos, eclHypothesis);
271 ECLCluster* closestECLCluster = get<0>(closestECLAndDist);
272 m_KLMECLDist = get<1>(closestECLAndDist);
273
274 if (!(closestECLCluster == nullptr)) {
275 m_KLMECLE = closestECLCluster->getEnergy(eclHypothesis);
276 m_KLMECLE9oE25 = closestECLCluster->getE9oE21();
277 m_KLMECLEerror = closestECLCluster->getUncertaintyEnergy();
278 m_KLMECLTerror = closestECLCluster->getDeltaTime99();
279 m_KLMECLdeltaL = closestECLCluster->getDeltaL();;
280 m_KLMECLminTrackDist = closestECLCluster->getMinTrkDistance();
281 m_KLMECLTiming = closestECLCluster->getTime();
282 m_KLMECLZMVA = closestECLCluster->getZernikeMVA();
283 m_KLMECLZ40 = closestECLCluster->getAbsZernike40();
284 m_KLMECLZ51 = closestECLCluster->getAbsZernike51();
285 m_KLMECLUncertaintyPhi = closestECLCluster->getUncertaintyPhi();
286 m_KLMECLUncertaintyTheta = closestECLCluster->getUncertaintyTheta();
287 m_KLMECLHypo = closestECLCluster->getHypotheses();
288 } else {
289 m_KLMECLdeltaL = -999;
291 m_KLMECLE = -999;
292 m_KLMECLE9oE25 = -999;
293 m_KLMECLTiming = -999;
294 m_KLMECLTerror = -999;
295 m_KLMECLEerror = -999;
296
297 m_KLMECLHypo = -999;
298 m_KLMECLZMVA = -999;
299 m_KLMECLZ40 = -999;
300 m_KLMECLZ51 = -999;
303 }
304
305 tuple<const KLMCluster*, double, double> closestKLMAndDist = findClosestKLMCluster(clusterPos);
306 m_KLMnextCluster = get<1>(closestKLMAndDist);
307 m_KLMavInterClusterDist = get<2>(closestKLMAndDist);
308
309 const auto mcParticleWeightPair = cluster.getRelatedToWithWeight<MCParticle>();
310 MCParticle* part = mcParticleWeightPair.first;
311
314
315 if (part) {
316 m_KLMMCWeight = mcParticleWeightPair.second;
317 m_KLMAngleToMC = ROOT::Math::VectorUtil::Angle(clusterPos, part->getMomentum());
318 m_KLMMCStatus = part->getStatus();
319 m_KLMMCLifetime = part->getLifetime();
320 m_KLMMCPDG = std::abs(part->getPDG());
322 m_KLMMCMom = part->getMomentum().R();
323 m_KLMMCPhi = part->getMomentum().Phi();
324 m_KLMMCTheta = part->getMomentum().Theta();
325 } else {
326 m_KLMMCWeight = -999;
327 m_KLMAngleToMC = -999;
328 m_KLMMCStatus = -999;
329 m_KLMMCLifetime = -999;
330 m_KLMMCPDG = -999;
331 m_KLMMCPrimaryPDG = -999;
332 m_KLMMCMom = -999;
333 m_KLMMCPhi = -999;
334 m_KLMMCTheta = -999;
335 }
336
337 KlId* klid = cluster.getRelatedTo<KlId>();
338 if (klid) {
339 m_KLMKLid = klid->getKlId();
340 } else {
341 m_KLMKLid = -999;
342 }
343 m_isSignal = isKLMClusterSignal(cluster, 0);
344
345
346 m_treeKLM -> Fill();
347 }// for klmcluster in klmclusters
348
349// --------------- ECL CLUSTERS
350 for (const ECLCluster& cluster : m_eclClusters) {
351
352 if (!m_useECL or !cluster.hasHypothesis(eclHypothesis)) {continue;}
353
354 m_ECLminTrkDistance = cluster.getMinTrkDistance();
355 m_ECLdeltaL = cluster.getDeltaL();
356 m_ECLE = cluster.getEnergy(eclHypothesis);
357 m_ECLE9oE25 = cluster.getE9oE21();
358 m_ECLTiming = cluster.getTime();
359 m_ECLR = cluster.getR();
360 m_ECLEerror = cluster.getUncertaintyEnergy();
361 m_ECLZ51 = cluster.getAbsZernike51();
362 m_ECLZ40 = cluster.getAbsZernike40();
363 m_ECLE1oE9 = cluster.getE1oE9();
364 m_ECL2ndMom = cluster.getSecondMoment();
365 m_ECLnumChrystals = cluster.getNumberOfCrystals();
366 m_ECLLAT = cluster.getLAT();
367 m_ECLZMVA = cluster.getZernikeMVA();
368
369 if (isnan(m_ECLminTrkDistance)) { m_ECLminTrkDistance = -999;}
370 if (isnan(m_ECLdeltaL)) { m_ECLdeltaL = -999;}
371 if (isnan(m_ECLE)) { m_ECLE = -999;}
372 if (isnan(m_ECLE9oE25)) { m_ECLE9oE25 = -999;}
373 if (isnan(m_ECLTiming)) { m_ECLTiming = -999;}
374 if (isnan(m_ECLR)) { m_ECLR = -999;}
375 if (isnan(m_ECLEerror)) { m_ECLEerror = -999;}
376 if (isnan(m_ECLZ40)) { m_ECLZ40 = -999;}
377 if (isnan(m_ECLZ51)) { m_ECLZ51 = -999;}
378 if (isnan(m_ECLE1oE9)) { m_ECLE1oE9 = -999;}
379 if (isnan(m_ECL2ndMom)) { m_ECL2ndMom = -999;}
380 if (isnan(m_ECLnumChrystals)) { m_ECLnumChrystals = -999;}
381 if (isnan(m_ECLLAT)) { m_ECLLAT = -999;}
382 if (isnan(m_ECLZMVA)) { m_ECLZMVA = -999;}
383
384 KlId* klid = cluster.getRelatedTo<KlId>();
385 if (klid) {
386 m_ECLKLid = klid->getKlId();
387 } else {
388 m_ECLKLid = -999;
389 }
390
391 const ROOT::Math::XYZVector& clusterPos = cluster.getClusterPosition();
392
393 m_ECLPhi = clusterPos.Phi();
394 m_ECLTheta = clusterPos.Theta();
395 m_ECLZ = clusterPos.Z();
396
397 ClusterUtils C;
398 m_ECLMom = C.Get4MomentumFromCluster(&cluster, eclHypothesis).Vect().Mag2();
399 m_ECLDeltaTime = cluster.getDeltaTime99();
400
401 m_ECLUncertaintyEnergy = cluster.getUncertaintyEnergy();
402 m_ECLUncertaintyTheta = cluster.getUncertaintyTheta();
403 m_ECLUncertaintyPhi = cluster.getUncertaintyPhi();
404
405// MCParticle* part = cluster.getRelatedTo<MCParticle>();
406 const auto mcParticleWeightPair = cluster.getRelatedToWithWeight<MCParticle>();
407 MCParticle* part = mcParticleWeightPair.first;
408
411 if (part) {
412 m_ECLMCWeight = mcParticleWeightPair.second;
413 m_ECLMCStatus = part->getStatus();
414 m_ECLMCLifetime = part->getLifetime();
415 m_ECLMCPDG = std::abs(part->getPDG());
416
418
419 m_ECLMCMom = part->getMomentum().Mag2();
420 m_ECLMCPhi = part->getMomentum().Phi();
421 m_ECLMCTheta = part->getMomentum().Theta();
422 } else {
423 m_ECLMCWeight = -999;
424 m_ECLMCStatus = -999;
425 m_ECLMCLifetime = -999;
426 m_ECLMCPrimaryPDG = -999;
427 m_ECLMCPDG = -999;
428 m_ECLMCMom = -999;
429 m_ECLMCPhi = -999;
430 m_ECLMCTheta = -999;
431 }
432
434
435 if (cluster.hasHypothesis(ECLCluster::EHypothesisBit::c_neutralHadron)) { m_treeECLhadron -> Fill();}
436 if (cluster.hasHypothesis(ECLCluster::EHypothesisBit::c_nPhotons)) { m_treeECLgamma -> Fill();}
437 }// for ecl cluster in clusters
438} // event
439
440
442{
443 // close root files
444 m_f -> cd();
445 if (m_useKLM) { m_treeKLM -> Write();}
446 if (m_useECL) {
447 m_treeECLhadron -> Write();
448 m_treeECLgamma -> Write();
449 }
450 m_f -> Close();
451}
452
Class to provide momentum-related information from ECLClusters.
Definition: ClusterUtils.h:36
const ROOT::Math::PxPyPzEVector Get4MomentumFromCluster(const ECLCluster *cluster, ECLCluster::EHypothesisBit hypo)
Returns four momentum vector.
Definition: ClusterUtils.cc:25
Float_t m_KLMnLayer
number of layers hit in KLM cluster
bool m_useKLM
write out KLM data
Float_t m_ECLnumChrystals
number of crystals in the cluster
Float_t m_KLMInitialTrackSepAngle
angular distance from track to cluster at track starting point
Float_t m_KLMTrackSepDist
distance from track separation object
Float_t m_KLMnCluster
varibales to write out.
Float_t m_KLMMCPhi
phi of matched mc particle
Float_t m_ECLMCLifetime
MC particles lifetime.
Float_t m_ECLE1oE9
central crystal devided by 3x3 area with it in its center
Float_t m_KLMTheta
measured theta
Float_t m_KLMECLdeltaL
distance between track entry point and cluster center, might be removed
Float_t m_KLMTrackSepAngle
angular distance from track separation object
Float_t m_ECLMCPrimaryPDG
pdg code of higher order MC particle, a cluster related to a photon that originates from a pi0 decay ...
StoreArray< KLMCluster > m_klmClusters
Store array
Float_t m_KLMECLminTrackDist
track distance between associated ECL cluster and track extrapolated into ECL
Float_t m_ECLE9oE25
energy of 9/25 chrystall rings (E dispersion shape)
virtual void initialize() override
init
Float_t m_KLMMCLifetime
MC partilces life time.
std::string m_outPath
Output path variable.
Float_t m_ECLLAT
lateral shower shape
virtual void event() override
process event
Float_t m_KLMMom
measured momentum
Float_t m_KLMECLZ51
zernike moment 5,1 of closest ECL cluster
Float_t m_ECLdeltaL
distance between track entrace into cluster and cluster center
Float_t m_KLMMCPDG
pdg code of matched MCparticle
Float_t m_ECLminTrkDistance
more sophisticated distaqnce to track in ECL
Float_t m_ECLMCPDG
pdg code of the MCparticle directly related to the cluster
Float_t m_ECLMCWeight
mc weight
Float_t m_ECLKLid
classifier output
Float_t m_KLMTrackRotationAngle
angle between track at poca and trackbeginning
Float_t m_ECLEerror
uncertainty on E measurement in ECL
Float_t m_ECLR
distance of cluster to IP
Float_t m_ECLMom
measured momentum
Float_t m_ECLMCPhi
MC particle phi; -999 if not MCparticle
virtual void endRun() override
end run
Float_t m_KLMTruth
target variable for KLM classification
Float_t m_KLMAngleToMC
angle between KLMcluster and Mcparticle
Float_t m_KLMECLE9oE25
E in surrounding 9 crystals divided by surrounding 25 crydtalls.
Float_t m_ECLMCStatus
mc status, seen in detector etc.
Float_t m_ECLE
measured energy
Float_t m_KLMECLZMVA
zernike mva output for closest ECL cluster (based on around 10 z-moments)
virtual void terminate() override
terminate
TTree * m_treeECLhadron
tree containing ntuples for ECL cluster with N2 (hadron hypothesis)
Float_t m_KLMtrackToECL
primitive distance cluster <-> track for associated ECL cluster
Float_t m_ECLZ40
Zernike moment 4,0 see Belle2 note on that.
Float_t m_ECLZ
measured Z-coordinate
Float_t m_ECLUncertaintyPhi
measured uncertainty of phi
Float_t m_ECL2ndMom
second moment, shower shape
Float_t m_KLMECLUncertaintyTheta
theta uncertainty of closest ECL cluster
Float_t m_ECLZMVA
output of a BDT that was fitted on some Zernike Moments on a connected region
TTree * m_treeECLgamma
tree containing ntuples for ECL cluster with N1 (photon hypothesis)
bool m_useECL
write out KLM data
Float_t m_KLMMCStatus
MC particles status.
virtual void beginRun() override
beginn run
Float_t m_isBeamBKG
is beam bkg
Float_t m_KLMMCTheta
theta of matched mc particle
Float_t m_ECLTiming
timing of ECL
Float_t m_KLMMCWeight
mc weight
Float_t m_KLMECLTiming
timing of associated ECL cluster
Float_t m_KLMECLDist
distance associated ECL <-> KLM cluster
Float_t m_KLMglobalZ
global Z position in KLM
StoreArray< ECLCluster > m_eclClusters
Store array
Float_t m_isSignal
isSignal for the classifier
Float_t m_KLMnInnermostLayer
number of innermost layers hit
Float_t m_ECLTruth
ECL trarget variable.
Float_t m_KLMtime
timing of KLM Cluster
Float_t m_KLMECLTerror
uncertainty on time in associated ECL cluster
Float_t m_KLMinvM
invariant mass calculated from root vector
Float_t m_KLMnextCluster
distance to next KLM cluster
Float_t m_ECLUncertaintyEnergy
measured energy uncertainty
Float_t m_ECLTheta
measured theta
Float_t m_ECLUncertaintyTheta
measured uncertainty on theta
Float_t m_KLMECLHypo
hypotheis id of closest ecl cluster 5: gamma, 6:hadron
StoreArray< MCParticle > m_mcParticles
Store array
TTree * m_treeKLM
tree for klm data
Float_t m_ECLDeltaTime
KlId for that object.
Float_t m_ECLPhi
measured phi
Float_t m_KLMhitDepth
hit depth in KLM, distance to IP
Float_t m_ECLZ51
Zernike moment 5,1 see Belle2 note on that.
Float_t m_KLMTrackClusterSepAngle
angle between trach momentum and cluster (measured from ip)
Float_t m_KLMPhi
measured phi
virtual ~DataWriterModule()
Destructor.
Float_t m_ECLMCMom
MC particle momentum; -999 if not MCparticle.
Float_t m_KLMavInterClusterDist
average distance between all KLM clusters
Float_t m_KLMECLEerror
uncertainty on E in associated ECL cluster
Float_t m_KLMMCMom
momentum of matched mc particle
Float_t m_KLMKLid
KlId for that object.
Float_t m_KLMenergy
Energy deposit in KLM (0.2 GeV * nHitCells)
Float_t m_KLMMCPrimaryPDG
pdg code of MCparticles mother, for example pi0 for some gammas
Float_t m_KLMECLZ40
zernike moment 4,0 of closest ecl cluster
Float_t m_KLMeclFlag
ecl flag for belle comparision
Float_t m_KLMECLUncertaintyPhi
phi uncertainty oof closeest ecl cluster
Float_t m_KLMECLE
energy measured in associated ECL cluster
Float_t m_ECLMCTheta
MC particle momentum; -999 if not MCparticle.
Float_t m_KLMtrackFlag
track flag for belle comparision
ECL cluster data.
Definition: ECLCluster.h:27
double getDeltaL() const
Return deltaL.
Definition: ECLCluster.h:265
double getUncertaintyTheta() const
Return Uncertainty on Theta of Shower.
Definition: ECLCluster.h:325
double getE9oE21() const
Return E9/E21 (shower shape variable).
Definition: ECLCluster.h:280
double getEnergy(EHypothesisBit hypothesis) const
Return Energy (GeV).
Definition: ECLCluster.cc:23
double getUncertaintyEnergy() const
Return Uncertainty on Energy of Shower.
Definition: ECLCluster.h:322
double getMinTrkDistance() const
Get distance between cluster COG and track extrapolation to ECL.
Definition: ECLCluster.h:259
double getZernikeMVA() const
Return MVA based hadron/photon value based on Zernike moments (shower shape variable).
Definition: ECLCluster.h:274
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
unsigned short getHypotheses() const
Return hypothesis (expert only, this returns a bti pattern).
Definition: ECLCluster.h:244
double getDeltaTime99() const
Return cluster delta time 99.
Definition: ECLCluster.h:301
double getTime() const
Return cluster time.
Definition: ECLCluster.h:298
EHypothesisBit
The hypothesis bits for this ECLCluster (Connected region (CR) is split using this hypothesis.
Definition: ECLCluster.h:31
@ c_nPhotons
CR is split into n photons (N1)
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
double getAbsZernike51() const
Return Zernike moment 51 (shower shape variable).
Definition: ECLCluster.h:271
KLM cluster data.
Definition: KLMCluster.h:28
Klong identifcation (KlId) datastore object to store results from KlId calculations.
Definition: KlId.h:23
double getKlId() const
get the klong classifier output
Definition: KlId.cc:29
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Store one Track-KLMCluster separation as a ROOT object.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Helper functions for all klid modules to improve readability of the code.
Definition: KlId.h:27
bool isKLMClusterSignal(const Belle2::KLMCluster &cluster, float mcWeigthCut=0.66)
checks if a cluster is signal under the mcWeightcondition (mcWeight = energy deposition)
Definition: KlId.h:100
int mcParticleIsBeamBKG(const Belle2::MCParticle *part)
return if MCparticle is beambkg
Definition: KlId.h:68
std::tuple< const Belle2::KLMCluster *, double, double > findClosestKLMCluster(const ROOT::Math::XYZVector &klmClusterPosition)
find nearest KLMCluster, tis distance and the av intercluster distance
Definition: KlId.h:236
bool isECLClusterSignal(const Belle2::ECLCluster &cluster, float mcWeigthCut=0.66)
checks if a cluster is signal under the mcWeightcondition (mcWeight = energy deposition)
Definition: KlId.h:114
std::pair< Belle2::ECLCluster *, double > findClosestECLCluster(const ROOT::Math::XYZVector &klmClusterPosition, const Belle2::ECLCluster::EHypothesisBit eclhypothesis=Belle2::ECLCluster::EHypothesisBit::c_neutralHadron)
Find the closest ECLCluster with a neutral hadron hypothesis, and return it with its distance.
Definition: KlId.h:203
int getPrimaryPDG(Belle2::MCParticle *part)
return if mc particles primary pdg.
Definition: KlId.h:151
int mcParticleIsKlong(Belle2::MCParticle *part)
return the mc hirachy of the klong 0:not a klong 1:final particle, 2: klong is mother etc
Definition: KlId.h:78
Abstract base class for different kinds of events.
STL namespace.