10#include <analysis/modules/PhotonEfficiencySystematics/PhotonEfficiencySystematics.h>
12#include <analysis/dataobjects/ParticleList.h>
13#include <analysis/VariableManager/Manager.h>
15#include <framework/datastore/StoreObjPtr.h>
16#include <framework/core/ModuleParam.templateDetails.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)
53 std::map<std::string, double> values;
54 for (
const auto& i_variable : variables) {
57 B2ERROR(
"Variable '" << i_variable <<
"' is not available in Variable::Manager!");
59 values.insert(std::make_pair(i_variable, std::get<double>(var->function(particle))));
78 B2ERROR(
"ParticleList " << iList <<
" not found");
82 size_t nPart = particleList->getListSize();
83 for (
size_t iPart = 0; iPart < nPart; iPart++) {
84 auto particle = particleList->getParticle(iPart);
93 if (particle->getParticleSource() == Particle::EParticleSourceObject::c_ECLCluster
97 for (
const auto& entry : info) {
98 const std::string extraInfoName =
m_tableName +
"_" + entry.first;
99 if (particle->hasExtraInfo(extraInfoName)) {
100 if (particle->getExtraInfo(extraInfoName) != entry.second) {
101 B2INFO(
"extraInfo " << extraInfoName <<
" has been already set and will be overwritten. Original: "
102 << particle->getExtraInfo(extraInfoName) <<
", New: " << entry.second);
103 particle->setExtraInfo(extraInfoName, entry.second);
106 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.
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.
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.