Belle II Software  release-05-01-25
SVDCalibrationsVector.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Laura Zani, Eugenio Paoloni *
7  * *
8  * This software is provided "as is" without any warranty. *
9  * WARNING: PLEASE, PLEASE, PLEASE USE ONLY WITH CAUTION AT YOUR OWN RISK!*
10  **************************************************************************/
11 
12 #pragma once
13 #include <vector>
14 
15 #include <svd/dbobjects/SVDCalibrationsBase.h>
16 
17 namespace Belle2 {
24  template <class T >
25  class SVDCalibrationsVector {
26 
27  public:
28  typedef T calibrationType;
29  typedef std::vector< calibrationType > payloadContainerType;
33 
36 
38  static inline calibrationType get(const payloadContainerType& svdVector, unsigned int strip)
39  {
40  return svdVector.at(strip);
41  }
42 
44  const static inline calibrationType& getReference(const payloadContainerType& svdVector, unsigned int strip)
45  {
46  return svdVector.at(strip);
47  }
48 
50  static inline void set(payloadContainerType& svdVector, unsigned int strip,
51  calibrationType value)
52  {
53  svdVector.at(strip) = value;
54  }
55 
57  static void init(payloadContainerType& svdVector, unsigned int layer,
58  unsigned int /*ladder*/ , unsigned int /*sensor*/,
59  unsigned int side, const T& defaultT)
60  {
61  unsigned int numberOfStrips = 0;
62 
63  if (layer < 3)
64  return;
65 
66  switch (side) {
68  numberOfStrips = 768;
69  break;
70 
72  numberOfStrips = layer == 3 ? 768 : 512;
73  }
74 
75  svdVector.resize(numberOfStrips , defaultT);
76 
77 
78  }
79  };
81 }
Belle2::SVDCalibrationsVector::~SVDCalibrationsVector
~SVDCalibrationsVector()
default destructor
Definition: SVDCalibrationsVector.h:44
Belle2::SVDCalibrationsVector::getReference
const static calibrationType & getReference(const payloadContainerType &svdVector, unsigned int strip)
get a reference to the calibration of the strip
Definition: SVDCalibrationsVector.h:53
Belle2::SVDCalibrationsVector::calibrationType
T calibrationType
typedef of the calibration type class
Definition: SVDCalibrationsVector.h:37
Belle2::SVDCalibrationsVector::init
static void init(payloadContainerType &svdVector, unsigned int layer, unsigned int, unsigned int, unsigned int side, const T &defaultT)
initialize the calibration vector
Definition: SVDCalibrationsVector.h:66
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SVDCalibrationsVector::SVDCalibrationsVector
SVDCalibrationsVector()
default constructor
Definition: SVDCalibrationsVector.h:41
Belle2::SVDCalibrationsVector::set
static void set(payloadContainerType &svdVector, unsigned int strip, calibrationType value)
set the calibration of the strip
Definition: SVDCalibrationsVector.h:59
Belle2::SVDCalibrationsVector::get
static calibrationType get(const payloadContainerType &svdVector, unsigned int strip)
get the calibration of the strip
Definition: SVDCalibrationsVector.h:47
Belle2::SVDCalibrationsBase
base class for calibrations classes
Definition: SVDCalibrationsBase.h:36
Belle2::SVDCalibrationsVector::payloadContainerType
std::vector< calibrationType > payloadContainerType
typedef of the payload container, one per strip
Definition: SVDCalibrationsVector.h:38