Belle II Software development
DBObjCalibrationConstMapBase Class Reference

Base for calibration or alignment parameters identified by two unsigned shorts Typically first is some identifier of a sub-detector element (sensor, layer, wire, board...) and the second is number of parameter. More...

#include <DBObjCalibrationConstMapBase.h>

Inheritance diagram for DBObjCalibrationConstMapBase:
CDCAlignment CDCCalibration CDCLayerAlignment CDCMisalignment VXDAlignment

Public Types

typedef int baseType
 The underlying element type (also for param id)
 
typedef std::pair< baseType, baseTypeElementParameter
 (element, parameter)
 
typedef std::map< ElementParameter, double > ElementParameterMap
 Map of (element, parameter) and its values.
 

Public Member Functions

const ElementParameterMapgetMap ()
 Get the underlying map of constants.
 
 DBObjCalibrationConstMapBase ()
 Constructor.
 
virtual ~DBObjCalibrationConstMapBase ()
 Destructor.
 
virtual double get (baseType id, baseType param) const
 Get parameter value for given element and parameter number.
 
virtual void set (baseType id, baseType param, double value)
 Set parameter correction for given WireID and parameter number.
 
virtual double add (baseType id, baseType param, double value, bool subtractInsteadOfAdd=false)
 Add correction to already stored (or to 0. if not set yet) constant value (optionally with minus sign)
 
virtual void dump () const
 Write all elements' parameters' values to standard output.
 

Private Member Functions

 ClassDef (DBObjCalibrationConstMapBase, 1)
 Storage for alignment and calibration constants.
 

Private Attributes

ElementParameterMap m_constants
 Map of map of all calibration elements' constants.
 

Detailed Description

Base for calibration or alignment parameters identified by two unsigned shorts Typically first is some identifier of a sub-detector element (sensor, layer, wire, board...) and the second is number of parameter.

Only the dublet has to be unique, so you can spare some parameters or give same number to parameters with similar meaning. E.g. shift in local sensor U system in VXD can have the same number as shift in layer local U system.

Basically a representation of table with 3 columns, primary key = (id, param)

  • (unsigned short) id ... identifies element
  • (unsigned short) param ... identifies element parameter
  • (double) value ... stored parameter value

Definition at line 36 of file DBObjCalibrationConstMapBase.h.

Member Typedef Documentation

◆ baseType

typedef int baseType

The underlying element type (also for param id)

Definition at line 41 of file DBObjCalibrationConstMapBase.h.

◆ ElementParameter

typedef std::pair<baseType, baseType> ElementParameter

(element, parameter)

Definition at line 43 of file DBObjCalibrationConstMapBase.h.

◆ ElementParameterMap

typedef std::map<ElementParameter, double> ElementParameterMap

Map of (element, parameter) and its values.

Definition at line 45 of file DBObjCalibrationConstMapBase.h.

Constructor & Destructor Documentation

◆ DBObjCalibrationConstMapBase()

Constructor.

Definition at line 51 of file DBObjCalibrationConstMapBase.h.

51{}

◆ ~DBObjCalibrationConstMapBase()

Destructor.

Definition at line 22 of file DBObjCalibrationConstMapBase.cc.

23{
24 m_constants.clear();
25}
ElementParameterMap m_constants
Map of map of all calibration elements' constants.

Member Function Documentation

◆ add()

double add ( DBObjCalibrationConstMapBase::baseType  id,
DBObjCalibrationConstMapBase::baseType  param,
double  value,
bool  subtractInsteadOfAdd = false 
)
virtual

Add correction to already stored (or to 0. if not set yet) constant value (optionally with minus sign)

Definition at line 44 of file DBObjCalibrationConstMapBase.cc.

46{
47 double original = get(id, param);
48 double newValue = (subtractInsteadOfAdd) ? (original - value) : (original + value);
49 set(id, param, newValue);
50 return newValue;
51}
virtual void set(baseType id, baseType param, double value)
Set parameter correction for given WireID and parameter number.
virtual double get(baseType id, baseType param) const
Get parameter value for given element and parameter number.

◆ dump()

void dump ( ) const
virtual

Write all elements' parameters' values to standard output.

Definition at line 14 of file DBObjCalibrationConstMapBase.cc.

15{
16 for (auto& elementParam : m_constants) {
17 std::cout << " Element " << elementParam.first.first << " Param " << elementParam.first.second << " Value = " << elementParam.second
18 << std::endl;
19 }
20}

◆ get()

Get parameter value for given element and parameter number.

Definition at line 27 of file DBObjCalibrationConstMapBase.cc.

29{
30
31 auto constant = m_constants.find({id, param});
32 if (constant == m_constants.end()) {
33 return 0.;
34 }
35 return constant->second;
36}

◆ getMap()

const ElementParameterMap & getMap ( )
inline

Get the underlying map of constants.

Definition at line 48 of file DBObjCalibrationConstMapBase.h.

48{return m_constants;}

◆ set()

void set ( DBObjCalibrationConstMapBase::baseType  id,
DBObjCalibrationConstMapBase::baseType  param,
double  value 
)
virtual

Set parameter correction for given WireID and parameter number.

Definition at line 38 of file DBObjCalibrationConstMapBase.cc.

40{
41 m_constants[ {id, param}] = value;
42}

Member Data Documentation

◆ m_constants

ElementParameterMap m_constants
private

Map of map of all calibration elements' constants.

Definition at line 68 of file DBObjCalibrationConstMapBase.h.


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