Belle II Software development
Wire.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 TRGCDCWire_FLAG_
14#define TRGCDCWire_FLAG_
15
16#include <vector>
17#include "CLHEP/Geometry/Vector3D.h"
18#include "CLHEP/Geometry/Point3D.h"
19#include "trg/trg/Signal.h"
20#include "trg/cdc/Cell.h"
21#include "trg/cdc/Layer.h"
22
23#ifdef TRGCDC_SHORT_NAMES
24#define TCWire TRGCDCWire
25#endif
26
27namespace Belle2 {
34 typedef HepGeom::Vector3D<double> Vector3D;
36#define WireInnerLeft 0
38#define WireInnerRight 1
40#define WireLeft 2
42#define WireRight 3
44#define WireOuterLeft 4
46#define WireOuterRight 5
48#define MaxNeighbors 6
49
50 class TRGCDC;
51 class TRGCDCWireHit;
52 class TRGCDCWireHitMC;
53 class TRGCDCTrackSegment;
54
56 class TRGCDCWire : public TRGCDCCell {
57
58 public:
60 TRGCDCWire(unsigned id,
61 unsigned localId,
62 const TRGCDCLayer&,
65 const TRGClock& clock);
66
68 virtual ~TRGCDCWire();
69
70 public:// Selectors
71
73 const TRGCDCWireHit* hit(void) const;
74
75// /// returns a pointer to a TRGCDCTrackSegment.
76// const TRGCDCTrackSegment * const segment(void) const;
77
79 const TRGCDCWire* neighbor(unsigned) const;
80
82 bool consective(const TRGCDCWire&) const;
83
85 bool adjacent(const TRGCDCWire&) const;
86
88 int localIdForPlus(void) const;
89
91 int localIdForMinus(void) const;
92
94 std::string name(void) const override;
95
97 void dump(const std::string& message = std::string(""),
98 const std::string& prefix = std::string("")) const override;
99
100 public:// Modifiers
101
103 void clear(void) override;
104
106 const TRGCDCWireHit* hit(const TRGCDCWireHit*);
107
110
112 void addSignal(const TRGSignal& newSignal);
113
115 void addSignal_adc(const TRGSignal& newSignal);
116
117 public:// TRG
118
120 const TRGSignal& signal(void) const override;
121
123 const TRGSignal& signal_adc(void) const override;
124
125 private:
126
128// std::vector<const TRGCDCWireHitMC * const> _mcHits;
129 std::vector<const TRGCDCWireHitMC*> _mcHits;
130
133
136
138 friend class TRGCDC;
139 };
140
141//-----------------------------------------------------------------------------
142
143 inline
144 const TRGCDCWireHit*
146 {
147 //TODO only this strong retyping work, is it OK?
148 return reinterpret_cast<const TRGCDCWireHit*>(TRGCDCCell::hit(reinterpret_cast<const TRGCDCCellHit*>(h)));
149 }
150
151 inline
152 const TRGCDCWireHit*
153 TRGCDCWire::hit(void) const
154 {
155 //TODO only this strong retyping work, is it OK?
156 return reinterpret_cast<const TRGCDCWireHit*>(TRGCDCCell::hit());
157 }
158
159 inline
160 const TRGCDCWireHitMC*
162 {
163 _mcHits.push_back(a);
164 return a;
165 }
166
167 inline
168 void
170 {
171 _signal |= newSignal;
172 }
173
174 inline
175 void
177 {
178 _signal_adc |= newSignal;
179 }
180
181 inline
182 bool
184 {
185 if (neighbor(2) == & w) return true;
186 else if (neighbor(3) == & w) return true;
187 return false;
188 }
189
190 inline
191 bool
193 {
194 for (unsigned i = 0; i < 7; i++)
195 if (neighbor(i) == & w)
196 return true;
197 return false;
198 }
199
200 inline
201 int
203 {
204 //
205 // used in curl finder
206 //
207 // new version by NK
208 //
209 //ho const TCDCLayer &l = *layer();
210 //ho const int nw = l.nWires();
211
212 const TRGCDCLayer& l = this->layer();
213 const unsigned nw = l.nCells();
214 if (localId() + 1 == nw)
215 return -1;
216 else
217 return localId();
218 }
219
220 inline
221 int
223 {
224 //
225 // used in curl finder
226 //
227 // new version by NK
228 //
229 //ho const TRGCDCLayer &l = *layer();
230 //ho const int nw = l.nWires();
231
232 const TRGCDCLayer& l = this->layer();
233 const unsigned nw = l.nCells();
234 if (0 == localId())
235 return nw;
236 else
237 return localId();
238 }
239
240 inline
241 const TRGSignal&
243 {
244 return _signal;
245 }
246
247 inline
248 const TRGSignal&
250 {
251 return _signal_adc;
252 }
253
255} // namespace Belle2
256
257#endif /* TRGCDCWire_FLAG_ */
258
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 represent a cell layer.
Definition: Layer.h:33
A class to represent a MC wire hit in CDC.
Definition: WireHitMC.h:34
A class to represent a wire hit in CDC.
Definition: WireHit.h:33
A class to represent a wire in CDC.
Definition: Wire.h:56
TRGSignal _signal
Trigger output.
Definition: Wire.h:132
std::vector< const TRGCDCWireHitMC * > _mcHits
MC wire hit.
Definition: Wire.h:129
TRGSignal _signal_adc
Trigger output. with adc cut.
Definition: Wire.h:135
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
bool adjacent(const TRGCDCWire &) const
returns true if a given wire is adjacent.
Definition: Wire.h:192
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:34
void addSignal(const TRGSignal &newSignal)
set signal |= newSignal
Definition: Wire.h:169
HepGeom::Point3D< double > Point3D
3D point
Definition: Cell.h:32
const HepGeom::Point3D< double > & forwardPosition(void) const
returns position in forward endplate.
Definition: Cell.h:317
virtual ~TRGCDCWire()
Destructor.
Definition: Wire.cc:49
bool consective(const TRGCDCWire &) const
returns true if a given wire is consective in a layer.
Definition: Wire.h:183
const HepGeom::Point3D< double > & backwardPosition(void) const
returns position in backward endplate.
Definition: Cell.h:324
const TRGCDCCellHit * hit(void) const
returns a pointer to a TRGCDCCellHit.
Definition: Cell.h:365
const TRGSignal & signal(void) const override
returns an input to the trigger. This is sync'ed to 1GHz clock.
Definition: Wire.h:242
const TRGCDCWire * neighbor(unsigned) const
returns a pointer to a neighbor wire. This function is expensive.
Definition: Wire.cc:75
const TRGCDCWireHit * hit(void) const
returns a pointer to a TRGCDCWireHit.
Definition: Wire.h:153
std::string name(void) const override
returns name.
Definition: Wire.cc:385
int localIdForPlus(void) const
returns localId but if maxLocalId, return -1.
Definition: Wire.h:202
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
dumps debug information.
Definition: Wire.cc:54
void clear(void) override
clears information.
Definition: Wire.cc:370
const TRGCDCLayer & layer(void) const
returns a pointer to a layer.
Definition: Cell.h:235
unsigned nCells(void) const
returns # of cells.
Definition: Layer.h:194
const TRGSignal & signal_adc(void) const override
returns an input to the trigger. This is sync'ed to 1GHz clock.
Definition: Wire.h:249
int localIdForMinus(void) const
returns localId but if 0, return maxLocalId + 1.
Definition: Wire.h:222
unsigned localId(void) const
returns local id in a layer.
Definition: Cell.h:207
void addSignal_adc(const TRGSignal &newSignal)
set signal |= newSignal
Definition: Wire.h:176
Abstract base class for different kinds of events.