BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/TrkReco/TrkReco/TMDCWire.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TMDCWire.h,v 1.8 2011/07/31 02:50:49 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TMDCWire.h
5// Section : Tracking MDC
6// Owner : Yoshi Iwasaki
7// Email : [email protected]
8//-----------------------------------------------------------------------------
9// Description : A class to represent a wire in MDC.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef TMDCWire_FLAG_
14#define TMDCWire_FLAG_
15
16#ifdef TRKRECO_DEBUG_DETAIL
17#ifndef TRKRECO_DEBUG
18#define TRKRECO_DEBUG
19#endif
20#endif
21
22// itostring
23#include "CLHEP/String/Strings.h"
24
25#define HEP_SHORT_NAMES
26#include "CLHEP/Geometry/Vector3D.h"
27#ifndef ENABLE_BACKWARDS_COMPATIBILITY
29#endif
30
31#ifndef CLHEP_POINT3D_H
32#include "CLHEP/Geometry/Point3D.h"
33#endif
34#ifndef ENABLE_BACKWARDS_COMPATIBILITY
36#endif
37
38#include "TrkReco/TMDCLayer.h"
39
40#define WireInnerLeft 0
41#define WireInnerRight 1
42#define WireLeft 2
43#define WireRight 3
44#define WireOuterLeft 4
45#define WireOuterRight 5
46
47//struct geocdc_wire;
48class MdcGeoWire;
49class TMDC;
50class TMDCTsf;
51class TMDCWireHit;
52class TMDCWireHitMC;
53
54/// A class to represent a wire in MDC.
55class TMDCWire {
56
57 public:
58 /// Constructor.
59 TMDCWire(const MdcGeoWire *, TMDCLayer *);
60
61 /// Destructor
62 virtual ~TMDCWire();
63
64 public:// Selectors
65 /// returns id.
66 unsigned id(void) const;
67
68 /// returns local id in a wire layer.
69 unsigned localId(void) const;
70
71 /// returns layer id.
72 unsigned layerId(void) const;
73
74 /// returns local layer id in a super layer.
75 unsigned localLayerId(void) const;
76
77 /// returns super layer id.
78 unsigned superLayerId(void) const;
79
80 /// returns id of axial or stereo id.
81 unsigned axialStereoLayerId(void) const;
82
83 /// returns a pointer to GEOMDC_WIR.
84 const MdcGeoWire * geocdc(void) const;
85
86 /// returns a pointer to a layer.
87 const TMDCLayer * const layer(void) const;
88
89 /// returns a pointer to a TMDCWireHit.
90 const TMDCWireHit * const hit(void) const;
91
92 /// returns a pointer to a TMDCTsf.
93 const TMDCTsf * const tsf(void) const;
94
95 /// returns state.
96 unsigned state(void) const;
97
98 /// returns true if this wire is in an axial layer.
99 bool axial(void) const;
100
101 /// returns true if this wire is in a stereo layer.
102 bool stereo(void) const;
103
104 /// returns true if this wire is in the inner part.
105 bool innerPart(void) const;
106
107 /// returns true if this wire is in the main part.
108 bool mainPart(void) const;
109
110 /// returns a pointer to a neighbor wire.
111 const TMDCWire * const neighbor(unsigned) const;
112
113 /// returns true if a given wire is consective in a layer.
114 bool consective(const TMDCWire &) const;
115
116 /// returns true if a given wire is adjacent.
117 bool adjacent(const TMDCWire &) const;
118
119 /// returns localId but if maxLocalId, return -1.
120 int localIdForPlus(void) const;
121
122 /// returns localId but if 0, return maxLocalId + 1.
123 int localIdForMinus(void) const;
124
125 /// returns position in forward endplate.
126 const HepPoint3D & forwardPosition(void) const;
127
128 /// returns position in backward endplate.
129 const HepPoint3D & backwardPosition(void) const;
130 double * backwardPosition(double p[3]) const;
131 const double & tension(void) const;
132 /// returns middle position of a wire. z componet is 0.
133 const HepPoint3D & xyPosition(void) const;
134 double * xyPosition(double p[3]) const;
135 const HepPoint3D xyPosition(double z) const;
136 /// returns direction vector of the wire.
137 const HepVector3D & direction(void) const;
138
139 /// calculates position and direction vector with sag correction.
140 void wirePosition(float zPosition,
143 HepVector3D & direction) const;
144
145 /// returns cell size in phi.
146 float cellSize(void) const;
147
148 /// returns local id difference.
149 int localIdDifference(const TMDCWire &) const;
150
151 /// returns name.
152 std::string name(void) const;
153
154 /// dumps debug information.
155 void dump(const std::string & message = std::string(""),
156 const std::string & prefix = std::string("")) const;
157
158 public:// Modifiers
159 /// sets a pointer to TMDCWireHit.
160 const TMDCWireHit * const hit(const TMDCWireHit * const);
161
162 /// appends a pointer to TMDCWireHitMC.
163 const TMDCWireHitMC * const hit(TMDCWireHitMC * const);
164
165 /// sets a pointer of TMDCTsf.
166 TMDCTsf * tsf(TMDCTsf *);
167
168 /// sets state.
169 unsigned state(unsigned newState);
170
171 /// clears information.
172 void clear(void);
173
174 private:
175 unsigned _state;
176 const TMDCWireHit * _hit;
177 AList<TMDCWireHitMC> _mcHits;
178
179 unsigned _id;
180 unsigned _localId;
181 unsigned _layerId;
182 const TMDCLayer * _layer;
183 TMDCTsf * _tsf;
184 HepPoint3D _xyPosition;
185 HepPoint3D _forwardPosition;
186 HepPoint3D _backwardPosition;
187 double _tension;
188 HepVector3D _direction;
189 const MdcGeoWire * _geo;
190
191 static TMDC * _cdc;
192};
193
194//-----------------------------------------------------------------------------
195
196#ifdef TMDCWire_NO_INLINE
197#define inline
198#else
199#undef inline
200#define TMDCWire_INLINE_DEFINE_HERE
201#endif
202
203#ifdef TMDCWire_INLINE_DEFINE_HERE
204
205inline
206unsigned
207TMDCWire::id(void) const {
208 return _id;
209}
210
211inline
212unsigned
213TMDCWire::localId(void) const {
214 return _localId;
215}
216
217inline
218unsigned
219TMDCWire::layerId(void) const {
220 return _layerId;
221}
222
223inline
224unsigned
226 return _layer->superLayerId();
227}
228
229inline
230unsigned
232 return _layer->localLayerId();
233}
234
235inline
236const MdcGeoWire *
237TMDCWire::geocdc(void) const {
238 return _geo;
239}
240
241inline
242const TMDCLayer * const
243TMDCWire::layer(void) const {
244 return _layer;
245}
246
247inline
248const TMDCTsf * const
249TMDCWire::tsf(void) const {
250 return _tsf;
251}
252
253inline
254TMDCTsf *
256 return _tsf = t;
257}
258
259inline
260unsigned
261TMDCWire::state(void) const {
262 return _state;
263}
264
265inline
266unsigned
267TMDCWire::state(unsigned a) {
268 return _state = a;
269}
270
271inline
272void
274 _state = 0;
275 _hit = 0;
276 _mcHits.removeAll();
277}
278
279inline
280const TMDCWireHit * const
281TMDCWire::hit(const TMDCWireHit * const h) {
282 return _hit = h;
283}
284
285inline
286const TMDCWireHit * const
287TMDCWire::hit(void) const {
288 return _hit;
289}
290
291inline
292const TMDCWireHitMC * const
294 _mcHits.append(a);
295 return a;
296}
297
298inline
299const HepPoint3D &
301 return _forwardPosition;
302}
303
304inline
305const HepPoint3D &
307 return _backwardPosition;
308}
309
310inline
311const double &
312TMDCWire::tension(void) const {
313 return _tension;
314}
315
316inline
317double *
318TMDCWire::backwardPosition(double p[3]) const {
319 p[0] = _backwardPosition.x();
320 p[1] = _backwardPosition.y();
321 p[2] = _backwardPosition.z();
322 return p;
323}
324
325inline
326const HepPoint3D &
328 return _xyPosition;
329}
330
331inline
332double *
333TMDCWire::xyPosition(double a[3]) const {
334 a[0] = _xyPosition.x();
335 a[1] = _xyPosition.y();
336 a[2] = 0.;
337 return a;
338}
339
340inline
341const HepVector3D &
343 return _direction;
344}
345
346inline
347bool
348TMDCWire::axial(void) const {
349 return _layer->axial();
350}
351
352inline
353bool
354TMDCWire::stereo(void) const {
355 return _layer->stereo();
356}
357
358inline
359unsigned
361 return _layer->axialStereoLayerId();
362}
363
364inline
365bool
367 if (_layerId < 14) return true;
368 return false;
369}
370
371inline
372bool
374 if (_layerId > 13) return true;
375 return false;
376}
377
378inline
379float
381 if (_layer) {
382 return _layer->cellSize();
383 }
384 else {
385#ifdef TRKRECO_DEBUG
386 std::cout << "TMDCWire::cellSize !!! can't return cell size";
387 std::cout << " because no pointer to a layer" << std::endl;
388#endif
389 return 0.;
390 }
391}
392
393inline
394bool
396 if (neighbor(2) == & w) return true;
397 else if (neighbor(3) == & w) return true;
398 return false;
399}
400
401inline
402bool
403TMDCWire::adjacent(const TMDCWire & w) const {
404 for (unsigned i = 0; i < 6; i++)
405 if (neighbor(i) == & w)
406 return true;
407 return false;
408}
409
410inline
411std::string
412TMDCWire::name(void) const {
413 if (axial())
414 return itostring(_layerId) + std::string("-") + itostring(_localId);
415 return itostring(_layerId) + std::string("=") + itostring(_localId);
416}
417
418#endif
419
420#undef inline
421
422#endif /* TMDCWire_FLAG_ */
423
HepGeom::Point3D< double > HepPoint3D
HepGeom::Vector3D< double > HepVector3D
A class to represent a wire layer.
unsigned superLayerId(void) const
returns super layer id.
float cellSize(void) const
returns cell size.
bool stereo(void) const
returns true if this is a stereo layer.
unsigned localLayerId(void) const
returns local layer id in a super layer.
unsigned axialStereoLayerId(void) const
returns id of axial or stereo id.
bool axial(void) const
returns true if this is an axial layer.
A class to represent a Track Finder Segment(TSF).
A class to represent a MC wire hit in MDC.
A class to represent a wire in MDC.
float cellSize(void) const
returns cell size in phi.
void clear(void)
clears information.
unsigned id(void) const
returns id.
bool adjacent(const TMDCWire &) const
returns true if a given wire is adjacent.
bool consective(const TMDCWire &) const
returns true if a given wire is consective in a layer.
bool axial(void) const
returns true if this wire is in an axial layer.
unsigned localLayerId(void) const
returns local layer id in a super layer.
const TMDCWireHit *const hit(void) const
returns a pointer to a TMDCWireHit.
const TMDCLayer *const layer(void) const
returns a pointer to a layer.
virtual ~TMDCWire()
Destructor.
Definition: TMDCWire.cxx:53
unsigned axialStereoLayerId(void) const
returns id of axial or stereo id.
bool innerPart(void) const
returns true if this wire is in the inner part.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
const HepVector3D & direction(void) const
returns direction vector of the wire.
const HepPoint3D & xyPosition(void) const
returns middle position of a wire. z componet is 0.
unsigned superLayerId(void) const
returns super layer id.
const TMDCWire *const neighbor(unsigned) const
returns a pointer to a neighbor wire.
Definition: TMDCWire.cxx:95
bool mainPart(void) const
returns true if this wire is in the main part.
int localIdForMinus(void) const
returns localId but if 0, return maxLocalId + 1.
Definition: TMDCWire.cxx:355
const HepPoint3D & forwardPosition(void) const
returns position in forward endplate.
int localIdDifference(const TMDCWire &) const
returns local id difference.
Definition: TMDCWire.cxx:577
const HepPoint3D & backwardPosition(void) const
returns position in backward endplate.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TMDCWire.cxx:57
const TMDCTsf *const tsf(void) const
returns a pointer to a TMDCTsf.
unsigned state(void) const
returns state.
const double & tension(void) const
const MdcGeoWire * geocdc(void) const
returns a pointer to GEOMDC_WIR.
bool stereo(void) const
returns true if this wire is in a stereo layer.
int localIdForPlus(void) const
returns localId but if maxLocalId, return -1.
Definition: TMDCWire.cxx:166
std::string name(void) const
returns name.
void wirePosition(float zPosition, HepPoint3D &xyPosition, HepPoint3D &backwardPosition, HepVector3D &direction) const
calculates position and direction vector with sag correction.
Definition: TMDCWire.cxx:541
int t()
Definition: t.c:1