Belle II Software development
SVDClusterTimeShifter.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 {
29 class SVDClusterTimeShifter: public TObject {
30 public:
34 SVDClusterTimeShifter(const TString& uniqueID = "")
35 : m_uniqueID(uniqueID)
36 {
38 };
39
49 Double_t getClusterTimeShift(const TString& alg,
50 const int& layer, const int& sensor,
51 const bool& isU, const int& size) const
52 {
53 if (auto searchAlg = m_svdClusterTimeShift.find(alg); // search for time alg
54 searchAlg != m_svdClusterTimeShift.end()) {
55 TString sensorType = getSensorType(layer, sensor, isU);
56 if (auto searchShift = (searchAlg->second).find(sensorType); // search for shift values
57 searchShift != (searchAlg->second).end()) {
58 int maxClusters = (searchShift->second).size();
59 if (maxClusters == 0)
60 return 0.;
61 else if (size > maxClusters)
62 return (searchShift->second)[maxClusters - 1];
63 else
64 return (searchShift->second)[size - 1];
65 }
66 }
67 return 0.; // returns zero if map is empty
68 };
69
76 void setClusterTimeShift(const TString& alg, const TString& sensorType,
77 const std::vector<Double_t>& shiftValues)
78 {
79 B2INFO("Shift values for " << alg << " and " << sensorType << " is set.");
80 m_svdClusterTimeShift[alg][sensorType] = shiftValues;
81 };
82
86 TString get_uniqueID() const {return m_uniqueID;}
87
89 static std::string name;
90
91 protected:
92
100 TString getSensorType(const int& layer, const int& sensor, const bool& isU) const
101 {
102 return TString::Format("L%iS%iS%c", layer, sensor, (isU ? 'U' : 'V'));
103 };
104
105 private:
106
108 TString m_uniqueID;
109
111 std::map<TString, std::map<TString, std::vector<Double_t>>> m_svdClusterTimeShift;
112
115 };
116
118}
This class store the shift in svd time w.r.t.
ClassDef(SVDClusterTimeShifter, 1)
needed by root
TString m_uniqueID
unique identifier of the SVD reconstruction configuration payload
Double_t getClusterTimeShift(const TString &alg, const int &layer, const int &sensor, const bool &isU, const int &size) const
Returns cluster time shift in ns.
std::map< TString, std::map< TString, std::vector< Double_t > > > m_svdClusterTimeShift
cluster time shifts
TString getSensorType(const int &layer, const int &sensor, const bool &isU) const
Returns the types of sensor grouping.
SVDClusterTimeShifter(const TString &uniqueID="")
Default constructor.
void setClusterTimeShift(const TString &alg, const TString &sensorType, const std::vector< Double_t > &shiftValues)
Sets the cluster time shift in ns.
TString get_uniqueID() const
Get the unique ID of the payload.
static std::string name
name of the payload
Abstract base class for different kinds of events.