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 unsigned int hitpattern,
20 unsigned int hitpattern_adc):
21 m_segmentID(segmentID), m_priorityPosition(priorityPosition), m_leftRight(leftRight),
22 m_priorityTime(priorityTime), m_fastestTime(fastestTime), m_foundTime(foundTime), m_quadrant(quadrant), m_hitpattern(hitpattern),
23 m_hitpattern_adc(hitpattern_adc)
24{
25 // find super layer and local wire id
26 std::array<int, 9> nWiresInSuperLayer = {
27 160, 160, 192, 224, 256, 288, 320, 352, 384
28 };
29 unsigned short iSL = 0;
30 unsigned short iWire = segmentID;
31 while (iWire >= nWiresInSuperLayer[iSL]) {
32 iWire -= nWiresInSuperLayer[iSL];
33 iSL += 1;
34 }
35 // shift from center wire to priority wire
36 if (priorityPosition == 1) {
37 if (iWire == 0)
38 iWire = nWiresInSuperLayer[iSL] - 1;
39 else
40 iWire -= 1;
41 }
42 unsigned short iLayer = (iSL == 0) ? 3 : 2;
43 if (priorityPosition == 1 || priorityPosition == 2)
44 iLayer += 1;
45 m_eWire = WireID(iSL, iLayer, iWire).getEWire();
46}
47
49 unsigned short iWire,
50 unsigned short priorityPosition,
51 unsigned short leftRight,
52 short priorityTime,
53 short fastestTime,
54 short foundTime,
55 short quadrant,
56 unsigned int hitpattern,
57 unsigned int hitpattern_adc):
58 m_priorityPosition(priorityPosition), m_leftRight(leftRight),
59 m_priorityTime(priorityTime), m_fastestTime(fastestTime), m_foundTime(foundTime), m_quadrant(quadrant), m_hitpattern(hitpattern),
60 m_hitpattern_adc(hitpattern_adc)
61{
62 // calculate continuous segment ID
63 std::array<int, 9> nWiresInSuperLayer = {
64 160, 160, 192, 224, 256, 288, 320, 352, 384
65 };
66 m_segmentID = iWire;
67 for (unsigned i = 0; i < iSL; ++i) {
68 m_segmentID += nWiresInSuperLayer[i];
69 }
70 // shift from center wire to priority wire
71 if (priorityPosition == 1) {
72 if (iWire == 0)
73 iWire = nWiresInSuperLayer[iSL] - 1;
74 else
75 iWire -= 1;
76 }
77 unsigned short iLayer = (iSL == 0) ? 3 : 2;
78 if (priorityPosition == 1 || priorityPosition == 2)
79 iLayer += 1;
80 m_eWire = WireID(iSL, iLayer, iWire).getEWire();
81}
82
84 unsigned short segmentID,
85 unsigned short priorityPosition,
86 unsigned short leftRight,
87 short priorityTime,
88 short fastestTime,
89 short foundTime,
90 short quadrant,
91 unsigned int hitpattern,
92 unsigned int hitpattern_adc):
93 m_segmentID(segmentID), m_priorityPosition(priorityPosition), m_leftRight(leftRight),
94 m_priorityTime(priorityTime), m_fastestTime(fastestTime), m_foundTime(foundTime),
95 m_eWire(priorityHit.getID()), m_quadrant(quadrant), m_hitpattern(hitpattern), m_hitpattern_adc(hitpattern_adc)
96{}
97
98unsigned short
100{
101 std::array<int, 9> nWiresInSuperLayer = {
102 160, 160, 192, 224, 256, 288, 320, 352, 384
103 };
104 unsigned short iWire = getIWire();
105 unsigned short iSL = getISuperLayer();
106 if (m_priorityPosition == 1) {
107 iWire += 1;
108 if (iWire == nWiresInSuperLayer[iSL]) {
109 iWire = 0;
110 }
111 }
112 return iWire;
113}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
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.
unsigned short getIWire() const
get wire number of priority wire within layer.
unsigned short m_segmentID
continuous ID of the track segment
unsigned short getISuperLayer() const
get super layer number.
CDCTriggerSegmentHit()
default constructor.
unsigned short getIWireCenter() const
get wire number of center wire within layer.
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
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
Definition: calibTools.h:60
Abstract base class for different kinds of events.