Belle II Software  release-08-01-10
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 
10 using namespace Belle2;
11 
13  unsigned short priorityPosition,
14  unsigned short leftRight,
15  short priorityTime,
16  short fastestTime,
17  short foundTime,
18  short quadrant):
19  m_segmentID(segmentID), m_priorityPosition(priorityPosition), m_leftRight(leftRight),
20  m_priorityTime(priorityTime), m_fastestTime(fastestTime), m_foundTime(foundTime), m_quadrant(quadrant)
21 {
22  // find super layer and local wire id
23  std::array<int, 9> nWiresInSuperLayer = {
24  160, 160, 192, 224, 256, 288, 320, 352, 384
25  };
26  unsigned short iSL = 0;
27  unsigned short iWire = segmentID;
28  while (iWire >= nWiresInSuperLayer[iSL]) {
29  iWire -= nWiresInSuperLayer[iSL];
30  iSL += 1;
31  }
32  // shift from center wire to priority wire
33  if (priorityPosition == 1) {
34  if (iWire == 0)
35  iWire = nWiresInSuperLayer[iSL] - 1;
36  else
37  iWire -= 1;
38  }
39  unsigned short iLayer = (iSL == 0) ? 3 : 2;
40  if (priorityPosition == 1 || priorityPosition == 2)
41  iLayer += 1;
42  m_eWire = WireID(iSL, iLayer, iWire).getEWire();
43 }
44 
46  unsigned short iWire,
47  unsigned short priorityPosition,
48  unsigned short leftRight,
49  short priorityTime,
50  short fastestTime,
51  short foundTime,
52  short quadrant):
53  m_priorityPosition(priorityPosition), m_leftRight(leftRight),
54  m_priorityTime(priorityTime), m_fastestTime(fastestTime), m_foundTime(foundTime), m_quadrant(quadrant)
55 {
56  // calculate continuous segment ID
57  std::array<int, 9> nWiresInSuperLayer = {
58  160, 160, 192, 224, 256, 288, 320, 352, 384
59  };
60  m_segmentID = iWire;
61  for (unsigned i = 0; i < iSL; ++i) {
62  m_segmentID += nWiresInSuperLayer[i];
63  }
64  // shift from center wire to priority wire
65  if (priorityPosition == 1) {
66  if (iWire == 0)
67  iWire = nWiresInSuperLayer[iSL] - 1;
68  else
69  iWire -= 1;
70  }
71  unsigned short iLayer = (iSL == 0) ? 3 : 2;
72  if (priorityPosition == 1 || priorityPosition == 2)
73  iLayer += 1;
74  m_eWire = WireID(iSL, iLayer, iWire).getEWire();
75 }
76 
78  unsigned short segmentID,
79  unsigned short priorityPosition,
80  unsigned short leftRight,
81  short priorityTime,
82  short fastestTime,
83  short foundTime,
84  short quadrant):
85  m_segmentID(segmentID), m_priorityPosition(priorityPosition), m_leftRight(leftRight),
86  m_priorityTime(priorityTime), m_fastestTime(fastestTime), m_foundTime(foundTime),
87  m_eWire(priorityHit.getID()), m_quadrant(quadrant)
88 {}
89 
90 unsigned short
92 {
93  std::array<int, 9> nWiresInSuperLayer = {
94  160, 160, 192, 224, 256, 288, 320, 352, 384
95  };
96  unsigned short iWire = getIWire();
97  unsigned short iSL = getISuperLayer();
98  if (m_priorityPosition == 1) {
99  iWire += 1;
100  if (iWire == nWiresInSuperLayer[iSL]) {
101  iWire = 0;
102  }
103  }
104  return iWire;
105 }
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.