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 {
27
31 class KLMTriggerParameters : public TObject {
32
33 public:
34
41
49 KLMTriggerParameters(int32_t nPlanes, int32_t nLayers, int32_t countPlanes, const std::string& whichLayers) :
50 m_nPlanes{nPlanes},
51 m_nLayers{nLayers},
52 m_countPlanes{countPlanes},
53 m_whichLayers{whichLayers}
54 {
55 }
56
63
64
69 void setNPlanes(int32_t nPlanes)
70 {
71 // Reject values that exceed the number of layers in backward EKLM,
72 // since it is the part with the smallest number of layers.
74 if (nPlanes > threshold) {
75 B2FATAL("The value passed to 'setNPlanes' exceed the maximum allowed number of layers."
76 << LogVar("nPlanes", nPlanes)
77 << LogVar("layers threshold", threshold));
78 } else if (nPlanes < 0) {
79 B2FATAL("The value passed to 'setNPlanes' is smaller than zero."
80 << LogVar("nPlanes", nPlanes)
81 );
82 }
83 m_nPlanes = nPlanes;
84 }
85
86
91 void setNLayers(int32_t nLayers)
92 {
93 // Reject values that exceed the number of layers in backward EKLM,
94 // since it is the part with the smallest number of layers.
96 if (nLayers > threshold) {
97 B2FATAL("The value passed to 'setNLayers' exceed the maximum allowed number of layers."
98 << LogVar("nLayers", nLayers)
99 << LogVar("layers threshold", threshold));
100 } else if (nLayers < 0) {
101 B2FATAL("The value passed to 'setNLayers' is smaller than zero."
102 << LogVar("nLayers", nLayers)
103 );
104 }
105 m_nLayers = nLayers;
106 }
107
108
113 void setCountPlanes(int32_t countPlanes)
114 {
115 m_countPlanes = countPlanes;
116 }
117
118
123 void setWhichLayers(const std::string& whichLayers)
124 {
125 if (whichLayers.empty())
126 B2FATAL("The string passed to 'setWhichLayers' is empty."
127 << LogVar("string", whichLayers));
128 m_whichLayers = whichLayers;
129 }
130
131
135 int32_t getNPlanes() const
136 {
137 return m_nPlanes;
138 }
139
140
144 int32_t getNLayers() const
145 {
146 return m_nLayers;
147 }
148
152 int32_t getcountPlanes() const
153 {
154 return m_countPlanes;
155 }
156
160 std::string getWhichLayers() const
161 {
162 return m_whichLayers;
163 }
164
165 int32_t getSubdetector(int32_t i) const
166 {
167 return m_Subdetector[i];
168 }
169
170 int32_t getSection(int32_t i) const
171 {
172 return m_section[i];
173 }
174 int32_t getSector(int32_t i) const
175 {
176 return m_sector[i];
177 }
178 int32_t getLayer(int32_t i) const
179 {
180 return m_layer[i];
181 }
182
183 int32_t getPlane(int32_t i) const
184 {
185 return m_plane[i];
186 }
187
188 double getSlopeX(int32_t i) const
189 {
190 return m_slopeX[i];
191 }
192 double getOffsetX(int32_t i) const
193 {
194 return m_offsetX[i];
195 }
196
197 double getSlopeY(int32_t i) const
198 {
199 return m_slopeY[i];
200 }
201 double getOffsetY(int32_t i) const
202 {
203 return m_offsetY[i];
204 }
205
206
207 size_t getGeometryDataSize() const
208 {
209 return m_Subdetector.size();
210 }
211
212 void pushGeometryData(int32_t Subdetector, int32_t section, int32_t sector, int32_t layer, int32_t plane, double slopeX,
213 double offsetX,
214 double slopeY, double offsetY)
215 {
216
217 m_Subdetector.push_back(Subdetector);
218 m_section.push_back(section);
219 m_sector.push_back(sector);
220 m_layer.push_back(layer);
221 m_plane.push_back(plane);
222 m_slopeX.push_back(slopeX);
223 m_offsetX.push_back(offsetX);
224 m_slopeY.push_back(slopeY);
225 m_offsetY.push_back(offsetY);
226 }
227
228
229 private:
230
234 int32_t m_nPlanes{8};
235 int32_t m_nLayers{0};
236 int32_t m_countPlanes{1};
237
238 std::vector<int32_t> m_Subdetector;
239 std::vector<int32_t> m_section;
240 std::vector<int32_t> m_sector;
241 std::vector<int32_t> m_layer;
242 std::vector<int32_t> m_plane;
243 std::vector<double> m_slopeX;
244 std::vector<double> m_offsetX;
245 std::vector<double> m_slopeY;
246 std::vector<double> m_offsetY;
247
248
249
253 std::string m_whichLayers;
254
259
260 };
261
263}
int getMaximalDetectorLayerNumber(int section) const
Get maximal detector layer number.
static const EKLMElementNumbers & Instance()
Instantiation.
void setCountPlanes(int32_t countPlanes)
Set the parameter to control counting Layers=0 or Planes=1.
int32_t getNLayers() const
Get the number of layers used in the trigger logic.
int32_t getcountPlanes() 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_nPlanes
Number of layers used in the trigger logic.
std::string m_whichLayers
Pattern of layers used in the trigger logic.
KLMTriggerParameters(int32_t nPlanes, int32_t nLayers, int32_t countPlanes, const std::string &whichLayers)
Constructor.
void setWhichLayers(const std::string &whichLayers)
Set the pattern of layers used in the trigger logic.
ClassDef(KLMTriggerParameters, 3)
Class version.
void setNPlanes(int32_t nPlanes)
Set the number of planes used in the trigger logic.
int32_t getNPlanes() const
Get the number of planes used in the trigger logic.
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.