10#include <analysis/modules/PhotonEfficiencySystematics/PhotonEfficiencySystematics.h>
13#include <framework/datastore/StoreObjPtr.h>
14#include <framework/core/ModuleParam.templateDetails.h>
15#include <framework/core/Environment.h>
16#include <analysis/VariableManager/Manager.h>
35 R
"DOC(Module to include data/MC weights for photon detection efficiency. Include in your code as
39 mypath.add_module("PhotonEfficiencySystematics", particleLists=['gamma:cut'], tableName=tableName_Weight)
52 std::map<std::string, double> values;
53 for (
const auto& i_variable : variables) {
56 B2ERROR(
"Variable '" << i_variable <<
"' is not available in Variable::Manager!");
58 values.insert(std::make_pair(i_variable, std::get<double>(var->function(particle))));
77 B2ERROR(
"ParticleList " << iList <<
" not found");
81 size_t nPart = particleList->getListSize();
82 for (
size_t iPart = 0; iPart < nPart; iPart++) {
83 auto particle = particleList->getParticle(iPart);
92 if (particle->getParticleSource() == Particle::EParticleSourceObject::c_ECLCluster
96 for (
const auto& entry : info) {
97 const std::string extraInfoName =
m_tableName +
"_" + entry.first;
98 if (particle->hasExtraInfo(extraInfoName)) {
99 if (particle->getExtraInfo(extraInfoName) != entry.second) {
100 B2INFO(
"extraInfo " << extraInfoName <<
" has been already set and will be overwritten. Original: "
101 << particle->getExtraInfo(extraInfoName) <<
", New: " << entry.second);
102 particle->setExtraInfo(extraInfoName, entry.second);
105 particle->addExtraInfo(extraInfoName, entry.second);
int getPDGCode() const
PDG code.
static const ParticleType photon
photon particle
void setDescription(const std::string &description)
Sets the description of the module.
Class to store reconstructed particles.
std::vector< std::string > m_ParticleLists
input particle lists
virtual void event() override
Function to be executed at each event.
WeightInfo getInfo(const Particle *particle)
Get LookUp information for the particle.
std::unique_ptr< DBObjPtr< ParticleWeightingLookUpTable > > m_ParticleWeightingLookUpTable
Pointer to the table in DB.
virtual void beginRun() override
Nothing so far.
std::string m_tableName
Name of the table.
PhotonEfficiencySystematicsModule()
Constructor: Sets the description, the properties and the parameters of the module.
void addPhotonDetectionEfficiencyRatios(Particle *particle)
function to add appropriate data/mc ratio weight to a particle
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.