BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcFastTrkAlg/MdcFastTrkAlg-00-04-09/MdcFastTrkAlg/FTSegment.h
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// Package: MdcFastTrkAlg
4// Module: FTSegment
5//
6// Description: segment class for MdcFastTrkAlg
7//
8
9#ifndef FTSegment_FLAG_
10#define FTSegment_FLAG_
11
12#include "MdcFastTrkAlg/FTList.h"
13#include "MdcFastTrkAlg/FTWire.h"
14#include "MdcFastTrkAlg/FTLayer.h"
15#include "MagneticField/IMagneticFieldSvc.h"
16#include "MagneticField/MagneticFieldSvc.h"
17#include <iostream>
18
19class FTFinder;
20class FTWire;
21class FTLayer;
22class FTSuperLayer;
23class FTTrack;
24class FTSegment{
25public:
26
27 /// constructors
29
30 /// destructors
32
33public: // public member functions
34 /// examine segment
35 int examine(void);
36
37#ifndef OnlineMode
38 /// printout of the wireHits info.
39 /// added by X.-R. Lu
40 void printout(void);
41#endif
42
43 /// update information for axial segment
44 void update(void);
45
46 /// update information for stereo segment
47 int update3D(const FTTrack * track);
48
49 /// link stereo segments by tanLambda
51
52 /// connect short segments
55
56 /// connect single hit
57 void connect_outer(const FTWire *);
58
59 /// connect single hit
60 void connect_inner(const FTWire *);
61
62public: // Selectors
63 /// returns wire-hit list
65
66 /// returns super-layer
67 FTSuperLayer & superLayer(void) const;
68
69 /// returns innerBoundHits
71
72 /// returns outerBoundHits
74
75 /// returns x of outgoing position
76 float outgoingX(void) const;
77
78 /// returns y of outgoing position
79 float outgoingY(void) const;
80
81 /// returns x of incoming position
82 float incomingX(void) const;
83
84 /// returns y of incoming position
85 float incomingY(void) const;
86
87 /// returns phi of incoming position
88 float incomingPhi(void) const;
89
90 /// returns phi of outgoing position
91 float outgoingPhi(void) const;
92
93 /// returns the sin(dphi)/MOD(r_out-r_in)
94 float attr_const(void) const;
95
96 /// returns track
97 FTTrack * track(void) const;
98
99 /// returns kappa(axial)
100 float kappa(void) const;
101
102 /// returns r from origin
103 float r(void) const;
104
105 /// returns s for matched 2D track
106 float s(void) const;
107
108 /// returns z for matched 2D track
109 float z(void) const;
110
111public: // Modifiers
112 /// set track
114 static MdcParameter * param;
115
116private: // private data members
117 IMagneticFieldSvc* m_pmgnIMF;
118 FTList<FTWire *>& _wireHits;
119 FTSuperLayer & _superLayer;
120 FTList<FTWire *> & _innerBoundHits;
121 FTList<FTWire *> & _outerBoundHits;
122 FTList<float> * _sList;
123 union{
124 float _kappa;
126 };
127 union{
128 FTTrack * _track;
130 };
131 float _r;
132 float _outgoing_x;
133 float _outgoing_y;
134 float _incoming_x;
135 float _incoming_y;
136};
137
138
139inline
141 : _wireHits(hits),
142 _superLayer(*super),
143 _innerBoundHits(*(new FTList<FTWire *>(3))),
144 _outerBoundHits(*(new FTList<FTWire *>(3))),
145 _sList(NULL),
146 _zList(NULL),
147 _track(NULL)
148{
149 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
150 if(scmgn!=StatusCode::SUCCESS) {
151 std::cout<< "Unable to open Magnetic field service"<<std::endl;
152 }
153}
154
155inline
157{
158 delete &_wireHits;
159 delete &_innerBoundHits;
160 delete &_outerBoundHits;
161 if (_sList){
162 delete _sList;
163 delete _zList;
164 delete _trackList;
165 }
166}
167
168inline
169void
171 const FTList<FTWire *> & outerBound)
172{
173 _wireHits.append(outerHits);
174 _outerBoundHits.clear();
175 _outerBoundHits.append(outerBound);
176}
177
178inline
179void
181 const FTList<FTWire *> & innerBound)
182{
183 _wireHits.append(innerHits);
184 _innerBoundHits.clear();
185 _innerBoundHits.append(innerBound);
186}
187
188inline
189void
191{
192 _wireHits.append((FTWire *)h);
193 _outerBoundHits.clear();
194 _outerBoundHits.append((FTWire *)h);
195}
196
197inline
198void
200{
201 _wireHits.append((FTWire *)h);
202 _innerBoundHits.clear();
203 _innerBoundHits.append((FTWire *)h);
204}
205
206inline
208FTSegment::superLayer(void) const
209{
210 return _superLayer;
211}
212
213inline
215FTSegment::wireHits(void) const
216{
217 return _wireHits;
218}
219
220inline
223{
224 return _innerBoundHits;
225}
226
227inline
230{
231 return _outerBoundHits;
232}
233
234inline
235float
236FTSegment::outgoingX(void) const
237{
238 return _outgoing_x;
239}
240
241inline
242float
243FTSegment::outgoingY(void) const
244{
245 return _outgoing_y;
246}
247
248inline
249float
250FTSegment::incomingX(void) const
251{
252 return _incoming_x;
253}
254
255inline
256float
257FTSegment::incomingY(void) const
258{
259 return _incoming_y;
260}
261
262inline
263float
264FTSegment::incomingPhi(void) const
265{
266 if (_innerBoundHits.length() ^ 1) {
267 float phi_1st = _innerBoundHits[0]->phi();
268 float phi_2nd = _innerBoundHits[1]->phi();
269 float phi = 0.5 * (phi_1st + phi_2nd);
270 if (fabs(phi_1st - phi_2nd) > M_PI) {
271 return (phi>M_PI) ? (phi-M_PI) : (phi+M_PI);
272 }
273 return phi;
274 }
275 return _innerBoundHits[0]->phi();
276}
277
278inline
279float
280FTSegment::outgoingPhi(void) const
281{
282 if (_outerBoundHits.length() ^ 1) {
283 float phi_1st = _outerBoundHits[0]->phi();
284 float phi_2nd = _outerBoundHits[1]->phi();
285 float phi = 0.5 * (phi_1st + phi_2nd);
286 if (fabs(phi_1st - phi_2nd) > M_PI) {
287 return (phi>M_PI) ? (phi-M_PI) : (phi+M_PI);
288 }
289 return phi;
290 }
291 return _outerBoundHits[0]->phi();
292}
293
294inline
295float
296FTSegment::attr_const(void) const
297{
298 float x_len = _outgoing_x - _incoming_x;
299 float y_len = _outgoing_y - _incoming_y;
300 float phi_l = outgoingPhi() - incomingPhi();
301 return sin(phi_l) / sqrt(x_len*x_len + y_len*y_len);
302}
303
304inline
305float
306FTSegment::r(void) const
307{
308 return _r;
309}
310
311inline
312float
313FTSegment::kappa(void) const
314{
315 return _kappa;
316}
317
318inline
319float
320FTSegment::s(void) const
321{
322 return _sList->first();
323}
324
325inline
326float
327FTSegment::z(void) const
328{
329 return _zList->first();
330}
331
332inline
333FTTrack *
334FTSegment::track(void) const
335{
336 return _track;
337}
338
339inline
340FTTrack *
342{
343 return _track = src;
344}
345
346
347#endif /* FTSegment_FLAG_ */
348
double sin(const BesAngle a)
#define M_PI
Definition: TConstant.h:4
T & first(void) const
returns the first object in the list
void clear(void)
clear lists but the allocated memory remains same
int length(void) const
returns the length of the list
int append(const T &x)
append an object into the end of the list
float incomingPhi(void) const
returns phi of incoming position
FTSuperLayer & superLayer(void) const
returns super-layer
void printout(void)
float outgoingY(void) const
returns y of outgoing position
~FTSegment()
destructors
float outgoingPhi(void) const
returns phi of outgoing position
void connect_outer(const FTWire *)
connect single hit
float attr_const(void) const
returns the sin(dphi)/MOD(r_out-r_in)
FTList< FTWire * > & innerBoundHits(void) const
returns innerBoundHits
float s(void) const
returns s for matched 2D track
float z(void) const
returns z for matched 2D track
float incomingY(void) const
returns y of incoming position
void connect_inner(const FTWire *)
connect single hit
void update(void)
update information for axial segment
FTList< FTWire * > & wireHits(void) const
returns wire-hit list
void connect_inner(const FTList< FTWire * > &, const FTList< FTWire * > &)
FTSegment(FTSuperLayer *super, FTList< FTWire * > &hits)
constructors
void linkStereoSegments(void)
link stereo segments by tanLambda
FTTrack * track(FTTrack *)
set track
float outgoingX(void) const
returns x of outgoing position
float kappa(void) const
returns kappa(axial)
float r(void) const
returns r from origin
void connect_outer(const FTList< FTWire * > &, const FTList< FTWire * > &)
connect short segments
FTList< FTWire * > & outerBoundHits(void) const
returns outerBoundHits
int update3D(const FTTrack *track)
update information for stereo segment
float incomingX(void) const
returns x of incoming position
int examine(void)
examine segment