9#include <analysis/variables/BeamBackground.h>
11#include <analysis/VariableManager/Manager.h>
12#include <framework/dataobjects/BackgroundInfo.h>
13#include <framework/dataobjects/BackgroundMetaData.h>
14#include <framework/datastore/DataStore.h>
15#include <framework/datastore/StoreObjPtr.h>
20namespace Belle2::Variable {
23 const BackgroundInfo::BackgroundDescr* getBackgroundDescription()
29 const auto bkgDescriptions = bkgInfo->getBackgrounds();
32 auto bkgDescription = std::find_if(bkgDescriptions.begin(), bkgDescriptions.end(), [](
const auto & d) { return d.type == BackgroundMetaData::getDefaultBackgroundOverlayType(); });
33 if (bkgDescription != bkgDescriptions.end())
34 return &(*bkgDescription);
40 int beamBackgroundReuseRate(
const Particle*)
42 const auto* bkgDescription = getBackgroundDescription();
43 if (not bkgDescription)
44 return std::numeric_limits<int>::quiet_NaN();
45 return bkgDescription->reused;
48 int beamBackgroundEvents(
const Particle*)
50 const auto* bkgDescription = getBackgroundDescription();
51 if (not bkgDescription)
52 return std::numeric_limits<int>::quiet_NaN();
53 return bkgDescription->numEvents;
56 VARIABLE_GROUP(
"BeamBackgroundOverlay");
57 REGISTER_VARIABLE(
"beamBackgroundReuseRate", beamBackgroundReuseRate,
58 "[Eventbased] Reuse rate of the background overlay events used for producing the file.",
"");
59 REGISTER_VARIABLE(
"beamBackgroundEvents", beamBackgroundEvents,
60 "[Eventbased] Total number of the background overlay events used for producing the file.",
"");
@ c_Persistent
Object is available during entire execution time.