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