Belle II Software  release-08-01-10
GlobalLabel Class Reference

Class to convert to/from global labels for Millepede II to/from detector & parameter identificators. More...

#include <GlobalLabel.h>

Collaboration diagram for GlobalLabel:

Classes

struct  TimeInterval
 Struct to hold intervals of validity. More...
 

Public Types

typedef unsigned int gidTYPE
 shortcut for main data type (unsigned int)
 

Public Member Functions

 GlobalLabel ()
 Default constuctor. Members initialized in declaration.
 
 GlobalLabel (gidTYPE globalLabel)
 Constructor from Pede label Depends on registered time dependent parameters if the time flag in the label is non-zero. More...
 
void construct (gidTYPE dbObjId, gidTYPE element, gidTYPE param)
 Construct label for given DB object id and its element and parameter. More...
 
void registerTimeDependent (gidTYPE start, gidTYPE end=maxTID)
 Register this Detector element and parameter as time dependent with instance starting at "start" time index and ending at "end" index. More...
 
gidTYPE setParameterId (gidTYPE paramId)
 Usefull setter to quickly change only the parameter id and return back the encoded label (for use in RecoHits) More...
 
int label ()
 Returns encoded Pede label. More...
 
 operator int ()
 Cast to encoded Pede label.
 
 operator unsigned int ()
 Cast to encoded Pede label.
 
gidTYPE getUniqueId () const
 Returns the global id identifing DB object for constantwith this label.
 
gidTYPE getElementId () const
 Returns the element id (like VxdID for silicon sensors) to identify sets of parameters in DB objects.
 
gidTYPE getParameterId () const
 Get id of alignment/calibration parameter.
 
gidTYPE getTimeId () const
 Get time id.
 
bool getTimeFlag () const
 Is label time-dependent?
 
bool isValid ()
 Is label valid? (non-zero)
 
void dump (int level=0) const
 Dumps the label to std::cout.
 
int getEndOfValidity ()
 Get the last time id, where this label is valid.
 
gidTYPE makeEIDPID (gidTYPE eid_, gidTYPE pid_)
 Helper to compose elemnt id & param id.
 
gidTYPE makeTEIDPID (gidTYPE teid_, gidTYPE pid_)
 Helper to compose time elemnt id & param id.
 

Static Public Member Functions

template<class DBObjType >
static GlobalLabel construct (gidTYPE element, gidTYPE param)
 Construct label for given DB object (template argument) and its element and parameter. More...
 
static void setComponents (const std::set< unsigned short > &components)
 Set which DB objects have non-zero labels (by their id) More...
 
static void clearTimeDependentParamaters ()
 Forget all previously registered time dependent parameters.
 
static unsigned int & getCurrentTimeIntervalRef ()
 Returns reference to current time id.
 
static void setCurrentTimeInterval (gidTYPE time)
 Sets current time id. More...
 
static gidTYPE getCurrentTimeInterval ()
 Get current time id.
 
static std::map< gidTYPE, TimeInterval > & getTimeIntervals ()
 Reference to map EIDPID -> (TEIDPID, time intervals)
 
static std::map< gidTYPE, gidTYPE > & getDictionary ()
 Reference to dictionary/map TEIDPID -> EIDPID.
 

Static Public Attributes

static const gidTYPE maxPID = 99
 max 99 parameter types 1..99
 
static const gidTYPE maxEID = 9999999
 max 9.999.999 detector elements 1..9999999 (NOT time-dep-)
 
static const gidTYPE maxTIF = 1
 time-dep. More...
 
static const gidTYPE maxTEID = 9999
 max time-dep. More...
 
static const gidTYPE maxTID = 999
 max time slices for a parameter 1..999

 
static const gidTYPE pidOffset = 1
 parameter number are the last 2 decimal digits
 
static const gidTYPE eidOffest = pidOffset * (maxPID + 1)
 Offset of detector element id = 100.
 
static const gidTYPE tifOffset = eidOffest * (maxEID + 1)
 Offset of time flag = 1.000.000.000.
 
static const gidTYPE teidOffset = eidOffest
 Offset of time dependent element(detector+parameter) = 100.
 
static const gidTYPE tidOffset = eidOffest * (maxTEID + 1)
 Offset of time slice id = 1.000.000.
 
static const gidTYPE maxGID
 max internal id = 1.999.999.999 More...
 
