BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkReco/include/TrkReco/TMDC.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TMDC.h,v 1.9 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TMDC.h
5// Section : Tracking MDC
6// Owner : Yoshi Iwasaki
7// Email : yoshihito.iwasaki@kek.jp
8//-----------------------------------------------------------------------------
9// Description : A class to represent MDC.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef TMDC_FLAG_
14#define TMDC_FLAG_
15
16#ifdef TRKRECO_DEBUG_DETAIL
17# ifndef TRKRECO_DEBUG
18# define TRKRECO_DEBUG
19# endif
20#endif
21
22#include <cmath>
23#include <string>
24
25// #define HEP_SHORT_NAMES
26#include "CLHEP/Alist/AList.h"
27#include "TrkReco/TUpdater.h"
28
29#ifndef CLHEP_POINT3D_H
30# include "CLHEP/Geometry/Point3D.h"
31#endif
32#ifndef ENABLE_BACKWARDS_COMPATIBILITY
33typedef HepGeom::Point3D<double> HepPoint3D;
34#endif
35
36class TMDC;
37class TMDCWire;
38class TMDCLayer;
39class TMDCWireHit;
40class TMDCWireHitMC;
41// class Geocdc_wire;
42// struct geocdc_wire;
43// struct geocdc_layer;
44// struct reccdc_wirhit;
45class MdcRecGeo;
46class MdcGeoWire;
47class MdcGeoLayer;
48class MdcRec_wirhit;
49
50// class HepPoint3D;
51class TMLink;
52class TTrack;
53
54/** A class to represent MDC.
55
56 The instance of TMDC is a singleton. 'TMDC::getTMDC()' gives you a
57 pointer to access the TMDC. Geometrical information is initialized
58 automatically. Before accessing hit information, user has to call
59 'update()' to initialize hit information event by event. */
60
61class TMDC : private TUpdater {
62
63public:
64 /// returns TMDC object.
65 static TMDC* getTMDC( const std::string& cdcVersion );
66 static TMDC* getTMDC( void );
67
68private:
69 /// Constructor
70 TMDC( const std::string& cdcVersion );
71
72public: // Selectors
73 /// returns name.
74 std::string name( void ) const;
75
76 /// returns version.
77 std::string version( void ) const;
78
79 /// returns MDC version.
80 std::string cdcVersion( void ) const;
81
82 /// dumps debug information.
83 void dump( const std::string& message ) const;
84
85 /// returns debug level.
86 int debugLevel( void ) const;
87
88 /// returns fudge factor for drift time error.
89 float fudgeFactor( void ) const;
90
91public: // to access information
92 /// clears all TMDC information.
93 void clear( void );
94
95 /// clears TMDC information.
96 void fastClear( void );
97
98 /// updates TMDC information. clear() is called in this function.
99 void update( bool mcAnalysis = true );
100
101 /// sets debug level.
102 int debugLevel( int );
103
104 /// sets/returns fudge factor for drift time error.
105 float fudgeFactor( float );
106
107public: // Geometry
108 /// returns a pointer to a wire. 0 will be returned if 'wireId' is invalid.
109 const TMDCWire* const wire( unsigned wireId ) const;
110
111 /// returns a pointer to a wire. 'localId' can be negative. 0 will be returned if 'layerId'
112 /// is invalid.
113 const TMDCWire* const wire( unsigned layerId, int localId ) const;
114
115 /// returns a pointer to a wire.
116 const TMDCWire* const wire( const HepPoint3D& point ) const;
117
118 /// returns a pointer to a wire.
119 const TMDCWire* const wire( float r, float phi ) const;
120
121 /// returns a pointer to a layer. 0 will be returned if 'id' is invalid.
122 const TMDCLayer* const layer( unsigned id ) const;
123
124 /// returns a pointer to a super-layer. 0 will be returned if 'id' is invalid.
125 const AList<TMDCLayer>* const superLayer( unsigned id ) const;
126
127 /// returns \# of wire layers in a super layer. 0 will be returned if 'superLayerId' is
128 /// invalid.
129 unsigned nLocalLayer( unsigned superLayerId ) const;
130
131public: // Event by event information.
132 /// returns a list of TMDCWireHit. 'update()' must be called before calling this function.
133 const AList<TMDCWireHit>& hits( unsigned mask = 0 ) const;
134
135 /// returns a list of axial hits. 'update()' must be called before calling this function.
136 const AList<TMDCWireHit>& axialHits( unsigned mask = 0 ) const;
137
138 /// returns a list of stereo hits. 'update()' must be called before calling this function.
139 const AList<TMDCWireHit>& stereoHits( unsigned mask = 0 ) const;
140
141 /// returns a list of TMDCWireHitMC. 'updateMC()' must be called before calling this
142 /// function.
143 const AList<TMDCWireHitMC>& hitsMC( void ) const;
144
145 /// returns bad hits(finding invalid hits).
147
148public: // Utility functions
149 unsigned nWires( void ) const;
150 unsigned nSuperLayers( void ) const;
151 unsigned nLayers( void ) const;
152
153public: // Utility functions for panther tables
154 static std::string wireName( unsigned wireId );
155 // static std::string wireName(const geocdc_wire * const);
156 // static std::string wireName(const Geocdc_wire * const);
157 // static std::string wireName(const reccdc_wirhit &);
158 static std::string wireName( const MdcGeoWire* const );
159 static std::string wireName( const MdcRec_wirhit& );
160
161 static unsigned layerId( unsigned wireId );
162 // static unsigned layerId(const geocdc_wire * const);
163 // static unsigned layerId(const Geocdc_wire * const);
164 static unsigned layerId( const MdcGeoWire* const );
165
166 static unsigned localId( unsigned wireId );
167 // static unsigned localId(const geocdc_wire * const);
168 // static unsigned localId(const Geocdc_wire * const);
169 static unsigned localId( const MdcGeoWire* const );
170
171 static unsigned superLayerId( unsigned wireId );
172 // static unsigned superLayerId(const geocdc_wire * const);
173 // static unsigned superLayerId(const Geocdc_wire * const);
174 // static unsigned superLayerId(const geocdc_layer * const);
175 static unsigned superLayerId( const MdcGeoWire* const );
176 static unsigned superLayerId( const MdcGeoLayer* const );
177
178 static unsigned localLayerId( unsigned wireId );
179 // static unsigned localLayerId(const geocdc_wire * const);
180 // static unsigned localLayerId(const Geocdc_wire * const);
181 // static unsigned localLayerId(const geocdc_layer * const);
182 static unsigned localLayerId( const MdcGeoWire* const );
183 static unsigned localLayerId( const MdcGeoLayer* const );
184
185 // static unsigned axialStereoLayerId(const geocdc_layer * const);
186 static unsigned axialStereoLayerId( const MdcGeoLayer* const );
187 static unsigned layerId( unsigned axialStereo, unsigned axialStereoLayerId );
188
189 static float phi( float phi );
190
191 /// calculates corrected drift time. correctionFlag(bit 0:tof, 1:T0 offset, 2:propagation
192 /// delay, 3:tan(lambda) correction)
193 static void driftDistance( TMLink& link, const TTrack& track, unsigned correctionFlag = 0,
194 float T0Offset = 0. );
195
196 // private:
197 /// classify hits.
198 void classification( void );
199
200 /// updates TMDC information for MC.
201 void updateMC( void );
202
203private:
204 static TMDC* _cdc;
205 // MdcRecGeo* _geo;
206
207 int _debugLevel;
208
209 const std::string _cdcVersion;
210 const bool _newCdc;
211 const unsigned _nWires;
212 const unsigned _nSuperLayers;
213 const unsigned _nLayers;
214
215 float _fudgeFactor;
216 AList<AList<TMDCLayer>> _superLayers;
217 AList<TMDCLayer> _layers;
218 AList<TMDCWire> _wires;
219 AList<TMDCWire> _hitWires;
220 AList<TMDCWireHit> _hits;
221 AList<TMDCWireHit> _axialHits;
222 AList<TMDCWireHit> _stereoHits;
223 AList<TMDCWireHit> _badHits;
224 AList<TMDCWireHitMC> _hitsMC;
225};
226
227//-----------------------------------------------------------------------------
228
229#ifdef TMDC_NO_INLINE
230# define inline
231#else
232# undef inline
233# define TMDC_INLINE_DEFINE_HERE
234#endif
235
236#ifdef TMDC_INLINE_DEFINE_HERE
237
238inline int TMDC::debugLevel( void ) const { return _debugLevel; }
239
240inline int TMDC::debugLevel( int a ) { return _debugLevel = a; }
241
242inline unsigned TMDC::nLocalLayer( unsigned superLayerId ) const {
243 AList<TMDCLayer>* superLayer = _superLayers[superLayerId];
244 if ( !superLayer ) return 0;
245 return superLayer->length();
246}
247
248inline const TMDCLayer* const TMDC::layer( unsigned id ) const { return _layers[id]; }
249
250inline const AList<TMDCWireHitMC>& TMDC::hitsMC( void ) const { return _hitsMC; }
251
252inline const AList<TMDCLayer>* const TMDC::superLayer( unsigned id ) const {
253 return _superLayers[id];
254}
255
256inline const TMDCWire* const TMDC::wire( unsigned id ) const { return _wires[id]; }
257
258inline float TMDC::phi( float a ) {
259 static const float pi2 = 2. * M_PI;
260 a = std::fmod( a, pi2 );
261 if ( a < 0. ) return a + pi2;
262 return a;
263}
264
265inline float TMDC::fudgeFactor( void ) const { return _fudgeFactor; }
266
267inline float TMDC::fudgeFactor( float a ) { return _fudgeFactor = a; }
268
269inline std::string TMDC::cdcVersion( void ) const { return std::string( _cdcVersion ); }
270
271inline unsigned TMDC::nWires( void ) const { return _nWires; }
272
273inline unsigned TMDC::nSuperLayers( void ) const { return _nSuperLayers; }
274
275inline unsigned TMDC::nLayers( void ) const { return _nLayers; }
276
277#endif
278
279#undef inline
280
281#endif /* TMDC_FLAG_ */
HepGeom::Point3D< double > HepPoint3D
character *LEPTONflag integer iresonances real pi2
HepGeom::Point3D< double > HepPoint3D
#define M_PI
Definition TConstant.h:4
void fastClear(void)
clears TMDC information.
static unsigned localId(unsigned wireId)
Definition TMDC.cxx:632
void update(bool mcAnalysis=true)
updates TMDC information. clear() is called in this function.
float fudgeFactor(void) const
returns fudge factor for drift time error.
static std::string wireName(const MdcGeoWire *const)
static unsigned axialStereoLayerId(const MdcGeoLayer *const)
Definition TMDC.cxx:939
unsigned nLocalLayer(unsigned superLayerId) const
static unsigned localLayerId(unsigned wireId)
const TMDCWire *const wire(unsigned wireId) const
returns a pointer to a wire. 0 will be returned if 'wireId' is invalid.
static TMDC * getTMDC(const std::string &cdcVersion)
returns TMDC object.
void updateMC(void)
updates TMDC information for MC.
static std::string wireName(unsigned wireId)
const TMDCWire *const wire(const HepPoint3D &point) const
returns a pointer to a wire.
std::string cdcVersion(void) const
returns MDC version.
static unsigned superLayerId(unsigned wireId)
Definition TMDC.cxx:719
unsigned nLayers(void) const
static unsigned superLayerId(unsigned wireId)
std::string name(void) const
returns name.
static unsigned layerId(unsigned wireId)
Definition TMDC.cxx:556
static unsigned superLayerId(const MdcGeoWire *const)
static unsigned layerId(const MdcGeoWire *const)
const AList< TMDCWireHit > & hits(unsigned mask=0) const
returns a list of TMDCWireHit. 'update()' must be called before calling this function.
int debugLevel(int)
sets debug level.
static unsigned layerId(unsigned wireId)
const AList< TMDCWireHit > & axialHits(unsigned mask=0) const
returns a list of axial hits. 'update()' must be called before calling this function.
unsigned nWires(void) const
static float phi(float phi)
static unsigned axialStereoLayerId(const MdcGeoLayer *const)
const TMDCLayer *const layer(unsigned id) const
returns a pointer to a layer. 0 will be returned if 'id' is invalid.
static unsigned superLayerId(const MdcGeoLayer *const)
static unsigned localLayerId(const MdcGeoLayer *const)
std::string version(void) const
returns version.
const TMDCWire *const wire(float r, float phi) const
returns a pointer to a wire.
const AList< TMDCWireHit > & badHits(void)
returns bad hits(finding invalid hits).
static TMDC * getTMDC(void)
const AList< TMDCWireHit > & stereoHits(unsigned mask=0) const
returns a list of stereo hits. 'update()' must be called before calling this function.
static std::string wireName(const MdcRec_wirhit &)
void dump(const std::string &message) const
dumps debug information.
static unsigned localLayerId(const MdcGeoWire *const)
const TMDCWire *const wire(unsigned layerId, int localId) const
int debugLevel(void) const
returns debug level.
const AList< TMDCLayer > *const superLayer(unsigned id) const
returns a pointer to a super-layer. 0 will be returned if 'id' is invalid.
const AList< TMDCWireHitMC > & hitsMC(void) const
void clear(void)
clears all TMDC information.
unsigned nSuperLayers(void) const
static void driftDistance(TMLink &link, const TTrack &track, unsigned correctionFlag=0, float T0Offset=0.)
static unsigned layerId(unsigned axialStereo, unsigned axialStereoLayerId)
static unsigned localId(const MdcGeoWire *const)
float fudgeFactor(float)
sets/returns fudge factor for drift time error.
void classification(void)
classify hits.
static unsigned localId(unsigned wireId)
A class to represent a track in tracking.
A class to handle update timing of static objects of tracking.