Belle II Software development
SVDAbsoluteClusterTimeShift.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
11#include <framework/logging/Logger.h>
12
13#include <TObject.h>
14#include <TString.h>
15#include <map>
16
17namespace Belle2 {
28
29 class SVDAbsoluteClusterTimeShift: public TObject {
30 public:
34 SVDAbsoluteClusterTimeShift(const TString& uniqueID = "")
35 : m_uniqueID(uniqueID)
36 {
37 m_svdAbsTimeShift.clear();
38 };
39
47 Double_t getAbsTimeShift(const TString& alg,
48 const int& layer, const bool& isU) const
49 {
50 if (auto searchAlg = m_svdAbsTimeShift.find(alg); // search for time alg
51 searchAlg != m_svdAbsTimeShift.end()) {
52 TString sensorType = getSensorType(layer, isU);
53 if (auto searchShift = (searchAlg->second).find(sensorType); // search for shift values
54 searchShift != (searchAlg->second).end())
55 return (searchShift->second);
56 }
57 return 0.; // returns zero if map is empty
58 };
59
66 void setClusterTimeShift(const TString& alg, const TString& sensorType,
67 const Double_t shiftValue)
68 {
69 B2INFO("Shift value for " << alg << " and " << sensorType << " is set.");
70 m_svdAbsTimeShift[alg][sensorType] = shiftValue;
71 };
72
76 TString get_uniqueID() const {return m_uniqueID;}
77
79 static std::string name;
80
81 protected:
82
89 TString getSensorType(const int& layer, const bool& isU) const
90 {
91 return TString::Format("L%iS%c", layer, (isU ? 'U' : 'V'));
92 };
93
94 private:
95
97 TString m_uniqueID;
98
100 std::map<TString, std::map<TString, Double_t>> m_svdAbsTimeShift;
101
103
104 };
105
107}
TString m_uniqueID
unique identifier of the SVD reconstruction configuration payload
void setClusterTimeShift(const TString &alg, const TString &sensorType, const Double_t shiftValue)
Sets the cluster time shift in ns.
SVDAbsoluteClusterTimeShift(const TString &uniqueID="")
Default constructor.
TString get_uniqueID() const
Get the unique ID of the payload.
Double_t getAbsTimeShift(const TString &alg, const int &layer, const bool &isU) const
Returns cluster time shift in ns.
static std::string name
name of the payload
std::map< TString, std::map< TString, Double_t > > m_svdAbsTimeShift
cluster time shifts
TString getSensorType(const int &layer, const bool &isU) const
Returns the types of sensor grouping.
ClassDef(SVDAbsoluteClusterTimeShift, 1)
needed by root
Abstract base class for different kinds of events.