9#include <analysis/modules/Pi0VetoEfficiencySystematics/Pi0VetoEfficiencySystematics.h>
12#include <framework/datastore/StoreObjPtr.h>
13#include <framework/core/ModuleParam.templateDetails.h>
14#include <framework/core/Environment.h>
15#include <analysis/VariableManager/Manager.h>
16#include <analysis/dataobjects/ParticleList.h>
34 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.");
36 std::vector<std::string> emptylist;
50 std::map<std::string, double> values;
51 for (
const auto& i_variable : variables) {
54 B2ERROR(
"Variable '" << i_variable <<
"' is not available in Variable::Manager!");
56 values.insert(std::make_pair(i_variable, std::get<double>(var->function(particle))));
70 B2ERROR(
"Please provide pi0veto threshold from 0.10 to 0.99 for Pi0VetoEfficiencySystematicsModule");
87 B2ERROR(
"ParticleList " << iList <<
" not found");
91 size_t nPart = particleList->getListSize();
92 for (
size_t iPart = 0; iPart < nPart; iPart++) {
93 auto particle = particleList->getParticle(iPart);
95 int nSelected = selectedParticles.size();
98 B2ERROR(
"You selected " << nSelected <<
" particle(s). Select only a hard photon");
101 const Particle* selectedDaughterParticle = selectedParticles[0];
110 if (hardPhoton->
getParticleSource() == Particle::EParticleSourceObject::c_ECLCluster
114 for (
const auto& entry : info) {
115 const std::string extraInfoName =
"Pi0VetoEfficiencySystematics_" +
m_mode +
m_suffix +
"_" + entry.first;
118 B2INFO(
"extraInfo " << extraInfoName <<
" has been already set and will be overwritten. Original: "
119 << B->
getExtraInfo(extraInfoName) <<
", New: " << entry.second);
127 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.
Class to store reconstructed particles.
void setExtraInfo(const std::string &name, double value)
Sets the user-defined data of given name to the given value.
bool hasExtraInfo(const std::string &name) const
Return whether the extra info with the given name is set.
int getPDGCode(void) const
Returns PDG code.
void addExtraInfo(const std::string &name, double value)
Sets the user-defined data of given name to the given value.
EParticleSourceObject getParticleSource() const
Returns particle source as defined with enum EParticleSourceObject.
double getExtraInfo(const std::string &name) const
Return given value if set.
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.