Belle II Software light-2406-ragdoll
PostProcessingParticleWeighting Class Reference

Post-processing particle weighting. More...

#include <PostProcessingParticleWeighting.h>

Collaboration diagram for PostProcessingParticleWeighting:

Public Member Functions

 PostProcessingParticleWeighting (const char *lookupTableName)
 Constructor.
 
 ~PostProcessingParticleWeighting ()
 Destructor.
 
void setValue (std::string variableName, double value)
 Set value.
 
WeightInfo getInfo (int experiment, int run)
 Get weight information.
 
PyObject * getInfoPython (int experiment, int run)
 Get weight information (Python).
 

Protected Attributes

std::map< std::string, double > m_Values
 Values.
 
EventMetaData m_EventMetaData
 Event metadata.
 
DBObjPtr< ParticleWeightingLookUpTablem_LookupTable
 Lookup table.
 

Detailed Description

Post-processing particle weighting.

Definition at line 34 of file PostProcessingParticleWeighting.h.

Constructor & Destructor Documentation

◆ PostProcessingParticleWeighting()

PostProcessingParticleWeighting ( const char *  lookupTableName)

Constructor.

Parameters
[in]lookupTableNameLookup-table name.

Definition at line 17 of file PostProcessingParticleWeighting.cc.

18 :
19 m_EventMetaData(-1, -1), m_LookupTable(lookupTableName)
20{
21}
DBObjPtr< ParticleWeightingLookUpTable > m_LookupTable
Lookup table.

◆ ~PostProcessingParticleWeighting()

Destructor.

Definition at line 23 of file PostProcessingParticleWeighting.cc.

24{
25}

Member Function Documentation

◆ getInfo()

WeightInfo getInfo ( int  experiment,
int  run 
)

Get weight information.

Definition at line 33 of file PostProcessingParticleWeighting.cc.

34{
35 if ((experiment != m_EventMetaData.getExperiment()) ||
36 (run != m_EventMetaData.getRun())) {
40 }
41 WeightInfo weightInfo = m_LookupTable->getInfo(m_Values);
42 return weightInfo;
43}
void setExperiment(int experiment)
Experiment Setter.
Definition: EventMetaData.h:73
int getRun() const
Run Getter.
void setRun(int run)
Run Setter.
Definition: EventMetaData.h:61
int getExperiment() const
Experiment Getter.
std::map< std::string, double > m_Values
Values.
std::map< std::string, double > WeightInfo
Weight information: a line from the weight lookup table.
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:28
void update()
Updates all objects that are outside their interval of validity.
Definition: DBStore.cc:79

◆ getInfoPython()

PyObject * getInfoPython ( int  experiment,
int  run 
)

Get weight information (Python).

Definition at line 45 of file PostProcessingParticleWeighting.cc.

47{
48 WeightInfo weightInfo = getInfo(experiment, run);
49 PyObject* dictionary = PyDict_New();
50 for (const auto& [name, val] : weightInfo) {
51 PyObject* key = PyUnicode_FromString(name.c_str());
52 PyObject* value = PyFloat_FromDouble(val);
53 PyDict_SetItem(dictionary, key, value);
54 }
55 return dictionary;
56}
WeightInfo getInfo(int experiment, int run)
Get weight information.

◆ setValue()

void setValue ( std::string  variableName,
double  value 
)

Set value.

Parameters
[in]variableNameVariable name.
[in]valueValue.

Definition at line 27 of file PostProcessingParticleWeighting.cc.

29{
30 m_Values[variableName] = value;
31}

Member Data Documentation

◆ m_EventMetaData

EventMetaData m_EventMetaData
protected

Event metadata.

Definition at line 72 of file PostProcessingParticleWeighting.h.

◆ m_LookupTable

DBObjPtr<ParticleWeightingLookUpTable> m_LookupTable
protected

Lookup table.

Definition at line 75 of file PostProcessingParticleWeighting.h.

◆ m_Values

std::map<std::string, double> m_Values
protected

Values.

Definition at line 69 of file PostProcessingParticleWeighting.h.


The documentation for this class was generated from the following files: