BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
TRunge.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TRunge.h,v 1.28 2012/05/28 05:16:29 maoh Exp $
3//-----------------------------------------------------------------------------
4// Filename : TRunge.h
5// Section : Tracking
6// Owner : Kenji Inami
7// Email : [email protected]
8//-----------------------------------------------------------------------------
9// Description : A class to represent a track using Runge Kutta method
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13//#ifdef TRKRECO_DEBUG_DETAIL
14//#define TRKRECO_DEBUG
15//#endif
16#ifndef TRUNGE_FLAG_
17#define TRUNGE_FLAG_
18
19#define Runge 64
20// This must be writen in TTrackBase.h
21
22#define HEP_SHORT_NAMES
23#ifndef CLHEP_POINT3D_H
24#include "CLHEP/Geometry/Point3D.h"
25#endif
26#ifndef ENABLE_BACKWARDS_COMPATIBILITY
28#endif
29
30#ifndef CLHEP_VECTOR3D_H
31#include "CLHEP/Geometry/Vector3D.h"
32#endif
33#ifndef ENABLE_BACKWARDS_COMPATIBILITY
35#endif
36typedef HepGeom::Transform3D HepTransform3D;
37//#include "helix/Helix.h"
38//#include "coil/Bfield.h"
39//#include "TrkReco/Helix.h"
40#include "TrackUtil/Helix.h"
41#include "TrkReco/Bfield.h"
42#include "TrkReco/TTrackBase.h"
43#include "TrkReco/TRunge.h"
44
45#include "GaudiKernel/IInterface.h"
46#include "GaudiKernel/Kernel.h"
47#include "GaudiKernel/Service.h"
50
51#include "CLHEP/Matrix/Vector.h"
52#include "CLHEP/Matrix/SymMatrix.h"
53#include "CLHEP/Vector/ThreeVector.h"
54#include "CLHEP/Vector/LorentzVector.h"
55#include "CLHEP/Geometry/Point3D.h"
58#include "CLHEP/Geometry/Transform3D.h"
59class TRungeFitter;
60class TTrack;
61class TMLink;
62
63#define TRunge_MAXstep 10000
64/// A class to represent a track in tracking.
65class TRunge : public TTrackBase {
66
67public:
68 /// Constructors
69 TRunge();
70 TRunge(const TTrack&);
71 TRunge(const Helix&);
72 TRunge(const TRunge&);
73 TRunge(const RecMdcTrack&);
74 /// Destructor
75 ~TRunge();
76
77public:// General information
78 /// returns object type
79 unsigned objectType(void) const;
80
81public:// Extractors
82 /// Track parameters (at pivot)
83 double dr(void) const;
84 double phi0(void) const;
85 double kappa(void) const;
86 double dz(void) const;
87 double tanl(void) const;
88
89 /// pivot position
90 const HepPoint3D& pivot(void) const;
91
92 /// returns helix parameter
93 const Vector& a(void) const;
94
95 /// returns error matrix
96 const SymMatrix& Ea(void) const;
97
98 /// returns helix class
99 Helix helix(void) const;
100
101
102 /// returns NDF
103 unsigned ndf(void) const;
104
105 /// returns chi2.
106 double chi2(void) const;
107
108 /// returns reduced-chi2
109 double reducedchi2(void) const;
110
111 /// returns B field ID
112 int BfieldID(void) const;
113
114 /// returns step size
115 double StepSize(void) const;
116
117 /// return error parameters for fitting with step size control
118 const double* Yscal(void) const;
119 double Eps(void) const;
120 double StepSizeMax(void) const;
121 double StepSizeMin(void) const;
122
123
124 /// return mass
125 float Mass(void) const;
126
127 /// return max flight length
128 double MaxFlightLength(void) const;
129
130public:// Executors
131
132public:// Utilities
133 /// calculates the closest approach to a wire in real space.
134 /// Results are stored in TMLink. Return value is negative if error happened.
135 int approach(TMLink &, const RkFitMaterial ,bool sagCorrection = true ) ;
136 int approach(TMLink &, float& tof, HepVector3D& p,
137 const RkFitMaterial ,bool sagCorrection = true ) ;
138
139 /// caluculate closest points between a line and this track
140 int approach_line(TMLink &,const HepPoint3D&,const HepVector3D&,
141 HepPoint3D& onLine,HepPoint3D& onTrack,const RkFitMaterial material) ;
142 int approach_line(TMLink &,const HepPoint3D&,const HepVector3D&,
143 HepPoint3D& onLine,HepPoint3D& onTrack,
144 float& tof, HepVector3D& p,const RkFitMaterial material) ;
145 int approach_line(TMLink &,const HepPoint3D&,const HepVector3D&,
146 HepPoint3D& onLine,HepPoint3D& onTrack,
147 float& tof, HepVector3D& p, const RkFitMaterial material,unsigned& stepNum) ;
148
149 /// caluculate closest point between a point and this track
150 int approach_point(TMLink &,const HepPoint3D&,HepPoint3D& onTrack,const RkFitMaterial material) const;
151
152public:// Modifiers
153 /// set new pivot
154 const HepPoint3D& pivot(const HepPoint3D&);
155
156 /// set helix parameter
157 const Vector& a(const Vector&);
158
159 /// set helix error matrix
160 const SymMatrix& Ea(const SymMatrix&);
161
162 /// set B field map ID
163 int BfieldID(int);
164
165 /// set step size to calc. trajectory
166 double StepSize(double);
167
168 /// set error parameters for fitting with step size control
169 const double* Yscal(const double*);
170 double Eps(double);
171 double StepSizeMax(double);
172 double StepSizeMin(double);
173
174 /// set mass for tof calc.
175 float Mass(float);
176
177 // set max flight length
178 double MaxFlightLength(double);
179
180 double DisToWire(TMLink& ,double,HepPoint3D ,HepPoint3D&);
181 double dEpath(double , double , double)const;
182 void eloss(double path, const RkFitMaterial * material,double mass,double y[6],int index)const;
183
184public:// utilities for local use
185 /// make the trajectory in cache, return the number of step
186 unsigned Fly(const RkFitMaterial material) const;
187 unsigned Fly_SC(void) const; //fly with stepsize control
188 double intersect_cylinder(double r) const;
189 double intersect_yz_plane(const HepTransform3D& plane, double x) const;
190 double intersect_zx_plane(const HepTransform3D& plane, double y) const;
191 double intersect_xy_plane(double z) const;
192 /// propagate the track using 4th-order Runge-Kutta method
193 void Propagate(double y[6],const double& step,const RkFitMaterial material) const;
194 void Function(const double y[6],double f[6]) const;
195 // for propagate with quality check
196 void Propagate1(const double y[6], const double dydx[6],
197 const double& step, double yout[6]) const;
198 void Propagate_QC(double y[6],double dydx[6],const double& steptry,
199 const double& eps, const double yscal[6],
200 double& stepdid, double& stepnext) const;
201
202 /// set first point (position, momentum) s=0, phi=0
203 void SetFirst(double y[6]) const;
204 /// access to trajectory cache
205 unsigned Nstep(void) const;
206 int GetXP(unsigned stepNum,double y[6]) const;
207 // y[6] = (x,y,z,px,py,pz) output: error=-1
208 int GetStep(unsigned stepNum,double& step) const;
209
210 /// set flight length using wire hits
211 double SetFlightLength(void);
212
213private:
214 // track parameters updated when fitted
215 HepPoint3D _pivot;
216 Vector _a; //dr,phi0,kappa,dz,tanl
217 SymMatrix _Ea;
218
219 double _chi2;
220 unsigned _ndf;
221
222 static const TRungeFitter _fitter;
223
224 friend class TRungeFitter;
225
226 Bfield* _bfield;
227 int _bfieldID;
228
229 double _maxflightlength;
230
231 double _stepSize; // default step size
232 //if 0, step size will be made automatically
233 double _yscal[6];
234 double _eps; //used for step size control
235 double _stepSizeMax;
236 double _stepSizeMin;
237
238 float _mass;
239 const RkFitMaterial FitMdcMaterial;
240
241
242private:
243 // caches
244 float _mass2; //=_mass*_mass;
245 int _charge;
246
247 mutable double _y[TRunge_MAXstep][6]; //(x,y,z,px,py,pz)
248 mutable double _h[TRunge_MAXstep]; //step size in each step
249 mutable unsigned _Nstep; //0:not cached the trajectory
250private:
251 IMagneticFieldSvc* m_pmgnIMF;
252
253
254};
255
256inline unsigned TRunge::objectType(void) const{
257 return Runge;
258}
259#endif /* TRUNGE_FLAG_ */
double mass
EvtTensor3C eps(const EvtVector3R &v)
Definition: EvtTensor3C.cc:307
HepGeom::Point3D< double > HepPoint3D
Definition: TRunge.h:27
HepGeom::Transform3D HepTransform3D
Definition: TRunge.h:36
#define Runge
Definition: TRunge.h:19
HepGeom::Vector3D< double > HepVector3D
Definition: TRunge.h:34
#define TRunge_MAXstep
Definition: TRunge.h:63
A class to fit a TTrackBase object to a 3D line.
Definition: TRungeFitter.h:34
A class to represent a track in tracking.
Definition: TRunge.h:65
double dr(void) const
Track parameters (at pivot)
Definition: TRunge.cxx:206
int GetXP(unsigned stepNum, double y[6]) const
Definition: TRunge.cxx:979
double kappa(void) const
Definition: TRunge.cxx:214
double MaxFlightLength(void) const
return max flight length
Definition: TRunge.cxx:283
Helix helix(void) const
returns helix class
Definition: TRunge.cxx:238
unsigned Fly_SC(void) const
Definition: TRunge.cxx:1097
void SetFirst(double y[6]) const
set first point (position, momentum) s=0, phi=0
Definition: TRunge.cxx:956
unsigned Nstep(void) const
access to trajectory cache
Definition: TRunge.cxx:975
unsigned Fly(const RkFitMaterial material) const
make the trajectory in cache, return the number of step
Definition: TRunge.cxx:836
double phi0(void) const
Definition: TRunge.cxx:210
double intersect_yz_plane(const HepTransform3D &plane, double x) const
Definition: TRunge.cxx:1345
const Vector & a(void) const
returns helix parameter
Definition: TRunge.cxx:230
~TRunge()
Destructor.
Definition: TRunge.cxx:203
void eloss(double path, const RkFitMaterial *material, double mass, double y[6], int index) const
Definition: TRunge.cxx:1299
double intersect_xy_plane(double z) const
Definition: TRunge.cxx:1362
double SetFlightLength(void)
set flight length using wire hits
Definition: TRunge.cxx:1141
double intersect_zx_plane(const HepTransform3D &plane, double y) const
Definition: TRunge.cxx:1328
double DisToWire(TMLink &, double, HepPoint3D, HepPoint3D &)
Definition: TRunge.cxx:1215
int approach_point(TMLink &, const HepPoint3D &, HepPoint3D &onTrack, const RkFitMaterial material) const
caluculate closest point between a point and this track
Definition: TRunge.cxx:777
int approach(TMLink &, const RkFitMaterial, bool sagCorrection=true)
Definition: TRunge.cxx:360
double StepSize(void) const
returns step size
Definition: TRunge.cxx:262
unsigned objectType(void) const
returns object type
Definition: TRunge.h:256
const double * Yscal(void) const
return error parameters for fitting with step size control
Definition: TRunge.cxx:266
void Propagate_QC(double y[6], double dydx[6], const double &steptry, const double &eps, const double yscal[6], double &stepdid, double &stepnext) const
Definition: TRunge.cxx:1048
double StepSizeMax(void) const
Definition: TRunge.cxx:272
double dz(void) const
Definition: TRunge.cxx:218
double Eps(void) const
Definition: TRunge.cxx:269
void Function(const double y[6], double f[6]) const
Definition: TRunge.cxx:916
int approach_line(TMLink &, const HepPoint3D &, const HepVector3D &, HepPoint3D &onLine, HepPoint3D &onTrack, const RkFitMaterial material)
caluculate closest points between a line and this track
Definition: TRunge.cxx:428
const SymMatrix & Ea(void) const
returns error matrix
Definition: TRunge.cxx:234
const HepPoint3D & pivot(void) const
pivot position
Definition: TRunge.cxx:226
void Propagate1(const double y[6], const double dydx[6], const double &step, double yout[6]) const
Definition: TRunge.cxx:991
double reducedchi2(void) const
returns reduced-chi2
Definition: TRunge.cxx:250
float Mass(void) const
return mass
Definition: TRunge.cxx:279
void Propagate(double y[6], const double &step, const RkFitMaterial material) const
propagate the track using 4th-order Runge-Kutta method
Definition: TRunge.cxx:862
TRunge()
Constructors.
Definition: TRunge.cxx:47
int BfieldID(void) const
returns B field ID
Definition: TRunge.cxx:258
double StepSizeMin(void) const
Definition: TRunge.cxx:275
int GetStep(unsigned stepNum, double &step) const
Definition: TRunge.cxx:985
double tanl(void) const
Definition: TRunge.cxx:222
double dEpath(double, double, double) const
Definition: TRunge.cxx:1239
unsigned ndf(void) const
returns NDF
Definition: TRunge.cxx:242
double chi2(void) const
returns chi2.
Definition: TRunge.cxx:246
const double * Yscal(const double *)
set error parameters for fitting with step size control
double intersect_cylinder(double r) const
Definition: TRunge.cxx:1316
A virtual class for a track class in tracking.
Definition: TTrackBase.h:46
A class to represent a track in tracking.
Definition: TTrack.h:129
double y[1000]
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")