10#include <analysis/variables/EventVariables.h>
13#include <analysis/VariableManager/Manager.h>
16#include <framework/datastore/StoreArray.h>
17#include <framework/datastore/StoreObjPtr.h>
18#include <framework/dataobjects/EventMetaData.h>
21#include <analysis/dataobjects/Particle.h>
22#include <analysis/dataobjects/EventKinematics.h>
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>
30#include <framework/dataobjects/EventT0.h>
31#include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
34#include <framework/database/DBObjPtr.h>
35#include <mdst/dbobjects/BeamSpot.h>
37#include <analysis/utility/PCmsLabTransform.h>
39#include <framework/core/Environment.h>
40#include <framework/logging/Logger.h>
51 bool isMC(
const Particle*)
56 bool eventType(
const Particle*)
58 StoreArray<MCParticle> mcparticles;
59 return (mcparticles.getEntries()) > 0 ? 0 : 1;
62 bool isContinuumEvent(
const Particle*)
64 return (isNotContinuumEvent(
nullptr) == 1 ? 0 : 1);
67 bool isChargedBEvent(
const Particle*)
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;
77 double isUnmixedBEvent(
const Particle*)
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);
85 if (bPDGs.size() == 2) {
86 return bPDGs[0] * bPDGs[1] < 0;
91 bool isNotContinuumEvent(
const Particle*)
93 StoreArray<MCParticle> mcParticles;
94 for (
const MCParticle& mcp : mcParticles) {
95 int pdg_no = mcp.getPDG();
96 if (mcp.getMother() ==
nullptr &&
100 (pdg_no == 300553) ||
101 (pdg_no == 9000553) ||
102 (pdg_no == 9010553)))
108 int nMCParticles(
const Particle*)
110 StoreArray<MCParticle> mcps;
111 return mcps.getEntries();
114 int nPrimaryMCParticles(
const Particle*)
117 StoreArray<MCParticle> mcps;
118 for (
const auto& mcp : mcps)
119 if (mcp.isPrimaryParticle())
124 int nInitialPrimaryMCParticles(
const Particle*)
127 StoreArray<MCParticle> mcps;
128 for (
const auto& mcp : mcps)
129 if (mcp.isInitial() and mcp.isPrimaryParticle())
134 int nVirtualPrimaryMCParticles(
const Particle*)
137 StoreArray<MCParticle> mcps;
138 for (
const auto& mcp : mcps)
139 if (mcp.isVirtual() and mcp.isPrimaryParticle())
144 int nTracks(
const Particle*)
146 StoreArray<Track> tracks;
147 return tracks.getEntries();
150 int nV0s(
const Particle*)
153 return v0s.getEntries();
156 int nValidV0s(
const Particle*)
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())
171 int nNeutralECLClusters(
const Particle*,
const std::vector<double>& hypothesis)
173 if (hypothesis.size() != 1)
174 B2FATAL(
"Number of arguments of nNeutralECLClusters must be 1.");
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)");
182 StoreArray<ECLCluster> eclClusters;
184 for (
int i = 0; i < eclClusters.getEntries(); i++) {
185 auto cluster = eclClusters[i];
186 if (!cluster->isNeutral())
196 int nChargeZeroTrackFits(
const Particle*)
198 StoreArray<TrackFitResult> tfrs;
200 for (
const auto& t : tfrs)
201 if (t.getChargeSign() == 0) out++;
205 double belleECLEnergy(
const Particle*)
207 StoreArray<ECLCluster> eclClusters;
209 for (
int i = 0; i < eclClusters.getEntries(); ++i) {
219 int nKLMClusters(
const Particle*)
221 StoreArray<KLMCluster> klmClusters;
222 return klmClusters.getEntries();
225 int expNum(
const Particle*)
227 StoreObjPtr<EventMetaData> evtMetaData;
228 int exp_no = evtMetaData->getExperiment();
232 int productionIdentifier(
const Particle*)
234 StoreObjPtr<EventMetaData> evtMetaData;
235 int eventProduction = evtMetaData->getProduction();
236 return eventProduction;
239 int evtNum(
const Particle*)
241 StoreObjPtr<EventMetaData> evtMetaData;
242 int evt_no = evtMetaData->getEvent();
246 int runNum(
const Particle*)
248 StoreObjPtr<EventMetaData> evtMetaData;
249 int run_no = evtMetaData->getRun();
254 double getCMSEnergy(
const Particle*)
257 return T.getCMSEnergy();
260 double getBeamPx(
const Particle*)
263 return (T.getBeamFourMomentum()).Px();
266 double getBeamPy(
const Particle*)
269 return (T.getBeamFourMomentum()).Py();
272 double getBeamPz(
const Particle*)
275 return (T.getBeamFourMomentum()).Pz();
278 double getBeamE(
const Particle*)
281 return (T.getBeamFourMomentum()).E();
285 static ROOT::Math::PxPyPzEVector getTotalMcFinalStateMomentum()
287 StoreArray<MCParticle> mcps;
288 ROOT::Math::PxPyPzEVector sum;
289 for (
const auto& mcp : mcps) {
291 if (mcp.isPrimaryParticle() and not(mcp.isInitial() or mcp.isVirtual())) {
292 const MCParticle* mother = mcp.getMother();
294 if (not mother or not(mother->isPrimaryParticle() and not(mother->isInitial() or mother->isVirtual())))
303 static ROOT::Math::PxPyPzEVector getMcBeamMomentum(
int charge)
305 StoreArray<MCParticle> mcps;
306 for (
const auto& mcp : mcps) {
307 if (mcp.isInitial() && mcp.getPDG() == -charge * 11) {
308 return mcp.get4Vector();
317 static ROOT::Math::PxPyPzEVector getBeamMomentum(
int charge)
320 double EbeamCM = T.getCMSEnergy() / 2;
323 ROOT::Math::PxPyPzEVector pCM(0, 0, -charge * pBeamCM, EbeamCM);
325 return T.cmsToLab(pCM);
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();}
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();}
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();}
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();}
347 double getCMSEnergyMC(
const Particle*)
349 StoreArray<MCParticle> mcps;
352 }
else return getTotalMcFinalStateMomentum().M();
355 double getTotalEnergyMC(
const Particle*)
357 StoreArray<MCParticle> mcps;
360 }
else return getTotalMcFinalStateMomentum().E();
363 double getGenIPX(
const Particle*)
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();
374 double getGenIPY(
const Particle*)
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();
383 double getGenIPZ(
const Particle*)
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();
392 double getIPX(
const Particle*)
394 static DBObjPtr<BeamSpot> beamSpotDB;
395 return (beamSpotDB->getIPPosition()).X();
398 double getIPY(
const Particle*)
400 static DBObjPtr<BeamSpot> beamSpotDB;
401 return (beamSpotDB->getIPPosition()).Y();
404 double getIPZ(
const Particle*)
406 static DBObjPtr<BeamSpot> beamSpotDB;
407 return (beamSpotDB->getIPPosition()).Z();
410 double ipCovMatrixElement(
const Particle*,
const std::vector<double>& element)
412 int elementI = std::lround(element[0]);
413 int elementJ = std::lround(element[1]);
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));
420 if (elementJ < 0 || elementJ > 2) {
421 B2WARNING(
"Requested IP covariance matrix element is out of boundaries [0 - 2]:" <<
LogVar(
"j", elementJ));
427 static DBObjPtr<BeamSpot> beamSpotDB;
428 return beamSpotDB->getCovVertex()(elementI, elementJ);
432 double missingMomentumOfEvent(
const Particle*)
434 StoreObjPtr<EventKinematics> evtShape;
436 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
439 double missing = evtShape->getMissingMomentum().R();
443 double missingMomentumOfEvent_Px(
const Particle*)
445 StoreObjPtr<EventKinematics> evtShape;
447 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
450 double missing = evtShape->getMissingMomentum().X();
454 double missingMomentumOfEvent_Py(
const Particle*)
456 StoreObjPtr<EventKinematics> evtShape;
458 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
461 double missing = evtShape->getMissingMomentum().Y();
465 double missingMomentumOfEvent_Pz(
const Particle*)
467 StoreObjPtr<EventKinematics> evtShape;
469 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
472 double missing = evtShape->getMissingMomentum().Z();
476 double missingMomentumOfEvent_theta(
const Particle*)
478 StoreObjPtr<EventKinematics> evtShape;
480 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
483 double missing = evtShape->getMissingMomentum().Theta();
487 double missingMomentumOfEventCMS(
const Particle*)
489 StoreObjPtr<EventKinematics> evtShape;
491 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
494 double missing = evtShape->getMissingMomentumCMS().R();
498 double genMissingMomentumOfEventCMS(
const Particle*)
500 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
502 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
505 double missing = evtShape->getMissingMomentumCMS().R();
509 double missingMomentumOfEventCMS_Px(
const Particle*)
511 StoreObjPtr<EventKinematics> evtShape;
513 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
516 double missing = evtShape->getMissingMomentumCMS().X();
520 double missingMomentumOfEventCMS_Py(
const Particle*)
522 StoreObjPtr<EventKinematics> evtShape;
524 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
527 double missing = evtShape->getMissingMomentumCMS().Y();
531 double missingMomentumOfEventCMS_Pz(
const Particle*)
533 StoreObjPtr<EventKinematics> evtShape;
535 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
538 double missing = evtShape->getMissingMomentumCMS().Z();
542 double missingMomentumOfEventCMS_theta(
const Particle*)
544 StoreObjPtr<EventKinematics> evtShape;
546 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
549 double theta = evtShape->getMissingMomentumCMS().Theta();
553 double missingEnergyOfEventCMS(
const Particle*)
555 StoreObjPtr<EventKinematics> evtShape;
557 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
560 double missing = evtShape->getMissingEnergyCMS();
564 double genMissingEnergyOfEventCMS(
const Particle*)
566 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
568 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
571 double missing = evtShape->getMissingEnergyCMS();
576 double missingMass2OfEvent(
const Particle*)
578 StoreObjPtr<EventKinematics> evtShape;
580 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
583 double missing = evtShape->getMissingMass2();
587 double genMissingMass2OfEvent(
const Particle*)
589 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
591 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
594 double missing = evtShape->getMissingMass2();
598 double visibleEnergyOfEventCMS(
const Particle*)
600 StoreObjPtr<EventKinematics> evtShape;
602 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
605 double visible = evtShape->getVisibleEnergyCMS();
609 double genVisibleEnergyOfEventCMS(
const Particle*)
611 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
613 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
616 double visible = evtShape->getVisibleEnergyCMS();
621 double totalPhotonsEnergyOfEvent(
const Particle*)
623 StoreObjPtr<EventKinematics> evtShape;
625 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
628 double energyOfPhotons = evtShape->getTotalPhotonsEnergy();
629 return energyOfPhotons;
632 double genTotalPhotonsEnergyOfEvent(
const Particle*)
634 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
636 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
639 double energyOfPhotons = evtShape->getTotalPhotonsEnergy();
640 return energyOfPhotons;
643 double eventYearMonthDay(
const Particle*)
645 StoreObjPtr<EventMetaData> evtMetaData;
649 std::time_t rawtime = trunc(evtMetaData->getTime() / 1e9);
650 auto tt = std::gmtime(&rawtime);
651 int y = tt->tm_year + 1900;
652 int m = tt->tm_mon + 1;
654 return (y * 1e4) + (m * 1e2) + d;
657 double eventYear(
const Particle*)
659 StoreObjPtr<EventMetaData> evtMetaData;
663 std::time_t rawtime = trunc(evtMetaData->getTime() / 1e9);
664 auto tt = std::gmtime(&rawtime);
665 return tt->tm_year + 1900;
668 double eventTimeSeconds(
const Particle*)
670 StoreObjPtr<EventMetaData> evtMetaData;
675 double evtTime = trunc(evtMetaData->getTime() / 1e9);
680 double eventTimeSecondsFractionRemainder(
const Particle*)
682 StoreObjPtr<EventMetaData> evtMetaData;
687 double evtTime = trunc(evtMetaData->getTime() / 1e9);
689 double evtTimeFrac = (evtMetaData->getTime() - evtTime * 1e9) / 1e9;
694 double eventT0(
const Particle*)
696 StoreObjPtr<EventT0> evtT0;
699 B2WARNING(
"StoreObjPtr<EventT0> does not exist, are you running over cDST data?");
703 if (evtT0->hasEventT0()) {
704 return evtT0->getEventT0();
710 double timeSincePrevTriggerClockTicks(
const Particle*)
712 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
715 if (!TTDInfo.isValid()) {
716 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
721 if (TTDInfo->isValid()) {
722 return TTDInfo->getTimeSincePrevTrigger();
728 double timeSincePrevTriggerMicroSeconds(
const Particle*)
730 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
733 if (!TTDInfo.isValid()) {
734 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
739 if (TTDInfo->isValid()) {
740 return TTDInfo->getTimeSincePrevTriggerInMicroSeconds();
746 double triggeredBunchNumberTTD(
const Particle*)
748 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
751 if (!TTDInfo.isValid()) {
752 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
757 if (TTDInfo->isValid()) {
758 return TTDInfo->getBunchNumber();
764 double triggeredBunchNumber(
const Particle*)
766 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
769 if (!TTDInfo.isValid()) {
770 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
775 if (TTDInfo->isValid()) {
776 return TTDInfo->getTriggeredBunchNumberGlobal();
782 double hasRecentInjection(
const Particle*)
784 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
787 if (!TTDInfo.isValid()) {
788 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
793 if (TTDInfo->isValid()) {
794 return TTDInfo->hasInjection();
800 double timeSinceLastInjectionSignalClockTicks(
const Particle*)
802 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
805 if (!TTDInfo.isValid()) {
806 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
811 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
812 return TTDInfo->getTimeSinceLastInjection();
818 double timeSinceLastInjectionSignalMicroSeconds(
const Particle*)
820 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
823 if (!TTDInfo.isValid()) {
824 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
829 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
830 return TTDInfo->getTimeSinceLastInjectionInMicroSeconds();
836 double timeSinceLastInjectionClockTicks(
const Particle*)
838 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
841 if (!TTDInfo.isValid()) {
842 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
847 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
848 return TTDInfo->getTimeSinceInjectedBunch();
854 double timeSinceLastInjectionMicroSeconds(
const Particle*)
856 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
859 if (!TTDInfo.isValid()) {
860 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
865 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
866 return TTDInfo->getTimeSinceInjectedBunchInMicroSeconds();
872 double injectionInHER(
const Particle*)
874 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
877 if (!TTDInfo.isValid()) {
878 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
883 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
884 return TTDInfo->isHER();
890 double revolutionCounter2(
const Particle*)
892 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
895 if (!TTDInfo.isValid()) {
896 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
901 if (TTDInfo->isValid()) {
902 return TTDInfo->isRevo2();
909 VARIABLE_GROUP(
"Event");
911 REGISTER_VARIABLE(
"isMC", isMC,
912 "[Eventbased] Returns 1 if current basf2 process is running over simulated (Monte-Carlo) dataset and 0 in case of real experimental data.");
913 REGISTER_VARIABLE(
"isContinuumEvent", isContinuumEvent,
914 "[Eventbased] Returns 1.0 if event doesn't contain a :math:`\\Upsilon(4S)` particle on generator level, 0.0 otherwise.");
915 REGISTER_VARIABLE(
"isNotContinuumEvent", isNotContinuumEvent,
916 "[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.");
918 REGISTER_VARIABLE(
"isChargedBEvent", isChargedBEvent,
919 "[Eventbased] Returns 1.0 if event contains a charged B-meson on generator level.");
920 REGISTER_VARIABLE(
"isUnmixedBEvent", isUnmixedBEvent,
921 R
"DOC([Eventbased] Returns 1.0 if the event contains opposite flavor neutral B-mesons on generator level,
9220.0 in case of same flavor B-mesons and NaN if the event has no generated neutral B.)DOC");
924 REGISTER_VARIABLE("nTracks", nTracks, R
"DOC(
925[Eventbased] Returns the total number of tracks (unfiltered) in the event.
927.. warning:: This variable is exceedingly background-dependent and should not really be used in any selections (other than perhaps for monitoring purposes).
928.. seealso:: :b2:var:`nCleanedTracks` for a more useful variable for use in selections.
930 REGISTER_VARIABLE("nChargeZeroTrackFits", nChargeZeroTrackFits, R
"DOC(
931[Eventbased] Returns number of track fits with zero charge.
934 Sometimes, track fits can have zero charge, if background or non IP originating tracks, for example, are fit from the IP.
935 These tracks are excluded from particle lists, but a large amount of charge zero
936 fits may indicate problems with whole event constraints
937 or abnominally high beam backgrounds and/or noisy events.
940 REGISTER_VARIABLE("belleECLEnergy", belleECLEnergy, R
"DOC(
941[Eventbased][Legacy] Returns total energy in ECL in the event as used in Belle 1 analyses.
944 For Belle II use cases use either ``totalEnergyOfParticlesInList(gamma:all)``,
945 or (probably better) fill a photon list with some minimal cleanup cuts and use that instead:
947 .. code-block:: python
949 from variables import variables as vm
950 fillParticleList("gamma:cleaned", "E > 0.05 and isFromECL==1", path=path)
951 fillParticleList("e+:cleaned", "clusterE > 0.05", path=path)
952 vm.addAlias("myNeutralECLEnergy", "totalEnergyOfParticlesInList(gamma:cleaned)")
953 vm.addAlias("myChargedECLEnergy", "totalEnergyOfParticlesInList(e+:cleaned)")
954 vm.addAlias("myECLEnergy", "formula(myNeutralECLEnergy+myChargedECLEnergy)")
957 REGISTER_VARIABLE("nKLMClusters", nKLMClusters,
958 "[Eventbased] Returns number of KLM clusters in the event.");
959 REGISTER_VARIABLE("nNeutralECLClusters(hypothesis)", nNeutralECLClusters,
960 "[Eventbased] Returns number of neutral ECL clusters with a given hypothesis, 1:nPhotons, 2:NeutralHadron.");
961 REGISTER_VARIABLE("nV0s", nV0s,
962 "[Eventbased] Returns number of V0s in the event.");
963 REGISTER_VARIABLE("nValidV0s", nValidV0s,
964 "[Eventbased] Returns number of V0s consisting of pair of tracks with opposite charges.");
965 REGISTER_VARIABLE("nMCParticles", nMCParticles,
966 "[Eventbased] Returns number of MCParticles in the event.");
967 REGISTER_VARIABLE("nPrimaryMCParticles", nPrimaryMCParticles,
968 "[Eventbased] Returns number of primary MCParticles in the event.");
969 REGISTER_VARIABLE("nInitialPrimaryMCParticles", nInitialPrimaryMCParticles,
970 "[Eventbased] Returns number of initial primary MCParticles in the event.");
971 REGISTER_VARIABLE("nVirtualPrimaryMCParticles", nVirtualPrimaryMCParticles,
972 "[Eventbased] Returns number of virtual primary MCParticles in the event.");
974 REGISTER_VARIABLE("expNum", expNum, "[Eventbased] Returns the experiment number.");
975 REGISTER_VARIABLE("evtNum", evtNum, "[Eventbased] Returns the event number.");
976 REGISTER_VARIABLE("runNum", runNum, "[Eventbased] Returns the run number.");
977 REGISTER_VARIABLE("productionIdentifier", productionIdentifier, R"DOC(
978[Eventbased] Production identifier.
979Uniquely identifies an MC sample by the (grid-jargon) production ID.
980This is useful when analysing large MC samples split between more than one production or combining different MC samples (e.g. combining all continuum samples).
981In such cases the event numbers are sequential *only within a production*, so experiment/run/event will restart with every new sample analysed.
983.. tip:: Experiment/run/event/production is unique for all MC samples. Experiment/run/event is unique for data.
985.. seealso:: `Where can I rely on uniqueness of the ['__experiment__', '__run__', '__event__', '__candidate__'] combination? <https://questions.belle2.org/question/9704>`__
988 REGISTER_VARIABLE("Ecms", getCMSEnergy,
"[Eventbased] Returns center-of-mass energy.\n\n",
"GeV");
989 REGISTER_VARIABLE(
"beamE", getBeamE,
"[Eventbased] Returns total beam energy in the laboratory frame.\n\n",
"GeV");
990 REGISTER_VARIABLE(
"beamPx", getBeamPx,
"[Eventbased] Returns x component of total beam momentum in the laboratory frame.\n\n",
"GeV/c");
991 REGISTER_VARIABLE(
"beamPy", getBeamPy,
"[Eventbased] Returns y component of total beam momentum in the laboratory frame.\n\n",
"GeV/c");
992 REGISTER_VARIABLE(
"beamPz", getBeamPz,
"[Eventbased] Returns z component of total beam momentum in the laboratory frame.\n\n",
"GeV/c");
993 REGISTER_VARIABLE(
"EcmsMC", getCMSEnergyMC,
"[Eventbased] Truth value of sqrt(s)\n\n",
"GeV");
994 REGISTER_VARIABLE(
"totalEnergyMC", getTotalEnergyMC,
"[Eventbased] Truth value of sum of energies of all the generated particles\n\n",
"GeV");
997 REGISTER_VARIABLE(
"PxHER", getPxHER,
"[Eventbased] Returns truth value of the x component of the incoming electron momentum in the laboratory frame.\n\n",
"GeV/c");
998 REGISTER_VARIABLE(
"PyHER", getPyHER,
"[Eventbased] Returns truth value of the y component of the incoming electron momentum in the laboratory frame.\n\n",
"GeV/c");
999 REGISTER_VARIABLE(
"PzHER", getPzHER,
"[Eventbased] Returns truth value of the z component of the incoming electron momentum in the laboratory frame.\n\n",
"GeV/c");
1000 REGISTER_VARIABLE(
"PxLER", getPxLER,
"[Eventbased] Returns truth value of the x component of the incoming positron momentum in the laboratory frame.\n\n",
"GeV/c");
1001 REGISTER_VARIABLE(
"PyLER", getPyLER,
"[Eventbased] Returns truth value of the y component of the incoming positron momentum in the laboratory frame.\n\n",
"GeV/c");
1002 REGISTER_VARIABLE(
"PzLER", getPzLER,
"[Eventbased] Returns truth value of the z component of the incoming positron momentum in the laboratory frame.\n\n",
"GeV/c");
1004 REGISTER_VARIABLE(
"mcPxHER", getMcPxHER,
"[Eventbased] Returns x component of the electron beam momentum in the laboratory frame.\n\n",
"GeV/c");
1005 REGISTER_VARIABLE(
"mcPyHER", getMcPyHER,
"[Eventbased] Returns y component of the electron beam momentum in the laboratory frame.\n\n",
"GeV/c");
1006 REGISTER_VARIABLE(
"mcPzHER", getMcPzHER,
"[Eventbased] Returns z component of the electron beam momentum in the laboratory frame.\n\n",
"GeV/c");
1007 REGISTER_VARIABLE(
"mcPxLER", getMcPxLER,
"[Eventbased] Returns x component of the positron beam momentum in the laboratory frame.\n\n",
"GeV/c");
1008 REGISTER_VARIABLE(
"mcPyLER", getMcPyLER,
"[Eventbased] Returns y component of the positron beam momentum in the laboratory frame.\n\n",
"GeV/c");
1009 REGISTER_VARIABLE(
"mcPzLER", getMcPzLER,
"[Eventbased] Returns z component of the positron beam momentum in the laboratory frame.\n\n",
"GeV/c");
1013 REGISTER_VARIABLE(
"IPX", getIPX, R
"DOC(
1014[Eventbased] Returns x coordinate of the measured interaction point.
1016.. note:: For old data and uncalibrated MC files this will return 0.0.
1018.. note:: You might hear tracking and calibration people refer to this as the ``BeamSpot``.
1021 REGISTER_VARIABLE("IPY", getIPY, "[Eventbased] Returns y coordinate of the measured interaction point.\n\n","cm");
1022 REGISTER_VARIABLE("IPZ", getIPZ, "[Eventbased] Returns z coordinate of the measured interaction point.\n\n","cm");
1023 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`");
1025 REGISTER_VARIABLE("genIPX", getGenIPX, R"DOC(
1026[Eventbased] Returns x coordinate of the interaction point used for the underlying **MC generation**.
1027Returns NaN for data.
1029.. note:: This is normally smeared from 0.0
1032 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");
1033 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");
1035 REGISTER_VARIABLE("date", eventYearMonthDay, R"DOC(
1036[Eventbased] Returns the date when the event was recorded, a number of the form YYYYMMDD (in UTC).
1038.. seealso:: :b2:var:`year`, :b2:var:`eventTimeSeconds`, :b2:var:`eventTimeSecondsFractionRemainder`, provided for convenience.
1040 REGISTER_VARIABLE("year", eventYear, R
"DOC(
1041[Eventbased] Returns the year when the event was recorded (in UTC).
1044 For more precise event time, see :b2:var:`eventTimeSeconds` and :b2:var:`eventTimeSecondsFractionRemainder`.
1046 REGISTER_VARIABLE("eventTimeSeconds", eventTimeSeconds,
1047 "[Eventbased] Time of the event (truncated down) since 1970/1/1 (Unix epoch).\n\n",
"s");
1048 REGISTER_VARIABLE(
"eventTimeSecondsFractionRemainder", eventTimeSecondsFractionRemainder, R
"DOC(
1049[Eventbased] Remainder of the event time.
1051.. tip:: Use eventTimeSeconds + eventTimeSecondsFractionRemainder to get the total event time in seconds.
1055 REGISTER_VARIABLE("timeSincePrevTriggerClockTicks", timeSincePrevTriggerClockTicks,
1056 "[Eventbased] Time since the previous trigger (127MHz=RF/4 clock).\n\n","clock ticks");
1058 REGISTER_VARIABLE("timeSincePrevTriggerMicroSeconds", timeSincePrevTriggerMicroSeconds,
1059 "[Eventbased] Time since the previous trigger.\n\n",":math:`\\mathrm{\\mu s}`");
1061 REGISTER_VARIABLE("triggeredBunchNumberTTD", triggeredBunchNumberTTD, R"DOC(
1062[Eventbased] Number of triggered bunch ranging from 0-1279.
1064.. warning:: This is the bunch number as provided by the TTD, which does not necessarily correspond to the 'global' SKB bunch number.
1065.. 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.
1068 REGISTER_VARIABLE("triggeredBunchNumber", triggeredBunchNumber, R
"DOC(
1069[Eventbased] Number of triggered bunch ranging from 0-1279.
1071.. 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
1074 REGISTER_VARIABLE("hasRecentInjection", hasRecentInjection,
1075 "[Eventbased] Returns 1 if an injection happened recently, 0 otherwise.");
1077 REGISTER_VARIABLE(
"timeSinceLastInjectionSignalClockTicks", timeSinceLastInjectionSignalClockTicks, R
"DOC(
1078[Eventbased] Time since the last injection pre-kick signal (127MHz=RF/4 clock)
1080.. warning:: this returns the time without the delay until the injected bunch reaches the detector (which differs for HER/LER)
1082)DOC","clock ticks");
1084 REGISTER_VARIABLE("timeSinceLastInjectionSignalMicroSeconds", timeSinceLastInjectionSignalMicroSeconds, R"DOC(
1085[Eventbased] Time since the last injection pre-kick signal
1087.. warning:: this returns the time without the delay until the injected bunch reaches the detector (which differs for HER/LER)
1089)DOC",":math:`\\mathrm{\\mu s}`");
1091 REGISTER_VARIABLE("timeSinceLastInjectionClockTicks", timeSinceLastInjectionClockTicks,
1092 "[Eventbased] Time since the last injected bunch passed by the detector.\n\n","clock ticks")
1094 REGISTER_VARIABLE("timeSinceLastInjectionMicroSeconds", timeSinceLastInjectionMicroSeconds,
1095 "[Eventbased] Time since the last injected bunch passed by the detector.\n\n",":math:`\\mathrm{\\mu s}`")
1097 REGISTER_VARIABLE("injectionInHER", injectionInHER,
1098 "[Eventbased] Returns 1 if injection was in HER, 0 otherwise.");
1100 REGISTER_VARIABLE("revolutionCounter2", revolutionCounter2, R"DOC(
1101[Eventbased] The lowest bit of revolution counter, i.e. return 0 or 1
1103.. note:: related to PXD data acquisition; PXD needs ~2 revolutions to read out one frame
1106 VARIABLE_GROUP("EventKinematics");
1108 REGISTER_VARIABLE(
"missingMomentumOfEvent", missingMomentumOfEvent, R
"DOC(
1109[Eventbased] The magnitude of the missing momentum in laboratory frame.
1111.. warning:: You have to run the Event Kinematics builder module for this variable to be meaningful.
1112.. seealso:: `modularAnalysis.buildEventKinematics`.
1115 REGISTER_VARIABLE("missingMomentumOfEvent_Px", missingMomentumOfEvent_Px, R"DOC(
1116[Eventbased] The x component of the missing momentum in laboratory frame.
1119 REGISTER_VARIABLE("missingMomentumOfEvent_Py", missingMomentumOfEvent_Py, R"DOC(
1120[Eventbased] The y component of the missing momentum in laboratory frame.
1123 REGISTER_VARIABLE("missingMomentumOfEvent_Pz", missingMomentumOfEvent_Pz, R"DOC(
1124[Eventbased] The z component of the missing momentum in laboratory frame.
1127 REGISTER_VARIABLE("missingMomentumOfEvent_theta", missingMomentumOfEvent_theta, R"DOC(
1128[Eventbased] The theta angle of the missing momentum of the event in laboratory frame.
1131 REGISTER_VARIABLE("missingMomentumOfEventCMS", missingMomentumOfEventCMS, R"DOC(
1132[Eventbased] The magnitude of the missing momentum in center-of-mass frame.
1135 REGISTER_VARIABLE("genMissingMomentumOfEventCMS", genMissingMomentumOfEventCMS, R"DOC(
1136[Eventbased] The magnitude of the missing momentum in center-of-mass frame from generator
1139 REGISTER_VARIABLE("missingMomentumOfEventCMS_Px", missingMomentumOfEventCMS_Px, R"DOC(
1140[Eventbased] The x component of the missing momentum in center-of-mass frame.
1143 REGISTER_VARIABLE("missingMomentumOfEventCMS_Py", missingMomentumOfEventCMS_Py, R"DOC(
1144[Eventbased] The y component of the missing momentum in center-of-mass frame.
1147 REGISTER_VARIABLE("missingMomentumOfEventCMS_Pz", missingMomentumOfEventCMS_Pz, R"DOC(
1148[Eventbased] The z component of the missing momentum in center-of-mass frame.
1151 REGISTER_VARIABLE("missingMomentumOfEventCMS_theta", missingMomentumOfEventCMS_theta, R"DOC(
1152[Eventbased] The theta angle of the missing momentum in center-of-mass frame.
1155 REGISTER_VARIABLE("missingEnergyOfEventCMS", missingEnergyOfEventCMS, R"DOC(
1156[Eventbased] The missing energy in center-of-mass frame.
1159 REGISTER_VARIABLE("genMissingEnergyOfEventCMS", genMissingEnergyOfEventCMS, R"DOC(
1160[Eventbased] The missing energy in center-of-mass frame from generator.
1163 REGISTER_VARIABLE("missingMass2OfEvent", missingMass2OfEvent, R"DOC(
1164[Eventbased] The missing mass squared.
1166)DOC",":math:`[\\text{GeV}/\\text{c}^2]^2`");
1167 REGISTER_VARIABLE("genMissingMass2OfEvent", genMissingMass2OfEvent, R"DOC(
1168[Eventbased] The missing mass squared from generator
1170)DOC",":math:`[\\text{GeV}/\\text{c}^2]^2`");
1171 REGISTER_VARIABLE("visibleEnergyOfEventCMS", visibleEnergyOfEventCMS, R"DOC(
1172[Eventbased] The visible energy in center-of-mass frame.
1175 REGISTER_VARIABLE("genVisibleEnergyOfEventCMS", genVisibleEnergyOfEventCMS, R"DOC(
1176[Eventbased] The visible energy in center-of-mass frame from generator.
1179 REGISTER_VARIABLE("totalPhotonsEnergyOfEvent", totalPhotonsEnergyOfEvent, R"DOC(
1180[Eventbased] The energy in laboratory frame of all the photons.
1183 REGISTER_VARIABLE("genTotalPhotonsEnergyOfEvent", genTotalPhotonsEnergyOfEvent, R"DOC(
1184[Eventbased] The energy in laboratory frame of all the photons. from generator.
1188 VARIABLE_GROUP("Event (cDST only)");
1189 REGISTER_VARIABLE("eventT0", eventT0, R"DOC(
1190[Eventbased][Calibration] The Event t0, is the time of the event relative to the trigger time.
1193 The event time can be measured by several sub-detectors including the SVD, CDC, ECL, and TOP.
1194 This eventT0 variable is the final combined value of all the event time measurements.
1195 Currently, only the SVD and ECL are used in this combination.
static const double electronMass
electron mass
static const double doubleNaN
quiet_NaN
@ c_nPhotons
CR is split into n photons (N1)
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
bool isMC() const
Do we have generated, not real data?
static Environment & Instance()
Static method to get a reference to the Environment instance.
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
Class to store variables with their name which were sent to the logging service.
Abstract base class for different kinds of events.