BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Muc/MucRecEvent/include/MucRecEvent/RecMucTrack.h
Go to the documentation of this file.
1//$id$
2//
3//$log$
4
5/*
6 * 2004/03/08 Zhengyun You Peking University
7 *
8 * 2004/09/12 Zhengyun You Peking University
9 * transplanted to Gaudi framework
10 */
11
12#ifndef REC_MUC_TRACK_H
13#define REC_MUC_TRACK_H
14
15#include "DstEvent/DstMucTrack.h"
16#include "EventModel/EventModel.h"
17#include "ExtEvent/RecExtTrack.h"
18#include "GaudiKernel/ContainedObject.h"
19#include "GaudiKernel/ObjectVector.h"
20#include "GaudiKernel/SmartRef.h"
21#include "Identifier/Identifier.h"
22
23#include "MucRecEvent/MucRecHit.h"
24
25/**
26 * Describes a track found in the muon chamber.
27 *
28 * A track is originated from a track reconstructed in MDC, and has its
29 * intersection and direction on MUC start surface, which is extrapolated
30 * from MDC track. Methods include projecting along the trajectory to each
31 * gap, including hits in search window, modifing intersectins, and then
32 * projecting the trajectory to the next gap.
33 *
34 * @author Zhengyun You \URL{mailto:youzy@hep.pku.cn}
35 *
36 */
37
38extern const CLID& CLID_RecMucTrack;
39
40class RecMucTrack : public DstMucTrack {
41public:
42 virtual const CLID& clID() const { return RecMucTrack::classID(); }
43
44 static const CLID& classID() { return CLID_RecMucTrack; }
45
46 /// Constructor.
48
49 /// Assignment constructor.
51
52 /// Copy constructor.
53 RecMucTrack( const RecMucTrack& source );
54
55 /// Assignment constructor from DstMucTrack.
56 RecMucTrack& operator=( const DstMucTrack& dstTrack );
57
58 /// Copy constructor from DstMucTrack.
59 RecMucTrack( const DstMucTrack& dstTrack );
60
61 /// Destructor.
63
64 void SetDefault();
65
66 /// set the index for this track.
67 void setTrackId( const int trackId );
68
69 /// set start position of the track in Mdc.
70 void SetMdcPos( const float x, const float y, const float z );
71
72 /// set start moment of the track in Mdc.
73 void SetMdcMomentum( const float px, const float py, const float pz );
74
75 /// set start position of ext track in Muc. (compute from MdcPos MdcMomentum or get from
76 /// ExtTrack)
77 void SetExtMucPos( const float x, const float y, const float z );
78
79 /// set start moment of ext track in Muc.
80 void SetExtMucMomentum( const float px, const float py, const float pz );
81
82 /// set start position of the track in Muc. (after line fit and correction)
83 void SetMucPos( const float x, const float y, const float z );
84
85 void SetMucPosSigma( const float sigmax, const float sigmay, const float sigmaz );
86
87 /// set start moment of the track in Muc.
88 void SetMucMomentum( const float px, const float py, const float pz );
89
90 /// set current position of the trajectory.
91 void SetCurrentPos( const float x, const float y, const float z );
92
93 /// set current direction of the trajectory.
94 void SetCurrentDir( const float x, const float y, const float z );
95
96 /// set current intersection of the trajectory with strip plane.
97 void SetCurrentInsct( const float x, const float y, const float z );
98
99 /// set Ext track point.
100 void SetExtTrack( RecExtTrack* extTrack );
101
102 /// set Ext track id. for compute from mdc myself
103 void SetExtTrackID( int id ) { m_ExtTrackID = id; }
104
105 /// compute ext track myself from mdc.
106 void GetMdcExtTrack( Hep3Vector mdcStartPos, Hep3Vector mdcStartMomentum, int charge,
107 Hep3Vector& mucStartPos, Hep3Vector& mucStartMomentum );
108
109 bool IsInsideSuperConductor( Hep3Vector pos );
110
111 /// set corresponding monte carlo track pointer.
112 // void SetMCTrack(const BesPersTrack* mcTrack);
113
114 /// Attach the given hit to this track.
115 void AttachHit( MucRecHit* hit );
116
117 /// Where does the trajectory of this track intersect a specific gap?
118 void Project( const int& part, const int& gap, float& x, float& y, float& z, int& seg );
119
120 /// Calculate the distance of the hit to the intersection in read direction.
121 float GetHitDistance( const MucRecHit* hit );
122
123 /// no abs value
124 float GetHitDistance2( const MucRecHit* hit );
125
126 /// Calculate intersection from all hits attached on this gap.
127 Hep3Vector CalculateInsct( const int part, const int seg, const int gap );
128
129 /// Attach the intersection to this trajectory.
130 void AttachInsct( Hep3Vector insct );
131
132 /// Attach the direction to this trajectory.
133 void AttachDirection( Hep3Vector dir );
134
135 /// Correct direction of this trajectory.
137
138 /// Correct current position of this trajectory.
140
141 /// Where does the trajectory of this track intersect the reference plane?
142 // void ProjectToReference(float& x, float& y, float& z);
143
144 /// Where does the trajectory of this track intersect a z=const plane?
145 // void ProjectToZ(float& x, float& y, float& zplane);
146
147 /// Transform the Phi, ZR cord. to ZX, ZY cord.
148 // void TransformPhiRToXY(const float& vk, const float& vr,
149 // const float& k0, const float& r0,
150 // float& vx, float& vy,
151 // float& x0, float& y0) const;
152
153 /// The identifier of the Ext track as seed.
154 int getExtTrackID() const { return m_ExtTrackID; }
155
156 /// start position of the Ext track in Muc.
157 Hep3Vector getExtMucPos() const { return m_ExtMucPos / 10; }
158
159 /// Start momentum of the Ext track in Muc.
160 Hep3Vector getExtMucMomentum() const { return m_ExtMucMomentum / 1000; }
161
162 /// start position of this track in Muc.
163 Hep3Vector getMucPos() const { return m_MucPos / 10; }
164
165 Hep3Vector getMucPosSigma() const { return m_MucPosSigma / 10; }
166
167 /// Start momentum of this track in Muc.
168 Hep3Vector getMucMomentum() const { return m_MucMomentum / 1000; }
169
170 /// momentum of this track in Mdc
171 Hep3Vector getMdcMomentum() const { return m_MdcMomentum / 1000; }
172
173 /// Current position.
174 Hep3Vector GetCurrentPos() const { return m_CurrentPos / 10; }
175
176 /// Current direction.
177 Hep3Vector GetCurrentDir() const { return m_CurrentDir / 1000; }
178
179 /// Current intersection.
180 Hep3Vector GetCurrentInsct() const { return m_CurrentInsct; } // internal
181
182 /// Comute last gap in barrel and endcap.
184
185 /// Which gap on Barrel is the first one with hits attached to this track?
186 int brFirstLayer() const { return m_brFirstLayer; }
187
188 /// Which gap on EndCap is the first one with hits attached to this track?
189 int ecFirstLayer() const { return m_ecFirstLayer; }
190
191 /// Line fit with hits on a seg with max hits.
192 void LineFit( int fittingMethod );
193
194 /// chi2 of line fit
195 // float GetChi2() const { return m_Chi2; }
196
197 /// degree of freedom in line fit
198 // float GetDof() const { return m_Dof; }
199
200 /// rms of distance from hit to track
201 // float GetRms() const { return m_Rms; }
202
203 /// Compute depth.
205
206 /// Compute depth.
207 void ComputeDepth( int method );
208
209 /// Compute distance match //2006.11.08
211
212 /// Extend mucpos and extmucpos to first layer of muc
213 void Extend();
214
215 /// Length of the track penetrating in iron absorber.
216 float GetDepth3() const { return m_depth_3 / 10; }
217
218 void SetRecMode( int recmode ) { m_recmode = recmode; }
219
220 int GetRecMode() const { return m_recmode; }
221
222 /// Distance match of the ext track with muc track in first layer
223 Hep3Vector GetExtMucDistance() const { return m_Dist_muc_ext; }
224
225 Hep3Vector GetMucStripPos() const { return m_StripPhi; }
226
227 /// ComputeNGapsWithHits;
229
230 /// How many gaps provide hits attached to this track?
231 int GetNGapsWithHits() const { return m_numLayers; }
232
233 /// How many hits in all does this track contain?
234 int GetTotalHits() const;
235
236 /// How many hits per gap does this track contain?
237 int GetHitInGap( const int part, const int gap ) const;
238
239 /// How many hits does a segment contains.
240 int GetHitInSeg( const int part, const int seg ) const;
241
242 /// How many hits does a segment contains in one orient.
243 int GetHitInSegOrient( const int part, const int seg, const int orient ) const;
244
245 /// Find the segment which contains most hits, return max hits number.
246 int FindSegWithMaxHits( int& part, int& seg );
247
248 /// ComputeMaxHitsInGap;
250
251 /// How many hits were attached in the gap with the most attached hits?
252 // int GetMaxHitsInGap() const { return m_MaxHitsInLayer; }
253
254 /// Does this track contains an assigned hit?
255 bool HasHit( const int part, const int seg, const int gap, const int strip ) const;
256
257 /// Does this track contain any hits in the given gap?
258 bool HasHitInGap( const int part, const int gap ) const;
259
260 /// How many hits do two tracks share?
261 int GetNSharedHits( const RecMucTrack* track ) const;
262
263 /// Get a pointer to the first hit attached in a particular gap.
264 MucRecHit* GetHit( const int part, const int gap ) const;
265
266 /// Get all hits on this track
267 vector<MucRecHit*> GetHits() const;
268
269 vector<int> getVecHits() const { return m_vecHits; }
270
271 vector<MucRecHit*> GetExpectedHits() const;
272
273 vector<int> getExpHits() const { return m_expHits; }
274
275 vector<float> getDistHits() const { return m_distHits; }
276
277 vector<float> getQuadDistHits() const { return m_distHits_quad; }
278
279 vector<float> getExtDistHits() const { return m_distHits_ext; }
280
281 /// Get indices of all hits in the track.
282 vector<long> GetHitIndices() const;
283
284 /// Get corresponding monte carlo track pointer.
285 // BesPersTrack* GetMCTrack() const { return m_MCTrack; }
286
287 /// Compute all infomation of this track;
288 void ComputeTrackInfo( int fittingmethod );
289
290 /// Print Hits Infomation.
291 void PrintHitsInfo() const;
292
293 /// change unit
295
296 /// reload setVecHits
297 void setVecHits( vector<MucRecHit*>& pHits );
298
299 void setExpHits( vector<MucRecHit*>& pHits );
300
301 void setVecHits( vector<int>& vechits ) { m_vecHits = vechits; }
302
303 void setExpHits( vector<int>& exphits ) { m_expHits = exphits; }
304
305 void setDistHits( vector<float>& disthits ) { m_distHits = disthits; }
306
307 void setQuadDistHits( vector<float>& disthits ) { m_distHits_quad = disthits; }
308
309 void setExtDistHits( vector<float>& disthits ) { m_distHits_ext = disthits; }
310
311 void pushExtDistHits( float dist ) { m_distHits_ext.push_back( dist ); }
312
313private:
314 int m_ExtTrackID; // identifier of the Ext track used as seed of this track
315 RecExtTrack* m_ExtTrack; // pointer to the Ext track as seed of this track
316
317 Hep3Vector m_MdcPos; // Start position of the ext track in Mdc
318 Hep3Vector m_MdcMomentum; // Start Momentum of the ext track in Mdc
319
320 Hep3Vector m_ExtMucPos; // position of the ext track in Muc
321 Hep3Vector m_ExtMucMomentum; // Momentum of the ext track in Muc
322
323 Hep3Vector m_MucPos; // Start position of the track in Muc
324 Hep3Vector m_MucMomentum; // Start Momentum of the track in Muc
325 Hep3Vector m_MucPosSigma;
326
327 Hep3Vector m_CurrentPos; // track current position
328 Hep3Vector m_CurrentDir; // track current direction
329 Hep3Vector m_CurrentInsct; // track current intersection
330 Hep3Vector m_Dist_muc_ext;
331 Hep3Vector m_StripPhi; // use to calc phi of strip in first layer
332
333 int m_brFirstLayer; // first gap of the track in barrel. 20070604
334 int m_ecFirstLayer; // first gap of the track in endcap. 20070604
335 int m_ecPart; // whic part of endcap
336
337 float m_depth_3; // compare with m_depth
338 int m_recmode; // 0: mdc ext; 1: emc ext
339 int m_Good3DLine;
340 int m_Good3DPart;
341 bool m_changeUnit;
342 Hep3Vector m_IntersectionInner[9]; // intersection of this track with inner surface this gap
343 Hep3Vector m_IntersectionOuter[9]; // intersection of this track with outer surface this gap
344
345 // BesPersTrack *m_MCTrack; // Pointer to monte carlo track
346 vector<int> m_vecHits;
347 vector<int> m_expHits;
348 vector<float> m_distHits;
349 vector<float> m_distHits_quad;
350 vector<float> m_distHits_ext;
351 vector<MucRecHit*> m_pHits; // Pointers to attached hits
352 vector<MucRecHit*> m_pExpectedHits; // Pointers to expected hits
353 vector<Hep3Vector> m_Intersections; // Container of intersection points
354 vector<Hep3Vector> m_Directions; // Container of track direction on intersection points
355};
356
357typedef ObjectVector<RecMucTrack> RecMucTrackCol;
358
359#endif /* MUC_TRACK_H */
const CLID & CLID_RecMucTrack
const CLID & CLID_RecMucTrack
int GetTotalHits() const
How many hits in all does this track contain?
void LineFit(int fittingMethod)
Line fit with hits on a seg with max hits.
void CorrectPos()
Correct current position of this trajectory.
void PrintHitsInfo() const
Print Hits Infomation.
void CorrectDir()
Correct direction of this trajectory.
void ComputeTrackInfo(int fittingmethod)
Get corresponding monte carlo track pointer.
int GetNGapsWithHits() const
How many gaps provide hits attached to this track?
void SetDefault()
void setDistHits(vector< float > &disthits)
void SetMdcMomentum(const float px, const float py, const float pz)
set start moment of the track in Mdc.
void setExpHits(vector< MucRecHit * > &pHits)
void SetMucPosSigma(const float sigmax, const float sigmay, const float sigmaz)
MucRecHit * GetHit(const int part, const int gap) const
Get a pointer to the first hit attached in a particular gap.
Hep3Vector getMucPos() const
start position of this track in Muc.
bool IsInsideSuperConductor(Hep3Vector pos)
int GetHitInSeg(const int part, const int seg) const
How many hits does a segment contains.
~RecMucTrack()
Destructor.
void AttachInsct(Hep3Vector insct)
Attach the intersection to this trajectory.
int brFirstLayer() const
Which gap on Barrel is the first one with hits attached to this track?
void SetExtMucPos(const float x, const float y, const float z)
Hep3Vector getExtMucMomentum() const
Start momentum of the Ext track in Muc.
int GetNSharedHits(const RecMucTrack *track) const
How many hits do two tracks share?
void ComputeNGapsWithHits()
ComputeNGapsWithHits;.
void SetExtTrackID(int id)
set Ext track id. for compute from mdc myself
void SetMdcPos(const float x, const float y, const float z)
set start position of the track in Mdc.
void SetCurrentDir(const float x, const float y, const float z)
set current direction of the trajectory.
void ComputeDepth()
chi2 of line fit
float GetHitDistance(const MucRecHit *hit)
Calculate the distance of the hit to the intersection in read direction.
void SetExtTrack(RecExtTrack *extTrack)
set Ext track point.
RecMucTrack(const DstMucTrack &dstTrack)
Copy constructor from DstMucTrack.
void setTrackId(const int trackId)
set the index for this track.
bool HasHit(const int part, const int seg, const int gap, const int strip) const
How many hits were attached in the gap with the most attached hits?
Hep3Vector GetExtMucDistance() const
Distance match of the ext track with muc track in first layer.
void GetMdcExtTrack(Hep3Vector mdcStartPos, Hep3Vector mdcStartMomentum, int charge, Hep3Vector &mucStartPos, Hep3Vector &mucStartMomentum)
compute ext track myself from mdc.
void ComputeMaxHitsInGap()
ComputeMaxHitsInGap;.
void ComputeDepth(int method)
Compute depth.
Hep3Vector GetCurrentDir() const
Current direction.
int GetHitInGap(const int part, const int gap) const
How many hits per gap does this track contain?
int FindSegWithMaxHits(int &part, int &seg)
Find the segment which contains most hits, return max hits number.
Hep3Vector getMdcMomentum() const
momentum of this track in Mdc
Hep3Vector CalculateInsct(const int part, const int seg, const int gap)
Calculate intersection from all hits attached on this gap.
void Project(const int &part, const int &gap, float &x, float &y, float &z, int &seg)
Where does the trajectory of this track intersect a specific gap?
RecMucTrack & operator=(const DstMucTrack &dstTrack)
Assignment constructor from DstMucTrack.
void SetMucMomentum(const float px, const float py, const float pz)
set start moment of the track in Muc.
void setVecHits(vector< MucRecHit * > &pHits)
reload setVecHits
Hep3Vector GetCurrentInsct() const
Current intersection.
vector< long > GetHitIndices() const
Get indices of all hits in the track.
RecMucTrack(const RecMucTrack &source)
Copy constructor.
int GetHitInSegOrient(const int part, const int seg, const int orient) const
How many hits does a segment contains in one orient.
void SetExtMucMomentum(const float px, const float py, const float pz)
set start moment of ext track in Muc.
int getExtTrackID() const
Where does the trajectory of this track intersect the reference plane?
RecMucTrack & operator=(const RecMucTrack &orig)
Assignment constructor.
vector< MucRecHit * > GetHits() const
Get all hits on this track.
void AttachHit(MucRecHit *hit)
set corresponding monte carlo track pointer.
Hep3Vector GetCurrentPos() const
Current position.
void SetCurrentInsct(const float x, const float y, const float z)
set current intersection of the trajectory with strip plane.
void ComputeDistanceMatch()
Compute distance match //2006.11.08.
void OutputUnitChange()
change unit
void setExtDistHits(vector< float > &disthits)
Hep3Vector getMucMomentum() const
Start momentum of this track in Muc.
void SetCurrentPos(const float x, const float y, const float z)
set current position of the trajectory.
vector< MucRecHit * > GetExpectedHits() const
int ecFirstLayer() const
Which gap on EndCap is the first one with hits attached to this track?
Hep3Vector getExtMucPos() const
start position of the Ext track in Muc.
float GetDepth3() const
Length of the track penetrating in iron absorber.
void SetMucPos(const float x, const float y, const float z)
set start position of the track in Muc. (after line fit and correction)
float GetHitDistance2(const MucRecHit *hit)
no abs value
void Extend()
Extend mucpos and extmucpos to first layer of muc.
bool HasHitInGap(const int part, const int gap) const
Does this track contain any hits in the given gap?
void ComputeLastGap()
Comute last gap in barrel and endcap.
RecMucTrack()
Constructor.
void setQuadDistHits(vector< float > &disthits)
void AttachDirection(Hep3Vector dir)
Attach the direction to this trajectory.