Belle II Software development
SVDPar.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#ifndef SVD_PAR_H_
10#define SVD_PAR_H_
11
12#include <vxd/dataobjects/VxdID.h>
13
14namespace Belle2 {
19 /* This namespace provides basic parameters in SVD setup.
20 */
21
22 namespace SVDPar {
23
24 const unsigned short maxLayer = 5;
25 const unsigned short minLayer = 2;
26 const unsigned short nLayer = maxLayer - minLayer + 1;
27 const unsigned short nLadder_L3 = 7;
28 const unsigned short nLadder_L4 = 10;
29 const unsigned short nLadder_L5 = 12;
30 const unsigned short nLadder_L6 = 16;
31 const unsigned short nLadder[nLayer] =
32 {nLadder_L3, nLadder_L4, nLadder_L5, nLadder_L6};
33 const unsigned short nSensor_L3 = 2;
34 const unsigned short nSensor_L4 = 3;
35 const unsigned short nSensor_L5 = 4;
36 const unsigned short nSensor_L6 = 5;
37 const unsigned short nSensor[nLayer] =
38 {nSensor_L3, nSensor_L4, nSensor_L5, nSensor_L6};
39 //const unsigned short nSegment = 2;
40 const unsigned short nPN = 2;
41 const unsigned short maxStrip = 768;
42
43 const unsigned short maxSample = 6;
44
45 const unsigned short NApvPerHybrid = 6;
46
47 const unsigned short nSensorID =
48 (unsigned short)(nSensor_L3 * nLadder_L3 +
49 nSensor_L4 * nLadder_L4 +
50 nSensor_L5 * nLadder_L5 +
51 nSensor_L6* nLadder_L6) * nPN;
52
53
54 short getSVDSensorID(const unsigned short layer,
55 const unsigned short ladder,
56 const unsigned short sensor,
57 const unsigned short pn)
58 {
59
60 if (layer < minLayer || maxLayer < layer || 2 <= pn) {
61 return -1;
62 }
63
64 short sensor_id_base = 0;
65
66 if (layer == 2) {
67 if (nLadder[0] <= ladder || nSensor[0] <= sensor) return -2;
68 return nPN * nSensor[0] * ladder + nPN * sensor + pn;
69 }
70
71 sensor_id_base += nPN * nSensor[0] * nLadder[0];
72 if (layer == 3) {
73 if (nLadder[1] <= ladder || nSensor[1] <= sensor) return -3;
74 return sensor_id_base + nPN * nSensor[1] * ladder + nPN * sensor + pn;
75 }
76
77 sensor_id_base += nPN * nSensor[1] * nLadder[1];
78 if (layer == 4) {
79 if (nLadder[2] <= ladder || nSensor[2] <= sensor) return -4;
80 return sensor_id_base + nPN * nSensor[2] * ladder + nPN * sensor + pn;
81 }
82
83 sensor_id_base += nPN * nSensor[2] * nLadder[2];
84 if (layer == 5) {
85 if (nLadder[3] <= ladder || nSensor[3] <= sensor) return -5;
86 return sensor_id_base + nPN * nSensor[3] * ladder + nPN * sensor + pn;
87 }
88
89 return -9;
90 }
91
92 short getSVDSensorID(VxdID id, bool is_u)
93 {
94 unsigned short layer = id.getLayerNumber() - 1;
95 unsigned short ladder = id.getLadderNumber();
96 //unsigned short sensor = id.getSensorNumber();
97 unsigned short sensor = 0; // workround solution for DESY beam data
98 //unsigned short segment = id.getSegmentNumber();
99
100 unsigned short pn = (is_u) ? 0 : 1; // 0: p-side, 1: n-side
101
102 //std::cout << "VxdID: " << id.getID() << " = layer: " << layer << ", ladder: " << ladder << ", sensor: " << sensor << ", segment: " << segment << std::endl;
103
104 return getSVDSensorID(layer, ladder, sensor, pn);
105 }
106
107 } // namespace SVDPar
108
110} // namespace Belle2
111
112#endif
Abstract base class for different kinds of events.