Belle II Software development
KLMTriggerParameters.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
12#include <framework/logging/Logger.h>
13#include <klm/dataobjects/eklm/EKLMElementNumbers.h>
14
15/* ROOT headers. */
16#include <TObject.h>
17
18
19/* C++ headers. */
20#include <string>
21
22namespace Belle2 {
31 class KLMTriggerParameters : public TObject {
32
33 public:
34
39 {
40 }
41
47 KLMTriggerParameters(int32_t nLayers, const std::string& whichLayers) :
48 m_nLayers{nLayers},
49 m_whichLayers{whichLayers}
50 {
51 }
52
57 {
58 }
59
64 void setNLayers(int32_t nLayers)
65 {
66 // Reject values that exceed the number of layers in backward EKLM,
67 // since it is the part with the smallest number of layers.
69 if (nLayers > threshold) {
70 B2FATAL("The value passed to 'setNLayers' exceed the maximum allowed number of layers."
71 << LogVar("nLayers", nLayers)
72 << LogVar("layers threshold", threshold));
73 } else if (nLayers < 0) {
74 B2FATAL("The value passed to 'setNLayers' is smaller than zero."
75 << LogVar("nLayers", nLayers)
76 );
77 }
78 m_nLayers = nLayers;
79 }
80
85 void setWhichLayers(const std::string& whichLayers)
86 {
87 if (whichLayers.empty())
88 B2FATAL("The string passed to 'setWhichLayers' is empty."
89 << LogVar("string", whichLayers));
90 m_whichLayers = whichLayers;
91 }
92
96 int32_t getNLayers() const
97 {
98 return m_nLayers;
99 }
100
104 std::string getWhichLayers() const
105 {
106 return m_whichLayers;
107 }
108
109 int32_t getSubdetector(int32_t i) const
110 {
111 return m_Subdetector[i];
112 }
113
114 int32_t getSection(int32_t i) const
115 {
116 return m_section[i];
117 }
118 int32_t getSector(int32_t i) const
119 {
120 return m_sector[i];
121 }
122 int32_t getLayer(int32_t i) const
123 {
124 return m_layer[i];
125 }
126
127 int32_t getPlane(int32_t i) const
128 {
129 return m_plane[i];
130 }
131
132 double getSlopeX(int32_t i) const
133 {
134 return m_slopeX[i];
135 }
136 double getOffsetX(int32_t i) const
137 {
138 return m_offsetX[i];
139 }
140
141 double getSlopeY(int32_t i) const
142 {
143 return m_slopeY[i];
144 }
145 double getOffsetY(int32_t i) const
146 {
147 return m_offsetY[i];
148 }
149
150
151 size_t getGeometryDataSize() const
152 {
153 return m_Subdetector.size();
154 }
155
156 void pushGeometryData(int32_t Subdetector, int32_t section, int32_t sector, int32_t layer, int32_t plane, double slopeX,
157 double offsetX,
158 double slopeY, double offsetY)
159 {
160
161 m_Subdetector.push_back(Subdetector);
162 m_section.push_back(section);
163 m_sector.push_back(sector);
164 m_layer.push_back(layer);
165 m_plane.push_back(plane);
166 m_slopeX.push_back(slopeX);
167 m_offsetX.push_back(offsetX);
168 m_slopeY.push_back(slopeY);
169 m_offsetY.push_back(offsetY);
170 }
171
172
173 private:
174
178 int32_t m_nLayers{0};
179
180 std::vector<int32_t> m_Subdetector;
181 std::vector<int32_t> m_section;
182 std::vector<int32_t> m_sector;
183 std::vector<int32_t> m_layer;
184 std::vector<int32_t> m_plane;
185 std::vector<double> m_slopeX;
186 std::vector<double> m_offsetX;
187 std::vector<double> m_slopeY;
188 std::vector<double> m_offsetY;
189
190
191
195 std::string m_whichLayers;
196
201
202 };
203
205}
int getMaximalDetectorLayerNumber(int section) const
Get maximal detector layer number.
static const EKLMElementNumbers & Instance()
Instantiation.
DBObject containing parameters used in KLMTrigger module.
int32_t getNLayers() const
Get the number of layers used in the trigger logic.
void setNLayers(int32_t nLayers)
Set the number of layers used in the trigger logic.
int32_t m_nLayers
Number of layers used in the trigger logic.
std::string m_whichLayers
Pattern of layers used in the trigger logic.
void setWhichLayers(const std::string &whichLayers)
Set the pattern of layers used in the trigger logic.
KLMTriggerParameters(int32_t nLayers, const std::string &whichLayers)
Constructor.
ClassDef(KLMTriggerParameters, 2)
Class version.
std::string getWhichLayers() const
Get the pattern of layers used in the trigger logic.
KLMTriggerParameters()
Default constructor.
Class to store variables with their name which were sent to the logging service.
Abstract base class for different kinds of events.