static const gidTYPE maxLabel
 Label and internal id ("gid") are the same numbers (label is signed but 0 and <0 values are invalid to give to Pede) More...
 

Private Member Functions

void construct (gidTYPE elementId, gidTYPE paramId)
 Constructor for any detector. More...
 

Private Attributes

gidTYPE gid {0}
 global id
 
gidTYPE eid {0}
 element id
 
gidTYPE pid {0}
 parameter id
 
gidTYPE tid {0}
 time id
 
gidTYPE tif {0}
 time identification flag
 

Static Private Attributes

static std::set< unsigned short > m_components = {}
 Set of global ids of components for which to return non-zero labels.
 

Detailed Description

Class to convert to/from global labels for Millepede II to/from detector & parameter identificators.

The labels are in following form (the example shows maximal allowed labels):

|TIF| EID |PID| | 0|9999999 |99 | & TEID=0 & TID=0, or

|TIF|TID|TEID|PID| | 1|999|9999|99 | & (EID,PID)=dictionary(TEID,PID).

where

  • TIF is time flag (0 or 1) for time-dependent parameters,
  • EID is id of detector element (numeric VxdID or WireID + offset),
  • PID is id of alignment/calibration parameter (u/v...),
  • TEID is time-dependent element index (one per time-dep. parameter)
  • TID is time interval id

Definition at line 41 of file GlobalLabel.h.

Constructor & Destructor Documentation

◆ GlobalLabel()

GlobalLabel ( GlobalLabel::gidTYPE  globalLabel)
explicit

Constructor from Pede label Depends on registered time dependent parameters if the time flag in the label is non-zero.

Parameters
globalLabelThe encoded label

Definition at line 19 of file GlobalLabel.cc.

