Belle II Software development
CDCTriggerSegmentHit.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#include <trg/cdc/dataobjects/CDCTriggerSegmentHit.h>
9
10using namespace Belle2;
11
13 unsigned short priorityPosition,
14 unsigned short leftRight,
15 short priorityTime,
16 short fastestTime,
17 short foundTime,
18 short quadrant,
19 std::vector<float> hittime,
20 unsigned int hitpattern,
21 std::vector<float> adcinfo,
22 unsigned int adcpattern):
23 m_segmentID(segmentID), m_priorityPosition(priorityPosition), m_leftRight(leftRight),
25 m_hittime(hittime), m_adcpattern(adcpattern), m_adcinfo(adcinfo)
26{
27 // find super layer and local wire id
28 std::array<int, 9> nWiresInSuperLayer = {
29 160, 160, 192, 224, 256, 288, 320, 352, 384
30 };
31 unsigned short iSL = 0;
32 unsigned short iWire = segmentID;
33 while (iWire >= nWiresInSuperLayer[iSL]) {
34 iWire -= nWiresInSuperLayer[iSL];
35 iSL += 1;
36 }
37 // shift from center wire to priority wire
38 if (priorityPosition == 1) {
39 if (iWire == 0)
40 iWire = nWiresInSuperLayer[iSL] - 1;
41 else
42 iWire -= 1;
43 }
44 unsigned short iLayer = (iSL == 0) ? 3 : 2;
45 if (priorityPosition == 1 || priorityPosition == 2)
46 iLayer += 1;
47 m_eWire = WireID(iSL, iLayer, iWire).getEWire();
48}
49
51 unsigned short iWire,
52 unsigned short priorityPosition,
53 unsigned short leftRight,
54 short priorityTime,
55 short fastestTime,
56 short foundTime,
57 short quadrant,
58 std::vector<float> hittime,
59 unsigned int hitpattern,
60 std::vector<float> adcinfo,
61 unsigned int adcpattern):
62
63 m_priorityPosition(priorityPosition), m_leftRight(leftRight),
65 m_hittime(hittime), m_adcpattern(adcpattern), m_adcinfo(adcinfo)
66{
67 // calculate continuous segment ID
68 std::array<int, 9> nWiresInSuperLayer = {
69 160, 160, 192, 224, 256, 288, 320, 352, 384
70 };
71 m_segmentID = iWire;
72 for (unsigned i = 0; i < iSL; ++i) {
73 m_segmentID += nWiresInSuperLayer[i];
74 }
75 // shift from center wire to priority wire
76 if (priorityPosition == 1) {
77 if (iWire == 0)
78 iWire = nWiresInSuperLayer[iSL] - 1;
79 else
80 iWire -= 1;
81 }
82 unsigned short iLayer = (iSL == 0) ? 3 : 2;
83 if (priorityPosition == 1 || priorityPosition == 2)
84 iLayer += 1;
85 m_eWire = WireID(iSL, iLayer, iWire).getEWire();
86}
87
89 unsigned short segmentID,
90 unsigned short priorityPosition,
91 unsigned short leftRight,
92 short priorityTime,
93 short fastestTime,
94 short foundTime,
95 short quadrant,
96 std::vector<float> hittime,
97 unsigned int hitpattern,
98 std::vector<float> adcinfo,
99 unsigned int adcpattern):
100 m_segmentID(segmentID), m_priorityPosition(priorityPosition), m_leftRight(leftRight),
102 m_eWire(priorityHit.getID()), m_quadrant(quadrant), m_hitpattern(hitpattern), m_hittime(hittime), m_adcpattern(adcpattern),
103 m_adcinfo(adcinfo)
104{}
105
106
107unsigned short
109{
110 std::array<int, 9> nWiresInSuperLayer = {
111 160, 160, 192, 224, 256, 288, 320, 352, 384
112 };
113 unsigned short iWire = getIWire();
114 unsigned short iSL = getISuperLayer();
115 if (m_priorityPosition == 1) {
116 iWire += 1;
117 if (iWire == nWiresInSuperLayer[iSL]) {
118 iWire = 0;
119 }
120 }
121 return iWire;
122}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition CDCHit.h:40
short priorityTime() const
get hit time of priority cell in trigger clocks
unsigned int m_hitpattern
hit pattern
unsigned short m_priorityPosition
position of the priority cell as an id: 0: no hit, 3: 1st priority, 1: 2nd right, 2: 2nd left
unsigned short m_eWire
Wire encoding of the priority wire.
std::vector< float > m_adcinfo
Full ADC information.
short m_priorityTime
hit time of priority cell in trigger clocks (~ 2ns)
unsigned short getIWire() const
get wire number of priority wire within layer.
short m_fastestTime
time of first hit in the track segment in trigger clocks (~ 2ns)
std::vector< float > m_hittime
hit pattern with hit time
unsigned short getID() const
get the encoded wire number of the priority wire.
unsigned short m_segmentID
continuous ID of the track segment
short fastestTime() const
get time of first hit in the track segment in trigger clocks
short m_foundTime
time when segment hit was found in trigger clocks (~ 2ns)
unsigned short getISuperLayer() const
get super layer number.
CDCTriggerSegmentHit()
default constructor.
unsigned int m_adcpattern
adc pattern
unsigned short m_leftRight
position of the priority cell relative to the track: 0: no hit, 1: right, 2: left,...
unsigned short getIWireCenter() const
get wire number of center wire within layer.
short foundTime() const
get time when segment hit was found in trigger clocks
Class to identify a wire inside the CDC.
Definition WireID.h:34
unsigned short getEWire() const
Getter for encoded wire number.
Definition WireID.h:154
Abstract base class for different kinds of events.