10#include <analysis/modules/BiasCorrection/BiasCorrection.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>
18#include <Math/Vector4D.h>
37 R
"DOC(Module to modify energy from the lists. Include in your code as
41 mypath.add_module("EnergyBiasCorrection", particleLists=['gamma:cut'], scale=tableName_Weight)
43The module modifies the input particleLists by scaling energy as given by the scale in the LookUpTable
56 std::map<std::string, double> values;
57 for (
const auto& i_variable : variables) {
60 B2ERROR(
"Variable '" << i_variable <<
"' is not available in Variable::Manager!");
62 values.insert(std::make_pair(i_variable, std::get<double>(var->function(particle))));
72 B2ERROR(
"Attempting to run EnergyBiasCorrection on MC but this is only for data");
91 B2ERROR(
"ParticleList " << iList <<
" not found");
95 size_t nPart = particleList->getListSize();
96 for (
size_t iPart = 0; iPart < nPart; iPart++) {
97 auto particle = particleList->getParticle(iPart);
106 if (particle->
getParticleSource() == Particle::EParticleSourceObject::c_Composite) {
116 px += daughter->getPx();
117 py += daughter->getPy();
118 pz += daughter->getPz();
119 E += daughter->getEnergy();
121 const ROOT::Math::PxPyPzEVector vec(px, py, pz, E);
123 }
else if (particle->
getParticleSource() == Particle::EParticleSourceObject::c_ECLCluster
127 for (
const auto& entry : info) {
133 B2DEBUG(10,
"Called setMomentumScalingFactor for an unspecified, track-based or KLM cluster-based particle");
int getPDGCode() const
PDG code.
static const ParticleType photon
photon particle
std::vector< std::string > m_ParticleLists
input particle lists
void setEnergyScalingFactor(Particle *particle)
function to set scaling factor
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.
EnergyBiasCorrectionModule()
Constructor: Sets the description, the properties and the parameters of the module.
static Environment & Instance()
Static method to get a reference to the Environment instance.
void setDescription(const std::string &description)
Sets the description of the module.
Class to store reconstructed particles.
void updateJacobiMatrix()
Propagate the photon energy scaling to jacobian elements that were calculated using energy.
void writeExtraInfo(const std::string &name, const double value)
Sets the user defined extraInfo.
void setMomentumScalingFactor(double momentumScalingFactor)
Sets momentum scaling.
int getPDGCode(void) const
Returns PDG code.
std::vector< Belle2::Particle * > getDaughters() const
Returns a vector of pointers to daughter particles.
void set4Vector(const ROOT::Math::PxPyPzEVector &p4)
Sets Lorentz vector.
EParticleSourceObject getParticleSource() const
Returns particle source as defined with enum EParticleSourceObject.
double getExtraInfo(const std::string &name) const
Return given value if set.
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.