Belle II Software development
Cell.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 cell (a wire or a track segment) in CDC.
11//-----------------------------------------------------------------------------
12
13#ifndef TRGCDCCell_FLAG_
14#define TRGCDCCell_FLAG_
15
16#include "CLHEP/Geometry/Vector3D.h"
17#include "CLHEP/Geometry/Point3D.h"
18#include "trg/trg/Signal.h"
19#include "trg/cdc/Layer.h"
20
21#ifdef TRGCDC_SHORT_NAMES
22#define TCCell TRGCDCCell
23#endif
24
25namespace Belle2 {
34 typedef HepGeom::Vector3D<double> Vector3D;
35
36 class TRGCDC;
37 class TRGCDCCellHit;
38
40 class TRGCDCCell {
41
42 public:
44 TRGCDCCell(unsigned id,
45 unsigned localId,
46 const TRGCDCLayer& layer,
49
51 virtual ~TRGCDCCell();
52
53 public:// Selectors
54
56 unsigned id(void) const;
57
59 unsigned localId(void) const;
60
62 unsigned layerId(void) const;
63
65 unsigned localLayerId(void) const;
66
68 unsigned superLayerId(void) const;
69
71 unsigned axialStereoLayerId(void) const;
72
74 unsigned axialStereoSuperLayerId(void) const;
75
77 const TRGCDCLayer& layer(void) const;
78
80 unsigned state(void) const;
81
83 bool axial(void) const;
84
86 bool stereo(void) const;
87
88// /// returns a pointer to a neighbor wire. This function is expensive.
89// virtual const TRGCDCCell * const neighbor(unsigned) const = 0;
90
92 int localIdDifference(const TRGCDCCell&) const;
93
95 virtual std::string name(void) const = 0;
96
98 virtual void dump(const std::string& message = std::string(""),
99 const std::string& prefix = std::string("")) const;
100
102 virtual const TRGSignal& signal(void) const = 0;
103
105 virtual const TRGSignal& signal_adc(void) const = 0;
106
107 public:// Geometry
108
110 const HepGeom::Point3D<double>& forwardPosition(void) const;
111
115 double* backwardPosition(double p[3]) const;
116
118 const HepGeom::Point3D<double>& xyPosition(void) const;
120 double* xyPosition(double p[3]) const;
121
123 const Vector3D& direction(void) const;
124
126// void wirePosition(float zPosition,
127// HepGeom::Point3D<double> & xyPosition,
128// HepGeom::Point3D<double> & backwardPosition,
129// Vector3D & direction) const;
130
132 float cellSize(void) const;
133
134 public:// Utility functions
135
137 virtual bool hasMember(const std::string& a) const;
138
139 public:// event by event information.
140
142 const TRGCDCCellHit* hit(void) const;
143
144 public:// Obsolete functions from Belle
145
147 bool innerPart(void) const;
148
150 bool mainPart(void) const;
151
152 public:// Modifiers
153
155 unsigned state(unsigned newState);
156
158 virtual void clear(void);
159
161 const TRGCDCCellHit* hit(const TRGCDCCellHit*);
162
163 private:
164
166 const unsigned _id;
167
169 const unsigned _localId;
170
173
176
179
182
185
187 unsigned _state;
188
191
193 friend class TRGCDC;
194 };
195
196//-----------------------------------------------------------------------------
197
198 inline
199 unsigned
200 TRGCDCCell::id(void) const
201 {
202 return _id;
203 }
204
205 inline
206 unsigned
208 {
209 return _localId;
210 }
211
212 inline
213 unsigned
215 {
216 return _layer.id();
217 }
218
219 inline
220 unsigned
222 {
223 return _layer.superLayerId();
224 }
225
226 inline
227 unsigned
229 {
230 return _layer.localLayerId();
231 }
232
233 inline
234 const TRGCDCLayer&
236 {
237 return _layer;
238 }
239
240 inline
241 unsigned
243 {
244 return _state;
245 }
246
247 inline
248 unsigned
250 {
251 return _state = a;
252 }
253
254 inline
255 bool
257 {
258 return _layer.axial();
259 }
260
261 inline
262 bool
264 {
265 return _layer.stereo();
266 }
267
268 inline
269 unsigned
271 {
272 return _layer.axialStereoLayerId();
273 }
274
275 inline
276 unsigned
278 {
280 }
281
282 inline
283 bool
285 {
286 std::cout << "TRGCDCCell::innerPart ... position not defined" << std::endl;
287 if (layerId() < 14) return true;
288 return false;
289 }
290
291 inline
292 bool
294 {
295 std::cout << "TRGCDCCell::mainPart ... position not defined" << std::endl;
296 if (layerId() > 13) return true;
297 return false;
298 }
299
300 inline
301 float
303 {
304 return _layer.cellSize();
305 }
306
307 inline
308 void
310 {
311 _state = 0;
312 _hit = 0;
313 }
314
315 inline
318 {
319 return _forwardPosition;
320 }
321
322 inline
325 {
326 return _backwardPosition;
327 }
328
329 inline
330 double*
332 {
333 p[0] = _backwardPosition.x();
334 p[1] = _backwardPosition.y();
335 p[2] = _backwardPosition.z();
336 return p;
337 }
338
339 inline
342 {
343 return _xyPosition;
344 }
345
346 inline
347 double*
348 TRGCDCCell::xyPosition(double a[3]) const
349 {
350 a[0] = _xyPosition.x();
351 a[1] = _xyPosition.y();
352 a[2] = 0.;
353 return a;
354 }
355
356 inline
357 const Vector3D&
359 {
360 return _direction;
361 }
362
363 inline
364 const TRGCDCCellHit*
365 TRGCDCCell::hit(void) const
366 {
367 return _hit;
368 }
369
370 inline
371 const TRGCDCCellHit*
373 {
374 return _hit = a;
375 }
376
377 inline
378 bool
379 TRGCDCCell::hasMember(const std::string& a) const
380 {
381 return name() == a;
382 }
383
385} // namespace Belle2
386
387#endif /* TRGCDCCell_FLAG_ */
388
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
const HepGeom::Point3D< double > _forwardPosition
Wire forward position.
Definition: Cell.h:178
const HepGeom::Point3D< double > _xyPosition
Wire center(?) position.
Definition: Cell.h:175
const unsigned _id
ID.
Definition: Cell.h:166
const unsigned _localId
Local ID.
Definition: Cell.h:169
virtual const TRGSignal & signal(void) const =0
returns trigger output. Null will returned if no signal.
const HepGeom::Point3D< double > _backwardPosition
Wire backward position.
Definition: Cell.h:181
const TRGCDCCellHit * _hit
Cell hit.
Definition: Cell.h:190
virtual std::string name(void) const =0
returns name.
const Vector3D _direction
Direction vector.
Definition: Cell.h:184
virtual const TRGSignal & signal_adc(void) const =0
returns trigger output. Null will returned if no signal.
const TRGCDCLayer & _layer
Layer.
Definition: Cell.h:172
unsigned _state
Status in this event.
Definition: Cell.h:187
A class to represent a cell layer.
Definition: Layer.h:33
The instance of TRGCDC is a singleton.
Definition: TRGCDC.h:69
A class to represent a digitized signal. Unit is nano second.
Definition: Signal.h:23
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:34
HepGeom::Point3D< double > Point3D
3D point
Definition: Cell.h:32
float cellSize(void) const
calculates position and direction vector with sag correction.
Definition: Cell.h:302
const HepGeom::Point3D< double > & forwardPosition(void) const
returns position in forward endplate.
Definition: Cell.h:317
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: Cell.cc:52
bool innerPart(void) const
returns true if this wire is in the inner part.
Definition: Cell.h:284
bool mainPart(void) const
returns true if this wire is in the main part.
Definition: Cell.h:293
unsigned id(void) const
returns id.
Definition: Cell.h:200
const Vector3D & direction(void) const
returns direction vector of the wire.
Definition: Cell.h:358
virtual ~TRGCDCCell()
Destructor.
Definition: Cell.cc:47
unsigned layerId(void) const
returns layer id.
Definition: Cell.h:214
unsigned localLayerId(void) const
returns local layer id in a super layer.
Definition: Cell.h:228
const HepGeom::Point3D< double > & backwardPosition(void) const
returns position in backward endplate.
Definition: Cell.h:324
unsigned superLayerId(void) const
returns super layer id.
Definition: Cell.h:221
const TRGCDCCellHit * hit(void) const
returns a pointer to a TRGCDCCellHit.
Definition: Cell.h:365
unsigned axialStereoSuperLayerId(void) const
returns id of axial or stereo super layer id.
Definition: Cell.h:277
virtual bool hasMember(const std::string &a) const
returns true this has member named a.
Definition: Cell.h:379
bool stereo(void) const
returns true if this wire is in a stereo layer.
Definition: Cell.h:263
const HepGeom::Point3D< double > & xyPosition(void) const
returns middle position of a wire. z componet is 0.
Definition: Cell.h:341
const TRGCDCLayer & layer(void) const
returns a pointer to a layer.
Definition: Cell.h:235
unsigned axialStereoLayerId(void) const
returns id of axial or stereo layer id.
Definition: Cell.h:270
int localIdDifference(const TRGCDCCell &) const
returns local id difference.
Definition: Cell.cc:69
virtual void clear(void)
clears information.
Definition: Cell.h:309
unsigned state(void) const
returns state.
Definition: Cell.h:242
bool axial(void) const
returns true if this wire is in an axial layer.
Definition: Cell.h:256
unsigned localId(void) const
returns local id in a layer.
Definition: Cell.h:207
Abstract base class for different kinds of events.