Belle II Software development
PostProcessingParticleWeighting Class Reference

Post-processing particle weighting. More...

#include <PostProcessingParticleWeighting.h>

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 14 of file PostProcessingParticleWeighting.cc.

15 :
16 m_EventMetaData(-1, -1), m_LookupTable(lookupTableName)
17{
18}
DBObjPtr< ParticleWeightingLookUpTable > m_LookupTable
Lookup table.

◆ ~PostProcessingParticleWeighting()

Destructor.

Definition at line 20 of file PostProcessingParticleWeighting.cc.

21{
22}

Member Function Documentation

◆ getInfo()

WeightInfo getInfo ( int  experiment,
int  run 
)

Get weight information.

Definition at line 30 of file PostProcessingParticleWeighting.cc.

31{
32 if ((experiment != m_EventMetaData.getExperiment()) ||
33 (run != m_EventMetaData.getRun())) {
37 }
38 WeightInfo weightInfo = m_LookupTable->getInfo(m_Values);
39 return weightInfo;
40}
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:26
void update()
Updates all objects that are outside their interval of validity.
Definition: DBStore.cc:77

◆ getInfoPython()

PyObject * getInfoPython ( int  experiment,
int  run 
)

Get weight information (Python).

Definition at line 42 of file PostProcessingParticleWeighting.cc.

44{
45 WeightInfo weightInfo = getInfo(experiment, run);
46 PyObject* dictionary = PyDict_New();
47 for (const auto& [name, val] : weightInfo) {
48 PyObject* key = PyUnicode_FromString(name.c_str());
49 PyObject* value = PyFloat_FromDouble(val);
50 PyDict_SetItem(dictionary, key, value);
51 }
52 return dictionary;
53}
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 24 of file PostProcessingParticleWeighting.cc.

26{
27 m_Values[variableName] = value;
28}

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: