Belle II Software  release-05-02-19
Segment.h
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : Segment.h
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a wire in CDC.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #ifndef TRGCDCSegment_FLAG_
15 #define TRGCDCSegment_FLAG_
16 
17 #include <vector>
18 #include "trg/cdc/LUT.h"
19 #include "trg/cdc/Cell.h"
20 
21 #ifdef TRGCDC_SHORT_NAMES
22 #define TCSegment TRGCDCSegment
23 #endif
24 
25 namespace Belle2 {
31  class TRGSignal;
32  class TRGCDCWire;
33  class TRGCDCLayer;
34  class TRGCDCLUT;
35  class TRGCDCWireHit;
36  class TRGCDCSegmentHit;
37  class CDCTriggerSegmentHit;
38 
40  class TRGCDCSegment : public TRGCDCCell {
41 
42  public:
43 
45  TRGCDCSegment(unsigned id,
46  const TRGCDCLayer& layer,
47  const TRGCDCWire& w,
48  const TRGClock& clock,
49  const std::string& TSLUTFile,
50  const std::vector<const TRGCDCWire*>& wires);
51 
53  virtual ~TRGCDCSegment();
54 
55  public:// Selectors
56 
58  const std::vector<const TRGCDCWire*>& wires(void) const;
59 
61  std::string name(void) const override;
62 
64  const TRGCDCWire* operator[](unsigned id) const;
65 
67  const TRGCDCWire& center(void) const;
68 
70  const TRGCDCWire& priority(void) const;
71 
73  const TRGSignal& signal(void) const override;
74 
76  const TRGCDCSegmentHit* hit(void) const;
77 
79  const std::vector<const CDCTriggerSegmentHit*> storeHits(void) const;
80 
82  unsigned hitPattern(void) const;
84  unsigned hitPattern(int clk0, int clk1) const;
86  unsigned lutPattern(void) const;
88  unsigned lutPattern(int clk0, int clk1) const;
89 
91  float fastestTime(void) const;
93  float fastestTime(int clk0) const;
94 
96  float foundTime(void)const;
97 
99  float priorityTime(void) const;
100 
102  int priorityPosition(void)const;
104  int priorityPosition(int clk0, int clk1)const;
105 
107  const TRGCDCLUT* LUT(void) const;
108 
110  void dump(const std::string& message = std::string(""),
111  const std::string& prefix = std::string("")) const override;
112 
113 
115  void initialize(void);
117  void initialize(bool fevtTime);
118 
119  public:// Utility functions
120 
122  /* static const std::vector<const TRGCDCSegment *> */
123  /* axial(const std::vector<const TRGCDCSegment *> & list); */
124 
126  static unsigned
127  nStereo(const std::vector<const TRGCDCSegment*>& list);
128 
130  virtual bool hasMember(const std::string& a) const override;
131 
132  public:// Modifiers
133 
135  void clear(void) override;
136 
138  void simulate(bool clockSimulation, bool logicLUTFlag,
139  std::string cdcCollectionName = std::string(""),
140  std::string tsCollectionName = std::string(""));
141 
143  const TRGCDCSegmentHit* hit(const TRGCDCSegmentHit*);
144 
146  void addStoreHit(const CDCTriggerSegmentHit*);
147 
148  public:
149 
151  void simulateWithoutClock(bool logicLUTFlag);
152 
154  void simulateWithClock(std::string cdcCollectionName,
155  std::string tsCollectionName);
156 
157  private:
158 
160  TRGCDCLUT* m_TSLUT = nullptr;
161 
163 // const TRGCDCLUT * const _lut; //Will be Removed.
164 
166  std::vector<const TRGCDCWire*> _wires;
167 
170 
173 
175  std::vector<const TRGCDCWireHit*> _hits;
176 
178  std::vector<const CDCTriggerSegmentHit*> _storeHits;
179 
181  std::string m_TSLUTFileName;
182 
183  // Friends
184  friend class TRGCDC;
185  };
186 
187 //-----------------------------------------------------------------------------
188 
189  inline
190  const std::vector<const TRGCDCWire*>&
192  {
193  return _wires;
194  }
195 
196  inline
197  const TRGCDCWire*
198  TRGCDCSegment::operator[](unsigned id) const
199  {
200  if (id < _wires.size())
201  return _wires[id];
202  return 0;
203  }
204 
205  inline
206  const TRGSignal&
208  {
209  return _signal;
210  }
211 
212  inline
213  const TRGCDCSegmentHit*
215  {
216  return (const TRGCDCSegmentHit*)
217  TRGCDCCell::hit((const TRGCDCCellHit*) h);
218  }
219 
220  inline
221  const TRGCDCSegmentHit*
222  TRGCDCSegment::hit(void) const
223  {
224  return (const TRGCDCSegmentHit*) TRGCDCCell::hit();
225  }
226 
227  inline
228  void
230  {
231  _storeHits.push_back(h);
232  }
233 
234  inline
235  const std::vector<const CDCTriggerSegmentHit*>
237  {
238  return _storeHits;
239  }
240 
241  inline
242  const TRGCDCLUT*
243  TRGCDCSegment::LUT(void) const
244  {
245  return m_TSLUT;
246  }
247 
248  inline
249  const TRGCDCWire&
251  {
252  if (_wires.size() == 15)
253  return * _wires[0];
254  return * _wires[5];
255  }
256 
258 } // namespace Belle2
259 
260 #endif /* TRGCDCSegment_FLAG_ */
Belle2::TRGSignal
A class to represent a digitized signal. Unit is nano second.
Definition: Signal.h:28
Belle2::TRGCDCSegment::clear
void clear(void) override
clears information.
Definition: Segment.cc:133
Belle2::TRGCDCSegment::_center
const TRGCDCWire * _center
Center wire.
Definition: Segment.h:169
Belle2::TRGCDCSegment::_wires
std::vector< const TRGCDCWire * > _wires
LookUp Table.
Definition: Segment.h:166
Belle2::TRGCDCCell::layer
const TRGCDCLayer & layer(void) const
returns a pointer to a layer.
Definition: Cell.h:233
Belle2::TRGCDCCell::hit
const TRGCDCCellHit * hit(void) const
returns a pointer to a TRGCDCCellHit.
Definition: Cell.h:363
Belle2::TRGCDCSegment::hitPattern
unsigned hitPattern(void) const
returns hit pattern.
Definition: Segment.cc:536
Belle2::TRGCDCSegment::simulateWithClock
void simulateWithClock(std::string cdcCollectionName, std::string tsCollectionName)
simulates TF hit time-dependently
Belle2::TRGCDCSegment::nStereo
static unsigned nStereo(const std::vector< const TRGCDCSegment * > &list)
returns axial segments.
Belle2::TRGCDCSegment::priority
const TRGCDCWire & priority(void) const
returns priority wire.
Belle2::TRGCDCLUT
A class to use LUTs for TRGCDC.
Definition: LUT.h:32
Belle2::TRGCDCSegment::priorityTime
float priorityTime(void) const
return priority time in TSHit.
Belle2::TRGCDCSegment::addStoreHit
void addStoreHit(const CDCTriggerSegmentHit *)
sets a pointer to a CDCTriggerSegmentHit.
Definition: Segment.h:229
Belle2::TRGCDCWire
A class to represent a wire in CDC.
Definition: Wire.h:57
Belle2::TRGCDCSegment::name
std::string name(void) const override
returns name.
Definition: Segment.cc:142
Belle2::TRGCDCSegment::TRGCDCSegment
TRGCDCSegment(unsigned id, const TRGCDCLayer &layer, const TRGCDCWire &w, const TRGClock &clock, const std::string &TSLUTFile, const std::vector< const TRGCDCWire * > &wires)
Constructor.
Definition: Segment.cc:41
Belle2::TRGCDCSegment::_signal
TRGSignal _signal
Trigger signal.
Definition: Segment.h:172
Belle2::TRGCDCSegment::simulateWithoutClock
void simulateWithoutClock(bool logicLUTFlag)
simulates time-indegrated TF hit
Belle2::TRGCDCSegment::foundTime
float foundTime(void) const
return found time in TSHit.
Belle2::TRGCDCLayer
A class to represent a cell layer.
Definition: Layer.h:34
Belle2::TRGCDCSegment::fastestTime
float fastestTime(void) const
return fastest time in TSHit.
Belle2::TRGCDCCell
A class to represent a wire in CDC.
Definition: Cell.h:41
Belle2::TRGCDCSegment::storeHits
const std::vector< const CDCTriggerSegmentHit * > storeHits(void) const
returns a pointer to a CDCTriggerSegmentHit.
Definition: Segment.h:236
Belle2::TRGCDCSegment::hit
const TRGCDCSegmentHit * hit(void) const
returns a pointer to a TRGCDCSegmentHit.
Definition: Segment.h:222
Belle2::TRGCDCSegment::dump
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
dumps debug information.
Definition: Segment.cc:72
Belle2::TRGCDCCellHit
A class to represent a wire hit in CDC.
Definition: CellHit.h:75
Belle2::TRGCDCSegment::m_TSLUT
TRGCDCLUT * m_TSLUT
LookUp Table. 0: no hit, 1: right, 2: left, 3: not determined.
Definition: Segment.h:160
Belle2::TRGCDCSegment::simulate
void simulate(bool clockSimulation, bool logicLUTFlag, std::string cdcCollectionName=std::string(""), std::string tsCollectionName=std::string(""))
simulates TF hit using wire information.
Belle2::TRGCDCSegment::hasMember
virtual bool hasMember(const std::string &a) const override
returns true this has member named a.
Definition: Segment.cc:580
Belle2::TRGCDCSegment::~TRGCDCSegment
virtual ~TRGCDCSegment()
Destructor.
Definition: Segment.cc:61
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCSegment::m_TSLUTFileName
std::string m_TSLUTFileName
TS LUT file name.
Definition: Segment.h:181
Belle2::TRGCDCSegmentHit
A class to represent a track segment hit in CDC.
Definition: SegmentHit.h:32
Belle2::TRGCDCSegment::priorityPosition
int priorityPosition(void) const
return priority cell position in TSHit. 0: no hit, 3: 1st priority, 1: 2nd right, 2: 2nd left
Belle2::TRGCDCCell::id
unsigned id(void) const
returns id.
Definition: Cell.h:198
Belle2::TRGCDC
The instance of TRGCDC is a singleton.
Definition: TRGCDC.h:70
Belle2::TRGCDCSegment
A class to represent a wire in CDC.
Definition: Segment.h:40
Belle2::TRGCDCSegment::center
const TRGCDCWire & center(void) const
returns a center wire.
Definition: Segment.h:250
Belle2::TRGCDCSegment::signal
const TRGSignal & signal(void) const override
returns trigger output. Null will returned if no signal.
Definition: Segment.h:207
Belle2::TRGCDCSegment::operator[]
const TRGCDCWire * operator[](unsigned id) const
returns a wire.
Definition: Segment.h:198
Belle2::CDCTriggerSegmentHit
Combination of several CDCHits to a track segment hit for the trigger.
Definition: CDCTriggerSegmentHit.h:16
Belle2::TRGCDCSegment::lutPattern
unsigned lutPattern(void) const
hit pattern containing bit for priority position
Definition: Segment.cc:560
Belle2::TRGCDCSegment::wires
const std::vector< const TRGCDCWire * > & wires(void) const
returns a vector containing pointers to a wire.
Definition: Segment.h:191
Belle2::TRGCDCSegment::_storeHits
std::vector< const CDCTriggerSegmentHit * > _storeHits
list of DataStore hits.
Definition: Segment.h:178
Belle2::TRGClock
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:43
Belle2::TRGCDCSegment::_hits
std::vector< const TRGCDCWireHit * > _hits
Wire hits.
Definition: Segment.h:175
Belle2::TRGCDCSegment::initialize
void initialize(void)
initilize variables.
Definition: Segment.cc:66
Belle2::TRGCDCSegment::LUT
const TRGCDCLUT * LUT(void) const
returns LUT
Definition: Segment.h:243