Belle II Software  release-08-01-10
SVDCalibrationsVector.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 #include <vector>
11 
12 #include <svd/dbobjects/SVDCalibrationsBase.h>
13 
14 namespace Belle2 {
21  template <class T >
23 
24  public:
25  typedef T calibrationType;
26  typedef std::vector< calibrationType > payloadContainerType;
30 
33 
35  static inline calibrationType get(const payloadContainerType& svdVector, unsigned int strip)
36  {
37  return svdVector.at(strip);
38  }
39 
41  const static inline calibrationType& getReference(const payloadContainerType& svdVector, unsigned int strip)
42  {
43  return svdVector.at(strip);
44  }
45 
47  static inline void set(payloadContainerType& svdVector, unsigned int strip,
48  calibrationType value)
49  {
50  svdVector.at(strip) = value;
51  }
52 
54  static void init(payloadContainerType& svdVector, unsigned int layer,
55  unsigned int /*ladder*/, unsigned int /*sensor*/,
56  unsigned int side, const T& defaultT)
57  {
58  unsigned int numberOfStrips = 0;
59 
60  if (layer < 3)
61  return;
62 
63  switch (side) {
65  numberOfStrips = 768;
66  break;
67 
69  numberOfStrips = layer == 3 ? 768 : 512;
70  }
71 
72  svdVector.resize(numberOfStrips, defaultT);
73 
74 
75  }
76  };
78 }
base class for calibrations classes
template class for vector (one per strip) calibrations
std::vector< calibrationType > payloadContainerType
typedef of the payload container, one per strip
static calibrationType get(const payloadContainerType &svdVector, unsigned int strip)
get the calibration of the strip
static const calibrationType & getReference(const payloadContainerType &svdVector, unsigned int strip)
get a reference to the calibration of the strip
static void set(payloadContainerType &svdVector, unsigned int strip, calibrationType value)
set the calibration of the strip
~SVDCalibrationsVector()
default destructor
static void init(payloadContainerType &svdVector, unsigned int layer, unsigned int, unsigned int, unsigned int side, const T &defaultT)
initialize the calibration vector
T calibrationType
typedef of the calibration type class
SVDCalibrationsVector()
default constructor
Abstract base class for different kinds of events.