BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkReco/include/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 : yoshihito.iwasaki@kek.jp
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// std::to_string
23// #include "CLHEP/String/Strings.h"
24
25// #define HEP_SHORT_NAMES
26#include "CLHEP/Geometry/Vector3D.h"
27#ifndef ENABLE_BACKWARDS_COMPATIBILITY
28typedef HepGeom::Vector3D<double> HepVector3D;
29#endif
30
31#ifndef CLHEP_POINT3D_H
32# include "CLHEP/Geometry/Point3D.h"
33#endif
34#ifndef ENABLE_BACKWARDS_COMPATIBILITY
35typedef HepGeom::Point3D<double> HepPoint3D;
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
57public:
58 /// Constructor.
60
61 /// Destructor
62 virtual ~TMDCWire();
63
64public: // 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.
141 HepVector3D& direction ) const;
142
143 /// returns cell size in phi.
144 float cellSize( void ) const;
145
146 /// returns local id difference.
147 int localIdDifference( const TMDCWire& ) const;
148
149 /// returns name.
150 std::string name( void ) const;
151
152 /// dumps debug information.
153 void dump( const std::string& message = std::string( "" ),
154 const std::string& prefix = std::string( "" ) ) const;
155
156public: // Modifiers
157 /// sets a pointer to TMDCWireHit.
158 const TMDCWireHit* const hit( const TMDCWireHit* const );
159
160 /// appends a pointer to TMDCWireHitMC.
161 const TMDCWireHitMC* const hit( TMDCWireHitMC* const );
162
163 /// sets a pointer of TMDCTsf.
165
166 /// sets state.
167 unsigned state( unsigned newState );
168
169 /// clears information.
170 void clear( void );
171
172private:
173 unsigned _state;
174 const TMDCWireHit* _hit;
175 AList<TMDCWireHitMC> _mcHits;
176
177 unsigned _id;
178 unsigned _localId;
179 unsigned _layerId;
180 const TMDCLayer* _layer;
181 TMDCTsf* _tsf;
182 HepPoint3D _xyPosition;
183 HepPoint3D _forwardPosition;
184 HepPoint3D _backwardPosition;
185 double _tension;
186 HepVector3D _direction;
187 const MdcGeoWire* _geo;
188
189 static TMDC* _cdc;
190};
191
192//-----------------------------------------------------------------------------
193
194#ifdef TMDCWire_NO_INLINE
195# define inline
196#else
197# undef inline
198# define TMDCWire_INLINE_DEFINE_HERE
199#endif
200
201#ifdef TMDCWire_INLINE_DEFINE_HERE
202
203inline unsigned TMDCWire::id( void ) const { return _id; }
204
205inline unsigned TMDCWire::localId( void ) const { return _localId; }
206
207inline unsigned TMDCWire::layerId( void ) const { return _layerId; }
208
209inline unsigned TMDCWire::superLayerId( void ) const { return _layer->superLayerId(); }
210
211inline unsigned TMDCWire::localLayerId( void ) const { return _layer->localLayerId(); }
212
213inline const MdcGeoWire* TMDCWire::geocdc( void ) const { return _geo; }
214
215inline const TMDCLayer* const TMDCWire::layer( void ) const { return _layer; }
216
217inline const TMDCTsf* const TMDCWire::tsf( void ) const { return _tsf; }
218
219inline TMDCTsf* TMDCWire::tsf( TMDCTsf* t ) { return _tsf = t; }
220
221inline unsigned TMDCWire::state( void ) const { return _state; }
222
223inline unsigned TMDCWire::state( unsigned a ) { return _state = a; }
224
225inline void TMDCWire::clear( void ) {
226 _state = 0;
227 _hit = 0;
228 _mcHits.removeAll();
229}
230
231inline const TMDCWireHit* const TMDCWire::hit( const TMDCWireHit* const h ) {
232 return _hit = h;
233}
234
235inline const TMDCWireHit* const TMDCWire::hit( void ) const { return _hit; }
236
237inline const TMDCWireHitMC* const TMDCWire::hit( TMDCWireHitMC* const a ) {
238 _mcHits.append( a );
239 return a;
240}
241
242inline const HepPoint3D& TMDCWire::forwardPosition( void ) const { return _forwardPosition; }
243
244inline const HepPoint3D& TMDCWire::backwardPosition( void ) const { return _backwardPosition; }
245
246inline const double& TMDCWire::tension( void ) const { return _tension; }
247
248inline double* TMDCWire::backwardPosition( double p[3] ) const {
249 p[0] = _backwardPosition.x();
250 p[1] = _backwardPosition.y();
251 p[2] = _backwardPosition.z();
252 return p;
253}
254
255inline const HepPoint3D& TMDCWire::xyPosition( void ) const { return _xyPosition; }
256
257inline double* TMDCWire::xyPosition( double a[3] ) const {
258 a[0] = _xyPosition.x();
259 a[1] = _xyPosition.y();
260 a[2] = 0.;
261 return a;
262}
263
264inline const HepVector3D& TMDCWire::direction( void ) const { return _direction; }
265
266inline bool TMDCWire::axial( void ) const { return _layer->axial(); }
267
268inline bool TMDCWire::stereo( void ) const { return _layer->stereo(); }
269
270inline unsigned TMDCWire::axialStereoLayerId( void ) const {
271 return _layer->axialStereoLayerId();
272}
273
274inline bool TMDCWire::innerPart( void ) const {
275 if ( _layerId < 14 ) return true;
276 return false;
277}
278
279inline bool TMDCWire::mainPart( void ) const {
280 if ( _layerId > 13 ) return true;
281 return false;
282}
283
284inline float TMDCWire::cellSize( void ) const {
285 if ( _layer ) { return _layer->cellSize(); }
286 else
287 {
288# ifdef TRKRECO_DEBUG
289 std::cout << "TMDCWire::cellSize !!! can't return cell size";
290 std::cout << " because no pointer to a layer" << std::endl;
291# endif
292 return 0.;
293 }
294}
295
296inline bool TMDCWire::consective( const TMDCWire& w ) const {
297 if ( neighbor( 2 ) == &w ) return true;
298 else if ( neighbor( 3 ) == &w ) return true;
299 return false;
300}
301
302inline bool TMDCWire::adjacent( const TMDCWire& w ) const {
303 for ( unsigned i = 0; i < 6; i++ )
304 if ( neighbor( i ) == &w ) return true;
305 return false;
306}
307
308inline std::string TMDCWire::name( void ) const {
309 if ( axial() )
310 return std::to_string( _layerId ) + std::string( "-" ) + std::to_string( _localId );
311 return std::to_string( _layerId ) + std::string( "=" ) + std::to_string( _localId );
312}
313
314#endif
315
316#undef inline
317
318#endif /* TMDCWire_FLAG_ */
HepGeom::Vector3D< double > HepVector3D
HepGeom::Point3D< double > HepPoint3D
double w
HepGeom::Point3D< double > HepPoint3D
HepGeom::Vector3D< double > HepVector3D
A class to represent a Track Finder Segment(TSF).
float cellSize(void) const
returns cell size in phi.
const HepPoint3D xyPosition(double z) const
void clear(void)
clears information.
unsigned id(void) const
returns id.
bool adjacent(const TMDCWire &) const
returns true if a given wire is adjacent.
unsigned state(unsigned newState)
sets state.
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 TMDCWireHitMC *const hit(TMDCWireHitMC *const)
appends a pointer to TMDCWireHitMC.
const TMDCLayer *const layer(void) const
returns a pointer to a layer.
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.
virtual ~TMDCWire()
Destructor.
double * xyPosition(double p[3]) const
TMDCTsf * tsf(TMDCTsf *)
sets a pointer of TMDCTsf.
double * backwardPosition(double p[3]) const
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.
TMDCWire(const MdcGeoWire *, TMDCLayer *)
Constructor.
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.
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.
const HepPoint3D & forwardPosition(void) const
returns position in forward endplate.
int localIdDifference(const TMDCWire &) const
returns local id difference.
const HepPoint3D & backwardPosition(void) const
returns position in backward endplate.
const TMDCWireHit *const hit(const TMDCWireHit *const)
sets a pointer to TMDCWireHit.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
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.
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.
int t()
Definition t.c:1