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>
29 #include <framework/dataobjects/EventT0.h>
30 #include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
33 #include <framework/database/DBObjPtr.h>
34 #include <mdst/dbobjects/BeamSpot.h>
36 #include <analysis/utility/PCmsLabTransform.h>
38 #include <framework/core/Environment.h>
39 #include <framework/logging/Logger.h>
49 bool isMC(
const Particle*)
54 bool eventType(
const Particle*)
56 StoreArray<MCParticle> mcparticles;
57 return (mcparticles.getEntries()) > 0 ? 0 : 1;
60 bool isContinuumEvent(
const Particle*)
62 return (isNotContinuumEvent(
nullptr) == 1 ? 0 : 1);
65 bool isChargedBEvent(
const Particle*)
67 StoreArray<MCParticle> mcParticles;
68 for (
const auto& mcp : mcParticles) {
69 int pdg_no = mcp.getPDG();
70 if (abs(pdg_no) == 521)
return 1.0;
75 double isUnmixedBEvent(
const Particle*)
77 StoreArray<MCParticle> mcParticles;
78 std::vector<int> bPDGs;
79 for (
const auto& mcp : mcParticles) {
80 int pdg_no = mcp.getPDG();
81 if (abs(pdg_no) == 511) bPDGs.push_back(pdg_no);
83 if (bPDGs.size() == 2) {
84 return bPDGs[0] * bPDGs[1] < 0;
89 bool isNotContinuumEvent(
const Particle*)
91 StoreArray<MCParticle> mcParticles;
92 for (
const MCParticle& mcp : mcParticles) {
93 int pdg_no = mcp.getPDG();
94 if (mcp.getMother() ==
nullptr &&
99 (pdg_no == 9000553) ||
100 (pdg_no == 9010553)))
106 int nMCParticles(
const Particle*)
108 StoreArray<MCParticle> mcps;
109 return mcps.getEntries();
112 int nPrimaryMCParticles(
const Particle*)
115 StoreArray<MCParticle> mcps;
116 for (
const auto& mcp : mcps)
117 if (mcp.isPrimaryParticle())
122 int nInitialPrimaryMCParticles(
const Particle*)
125 StoreArray<MCParticle> mcps;
126 for (
const auto& mcp : mcps)
127 if (mcp.isInitial() and mcp.isPrimaryParticle())
132 int nVirtualPrimaryMCParticles(
const Particle*)
135 StoreArray<MCParticle> mcps;
136 for (
const auto& mcp : mcps)
137 if (mcp.isVirtual() and mcp.isPrimaryParticle())
142 int nTracks(
const Particle*)
144 StoreArray<Track> tracks;
145 return tracks.getEntries();
148 int nChargeZeroTrackFits(
const Particle*)
150 StoreArray<TrackFitResult> tfrs;
152 for (
const auto& t : tfrs)
153 if (t.getChargeSign() == 0) out++;
157 double belleECLEnergy(
const Particle*)
159 StoreArray<ECLCluster> eclClusters;
161 for (
int i = 0; i < eclClusters.getEntries(); ++i) {
171 int nKLMClusters(
const Particle*)
173 StoreArray<KLMCluster> klmClusters;
174 return klmClusters.getEntries();
177 int expNum(
const Particle*)
179 StoreObjPtr<EventMetaData> evtMetaData;
180 int exp_no = evtMetaData->getExperiment();
184 int productionIdentifier(
const Particle*)
186 StoreObjPtr<EventMetaData> evtMetaData;
187 int eventProduction = evtMetaData->getProduction();
188 return eventProduction;
191 int evtNum(
const Particle*)
193 StoreObjPtr<EventMetaData> evtMetaData;
194 int evt_no = evtMetaData->getEvent();
198 int runNum(
const Particle*)
200 StoreObjPtr<EventMetaData> evtMetaData;
201 int run_no = evtMetaData->getRun();
206 double getCMSEnergy(
const Particle*)
209 return T.getCMSEnergy();
212 double getBeamPx(
const Particle*)
215 return (T.getBeamFourMomentum()).Px();
218 double getBeamPy(
const Particle*)
221 return (T.getBeamFourMomentum()).Py();
224 double getBeamPz(
const Particle*)
227 return (T.getBeamFourMomentum()).Pz();
230 double getBeamE(
const Particle*)
233 return (T.getBeamFourMomentum()).E();
236 ROOT::Math::PxPyPzEVector getCMSEnergyMCVector()
238 StoreArray<MCParticle> mcps;
239 ROOT::Math::PxPyPzEVector sum;
240 for (
const auto& mcp : mcps) {
242 if (mcp.isPrimaryParticle() and not(mcp.isInitial() or mcp.isVirtual())) {
243 const MCParticle* mother = mcp.getMother();
245 if (not mother or not(mother->isPrimaryParticle() and not(mother->isInitial() or mother->isVirtual())))
246 sum += mcp.get4Vector();
252 double getCMSEnergyMC(
const Particle*)
254 StoreArray<MCParticle> mcps;
257 }
else return getCMSEnergyMCVector().M();
260 double getTotalEnergyMC(
const Particle*)
262 StoreArray<MCParticle> mcps;
265 }
else return getCMSEnergyMCVector().E();
268 double getGenIPX(
const Particle*)
272 StoreArray<MCParticle> mcps;
273 for (
const auto& mcp : mcps)
274 if (not mcp.isInitial() and not mcp.isVirtual() and mcp.isPrimaryParticle())
275 return mcp.getVertex().X();
279 double getGenIPY(
const Particle*)
281 StoreArray<MCParticle> mcps;
282 for (
const auto& mcp : mcps)
283 if (not mcp.isInitial() and not mcp.isVirtual() and mcp.isPrimaryParticle())
284 return mcp.getVertex().Y();
288 double getGenIPZ(
const Particle*)
290 StoreArray<MCParticle> mcps;
291 for (
const auto& mcp : mcps)
292 if (not mcp.isInitial() and not mcp.isVirtual() and mcp.isPrimaryParticle())
293 return mcp.getVertex().Z();
297 double getIPX(
const Particle*)
299 static DBObjPtr<BeamSpot> beamSpotDB;
300 return (beamSpotDB->getIPPosition()).X();
303 double getIPY(
const Particle*)
305 static DBObjPtr<BeamSpot> beamSpotDB;
306 return (beamSpotDB->getIPPosition()).Y();
309 double getIPZ(
const Particle*)
311 static DBObjPtr<BeamSpot> beamSpotDB;
312 return (beamSpotDB->getIPPosition()).Z();
315 double ipCovMatrixElement(
const Particle*,
const std::vector<double>& element)
317 int elementI = int(std::lround(element[0]));
318 int elementJ = int(std::lround(element[1]));
320 if (elementI < 0 || elementI > 3) {
321 B2WARNING(
"Requested IP covariance matrix element is out of boundaries [0 - 3]:" <<
LogVar(
"i", elementI));
324 if (elementJ < 0 || elementJ > 3) {
325 B2WARNING(
"Requested particle's momentumVertex covariance matrix element is out of boundaries [0 - 3]:" <<
LogVar(
"j", elementJ));
329 static DBObjPtr<BeamSpot> beamSpotDB;
330 return beamSpotDB->getCovVertex()(elementI, elementJ);
334 double missingMomentumOfEvent(
const Particle*)
336 StoreObjPtr<EventKinematics> evtShape;
338 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
341 double missing = evtShape->getMissingMomentum().R();
345 double missingMomentumOfEvent_Px(
const Particle*)
347 StoreObjPtr<EventKinematics> evtShape;
349 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
352 double missing = evtShape->getMissingMomentum().X();
356 double missingMomentumOfEvent_Py(
const Particle*)
358 StoreObjPtr<EventKinematics> evtShape;
360 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
363 double missing = evtShape->getMissingMomentum().Y();
367 double missingMomentumOfEvent_Pz(
const Particle*)
369 StoreObjPtr<EventKinematics> evtShape;
371 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
374 double missing = evtShape->getMissingMomentum().Z();
378 double missingMomentumOfEvent_theta(
const Particle*)
380 StoreObjPtr<EventKinematics> evtShape;
382 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
385 double missing = evtShape->getMissingMomentum().Theta();
389 double missingMomentumOfEventCMS(
const Particle*)
391 StoreObjPtr<EventKinematics> evtShape;
393 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
396 double missing = evtShape->getMissingMomentumCMS().R();
400 double genMissingMomentumOfEventCMS(
const Particle*)
402 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
404 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
407 double missing = evtShape->getMissingMomentumCMS().R();
411 double missingMomentumOfEventCMS_Px(
const Particle*)
413 StoreObjPtr<EventKinematics> evtShape;
415 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
418 double missing = evtShape->getMissingMomentumCMS().X();
422 double missingMomentumOfEventCMS_Py(
const Particle*)
424 StoreObjPtr<EventKinematics> evtShape;
426 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
429 double missing = evtShape->getMissingMomentumCMS().Y();
433 double missingMomentumOfEventCMS_Pz(
const Particle*)
435 StoreObjPtr<EventKinematics> evtShape;
437 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
440 double missing = evtShape->getMissingMomentumCMS().Z();
444 double missingMomentumOfEventCMS_theta(
const Particle*)
446 StoreObjPtr<EventKinematics> evtShape;
448 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
451 double theta = evtShape->getMissingMomentumCMS().Theta();
455 double missingEnergyOfEventCMS(
const Particle*)
457 StoreObjPtr<EventKinematics> evtShape;
459 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
462 double missing = evtShape->getMissingEnergyCMS();
466 double genMissingEnergyOfEventCMS(
const Particle*)
468 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
470 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
473 double missing = evtShape->getMissingEnergyCMS();
478 double missingMass2OfEvent(
const Particle*)
480 StoreObjPtr<EventKinematics> evtShape;
482 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
485 double missing = evtShape->getMissingMass2();
489 double genMissingMass2OfEvent(
const Particle*)
491 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
493 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
496 double missing = evtShape->getMissingMass2();
500 double visibleEnergyOfEventCMS(
const Particle*)
502 StoreObjPtr<EventKinematics> evtShape;
504 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
507 double visible = evtShape->getVisibleEnergyCMS();
511 double genVisibleEnergyOfEventCMS(
const Particle*)
513 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
515 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
518 double visible = evtShape->getVisibleEnergyCMS();
523 double totalPhotonsEnergyOfEvent(
const Particle*)
525 StoreObjPtr<EventKinematics> evtShape;
527 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule?");
530 double energyOfPhotons = evtShape->getTotalPhotonsEnergy();
531 return energyOfPhotons;
534 double genTotalPhotonsEnergyOfEvent(
const Particle*)
536 StoreObjPtr<EventKinematics> evtShape(
"EventKinematicsFromMC");
538 B2WARNING(
"Cannot find missing momentum information, did you forget to run EventKinematicsModule with usingMC parameter set to true?");
541 double energyOfPhotons = evtShape->getTotalPhotonsEnergy();
542 return energyOfPhotons;
545 double eventYearMonthDay(
const Particle*)
547 StoreObjPtr<EventMetaData> evtMetaData;
551 std::time_t rawtime = trunc(evtMetaData->getTime() / 1e9);
552 auto tt = std::gmtime(&rawtime);
553 int y = tt->tm_year + 1900;
554 int m = tt->tm_mon + 1;
556 return (y * 1e4) + (m * 1e2) + d;
559 double eventYear(
const Particle*)
561 StoreObjPtr<EventMetaData> evtMetaData;
565 std::time_t rawtime = trunc(evtMetaData->getTime() / 1e9);
566 auto tt = std::gmtime(&rawtime);
567 return tt->tm_year + 1900;
570 double eventTimeSeconds(
const Particle*)
572 StoreObjPtr<EventMetaData> evtMetaData;
577 double evtTime = trunc(evtMetaData->getTime() / 1e9);
582 double eventTimeSecondsFractionRemainder(
const Particle*)
584 StoreObjPtr<EventMetaData> evtMetaData;
589 double evtTime = trunc(evtMetaData->getTime() / 1e9);
591 double evtTimeFrac = (evtMetaData->getTime() - evtTime * 1e9) / 1e9;
596 double eventT0(
const Particle*)
598 StoreObjPtr<EventT0> evtT0;
601 B2WARNING(
"StoreObjPtr<EventT0> does not exist, are you running over cDST data?");
605 if (evtT0->hasEventT0()) {
606 return evtT0->getEventT0();
612 double timeSincePrevTriggerClockTicks(
const Particle*)
614 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
617 if (!TTDInfo.isValid()) {
618 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
623 if (TTDInfo->isValid()) {
624 return TTDInfo->getTimeSincePrevTrigger();
630 double timeSincePrevTriggerMicroSeconds(
const Particle*)
632 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
635 if (!TTDInfo.isValid()) {
636 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
641 if (TTDInfo->isValid()) {
642 return TTDInfo->getTimeSincePrevTriggerInMicroSeconds();
648 double triggeredBunchNumberTTD(
const Particle*)
650 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
653 if (!TTDInfo.isValid()) {
654 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
659 if (TTDInfo->isValid()) {
660 return TTDInfo->getBunchNumber();
666 double triggeredBunchNumber(
const Particle*)
668 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
671 if (!TTDInfo.isValid()) {
672 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
677 if (TTDInfo->isValid()) {
678 return TTDInfo->getTriggeredBunchNumberGlobal();
684 double hasRecentInjection(
const Particle*)
686 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
689 if (!TTDInfo.isValid()) {
690 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
695 if (TTDInfo->isValid()) {
696 return TTDInfo->hasInjection();
702 double timeSinceLastInjectionSignalClockTicks(
const Particle*)
704 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
707 if (!TTDInfo.isValid()) {
708 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
713 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
714 return TTDInfo->getTimeSinceLastInjection();
720 double timeSinceLastInjectionSignalMicroSeconds(
const Particle*)
722 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
725 if (!TTDInfo.isValid()) {
726 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
731 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
732 return TTDInfo->getTimeSinceLastInjectionInMicroSeconds();
738 double timeSinceLastInjectionClockTicks(
const Particle*)
740 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
743 if (!TTDInfo.isValid()) {
744 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
749 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
750 return TTDInfo->getTimeSinceInjectedBunch();
756 double timeSinceLastInjectionMicroSeconds(
const Particle*)
758 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
761 if (!TTDInfo.isValid()) {
762 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
767 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
768 return TTDInfo->getTimeSinceInjectedBunchInMicroSeconds();
774 double injectionInHER(
const Particle*)
776 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
779 if (!TTDInfo.isValid()) {
780 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
785 if (TTDInfo->isValid() && TTDInfo->hasInjection()) {
786 return TTDInfo->isHER();
792 double revolutionCounter2(
const Particle*)
794 StoreObjPtr<EventLevelTriggerTimeInfo> TTDInfo;
797 if (!TTDInfo.isValid()) {
798 B2WARNING(
"StoreObjPtr<EventLevelTriggerTimeInfo> does not exist, are you running over data reconstructed with release-05 or earlier?");
803 if (TTDInfo->isValid()) {
804 return TTDInfo->isRevo2();
811 VARIABLE_GROUP(
"Event");
813 REGISTER_VARIABLE(
"isMC", isMC,
814 "[Eventbased] Returns 1 if current basf2 process is running over simulated (Monte-Carlo) dataset and 0 in case of real experimental data.");
815 REGISTER_VARIABLE(
"isContinuumEvent", isContinuumEvent,
816 "[Eventbased] Returns 1.0 if event doesn't contain a :math:`\\Upsilon(4S)` particle on generator level, 0.0 otherwise.");
817 REGISTER_VARIABLE(
"isNotContinuumEvent", isNotContinuumEvent,
818 "[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.");
820 REGISTER_VARIABLE(
"isChargedBEvent", isChargedBEvent,
821 "[Eventbased] Returns 1.0 if event contains a charged B-meson on generator level.");
822 REGISTER_VARIABLE(
"isUnmixedBEvent", isUnmixedBEvent,
823 R
"DOC([Eventbased] Returns 1.0 if the event contains opposite flavor neutral B-mesons on generator level,
824 0.0 in case of same flavor B-mesons and NaN if the event has no generated neutral B.)DOC");
826 REGISTER_VARIABLE("nTracks", nTracks, R
"DOC(
827 [Eventbased] Returns the total number of tracks (unfiltered) in the event.
829 .. warning:: This variable is exceedingly background-dependent and should not really be used in any selections (other than perhaps for monitoring purposes).
830 .. seealso:: :b2:var:`nCleanedTracks` for a more useful variable for use in selections.
832 REGISTER_VARIABLE("nChargeZeroTrackFits", nChargeZeroTrackFits, R
"DOC(
833 [Eventbased] Returns number of track fits with zero charge.
836 Sometimes, track fits can have zero charge, if background or non IP originating tracks, for example, are fit from the IP.
837 These tracks are excluded from particle lists, but a large amount of charge zero
838 fits may indicate problems with whole event constraints
839 or abnominally high beam backgrounds and/or noisy events.
842 REGISTER_VARIABLE("belleECLEnergy", belleECLEnergy, R
"DOC(
843 [Eventbased][Legacy] Returns total energy in ECL in the event as used in Belle 1 analyses.
846 For Belle II use cases use either ``totalEnergyOfParticlesInList(gamma:all)``,
847 or (probably better) fill a photon list with some minimal cleanup cuts and use that instead:
849 .. code-block:: python
851 from variables import variables as vm
852 fillParticleList("gamma:cleaned", "E > 0.05 and isFromECL==1", path=path)
853 fillParticleList("e+:cleaned", "clusterE > 0.05", path=path)
854 vm.addAlias("myNeutralECLEnergy", "totalEnergyOfParticlesInList(gamma:cleaned)")
855 vm.addAlias("myChargedECLEnergy", "totalEnergyOfParticlesInList(e+:cleaned)")
856 vm.addAlias("myECLEnergy", "formula(myNeutralECLEnergy+myChargedECLEnergy)")
859 REGISTER_VARIABLE("nKLMClusters", nKLMClusters,
860 "[Eventbased] Returns number of KLM clusters in the event.");
861 REGISTER_VARIABLE("nMCParticles", nMCParticles,
862 "[Eventbased] Returns number of MCParticles in the event.");
863 REGISTER_VARIABLE("nPrimaryMCParticles", nPrimaryMCParticles,
864 "[Eventbased] Returns number of primary MCParticles in the event.");
865 REGISTER_VARIABLE("nInitialPrimaryMCParticles", nInitialPrimaryMCParticles,
866 "[Eventbased] Returns number of initial primary MCParticles in the event.");
867 REGISTER_VARIABLE("nVirtualPrimaryMCParticles", nVirtualPrimaryMCParticles,
868 "[Eventbased] Returns number of virtual primary MCParticles in the event.");
870 REGISTER_VARIABLE("expNum", expNum, "[Eventbased] Returns the experiment number.");
871 REGISTER_VARIABLE("evtNum", evtNum, "[Eventbased] Returns the event number.");
872 REGISTER_VARIABLE("runNum", runNum, "[Eventbased] Returns the run number.");
873 REGISTER_VARIABLE("productionIdentifier", productionIdentifier, R"DOC(
874 [Eventbased] Production identifier.
875 Uniquely identifies an MC sample by the (grid-jargon) production ID.
876 This is useful when analysing large MC samples split between more than one production or combining different MC samples (e.g. combining all continuum samples).
877 In such cases the event numbers are sequential *only within a production*, so experiment/run/event will restart with every new sample analysed.
879 .. tip:: Experiment/run/event/production is unique for all MC samples. Experiment/run/event is unique for data.
881 .. seealso:: `Where can I rely on uniqueness of the ['__experiment__', '__run__', '__event__', '__candidate__'] combination? <https://questions.belle2.org/question/9704>`__
884 REGISTER_VARIABLE("Ecms", getCMSEnergy,
"[Eventbased] Returns center-of-mass energy.\n\n",
"GeV");
885 REGISTER_VARIABLE(
"beamE", getBeamE,
"[Eventbased] Returns total beam energy in the laboratory frame.\n\n",
"GeV");
886 REGISTER_VARIABLE(
"beamPx", getBeamPx,
"[Eventbased] Returns x component of total beam momentum in the laboratory frame.\n\n",
"GeV/c");
887 REGISTER_VARIABLE(
"beamPy", getBeamPy,
"[Eventbased] Returns y component of total beam momentum in the laboratory frame.\n\n",
"GeV/c");
888 REGISTER_VARIABLE(
"beamPz", getBeamPz,
"[Eventbased] Returns z component of total beam momentum in the laboratory frame.\n\n",
"GeV/c");
889 REGISTER_VARIABLE(
"EcmsMC", getCMSEnergyMC,
"[Eventbased] Truth value of sqrt(s)\n\n",
"GeV");
890 REGISTER_VARIABLE(
"totalEnergyMC", getTotalEnergyMC,
"[Eventbased] Truth value of sum of energies of all the generated particles\n\n",
"GeV");
892 REGISTER_VARIABLE(
"IPX", getIPX, R
"DOC(
893 [Eventbased] Returns x coordinate of the measured interaction point.
895 .. note:: For old data and uncalibrated MC files this will return 0.0.
897 .. note:: You might hear tracking and calibration people refer to this as the ``BeamSpot``.
900 REGISTER_VARIABLE("IPY", getIPY, "[Eventbased] Returns y coordinate of the measured interaction point.\n\n","cm");
901 REGISTER_VARIABLE("IPZ", getIPZ, "[Eventbased] Returns z coordinate of the measured interaction point.\n\n","cm");
902 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`");
904 REGISTER_VARIABLE("genIPX", getGenIPX, R"DOC(
905 [Eventbased] Returns x coordinate of the interaction point used for the underlying **MC generation**.
906 Returns NaN for data.
908 .. note:: This is normally smeared from 0.0
911 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");
912 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");
914 REGISTER_VARIABLE("date", eventYearMonthDay, R"DOC(
915 [Eventbased] Returns the date when the event was recorded, a number of the form YYYYMMDD (in UTC).
917 .. seealso:: :b2:var:`year`, :b2:var:`eventTimeSeconds`, :b2:var:`eventTimeSecondsFractionRemainder`, provided for convenience.
919 REGISTER_VARIABLE("year", eventYear, R
"DOC(
920 [Eventbased] Returns the year when the event was recorded (in UTC).
923 For more precise event time, see :b2:var:`eventTimeSeconds` and :b2:var:`eventTimeSecondsFractionRemainder`.
925 REGISTER_VARIABLE("eventTimeSeconds", eventTimeSeconds,
926 "[Eventbased] Time of the event (truncated down) since 1970/1/1 (Unix epoch).\n\n",
"s");
927 REGISTER_VARIABLE(
"eventTimeSecondsFractionRemainder", eventTimeSecondsFractionRemainder, R
"DOC(
928 [Eventbased] Remainder of the event time.
930 .. tip:: Use eventTimeSeconds + eventTimeSecondsFractionRemainder to get the total event time in seconds.
934 REGISTER_VARIABLE("timeSincePrevTriggerClockTicks", timeSincePrevTriggerClockTicks,
935 "[Eventbased] Time since the previous trigger (127MHz=RF/4 clock).\n\n","clock ticks");
937 REGISTER_VARIABLE("timeSincePrevTriggerMicroSeconds", timeSincePrevTriggerMicroSeconds,
938 "[Eventbased] Time since the previous trigger.\n\n",":math:`\\mathrm{\\mu s}`");
940 REGISTER_VARIABLE("triggeredBunchNumberTTD", triggeredBunchNumberTTD, R"DOC(
941 [Eventbased] Number of triggered bunch ranging from 0-1279.
943 .. warning:: This is the bunch number as provided by the TTD, which does not necessarily correspond to the 'global' SKB bunch number.
944 .. 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.
947 REGISTER_VARIABLE("triggeredBunchNumber", triggeredBunchNumber, R
"DOC(
948 [Eventbased] Number of triggered bunch ranging from 0-1279.
950 .. 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
953 REGISTER_VARIABLE("hasRecentInjection", hasRecentInjection,
954 "[Eventbased] Returns 1 if an injection happened recently, 0 otherwise.");
956 REGISTER_VARIABLE(
"timeSinceLastInjectionSignalClockTicks", timeSinceLastInjectionSignalClockTicks, R
"DOC(
957 [Eventbased] Time since the last injection pre-kick signal (127MHz=RF/4 clock)
959 .. warning:: this returns the time without the delay until the injected bunch reaches the detector (which differs for HER/LER)
961 )DOC","clock ticks");
963 REGISTER_VARIABLE("timeSinceLastInjectionSignalMicroSeconds", timeSinceLastInjectionSignalMicroSeconds, R"DOC(
964 [Eventbased] Time since the last injection pre-kick signal
966 .. warning:: this returns the time without the delay until the injected bunch reaches the detector (which differs for HER/LER)
968 )DOC",":math:`\\mathrm{\\mu s}`");
970 REGISTER_VARIABLE("timeSinceLastInjectionClockTicks", timeSinceLastInjectionClockTicks,
971 "[Eventbased] Time since the last injected bunch passed by the detector.\n\n","clock ticks")
973 REGISTER_VARIABLE("timeSinceLastInjectionMicroSeconds", timeSinceLastInjectionMicroSeconds,
974 "[Eventbased] Time since the last injected bunch passed by the detector.\n\n",":math:`\\mathrm{\\mu s}`")
976 REGISTER_VARIABLE("injectionInHER", injectionInHER,
977 "[Eventbased] Returns 1 if injection was in HER, 0 otherwise.");
979 REGISTER_VARIABLE("revolutionCounter2", revolutionCounter2, R"DOC(
980 [Eventbased] The lowest bit of revolution counter, i.e. return 0 or 1
982 .. note:: related to PXD data acquisition; PXD needs ~2 revolutions to read out one frame
985 VARIABLE_GROUP("EventKinematics");
987 REGISTER_VARIABLE(
"missingMomentumOfEvent", missingMomentumOfEvent, R
"DOC(
988 [Eventbased] The magnitude of the missing momentum in laboratory frame.
990 .. warning:: You have to run the Event Kinematics builder module for this variable to be meaningful.
991 .. seealso:: `modularAnalysis.buildEventKinematics`.
994 REGISTER_VARIABLE("missingMomentumOfEvent_Px", missingMomentumOfEvent_Px, R"DOC(
995 [Eventbased] The x component of the missing momentum in laboratory frame.
998 REGISTER_VARIABLE("missingMomentumOfEvent_Py", missingMomentumOfEvent_Py, R"DOC(
999 [Eventbased] The y component of the missing momentum in laboratory frame.
1002 REGISTER_VARIABLE("missingMomentumOfEvent_Pz", missingMomentumOfEvent_Pz, R"DOC(
1003 [Eventbased] The z component of the missing momentum in laboratory frame.
1006 REGISTER_VARIABLE("missingMomentumOfEvent_theta", missingMomentumOfEvent_theta, R"DOC(
1007 [Eventbased] The theta angle of the missing momentum of the event in laboratory frame.
1010 REGISTER_VARIABLE("missingMomentumOfEventCMS", missingMomentumOfEventCMS, R"DOC(
1011 [Eventbased] The magnitude of the missing momentum in center-of-mass frame.
1014 REGISTER_VARIABLE("genMissingMomentumOfEventCMS", genMissingMomentumOfEventCMS, R"DOC(
1015 [Eventbased] The magnitude of the missing momentum in center-of-mass frame from generator
1018 REGISTER_VARIABLE("missingMomentumOfEventCMS_Px", missingMomentumOfEventCMS_Px, R"DOC(
1019 [Eventbased] The x component of the missing momentum in center-of-mass frame.
1022 REGISTER_VARIABLE("missingMomentumOfEventCMS_Py", missingMomentumOfEventCMS_Py, R"DOC(
1023 [Eventbased] The y component of the missing momentum in center-of-mass frame.
1026 REGISTER_VARIABLE("missingMomentumOfEventCMS_Pz", missingMomentumOfEventCMS_Pz, R"DOC(
1027 [Eventbased] The z component of the missing momentum in center-of-mass frame.
1030 REGISTER_VARIABLE("missingMomentumOfEventCMS_theta", missingMomentumOfEventCMS_theta, R"DOC(
1031 [Eventbased] The theta angle of the missing momentum in center-of-mass frame.
1034 REGISTER_VARIABLE("missingEnergyOfEventCMS", missingEnergyOfEventCMS, R"DOC(
1035 [Eventbased] The missing energy in center-of-mass frame.
1038 REGISTER_VARIABLE("genMissingEnergyOfEventCMS", genMissingEnergyOfEventCMS, R"DOC(
1039 [Eventbased] The missing energy in center-of-mass frame from generator.
1042 REGISTER_VARIABLE("missingMass2OfEvent", missingMass2OfEvent, R"DOC(
1043 [Eventbased] The missing mass squared.
1045 )DOC",":math:`[\\text{GeV}/\\text{c}^2]^2`");
1046 REGISTER_VARIABLE("genMissingMass2OfEvent", genMissingMass2OfEvent, R"DOC(
1047 [Eventbased] The missing mass squared from generator
1049 )DOC",":math:`[\\text{GeV}/\\text{c}^2]^2`");
1050 REGISTER_VARIABLE("visibleEnergyOfEventCMS", visibleEnergyOfEventCMS, R"DOC(
1051 [Eventbased] The visible energy in center-of-mass frame.
1054 REGISTER_VARIABLE("genVisibleEnergyOfEventCMS", genVisibleEnergyOfEventCMS, R"DOC(
1055 [Eventbased] The visible energy in center-of-mass frame from generator.
1058 REGISTER_VARIABLE("totalPhotonsEnergyOfEvent", totalPhotonsEnergyOfEvent, R"DOC(
1059 [Eventbased] The energy in laboratory frame of all the photons.
1062 REGISTER_VARIABLE("genTotalPhotonsEnergyOfEvent", genTotalPhotonsEnergyOfEvent, R"DOC(
1063 [Eventbased] The energy in laboratory frame of all the photons. from generator.
1067 VARIABLE_GROUP("Event (cDST only)");
1068 REGISTER_VARIABLE("eventT0", eventT0, R"DOC(
1069 [Eventbased][Calibration] The Event t0, is the time of the event relative to the trigger time.
1072 The event time can be measured by several sub-detectors including the SVD, CDC, ECL, and TOP.
1073 This eventT0 variable is the final combined value of all the event time measurements.
1074 Currently, only the SVD and ECL are used in this combination.
static const double doubleNaN
quiet_NaN
@ c_nPhotons
CR is split into n photons (N1)
bool isMC() const
Do we have generated, not real data?
static Environment & Instance()
Static method to get a reference to the Environment instance.
Class to store variables with their name which were sent to the logging service.
Abstract base class for different kinds of events.