Belle II Software development
CalibrationAlgorithm::ExecutionData Class Reference

A class to hold all data that is needed ONLY for the most recent single execution of the algorithm. More...

#include <CalibrationAlgorithm.h>

Public Member Functions

void reset ()
 Resets this class back to what is needed at the beginning of an execution.
 
void clearCalibrationData ()
 Clear calibration data.
 
const std::vector< Calibration::ExpRun > & getRequestedRuns () const
 Returns the vector of ExpRuns.
 
void setRequestedRuns (const std::vector< Calibration::ExpRun > &requestedRuns)
 Sets the vector of ExpRuns.
 
int getIteration () const
 Getter for current iteration.
 
void setIteration (int iteration)
 Setter for current iteration.
 
EResult getResult () const
 Getter for current result.
 
void setResult (EResult result)
 Setter for current iteration.
 
void setRequestedIov (const IntervalOfValidity &iov=IntervalOfValidity(0, 0, -1, -1))
 Sets the requested IoV for this execution, based on the.
 
const IntervalOfValiditygetRequestedIov () const
 Getter for requested IOV.
 
std::list< Database::DBImportQuery > & getPayloads ()
 Get constants (in TObjects) for database update from last calibration.
 
std::list< Database::DBImportQuerygetPayloadValues ()
 Get constants (in TObjects) for database update from last calibration but passed by VALUE.
 
std::shared_ptr< TNamed > getCalibObj (const std::string &name, const RunRange &runRange) const
 Get a previously created object in m_mapCalibData if one exists, otherwise return shared_ptr(nullptr)
 
void setCalibObj (const std::string &name, const RunRange &runRange, const std::shared_ptr< TNamed > &objectPtr)
 Insert a newly created object in m_mapCalibData. Overwrites a previous entry if one exists.
 

Private Attributes

std::vector< Calibration::ExpRun > m_requestedRuns {}
 Runs for which the calibration has been last requested, either requested explicitly or generated from the collected data.
 
int m_iteration { -1}
 current iteration for execution
 
EResult m_result {c_Undefined}
 Result of execution, default undefined to indicate we haven't run yet.
 
IntervalOfValidity m_iov
 Current IoV to be executed, default empty. Will be either set by user explicitly or generated from collected/requested runs.
 
std::list< Database::DBImportQuerym_payloads {}
 Payloads saved by execution.
 
std::map< std::pair< std::string, RunRange >, std::shared_ptr< TNamed > > m_mapCalibData
 Map of shared pointers to merged calibration objects created by getObjectPtr() calls.
 

Detailed Description

A class to hold all data that is needed ONLY for the most recent single execution of the algorithm.

This is then reset upon calling execute() again. All other data members aren't reset unless you do it explicitly.

Definition at line 53 of file CalibrationAlgorithm.h.

Constructor & Destructor Documentation

◆ ExecutionData()

ExecutionData ( )
inline

Definition at line 55 of file CalibrationAlgorithm.h.

55{};

◆ ~ExecutionData()

~ExecutionData ( )
inline

Definition at line 56 of file CalibrationAlgorithm.h.

56{};

Member Function Documentation

◆ clearCalibrationData()

void clearCalibrationData ( )
inline

Clear calibration data.

Definition at line 69 of file CalibrationAlgorithm.h.

70 {
71 m_mapCalibData.clear();
72 }
std::map< std::pair< std::string, RunRange >, std::shared_ptr< TNamed > > m_mapCalibData
Map of shared pointers to merged calibration objects created by getObjectPtr() calls.

◆ getCalibObj()

std::shared_ptr< TNamed > getCalibObj ( const std::string &  name,
const RunRange runRange 
) const
inline

Get a previously created object in m_mapCalibData if one exists, otherwise return shared_ptr(nullptr)

Definition at line 98 of file CalibrationAlgorithm.h.

99 {
100 auto it = m_mapCalibData.find(std::make_pair(name, runRange));
101 if (it == m_mapCalibData.end()) {
102 return nullptr;
103 }
104 return it->second;
105 }

◆ getIteration()

int getIteration ( ) const
inline

Getter for current iteration.

Definition at line 78 of file CalibrationAlgorithm.h.

78{return m_iteration;}
int m_iteration
current iteration for execution

◆ getPayloads()

std::list< Database::DBImportQuery > & getPayloads ( )
inline

Get constants (in TObjects) for database update from last calibration.

Definition at line 94 of file CalibrationAlgorithm.h.

94{return m_payloads;}
std::list< Database::DBImportQuery > m_payloads
Payloads saved by execution.

◆ getPayloadValues()

std::list< Database::DBImportQuery > getPayloadValues ( )
inline

Get constants (in TObjects) for database update from last calibration but passed by VALUE.

