BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/TrkReco/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 : [email protected]
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
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
63 public:
64 /// returns TMDC object.
65 static TMDC * getTMDC(const std::string & cdcVersion);
66 static TMDC * getTMDC(void);
67
68 private:
69 /// Constructor
70 TMDC(const std::string & cdcVersion);
71
72 public:// 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
91 public:// 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
107 public:// 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' is invalid.
112 const TMDCWire * const wire(unsigned layerId, int localId) const;
113
114 /// returns a pointer to a wire.
115 const TMDCWire * const wire(const HepPoint3D & point) const;
116
117 /// returns a pointer to a wire.
118 const TMDCWire * const wire(float r, float phi) const;
119
120 /// returns a pointer to a layer. 0 will be returned if 'id' is invalid.
121 const TMDCLayer * const layer(unsigned id) const;
122
123 /// returns a pointer to a super-layer. 0 will be returned if 'id' is invalid.
124 const AList<TMDCLayer> * const superLayer(unsigned id) const;
125
126 /// returns \# of wire layers in a super layer. 0 will be returned if 'superLayerId' is invalid.
127 unsigned nLocalLayer(unsigned superLayerId) const;
128
129 public:// Event by event information.
130 /// returns a list of TMDCWireHit. 'update()' must be called before calling this function.
131 const AList<TMDCWireHit> & hits(unsigned mask = 0) const;
132
133 /// returns a list of axial hits. 'update()' must be called before calling this function.
134 const AList<TMDCWireHit> & axialHits(unsigned mask = 0) const;
135
136 /// returns a list of stereo hits. 'update()' must be called before calling this function.
137 const AList<TMDCWireHit> & stereoHits(unsigned mask = 0) const;
138
139 /// returns a list of TMDCWireHitMC. 'updateMC()' must be called before calling this function.
140 const AList<TMDCWireHitMC> & hitsMC(void) const;
141
142 /// returns bad hits(finding invalid hits).
143 const AList<TMDCWireHit> & badHits(void);
144
145 public:// Utility functions
146 unsigned nWires(void) const;
147 unsigned nSuperLayers(void) const;
148 unsigned nLayers(void) const;
149
150 public:// Utility functions for panther tables
151 static std::string wireName(unsigned wireId);
152 // static std::string wireName(const geocdc_wire * const);
153 // static std::string wireName(const Geocdc_wire * const);
154 // static std::string wireName(const reccdc_wirhit &);
155 static std::string wireName(const MdcGeoWire * const);
156 static std::string wireName(const MdcRec_wirhit &);
157
158 static unsigned layerId(unsigned wireId);
159 // static unsigned layerId(const geocdc_wire * const);
160 // static unsigned layerId(const Geocdc_wire * const);
161 static unsigned layerId(const MdcGeoWire * const);
162
163 static unsigned localId(unsigned wireId);
164 // static unsigned localId(const geocdc_wire * const);
165 // static unsigned localId(const Geocdc_wire * const);
166 static unsigned localId(const MdcGeoWire * const);
167
168 static unsigned superLayerId(unsigned wireId);
169 // static unsigned superLayerId(const geocdc_wire * const);
170 // static unsigned superLayerId(const Geocdc_wire * const);
171 // static unsigned superLayerId(const geocdc_layer * const);
172 static unsigned superLayerId(const MdcGeoWire * const);
173 static unsigned superLayerId(const MdcGeoLayer * const);
174
175 static unsigned localLayerId(unsigned wireId);
176 // static unsigned localLayerId(const geocdc_wire * const);
177 // static unsigned localLayerId(const Geocdc_wire * const);
178 // static unsigned localLayerId(const geocdc_layer * const);
179 static unsigned localLayerId(const MdcGeoWire * const);
180 static unsigned localLayerId(const MdcGeoLayer * const);
181
182
183 // static unsigned axialStereoLayerId(const geocdc_layer * const);
184 static unsigned axialStereoLayerId(const MdcGeoLayer * const);
185 static unsigned layerId(unsigned axialStereo, unsigned axialStereoLayerId);
186
187 static float phi(float phi);
188
189 /// calculates corrected drift time. correctionFlag(bit 0:tof, 1:T0 offset, 2:propagation delay, 3:tan(lambda) correction)
190 static void driftDistance(TMLink & link,
191 const TTrack & track,
192 unsigned correctionFlag = 0,
193 float T0Offset = 0.);
194
195// private:
196 /// classify hits.
197 void classification(void);
198
199 /// updates TMDC information for MC.
200 void updateMC(void);
201
202 private:
203 static TMDC * _cdc;
204// MdcRecGeo* _geo;
205
206 int _debugLevel;
207
208 const std::string _cdcVersion;
209 const bool _newCdc;
210 const unsigned _nWires;
211 const unsigned _nSuperLayers;
212 const unsigned _nLayers;
213
214 float _fudgeFactor;
215 AList< AList<TMDCLayer> > _superLayers;
216 AList<TMDCLayer> _layers;
217 AList<TMDCWire> _wires;
218 AList<TMDCWire> _hitWires;
219 AList<TMDCWireHit> _hits;
220 AList<TMDCWireHit> _axialHits;
221 AList<TMDCWireHit> _stereoHits;
222 AList<TMDCWireHit> _badHits;
223 AList<TMDCWireHitMC> _hitsMC;
224};
225
226//-----------------------------------------------------------------------------
227
228#ifdef TMDC_NO_INLINE
229#define inline
230#else
231#undef inline
232#define TMDC_INLINE_DEFINE_HERE
233#endif
234
235#ifdef TMDC_INLINE_DEFINE_HERE
236
237inline
238int
239TMDC::debugLevel(void) const {
240 return _debugLevel;
241}
242
243inline
244int
246 return _debugLevel = a;
247}
248
249inline
250unsigned
251TMDC::nLocalLayer(unsigned superLayerId) const {
252 AList<TMDCLayer> * superLayer = _superLayers[superLayerId];
253 if (! superLayer) return 0;
254 return superLayer->length();
255}
256
257inline
258const TMDCLayer * const
259TMDC::layer(unsigned id) const {
260 return _layers[id];
261}
262
263inline
265TMDC::hitsMC(void) const {
266 return _hitsMC;
267}
268
269inline
270const AList<TMDCLayer> * const
271TMDC::superLayer(unsigned id) const {
272 return _superLayers[id];
273}
274
275inline
276const TMDCWire * const
277TMDC::wire(unsigned id) const {
278 return _wires[id];
279}
280
281inline
282float
283TMDC::phi(float a) {
284 static const float pi2 = 2. * M_PI;
285 a = std::fmod(a, pi2);
286 if (a < 0.) return a + pi2;
287 return a;
288}
289
290inline
291float
292TMDC::fudgeFactor(void) const {
293 return _fudgeFactor;
294}
295
296inline
297float
299 return _fudgeFactor = a;
300}
301
302inline
303std::string
304TMDC::cdcVersion(void) const {
305 return std::string(_cdcVersion);
306}
307
308inline
309unsigned
310TMDC::nWires(void) const {
311 return _nWires;
312}
313
314inline
315unsigned
317 return _nSuperLayers;
318}
319
320inline
321unsigned
322TMDC::nLayers(void) const {
323 return _nLayers;
324}
325
326#endif
327
328#undef inline
329
330#endif /* TMDC_FLAG_ */
HepGeom::Point3D< double > HepPoint3D
#define M_PI
Definition: TConstant.h:4
A class to represent a wire layer.
A class to represent a MC wire hit in MDC.
A class to represent a wire in MDC.
void fastClear(void)
clears TMDC information.
Definition: TMDC.cxx:298
static unsigned localId(unsigned wireId)
Definition: TMDC.cxx:676
float fudgeFactor(void) const
returns fudge factor for drift time error.
static unsigned axialStereoLayerId(const MdcGeoLayer *const)
Definition: TMDC.cxx:991
unsigned nLocalLayer(unsigned superLayerId) const
returns # of wire layers in a super layer. 0 will be returned if 'superLayerId' is invalid.
const TMDCWire *const wire(unsigned wireId) const
returns a pointer to a wire. 0 will be returned if 'wireId' is invalid.
void updateMC(void)
updates TMDC information for MC.
Definition: TMDC.cxx:376
static void driftDistance(TMLink &link, const TTrack &track, unsigned correctionFlag=0, float T0Offset=0.)
calculates corrected drift time. correctionFlag(bit 0:tof, 1:T0 offset, 2:propagation delay,...
Definition: TMDC.cxx:1029
std::string cdcVersion(void) const
returns MDC version.
static unsigned superLayerId(unsigned wireId)
Definition: TMDC.cxx:765
unsigned nLayers(void) const
std::string name(void) const
returns name.
Definition: TMDC.cxx:76
static unsigned layerId(unsigned wireId)
Definition: TMDC.cxx:598
const AList< TMDCWireHit > & hits(unsigned mask=0) const
returns a list of TMDCWireHit. 'update()' must be called before calling this function.
Definition: TMDC.cxx:534
static TMDC * getTMDC(void)
Definition: TMDC.cxx:95
const AList< TMDCWireHit > & axialHits(unsigned mask=0) const
returns a list of axial hits. 'update()' must be called before calling this function.
Definition: TMDC.cxx:518
unsigned nWires(void) const
const TMDCLayer *const layer(unsigned id) const
returns a pointer to a layer. 0 will be returned if 'id' is invalid.
static std::string wireName(unsigned wireId)
Definition: TMDC.cxx:575
std::string version(void) const
returns version.
Definition: TMDC.cxx:81
static float phi(float phi)
const AList< TMDCWireHit > & badHits(void)
returns bad hits(finding invalid hits).
Definition: TMDC.cxx:542
const AList< TMDCWireHit > & stereoHits(unsigned mask=0) const
returns a list of stereo hits. 'update()' must be called before calling this function.
Definition: TMDC.cxx:526
static unsigned localLayerId(unsigned wireId)
Definition: TMDC.cxx:833
void dump(const std::string &message) const
dumps debug information.
Definition: TMDC.cxx:181
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
returns a list of TMDCWireHitMC. 'updateMC()' must be called before calling this function.
void clear(void)
clears all TMDC information.
Definition: TMDC.cxx:282
unsigned nSuperLayers(void) const
void classification(void)
classify hits.
Definition: TMDC.cxx:445
A class to represent a track in tracking.
A class to handle update timing of static objects of tracking.
virtual void update(void)
updates an object.
Definition: TUpdater.cxx:37