9#include <analysis/modules/Pi0VetoEfficiencySystematics/Pi0VetoEfficiencySystematics.h>
11#include <framework/datastore/StoreObjPtr.h>
12#include <framework/core/ModuleParam.templateDetails.h>
13#include <analysis/VariableManager/Manager.h>
14#include <analysis/dataobjects/ParticleList.h>
32 setDescription(
"Includes data/MC weights for pi0 veto efficiency as extraInfo for a given particle list. One must call writeP0EtaVeto function in advance. Weights and their errors will be provided for given mode and threshold.");
35 std::vector<std::string> emptylist;
49 std::map<std::string, double> values;
50 for (
const auto& i_variable : variables) {
53 B2ERROR(
"Variable '" << i_variable <<
"' is not available in Variable::Manager!");
55 values.insert(std::make_pair(i_variable, std::get<double>(var->function(particle))));
69 B2ERROR(
"Please provide pi0veto threshold from 0.10 to 0.99 for Pi0VetoEfficiencySystematicsModule");
86 B2ERROR(
"ParticleList " << iList <<
" not found");
90 size_t nPart = particleList->getListSize();
91 for (
size_t iPart = 0; iPart < nPart; iPart++) {
92 auto particle = particleList->getParticle(iPart);
94 int nSelected = selectedParticles.size();
97 B2ERROR(
"You selected " << nSelected <<
" particle(s). Select only a hard photon");
100 const Particle* selectedDaughterParticle = selectedParticles[0];
109 if (hardPhoton->
getParticleSource() == Particle::EParticleSourceObject::c_ECLCluster
113 for (
const auto& entry : info) {
114 const std::string extraInfoName =
"Pi0VetoEfficiencySystematics_" +
m_mode +
m_suffix +
"_" + entry.first;
115 if (B->hasExtraInfo(extraInfoName)) {
116 if (B->getExtraInfo(extraInfoName) != entry.second) {
117 B2INFO(
"extraInfo " << extraInfoName <<
" has been already set and will be overwritten. Original: "
118 << B->getExtraInfo(extraInfoName) <<
", New: " << entry.second);
119 B->setExtraInfo(extraInfoName, entry.second);
122 B->addExtraInfo(extraInfoName, entry.second);
126 B2WARNING(
"The given hard photon is not from ECL or not photon");
int getPDGCode() const
PDG code.
static const ParticleType photon
photon particle
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
std::vector< const Particle * > getSelectionParticles(const Particle *particle)
Get a vector of pointers with selected daughters in the decay tree.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Class to store reconstructed particles.
int getPDGCode(void) const
Returns PDG code.
EParticleSourceObject getParticleSource() const
Returns particle source as defined with enum EParticleSourceObject.
std::vector< std::string > m_ParticleLists
input particle lists
virtual void initialize() override
Initializes the module.
virtual void event() override
Function to be executed at each event.
std::string m_decayString
Decay string to select primary photon.
double m_threshold
Threshold of pi0 veto.
WeightInfo getInfo(const Particle *particle)
Get LookUp information for the particle.
std::string m_suffix
Suffix of extrainfo name.
std::unique_ptr< DBObjPtr< ParticleWeightingLookUpTable > > m_ParticleWeightingLookUpTable
Pointer to the table in DB.
DecayDescriptor m_decayDescriptor
decay descriptor which specifies the primary photon
std::string m_tableName
Table name of the payloads.
Pi0VetoEfficiencySystematicsModule()
Constructor: Sets the description, the properties and the parameters of the module.
void addPi0VetoEfficiencyRatios(Particle *B, const Particle *hardPhoton)
function to add appropriate data/mc ratio weight to a particle
std::string m_mode
Mode of pi0 veto.
Type-safe access to single objects in the data store.
std::vector< std::string > resolveCollections(const std::vector< std::string > &variables)
Resolve Collection Returns variable names corresponding to the given collection or if it is not a col...
const Var * getVariable(std::string name)
Get the variable belonging to the given key.
static Manager & Instance()
get singleton instance.
std::map< std::string, double > WeightInfo
Weight information: a line from the weight lookup table.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.
A variable returning a floating-point value for a given Particle.