Definition at line 96 of file CalibrationAlgorithm.h.

96{return m_payloads;}

◆ getRequestedIov()

const IntervalOfValidity & getRequestedIov ( ) const
inline

Getter for requested IOV.

Definition at line 92 of file CalibrationAlgorithm.h.

92{return m_iov;}
IntervalOfValidity m_iov
Current IoV to be executed, default empty. Will be either set by user explicitly or generated from co...

◆ getRequestedRuns()

const std::vector< Calibration::ExpRun > & getRequestedRuns ( ) const
inline

Returns the vector of ExpRuns.

Definition at line 74 of file CalibrationAlgorithm.h.

74{return m_requestedRuns;}
std::vector< Calibration::ExpRun > m_requestedRuns
Runs for which the calibration has been last requested, either requested explicitly or generated from...

◆ getResult()

EResult getResult ( ) const
inline

Getter for current result.

Definition at line 86 of file CalibrationAlgorithm.h.

86{return m_result;}
EResult m_result
Result of execution, default undefined to indicate we haven't run yet.

◆ reset()

void reset ( )
inline

Resets this class back to what is needed at the beginning of an execution.

Definition at line 58 of file CalibrationAlgorithm.h.

59 {
60 B2DEBUG(100, "Resetting ExecutionData of algorithm");
61 m_requestedRuns.clear();
62 m_iteration = -1;
64 m_payloads.clear();
65 m_iov = IntervalOfValidity();
67 }
void clearCalibrationData()
Clear calibration data.
@ c_Undefined
Not yet known (before execution) =4 in Python.

◆ setCalibObj()

void setCalibObj ( const std::string &  name,
const RunRange runRange,
const std::shared_ptr< TNamed > &  objectPtr 
)
inline

Insert a newly created object in m_mapCalibData. Overwrites a previous entry if one exists.

Definition at line 107 of file CalibrationAlgorithm.h.

108 {
109 m_mapCalibData[std::make_pair(name, runRange)] = objectPtr;
110 }

◆ setIteration()

void setIteration ( int  iteration)
inline

Setter for current iteration.

Definition at line 80 of file CalibrationAlgorithm.h.

81 {
82 B2DEBUG(29, "Setting Iteration of Algorithm to " << iteration);
83 m_iteration = iteration;
84 }

◆ setRequestedIov()

void setRequestedIov ( const IntervalOfValidity iov = IntervalOfValidity(0, 0, -1, -1))
inline

Sets the requested IoV for this execution, based on the.

Definition at line 90 of file CalibrationAlgorithm.h.

90{m_iov = iov;}

◆ setRequestedRuns()

void setRequestedRuns ( const std::vector< Calibration::ExpRun > &  requestedRuns)
inline

Sets the vector of ExpRuns.

Definition at line 76 of file CalibrationAlgorithm.h.

76{m_requestedRuns = requestedRuns;}

◆ setResult()

void setResult ( EResult  result)
inline

Setter for current iteration.

Definition at line 88 of file CalibrationAlgorithm.h.

88{m_result = result;}

Member Data Documentation

◆ m_iov

IntervalOfValidity m_iov
private

Current IoV to be executed, default empty. Will be either set by user explicitly or generated from collected/requested runs.

Definition at line 120 of file CalibrationAlgorithm.h.

◆ m_iteration

int m_iteration { -1}
private

current iteration for execution

Definition at line 116 of file CalibrationAlgorithm.h.

◆ m_mapCalibData

std::map<std::pair<std::string, RunRange>, std::shared_ptr<TNamed> > m_mapCalibData
private

Map of shared pointers to merged calibration objects created by getObjectPtr() calls.

Used to lookup previously created objects instead of recreating them needlessly. Using shared_ptr allows us to return a shared_ptr so the user knows that they don't own the pointer exclusively, but that they could hold onto a shared_ptr for longer than the reset of this ExecutionData object if they really wanted to i.e. you could hold onto a previous execution's created data if you wish (not recommended), but if you don't care then you can be assured that the memory will clear itself for you upon a new execute().

Definition at line 131 of file CalibrationAlgorithm.h.

◆ m_payloads

std::list<Database::DBImportQuery> m_payloads {}
private

Payloads saved by execution.

Definition at line 122 of file CalibrationAlgorithm.h.

◆ m_requestedRuns

std::vector<Calibration::ExpRun> m_requestedRuns {}
private

Runs for which the calibration has been last requested, either requested explicitly or generated from the collected data.

Definition at line 114 of file CalibrationAlgorithm.h.

◆ m_result

EResult m_result {c_Undefined}
private

Result of execution, default undefined to indicate we haven't run yet.

Definition at line 118 of file CalibrationAlgorithm.h.


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