Belle II Software development
Segment.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//-----------------------------------------------------------------------------
10// Description : A class to represent a wire in CDC.
11//-----------------------------------------------------------------------------
12
13#ifndef TRGCDCSegment_FLAG_
14#define TRGCDCSegment_FLAG_
15
16#include <vector>
17#include "trg/cdc/LUT.h"
18#include "trg/cdc/Cell.h"
19
20#ifdef TRGCDC_SHORT_NAMES
21#define TCSegment TRGCDCSegment
22#endif
23
24namespace Belle2 {
30 class TRGSignal;
31 class TRGCDCWire;
32 class TRGCDCLayer;
33 class TRGCDCLUT;
34 class TRGCDCWireHit;
35 class TRGCDCSegmentHit;
36 class CDCTriggerSegmentHit;
37
39 class TRGCDCSegment : public TRGCDCCell {
40
41 public:
42
44 TRGCDCSegment(unsigned id,
45 const TRGCDCLayer& layer,
46 const TRGCDCWire& w,
47 const TRGClock& clock,
48 const std::string& TSLUTFile,
49 const std::vector<const TRGCDCWire*>& wires);
50
52 virtual ~TRGCDCSegment();
53
54 public:// Selectors
55
57 const std::vector<const TRGCDCWire*>& wires(void) const;
58
60 std::string name(void) const override;
61
63 const TRGCDCWire* operator[](unsigned id) const;
64
66 const TRGCDCWire& center(void) const;
67
69 const TRGCDCWire& priority(void) const;
70
72 const TRGSignal& signal(void) const override;
73
75 const TRGSignal& signal_adc(void) const override;
76
78 const TRGCDCSegmentHit* hit(void) const;
79
81 const std::vector<const CDCTriggerSegmentHit*> storeHits(void) const;
82
84 unsigned hitPattern(void) const;
86 unsigned hitPattern_adc(void) const;
88 unsigned hitPattern(int clk0, int clk1) const;
90 unsigned lutPattern(void) const;
92 unsigned lutPattern(int clk0, int clk1) const;
93
95 float fastestTime(void) const;
97 float fastestTime(int clk0) const;
98
100 float foundTime(void)const;
101
103 float priorityTime(void) const;
104
106 int priorityPosition(void)const;
108 int priorityPosition(int clk0, int clk1)const;
109
111 const TRGCDCLUT* LUT(void) const;
112
114 void dump(const std::string& message = std::string(""),
115 const std::string& prefix = std::string("")) const override;
116
117
119 void initialize(void);
121 void initialize(bool fevtTime);
122
123 public:// Utility functions
124
126 /* static const std::vector<const TRGCDCSegment *> */
127 /* axial(const std::vector<const TRGCDCSegment *> & list); */
128
130 static unsigned
131 nStereo(const std::vector<const TRGCDCSegment*>& list);
132
134 virtual bool hasMember(const std::string& a) const override;
135
136 public:// Modifiers
137
139 void clear(void) override;
140
142 void simulate(bool clockSimulation, bool logicLUTFlag,
143 const std::string& cdcCollectionName = std::string(""),
144 const std::string& tsCollectionName = std::string(""));
145
148
151
152 public:
153
155 void simulateWithoutClock(bool logicLUTFlag);
156
158 void simulateWithClock(std::string cdcCollectionName,
159 std::string tsCollectionName);
160
161 private:
162
164 TRGCDCLUT* m_TSLUT = nullptr;
165
167// const TRGCDCLUT * const _lut; //Will be Removed.
168
170 std::vector<const TRGCDCWire*> _wires;
171
174
177
180
182 std::vector<const TRGCDCWireHit*> _hits;
183
185 std::vector<const CDCTriggerSegmentHit*> _storeHits;
186
188 std::string m_TSLUTFileName;
189
190 // Friends
191 friend class TRGCDC;
192 };
193
194//-----------------------------------------------------------------------------
195
196 inline
197 const std::vector<const TRGCDCWire*>&
199 {
200 return _wires;
201 }
202
203 inline
204 const TRGCDCWire*
205 TRGCDCSegment::operator[](unsigned id) const
206 {
207 if (id < _wires.size())
208 return _wires[id];
209 return 0;
210 }
211
212 inline
213 const TRGSignal&
215 {
216 return _signal;
217 }
218
219 inline
220 const TRGSignal&
222 {
223 return _signal_adc;
224 }
225
226 inline
227 const TRGCDCSegmentHit*
229 {
230 //TODO only this strong retyping work, is it OK?
231 return reinterpret_cast<const TRGCDCSegmentHit*>(TRGCDCCell::hit(reinterpret_cast<const TRGCDCCellHit*>(h)));
232 }
233
234 inline
235 const TRGCDCSegmentHit*
237 {
238 //TODO only this strong retyping work, is it OK?
239 return reinterpret_cast<const TRGCDCSegmentHit*>(TRGCDCCell::hit());
240 }
241
242 inline
243 void
245 {
246 _storeHits.push_back(h);
247 }
248
249 inline
250 const std::vector<const CDCTriggerSegmentHit*>
252 {
253 return _storeHits;
254 }
255
256 inline
257 const TRGCDCLUT*
259 {
260 return m_TSLUT;
261 }
262
263 inline
264 const TRGCDCWire&
266 {
267 if (_wires.size() == 15)
268 return * _wires[0];
269 return * _wires[5];
270 }
271
273} // namespace Belle2
274
275#endif /* TRGCDCSegment_FLAG_ */
Combination of several CDCHits to a track segment hit for the trigger.
A class to represent a wire hit in CDC.
Definition: CellHit.h:74
A class to represent a wire in CDC.
Definition: Cell.h:40
A class to use LUTs for TRGCDC.
Definition: LUT.h:39
A class to represent a cell layer.
Definition: Layer.h:33
A class to represent a track segment hit in CDC.
Definition: SegmentHit.h:31
A class to represent a wire in CDC.
Definition: Segment.h:39
std::vector< const TRGCDCWire * > _wires
LookUp Table.
Definition: Segment.h:170
std::vector< const CDCTriggerSegmentHit * > _storeHits
list of DataStore hits.
Definition: Segment.h:185
TRGSignal _signal
Trigger signal.
Definition: Segment.h:176
void initialize(bool fevtTime)
initilize variables.
std::vector< const TRGCDCWireHit * > _hits
Wire hits.
Definition: Segment.h:182
std::string m_TSLUTFileName
TS LUT file name.
Definition: Segment.h:188
TRGCDCLUT * m_TSLUT
LookUp Table. 0: no hit, 1: right, 2: left, 3: not determined.
Definition: Segment.h:164
static unsigned nStereo(const std::vector< const TRGCDCSegment * > &list)
returns axial segments.
TRGSignal _signal_adc
Trigger signal.
Definition: Segment.h:179
const TRGCDCWire * _center
Center wire.
Definition: Segment.h:173
A class to represent a wire in CDC.
Definition: Wire.h:56
The instance of TRGCDC is a singleton.
Definition: TRGCDC.h:69
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:38
A class to represent a digitized signal. Unit is nano second.
Definition: Signal.h:23
virtual bool hasMember(const std::string &a) const override
returns true this has member named a.
Definition: Segment.cc:591
const TRGCDCWire & center(void) const
returns a center wire.
Definition: Segment.h:265
int priorityPosition(void) const
return priority cell position in TSHit. 0: no hit, 3: 1st priority, 1: 2nd right, 2: 2nd left
Definition: Segment.cc:473
float fastestTime(void) const
return fastest time in TSHit.
Definition: Segment.cc:387
unsigned id(void) const
returns id.
Definition: Cell.h:200
void addStoreHit(const CDCTriggerSegmentHit *)
sets a pointer to a CDCTriggerSegmentHit.
Definition: Segment.h:244
virtual ~TRGCDCSegment()
Destructor.
Definition: Segment.cc:60
void simulateWithoutClock(bool logicLUTFlag)
simulates time-indegrated TF hit
Definition: Segment.cc:176
void simulateWithClock(std::string cdcCollectionName, std::string tsCollectionName)
simulates TF hit time-dependently
Definition: Segment.cc:291
unsigned hitPattern(void) const
returns hit pattern.
Definition: Segment.cc:535
const TRGCDCCellHit * hit(void) const
returns a pointer to a TRGCDCCellHit.
Definition: Cell.h:365
const TRGSignal & signal(void) const override
returns trigger output. Null will returned if no signal.
Definition: Segment.h:214
const TRGCDCWire & priority(void) const
returns priority wire.
Definition: Segment.cc:525
void initialize(void)
initilize variables.
Definition: Segment.cc:65
std::string name(void) const override
returns name.
Definition: Segment.cc:141
unsigned lutPattern(void) const
hit pattern containing bit for priority position
Definition: Segment.cc:571
void simulate(bool clockSimulation, bool logicLUTFlag, const std::string &cdcCollectionName=std::string(""), const std::string &tsCollectionName=std::string(""))
simulates TF hit using wire information.
Definition: Segment.cc:154
const TRGCDCWire * operator[](unsigned id) const
returns a wire.
Definition: Segment.h:205
const TRGCDCLUT * LUT(void) const
returns LUT
Definition: Segment.h:258
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
dumps debug information.
Definition: Segment.cc:71
void clear(void) override
clears information.
Definition: Segment.cc:132
const std::vector< const CDCTriggerSegmentHit * > storeHits(void) const
returns a pointer to a CDCTriggerSegmentHit.
Definition: Segment.h:251
const TRGCDCLayer & layer(void) const
returns a pointer to a layer.
Definition: Cell.h:235
const std::vector< const TRGCDCWire * > & wires(void) const
returns a vector containing pointers to a wire.
Definition: Segment.h:198
float priorityTime(void) const
return priority time in TSHit.
Definition: Segment.cc:463
unsigned hitPattern_adc(void) const
returns hit pattern with adc cut.
Definition: Segment.cc:547
float foundTime(void) const
return found time in TSHit.
Definition: Segment.cc:423
const TRGSignal & signal_adc(void) const override
returns trigger output. Null will returned if no signal.
Definition: Segment.h:221
const TRGCDCSegmentHit * hit(void) const
returns a pointer to a TRGCDCSegmentHit.
Definition: Segment.h:236
Abstract base class for different kinds of events.