19  :
20  gid(0), eid(0), pid(0), tid(0), tif(0)
21 {
22  if (globalLabel > maxLabel)
23  return;
24  gid = globalLabel;
25  tif = gid / tifOffset;
26  pid = gid % eidOffest / pidOffset;
27 
28  if (!tif) {
29  eid = gid % tifOffset / eidOffest;
30  } else {
31  // Time-dep label
32  gidTYPE teid = gid % tidOffset / teidOffset;
33  gidTYPE teidpid = makeTEIDPID(teid, pid);
34  gidTYPE eidpid = 0;
35  auto& dict = GlobalLabel::getDictionary();
36  auto it = dict.find(teidpid);
37  if (it != dict.end())
38  eidpid = it->second;
39 
40  eid = eidpid / eidOffest;
41  tid = gid % tifOffset / tidOffset;
42  }
43 }
static const gidTYPE tidOffset
Offset of time slice id = 1.000.000.
Definition: GlobalLabel.h:55
static std::map< gidTYPE, gidTYPE > & getDictionary()
Reference to dictionary/map TEIDPID -> EIDPID.
Definition: GlobalLabel.h:283
gidTYPE tid
time id
Definition: GlobalLabel.h:306
static const gidTYPE eidOffest
Offset of detector element id = 100.
Definition: GlobalLabel.h:52
gidTYPE gid
global id
Definition: GlobalLabel.h:297
static const gidTYPE teidOffset
Offset of time dependent element(detector+parameter) = 100.
Definition: GlobalLabel.h:54
unsigned int gidTYPE
shortcut for main data type (unsigned int)
Definition: GlobalLabel.h:45
static const gidTYPE pidOffset
parameter number are the last 2 decimal digits
Definition: GlobalLabel.h:51
gidTYPE makeTEIDPID(gidTYPE teid_, gidTYPE pid_)
Helper to compose time elemnt id & param id.
Definition: GlobalLabel.h:294
gidTYPE tif
time identification flag
Definition: GlobalLabel.h:309
static const gidTYPE tifOffset
Offset of time flag = 1.000.000.000.
Definition: GlobalLabel.h:53
gidTYPE eid
element id
Definition: GlobalLabel.h:300
static const gidTYPE maxLabel
Label and internal id ("gid") are the same numbers (label is signed but 0 and <0 values are invalid t...
Definition: GlobalLabel.h:58
gidTYPE pid
parameter id
Definition: GlobalLabel.h:303

Member Function Documentation

◆ construct() [1/3]

void construct ( gidTYPE  dbObjId,
gidTYPE  element,
gidTYPE  param 
)
inline

Construct label for given DB object id and its element and parameter.

Parameters
dbObjIdid of the DB object in global calibration
elementElement id in DB object (wire, sensor etc.)
paramParemetr id of the element (shift, angle, etc.)
Returns
GlobalLabel

Definition at line 96 of file GlobalLabel.h.

97  {
98  if (m_components.empty() or m_components.find(dbObjId) != m_components.end())
99  construct(100000 * dbObjId + element, param);
100  else
101  construct(0, 0);
102  }
static GlobalLabel construct(gidTYPE element, gidTYPE param)
Construct label for given DB object (template argument) and its element and parameter.
Definition: GlobalLabel.h:81
static std::set< unsigned short > m_components
Set of global ids of components for which to return non-zero labels.
Definition: GlobalLabel.h:222

◆ construct() [2/3]

static GlobalLabel construct ( gidTYPE  element,
gidTYPE  param 
)
inlinestatic

Construct label for given DB object (template argument) and its element and parameter.

Parameters
elementElement id in DB object (wire, sensor etc.)
paramParemetr id of the element (shift, angle, etc.)
Returns
GlobalLabel

Definition at line 81 of file GlobalLabel.h.

◆ construct() [3/3]

void construct ( GlobalLabel::gidTYPE  elementId,
GlobalLabel::gidTYPE  paramId 
)
private

Constructor for any detector.

Parameters
elementIdUnique id of Belle2 detector element (sensor, layer, wire...)
paramIdid of the parameter of the element

Definition at line 81 of file GlobalLabel.cc.

◆ label()

int label ( )
inline

Returns encoded Pede label.

Returns
int

Definition at line 142 of file GlobalLabel.h.

◆ registerTimeDependent()

void registerTimeDependent ( GlobalLabel::gidTYPE  start,
GlobalLabel::gidTYPE  end = maxTID 
)

Register this Detector element and parameter as time dependent with instance starting at "start" time index and ending at "end" index.

Call this for each time interval, in which the parameter is allowed to have different value (from that at interval 0-0)

Parameters
startStart time of parameter time-dep. instance (the instance has number "start" from start to end). The instance number before is 0 if not set.
endEnd time of parameter instance. The number after "end" is 0 if not set.

Definition at line 45 of file GlobalLabel.cc.

◆ setComponents()

static void setComponents ( const std::set< unsigned short > &  components)
inlinestatic

Set which DB objects have non-zero labels (by their id)

Parameters
componentsset of global ids of DB objects

Definition at line 108 of file GlobalLabel.h.

◆ setCurrentTimeInterval()

static void setCurrentTimeInterval ( gidTYPE  time)
inlinestatic

Sets current time id.

Parameters
timetime id

Definition at line 208 of file GlobalLabel.h.

◆ setParameterId()

GlobalLabel::gidTYPE setParameterId ( GlobalLabel::gidTYPE  paramId)

Usefull setter to quickly change only the parameter id and return back the encoded label (for use in RecoHits)

Parameters
paramIdId of calibration/alignment parameter
Returns
Encoded Pede label with new parameter id

Definition at line 72 of file GlobalLabel.cc.

Member Data Documentation

◆ maxGID

const gidTYPE maxGID
static
Initial value:
static const gidTYPE maxEID
max 9.999.999 detector elements 1..9999999 (NOT time-dep-)
Definition: GlobalLabel.h:47
static const gidTYPE maxPID
max 99 parameter types 1..99
Definition: GlobalLabel.h:46
static const gidTYPE maxTIF
time-dep.
Definition: GlobalLabel.h:48

max internal id = 1.999.999.999

Definition at line 56 of file GlobalLabel.h.

◆ maxLabel

const gidTYPE maxLabel
static
Initial value:
=
static const gidTYPE maxGID
max internal id = 1.999.999.999
Definition: GlobalLabel.h:56

Label and internal id ("gid") are the same numbers (label is signed but 0 and <0 values are invalid to give to Pede)

Definition at line 58 of file GlobalLabel.h.

◆ maxTEID

const gidTYPE maxTEID = 9999
static

max time-dep.

parameters 1..9999

Definition at line 49 of file GlobalLabel.h.

◆ maxTIF

const gidTYPE maxTIF = 1
static

time-dep.

flag

Definition at line 48 of file GlobalLabel.h.


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