Belle II Software development
ECLCrystalData.cc
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/* Own header. */
10#include <ecl/modules/eclBackgroundStudy/ECLCrystalData.h>
11
12/* Basf2 headers. */
13#include <framework/logging/Logger.h>
14
15/* ROOT headers. */
16#include <TMath.h>
17
18/* C++ headers. */
19#include <cmath>
20
21using namespace Belle2;
22
23//ECL has 16-fold symmetry in phi. Multiply this by 16 to get the total number of crystals at each theta location.
24int const ECLCrystalData::Ring[69] = {
25 3, 3, 4, 4, 4, 6, 6, 6, 6, 6, 6, 9, 9, //forward calorimeter
26 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, //barrel
27 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, //barrel
28 9, 9, 9, 9, 9, 9, //barrel
29 9, 9, 6, 6, 6, 6, 6, 4, 4, 4 //backward calorimeter
30};
31
32int const ECLCrystalData::sumPrevious[24] = {0, 3, 6, 10, 14, 18, 24, 30, 36, 42, 48, 54, 63, 72, 81, 90, 96, 102, 108, 114, 120, 124, 128, 132};
33
34//endcap crystal masses
35float const ECLCrystalData::CrystalMassEndcap[132] = {4.99, 5.01, 4.99, 5.82, 5.94, 5.83, 4.75, 4.76, 4.77, 4.74, 5.14, 5.16, 5.16,
36 5.14, 5.76, 5.8, 5.79, 5.78, 4.14, 4.28, 4.15, 4.16, 4.28, 4.14, 4.32, 4.34,
37 4.34, 4.34, 4.34, 4.32, 4.85, 4.87, 4.87, 4.87, 4.87, 4.85, 4.99, 5.02, 5.02,
38 5.02, 5.02, 4.99, 5.37, 5.39, 5.39, 5.39, 5.39, 5.37, 5.89, 5.92, 5.92, 5.92,
39 5.92, 5.9, 4.03, 4.12, 4.05, 4.05, 4.12, 4.05, 4.05, 4.12, 4.03, 4.16, 4.18,
40 4.18, 4.18, 4.18, 4.18, 4.18, 4.18, 4.16, 4.47, 4.49, 4.49, 4.49, 4.49, 4.49,
41 4.49, 4.49, 4.47, 4.26, 4.34, 4.28, 4.28, 4.34, 4.28, 4.28, 4.34, 4.26, 5.88,
42 5.91, 5.91, 5.91, 5.91, 5.88, 5.46, 5.48, 5.48, 5.48, 5.48, 5.46, 5.02, 5.04,
43 5.04, 5.04, 5.04, 5.02, 4.63, 4.65, 4.65, 4.65, 4.65, 4.63, 4.4, 4.53, 4.42,
44 4.42, 4.53, 4.4, 5.74, 5.77, 5.76, 5.74, 5.09, 5.11, 5.11, 5.09, 4.56, 4.58,
45 4.58, 4.56
46 };
47
48//Barrel crystal masses
49float const ECLCrystalData::CrystalMassBarrel[46] = {4.599, 4.619, 4.639, 4.659, 4.680, 4.701, 4.722, 4.744, 4.765,
50 4.786, 4.807, 4.828, 4.848, 4.868, 4.887, 4.906, 4.923, 4.940,
51 4.955, 4.969, 4.981, 4.992, 5.001, 5.008, 5.013, 5.016, 5.017,
52 5.016, 4.455, 4.455, 5.016, 5.017, 5.016, 5.013, 5.008, 5.001,
53 4.992, 4.981, 4.969, 4.955, 4.940, 4.923, 4.906, 4.887, 4.868,
54 4.848
55 };
56
57
58//Theta ID to theta(deg)
59double const ECLCrystalData::theta[69] = {13.9486666667, 15.4862, 17.110575, 18.757625, 20.255425, 21.8637333333,
60 23.4259666667, 24.96125, 26.4777833333, 27.9407, 29.36275, 30.8382555556,
61 32.2618444444, 33.667039, 35.062886, 36.509337, 38.007345, 39.557769,
62 41.161373, 42.818633, 44.530027, 46.295838, 48.115876, 49.990235, 51.91882,
63 53.900865, 55.935415, 58.021324, 60.157158, 62.3412, 64.571442, 66.8455,
64 69.160698, 71.513983, 73.902011, 76.321253, 78.767888, 81.237718, 83.726351,
65 86.229301, 88.741891, 90, 90, 91.258109, 93.770699, 96.273649, 98.762282,
66 101.232112, 103.678747, 106.097989, 108.486017, 110.839302, 113.154501,
67 115.428558, 117.658801, 119.842842, 121.978676, 124.064585, 126.099135,
68 128.2902222222, 130.4424444444, 132.6918333333, 134.9551666667, 137.3811666667,
69 139.9081666667, 142.5951666667, 145.374, 148.0185, 150.8355
70 };
71
73double const ECLCrystalData::EndcapRadius[132] = {
74// 3,3,4,4,4,6,6,6,6,6,6,9,9, //forward calorimeter
75 217.25, 217.25, 217.25,
76 218.72, 218.72, 218.72,
77 220.29, 220.29, 220.29, 220.29,
78 222.00, 222.00, 222.00, 222.00,
79 223.96, 223.96, 223.96, 223.96,
80 226.01, 226.01, 226.01, 226.01, 226.01, 226.01,
81 228.21, 228.21, 228.21, 228.21, 228.21, 228.21,
82 230.67, 230.67, 230.67, 230.67, 230.67, 230.67,
83 233.20, 233.20, 233.20, 233.20, 233.20, 233.20,
84 235.89, 235.89, 235.89, 235.89, 235.89, 235.89,
85 238.89, 238.89, 238.89, 238.89, 238.89, 238.89,
86 241.94, 241.94, 241.94, 241.94, 241.94, 241.94, 241.94, 241.94, 241.94,
87 245.16, 245.16, 245.16, 245.16, 245.16, 245.16, 245.16, 245.16, 245.16,
88// 9,9,6,6,6,6,6,4,4,4 //backward calorimeter
89 172.06, 172.06, 172.06, 172.06, 172.06, 172.06, 172.06, 172.06, 172.06,
90 165.69, 165.69, 165.69, 165.69, 165.69, 165.69, 165.69, 165.69, 165.69,
91 159.78, 159.78, 159.78, 159.78, 159.78, 159.78,
92 154.36, 154.36, 154.36, 154.36, 154.36, 154.36,
93 149.37, 149.37, 149.37, 149.37, 149.37, 149.37,
94 144.82, 144.82, 144.82, 144.82, 144.82, 144.82,
95 140.67, 140.67, 140.67, 140.67, 140.67, 140.67,
96 136.89, 136.89, 136.89, 136.89,
97 133.49, 133.49, 133.49, 133.49,
98 133.49, 133.49, 133.49, 133.49
99};
100
101
103double const ECLCrystalData::BarrelZ[46] = {210.15, 200.14, 190.44, 181.05, 171.95, 163.03, 154.45, 146.10, 137.98, 129.99, 122.27, 114.72, 107.34, 100.05, 92.96, 86.00, 79.15, 72.36, 65.72, 59.16, 52.69, 46.22, 39.87, 33.56, 27.29, 21.01, 14.81, 8.62, 2.78, -2.78, -14.81, -21.01, -27.29, -33.56, -39.87, -46.22, -52.69, -59.16, -65.72, -72.36, -79.15, -86.00, -92.95, -100.05, -107 - 28};
104
105
106
107
110{
111 m_cell_ID = -1;
112 m_phi_ID = -1;
113 m_theta_ID = -1;
114 m_phi_idx = -1;
115 m_theta_idx = -1;
116
117 m_mass = -1;
118 m_volume = -1;
119 m_PosR = -1;
120 m_PosP = -1;
121 m_PosX = -1;
122 m_PosY = -1;
123 m_PosZ = -1;
124}
125
127{
128 m_cell_ID = cid;
129 Mapping(cid);
130
131 Eval();
132
133}
134
136{
137 m_phi_idx = -1;
138 m_theta_idx = -1;
139 m_theta_ID = tid;
140 m_phi_ID = pid;
141 m_cell_ID = GetCellID(tid, pid);
142
143 Eval();
144}
145
149
150
153{
154 //Crystal properties
155 m_mass = EvalMass();
156 m_volume = m_mass / 4.51;
157
158 //Crystal Location
159 m_PosP = EvalPhi();
160 m_PosR = EvalR();
161
162 m_PosZ = EvalZ();
163 m_PosX = EvalX();
164 m_PosY = EvalY();
165
166
167}
168
170{
171 return m_PosR * cos(TMath::DegToRad() * m_PosP);
172}
173
175{
176 return m_PosR * sin(TMath::DegToRad() * m_PosP);
177}
178
179
180//Determine mass of crystal
182{
183 if (IsEndCap()) {
185
186 } else {
188 }
189}
190
192{
193 if (m_theta_ID <= 12) { //forward ECL crystal
195
196 } else if (m_theta_ID >= 59) { //backward ECL crystal
198
199 }
200
201 //barrel ECL crystal
202 return m_theta_ID - 13;
203}
204
206{
208}
209
211{
212 return !IsEndCap();
213}
214
215
217{
218 return m_cell_ID;
219}
220
222{
223 return 22.5 * m_phi_ID / Ring[m_theta_ID];
224}
225
227{
228 if (IsEndCap()) {
229 return EndcapRadius[GetCrystalIndex()] * cos(TMath::DegToRad() * theta[m_theta_ID]);
230 }
231
232 return BarrelZ[GetCrystalIndex()];
233}
234
236{
237 if (IsEndCap()) {
238 return EndcapRadius[GetCrystalIndex()] * sin(TMath::DegToRad() * theta[m_theta_ID]);
239 }
240
241 return 147.7;
242}
243
244
245//Get CellID from theta and phi IDs
246int ECLCrystalData::GetCellID(int ThetaId, int PhiId)
247{
251 if (ThetaId < 13) {
252 const int forwRing[13] = {0, 3, 6, 10, 14, 18, 24, 30, 36, 42, 48, 54, 63 };
253 return forwRing[ThetaId] * 16 + PhiId;
254
255 } else if (ThetaId > 58) {
256 const int backRing[10] = {0, 9, 18, 24, 30, 36, 42, 48, 52, 56} ;
257 return ECLElementNumbers::c_NCrystalsForwardBarrel + backRing[ThetaId - 59] * 16 + PhiId;
258
259 }
260
261 return ECLElementNumbers::c_NCrystalsForward + 144 * (ThetaId - 13) + PhiId;
262}
263
265{
266 if (cid < 0) {
267 B2ERROR("ECL ECLGeometryPar Mapping " << cid << ". Out of range.");
268
269 } else if (cid < 3 * 16) { //Forkward start
270 m_theta_ID = 0;
271 m_phi_ID = cid;
272 m_phi_idx = m_phi_ID % 3;
273 m_theta_idx = m_phi_ID / 3;
274 } else if (cid < 6 * 16) {
275 m_theta_ID = 1;
276 m_phi_ID = cid - 3 * 16;
277 m_phi_idx = m_phi_ID % 3 + 3;
278 m_theta_idx = m_phi_ID / 3;
279 } else if (cid < 10 * 16) {
280 m_theta_ID = 2;
281 m_phi_ID = cid - 6 * 16 ;
282 m_phi_idx = m_phi_ID % 4 + 6;
283 m_theta_idx = m_phi_ID / 4;
284 } else if (cid < 14 * 16) {
285 m_theta_ID = 3;
286 m_phi_ID = cid - 10 * 16 ;
287 m_phi_idx = m_phi_ID % 4 + 10;
288 m_theta_idx = m_phi_ID / 4;
289 } else if (cid < 18 * 16) {
290 m_theta_ID = 4;
291 m_phi_ID = cid - 14 * 16 ;
292 m_phi_idx = m_phi_ID % 4 + 14;
293 m_theta_idx = m_phi_ID / 4;
294 } else if (cid < 24 * 16) {
295 m_theta_ID = 5;
296 m_phi_ID = cid - 18 * 16 ;
297 m_phi_idx = m_phi_ID % 6 + 18;
298 m_theta_idx = m_phi_ID / 6;
299 } else if (cid < 30 * 16) {
300 m_theta_ID = 6;
301 m_phi_ID = cid - 24 * 16 ;
302 m_phi_idx = m_phi_ID % 6 + 24;
303 m_theta_idx = m_phi_ID / 6;
304 } else if (cid < 36 * 16) {
305 m_theta_ID = 7;
306 m_phi_ID = cid - 30 * 16 ;
307 m_phi_idx = m_phi_ID % 6 + 30;
308 m_theta_idx = m_phi_ID / 6;
309 } else if (cid < 42 * 16) {
310 m_theta_ID = 8;
311 m_phi_ID = cid - 36 * 16 ;
312 m_phi_idx = m_phi_ID % 6 + 36;
313 m_theta_idx = m_phi_ID / 6;
314 } else if (cid < 48 * 16) {
315 m_theta_ID = 9;
316 m_phi_ID = cid - 42 * 16 ;
317 m_phi_idx = m_phi_ID % 6 + 42;
318 m_theta_idx = m_phi_ID / 6;
319 } else if (cid < 54 * 16) {
320 m_theta_ID = 10;
321 m_phi_ID = cid - 48 * 16 ;
322 m_phi_idx = m_phi_ID % 6 + 48;
323 m_theta_idx = m_phi_ID / 6;
324 } else if (cid < 63 * 16) {
325 m_theta_ID = 11;
326 m_phi_ID = cid - 54 * 16 ;
327 m_phi_idx = m_phi_ID % 9 + 54;
328 m_theta_idx = m_phi_ID / 9;
329 } else if (cid < 72 * 16) {
330 m_theta_ID = 12;
331 m_phi_ID = cid - 63 * 16 ;
332 m_phi_idx = m_phi_ID % 9 + 63;
333 m_theta_idx = m_phi_ID / 9;
334 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel) {//Barrel start
339 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 9 * 16) { //Backward start
340 m_theta_ID = 59;
342 m_phi_idx = m_phi_ID % 9 + 72;
343 m_theta_idx = m_phi_ID / 9;
344 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 18 * 16) {
345 m_theta_ID = 60;
347 m_phi_idx = m_phi_ID % 9 + 81;
348 m_theta_idx = m_phi_ID / 9;
349 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 24 * 16) {
350 m_theta_ID = 61;
352 m_phi_idx = m_phi_ID % 6 + 90;
353 m_theta_idx = m_phi_ID / 6;
354 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 30 * 16) {
355 m_theta_ID = 62;
357 m_phi_idx = m_phi_ID % 6 + 96;
358 m_theta_idx = m_phi_ID / 6;
359 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 36 * 16) {
360 m_theta_ID = 63;
362 m_phi_idx = m_phi_ID % 6 + 102;
363 m_theta_idx = m_phi_ID / 6;
364 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 42 * 16) {
365 m_theta_ID = 64;
367 m_phi_idx = m_phi_ID % 6 + 108;
368 m_theta_idx = m_phi_ID / 6;
369 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 48 * 16) {
370 m_theta_ID = 65;
372 m_phi_idx = m_phi_ID % 6 + 114;
373 m_theta_idx = m_phi_ID / 6;
374 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 52 * 16) {
375 m_theta_ID = 66;
377 m_phi_idx = m_phi_ID % 4 + 120;
378 m_theta_idx = m_phi_ID / 4;
379 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 56 * 16) {
380 m_theta_ID = 67;
382 m_phi_idx = m_phi_ID % 4 + 124;
383 m_theta_idx = m_phi_ID / 4;
384 } else if (cid < ECLElementNumbers::c_NCrystalsForwardBarrel + 60 * 16) {
385 m_theta_ID = 68;
387 m_phi_idx = m_phi_ID % 4 + 128;
388 m_theta_idx = m_phi_ID / 4;
389 } else {
390 B2ERROR("ECL ECLCrystalData Mapping " << cid << ". Out of range.");
391 }
392}
void Eval()
Set values for the crystal.
static const double theta[69]
Theta ID to theta(deg)
float m_PosY
Crystal Position - Y.
float m_mass
Crystal Mass.
float m_PosZ
Crystal Position - Z.
double EvalPhi()
Set phi value of crystal.
double EvalR()
Set R value of crystal.
float EvalMass()
Evaluate mass of crystal.
double EvalZ()
Set Z value of crystal.
int GetCrystalIndex()
return crystal index
float m_volume
Crystal Volume.
double EvalY()
Set Y value of crystal.
static const float CrystalMassEndcap[132]
Barrel crystal mass.
int m_cell_ID
Cell ID of crystal.
static const int sumPrevious[24]
Number of crystals in preceding theta rings (endcaps only)
bool IsEndCap()
True if crystal is in endcaps.
static const int Ring[69]
ECL has 16-fold symmetry in phi.
float m_PosR
Crystal Position - R.
float m_PosP
Crystal Position - P.
static const double EndcapRadius[132]
EndCapCrystalID to radius (spherical)
void Mapping(int cid)
set theta and phi value of crystal
ECLCrystalData()
Blank Constructor.
int m_phi_ID
phi ID of crystal
static const float CrystalMassBarrel[46]
Endcap crystal mass.
int m_theta_ID
theta ID of crystal
bool IsBarrel()
True if crystal is in barrel.
double EvalX()
Set X value of crystal.
float m_PosX
Crystal Position - X.
int GetCellID()
return cell ID
static const double BarrelZ[46]
BarrelCrystalID to z-coordinate.
const int c_NCrystalsForwardBarrel
Number of crystals in the forward and barrel ECL.
const int c_NCrystalsForward
Number of crystals in the forward ECL.
Abstract base class for different kinds of events.