#include <TRunge.h>
Inheritance diagram for TRunge:
Public Member Functions | |
const Vector & | a (const Vector &) |
set helix parameter | |
const Vector & | a (void) const |
returns helix parameter | |
const Vector & | a (const Vector &) |
set helix parameter | |
const Vector & | a (void) const |
returns helix parameter | |
void | append (const AList< TMLink > &) |
appends TMLinks. | |
void | append (TMLink &) |
appends a TMLink. | |
void | append (const AList< TMLink > &) |
appends TMLinks. | |
void | append (TMLink &) |
appends a TMLink. | |
void | appendByApproach (AList< TMLink > &list, double maxSigma) |
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned. | |
void | appendByApproach (AList< TMLink > &list, double maxSigma) |
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned. | |
void | appendByDistance (AList< TMLink > &list, double maxDistance) |
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned. | |
void | appendByDistance (AList< TMLink > &list, double maxDistance) |
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned. | |
virtual int | approach (TMLink &) const |
calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened. | |
int | approach (TMLink &, float &tof, HepVector3D &p, bool sagCorrection=true) const |
int | approach (TMLink &, bool sagCorrection=true) const |
int | approach (TMLink &, float &tof, HepVector3D &p, bool sagCorrection=true) const |
int | approach (TMLink &, bool sagCorrection=true) const |
int | approach_line (const HepPoint3D &, const HepVector3D &, HepPoint3D &onLine, HepPoint3D &onTrack, float &tof, HepVector3D &p, unsigned &stepNum) const |
int | approach_line (const HepPoint3D &, const HepVector3D &, HepPoint3D &onLine, HepPoint3D &onTrack, float &tof, HepVector3D &p) const |
int | approach_line (const HepPoint3D &, const HepVector3D &, HepPoint3D &onLine, HepPoint3D &onTrack) const |
caluculate closest points between a line and this track | |
int | approach_line (const HepPoint3D &, const HepVector3D &, HepPoint3D &onLine, HepPoint3D &onTrack, float &tof, HepVector3D &p, unsigned &stepNum) const |
int | approach_line (const HepPoint3D &, const HepVector3D &, HepPoint3D &onLine, HepPoint3D &onTrack, float &tof, HepVector3D &p) const |
int | approach_line (const HepPoint3D &, const HepVector3D &, HepPoint3D &onLine, HepPoint3D &onTrack) const |
caluculate closest points between a line and this track | |
int | approach_point (const HepPoint3D &, HepPoint3D &onTrack) const |
caluculate closest point between a point and this track | |
int | approach_point (const HepPoint3D &, HepPoint3D &onTrack) const |
caluculate closest point between a point and this track | |
int | BfieldID (int) |
set B field map ID | |
int | BfieldID (void) const |
returns B field ID | |
int | BfieldID (int) |
set B field map ID | |
int | BfieldID (void) const |
returns B field ID | |
double | chi2 (void) const |
returns chi2. | |
double | chi2 (void) const |
returns chi2. | |
const AList< TMLink > & | cores (unsigned mask=0) const |
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0. | |
const AList< TMLink > & | cores (unsigned mask=0) const |
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0. | |
virtual double | distance (const TMLink &) const |
returns distance to a position of TMLink in TMLink space. | |
virtual double | distance (const TMLink &) const |
returns distance to a position of TMLink in TMLink space. | |
double | dr (void) const |
Track parameters (at pivot). | |
double | dr (void) const |
Track parameters (at pivot). | |
virtual void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
virtual void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
double | dz (void) const |
double | dz (void) const |
const SymMatrix & | Ea (const SymMatrix &) |
set helix error matrix | |
const SymMatrix & | Ea (void) const |
returns error matrix | |
const SymMatrix & | Ea (const SymMatrix &) |
set helix error matrix | |
const SymMatrix & | Ea (void) const |
returns error matrix | |
double | Eps (double) |
double | Eps (void) const |
double | Eps (double) |
double | Eps (void) const |
void | falseFit () |
false Fit | |
void | falseFit () |
false Fit | |
virtual int | fit (void) |
fits itself by a default fitter. Error was happened if return value is not zero. | |
virtual int | fit (void) |
fits itself by a default fitter. Error was happened if return value is not zero. | |
bool | fitted (void) const |
returns true if fitted. | |
bool | fitted (void) const |
returns true if fitted. | |
bool | fittedWithCathode (void) const |
returns true if fitted with cathode hits(TEMPORARY). | |
bool | fittedWithCathode (void) const |
returns true if fitted with cathode hits(TEMPORARY). | |
const TMFitter *const | fitter (const TMFitter *) |
sets a default fitter. | |
const TMFitter *const | fitter (void) const |
returns a pointer to a default fitter. | |
const TMFitter *const | fitter (const TMFitter *) |
sets a default fitter. | |
const TMFitter *const | fitter (void) const |
returns a pointer to a default fitter. | |
unsigned | Fly (void) const |
make the trajectory in cache, return the number of step | |
unsigned | Fly (void) const |
make the trajectory in cache, return the number of step | |
unsigned | Fly_SC (void) const |
unsigned | Fly_SC (void) const |
void | Function (const double y[6], double f[6]) const |
void | Function (const double y[6], double f[6]) const |
int | GetStep (unsigned stepNum, double &step) const |
int | GetStep (unsigned stepNum, double &step) const |
int | GetXP (unsigned stepNum, double y[6]) const |
int | GetXP (unsigned stepNum, double y[6]) const |
Helix | helix (void) const |
returns helix class | |
Helix | helix (void) const |
returns helix class | |
const TTrackHEP *const | hep (void) const |
returns TTrackHEP. | |
const TTrackHEP *const | hep (void) const |
returns TTrackHEP. | |
double | kappa (void) const |
double | kappa (void) const |
const AList< TMLink > & | links (unsigned mask=0) const |
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0. | |
const AList< TMLink > & | links (unsigned mask=0) const |
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0. | |
float | Mass (float) |
set mass for tof calc. | |
float | Mass (void) const |
return mass | |
float | Mass (float) |
set mass for tof calc. | |
float | Mass (void) const |
return mass | |
double | MaxFlightLength (double) |
double | MaxFlightLength (void) const |
return max flight length | |
double | MaxFlightLength (double) |
double | MaxFlightLength (void) const |
return max flight length | |
const TTrackMC *const | mc (void) const |
returns a pointer to TTrackMC. | |
const TTrackMC *const | mc (void) const |
returns a pointer to TTrackMC. | |
unsigned | nCores (unsigned mask=0) const |
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0. | |
unsigned | nCores (unsigned mask=0) const |
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0. | |
unsigned | ndf (void) const |
returns NDF | |
unsigned | ndf (void) const |
returns NDF | |
unsigned | nHeps (void) const |
returns # of contributed TTrackHEP tracks. | |
unsigned | nHeps (void) const |
returns # of contributed TTrackHEP tracks. | |
unsigned | nLinks (unsigned mask=0) const |
returns # of masked TMLinks assigned to this track object. | |
unsigned | nLinks (unsigned mask=0) const |
returns # of masked TMLinks assigned to this track object. | |
unsigned | Nstep (void) const |
access to trajectory cache | |
unsigned | Nstep (void) const |
access to trajectory cache | |
unsigned | objectType (void) const |
returns object type | |
unsigned | objectType (void) const |
returns object type | |
TMLink * | operator[] (unsigned i) const |
TMLink * | operator[] (unsigned i) const |
double | phi0 (void) const |
double | phi0 (void) const |
const HepPoint3D & | pivot (const HepPoint3D &) |
set new pivot | |
const HepPoint3D & | pivot (void) const |
pivot position | |
const HepPoint3D & | pivot (const HepPoint3D &) |
set new pivot | |
const HepPoint3D & | pivot (void) const |
pivot position | |
void | Propagate (double y[6], const double &step) const |
propagate the track using 4th-order Runge-Kutta method | |
void | Propagate (double y[6], const double &step) const |
propagate the track using 4th-order Runge-Kutta method | |
void | Propagate1 (const double y[6], const double dydx[6], const double &step, double yout[6]) const |
void | Propagate1 (const double y[6], const double dydx[6], const double &step, double yout[6]) const |
void | Propagate_QC (double y[6], double dydx[6], const double &steptry, const double &eps, const double yscal[6], double &stepdid, double &stepnext) const |
void | Propagate_QC (double y[6], double dydx[6], const double &steptry, const double &eps, const double yscal[6], double &stepdid, double &stepnext) const |
double | reducedchi2 (void) const |
returns reduced-chi2 | |
double | reducedchi2 (void) const |
returns reduced-chi2 | |
virtual void | refine (double maxSigma) |
removes bad points by pull. The bad points are masked not to be used in fit. | |
virtual void | refine (AList< TMLink > &list, double maxSigma) |
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'. | |
virtual void | refine (double maxSigma) |
removes bad points by pull. The bad points are masked not to be used in fit. | |
virtual void | refine (AList< TMLink > &list, double maxSigma) |
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'. | |
void | remove (const AList< TMLink > &) |
removes TMLinks. | |
void | remove (TMLink &a) |
removes a TMLink. | |
void | remove (const AList< TMLink > &) |
removes TMLinks. | |
void | remove (TMLink &a) |
removes a TMLink. | |
virtual void | removeLinks (void) |
virtual void | removeLinks (void) |
void | SetFirst (double y[6]) const |
set first point (position, momentum) s=0, phi=0 | |
void | SetFirst (double y[6]) const |
set first point (position, momentum) s=0, phi=0 | |
double | SetFlightLength (void) |
set flight length using wire hits | |
double | SetFlightLength (void) |
set flight length using wire hits | |
double | StepSize (double) |
set step size to calc. trajectory | |
double | StepSize (void) const |
returns step size | |
double | StepSize (double) |
set step size to calc. trajectory | |
double | StepSize (void) const |
returns step size | |
double | StepSizeMax (double) |
double | StepSizeMax (void) const |
double | StepSizeMax (double) |
double | StepSizeMax (void) const |
double | StepSizeMin (double) |
double | StepSizeMin (void) const |
double | StepSizeMin (double) |
double | StepSizeMin (void) const |
double | tanl (void) const |
double | tanl (void) const |
unsigned | testByApproach (const AList< TMLink > &list, double sigma) const |
unsigned | testByApproach (const TMLink &list, double sigma) const |
returns # of good hits to be appended. | |
unsigned | testByApproach (const AList< TMLink > &list, double sigma) const |
unsigned | testByApproach (const TMLink &list, double sigma) const |
returns # of good hits to be appended. | |
TRunge (const TRunge &) | |
TRunge (const Helix &) | |
TRunge (const TTrack &) | |
TRunge () | |
Constructors. | |
TRunge (const TRunge &) | |
TRunge (const Helix &) | |
TRunge (const TTrack &) | |
TRunge () | |
Constructors. | |
virtual unsigned | type (void) const |
returns type. Definition is depending on an object class. | |
virtual unsigned | type (void) const |
returns type. Definition is depending on an object class. | |
void | update (void) const |
update cache. | |
void | update (void) const |
update cache. | |
const double * | Yscal (const double *) |
set error parameters for fitting with step size control | |
const double * | Yscal (void) const |
return error parameters for fitting with step size control | |
const double * | Yscal (const double *) |
set error parameters for fitting with step size control | |
const double * | Yscal (void) const |
return error parameters for fitting with step size control | |
~TRunge () | |
Destructor. | |
~TRunge () | |
Destructor. | |
Protected Attributes | |
bool | _fitted |
bool | _fittedWithCathode |
AList< TMLink > | _links |
AList< TMLink > | _links |
TTrackMC * | _mc |
TTrackMC * | _mc |
Private Attributes | |
Vector | _a |
Bfield * | _bfield |
Bfield * | _bfield |
int | _bfieldID |
int | _charge |
double | _chi2 |
SymMatrix | _Ea |
double | _eps |
double | _h [TRunge_MAXstep] |
float | _mass |
float | _mass2 |
double | _maxflightlength |
unsigned | _ndf |
unsigned | _Nstep |
HepPoint3D | _pivot |
double | _stepSize |
double | _stepSizeMax |
double | _stepSizeMin |
double | _y [TRunge_MAXstep][6] |
double | _yscal [6] |
IMagneticFieldSvc * | m_pmgnIMF |
IMagneticFieldSvc * | m_pmgnIMF |
Static Private Attributes | |
const TRungeFitter | _fitter = TRungeFitter("TRunge Default fitter") |
Friends | |
class | TRungeFitter |
|
Constructors.
00049 : TTrackBase(), 00050 _pivot(ORIGIN),_a(Vector(5,0)),_Ea(SymMatrix(5,0)), 00051 _chi2(0),_ndf(0),_charge(1),_bfieldID(21),_Nstep(0), 00052 _stepSize(default_stepSize),_mass(0.140),_eps(EPS), 00053 _stepSizeMax(default_stepSizeMax),_stepSizeMin(default_stepSizeMin), 00054 _maxflightlength(default_maxflightlength) { 00055 00056 //...Set a default fitter... 00057 fitter(& TRunge::_fitter); 00058 00059 _fitted = false; 00060 _fittedWithCathode = false; 00061 00062 _bfield = Bfield::getBfield(_bfieldID); 00063 00064 _mass2=_mass*_mass; 00065 00066 _yscal[0]=0.1; //1mm -> error = 1mm*EPS 00067 _yscal[1]=0.1; //1mm 00068 _yscal[2]=0.1; //1mm 00069 _yscal[3]=0.001; //1MeV 00070 _yscal[4]=0.001; //1MeV 00071 _yscal[5]=0.001; //1MeV 00072 //jialk 00073 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00074 if(scmgn!=StatusCode::SUCCESS) { 00075 std::cout<< "Unable to open Magnetic field service"<<std::endl; 00076 } 00077 00078 }
|
|
00081 : TTrackBase((TTrackBase &) a), 00082 _pivot(a.helix().pivot()),_a(a.helix().a()),_Ea(a.helix().Ea()), 00083 _chi2(0),_ndf(0),_bfieldID(21),_Nstep(0), 00084 _stepSize(default_stepSize),_mass(0.140),_eps(EPS), 00085 _stepSizeMax(default_stepSizeMax),_stepSizeMin(default_stepSizeMin), 00086 _maxflightlength(default_maxflightlength) { 00087 00088 //...Set a default fitter... 00089 fitter(& TRunge::_fitter); 00090 00091 _fitted = false; 00092 _fittedWithCathode = false; 00093 00094 if(_a[2]<0) _charge=-1; 00095 else _charge=1; 00096 00097 _bfield = Bfield::getBfield(_bfieldID); 00098 00099 _mass2=_mass*_mass; 00100 00101 _yscal[0]=0.1; //1mm -> error = 1mm*EPS 00102 _yscal[1]=0.1; //1mm 00103 _yscal[2]=0.1; //1mm 00104 _yscal[3]=0.001; //1MeV 00105 _yscal[4]=0.001; //1MeV 00106 _yscal[5]=0.001; //1MeV 00107 00108 //SetFlightLength(); 00109 //cout<<"TR:: _maxflightlength="<<_maxflightlength<<endl; 00110 }
|
|
00113 : TTrackBase(), 00114 _pivot(h.pivot()),_a(h.a()),_Ea(h.Ea()), 00115 _chi2(0),_ndf(0),_bfieldID(21),_Nstep(0), 00116 _stepSize(default_stepSize),_mass(0.140),_eps(EPS), 00117 _stepSizeMax(default_stepSizeMax),_stepSizeMin(default_stepSizeMin), 00118 _maxflightlength(default_maxflightlength) { 00119 00120 //...Set a default fitter... 00121 fitter(& TRunge::_fitter); 00122 00123 _fitted = false; 00124 _fittedWithCathode = false; 00125 00126 if(_a[2]<0) _charge=-1; 00127 else _charge=1; 00128 00129 _bfield = Bfield::getBfield(_bfieldID); 00130 00131 _mass2=_mass*_mass; 00132 00133 _yscal[0]=0.1; //1mm -> error = 1mm*EPS 00134 _yscal[1]=0.1; //1mm 00135 _yscal[2]=0.1; //1mm 00136 _yscal[3]=0.001; //1MeV 00137 _yscal[4]=0.001; //1MeV 00138 _yscal[5]=0.001; //1MeV 00139 }
|
|
00142 : TTrackBase((TTrackBase &) a), 00143 _pivot(a.pivot()),_a(a.a()),_Ea(a.Ea()), 00144 _chi2(a.chi2()),_ndf(a.ndf()),_bfieldID(a.BfieldID()),_Nstep(0), 00145 _stepSize(a.StepSize()),_mass(a.Mass()),_eps(a.Eps()), 00146 _stepSizeMax(a.StepSizeMax()),_stepSizeMin(a.StepSizeMin()), 00147 _maxflightlength(a.MaxFlightLength()) { 00148 00149 //...Set a default fitter... 00150 fitter(& TRunge::_fitter); 00151 00152 _fitted = false; 00153 _fittedWithCathode = false; 00154 00155 if(_a[2]<0) _charge=-1; 00156 else _charge=1; 00157 00158 _bfield = Bfield::getBfield(_bfieldID); 00159 00160 _mass2=_mass*_mass; 00161 00162 for(unsigned i=0;i<6;i++) _yscal[i]=a.Yscal()[i]; 00163 }
|
|
Destructor.
00166 { 00167 }
|
|
Constructors.
|
|
|
|
|
|
|
|
Destructor.
|
|
set helix parameter
|
|
returns helix parameter
|
|
set helix parameter
00262 { 00263 _a=ta; 00264 if(_a[2]<0) _charge=-1; 00265 else _charge=1; 00266 _Nstep=0; 00267 return(_a); 00268 }
|
|
returns helix parameter
00193 {
00194 return(_a);
00195 }
|
|
appends TMLinks.
|
|
appends a TMLink.
|
|
appends TMLinks.
00357 { 00358 AList<TMLink> tmp; 00359 for (unsigned i = 0; i < a.length(); i++) { 00360 if ((_links.hasMember(a[i])) || (a[i]->hit()->state() & WireHitUsed)) { 00361 #ifdef TRKRECO_DEBUG_DETAIL 00362 std::cout << " TTrackBase::append(list) !!! "; 00363 std::cout << a[i]->wire()->name(); 00364 std::cout << " Hey!, this is already used! Don't mess with me."; 00365 std::cout << std::endl; 00366 #endif 00367 continue; 00368 } 00369 else { 00370 tmp.append(a[i]); 00371 } 00372 } 00373 _links.append(tmp); 00374 _updated = false; 00375 _fitted = false; 00376 _fittedWithCathode = false; // added by matsu ( 1999/05/24 ) 00377 }
|
|
appends a TMLink.
00335 { 00336 if ((a.hit()->state() & WireHitUsed)) { 00337 #ifdef TRKRECO_DEBUG_DETAIL 00338 std::cout << "TTrackBase::append !!! " << a.wire()->name() 00339 << " this is already used by another track!" << std::endl; 00340 #endif 00341 return; 00342 } 00343 if (_links.hasMember(a)) { 00344 #ifdef TRKRECO_DEBUG_DETAIL 00345 std::cout << "TTrackBase::append !!! " << a.wire()->name() 00346 << " this is already included in this track!" << std::endl; 00347 #endif 00348 return; 00349 } 00350 _links.append(a); 00351 _updated = false; 00352 _fitted = false; 00353 _fittedWithCathode = false; // added by matsu ( 1999/05/24 ) 00354 }
|
|
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
|
|
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
00101 { 00102 #ifdef TRKRECO_DEBUG_DETAIL 00103 std::cout << " TTrackBase::appendByApproach ... sigma=" << maxSigma << std::endl; 00104 #endif 00105 00106 AList<TMLink> unused; 00107 unsigned n = list.length(); 00108 for (unsigned i = 0; i < n; i++) { 00109 TMLink & l = * list[i]; 00110 00111 if ((_links.hasMember(l)) || (l.hit()->state() & WireHitUsed)) 00112 continue; 00113 00114 //...Calculate closest approach... 00115 int err = approach(l); 00116 if (err < 0) { 00117 unused.append(l); 00118 continue; 00119 } 00120 00121 //...Calculate sigma... 00122 float distance = (l.positionOnWire() - l.positionOnTrack()).mag(); 00123 float diff = fabs(distance - l.drift()); 00124 float sigma = diff / l.dDrift(); 00125 00126 //...For debug... 00127 #ifdef TRKRECO_DEBUG_DETAIL 00128 std::cout << " sigma=" << sigma; 00129 std::cout << ",dist=" << distance; 00130 std::cout << ",diff=" << diff; 00131 std::cout << ",err=" << l.hit()->dDrift() << ","; 00132 if (sigma < maxSigma) std::cout << "ok,"; 00133 else std::cout << "X,"; 00134 l.dump("mc"); 00135 #endif 00136 00137 //...Make sigma cut... 00138 if (sigma > maxSigma) { 00139 unused.append(l); 00140 continue; 00141 } 00142 00143 //...OK... 00144 _links.append(l); 00145 _updated = false; 00146 _fitted = false; 00147 } 00148 list.remove(unused); 00149 }
|
|
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
|
|
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
00152 {
00153 std::cout << "TTrackBase::appendByDistance !!! not implemented" << std::endl;
00154 list.removeAll();
00155 }
|
|
calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.
Reimplemented in TTrack, and TTrack. 00095 { 00096 std::cout << "TTrackBase::approach !!! not implemented" << std::endl; 00097 return -1; 00098 }
|
|
|
|
calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened. |
|
00330 { 00331 HepPoint3D xw; 00332 HepPoint3D wireBackwardPosition; 00333 HepVector3D v; 00334 HepPoint3D onWire,onTrack; 00335 double onWire_y, onWire_z, zwf, zwb; 00336 00337 const TMDCWire& w=*l.wire(); 00338 xw = w.xyPosition(); 00339 wireBackwardPosition = w.backwardPosition(); 00340 v = w.direction(); 00341 00342 unsigned stepNum=0; 00343 if(approach_line(wireBackwardPosition,v,onWire,onTrack,tof,p,stepNum)<0){ 00344 //cout<<"TR::error approach_line"<<endl; 00345 return(-1); 00346 } 00347 00348 zwf = w.forwardPosition().z(); 00349 zwb = w.backwardPosition().z(); 00350 // protection for strange wire hit info. (Only 'onWire' is corrected) 00351 if(onWire.z() > zwf) 00352 w.wirePosition(zwf,onWire,wireBackwardPosition,(HepVector3D&)v); 00353 else if(onWire.z() < zwb) 00354 w.wirePosition(zwb,onWire,wireBackwardPosition,(HepVector3D&)v); 00355 00356 // onWire,onTrack filled 00357 00358 if(!doSagCorrection){ 00359 l.positionOnWire(onWire); 00360 l.positionOnTrack(onTrack); 00361 return(0); // no sag correction 00362 } 00363 // Sag correction 00364 // loop for sag correction 00365 onWire_y = onWire.y(); 00366 onWire_z = onWire.z(); 00367 00368 unsigned nTrial = 1; 00369 while(nTrial<100){ 00370 //cout<<"TR: nTrial "<<nTrial<<endl; 00371 w.wirePosition(onWire_z,xw,wireBackwardPosition,(HepVector3D&)v); 00372 if(approach_line(wireBackwardPosition,v,onWire,onTrack,tof,p,stepNum)<0) 00373 return(-1); 00374 if(fabs(onWire_y - onWire.y())<0.0001) break; // |dy|< 1 micron 00375 onWire_y = onWire.y(); 00376 onWire_z += (onWire.z()-onWire_z)/2; 00377 // protection for strange wire hit info. 00378 if(onWire_z > zwf) onWire_z=zwf; 00379 else if(onWire_z < zwb) onWire_z=zwb; 00380 00381 nTrial++; 00382 } 00383 // cout<<"TR nTrial="<<nTrial<<endl; 00384 00385 l.positionOnWire(onWire); 00386 l.positionOnTrack(onTrack); 00387 return(nTrial); 00388 }
|
|
calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened. 00323 { 00324 float tof; 00325 HepVector3D p; 00326 return(approach(l,tof,p,doSagCorrection)); 00327 }
|
|
|
|
|
|
caluculate closest points between a line and this track
|
|
00406 { 00407 // line = [w0] + t * [v] -> [onLine] 00408 if(_Nstep==0){ 00409 if(_stepSize==0) Fly_SC(); 00410 else Fly(); 00411 } 00412 00413 //cout<<"TR::approach_line stepNum="<<stepNum<<endl; 00414 00415 const double w0x = w0.x(); 00416 const double w0y = w0.y(); 00417 const double w0z = w0.z(); 00418 //cout<<"TR::line w0="<<w0x<<","<<w0y<<","<<w0z<<endl; 00419 const double vx = v.x(); 00420 const double vy = v.y(); 00421 const double vz = v.z(); 00422 const double v_2 = vx*vx+vy*vy+vz*vz; 00423 00424 const float clight=29.9792458; //[cm/ns] 00425 //const float M2=_mass*_mass; 00426 //const float& M2=_mass2; 00427 const float p2 = _y[0][3]*_y[0][3]+_y[0][4]*_y[0][4]+_y[0][5]*_y[0][5]; 00428 const float tof_factor=1./clight*sqrt(1+_mass2/p2); 00429 00430 // search for the closest point in cache (point - line) 00431 // unsigned stepNum; 00432 double l2_old= DBL_MAX; 00433 if(stepNum>_Nstep) stepNum=0; 00434 unsigned stepNumLo; 00435 unsigned stepNumHi; 00436 if(stepNum==0 && _stepSize!=0){ // skip 00437 const double dx = _y[0][0]-w0x; 00438 const double dy = _y[0][1]-w0y; 00439 stepNum=(unsigned) 00440 (sqrt( (dx*dx+dy*dy)*(1+_a[4]*_a[4]) )/_stepSize); 00441 } 00442 unsigned mergin; 00443 if(_stepSize==0){ 00444 mergin=10; //10 step back 00445 }else{ 00446 mergin=(unsigned)(1.0/_stepSize); //1mm back 00447 } 00448 if(stepNum>mergin) stepNum-=mergin; 00449 else stepNum=0; 00450 if(stepNum>=_Nstep) stepNum=_Nstep-1; 00451 // hunt 00452 // unsigned inc=1; 00453 unsigned inc=(mergin>>1)+1; 00454 stepNumLo=stepNum; 00455 stepNumHi=stepNum; 00456 for(;;){ 00457 const double dx = _y[stepNumHi][0]-w0x; 00458 const double dy = _y[stepNumHi][1]-w0y; 00459 const double dz = _y[stepNumHi][2]-w0z; 00460 const double t = (dx*vx+dy*vy+dz*vz)/v_2; 00461 const double l2 = (dx*dx+dy*dy+dz*dz)-(t*t)/v_2; 00462 if(l2 > l2_old) break; 00463 l2_old=l2; 00464 stepNumLo=stepNumHi; 00465 // inc+=inc; 00466 stepNumHi+=inc; 00467 if(stepNumHi>=_Nstep){ 00468 stepNumHi=_Nstep; 00469 break; 00470 } 00471 } 00472 // locate (2-bun-hou, bisection method) 00473 while(stepNumHi-stepNumLo>1){ 00474 unsigned j=(stepNumHi+stepNumLo)>>1; 00475 const double dx = _y[j][0]-w0x; 00476 const double dy = _y[j][1]-w0y; 00477 const double dz = _y[j][2]-w0z; 00478 const double t = (dx*vx+dy*vy+dz*vz)/v_2; 00479 const double l2 = (dx*dx+dy*dy+dz*dz)-(t*t)/v_2; 00480 if(l2 > l2_old){ 00481 stepNumHi=j; 00482 }else{ 00483 l2_old=l2; 00484 stepNumLo=j; 00485 } 00486 } 00487 //stepNum=stepNumHi; 00488 stepNum=stepNumLo; 00489 /* 00490 for(;stepNum<_Nstep;stepNum++){ 00491 const double dx = _y[stepNum][0]-w0x; 00492 const double dy = _y[stepNum][1]-w0y; 00493 const double dz = _y[stepNum][2]-w0z; 00494 const double t = (dx*vx+dy*vy+dz*vz)/v_2; 00495 const double l2 = (dx*dx+dy*dy+dz*dz)-(t*t)/v_2; 00496 if(l2 > l2_old) break; 00497 l2_old=l2; 00498 // const float p2 = _y[stepNum][3]*_y[stepNum][3]+ 00499 // _y[stepNum][4]*_y[stepNum][4]+ 00500 // _y[stepNum][5]*_y[stepNum][5]; 00501 // tof+=_stepSize/clight*sqrt(1+M2/p2); 00502 } 00503 */ 00504 // cout<<"TR stepNum="<<stepNum<<endl; 00505 //if(stepNum>=_Nstep) return(-1); // not found 00506 //stepNum--; 00507 if(_stepSize==0){ 00508 double dstep=0; 00509 for(unsigned i=0;i<stepNum;i++) dstep+=_h[i]; 00510 tof=dstep*tof_factor; 00511 }else{ 00512 tof=stepNum*_stepSize*tof_factor; 00513 } 00514 00515 // propagate the track and search for the closest point 00516 //2-bun-hou (bisection method) 00517 /* 00518 double y[6],y_old[6]; 00519 for(unsigned i=0;i<6;i++) y[i]=_y[stepNum][i]; 00520 double step=_stepSize; 00521 double step2=0; 00522 for(;;){ 00523 for(unsigned i=0;i<6;i++) y_old[i]=y[i]; 00524 Propagate(y,step); 00525 const double dx = y[0]-w0x; 00526 const double dy = y[1]-w0y; 00527 const double dz = y[2]-w0z; 00528 const double t = (dx*vx+dy*vy+dz*vz)/v_2; 00529 const double l2 = (dx*dx+dy*dy+dz*dz)-(t*t)/v_2; 00530 if(l2 > l2_old){ // back 00531 for(unsigned i=0;i<6;i++) y[i]=y_old[i]; 00532 }else{ // propagate 00533 l2_old=l2; 00534 // const float p2=y[3]*y[3]+y[4]*y[4]+y[5]*y[5]; 00535 // tof+=step/clight*sqrt(1+M2/p2); 00536 step2+=step; 00537 } 00538 step/=2; 00539 if(step < 0.0001) break; // step < 1 [um] 00540 } 00541 */ 00542 // Hasamiuchi-Hou (false position method) 00543 /* 00544 double y[6],y1[6],y2[6]; 00545 for(unsigned i=0;i<6;i++) y1[i]=_y[stepNum][i]; 00546 for(unsigned i=0;i<6;i++) y2[i]=_y[stepNum+2][i]; 00547 double minStep=0; 00548 double maxStep=_stepSize*2; 00549 double step2=0; 00550 const double A[3][3]={{1-vx*vx/v_2, -vx*vy/v_2, -vx*vz/v_2}, 00551 { -vy*vx/v_2,1-vy*vy/v_2, -vy*vz/v_2}, 00552 { -vz*vx/v_2, -vz*vy/v_2,1-vz*vz/v_2}}; 00553 00554 double Y1=0; 00555 { 00556 const double dx = y1[0]-w0x; 00557 const double dy = y1[1]-w0y; 00558 const double dz = y1[2]-w0z; 00559 const double t = (dx*vx+dy*vy+dz*vz)/v_2; 00560 const double d[3]={dx-t*vx,dy-t*vy,dz-t*vz}; 00561 const double l = sqrt( (dx*dx+dy*dy+dz*dz)-(t*t)/v_2 ); 00562 const double pmag=sqrt(y1[3]*y1[3]+y1[4]*y1[4]+y1[5]*y1[5]); 00563 for(int j=0;j<3;j++){ 00564 double g=0; 00565 for(int k=0;k<3;k++) g+=A[j][k]*d[k]; 00566 Y1+=y1[j+3]*g; 00567 } 00568 Y1=Y1/pmag/l; 00569 } 00570 double Y2=0; 00571 { 00572 const double dx = y2[0]-w0x; 00573 const double dy = y2[1]-w0y; 00574 const double dz = y2[2]-w0z; 00575 const double t = (dx*vx+dy*vy+dz*vz)/v_2; 00576 const double d[3]={dx-t*vx,dy-t*vy,dz-t*vz}; 00577 const double l = sqrt( (dx*dx+dy*dy+dz*dz)-(t*t)/v_2 ); 00578 const double pmag=sqrt(y2[3]*y2[3]+y2[4]*y2[4]+y2[5]*y2[5]); 00579 for(int j=0;j<3;j++){ 00580 double g=0; 00581 for(int k=0;k<3;k++) g+=A[j][k]*d[k]; 00582 Y2+=y2[j+3]*g; 00583 } 00584 Y2=Y2/pmag/l; 00585 } 00586 if(Y1*Y2>=0) cout<<"TR fatal error!"<<endl; 00587 double step_old= DBL_MAX; 00588 for(;;){ 00589 const double step=(minStep*Y2-maxStep*Y1)/(Y2-Y1); 00590 if(fabs(step-step_old)<0.0001) break; 00591 step_old=step; 00592 for(unsigned i=0;i<6;i++) y[i]=y1[i]; 00593 Propagate(y,step-minStep); 00594 double Y=0; 00595 { 00596 const double dx = y[0]-w0x; 00597 const double dy = y[1]-w0y; 00598 const double dz = y[2]-w0z; 00599 const double t = (dx*vx+dy*vy+dz*vz)/v_2; 00600 const double d[3]={dx-t*vx,dy-t*vy,dz-t*vz}; 00601 const double l = sqrt( (dx*dx+dy*dy+dz*dz)-(t*t)/v_2 ); 00602 const double pmag=sqrt(y[3]*y[3]+y[4]*y[4]+y[5]*y[5]); 00603 for(int j=0;j<3;j++){ 00604 double g=0; 00605 for(int k=0;k<3;k++) g+=A[j][k]*d[k]; 00606 Y+=y[j+3]*g; 00607 } 00608 Y=Y/pmag/l; 00609 } 00610 if(Y1*Y<0){ //Y->Y2 00611 Y2=Y; 00612 for(unsigned i=0;i<6;i++) y2[i]=y[i]; 00613 maxStep=step; 00614 }else{ //Y->Y1 00615 Y1=Y; 00616 for(unsigned i=0;i<6;i++) y1[i]=y[i]; 00617 minStep=step; 00618 } 00619 if(Y1==Y2) break; 00620 } 00621 step2=step_old; 00622 */ 00623 // Newton method 00624 double y[6]; 00625 for(unsigned i=0;i<6;i++) y[i]=_y[stepNum][i]; 00626 //memcpy(y,_y[stepNum],sizeof(double)*6); 00627 double step2=0; 00628 const double A[3][3]={{1-vx*vx/v_2, -vx*vy/v_2, -vx*vz/v_2}, 00629 { -vy*vx/v_2,1-vy*vy/v_2, -vy*vz/v_2}, 00630 { -vz*vx/v_2, -vz*vy/v_2,1-vz*vz/v_2}}; 00631 double factor=1; 00632 double g[3]; 00633 double f[6]; 00634 double Af[3],Af2[3]; 00635 unsigned i,j,k; 00636 for(i=0;i<10;i++){ 00637 //cout<<"TR::line "<<y[0]<<","<<y[1]<<","<<y[2]<<","<<y[3]<<","<<y[4]<<","<<y[5]<<endl; 00638 const double dx = y[0]-w0x; 00639 const double dy = y[1]-w0y; 00640 const double dz = y[2]-w0z; 00641 const double t = (dx*vx+dy*vy+dz*vz)/v_2; 00642 const double d[3]={dx-t*vx,dy-t*vy,dz-t*vz}; 00643 const double l2 = (dx*dx+dy*dy+dz*dz)-(t*t)/v_2; 00644 for(j=0;j<3;j++){ 00645 g[j]=0; 00646 for(k=0;k<3;k++) g[j]+=A[j][k]*d[k]; 00647 } 00648 //cout<<"g="<<g[0]<<","<<g[1]<<","<<g[2]<<endl; 00649 Function(y,f); 00650 //cout<<"f="<<f[0]<<","<<f[1]<<","<<f[2]<<","<<f[3]<<","<<f[4]<<","<<f[5]<<endl; 00651 //cout<<"A="<<A[0][0]<<","<<A[0][1]<<","<<A[0][2]<<endl; 00652 //cout<<"A="<<A[1][0]<<","<<A[1][1]<<","<<A[1][2]<<endl; 00653 //cout<<"A="<<A[2][0]<<","<<A[2][1]<<","<<A[2][2]<<endl; 00654 double Y=0; 00655 for(j=0;j<3;j++) Y+=y[j+3]*g[j]; 00656 double dYds=0; 00657 for(j=0;j<3;j++) dYds+=f[j+3]*g[j]; 00658 //cout<<"dYds="<<dYds<<endl; 00659 for(j=0;j<3;j++){ 00660 Af[j]=0; 00661 Af2[j]=0; 00662 } 00663 for(j=0;j<3;j++){ 00664 //Af[j]=0; 00665 //Af2[j]=0; 00666 for(k=0;k<3;k++) Af[j]+=(A[j][k]*f[k]); 00667 for(k=0;k<3;k++) Af2[j]+=(A[j][k]*Af[k]); 00668 dYds+=y[j+3]*Af2[j]; 00669 //cout<<j<<" dYds="<<dYds<<endl; 00670 } 00671 //cout<<"dYds="<<dYds<<endl; 00672 const double step=-Y/dYds*factor; 00673 //cout<<"TR step="<<step<<" i="<<i<<endl; 00674 if(fabs(step) < 0.0001) break; // step < 1 [um] 00675 if(l2 > l2_old) factor/=2; 00676 l2_old=l2; 00677 Propagate(y,step); 00678 step2+=step; 00679 } 00680 00681 tof+=step2*tof_factor; 00682 00683 onTrack.setX(y[0]); 00684 onTrack.setY(y[1]); 00685 onTrack.setZ(y[2]); 00686 p.setX(y[3]); 00687 p.setY(y[4]); 00688 p.setZ(y[5]); 00689 00690 const double dx = y[0]-w0x; 00691 const double dy = y[1]-w0y; 00692 const double dz = y[2]-w0z; 00693 const double s = (dx*vx+dy*vy+dz*vz)/v_2; 00694 onLine.setX(w0x+s*vx); 00695 onLine.setY(w0y+s*vy); 00696 onLine.setZ(w0z+s*vz); 00697 00698 return(0); 00699 }
|
|
00399 { 00400 unsigned stepNum=0; 00401 return(approach_line(w0,v,onLine,onTrack,tof,p,stepNum)); 00402 }
|
|
caluculate closest points between a line and this track
00391 { 00392 float tof; 00393 HepVector3D p; 00394 return(approach_line(w0,v,onLine,onTrack,tof,p)); 00395 }
|
|
caluculate closest point between a point and this track
|
|
caluculate closest point between a point and this track
00701 { 00702 if(_Nstep==0){ 00703 if(_stepSize==0) Fly_SC(); 00704 else Fly(); 00705 } 00706 00707 double x0=p0.x(); 00708 double y0=p0.y(); 00709 double z0=p0.z(); 00710 00711 //tof=0; 00712 //const float clight=29.9792458; //[cm/ns] 00713 //const float M2=_mass*_mass; 00714 00715 // search for the closest point in cache 00716 unsigned stepNum; 00717 double l2_old= DBL_MAX; 00718 for(stepNum=0;stepNum<_Nstep;stepNum++){ 00719 double l2=(_y[stepNum][0]-x0)*(_y[stepNum][0]-x0)+ 00720 (_y[stepNum][1]-y0)*(_y[stepNum][1]-y0)+ 00721 (_y[stepNum][2]-z0)*(_y[stepNum][2]-z0); 00722 if(l2 > l2_old) break; 00723 l2_old=l2; 00724 //const double p2 = _y[stepNum][3]*_y[stepNum][3]+ 00725 // _y[stepNum][4]*_y[stepNum][4]+ 00726 // _y[stepNum][5]*_y[stepNum][5]; 00727 //tof+=_stepSize/clight*sqrt(1+M2/p2); 00728 } 00729 if(stepNum>=_Nstep) return(-1); // not found 00730 stepNum--; 00731 00732 // propagate the track and search for the closest point 00733 double y[6],y_old[6]; 00734 for(unsigned i=0;i<6;i++) y[i]=_y[stepNum][i]; 00735 double step=_stepSize; 00736 for(;;){ 00737 for(unsigned i=0;i<6;i++) y_old[i]=y[i]; 00738 Propagate(y,step); 00739 double l2=(y[0]-x0)*(y[0]-x0)+(y[1]-y0)*(y[1]-y0)+(y[2]-z0)*(y[2]-z0); 00740 if(l2 > l2_old){ // back 00741 for(unsigned i=0;i<6;i++) y[i]=y_old[i]; 00742 }else{ // propagate 00743 l2_old=l2; 00744 //const double p2=y[3]*y[3]+y[4]*y[4]+y[5]*y[5]; 00745 //tof+=step/clight*sqrt(1+M2/p2); 00746 } 00747 step/=2; 00748 if(step < 0.0001) break; // step < 1 [um] 00749 } 00750 00751 onTrack.setX(y[0]); 00752 onTrack.setY(y[1]); 00753 onTrack.setZ(y[2]); 00754 //p.setX(y[3]); 00755 //p.setY(y[4]); 00756 //p.setZ(y[5]); 00757 return(0); 00758 }
|
|
set B field map ID
|
|
returns B field ID
|
|
set B field map ID
00276 { 00277 _bfieldID=id; 00278 _bfield = Bfield::getBfield(_bfieldID); 00279 _Nstep=0; 00280 return(_bfieldID); 00281 }
|
|
returns B field ID
00221 {
00222 return(_bfieldID);
00223 }
|
|
returns chi2.
|
|
returns chi2.
00209 {
00210 return _chi2;
00211 }
|
|
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
|
|
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
00290 { 00291 if (mask) 00292 std::cout << "TTrackBase::cores !!! mask is not supported" << std::endl; 00293 if (! _updated) update(); 00294 return _cores; 00295 }
|
|
returns distance to a position of TMLink in TMLink space.
|
|
returns distance to a position of TMLink in TMLink space.
Reimplemented in TLine0, TMLine, TLine0, and TMLine. 00089 { 00090 std::cout << "TTrackBase::distance !!! not implemented" << std::endl; 00091 return 0.; 00092 }
|
|
Track parameters (at pivot).
|
|
Track parameters (at pivot).
00169 { 00170 return(_a[0]); 00171 }
|
|
dumps debug information.
Reimplemented in TCircle, TLine0, TMLine, TSegment, TSegment0, TTrack, TCircle, TLine0, TMLine, TSegment, TSegment0, and TTrack. |
|
dumps debug information.
Reimplemented in TCircle, TLine0, TMLine, TSegment, TSegment0, TTrack, TCircle, TLine0, TMLine, TSegment, TSegment0, and TTrack. 00058 { 00059 bool mc = (msg.find("mc") != std::string::npos); 00060 bool pull = (msg.find("pull") != std::string::npos); 00061 bool flag = (msg.find("flag") != std::string::npos); 00062 bool detail = (msg.find("detail") != std::string::npos); 00063 if (detail) 00064 mc = pull = flag = true; 00065 00066 if (detail || (msg.find("layer") != std::string::npos)) { 00067 if (! _updated) update(); 00068 } 00069 if (detail || (msg.find("hits") != std::string::npos)) { 00070 Dump(_links, msg, pre); 00071 } 00072 }
|
|
|
|
00181 { 00182 return(_a[3]); 00183 }
|
|
set helix error matrix
|
|
returns error matrix
|
|
set helix error matrix
|
|
returns error matrix
00197 {
00198 return(_Ea);
00199 }
|
|
|
|
|
|
|
|
00232 {
00233 return(_eps);
00234 }
|
|
false Fit
|
|
false Fit
00227 { 00228 _fitted = false; 00229 _fittedWithCathode = false; 00230 }
|
|
fits itself by a default fitter. Error was happened if return value is not zero.
|
|
fits itself by a default fitter. Error was happened if return value is not zero.
|
|
returns true if fitted.
|
|
returns true if fitted.
00220 {
00221 return _fitted;
00222 }
|
|
returns true if fitted with cathode hits(TEMPORARY).
|
|
returns true if fitted with cathode hits(TEMPORARY).
00241 {
00242 return _fittedWithCathode;
00243 }
|
|
sets a default fitter.
|
|
returns a pointer to a default fitter.
|
|
sets a default fitter.
|
|
returns a pointer to a default fitter.
00253 {
00254 return _fitter;
00255 }
|
|
make the trajectory in cache, return the number of step
|
|
make the trajectory in cache, return the number of step
00760 { 00761 double y[6]; 00762 unsigned Nstep; 00763 double flightlength; 00764 00765 flightlength=0; 00766 SetFirst(y); 00767 for(Nstep=0;Nstep<TRunge_MAXstep;Nstep++){ 00768 for(unsigned j=0;j<6;j++) _y[Nstep][j]=y[j]; 00769 //memcpy(_y[Nstep],y,sizeof(double)*6); 00770 00771 Propagate(y,_stepSize); 00772 00773 if( y[2]>160 || y[2]<-80 || (y[0]*y[0]+y[1]*y[1])>8100 ) break; 00774 //if position is out side of MDC, stop to fly 00775 // R>90cm, z<-80cm,160cm<z 00776 00777 flightlength += _stepSize; 00778 if(flightlength>_maxflightlength) break; 00779 00780 _h[Nstep]=_stepSize; 00781 } 00782 _Nstep=Nstep+1; 00783 return(_Nstep); 00784 }
|
|
|
|
01017 {//fly the particle track with stepsize control 01018 double y[6],dydx[6],yscal[6]; 01019 unsigned Nstep; 01020 double step,stepdid,stepnext; 01021 unsigned i; 01022 double flightlength; 01023 01024 //yscal[0]=0.1; //1mm -> error = 1mm*EPS 01025 //yscal[1]=0.1; //1mm 01026 //yscal[2]=0.1; //1mm 01027 //yscal[3]=0.001; //1MeV 01028 //yscal[4]=0.001; //1MeV 01029 //yscal[5]=0.001; //1MeV 01030 01031 step=default_stepSize0; 01032 flightlength=0; 01033 SetFirst(y); 01034 for(Nstep=0;Nstep<TRunge_MAXstep;Nstep++){ 01035 for(i=0;i<6;i++) _y[Nstep][i]=y[i]; // save each step 01036 //memcpy(_y[Nstep],y,sizeof(double)*6); 01037 01038 Function(y,dydx); 01039 //for(i=0;i<6;i++) yscal[i]=abs(y[i])+abs(dydx[i]*step)+TINY; 01040 01041 Propagate_QC(y,dydx,step,_eps,_yscal,stepdid,stepnext); 01042 01043 if( y[2]>160 || y[2]<-80 || (y[0]*y[0]+y[1]*y[1])>8100 ) break; 01044 //if position is out side of MDC, stop to fly 01045 // R>90cm, z<-80cm,160cm<z 01046 01047 flightlength += stepdid; 01048 if(flightlength>_maxflightlength) break; 01049 01050 _h[Nstep]=stepdid; 01051 //cout<<"TR:"<<Nstep<<":step="<<stepdid<<endl; 01052 if(stepnext<_stepSizeMin) step=_stepSizeMin; 01053 else if(stepnext>_stepSizeMax) step=_stepSizeMax; 01054 else step=stepnext; 01055 } 01056 _Nstep=Nstep+1; 01057 //cout<<"TR: Nstep="<<_Nstep<<endl; 01058 return(_Nstep); 01059 }
|
|
|
|
00838 { 00839 // return the value of formula 00840 // y[6] = (x,y,z,px,py,pz) 00841 // f[6] = ( dx[3]/ds, dp[3]/ds ) 00842 // dx/ds = p/|p| 00843 // dp/ds = e/|e| 1/alpha (p x B)/|p||B| 00844 // alpha = 1/cB = 333.5640952/B[Tesla] [cm/(GeV/c)] 00845 // const float Bx = _bfield->bx(y[0],y[1],y[2]); 00846 // const float By = _bfield->by(y[0],y[1],y[2]); 00847 // const float Bz = _bfield->bz(y[0],y[1],y[2]); //[kGauss] 00848 float B[3]; 00849 //const float B[3]={0,0,15.0}; 00850 float pos[3]; 00851 double pmag; 00852 double factor; 00853 00854 pos[0]=(float)y[0]; 00855 pos[1]=(float)y[1]; 00856 pos[2]=(float)y[2]; 00857 //cout<<"TR::pos="<<pos[0]<<","<<pos[1]<<","<<pos[2]<<endl; 00858 _bfield->fieldMap(pos,B); 00859 //cout<<"TR::B="<<B[0]<<","<<B[1]<<","<<B[2]<<endl; 00860 // const double Bmag = sqrt(Bx*Bx+By*By+Bz*Bz); 00861 00862 pmag = sqrt(y[3]*y[3]+y[4]*y[4]+y[5]*y[5]); 00863 f[0] = y[3]/pmag; // p/|p| 00864 f[1] = y[4]/pmag; 00865 f[2] = y[5]/pmag; 00866 00867 // const factor = _charge/(alpha2/Bmag)/pmag/Bmag; 00868 // factor = ((double)_charge)/alpha2/10.; //[(GeV/c)/(cm kG)] 00869 factor = ((double)_charge)/(333.564095/(-1000*(m_pmgnIMF->getReferField())))/10.; //[(GeV/c)/(cm kG)] 00870 // f[3] = factor*(f[1]*Bz-f[2]*By); 00871 // f[4] = factor*(f[2]*Bx-f[0]*Bz); 00872 // f[5] = factor*(f[0]*By-f[1]*Bx); 00873 f[3] = factor*(f[1]*B[2]-f[2]*B[1]); 00874 f[4] = factor*(f[2]*B[0]-f[0]*B[2]); 00875 f[5] = factor*(f[0]*B[1]-f[1]*B[0]); 00876 }
|
|
|
|
00905 { 00906 if(stepNum>=_Nstep || stepNum>=TRunge_MAXstep) return(-1); 00907 step=_h[stepNum]; 00908 return(0); 00909 }
|
|
|
|
00899 { 00900 if(stepNum>=_Nstep || stepNum>=TRunge_MAXstep) return(-1); 00901 00902 for(unsigned i=0;i<6;i++) y[i]=_y[stepNum][i]; 00903 return(0); 00904 }
|
|
returns helix class
|
|
returns helix class
00201 { 00202 return(Helix(_pivot,_a,_Ea)); 00203 }
|
|
returns TTrackHEP.
|
|
returns TTrackHEP.
00380 { 00381 unsigned n = _links.length(); 00382 CAList<TTrackHEP> hepList; 00383 CList<unsigned> hepCounter; 00384 for (unsigned i = 0; i < n; i++) { 00385 const TTrackHEP * hep = _links[i]->hit()->mc()->hep(); 00386 unsigned nH = hepList.length(); 00387 bool found = false; 00388 for (unsigned j = 0; j < nH; j++) { 00389 if (hepList[j] == hep) { 00390 found = true; 00391 ++(* hepCounter[j]); 00392 } 00393 } 00394 00395 if (! found) { 00396 hepList.append(hep); 00397 unsigned c = 0; 00398 hepCounter.append(c); 00399 } 00400 } 00401 00402 _nHeps = hepList.length(); 00403 _hep = 0; 00404 unsigned max = 0; 00405 for (unsigned i = 0; i < _nHeps; i++) { 00406 if ((* hepCounter[i]) > max) { 00407 max = (* hepCounter[i]); 00408 _hep = hepList[i]; 00409 } 00410 } 00411 00412 return _hep; 00413 }
|
|
|
|
00177 { 00178 return(_a[2]); 00179 }
|
|
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
|
|
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
00270 { 00271 if (mask == 0) return _links; 00272 00273 std::cout << "TTrackBase::links !!! mask is not supportted yet" << std::endl; 00274 return _links; 00275 }
|
|
set mass for tof calc.
|
|
return mass
|
|
set mass for tof calc.
|
|
return mass
00242 {
00243 return(_mass);
00244 }
|
|
|
|
return max flight length
|
|
00316 { 00317 if(length>0) _maxflightlength=length; 00318 else _maxflightlength=default_maxflightlength; 00319 _Nstep=0; 00320 return(_maxflightlength); 00321 }
|
|
return max flight length
00246 {
00247 return(_maxflightlength);
00248 }
|
|
returns a pointer to TTrackMC.
|
|
returns a pointer to TTrackMC.
00247 {
00248 return _mc;
00249 }
|
|
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
|
|
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
00298 { 00299 if (mask) 00300 std::cout << "TTrackBase::nCores !!! mask is not supported" << std::endl; 00301 if (! _updated) update(); 00302 return _cores.length(); 00303 }
|
|
returns NDF
|
|
returns NDF
00205 {
00206 return _ndf;
00207 }
|
|
returns # of contributed TTrackHEP tracks.
|
|
returns # of contributed TTrackHEP tracks.
00416 { 00417 hep(); 00418 return _nHeps; 00419 }
|
|
returns # of masked TMLinks assigned to this track object.
|
|
returns # of masked TMLinks assigned to this track object.
00278 { 00279 unsigned n = _links.length(); 00280 if (mask == 0) return n; 00281 unsigned nn = 0; 00282 for (unsigned i = 0; i < n; i++) { 00283 const TMDCWireHit & h = * _links[i]->hit(); 00284 if (h.state() & mask) ++nn; 00285 } 00286 return nn; 00287 }
|
|
access to trajectory cache
|
|
access to trajectory cache
00895 {
00896 return(_Nstep);
00897 }
|
|
returns object type
Reimplemented from TTrackBase. |
|
returns object type
Reimplemented from TTrackBase. 00247 {
00248 return Runge;
00249 }
|
|
|
|
00235 { 00236 return _links[i]; 00237 }
|
|
|
|
00173 { 00174 return(_a[1]); 00175 }
|
|
set new pivot
|
|
pivot position
|
|
set new pivot !!!!! under construction !!!!! track parameter should be extracted after track propagation. 00250 { 00253 Helix tHelix(helix()); 00254 tHelix.pivot(newpivot); 00255 _pivot=newpivot; 00256 _a=tHelix.a(); 00257 _Ea=tHelix.Ea(); 00258 _Nstep=0; 00259 return(_pivot); 00260 }
|
|
pivot position
00189 {
00190 return(_pivot);
00191 }
|
|
propagate the track using 4th-order Runge-Kutta method
|
|
propagate the track using 4th-order Runge-Kutta method
00786 { 00787 // y[6] = (x,y,z,px,py,pz) 00788 double f1[6],f2[6],f3[6],f4[6],yt[6]; 00789 double hh; 00790 double h6; 00791 unsigned i; 00792 00793 hh = step*0.5; 00794 //cout<<"TR:Pro hh="<<hh<<endl; 00795 Function(y,f1); 00796 for(i=0;i<6;i++) yt[i]=y[i]+hh*f1[i]; 00797 //{ 00798 // register double *a=y; 00799 // register double *b=f1; 00800 // register double *t=yt; 00801 // register double *e=y+6; 00802 // for(;a<e;a++,b++,t++) (*t)=(*a)+hh*(*b); 00803 //} 00804 Function(yt,f2); 00805 for(i=0;i<6;i++) yt[i]=y[i]+hh*f2[i]; 00806 //{ 00807 // register double *a=y; 00808 // register double *b=f2; 00809 // register double *t=yt; 00810 // register double *e=y+6; 00811 // for(;a<e;a++,b++,t++) (*t)=(*a)+hh*(*b); 00812 //} 00813 Function(yt,f3); 00814 for(i=0;i<6;i++) yt[i]=y[i]+step*f3[i]; 00815 //{ 00816 // register double *a=y; 00817 // register double *b=f3; 00818 // register double *t=yt; 00819 // register double *e=y+6; 00820 // for(;a<e;a++,b++,t++) (*t)=(*a)+step*(*b); 00821 //} 00822 Function(yt,f4); 00823 00824 h6 = step/6; 00825 for(i=0;i<6;i++) y[i]+=h6*(f1[i]+2*f2[i]+2*f3[i]+f4[i]); 00826 //{ 00827 // register double *a=f1; 00828 // register double *b=f2; 00829 // register double *c=f3; 00830 // register double *d=f4; 00831 // register double *t=y; 00832 // register double *e=y+6; 00833 // for(;t<e;a++,b++,c++,d++,t++) 00834 // (*t)+=h6*((*a)+2*(*b)+2*(*c)+(*d)); 00835 //} 00836 }
|
|
|
|
00912 { 00913 // y[6] = (x,y,z,px,py,pz) 00914 double f2[6],f3[6],f4[6],yt[6]; 00915 double hh; 00916 double h6; 00917 unsigned i; 00918 00919 hh = step*0.5; 00920 for(i=0;i<6;i++) yt[i]=y[i]+hh*dydx[i]; // 1st step 00921 //{ 00922 // const register double *a=y; 00923 // const register double *b=dydx; 00924 // register double *t=yt; 00925 // const register double *e=y+6; 00926 // for(;a<e;a++,b++,t++) (*t)=(*a)+hh*(*b); 00927 //} 00928 Function(yt,f2); // 2nd step 00929 for(i=0;i<6;i++) yt[i]=y[i]+hh*f2[i]; 00930 //{ 00931 // const register double *a=y; 00932 // const register double *b=f2; 00933 // register double *t=yt; 00934 // const register double *e=y+6; 00935 // for(;a<e;a++,b++,t++) (*t)=(*a)+hh*(*b); 00936 //} 00937 Function(yt,f3); // 3rd step 00938 for(i=0;i<6;i++) yt[i]=y[i]+step*f3[i]; 00939 //{ 00940 // const register double *a=y; 00941 // const register double *b=f3; 00942 // register double *t=yt; 00943 // const register double *e=y+6; 00944 // for(;a<e;a++,b++,t++) (*t)=(*a)+step*(*b); 00945 //} 00946 Function(yt,f4); // 4th step 00947 00948 h6 = step/6; 00949 for(i=0;i<6;i++) yout[i]=y[i]+h6*(dydx[i]+2*f2[i]+2*f3[i]+f4[i]); 00950 //{ 00951 // const register double *a=dydx; 00952 // const register double *b=f2; 00953 // const register double *c=f3; 00954 // const register double *d=f4; 00955 // const register double *e=y; 00956 // register double *t=yout; 00957 // const register double *s=yout+6; 00958 // for(;t<s;a++,b++,c++,d++,e++,t++) 00959 // (*t)=(*e)+h6*((*a)+2*(*b)+2*(*c)+(*d)); 00960 //} 00961 }
|
|
|
|
00970 { 00971 //propagate with quality check, step will be scaled automatically 00972 double ysav[6],dysav[6],ytemp[6]; 00973 double h,hh,errmax,temp; 00974 unsigned i; 00975 00976 for(i=0;i<6;i++) ysav[i]=y[i]; 00977 //memcpy(ysav,y,sizeof(double)*6); 00978 for(i=0;i<6;i++) dysav[i]=dydx[i]; 00979 //memcpy(dysav,dydx,sizeof(double)*6); 00980 00981 h=steptry; 00982 for(;;){ 00983 hh=h*0.5; // 2 half step 00984 Propagate1(ysav,dysav,hh,ytemp); 00985 Function(ytemp,dydx); 00986 Propagate1(ytemp,dydx,hh,y); 00987 //if check step size 00988 Propagate1(ysav,dysav,h,ytemp); // 1 full step 00989 // error calculation 00990 errmax=0.0; 00991 for(i=0;i<6;i++){ 00992 ytemp[i]=y[i]-ytemp[i]; 00993 temp=fabs(ytemp[i]/yscal[i]); 00994 if(errmax < temp) errmax=temp; 00995 } 00996 //cout<<"TR: errmax="<<errmax<<endl; 00997 errmax/=eps; 00998 if(errmax <= 1.0){ // step O.K. calc. for next step 00999 stepdid=h; 01000 stepnext=(errmax>ERRCON ? SAFETY*h*exp(PGROW*log(errmax)) : 4.0*h); 01001 break; 01002 } 01003 h=SAFETY*h*exp(PSHRNK*log(errmax)); 01004 } 01005 for(i=0;i<6;i++) y[i]+=ytemp[i]*FCOR; 01006 //{ 01007 // register double *a=ytemp; 01008 // register double *t=y; 01009 // register double *e=y+6; 01010 // for(;t<e;a++,t++) (*t)+=(*a)*FCOR; 01011 //} 01012 01013 }
|
|
returns reduced-chi2
|
|
returns reduced-chi2
00213 { 00214 if(_ndf==0){ 00215 std::cout<<"error at TRunge::reducedchi2 ndf=0"<<std::endl; 00216 return 0; 00217 } 00218 return (_chi2/_ndf); 00219 }
|
|
removes bad points by pull. The bad points are masked not to be used in fit.
|
|
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
|
|
removes bad points by pull. The bad points are masked not to be used in fit.
00194 { 00195 AList<TMLink> bad = refineMain(sigma); 00196 // for (unsigned i = 0; i < bad.length(); i++) { 00197 // const TMDCWireHit * hit = bad[i]->hit(); 00198 // hit->state(hit->state() | WireHitInvalidForFit); 00199 // } 00200 00201 #ifdef TRKRECO_DEBUG_DETAIL 00202 std::cout << " refine ... sigma=" << sigma << std::endl; 00203 Dump(bad, "detail sort", " "); 00204 #endif 00205 00206 if (bad.length()) { 00207 _fitted = false; 00208 _updated = false; 00209 } 00210 }
|
|
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
00170 { 00171 AList<TMLink> bad = refineMain(sigma); 00172 #ifdef TRKRECO_DEBUG 00173 std::cout << " refine ... sigma=" << sigma << ", # of rejected hits="; 00174 std::cout << bad.length() << std::endl; 00175 #endif 00176 #ifdef TRKRECO_DEBUG 00177 Dump(bad, "sort pull mc", " "); 00178 #endif 00179 00180 if (bad.length()) { 00181 _links.remove(bad); 00182 list.append(bad); 00183 _fitted = false; 00184 _updated = false; 00185 } 00186 }
|
|
removes TMLinks.
|
|
removes a TMLink.
|
|
removes TMLinks.
00211 { 00212 _links.remove(a); 00213 _updated = false; 00214 _fitted = false; 00215 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 ) 00216 }
|
|
removes a TMLink.
00202 { 00203 _links.remove(a); 00204 _updated = false; 00205 _fitted = false; 00206 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 ) 00207 }
|
|
|
|
00189 { 00190 _links.removeAll(); 00191 }
|
|
set first point (position, momentum) s=0, phi=0
|
|
set first point (position, momentum) s=0, phi=0
00878 { 00879 // y[6] = (x,y,z,px,py,pz) 00880 const double cosPhi0=cos(_a[1]); 00881 const double sinPhi0=sin(_a[1]); 00882 const double invKappa=1/abs(_a[2]); 00883 00884 y[0]= _pivot.x()+_a[0]*cosPhi0; //x 00885 y[1]= _pivot.y()+_a[0]*sinPhi0; //y 00886 y[2]= _pivot.z()+_a[3]; //z 00887 y[3]= -sinPhi0*invKappa; //px 00888 y[4]= cosPhi0*invKappa; //py 00889 y[5]= _a[4]*invKappa; //pz 00890 }
|
|
set flight length using wire hits
|
|
set flight length using wire hits
01061 { 01062 01063 // get a list of links to a wire hit 01064 const AList<TMLink>& cores=this->cores(); 01065 //cout<<"TR:: cores.length="<<cores.length()<<endl; 01066 01067 const Helix hel(this->helix()); 01068 double tanl=hel.tanl(); 01069 //double curv=hel.curv(); 01070 //double rho = Helix::ConstantAlpha / hel.kappa(); 01071 // double rho = 333.564095 / hel.kappa(); 01072 double rho = 333.564095/(-1000*(m_pmgnIMF->getReferField())) / hel.kappa(); 01073 01074 // search max phi 01075 double phi_max=- DBL_MAX; 01076 double phi_min= DBL_MAX; 01077 // loop over link 01078 for(int j=0;j<cores.length();j++){ 01079 TMLink& l=*cores[j]; 01080 // fitting valid? 01081 const TMDCWire& wire=*l.wire(); 01082 double Wz=0; 01083 //double mindist; 01084 HepPoint3D onWire; 01085 HepPoint3D dummy_bP; 01086 HepVector3D dummy_dir; 01087 Helix th(hel); 01088 for(int i=0;i<10;i++){ 01089 wire.wirePosition(Wz,onWire,dummy_bP,dummy_dir); 01090 th.pivot(onWire); 01091 if(abs(th.dz())<0.1){ //<1mm 01092 //mindist=abs(hel.dr()); 01093 break; 01094 } 01095 Wz+=th.dz(); 01096 } 01097 //onWire is closest point , th.x() is closest point on trk 01098 //Wz is z position of closest point 01099 //Z->dphi 01100 /* 01101 // Calculate position (x,y,z) along helix. 01102 // x = x0 + dr * cos(phi0) + (alpha / kappa) * (cos(phi0) - cos(phi0+phi)) 01103 // y = y0 + dr * sin(phi0) + (alpha / kappa) * (sin(phi0) - sin(phi0+phi)) 01104 // z = z0 + dz - (alpha / kappa) * tan(lambda) * phi 01105 cout<<"TR:: Wz="<<Wz<<" tanl="<<tanl<<endl; 01106 double phi=( hel.pivot().z()+hel.dz()-Wz )/( curv*tanl ); 01107 */ 01108 //...Cal. dPhi to rotate... 01109 const HepPoint3D & xc = hel.center(); 01110 const HepPoint3D & xt = hel.x(); 01111 HepVector3D v0, v1; 01112 v0 = xt - xc; 01113 v1 = th.x() - xc; 01114 const double vCrs = v0.x() * v1.y() - v0.y() * v1.x(); 01115 const double vDot = v0.x() * v1.x() + v0.y() * v1.y(); 01116 double phi = atan2(vCrs, vDot); 01117 01118 double tz=hel.x(phi).z(); 01119 //cout<<"TR:: Wz="<<Wz<<" tz="<<tz<<endl; 01120 01121 if(phi>phi_max) phi_max=phi; 01122 if(phi<phi_min) phi_min=phi; 01123 //cout<<"TR:: phi="<<phi<<endl; 01124 } 01125 //cout<<"TR:: phi_max="<<phi_max<<" phi_min="<<phi_min 01126 // <<" rho="<<rho<<" tanl="<<tanl<<endl; 01127 //phi->length, set max filght length 01128 //tanl*=1.2; // for mergin 01129 _maxflightlength= 01130 abs( rho*(phi_max-phi_min)*sqrt(1+tanl*tanl) )*1.2; //x1.1 mergin 01131 01132 return(_maxflightlength); 01133 }
|
|
set step size to calc. trajectory
|
|
returns step size
|
|
set step size to calc. trajectory
|
|
returns step size
00225 {
00226 return(_stepSize);
00227 }
|
|
|
|
|
|
00299 { 00300 _stepSizeMax=step; 00301 _Nstep=0; 00302 return(_stepSizeMax); 00303 }
|
|
00235 {
00236 return(_stepSizeMax);
00237 }
|
|
|
|
|
|
00304 { 00305 _stepSizeMin=step; 00306 _Nstep=0; 00307 return(_stepSizeMin); 00308 }
|
|
00238 {
00239 return(_stepSizeMin);
00240 }
|
|
|
|
00185 { 00186 return(_a[4]); 00187 }
|
|
|
|
returns # of good hits to be appended.
|
|
00213 { 00214 #ifdef TRKRECO_DEBUG_DETAIL 00215 std::cout << " TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl; 00216 #endif 00217 00218 unsigned nOK = 0; 00219 unsigned n = list.length(); 00220 for (unsigned i = 0; i < n; i++) { 00221 TMLink & l = * list[i]; 00222 nOK += testByApproach(l, maxSigma); 00223 } 00224 return nOK; 00225 }
|
|
returns # of good hits to be appended.
00228 { 00229 #ifdef TRKRECO_DEBUG_DETAIL 00230 std::cout << " TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl; 00231 #endif 00232 TMLink l = link; 00233 00234 //...Calculate closest approach... 00235 int err = approach(l); 00236 if (err < 0) return 0; 00237 //...Calculate sigma... 00238 float distance = l.distance(); 00239 float diff = fabs(distance - l.hit()->drift()); 00240 float sigma = diff / l.hit()->dDrift(); 00241 l.pull(sigma * sigma); 00242 00243 //...For debug... 00244 #ifdef TRKRECO_DEBUG_DETAIL 00245 std::cout << " sigma=" << sigma; 00246 std::cout << ",dist=" << distance; 00247 std::cout << ",diff=" << diff << ","; 00248 if (sigma < maxSigma) std::cout << "ok,"; 00249 else std::cout << "X,"; 00250 l.dump("mc"); 00251 #endif 00252 00253 //...Make sigma cut... 00254 if (sigma < maxSigma) return 1; 00255 00256 return 0; 00257 }
|
|
returns type. Definition is depending on an object class.
|
|
returns type. Definition is depending on an object class.
Reimplemented in TTrack, and TTrack. 00272 {
00273 return 0;
00274 }
|
|
update cache.
Reimplemented in TSegment, TSegment0, TSegment, and TSegment0. |
|
update cache.
Reimplemented in TSegment, TSegment0, TSegment, and TSegment0. 00075 { 00076 _cores.removeAll(); 00077 unsigned n = _links.length(); 00078 for (unsigned i = 0; i < n; i++) { 00079 TMLink * l = _links[i]; 00080 const TMDCWireHit & h = * l->hit(); 00081 if (h.state() & WireHitInvalidForFit) continue; 00082 if (! (h.state() & WireHitFittingValid)) continue; 00083 _cores.append(l); 00084 } 00085 _updated = true; 00086 }
|
|
set error parameters for fitting with step size control
|
|
return error parameters for fitting with step size control
|
|
set error parameters for fitting with step size control
|
|
return error parameters for fitting with step size control
00229 {
00230 return(_yscal);
00231 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reimplemented from TTrackBase. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|