Belle II Software light-2607-kasei
EventVariables.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// Own header.
10#include <analysis/variables/EventVariables.h>
11
12// include VariableManager
13#include <analysis/VariableManager/Manager.h>
14
15// framework - DataStore
16#include <framework/datastore/StoreArray.h>
17#include <framework/datastore/StoreObjPtr.h>
18#include <framework/dataobjects/EventMetaData.h>
19
20// dataobjects
21#include <analysis/dataobjects/Particle.h>
22#include <analysis/dataobjects/EventKinematics.h>
23
24#include <mdst/dataobjects/MCParticle.h>
25#include <mdst/dataobjects/Track.h>
26#include <mdst/dataobjects/ECLCluster.h>
27#include <mdst/dataobjects/KLMCluster.h>
28#include <mdst/dataobjects/V0.h>
29
30#include <framework/dataobjects/EventT0.h>
31#include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
32
33// database
34#include <framework/database/DBObjPtr.h>
35#include <mdst/dbobjects/BeamSpot.h>
36
37#include <analysis/utility/PCmsLabTransform.h>
38
39#include <framework/core/Environment.h>
40#include <framework/logging/Logger.h>
41
42
43namespace Belle2 {
48 namespace Variable {
49
50 // Event ------------------------------------------------
51 bool isMC(const Particle*)
52 {
53 return Environment::Instance().isMC();
54 }
55
56 bool isContinuumEvent(const Particle*)
57 {
58 return (isNotContinuumEvent(nullptr) == 1 ? 0 : 1);
59 }
60
61 bool isChargedBEvent(const Particle*)
62 {
63 StoreArray<MCParticle> mcParticles;
64 for (const auto& mcp : mcParticles) {
65 int pdg_no = mcp.getPDG();
66 if (abs(pdg_no) == 521) return 1.0;
67 }
68 return 0.0;
69 }
70
71 double isUnmixedBEvent(const Particle*)
72 {
73 StoreArray<MCParticle> mcParticles;
74 std::vector<int> bPDGs;
75 for (const auto& mcp : mcParticles) {
76 int pdg_no = mcp.getPDG();
77 if (abs(pdg_no) == 511) bPDGs.push_back(pdg_no);
78 }
79 if (bPDGs.size() == 2) {
80 return bPDGs[0] * bPDGs[1] < 0;
81 }
82 return Const::doubleNaN;
83 }
84
85 bool isNotContinuumEvent(const Particle*)
86 {
87 StoreArray<MCParticle> mcParticles;
88 for (const MCParticle& mcp : mcParticles) {
89 int pdg_no = mcp.getPDG();
90 if (mcp.getMother() == nullptr &&
91 ((pdg_no == 553) ||
92 (pdg_no == 100553) ||
93 (pdg_no == 200553) ||
94 (pdg_no == 300553) ||
95 (pdg_no == 9000553) ||
96 (pdg_no == 9010553)))
97 return 1;
98 }
99 return 0;
100 }
101
102 int nMCParticles(const Particle*)
103 {
104 StoreArray<MCParticle> mcps;
105 return mcps.getEntries();
106 }
107
108 int nPrimaryMCParticles(const Particle*)
109 {
110 int n = 0;
111 StoreArray<MCParticle> mcps;
112 for (const auto& mcp : mcps)
113 if (mcp.isPrimaryParticle())
114 n++;
115 return n;
116 }
117
118 int nInitialPrimaryMCParticles(const Particle*)
119 {
120 int n = 0;
121 StoreArray<MCParticle> mcps;
122 for (const auto& mcp : mcps)
123 if (mcp.isInitial() and mcp.isPrimaryParticle())
124 n++;
125 return n;
126 }
127
128 int nVirtualPrimaryMCParticles(const Particle*)
129 {
130 int n = 0;
131 StoreArray<MCParticle> mcps;
132 for (const auto& mcp : mcps)
133 if (mcp.isVirtual() and mcp.isPrimaryParticle())
134 n++;
135 return n;
136 }
137
138 int nTracks(const Particle*)
139 {
140 StoreArray<Track> tracks;
141 return tracks.getEntries();
142 }
143
144 int nV0s(const Particle*)
145 {
146 StoreArray<V0> v0s;
147 return v0s.getEntries();
148 }
149
150 int nValidV0s(const Particle*)
151 {
152 StoreArray<V0> v0s;
153
154 int n = 0;
155 for (int i = 0; i < v0s.getEntries(); i++) {
156 const V0* v0 = v0s[i];
157 if (v0->getTrackFitResults().first->getChargeSign() == v0->getTrackFitResults().second->getChargeSign())
158 continue;
159 n++;
160 }
161
162 return n;
163 }
164
165 int nNeutralECLClusters(const Particle*, const std::vector<double>& hypothesis)
166 {
167 if (hypothesis.size() != 1)
168 B2FATAL("Number of arguments of nNeutralECLClusters must be 1.");
169
170 int hypothesis_int = std::lround(hypothesis[0]);
171 if (hypothesis_int < 1 or hypothesis_int > 2) {
172 B2WARNING("nNeutralECLClusters:: Hypothesis must be 1 (nPhotons) or 2 (NeutralHadron)");
173 return 0;
174 }
175
176 StoreArray<ECLCluster> eclClusters;
177 int nClusters = 0;
178 for (int i = 0; i < eclClusters.getEntries(); i++) {
179 auto cluster = eclClusters[i];
180 if (!cluster->isNeutral())
181 continue;
182
183 if ((hypothesis_int == 1 and cluster->hasHypothesis(ECLCluster::EHypothesisBit::c_nPhotons)) or
184 (hypothesis_int == 2 and cluster->hasHypothesis(ECLCluster::EHypothesisBit::c_neutralHadron)))
185 nClusters++;
186 }
187 return nClusters;
188 }
189
190 int nChargeZeroTrackFits(const Particle*)
191 {
192 StoreArray<TrackFitResult> tfrs;
193 int out = 0;
194 for (const auto& t : tfrs)
195 if (t.getChargeSign() == 0) out++;
196 return out;
197 }
198
199 double belleECLEnergy(const Particle*)
200 {
201 StoreArray<ECLCluster> eclClusters;
202 double result = 0;
203 for (int i = 0; i < eclClusters.getEntries(); ++i) {
204 // sum only ECLClusters which have the N1 (n photons) hypothesis
205 if (!eclClusters[i]->hasHypothesis(ECLCluster::EHypothesisBit::c_nPhotons))
206 continue;
207
208 result += eclClusters[i]->getEnergy(ECLCluster::EHypothesisBit::c_nPhotons);
209 }
210 return result;
211 }
212
213 int nKLMClusters(const Particle*)
214 {
215 StoreArray<KLMCluster> klmClusters;
216 return klmClusters.getEntries();
217 }
218
219 int expNum(const Particle*)
220 {
221 StoreObjPtr<EventMetaData> evtMetaData;
222 int exp_no = evtMetaData->getExperiment();
223 return exp_no;
224 }
225
226 int productionIdentifier(const Particle*)
227 {
228 StoreObjPtr<EventMetaData> evtMetaData;
229 int eventProduction = evtMetaData->getProduction();
230 return eventProduction;
231 }
232
233 int evtNum(const Particle*)
234 {
235 StoreObjPtr<EventMetaData> evtMetaData;
236 int evt_no = evtMetaData->getEvent();
237 return evt_no;
238 }
239
240 int runNum(const Particle*)
241 {
242 StoreObjPtr<EventMetaData> evtMetaData;
243 int run_no = evtMetaData->getRun();
244 return run_no;
245 }
246
247 // Beam Energies
248 double getCMSEnergy(const Particle*)
249 {
250 PCmsLabTransform T;
251 return T.getCMSEnergy();
252 }
253
254 double getBeamPx(const Particle*)
255 {
256 PCmsLabTransform T;
257 return (T.getBeamFourMomentum()).Px();
258 }
259
260 double getBeamPy(const Particle*)
261 {
262 PCmsLabTransform T;
263 return (T.getBeamFourMomentum()).Py();
264 }
265
266 double getBeamPz(const Particle*)
267 {
268 PCmsLabTransform T;
269 return (T.getBeamFourMomentum()).Pz();
270 }
271
272 double getBeamE(const Particle*)
273 {
274 PCmsLabTransform T;
275 return (T.getBeamFourMomentum()).E();
276 }
277
278 // get total 4-momentum of all final-state particles in MC
279 static ROOT::Math::PxPyPzEVector getTotalMcFinalStateMomentum()
280 {
281 StoreArray<MCParticle> mcps;
282 ROOT::Math::PxPyPzEVector sum;
283 for (const auto& mcp : mcps) {
284 // only consider primary final-state particle generated by generator
285 if (mcp.isPrimaryParticle() and not(mcp.isInitial() or mcp.isVirtual())) {
286 const MCParticle* mother = mcp.getMother();
287 // only consider particles with no mother or particles whose mother is not initial or virtual
288 if (not mother or not(mother->isPrimaryParticle() and not(mother->isInitial() or mother->isVirtual())))
289 sum += mcp.get4Vector();
290 }
291 }
292 return sum;
293 }
294
295
296 // get 4-momentum of the incoming electron/positron in MC event
297 static ROOT::Math::PxPyPzEVector getMcBeamMomentum(int charge)
298 {
299 StoreArray<MCParticle> mcps;
300 for (const auto& mcp : mcps) {
301 if (mcp.isInitial() && mcp.getPDG() == -charge * 11) {
302 return mcp.get4Vector();
303 }
304 }
305
306 // if no initial electron/positron found
307 return ROOT::Math::PxPyPzEVector(Const::doubleNaN, Const::doubleNaN, Const::doubleNaN, Const::doubleNaN);
308 }
309
310 // get HER/LER 4-momentum based on the calibration payloads
311 static ROOT::Math::PxPyPzEVector getBeamMomentum(int charge)
312 {
313 PCmsLabTransform T;
314 double EbeamCM = T.getCMSEnergy() / 2;
315 double pBeamCM = sqrt(pow(EbeamCM, 2) - pow(Const::electronMass, 2));
316
317 ROOT::Math::PxPyPzEVector pCM(0, 0, -charge * pBeamCM, EbeamCM);
318
319 return T.cmsToLab(pCM);
320 }
321
322
323 double getMcPxHER(const Particle*) {return getMcBeamMomentum(-1).Px();}
324 double getMcPyHER(const Particle*) {return getMcBeamMomentum(-1).Py();}
325 double getMcPzHER(const Particle*) {return getMcBeamMomentum(-1).Pz();}
326
327 double getMcPxLER(const Particle*) {return getMcBeamMomentum(+1).Px();}
328 double getMcPyLER(const Particle*) {return getMcBeamMomentum(+1).Py();}
329 double getMcPzLER(const Particle*) {return getMcBeamMomentum(+1).Pz();}
330
331
332 double getPxHER(const Particle*) {return getBeamMomentum(-1).Px();}
333 double getPyHER(const Particle*) {return getBeamMomentum(-1).Py();}
334 double getPzHER(const Particle*) {return getBeamMomentum(-1).Pz();}
335
336 double getPxLER(const Particle*) {return getBeamMomentum(+1).Px();}
337 double getPyLER(const Particle*) {return getBeamMomentum(+1).Py();}
338 double getPzLER(const Particle*) {return getBeamMomentum(+1).Pz();}
339
340
341 double getCMSEnergyMC(const Particle*)
342 {
343 StoreArray<MCParticle> mcps;
344 if (!mcps) {
345 return Const::doubleNaN;
346 } else return getTotalMcFinalStateMomentum().M();
347 }
348
349 double getTotalEnergyMC(const Particle*)
350 {
351 StoreArray<MCParticle> mcps;
352 if (!mcps) {
353 return Const::doubleNaN;
354 } else return getTotalMcFinalStateMomentum().E();
355 }
356
357 double getGenIPX(const Particle*)
358 {
359 // generated IP corresponds to the generated vertex of the
360 // first not-initial and not-virtual MCParticle
361 StoreArray<MCParticle> mcps;
362 for (const auto& mcp : mcps)
363 if (not mcp.isInitial() and not mcp.isVirtual() and mcp.isPrimaryParticle())
364 return mcp.getVertex().X();
365 return Const::doubleNaN;
366 }
367
368 double getGenIPY(const Particle*)
369 {
370 StoreArray<MCParticle> mcps;
371 for (const auto& mcp : mcps)
372 if (not mcp.isInitial() and not mcp.isVirtual() and mcp.isPrimaryParticle())
373 return mcp.getVertex().Y();
374 return Const::doubleNaN;
375 }
376
377 double getGenIPZ(const Particle*)
378 {
379 StoreArray<MCParticle> mcps;
380 for (const auto& mcp : mcps)
381 if (not mcp.isInitial() and not mcp.isVirtual() and mcp.isPrimaryParticle())
382 return mcp.getVertex().Z();
383 return Const::doubleNaN;
384 }
385
386 double getIPX(const Particle*)
387 {
388 static DBObjPtr<BeamSpot> beamSpotDB;
389 if (!beamSpotDB.isValid())
390 return Const::doubleNaN;
391 return (beamSpotDB->getIPPosition()).X();
392 }
393
394 double getIPY(const Particle*)
395 {
396 static DBObjPtr<BeamSpot> beamSpotDB;
397 if (!beamSpotDB.isValid())
398 return Const::doubleNaN;
399 return (beamSpotDB->getIPPosition()).Y();
400 }
401
402 double getIPZ(const Particle*)
403 {
404 static DBObjPtr<BeamSpot> beamSpotDB;
405 if (!beamSpotDB.isValid())
406 return Const::doubleNaN;
407 return (beamSpotDB->getIPPosition()).Z();
408 }
409
410 double ipCovMatrixElement(const Particle*, const std::vector<double>& element)
411 {
412 int elementI = std::lround(element[0]);
413 int elementJ = std::lround(element[1]);
414
415 bool isOutOfRange = false;
416 if (elementI < 0 || elementI > 2) {
417 B2WARNING("Requested IP covariance matrix element is out of boundaries [0 - 2]:" << LogVar("i", elementI));
418 isOutOfRange = true;
419 }
420 if (elementJ < 0 || elementJ > 2) {
421 B2WARNING("Requested IP covariance matrix element is out of boundaries [0 - 2]:" << LogVar("j", elementJ));
422 isOutOfRange = true;
423 }
424
425 if (isOutOfRange) return Const::doubleNaN;
426
427 static DBObjPtr<BeamSpot> beamSpotDB;
428 if (!beamSpotDB.isValid())
429 return Const::doubleNaN;
430 return beamSpotDB->getCovVertex()(elementI, elementJ);
431 }
432
433 // Event kinematics -> missing momentum in lab and CMS, missing energy and mass2, visible energy
434 double missingMomentumOfEvent(const Particle*)
435 {
436 StoreObjPtr<EventKinematics> evtShape;
437 if (!evtShape) {
438 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
439 return Const::doubleNaN;
440 }
441 double missing = evtShape->getMissingMomentum().R();
442 return missing;
443 }
444
445 double missingMomentumOfEvent_Px(const Particle*)
446 {
447 StoreObjPtr<EventKinematics> evtShape;
448 if (!evtShape) {
449 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
450 return Const::doubleNaN;
451 }
452 double missing = evtShape->getMissingMomentum().X();
453 return missing;
454 }
455
456 double missingMomentumOfEvent_Py(const Particle*)
457 {
458 StoreObjPtr<EventKinematics> evtShape;
459 if (!evtShape) {
460 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
461 return Const::doubleNaN;
462 }
463 double missing = evtShape->getMissingMomentum().Y();
464 return missing;
465 }
466
467 double missingMomentumOfEvent_Pz(const Particle*)
468 {
469 StoreObjPtr<EventKinematics> evtShape;
470 if (!evtShape) {
471 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
472 return Const::doubleNaN;
473 }
474 double missing = evtShape->getMissingMomentum().Z();
475 return missing;
476 }
477
478 double missingMomentumOfEvent_theta(const Particle*)
479 {
480 StoreObjPtr<EventKinematics> evtShape;
481 if (!evtShape) {
482 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
483 return Const::doubleNaN;
484 }
485 double missing = evtShape->getMissingMomentum().Theta();
486 return missing;
487 }
488
489 double missingMomentumOfEventCMS(const Particle*)
490 {
491 StoreObjPtr<EventKinematics> evtShape;
492 if (!evtShape) {
493 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
494 return Const::doubleNaN;
495 }
496 double missing = evtShape->getMissingMomentumCMS().R();
497 return missing;
498 }
499
500 double genMissingMomentumOfEventCMS(const Particle*)
501 {
502 StoreObjPtr<EventKinematics> evtShape("EventKinematicsFromMC");
503 if (!evtShape) {
504 B2WARNING("Cannot find missing momentum information from MC, did you forget to use the buildEventKinematicsFromMC method?");
505 return Const::doubleNaN;
506 }
507 double missing = evtShape->getMissingMomentumCMS().R();
508 return missing;
509 }
510
511 double missingMomentumOfEventCMS_Px(const Particle*)
512 {
513 StoreObjPtr<EventKinematics> evtShape;
514 if (!evtShape) {
515 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
516 return Const::doubleNaN;
517 }
518 double missing = evtShape->getMissingMomentumCMS().X();
519 return missing;
520 }
521
522 double missingMomentumOfEventCMS_Py(const Particle*)
523 {
524 StoreObjPtr<EventKinematics> evtShape;
525 if (!evtShape) {
526 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
527 return Const::doubleNaN;
528 }
529 double missing = evtShape->getMissingMomentumCMS().Y();
530 return missing;
531 }
532
533 double missingMomentumOfEventCMS_Pz(const Particle*)
534 {
535 StoreObjPtr<EventKinematics> evtShape;
536 if (!evtShape) {
537 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
538 return Const::doubleNaN;
539 }
540 double missing = evtShape->getMissingMomentumCMS().Z();
541 return missing;
542 }
543
544 double missingMomentumOfEventCMS_theta(const Particle*)
545 {
546 StoreObjPtr<EventKinematics> evtShape;
547 if (!evtShape) {
548 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
549 return Const::doubleNaN;
550 }
551 double theta = evtShape->getMissingMomentumCMS().Theta();
552 return theta;
553 }
554
555 double missingEnergyOfEventCMS(const Particle*)
556 {
557 StoreObjPtr<EventKinematics> evtShape;
558 if (!evtShape) {
559 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
560 return Const::doubleNaN;
561 }
562 double missing = evtShape->getMissingEnergyCMS();
563 return missing;
564 }
565
566 double genMissingEnergyOfEventCMS(const Particle*)
567 {
568 StoreObjPtr<EventKinematics> evtShape("EventKinematicsFromMC");
569 if (!evtShape) {
570 B2WARNING("Cannot find missing momentum information from MC, did you forget to use the buildEventKinematicsFromMC method?");
571 return Const::doubleNaN;
572 }
573 double missing = evtShape->getMissingEnergyCMS();
574 return missing;
575 }
576
577
578 double missingMass2OfEvent(const Particle*)
579 {
580 StoreObjPtr<EventKinematics> evtShape;
581 if (!evtShape) {
582 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
583 return Const::doubleNaN;
584 }
585 double missing = evtShape->getMissingMass2();
586 return missing;
587 }
588
589 double genMissingMass2OfEvent(const Particle*)
590 {
591 StoreObjPtr<EventKinematics> evtShape("EventKinematicsFromMC");
592 if (!evtShape) {
593 B2WARNING("Cannot find missing momentum information from MC, did you forget to use the buildEventKinematicsFromMC method?");
594 return Const::doubleNaN;
595 }
596 double missing = evtShape->getMissingMass2();
597 return missing;
598 }
599
600 double visibleEnergyOfEventCMS(const Particle*)
601 {
602 StoreObjPtr<EventKinematics> evtShape;
603 if (!evtShape) {
604 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
605 return Const::doubleNaN;
606 }
607 double visible = evtShape->getVisibleEnergyCMS();
608 return visible;
609 }
610
611 double genVisibleEnergyOfEventCMS(const Particle*)
612 {
613 StoreObjPtr<EventKinematics> evtShape("EventKinematicsFromMC");
614 if (!evtShape) {
615 B2WARNING("Cannot find missing momentum information from MC, did you forget to use the buildEventKinematicsFromMC method?");
616 return Const::doubleNaN;
617 }
618 double visible = evtShape->getVisibleEnergyCMS();
619 return visible;
620 }
621
622
623 double totalPhotonsEnergyOfEvent(const Particle*)
624 {
625 StoreObjPtr<EventKinematics> evtShape;
626 if (!evtShape) {
627 B2WARNING("Cannot find missing momentum information, did you forget to use the buildEventKinematics method?");
628 return Const::doubleNaN;
629 }
630 double energyOfPhotons = evtShape->getTotalPhotonsEnergy();
631 return energyOfPhotons;
632 }
633
634 double genTotalPhotonsEnergyOfEvent(const Particle*)
635 {
636 StoreObjPtr<EventKinematics> evtShape("EventKinematicsFromMC");
637 if (!evtShape) {
638 B2WARNING("Cannot find missing momentum information from MC, did you forget to use the buildEventKinematicsFromMC method?");
639 return Const::doubleNaN;
640 }
641 double energyOfPhotons = evtShape->getTotalPhotonsEnergy();
642 return energyOfPhotons;
643 }
644
645 double eventYearMonthDay(const Particle*)
646 {
647 StoreObjPtr<EventMetaData> evtMetaData;
648 if (!evtMetaData) {
649 return Const::doubleNaN;
650 }
651 std::time_t rawtime = trunc(evtMetaData->getTime() / 1e9);
652 const auto* tt = std::gmtime(&rawtime); // GMT
653 int y = tt->tm_year + 1900; // years since 1900
654 int m = tt->tm_mon + 1; // months since January
655 int d = tt->tm_mday; // day of the month
656 return (y * 1e4) + (m * 1e2) + d;
657 }
658
659 double eventYear(const Particle*)
660 {
661 StoreObjPtr<EventMetaData> evtMetaData;
662 if (!evtMetaData) {
663 return Const::doubleNaN;
664 }
665 std::time_t rawtime = trunc(evtMetaData->getTime() / 1e9);
666 const auto* tt = std::gmtime(&rawtime);
667 return tt->tm_year + 1900;
668 }
669
670 double eventTimeSeconds(const Particle*)
671 {
672 StoreObjPtr<EventMetaData> evtMetaData;
673
674 if (!evtMetaData) {
675 return Const::doubleNaN;
676 }
677 double evtTime = trunc(evtMetaData->getTime() / 1e9);
678
679 return evtTime;
680 }
681
682 double eventTimeSecondsFractionRemainder(const Particle*)
683 {
684 StoreObjPtr<EventMetaData> evtMetaData;
685
686 if (!evtMetaData) {
687 return Const::doubleNaN;
688 }
689 double evtTime = trunc(evtMetaData->getTime() / 1e9);
690
691 double evtTimeFrac = (evtMetaData->getTime() - evtTime * 1e9) / 1e9;
692
693 return evtTimeFrac;
694 }
695
696 double eventT0(const Particle*)
697 {
698 StoreObjPtr<EventT0> evtT0;
699
700 if (!evtT0) {
701 B2WARNING("StoreObjPtr<EventT0> does not exist, are you running over cDST data?");
702 return Const::doubleNaN;
703 }
704
705 if (evtT0->hasEventT0()) {
706 return evtT0->getEventT0();
707 } else {
708 return Const::doubleNaN;
709 }
710 }
711
712 double timeSincePrevTriggerClockTicks(const Particle*)
713 {
714 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
715
716 // Check if the pointer is valid
717 if (!TTDInfo.isValid()) {
718 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
719 return Const::doubleNaN;
720 }
721
722 // And check if the stored data is valid
723 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
724 // cppcheck-suppress knownConditionTrueFalse
725 if (TTDInfo->isValid()) {
726 return TTDInfo->getTimeSincePrevTrigger();
727 } else {
728 return Const::doubleNaN;
729 }
730 }
731
732 double timeSincePrevTriggerMicroSeconds(const Particle*)
733 {
734 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
735
736 // Check if the pointer is valid
737 if (!TTDInfo.isValid()) {
738 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
739 return Const::doubleNaN;
740 }
741
742 // And check if the stored data is valid
743 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
744 // cppcheck-suppress knownConditionTrueFalse
745 if (TTDInfo->isValid()) {
746 return TTDInfo->getTimeSincePrevTriggerInMicroSeconds();
747 } else {
748 return Const::doubleNaN;
749 }
750 }
751
752 double triggeredBunchNumberTTD(const Particle*)
753 {
754 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
755
756 // Check if the pointer is valid
757 if (!TTDInfo.isValid()) {
758 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
759 return Const::doubleNaN;
760 }
761
762 // And check if the stored data is valid
763 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
764 // cppcheck-suppress knownConditionTrueFalse
765 if (TTDInfo->isValid()) {
766 return TTDInfo->getBunchNumber();
767 } else {
768 return Const::doubleNaN;
769 }
770 }
771
772 double triggeredBunchNumber(const Particle*)
773 {
774 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
775
776 // Check if the pointer is valid
777 if (!TTDInfo.isValid()) {
778 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
779 return Const::doubleNaN;
780 }
781
782 // And check if the stored data is valid
783 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
784 // cppcheck-suppress knownConditionTrueFalse
785 if (TTDInfo->isValid()) {
786 return TTDInfo->getTriggeredBunchNumberGlobal();
787 } else {
788 return Const::doubleNaN;
789 }
790 }
791
792 double hasRecentInjection(const Particle*)
793 {
794 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
795
796 // Check if the pointer is valid
797 if (!TTDInfo.isValid()) {
798 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
799 return Const::doubleNaN;
800 }
801
802 // And check if the stored data is valid
803 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
804 // cppcheck-suppress knownConditionTrueFalse
805 if (TTDInfo->isValid()) {
806 return TTDInfo->hasInjection();
807 } else {
808 return Const::doubleNaN;
809 }
810 }
811
812 double timeSinceLastInjectionSignalClockTicks(const Particle*)
813 {
814 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
815
816 // Check if the pointer is valid
817 if (!TTDInfo.isValid()) {
818 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
819 return Const::doubleNaN;
820 }
821
822 // And check if the stored data is valid and if an injection happened recently
823 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
824 // cppcheck-suppress knownConditionTrueFalse
825 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
826 return TTDInfo->getTimeSinceLastInjection();
827 } else {
828 return Const::doubleNaN;
829 }
830 }
831
832 double timeSinceLastInjectionSignalMicroSeconds(const Particle*)
833 {
834 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
835
836 // Check if the pointer is valid
837 if (!TTDInfo.isValid()) {
838 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
839 return Const::doubleNaN;
840 }
841
842 // And check if the stored data is valid and if an injection happened recently
843 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
844 // cppcheck-suppress knownConditionTrueFalse
845 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
846 return TTDInfo->getTimeSinceLastInjectionInMicroSeconds();
847 } else {
848 return Const::doubleNaN;
849 }
850 }
851
852 double timeSinceLastInjectionClockTicks(const Particle*)
853 {
854 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
855
856 // Check if the pointer is valid
857 if (!TTDInfo.isValid()) {
858 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
859 return Const::doubleNaN;
860 }
861
862 // And check if the stored data is valid and if an injection happened recently
863 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
864 // cppcheck-suppress knownConditionTrueFalse
865 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
866 return TTDInfo->getTimeSinceInjectedBunch();
867 } else {
868 return Const::doubleNaN;
869 }
870 }
871
872 double timeSinceLastInjectionMicroSeconds(const Particle*)
873 {
874 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
875
876 // Check if the pointer is valid
877 if (!TTDInfo.isValid()) {
878 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
879 return Const::doubleNaN;
880 }
881
882 // And check if the stored data is valid and if an injection happened recently
883 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
884 // cppcheck-suppress knownConditionTrueFalse
885 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
886 return TTDInfo->getTimeSinceInjectedBunchInMicroSeconds();
887 } else {
888 return Const::doubleNaN;
889 }
890 }
891
892 double injectionInHER(const Particle*)
893 {
894 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
895
896 // Check if the pointer is valid
897 if (!TTDInfo.isValid()) {
898 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
899 return Const::doubleNaN;
900 }
901
902 // And check if the stored data is valid and if an injection happened recently
903 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
904 // cppcheck-suppress knownConditionTrueFalse
905 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
906 return TTDInfo->isHER();
907 } else {
908 return Const::doubleNaN;
909 }
910 }
911
912 double revolutionCounter2(const Particle*)
913 {
914 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
915
916 // Check if the pointer is valid
917 if (!TTDInfo.isValid()) {
918 B2WARNING("StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
919 return Const::doubleNaN;
920 }
921
922 // And check if the stored data is valid
923 // (a different isValid() than StoreObjPtr's, which cppcheck conflates)
924 // cppcheck-suppress knownConditionTrueFalse
925 if (TTDInfo->isValid()) {
926 return TTDInfo->isRevo2();
927 } else {
928 return Const::doubleNaN;
929 }
930 }
931
932 bool eventT0CalculatedWithSVDInfo(const Particle*)
933 {
934 StoreObjPtr<EventLevelTriggerTimeInfo> triggerTimeInfo;
935 if (!triggerTimeInfo.isValid()) {
936 return false;
937 }
938 return triggerTimeInfo->hasEventT0SourceFromSVD();
939 }
940
941 bool eventT0CalculatedWithCDCInfo(const Particle*)
942 {
943 StoreObjPtr<EventLevelTriggerTimeInfo> triggerTimeInfo;
944 if (!triggerTimeInfo.isValid()) {
945 return false;
946 }
947 return triggerTimeInfo->hasEventT0SourceFromCDC();
948 }
949
950 bool eventT0CalculatedWithECLInfo(const Particle*)
951 {
952 StoreObjPtr<EventLevelTriggerTimeInfo> triggerTimeInfo;
953 if (!triggerTimeInfo.isValid()) {
954 return false;
955 }
956 return triggerTimeInfo->hasEventT0SourceFromECL();
957 }
958
959
960 VARIABLE_GROUP("Event");
961
962 REGISTER_VARIABLE("isMC", isMC,
963 "[Eventbased] Returns 1 if current basf2 process is running over simulated (Monte-Carlo) dataset and 0 in case of real experimental data.");
964 REGISTER_VARIABLE("isContinuumEvent", isContinuumEvent,
965 "[Eventbased] Returns 1.0 if event doesn't contain a :math:`\\Upsilon(4S)` particle on generator level, 0.0 otherwise.");
966 REGISTER_VARIABLE("isNotContinuumEvent", isNotContinuumEvent,
967 "[Eventbased] Returns 1.0 if event does contain an :math:`\\Upsilon(4S)` particle on generator level and therefore is not a continuum event, 0.0 otherwise.");
968
969 REGISTER_VARIABLE("isChargedBEvent", isChargedBEvent,
970 "[Eventbased] Returns 1.0 if event contains a charged B-meson on generator level.");
971 REGISTER_VARIABLE("isUnmixedBEvent", isUnmixedBEvent,
972 R"DOC([Eventbased] Returns 1.0 if the event contains opposite flavor neutral B-mesons on generator level,
9730.0 in case of same flavor B-mesons and NaN if the event has no generated neutral B.)DOC");
974
975 REGISTER_VARIABLE("nTracks", nTracks, R"DOC(
976[Eventbased] Returns the total number of tracks (unfiltered) in the event.
977
978.. warning:: This variable is exceedingly background-dependent and should not really be used in any selections (other than perhaps for monitoring purposes).
979.. seealso:: :b2:var:`nCleanedTracks` for a more useful variable for use in selections.
980)DOC");
981 REGISTER_VARIABLE("nChargeZeroTrackFits", nChargeZeroTrackFits, R"DOC(
982[Eventbased] Returns number of track fits with zero charge.
983
984.. note::
985 Sometimes, track fits can have zero charge, if background or non IP originating tracks, for example, are fit from the IP.
986 These tracks are excluded from particle lists, but a large amount of charge zero
987 fits may indicate problems with whole event constraints
988 or abnominally high beam backgrounds and/or noisy events.
989)DOC");
990
991 REGISTER_VARIABLE("belleECLEnergy", belleECLEnergy, R"DOC(
992[Eventbased][Legacy] Returns total energy in ECL in the event as used in Belle 1 analyses.
993
994.. warning::
995 For Belle II use cases use either ``totalEnergyOfParticlesInList(gamma:all)``,
996 or (probably better) fill a photon list with some minimal cleanup cuts and use that instead:
997
998 .. code-block:: python
999
1000 from variables import variables as vm
1001 fillParticleList("gamma:cleaned", "E > 0.05 and isFromECL==1", path=path)
1002 fillParticleList("e+:cleaned", "clusterE > 0.05", path=path)
1003 vm.addAlias("myNeutralECLEnergy", "totalEnergyOfParticlesInList(gamma:cleaned)")
1004 vm.addAlias("myChargedECLEnergy", "totalEnergyOfParticlesInList(e+:cleaned)")
1005 vm.addAlias("myECLEnergy", "formula(myNeutralECLEnergy+myChargedECLEnergy)")
1006
1007)DOC","GeV");
1008 REGISTER_VARIABLE("nKLMClusters", nKLMClusters,
1009 "[Eventbased] Returns number of KLM clusters in the event.");
1010 REGISTER_VARIABLE("nNeutralECLClusters(hypothesis)", nNeutralECLClusters,
1011 "[Eventbased] Returns number of neutral ECL clusters with a given hypothesis, 1:nPhotons, 2:NeutralHadron.");
1012 REGISTER_VARIABLE("nV0s", nV0s,
1013 "[Eventbased] Returns number of V0s in the event.");
1014 REGISTER_VARIABLE("nValidV0s", nValidV0s,
1015 "[Eventbased] Returns number of V0s consisting of pair of tracks with opposite charges.");
1016 REGISTER_VARIABLE("nMCParticles", nMCParticles,
1017 "[Eventbased] Returns number of MCParticles in the event.");
1018 REGISTER_VARIABLE("nPrimaryMCParticles", nPrimaryMCParticles,
1019 "[Eventbased] Returns number of primary MCParticles in the event.");
1020 REGISTER_VARIABLE("nInitialPrimaryMCParticles", nInitialPrimaryMCParticles,
1021 "[Eventbased] Returns number of initial primary MCParticles in the event.");
1022 REGISTER_VARIABLE("nVirtualPrimaryMCParticles", nVirtualPrimaryMCParticles,
1023 "[Eventbased] Returns number of virtual primary MCParticles in the event.");
1024
1025 REGISTER_VARIABLE("expNum", expNum, "[Eventbased] Returns the experiment number.");
1026 REGISTER_VARIABLE("evtNum", evtNum, "[Eventbased] Returns the event number.");
1027 REGISTER_VARIABLE("runNum", runNum, "[Eventbased] Returns the run number.");
1028 REGISTER_VARIABLE("productionIdentifier", productionIdentifier, R"DOC(
1029[Eventbased] Production identifier.
1030Uniquely identifies an MC sample by the (grid-jargon) production ID.
1031This is useful when analysing large MC samples split between more than one production or combining different MC samples (e.g. combining all continuum samples).
1032In such cases the event numbers are sequential *only within a production*, so experiment/run/event will restart with every new sample analysed.
1033
1034.. tip:: Experiment/run/event/production is unique for all MC samples. Experiment/run/event is unique for data.
1035
1036.. seealso:: `Where can I rely on uniqueness of the ['__experiment__', '__run__', '__event__', '__candidate__'] combination? <https://questions.belle2.org/question/9704>`__
1037)DOC");
1038
1039 REGISTER_VARIABLE("Ecms", getCMSEnergy, "[Eventbased] Returns center-of-mass energy.\n\n", "GeV");
1040 REGISTER_VARIABLE("beamE", getBeamE, "[Eventbased] Returns total beam energy in the laboratory frame.\n\n","GeV");
1041 REGISTER_VARIABLE("beamPx", getBeamPx, "[Eventbased] Returns x component of total beam momentum in the laboratory frame.\n\n","GeV/c");
1042 REGISTER_VARIABLE("beamPy", getBeamPy, "[Eventbased] Returns y component of total beam momentum in the laboratory frame.\n\n","GeV/c");
1043 REGISTER_VARIABLE("beamPz", getBeamPz, "[Eventbased] Returns z component of total beam momentum in the laboratory frame.\n\n","GeV/c");
1044 REGISTER_VARIABLE("EcmsMC", getCMSEnergyMC, "[Eventbased] Truth value of sqrt(s)\n\n", "GeV");
1045 REGISTER_VARIABLE("totalEnergyMC", getTotalEnergyMC, "[Eventbased] Truth value of sum of energies of all the generated particles\n\n", "GeV");
1046
1047
1048 REGISTER_VARIABLE("PxHER", getPxHER, "[Eventbased] Returns x component of the electron beam momentum in the laboratory frame.\n\n","GeV/c");
1049 REGISTER_VARIABLE("PyHER", getPyHER, "[Eventbased] Returns y component of the electron beam momentum in the laboratory frame.\n\n","GeV/c");
1050 REGISTER_VARIABLE("PzHER", getPzHER, "[Eventbased] Returns z component of the electron beam momentum in the laboratory frame.\n\n","GeV/c");
1051 REGISTER_VARIABLE("PxLER", getPxLER, "[Eventbased] Returns x component of the positron beam momentum in the laboratory frame.\n\n","GeV/c");
1052 REGISTER_VARIABLE("PyLER", getPyLER, "[Eventbased] Returns y component of the positron beam momentum in the laboratory frame.\n\n","GeV/c");
1053 REGISTER_VARIABLE("PzLER", getPzLER, "[Eventbased] Returns z component of the positron beam momentum in the laboratory frame.\n\n","GeV/c");
1054
1055 REGISTER_VARIABLE("mcPxHER", getMcPxHER, "[Eventbased] Returns truth value of the x component of the incoming electron momentum in the laboratory frame.\n\n","GeV/c");
1056 REGISTER_VARIABLE("mcPyHER", getMcPyHER, "[Eventbased] Returns truth value of the y component of the incoming electron momentum in the laboratory frame.\n\n","GeV/c");
1057 REGISTER_VARIABLE("mcPzHER", getMcPzHER, "[Eventbased] Returns truth value of the z component of the incoming electron momentum in the laboratory frame.\n\n","GeV/c");
1058 REGISTER_VARIABLE("mcPxLER", getMcPxLER, "[Eventbased] Returns truth value of the x component of the incoming positron momentum in the laboratory frame.\n\n","GeV/c");
1059 REGISTER_VARIABLE("mcPyLER", getMcPyLER, "[Eventbased] Returns truth value of the y component of the incoming positron momentum in the laboratory frame.\n\n","GeV/c");
1060 REGISTER_VARIABLE("mcPzLER", getMcPzLER, "[Eventbased] Returns truth value of the z component of the incoming positron momentum in the laboratory frame.\n\n","GeV/c");
1061
1062
1063
1064 REGISTER_VARIABLE("IPX", getIPX, R"DOC(
1065[Eventbased] Returns x coordinate of the measured interaction point.
1066
1067.. note:: For old data and uncalibrated MC files this will return 0.0.
1068
1069.. note:: You might hear tracking and calibration people refer to this as the ``BeamSpot``.
1070
1071)DOC","cm");
1072 REGISTER_VARIABLE("IPY", getIPY, "[Eventbased] Returns y coordinate of the measured interaction point.\n\n","cm");
1073 REGISTER_VARIABLE("IPZ", getIPZ, "[Eventbased] Returns z coordinate of the measured interaction point.\n\n","cm");
1074 REGISTER_VARIABLE("IPCov(i,j)", ipCovMatrixElement, "[Eventbased] Returns (i,j)-th element of the covariance matrix of the measured interaction point.\n\n",":math:`\\text{cm}^2`");
1075
1076 REGISTER_VARIABLE("genIPX", getGenIPX, R"DOC(
1077[Eventbased] Returns x coordinate of the interaction point used for the underlying **MC generation**.
1078Returns NaN for data.
1079
1080.. note:: This is normally smeared from 0.0
1081
1082)DOC","cm");
1083 REGISTER_VARIABLE("genIPY", getGenIPY, "[Eventbased] Returns y coordinate of the interaction point used for the underlying **MC generation**. Returns NaN for data.\n\n","cm");
1084 REGISTER_VARIABLE("genIPZ", getGenIPZ, "[Eventbased] Returns z coordinate of the interaction point used for the underlying **MC generation**. Returns NaN for data.\n\n","cm");
1085
1086 REGISTER_VARIABLE("date", eventYearMonthDay, R"DOC(
1087[Eventbased] Returns the date when the event was recorded, a number of the form YYYYMMDD (in UTC).
1088
1089.. seealso:: :b2:var:`year`, :b2:var:`eventTimeSeconds`, :b2:var:`eventTimeSecondsFractionRemainder`, provided for convenience.
1090)DOC");
1091 REGISTER_VARIABLE("year", eventYear, R"DOC(
1092[Eventbased] Returns the year when the event was recorded (in UTC).
1093
1094.. tip::
1095 For more precise event time, see :b2:var:`eventTimeSeconds` and :b2:var:`eventTimeSecondsFractionRemainder`.
1096)DOC");
1097 REGISTER_VARIABLE("eventTimeSeconds", eventTimeSeconds,
1098 "[Eventbased] Time of the event (truncated down) since 1970/1/1 (Unix epoch).\n\n","s");
1099 REGISTER_VARIABLE("eventTimeSecondsFractionRemainder", eventTimeSecondsFractionRemainder, R"DOC(
1100[Eventbased] Remainder of the event time.
1101
1102.. tip:: Use eventTimeSeconds + eventTimeSecondsFractionRemainder to get the total event time in seconds.
1103
1104)DOC","s");
1105
1106 REGISTER_VARIABLE("timeSincePrevTriggerClockTicks", timeSincePrevTriggerClockTicks,
1107 "[Eventbased] Time since the previous trigger (127MHz=RF/4 clock).\n\n","clock ticks");
1108
1109 REGISTER_VARIABLE("timeSincePrevTriggerMicroSeconds", timeSincePrevTriggerMicroSeconds,
1110 "[Eventbased] Time since the previous trigger.\n\n",":math:`\\mathrm{\\mu s}`");
1111
1112 REGISTER_VARIABLE("triggeredBunchNumberTTD", triggeredBunchNumberTTD, R"DOC(
1113[Eventbased] Number of triggered bunch ranging from 0-1279.
1114
1115.. warning:: This is the bunch number as provided by the TTD, which does not necessarily correspond to the 'global' SKB bunch number.
1116.. note:: There are a maximum of 5120 buckets, which could each carry one bunch of e+/e-, but we only have 1280 clock ticks (=5120/4) to identify the bunches.
1117)DOC");
1118
1119 REGISTER_VARIABLE("triggeredBunchNumber", triggeredBunchNumber, R"DOC(
1120[Eventbased] Number of triggered bunch ranging from 0-1279.
1121
1122.. note:: There are a maximum of 5120 buckets, which could each carry one bunch of e+/e-, but we only have 1280 clock ticks (=5120/4) to identify the bunches
1123)DOC");
1124
1125 REGISTER_VARIABLE("hasRecentInjection", hasRecentInjection,
1126 "[Eventbased] Returns 1 if an injection happened recently, 0 otherwise.");
1127
1128 REGISTER_VARIABLE("timeSinceLastInjectionSignalClockTicks", timeSinceLastInjectionSignalClockTicks, R"DOC(
1129[Eventbased] Time since the last injection pre-kick signal (127MHz=RF/4 clock)
1130
1131.. warning:: this returns the time without the delay until the injected bunch reaches the detector (which differs for HER/LER)
1132
1133)DOC","clock ticks");
1134
1135 REGISTER_VARIABLE("timeSinceLastInjectionSignalMicroSeconds", timeSinceLastInjectionSignalMicroSeconds, R"DOC(
1136[Eventbased] Time since the last injection pre-kick signal
1137
1138.. warning:: this returns the time without the delay until the injected bunch reaches the detector (which differs for HER/LER)
1139
1140)DOC",":math:`\\mathrm{\\mu s}`");
1141
1142 REGISTER_VARIABLE("timeSinceLastInjectionClockTicks", timeSinceLastInjectionClockTicks,
1143 "[Eventbased] Time since the last injected bunch passed by the detector.\n\n","clock ticks")
1144
1145 REGISTER_VARIABLE("timeSinceLastInjectionMicroSeconds", timeSinceLastInjectionMicroSeconds,
1146 "[Eventbased] Time since the last injected bunch passed by the detector.\n\n",":math:`\\mathrm{\\mu s}`")
1147
1148 REGISTER_VARIABLE("injectionInHER", injectionInHER,
1149 "[Eventbased] Returns 1 if injection was in HER, 0 otherwise.");
1150
1151 REGISTER_VARIABLE("revolutionCounter2", revolutionCounter2, R"DOC(
1152[Eventbased] The lowest bit of revolution counter, i.e. return 0 or 1
1153
1154.. note:: related to PXD data acquisition; PXD needs ~2 revolutions to read out one frame
1155)DOC");
1156
1157 VARIABLE_GROUP("EventKinematics");
1158
1159 REGISTER_VARIABLE("missingMomentumOfEvent", missingMomentumOfEvent, R"DOC(
1160[Eventbased] The magnitude of the missing momentum in laboratory frame.
1161
1162.. warning:: You have to run the Event Kinematics builder module for this variable to be meaningful.
1163.. seealso:: `modularAnalysis.buildEventKinematics`.
1164
1165)DOC","GeV/c");
1166 REGISTER_VARIABLE("missingMomentumOfEvent_Px", missingMomentumOfEvent_Px, R"DOC(
1167[Eventbased] The x component of the missing momentum in laboratory frame.
1168
1169)DOC","GeV/c");
1170 REGISTER_VARIABLE("missingMomentumOfEvent_Py", missingMomentumOfEvent_Py, R"DOC(
1171[Eventbased] The y component of the missing momentum in laboratory frame.
1172
1173)DOC","GeV/c");
1174 REGISTER_VARIABLE("missingMomentumOfEvent_Pz", missingMomentumOfEvent_Pz, R"DOC(
1175[Eventbased] The z component of the missing momentum in laboratory frame.
1176
1177)DOC","GeV/c");
1178 REGISTER_VARIABLE("missingMomentumOfEvent_theta", missingMomentumOfEvent_theta, R"DOC(
1179[Eventbased] The theta angle of the missing momentum of the event in laboratory frame.
1180
1181)DOC","rad");
1182 REGISTER_VARIABLE("missingMomentumOfEventCMS", missingMomentumOfEventCMS, R"DOC(
1183[Eventbased] The magnitude of the missing momentum in center-of-mass frame.
1184
1185)DOC","GeV/c");
1186 REGISTER_VARIABLE("genMissingMomentumOfEventCMS", genMissingMomentumOfEventCMS, R"DOC(
1187[Eventbased] The magnitude of the missing momentum in center-of-mass frame from generator
1188
1189)DOC","GeV/c");
1190 REGISTER_VARIABLE("missingMomentumOfEventCMS_Px", missingMomentumOfEventCMS_Px, R"DOC(
1191[Eventbased] The x component of the missing momentum in center-of-mass frame.
1192
1193)DOC","GeV/c");
1194 REGISTER_VARIABLE("missingMomentumOfEventCMS_Py", missingMomentumOfEventCMS_Py, R"DOC(
1195[Eventbased] The y component of the missing momentum in center-of-mass frame.
1196
1197)DOC","GeV/c");
1198 REGISTER_VARIABLE("missingMomentumOfEventCMS_Pz", missingMomentumOfEventCMS_Pz, R"DOC(
1199[Eventbased] The z component of the missing momentum in center-of-mass frame.
1200
1201)DOC","GeV/c");
1202 REGISTER_VARIABLE("missingMomentumOfEventCMS_theta", missingMomentumOfEventCMS_theta, R"DOC(
1203[Eventbased] The theta angle of the missing momentum in center-of-mass frame.
1204
1205)DOC","rad");
1206 REGISTER_VARIABLE("missingEnergyOfEventCMS", missingEnergyOfEventCMS, R"DOC(
1207[Eventbased] The missing energy in center-of-mass frame.
1208
1209)DOC","GeV");
1210 REGISTER_VARIABLE("genMissingEnergyOfEventCMS", genMissingEnergyOfEventCMS, R"DOC(
1211[Eventbased] The missing energy in center-of-mass frame from generator.
1212
1213)DOC","GeV");
1214 REGISTER_VARIABLE("missingMass2OfEvent", missingMass2OfEvent, R"DOC(
1215[Eventbased] The missing mass squared.
1216
1217)DOC",":math:`[\\text{GeV}/\\text{c}^2]^2`");
1218 REGISTER_VARIABLE("genMissingMass2OfEvent", genMissingMass2OfEvent, R"DOC(
1219[Eventbased] The missing mass squared from generator
1220
1221)DOC",":math:`[\\text{GeV}/\\text{c}^2]^2`");
1222 REGISTER_VARIABLE("visibleEnergyOfEventCMS", visibleEnergyOfEventCMS, R"DOC(
1223[Eventbased] The visible energy in center-of-mass frame.
1224
1225)DOC","GeV");
1226 REGISTER_VARIABLE("genVisibleEnergyOfEventCMS", genVisibleEnergyOfEventCMS, R"DOC(
1227[Eventbased] The visible energy in center-of-mass frame from generator.
1228
1229)DOC","GeV");
1230 REGISTER_VARIABLE("totalPhotonsEnergyOfEvent", totalPhotonsEnergyOfEvent, R"DOC(
1231[Eventbased] The energy in laboratory frame of all the photons.
1232
1233)DOC","GeV");
1234 REGISTER_VARIABLE("genTotalPhotonsEnergyOfEvent", genTotalPhotonsEnergyOfEvent, R"DOC(
1235[Eventbased] The energy in laboratory frame of all the photons. from generator.
1236
1237)DOC","GeV");
1238 REGISTER_VARIABLE("eventT0CalculatedWithSVDInfo", eventT0CalculatedWithSVDInfo, R"DOC(
1239[Eventbased] It returns true if the SVD subdetector contributed in the calculation of the EventT0.
1240Please note that other subdetectors may also have contributed, so store the variables for these as well.
1241)DOC");
1242 REGISTER_VARIABLE("eventT0CalculatedWithCDCInfo", eventT0CalculatedWithCDCInfo, R"DOC(
1243[Eventbased] It returns true if the CDC subdetector contributed in the calculation of the EventT0.
1244Please note that other subdetectors may also have contributed, so store the variables for these as well.
1245)DOC");
1246 REGISTER_VARIABLE("eventT0CalculatedWithECLInfo", eventT0CalculatedWithECLInfo, R"DOC(
1247[Eventbased] It returns true if the ECL subdetector contributed in the calculation of the EventT0.
1248Please note that other subdetectors may also have contributed, so store the variables for these as well.
1249)DOC");
1250
1251 VARIABLE_GROUP("Event (cDST only)");
1252 REGISTER_VARIABLE("eventT0", eventT0, R"DOC(
1253[Eventbased][Calibration] The Event t0, is the time of the event relative to the trigger time.
1254
1255.. note::
1256 The event time can be measured by several sub-detectors including the SVD, CDC, ECL, and TOP.
1257 This eventT0 variable is the final combined value of all the event time measurements.
1258 Currently, only the SVD and ECL are used in this combination.
1259
1260)DOC","ns");
1261 }
1263}
static const double electronMass
electron mass
Definition Const.h:686
static const double doubleNaN
quiet_NaN
Definition Const.h:704
@ c_nPhotons
CR is split into n photons (N1)
Definition ECLCluster.h:41
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
Definition ECLCluster.h:43
bool isMC() const
Do we have generated, not real data?
static Environment & Instance()
Static method to get a reference to the Environment instance.
Abstract base class for different kinds of events.