#include <TTrack.h>
Inheritance diagram for TTrack:
Public Member Functions | |
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. | |
int | approach (TMLink &, bool sagCorrection) const |
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 &, bool sagCorrection) const |
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 | approach2D (TMLink &) const |
int | approach2D (TMLink &) const |
void | assign (unsigned maskForWireHit) |
assigns wire hits to this track. | |
void | assign (unsigned maskForWireHit) |
assigns wire hits to this track. | |
const AList< TMLink > & | associateHits (const AList< TMLink > &hits) |
const AList< TMLink > & | associateHits (void) const |
sets/returns a list of associated TMLink which are used for table output. | |
const AList< TMLink > & | associateHits (const AList< TMLink > &hits) |
const AList< TMLink > & | associateHits (void) const |
sets/returns a list of associated TMLink which are used for table output. | |
TPoint2D | center (void) const |
returns position of helix center. | |
TPoint2D | center (void) const |
returns position of helix center. | |
double | charge (double) |
sets charge. | |
double | charge (void) const |
returns charge. | |
double | charge (double) |
sets charge. | |
double | charge (void) const |
returns charge. | |
double | chi2 (void) const |
returns chi2. | |
double | chi2 (void) const |
returns chi2. | |
double | confidenceLevel (void) const |
returns confidence level. | |
double | confidenceLevel (void) const |
returns confidence level. | |
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. | |
TTrack * | daughter (TTrack *) |
TTrack * | daughter (void) const |
TTrack * | daughter (TTrack *) |
TTrack * | daughter (void) const |
void | deleteListForCurl (AList< HepPoint3D > &l1, AList< HepPoint3D > &l2, AList< HepPoint3D > &l3) const |
void | deleteListForCurl (AList< HepPoint3D > &l1, AList< HepPoint3D > &l2) const |
void | deleteListForCurl (AList< HepPoint3D > &l1, AList< HepPoint3D > &l2, AList< HepPoint3D > &l3) const |
void | deleteListForCurl (AList< HepPoint3D > &l1, AList< HepPoint3D > &l2) const |
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. | |
void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
void | falseFit () |
false Fit | |
void | falseFit () |
false Fit | |
const AList< TMLink > & | finalHits (const AList< TMLink > &hits) |
const AList< TMLink > & | finalHits (void) const |
sets/returns a list of TMLink which are used for table output. | |
const AList< TMLink > & | finalHits (const AList< TMLink > &hits) |
const AList< TMLink > & | finalHits (void) const |
sets/returns a list of TMLink which are used for table output. | |
unsigned | finder (unsigned finderMask) |
unsigned | finder (void) const |
sets/returns finder. | |
unsigned | finder (unsigned finderMask) |
unsigned | finder (void) const |
sets/returns finder. | |
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. | |
int | fit2D (unsigned=0, double=0.1, double=0.015) |
fits itself with r-phi view. Error was happened if return value is not zero. | |
int | fit2D (unsigned=0, double=0.1, double=0.015) |
fits itself with r-phi view. 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 | fitting (unsigned fitMask) |
unsigned | fitting (void) const |
sets/returns fitting status. | |
unsigned | fitting (unsigned fitMask) |
unsigned | fitting (void) const |
sets/returns fitting status. | |
int | HelCyl (double rhole, double rcyl, double zb, double zf, double epsl, double &phi, HepPoint3D &xp) const |
calculates an intersection of this track and a cylinder. | |
int | HelCyl (double rhole, double rcyl, double zb, double zf, double epsl, double &phi, HepPoint3D &xp) const |
calculates an intersection of this track and a cylinder. | |
const Helix & | helix (void) const |
returns helix parameter. | |
const Helix & | helix (void) const |
returns helix parameter. | |
const TTrackHEP *const | hep (void) const |
returns TTrackHEP. | |
const TTrackHEP *const | hep (void) const |
returns TTrackHEP. | |
double | impact (void) const |
returns signed impact parameter to the origin. | |
double | impact (void) const |
returns signed impact parameter to the origin. | |
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. | |
const TTrackMC *const | mc (void) const |
returns a pointer to TTrackMC. | |
const TTrackMC *const | mc (void) const |
returns a pointer to TTrackMC. | |
TTrack * | mother (TTrack *) |
TTrack * | mother (void) const |
sets/returns mother/daughter. | |
TTrack * | mother (TTrack *) |
TTrack * | mother (void) const |
sets/returns mother/daughter. | |
void | movePivot (void) |
moves pivot to the inner most hit. | |
void | movePivot (void) |
moves pivot to the inner most hit. | |
const std::string & | name (const std::string &newName) |
const std::string & | name (void) const |
returns/sets name. | |
const std::string & | name (const std::string &newName) |
const std::string & | name (void) const |
returns/sets name. | |
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 | objectType (void) const |
returns type. | |
unsigned | objectType (void) const |
returns type. | |
TMLink * | operator[] (unsigned i) const |
TMLink * | operator[] (unsigned i) const |
Hep3Vector | p (void) const |
returns momentum. | |
Hep3Vector | p (void) const |
returns momentum. | |
double | pt (void) const |
returns Pt. | |
double | pt (void) const |
returns Pt. | |
double | ptot (void) const |
returns magnitude of momentum. | |
double | ptot (void) const |
returns magnitude of momentum. | |
double | pz (void) const |
returns Pz. | |
double | pz (void) const |
returns Pz. | |
unsigned | quality (unsigned qualityMask) |
unsigned | quality (void) const |
sets/returns quality. | |
unsigned | quality (unsigned qualityMask) |
unsigned | quality (void) const |
sets/returns quality. | |
double | radius (void) const |
returns signed radius. | |
double | radius (void) const |
returns signed radius. | |
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 | refine2D (AList< TMLink > &list, float maxSigma) |
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function. (using stereo wire as axial wire(z=0)) | |
void | refine2D (AList< TMLink > &list, float maxSigma) |
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function. (using stereo wire as axial wire(z=0)) | |
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) |
const AList< TSegment > & | segments (void) const |
AList< TSegment > & | segments (void) |
returns AList<TSegment>. | |
const AList< TSegment > & | segments (void) const |
AList< TSegment > & | segments (void) |
returns AList<TSegment>. | |
unsigned | state (void) const |
returns/sets internal state.(for bank output) | |
unsigned | state (void) const |
returns/sets internal state.(for bank output) | |
int | stereoHitForCurl (AList< TMLink > &) const |
calculates arc length and z for a stereo hit. uses these functions for curl tracks(included svd version). | |
int | stereoHitForCurl (TMLink &link, TMLink &link1, TMLink &link2) const |
int | stereoHitForCurl (TMLink &link, TMLink &link1) const |
int | stereoHitForCurl (TMLink &link, AList< HepPoint3D > &arcZList) const |
int | stereoHitForCurl (AList< TMLink > &) const |
calculates arc length and z for a stereo hit. uses these functions for curl tracks(included svd version). | |
int | stereoHitForCurl (TMLink &link, TMLink &link1, TMLink &link2) const |
int | stereoHitForCurl (TMLink &link, TMLink &link1) const |
int | stereoHitForCurl (TMLink &link, AList< HepPoint3D > &arcZList) const |
int | szPosition (const HepPoint3D &p, HepPoint3D &szPosition) const |
calculates arc length for a point. | |
int | szPosition (const TSegment &segment, TMLink &link) const |
calculates arc length and z for a segment. Results are stored in TMLink. | |
int | szPosition (TMLink &link) const |
calculates arc length and z for a stereo hit. | |
int | szPosition (const HepPoint3D &p, HepPoint3D &szPosition) const |
calculates arc length for a point. | |
int | szPosition (const TSegment &segment, TMLink &link) const |
calculates arc length and z for a segment. Results are stored in TMLink. | |
int | szPosition (TMLink &link) const |
calculates arc length and z for a stereo hit. | |
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. | |
TTrack (const Helix &) | |
Constructor. | |
TTrack (const T3DLine &) | |
Constructor. | |
TTrack (const TTrack &) | |
Copy constructor. | |
TTrack (const TCircle &) | |
Constructor. | |
TTrack () | |
Default constructor. | |
TTrack (const Helix &) | |
Constructor. | |
TTrack (const T3DLine &) | |
Constructor. | |
TTrack (const TTrack &) | |
Copy constructor. | |
TTrack (const TCircle &) | |
Constructor. | |
TTrack () | |
Default constructor. | |
unsigned | type (void) const |
returns type. Definition is depending on an object type. | |
unsigned | type (void) const |
returns type. Definition is depending on an object type. | |
void | update (void) const |
update cache. | |
void | update (void) const |
update cache. | |
virtual | ~TTrack () |
Destructor. | |
virtual | ~TTrack () |
Destructor. | |
Protected Attributes | |
bool | _fitted |
bool | _fittedWithCathode |
AList< TMLink > | _links |
AList< TMLink > | _links |
TTrackMC * | _mc |
TTrackMC * | _mc |
Private Member Functions | |
unsigned | defineType (void) const |
unsigned | defineType (void) const |
int | dxda (const TMLink &link, double dPhi, Vector &dxda, Vector &dyda, Vector &dzda) const |
calculates dXda. 'link' and 'dPhi' are inputs. Others are outputs. | |
int | dxda (const TMLink &link, double dPhi, Vector &dxda, Vector &dyda, Vector &dzda) const |
calculates dXda. 'link' and 'dPhi' are inputs. Others are outputs. | |
int | dxda2D (double dPhi, Vector &dxda, Vector &dyda) const |
int | dxda2D (const TMLink &link, double dPhi, Vector &dxda, Vector &dyda) const |
int | dxda2D (const TMLink &link, double dPhi, Vector &dxda, Vector &dyda, Vector &dzda) const |
int | dxda2D (double dPhi, Vector &dxda, Vector &dyda) const |
int | dxda2D (const TMLink &link, double dPhi, Vector &dxda, Vector &dyda) const |
int | dxda2D (const TMLink &link, double dPhi, Vector &dxda, Vector &dyda, Vector &dzda) const |
Private Attributes | |
AList< TMLink > | _associateHits |
AList< TMLink > | _associateHits |
double | _charge |
double | _chi2 |
TTrack * | _daughter |
TTrack * | _daughter |
AList< TMLink > | _finalHits |
AList< TMLink > | _finalHits |
Helix *const | _helix |
Helix *const | _helix |
TTrack * | _mother |
TTrack * | _mother |
std::string | _name |
unsigned | _ndf |
AList< TSegment > | _segments |
AList< TSegment > | _segments |
unsigned | _state |
unsigned | _type |
IMagneticFieldSvc * | m_pmgnIMF |
IMagneticFieldSvc * | m_pmgnIMF |
Static Private Attributes | |
const THelixFitter | _fitter = THelixFitter("TTrack Default Helix Fitter") |
Friends | |
class | Refit |
class | TBuilder |
class | TBuilder0 |
class | TBuilderCosmic |
class | TBuilderCurl |
class | TCosmicFitter |
class | TCurlFinder |
class | THelixFitter |
class | TPMCurlFinder |
class | TrkReco |
class | TTrackManager |
|
Default constructor.
00192 : TTrackBase(), 00193 _charge(1.), 00194 _helix(new Helix(ORIGIN, Vector(5, 0), SymMatrix(5, 0))), 00195 _ndf(0), 00196 _chi2(0.), 00197 _name("empty track"), 00198 _state(0), 00199 _mother(0), 00200 _daughter(0) { 00201 //jialk 00202 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00203 if(scmgn!=StatusCode::SUCCESS) { 00204 std::cout<< "Unable to open Magnetic field service"<<std::endl; 00205 } 00206 }
|
|
Constructor.
00082 : TTrackBase(c.links()), 00083 _helix(new Helix(ORIGIN, Vector(5, 0), SymMatrix(5, 0))), 00084 _charge(c.charge()), 00085 _ndf(0), 00086 _chi2(0.), 00087 _name("none"), 00088 _type(0), 00089 _state(0), 00090 _mother(0), 00091 _daughter(0) { 00092 00093 //jialk 00094 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00095 if(scmgn!=StatusCode::SUCCESS) { 00096 std::cout<< "Unable to open Magnetic field service"<<std::endl; 00097 } 00098 //cout<<"TTrack: "<<m_pmgnIMF->getReferField()<<endl; 00099 //...Set a defualt fitter... 00100 fitter(& TTrack::_fitter); 00101 00102 //...Calculate helix parameters... 00103 Vector a(5); 00104 a[1] = fmod(atan2(_charge * (c.center().y() - ORIGIN.y()), 00105 _charge * (c.center().x() - ORIGIN.x())) 00106 + 4. * M_PI, 00107 2. * M_PI); 00108 // a[2] = Helix::ConstantAlpha / c.radius(); 00109 // a[2] = 333.564095 / c.radius(); 00110 a[2] = 333.564095/(-1000*(m_pmgnIMF->getReferField())) / c.radius(); 00111 a[0] = (c.center().x() - ORIGIN.x()) / cos(a[1]) - c.radius(); 00112 a[3] = 0.; 00113 a[4] = 0.; 00114 _helix->a(a); 00115 00116 //...Update links... 00117 unsigned n = _links.length(); 00118 for (unsigned i = 0; i < n; i++) 00119 _links[i]->track(this); 00120 00121 _fitted = false; 00122 _fittedWithCathode = false; 00123 /* 00124 //jialk 00125 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00126 if(scmgn!=StatusCode::SUCCESS) { 00127 std::cout<< "Unable to open Magnetic field service"<<std::endl; 00128 } 00129 */ 00130 }
|
|
Copy constructor.
00133 : TTrackBase((TTrackBase &) a), 00134 _charge(a._charge), 00135 _segments(a._segments), 00136 _helix(new Helix(* a._helix)), 00137 _ndf(a._ndf), 00138 _chi2(a._chi2), 00139 _name("copy of " + a._name), 00140 _type(a._type), 00141 // _catHits(a._catHits), 00142 _state(a._state), 00143 _mother(a._mother), 00144 _daughter(a._daughter) { 00145 //jialk 00146 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00147 if(scmgn!=StatusCode::SUCCESS) { 00148 std::cout<< "Unable to open Magnetic field service"<<std::endl; 00149 } 00150 }
|
|
Constructor.
|
|
Constructor.
00166 : TTrackBase(), 00167 _helix(new Helix(h)), 00168 _ndf(0), 00169 _chi2(0.), 00170 _name("none"), 00171 _type(0), 00172 _state(0), 00173 _mother(0), 00174 _daughter(0) { 00175 00176 //...Set a defualt fitter... 00177 fitter(& TTrack::_fitter); 00178 00179 if(_helix->kappa() > 0.)_charge = 1.; 00180 else _charge = -1.; 00181 00182 _fitted = false; 00183 _fittedWithCathode = false; 00184 //jialk 00185 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00186 if(scmgn!=StatusCode::SUCCESS) { 00187 std::cout<< "Unable to open Magnetic field service"<<std::endl; 00188 } 00189 }
|
|
Destructor.
00208 {
00209 delete _helix;
00210 }
|
|
Default constructor.
|
|
Constructor.
|
|
Copy constructor.
|
|
Constructor.
|
|
Constructor.
|
|
Destructor.
|
|
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 from TTrackBase. |
|
03038 { 03039 //...Cal. dPhi to rotate... 03040 const TMDCWire & w = * link.wire(); 03041 double wp[3]; w.xyPosition(wp); 03042 double wb[3]; w.backwardPosition(wb); 03043 double v[3]; 03044 v[0] = w.direction().x(); 03045 v[1] = w.direction().y(); 03046 v[2] = w.direction().z(); 03047 03048 //...Sag correction... 03049 if (doSagCorrection) { 03050 HepVector3D dir = w.direction(); 03051 HepPoint3D xw(wp[0], wp[1], wp[2]); 03052 HepPoint3D wireBackwardPosition(wb[0], wb[1], wb[2]); 03053 w.wirePosition(link.positionOnTrack().z(), 03054 xw, 03055 wireBackwardPosition, 03056 dir); 03057 v[0] = dir.x(); 03058 v[1] = dir.y(); 03059 v[2] = dir.z(); 03060 wp[0] = xw.x(); 03061 wp[1] = xw.y(); 03062 wp[2] = xw.z(); 03063 wb[0] = wireBackwardPosition.x(); 03064 wb[1] = wireBackwardPosition.y(); 03065 wb[2] = wireBackwardPosition.z(); 03066 } 03067 03068 //...Cal. dPhi to rotate... 03069 const HepPoint3D & xc = _helix->center(); 03070 double xt[3]; _helix->x(0., xt); 03071 double x0 = - xc.x(); 03072 double y0 = - xc.y(); 03073 double x1 = wp[0] + x0; 03074 double y1 = wp[1] + y0; 03075 x0 += xt[0]; 03076 y0 += xt[1]; 03077 double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1); 03078 03079 //...Setup... 03080 double kappa = _helix->kappa(); 03081 double phi0 = _helix->phi0(); 03082 03083 //...Axial case... 03084 if (w.axial()) { 03085 link.positionOnTrack(_helix->x(dPhi)); 03086 HepPoint3D x(wp[0], wp[1], wp[2]); 03087 x.setZ(link.positionOnTrack().z()); 03088 link.positionOnWire(x); 03089 link.dPhi(dPhi); 03090 return 0; 03091 } 03092 03093 #ifdef TRKRECO_DEBUG 03094 double firstdfdphi = 0.; 03095 static bool first = true; 03096 if (first) { 03097 // extern BelleTupleManager * BASF_Histogram; 03098 // BelleTupleManager * m = BASF_Histogram; 03099 // h_nTrial = m->histogram("TTrack::approach nTrial", 100, 0., 100.); 03100 } 03101 #endif 03102 03103 //...Stereo case... 03104 // double rho = Helix::ConstantAlpha / kappa; 03105 // double rho = 333.564095 / kappa; 03106 double rho = 333.564095/(-1000*(m_pmgnIMF->getReferField())) / kappa; 03107 03108 double tanLambda = _helix->tanl(); 03109 static Vector x(3); 03110 double t_x[3]; 03111 double t_dXdPhi[3]; 03112 const double convergence = 1.0e-5; 03113 double l; 03114 unsigned nTrial = 0; 03115 while (nTrial < 100) { 03116 03117 x = link.positionOnTrack(_helix->x(dPhi)); 03118 t_x[0] = x[0]; 03119 t_x[1] = x[1]; 03120 t_x[2] = x[2]; 03121 03122 l = v[0] * t_x[0] + v[1] * t_x[1] + v[2] * t_x[2] 03123 - v[0] * wb[0] - v[1] * wb[1] - v[2] * wb[2]; 03124 03125 double rcosPhi = rho * cos(phi0 + dPhi); 03126 double rsinPhi = rho * sin(phi0 + dPhi); 03127 t_dXdPhi[0] = rsinPhi; 03128 t_dXdPhi[1] = - rcosPhi; 03129 t_dXdPhi[2] = - rho * tanLambda; 03130 03131 //...f = d(Distance) / d phi... 03132 double t_d2Xd2Phi[2]; 03133 t_d2Xd2Phi[0] = rcosPhi; 03134 t_d2Xd2Phi[1] = rsinPhi; 03135 03136 //...iw new... 03137 double n[3]; 03138 n[0] = t_x[0] - wb[0]; 03139 n[1] = t_x[1] - wb[1]; 03140 n[2] = t_x[2] - wb[2]; 03141 03142 double a[3]; 03143 a[0] = n[0] - l * v[0]; 03144 a[1] = n[1] - l * v[1]; 03145 a[2] = n[2] - l * v[2]; 03146 double dfdphi = a[0] * t_dXdPhi[0] 03147 + a[1] * t_dXdPhi[1] 03148 + a[2] * t_dXdPhi[2]; 03149 03150 #ifdef TRKRECO_DEBUG 03151 if (nTrial == 0) { 03152 // break; 03153 firstdfdphi = dfdphi; 03154 } 03155 03156 //...Check bad case... 03157 if (nTrial > 3) { 03158 std::cout << "TTrack::approach ... " << w.name() << " " 03159 << "dfdphi(0)=" << firstdfdphi 03160 << ",(" << nTrial << ")=" << dfdphi << endl; 03161 } 03162 #endif 03163 03164 //...Is it converged?... 03165 if (fabs(dfdphi) < convergence) 03166 break; 03167 03168 double dv = v[0] * t_dXdPhi[0] 03169 + v[1] * t_dXdPhi[1] 03170 + v[2] * t_dXdPhi[2]; 03171 double t0 = t_dXdPhi[0] * t_dXdPhi[0] 03172 + t_dXdPhi[1] * t_dXdPhi[1] 03173 + t_dXdPhi[2] * t_dXdPhi[2]; 03174 double d2fd2phi = t0 - dv * dv 03175 + a[0] * t_d2Xd2Phi[0] 03176 + a[1] * t_d2Xd2Phi[1]; 03177 // + a[2] * t_d2Xd2Phi[2]; 03178 03179 dPhi -= dfdphi / d2fd2phi; 03180 03181 // cout << "nTrial=" << nTrial << endl; 03182 // cout << "iw f,df,dphi=" << dfdphi << "," << d2fd2phi << "," << dPhi << endl; 03183 03184 ++nTrial; 03185 } 03186 03187 //...Cal. positions... 03188 link.positionOnWire(HepPoint3D(wb[0] + l * v[0], 03189 wb[1] + l * v[1], 03190 wb[2] + l * v[2])); 03191 link.dPhi(dPhi); 03192 03193 #ifdef TRKRECO_DEBUG 03194 // h_nTrial->accumulate((float) nTrial + .5); 03195 #endif 03196 03197 return nTrial; 03198 }
|
|
calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.
Reimplemented from TTrackBase. 00280 { 00281 return approach(l, false); 00282 }
|
|
|
|
02872 { 02873 02874 const TMDCWire &w = *l.wire(); 02875 double kappa = _helix->a()[2]; 02876 double phi0 = _helix->a()[1]; 02877 HepPoint3D xc(_helix->center()); 02878 HepPoint3D xw(w.xyPosition()); 02879 HepPoint3D xt(_helix->x()); 02880 HepVector3D v0(xt-xc); 02881 HepVector3D v1(xw-xc); 02882 02883 double vCrs = v0.x() * v1.y() - v0.y() * v1.x(); 02884 double vDot = v0.x() * v1.x() + v0.y() * v1.y(); 02885 double dPhi = atan2(vCrs, vDot); 02886 02887 xt = _helix->x(dPhi); 02888 xt.setZ(0.); 02889 l.positionOnTrack(xt); 02890 xw.setZ(0.); 02891 l.positionOnWire(xw); 02892 l.dPhi(dPhi); 02893 return 0; 02894 }
|
|
assigns wire hits to this track.
|
|
assigns wire hits to this track.
03562 { 03563 hitMask |= WireHitUsed; 03564 03565 unsigned n = _links.length(); 03566 for (unsigned i = 0; i < n; i++) { 03567 TMLink * l = _links[i]; 03568 const TMDCWireHit * h = l->hit(); 03569 03570 #ifdef TRKRECO_DEBUG 03571 if (h->track()) { 03572 std::cout << "TTrack::assign !!! hit(" << h->wire()->name(); 03573 std::cout << ") already assigned" << std::endl; 03574 } 03575 #endif 03576 03577 //...This function will be moved to TTrackManager... 03578 h->track((TTrack *) this); 03579 h->state(h->state() | hitMask); 03580 } 03581 }
|
|
|
|
sets/returns a list of associated TMLink which are used for table output.
|
|
00704 { 00705 _associateHits = list; 00706 return _associateHits; 00707 }
|
|
sets/returns a list of associated TMLink which are used for table output.
00711 {
00712 return _associateHits;
00713 }
|
|
returns position of helix center.
|
|
returns position of helix center.
|
|
sets charge.
|
|
returns charge.
|
|
sets charge.
00505 { 00506 return _charge = a; 00507 }
|
|
returns charge.
00499 {
00500 return _charge;
00501 }
|
|
returns chi2.
|
|
returns chi2.
00490 { 00491 #ifdef TRKRECO_DEBUG 00492 if (! _fitted) std::cout << "TTrack::chi2 !!! chi2 not updated" << std::endl; 00493 #endif 00494 return _chi2; 00495 }
|
|
returns confidence level.
|
|
returns confidence level.
00542 { 00543 return chisq2confLevel((int) _ndf, _chi2); 00544 }
|
|
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 }
|
|
|
|
|
|
00658 { 00659 if (a) _state |= (TrackHasDaughter << TrackRelationShift); 00660 else _state &= (~(TrackHasDaughter << TrackRelationShift)); 00661 return _daughter = a; 00662 }
|
|
00652 {
00653 return _daughter;
00654 }
|
|
|
|
02994 { 02995 bool highPt = true; 02996 if (pt() < 0.2) highPt = false; //Bes 02997 bool fromIP = true; 02998 if (fabs(impact()) > 8.3) fromIP = false; 02999 03000 if (fromIP && highPt) return _type = TrackTypeNormal; 03001 else if (fromIP && (! highPt)) return _type = TrackTypeCurl; 03002 03003 if ((fabs(radius()) * 2. + fabs(impact())) < 81.) //Bes 03004 return _type = TrackTypeCircle; 03005 return _type = TrackTypeCosmic; 03006 }
|
|
|
|
|
|
|
|
|
|
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 }
|
|
dumps debug information.
Reimplemented from TTrackBase. |
|
dumps debug information.
Reimplemented from TTrackBase. 00213 { 00214 bool def = false; 00215 if (msg == "") def = true; 00216 std::string pre = pre0; 00217 std::string tab; 00218 for (unsigned i = 0; i < pre.length(); i++) 00219 tab += " "; 00220 if (def || msg.find("track") != std::string::npos || msg.find("detail") != std::string::npos) { 00221 std::cout << pre 00222 << p() << "(pt=" << pt() << ")" << std::endl 00223 << tab 00224 << "links=" << _links.length() 00225 << "(cores=" << nCores() 00226 << "),chrg=" << _charge 00227 << ",ndf=" << _ndf 00228 << ",chi2=" << _chi2 00229 << std::endl; 00230 pre = tab; 00231 } 00232 if (msg.find("helix") != std::string::npos || msg.find("detail") != std::string::npos) { 00233 std::cout << pre 00234 << "pivot=" << _helix->pivot() 00235 << ",center=" << _helix->center() << std::endl 00236 << pre 00237 << "helix=(" << _helix->a()[0] << "," << _helix->a()[1] 00238 << _helix->a()[2] << "," << _helix->a()[3] << "," 00239 << _helix->a()[4] << ")" << std::endl; 00240 pre = tab; 00241 } 00242 if (! def) TTrackBase::dump(msg, pre); 00243 }
|
|
calculates dXda. 'link' and 'dPhi' are inputs. Others are outputs.
|
|
calculates dXda. 'link' and 'dPhi' are inputs. Others are outputs.
00777 { 00778 00779 //...Setup... 00780 const TMDCWire & w = * link.wire(); 00781 Vector a = _helix->a(); 00782 double dRho = a[0]; 00783 double phi0 = a[1]; 00784 double kappa = a[2]; 00785 // double rho = Helix::ConstantAlpha / kappa; 00786 // double rho = 333.564095 / kappa; 00787 double rho = 333.564095/(-1000*(m_pmgnIMF->getReferField())) / kappa; 00788 double tanLambda = a[4]; 00789 00790 double sinPhi0 = sin(phi0); 00791 double cosPhi0 = cos(phi0); 00792 double sinPhi0dPhi = sin(phi0 + dPhi); 00793 double cosPhi0dPhi = cos(phi0 + dPhi); 00794 Vector dphida(5); 00795 00796 //...Axial case... 00797 if (w.axial()) { 00798 HepPoint3D d = _helix->center() - w.xyPosition(); 00799 double dmag2 = d.mag2(); 00800 00801 dphida[0] = (sinPhi0 * d.x() - cosPhi0 * d.y()) / dmag2; 00802 dphida[1] = (dRho + rho) * (cosPhi0 * d.x() + sinPhi0 * d.y()) 00803 / dmag2 - 1.; 00804 dphida[2] = (- rho / kappa) * (sinPhi0 * d.x() - cosPhi0 * d.y()) 00805 / dmag2; 00806 dphida[3] = 0.; 00807 dphida[4] = 0.; 00808 } 00809 00810 //...Stereo case... 00811 else { 00812 HepPoint3D onTrack = _helix->x(dPhi); 00813 HepVector3D v = w.direction(); 00814 Vector c(3); 00815 c = HepPoint3D(w.backwardPosition() - (v * w.backwardPosition()) * v); 00816 00817 Vector x(3); 00818 x = onTrack; 00819 00820 Vector dxdphi(3); 00821 dxdphi[0] = rho * sinPhi0dPhi; 00822 dxdphi[1] = - rho * cosPhi0dPhi; 00823 dxdphi[2] = - rho * tanLambda; 00824 00825 Vector d2xdphi2(3); 00826 d2xdphi2[0] = rho * cosPhi0dPhi; 00827 d2xdphi2[1] = rho * sinPhi0dPhi; 00828 d2xdphi2[2] = 0.; 00829 00830 double dxdphi_dot_v = dxdphi[0]*v.x() + dxdphi[1]*v.y() + dxdphi[2]*v.z(); 00831 double x_dot_v = x[0]*v.x() + x[1]*v.y() + x[2]*v.z(); 00832 00833 double dfdphi = - (dxdphi[0] - dxdphi_dot_v*v.x()) * dxdphi[0] 00834 - (dxdphi[1] - dxdphi_dot_v*v.y()) * dxdphi[1] 00835 - (dxdphi[2] - dxdphi_dot_v*v.z()) * dxdphi[2] 00836 - (x[0] - c[0] - x_dot_v*v.x()) * d2xdphi2[0] 00837 - (x[1] - c[1] - x_dot_v*v.y()) * d2xdphi2[1]; 00838 /* - (x[2] - c[2] - x_dot_v*v.z()) * d2xdphi2[2]; = 0. */ 00839 00840 00841 //dxda_phi, dyda_phi, dzda_phi : phi is fixed 00842 Vector dxda_phi(5); 00843 dxda_phi[0] = cosPhi0; 00844 dxda_phi[1] = -(dRho + rho)*sinPhi0 + rho*sinPhi0dPhi; 00845 dxda_phi[2] = -(rho/kappa)*( cosPhi0 - cosPhi0dPhi ); 00846 dxda_phi[3] = 0.; 00847 dxda_phi[4] = 0.; 00848 00849 Vector dyda_phi(5); 00850 dyda_phi[0] = sinPhi0; 00851 dyda_phi[1] = (dRho + rho)*cosPhi0 - rho*cosPhi0dPhi; 00852 dyda_phi[2] = -(rho/kappa)*( sinPhi0 - sinPhi0dPhi ); 00853 dyda_phi[3] = 0.; 00854 dyda_phi[4] = 0.; 00855 00856 Vector dzda_phi(5); 00857 dzda_phi[0] = 0.; 00858 dzda_phi[1] = 0.; 00859 dzda_phi[2] = (rho/kappa)*tanLambda*dPhi; 00860 dzda_phi[3] = 1.; 00861 dzda_phi[4] = -rho*dPhi; 00862 00863 Vector d2xdphida(5); 00864 d2xdphida[0] = 0.; 00865 d2xdphida[1] = rho*cosPhi0dPhi; 00866 d2xdphida[2] = -(rho/kappa)*sinPhi0dPhi; 00867 d2xdphida[3] = 0.; 00868 d2xdphida[4] = 0.; 00869 00870 Vector d2ydphida(5); 00871 d2ydphida[0] = 0.; 00872 d2ydphida[1] = rho*sinPhi0dPhi; 00873 d2ydphida[2] = (rho/kappa)*cosPhi0dPhi; 00874 d2ydphida[3] = 0.; 00875 d2ydphida[4] = 0.; 00876 00877 Vector d2zdphida(5); 00878 d2zdphida[0] = 0.; 00879 d2zdphida[1] = 0.; 00880 d2zdphida[2] = (rho/kappa)*tanLambda; 00881 d2zdphida[3] = 0.; 00882 d2zdphida[4] = -rho; 00883 00884 Vector dfda(5); 00885 for( int i = 0; i < 5; i++ ){ 00886 double d_dot_v = v.x()*dxda_phi[i] 00887 + v.y()*dyda_phi[i] 00888 + v.z()*dzda_phi[i]; 00889 dfda[i] = - (dxda_phi[i] - d_dot_v*v.x()) * dxdphi[0] 00890 - (dyda_phi[i] - d_dot_v*v.y()) * dxdphi[1] 00891 - (dzda_phi[i] - d_dot_v*v.z()) * dxdphi[2] 00892 - (x[0] - c[0] - x_dot_v*v.x()) * d2xdphida[i] 00893 - (x[1] - c[1] - x_dot_v*v.y()) * d2ydphida[i] 00894 - (x[2] - c[2] - x_dot_v*v.z()) * d2zdphida[i]; 00895 dphida[i] = - dfda[i] /dfdphi; 00896 } 00897 } 00898 00899 dxda[0] = cosPhi0 + rho * sinPhi0dPhi * dphida[0]; 00900 dxda[1] = - (dRho + rho) * sinPhi0 + rho * sinPhi0dPhi * (1. + dphida[1]); 00901 dxda[2] = - rho / kappa * (cosPhi0 - cosPhi0dPhi) 00902 + rho * sinPhi0dPhi * dphida[2]; 00903 dxda[3] = rho * sinPhi0dPhi * dphida[3]; 00904 dxda[4] = rho * sinPhi0dPhi * dphida[4]; 00905 00906 dyda[0] = sinPhi0 - rho * cosPhi0dPhi * dphida[0]; 00907 dyda[1] = (dRho + rho) * cosPhi0 - rho * cosPhi0dPhi * (1. + dphida[1]); 00908 dyda[2] = - rho / kappa * (sinPhi0 - sinPhi0dPhi) 00909 - rho * cosPhi0dPhi * dphida[2]; 00910 dyda[3] = - rho * cosPhi0dPhi * dphida[3]; 00911 dyda[4] = - rho * cosPhi0dPhi * dphida[4]; 00912 00913 dzda[0] = - rho * tanLambda * dphida[0]; 00914 dzda[1] = - rho * tanLambda * dphida[1]; 00915 dzda[2] = rho / kappa * tanLambda * dPhi - rho * tanLambda * dphida[2]; 00916 dzda[3] = 1. - rho * tanLambda * dphida[3]; 00917 dzda[4] = - rho * dPhi - rho * tanLambda * dphida[4]; 00918 00919 return 0; 00920 }
|
|
|
|
|
|
|
|
02948 { 02949 02950 //...Setup... 02951 double kappa = (_helix->a())[2]; 02952 if(kappa == 0.){ 02953 std::cout << "Error(?) : kappa == 0 in dxda2D of TrkReco." << std::endl; 02954 return 1; 02955 } 02956 double dRho = (_helix->a())[0]; 02957 double phi0 = (_helix->a())[1]; 02958 // double rho = Helix::ConstantAlpha / kappa; 02959 // double rho = 333.564095 / kappa; 02960 double rho = 333.564095/(-1000*(m_pmgnIMF->getReferField())) / kappa; 02961 02962 double sinPhi0 = sin(phi0); 02963 double cosPhi0 = cos(phi0); 02964 double sinPhi0dPhi = sin(phi0 + dPhi); 02965 double cosPhi0dPhi = cos(phi0 + dPhi); 02966 Vector dphida(3); 02967 02968 HepPoint3D d = _helix->center(); // d = center - (0,0,0) 02969 d.setZ(0.); 02970 double dmag2 = d.mag2(); 02971 02972 if(dmag2 == 0.){ 02973 std::cout << "Error(?) : Distance(center-xyPosition) == 0 in dxda2D of TrkReco." << std::endl; 02974 return 1; 02975 } 02976 02977 dphida[0] = (sinPhi0*d.x()-cosPhi0*d.y())/dmag2; 02978 dphida[1] = (dRho+rho)*(cosPhi0*d.x()+sinPhi0 * d.y())/dmag2 - 1.; 02979 dphida[2] = (-rho/kappa)*(sinPhi0*d.x()-cosPhi0*d.y())/dmag2; 02980 02981 dxda[0] = cosPhi0+rho*sinPhi0dPhi*dphida[0]; 02982 dxda[1] = -(dRho+rho)*sinPhi0+rho*sinPhi0dPhi*(1.+dphida[1]); 02983 dxda[2] = -rho/kappa*(cosPhi0-cosPhi0dPhi)+rho*sinPhi0dPhi*dphida[2]; 02984 02985 dyda[0] = sinPhi0-rho*cosPhi0dPhi*dphida[0]; 02986 dyda[1] = (dRho+rho)*cosPhi0-rho*cosPhi0dPhi*(1.+dphida[1]); 02987 dyda[2] = -rho/kappa*(sinPhi0-sinPhi0dPhi)-rho*cosPhi0dPhi*dphida[2]; 02988 02989 return 0; 02990 }
|
|
02900 { 02901 02902 //...Setup... 02903 double kappa = (_helix->a())[2]; 02904 if(kappa == 0.){ 02905 std::cout << "Error(?) : kappa == 0 in dxda2D of TrkReco." << std::endl; 02906 return 1; 02907 } 02908 const TMDCWire &w = *link.wire(); 02909 double dRho = (_helix->a())[0]; 02910 double phi0 = (_helix->a())[1]; 02911 // double rho = Helix::ConstantAlpha / kappa; 02912 // double rho = 333.564095 / kappa; 02913 double rho = 333.564095/(-1000*(m_pmgnIMF->getReferField())) / kappa; 02914 02915 double sinPhi0 = sin(phi0); 02916 double cosPhi0 = cos(phi0); 02917 double sinPhi0dPhi = sin(phi0 + dPhi); 02918 double cosPhi0dPhi = cos(phi0 + dPhi); 02919 Vector dphida(3); 02920 02921 HepPoint3D d = _helix->center() - w.xyPosition(); 02922 d.setZ(0.); 02923 double dmag2 = d.mag2(); 02924 02925 if(dmag2 == 0.){ 02926 std::cout << "Error(?) : Distance(center-xyPosition) == 0 in dxda2D of TrkReco." << std::endl; 02927 return 1; 02928 } 02929 02930 dphida[0] = (sinPhi0*d.x()-cosPhi0*d.y())/dmag2; 02931 dphida[1] = (dRho+rho)*(cosPhi0*d.x()+sinPhi0 * d.y())/dmag2 - 1.; 02932 dphida[2] = (-rho/kappa)*(sinPhi0*d.x()-cosPhi0*d.y())/dmag2; 02933 02934 dxda[0] = cosPhi0+rho*sinPhi0dPhi*dphida[0]; 02935 dxda[1] = -(dRho+rho)*sinPhi0+rho*sinPhi0dPhi*(1.+dphida[1]); 02936 dxda[2] = -rho/kappa*(cosPhi0-cosPhi0dPhi)+rho*sinPhi0dPhi*dphida[2]; 02937 02938 dyda[0] = sinPhi0-rho*cosPhi0dPhi*dphida[0]; 02939 dyda[1] = (dRho+rho)*cosPhi0-rho*cosPhi0dPhi*(1.+dphida[1]); 02940 dyda[2] = -rho/kappa*(sinPhi0-sinPhi0dPhi)-rho*cosPhi0dPhi*dphida[2]; 02941 02942 return 0; 02943 }
|
|
|
|
false Fit
|
|
false Fit
00227 { 00228 _fitted = false; 00229 _fittedWithCathode = false; 00230 }
|
|
|
|
sets/returns a list of TMLink which are used for table output.
|
|
00691 { 00692 _finalHits = list; 00693 return _finalHits; 00694 }
|
|
sets/returns a list of TMLink which are used for table output.
00698 {
00699 return _finalHits;
00700 }
|
|
|
|
sets/returns finder.
|
|
|
|
sets/returns finder.
00596 { 00597 return _state & TrackFinderMask; 00598 }
|
|
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.
|
|
fits itself with r-phi view. Error was happened if return value is not zero.
|
|
fits itself with r-phi view. Error was happened if return value is not zero.
02523 { 02524 #ifdef TRKRECO_DEBUG_DETAIL 02525 std::cout << " TTrack::fit2D(r-phi) ..." << std::endl; 02526 #endif 02527 //if(_fitted)return 0; 02528 02529 //...Check # of hits... 02530 02531 //std::cout << "# = " << _links.length() << std::endl; 02532 //...Setup... 02533 unsigned nTrial(0); 02534 Vector a(_helix->a()); 02535 double chi2; 02536 double chi2Old = 1.0e+99; 02537 Vector dchi2da(3); 02538 SymMatrix d2chi2d2a(3,0); 02539 Vector da(5), dxda(3), dyda(3); 02540 Vector dDda(3); 02541 const double convergence = 1.0e-5; 02542 Vector f(3); 02543 int err = 0; 02544 double factor = 1.0; 02545 unsigned usedWireNumber = 0; 02546 02547 //...Fitting loop... 02548 while(nTrial < 100){ 02549 //...Set up... 02550 chi2 = 0.; 02551 for (unsigned j=0;j<3;++j) dchi2da[j] = 0.; 02552 d2chi2d2a = SymMatrix(3, 0); 02553 usedWireNumber = 0; 02554 02555 //...Loop with hits... 02556 unsigned i = 0; 02557 while (TMLink * l = _links[i++]) { 02558 if(l->fit2D() == 0)continue; 02559 const TMDCWireHit &h = *l->hit(); 02560 02561 //...Cal. closest points... 02562 if(approach2D(*l) != 0)continue; 02563 double dPhi = l->dPhi(); 02564 const HepPoint3D & onTrack = l->positionOnTrack(); 02565 const HepPoint3D & onWire = l->positionOnWire(); 02566 HepPoint3D onTrack2(onTrack.x(),onTrack.y(),0.); 02567 HepPoint3D onWire2(onWire.x(),onWire.y(),0.); 02568 02569 //...Obtain drift distance and its error... 02570 unsigned leftRight = WireHitRight; 02571 if (onWire2.cross(onTrack2).z() < 0.) leftRight = WireHitLeft; 02572 double distance = h.drift(leftRight); 02573 double eDistance = h.dDrift(leftRight); 02574 double eDistance2 = eDistance * eDistance; 02575 if(eDistance == 0.){ 02576 std::cout << "Error(?) : Drift Distance Error = 0 in fit2D of TrkReco." << std::endl; 02577 continue; 02578 } 02579 02580 //...Residual... 02581 HepVector3D v = onTrack2 - onWire2; 02582 double vmag = v.mag(); 02583 double dDistance = vmag - distance; 02584 02585 //...dxda... 02586 if(this->dxda2D(*l, dPhi, dxda, dyda) != 0)continue; 02587 02588 //...Chi2 related... 02589 //Vector3 vw(0.,0.,1.); 02590 dDda = (vmag > 0.) 02591 ? (v.x()*dxda+v.y()*dyda)/vmag 02592 : Vector(3,0); 02593 if(vmag<=0.0){ 02594 std::cout << " in fit2D " << onTrack << ", " << onWire; 02595 h.dump(); 02596 continue; 02597 } 02598 dchi2da += (dDistance/eDistance2)*dDda; 02599 d2chi2d2a += vT_times_v(dDda)/eDistance2; 02600 double pChi2 = dDistance*dDistance/eDistance2; 02601 chi2 += pChi2; 02602 02603 //...Store results... 02604 l->update(onTrack2, onWire2, leftRight, pChi2); 02605 ++usedWireNumber; 02606 } 02607 if(ipFlag != 0){ 02608 double kappa = _helix->a()[2]; 02609 double phi0 = _helix->a()[1]; 02610 HepPoint3D xc(_helix->center()); 02611 HepPoint3D onWire(0.,0.,0.); 02612 HepPoint3D xt(_helix->x()); 02613 HepVector3D v0(xt-xc); 02614 HepVector3D v1(onWire-xc); 02615 double vCrs = v0.x() * v1.y() - v0.y() * v1.x(); 02616 double vDot = v0.x() * v1.x() + v0.y() * v1.y(); 02617 double dPhi = atan2(vCrs, vDot); 02618 HepPoint3D onTrack(_helix->x(dPhi).x(),_helix->x(dPhi).y(),0.); 02619 double distance = ipDistance; 02620 double eDistance = ipError; 02621 double eDistance2 = eDistance * eDistance; 02622 02623 HepVector3D v = onTrack - onWire; 02624 double vmag = v.mag(); 02625 double dDistance = vmag - distance; 02626 02627 if(this->dxda2D(dPhi, dxda, dyda) != 0)goto ipOff; 02628 02629 dDda = (vmag > 0.) 02630 ? (v.x()*dxda+v.y()*dyda)/vmag 02631 : Vector(3,0); 02632 if(vmag<=0.0){ 02633 goto ipOff; 02634 } 02635 dchi2da += (dDistance/eDistance2)*dDda; 02636 d2chi2d2a += vT_times_v(dDda)/eDistance2; 02637 double pChi2 = dDistance*dDistance/eDistance2; 02638 chi2 += pChi2; 02639 02640 ++usedWireNumber; 02641 } 02642 ipOff: 02643 if(usedWireNumber < 4){ 02644 err = -2; 02645 break; 02646 } 02647 02648 //...Check condition... 02649 double change = chi2Old - chi2; 02650 if(fabs(change) < convergence)break; 02651 if(change < 0.){ 02652 #ifdef TRKRECO_DEBUG_DETAIL 02653 std::cout << "chi2Old, chi2=" << chi2Old <<" "<< chi2 << std::endl; 02654 #endif 02655 //change to the old value. 02656 a += factor*da; 02657 _helix->a(a); 02658 02659 chi2 = 0.; 02660 for (unsigned j=0;j<3;++j) dchi2da[j] = 0.; 02661 d2chi2d2a = SymMatrix(3,0); 02662 usedWireNumber = 0; 02663 02664 //...Loop with hits... 02665 unsigned i = 0; 02666 while (TMLink *l = _links[i++]) { 02667 if(l->fit2D() == 0)continue; 02668 const TMDCWireHit & h = * l->hit(); 02669 02670 //...Cal. closest points... 02671 if(approach2D(*l) != 0)continue; 02672 double dPhi = l->dPhi(); 02673 const HepPoint3D & onTrack = l->positionOnTrack(); 02674 const HepPoint3D & onWire = l->positionOnWire(); 02675 HepPoint3D onTrack2(onTrack.x(),onTrack.y(),0.); 02676 HepPoint3D onWire2(onWire.x(),onWire.y(),0.); 02677 02678 //...Obtain drift distance and its error... 02679 unsigned leftRight = WireHitRight; 02680 if (onWire2.cross(onTrack2).z() < 0.) leftRight = WireHitLeft; 02681 double distance = h.drift(leftRight); 02682 double eDistance = h.dDrift(leftRight); 02683 double eDistance2 = eDistance * eDistance; 02684 02685 //...Residual... 02686 HepVector3D v = onTrack2 - onWire2; 02687 double vmag = v.mag(); 02688 double dDistance = vmag - distance; 02689 02690 //...dxda... 02691 if(this->dxda2D(*l, dPhi, dxda, dyda) != 0)continue; 02692 02693 //...Chi2 related... 02694 dDda = (vmag>0.) 02695 ? (v.x()*dxda + v.y()*dyda)/vmag 02696 : Vector(3,0); 02697 if(vmag<=0.0) { 02698 std::cout << " in fit2D " << onTrack << ", " << onWire; 02699 h.dump(); 02700 continue; 02701 } 02702 dchi2da += (dDistance/eDistance2)*dDda; 02703 d2chi2d2a += vT_times_v(dDda)/eDistance2; 02704 double pChi2 = dDistance*dDistance/eDistance2; 02705 chi2 += pChi2; 02706 02707 //...Store results... 02708 l->update(onTrack2, onWire2, leftRight, pChi2); 02709 ++usedWireNumber; 02710 } 02711 if(ipFlag != 0){ 02712 double kappa = _helix->a()[2]; 02713 double phi0 = _helix->a()[1]; 02714 HepPoint3D xc(_helix->center()); 02715 HepPoint3D onWire(0.,0.,0.); 02716 HepPoint3D xt(_helix->x()); 02717 HepVector3D v0(xt-xc); 02718 HepVector3D v1(onWire-xc); 02719 double vCrs = v0.x() * v1.y() - v0.y() * v1.x(); 02720 double vDot = v0.x() * v1.x() + v0.y() * v1.y(); 02721 double dPhi = atan2(vCrs, vDot); 02722 HepPoint3D onTrack(_helix->x(dPhi).x(),_helix->x(dPhi).y(),0.); 02723 double distance = ipDistance; 02724 double eDistance = ipError; 02725 double eDistance2 = eDistance * eDistance; 02726 02727 HepVector3D v = onTrack - onWire; 02728 double vmag = v.mag(); 02729 double dDistance = vmag - distance; 02730 02731 if(this->dxda2D(dPhi, dxda, dyda) != 0)goto ipOff2; 02732 02733 dDda = (vmag > 0.) 02734 ? (v.x()*dxda+v.y()*dyda)/vmag 02735 : Vector(3,0); 02736 if(vmag<=0.0){ 02737 goto ipOff2; 02738 } 02739 dchi2da += (dDistance/eDistance2)*dDda; 02740 d2chi2d2a += vT_times_v(dDda)/eDistance2; 02741 double pChi2 = dDistance*dDistance/eDistance2; 02742 chi2 += pChi2; 02743 02744 ++usedWireNumber; 02745 } 02746 ipOff2: 02747 if(usedWireNumber < 4){ 02748 err = -2; 02749 break; 02750 } 02751 //break; 02752 factor *= 0.75; 02753 #ifdef TRKRECO_DEBUG_DETAIL 02754 std::cout << "factor = " << factor << std::endl; 02755 std::cout << "chi2 = " << chi2 << std::endl; 02756 #endif 02757 if(factor < 0.01)break; 02758 } 02759 02760 chi2Old = chi2; 02761 02762 //...Cal. helix parameters for next loop... 02763 f = solve(d2chi2d2a, dchi2da); 02764 da[0] = f[0]; 02765 da[1] = f[1]; 02766 da[2] = f[2]; 02767 da[3] = 0.; 02768 da[4] = 0.; 02769 02770 a -= factor*da; 02771 _helix->a(a); 02772 ++nTrial; 02773 } 02774 if(err){ 02775 return err; 02776 } 02777 02778 //...Cal. error matrix... 02779 SymMatrix Ea(5,0); 02780 unsigned dim = 3; 02781 SymMatrix Eb = d2chi2d2a; 02782 SymMatrix Ec = Eb.inverse(err); 02783 Ea[0][0] = Ec[0][0]; 02784 Ea[0][1] = Ec[0][1]; 02785 Ea[0][2] = Ec[0][2]; 02786 Ea[1][1] = Ec[1][1]; 02787 Ea[1][2] = Ec[1][2]; 02788 Ea[2][2] = Ec[2][2]; 02789 02790 //...Store information... 02791 if(!err){ 02792 _helix->a(a); 02793 _helix->Ea(Ea); 02794 }else{ 02795 err = -2; 02796 } 02797 02798 _ndf = usedWireNumber-dim; 02799 _chi2 = chi2; 02800 02801 //_fitted = true; 02802 02803 #define JJJTEST 0 02804 #if JJJTEST 02805 double gmaxX = -9999. ,gminX = 9999.; 02806 double gmaxY = -9999. ,gminY = 9999.; 02807 FILE *gnuplot, *data; 02808 double step = 200.; 02809 double dStep = 2.*M_PI/step; 02810 for(int i=0,size = _links.length();i<size;++i){ 02811 TMLink * l = _links[i]; 02812 double drift = l->hit()->distance(0); 02813 char name[100] = "dat"; 02814 char counter[10] = ""; 02815 sprintf(counter,"%02d",i); 02816 strcat(name,counter); 02817 if((data = fopen(name,"w")) != NULL){ 02818 for(int ii=0;ii<step;++ii){ 02819 double X = l->wire()->xyPosition().x() + drift*cos(dStep*static_cast<double>(ii)); 02820 double Y = l->wire()->xyPosition().y() + drift*sin(dStep*static_cast<double>(ii)); 02821 fprintf(data,"%lf, %lf\n",X,Y); 02822 if(gmaxX < X)gmaxX = X; 02823 if(gminX > X)gminX = X; 02824 if(gmaxY < Y)gmaxY = Y; 02825 if(gminY > Y)gminY = Y; 02826 } 02827 fclose(data); 02828 } 02829 } 02830 step = 300.; 02831 dStep = 2.*M_PI/step; 02832 if((data = fopen("datc","w")) != NULL){ 02833 for(int ii=0;ii<step;++ii){ 02834 double X = _helix->center().x() + _helix->radius()*cos(dStep*static_cast<double>(ii)); 02835 double Y = _helix->center().y() + _helix->radius()*sin(dStep*static_cast<double>(ii)); 02836 fprintf(data,"%lf, %lf\n",X,Y); 02837 } 02838 fclose(data); 02839 } 02840 if((gnuplot = popen("gnuplot","w")) != NULL){ 02841 fprintf(gnuplot,"set size 0.721,1.0 \n"); 02842 fprintf(gnuplot,"set xrange [%f:%f] \n",gminX,gmaxX); 02843 fprintf(gnuplot,"set yrange [%f:%f] \n",gminY,gmaxY); 02844 if(_links.length() == 4){ 02845 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line \n"); 02846 }else if(_links.length() == 5){ 02847 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line, \"dat04\" with line \n"); 02848 }else if(_links.length() == 6){ 02849 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line, \"dat04\" with line, \"dat05\" with line \n"); 02850 }else if(_links.length() == 7){ 02851 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line, \"dat04\" with line, \"dat05\" with line, \"dat06\" with line \n"); 02852 }else if(_links.length() == 8){ 02853 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line, \"dat04\" with line, \"dat05\" with line, \"dat06\" with line, \"dat07\" with line \n"); 02854 }else if(_links.length() == 9){ 02855 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line, \"dat04\" with line, \"dat05\" with line, \"dat06\" with line, \"dat07\" with line, \"dat08\" with line \n"); 02856 }else if(_links.length() == 10){ 02857 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line, \"dat04\" with line, \"dat05\" with line, \"dat06\" with line, \"dat07\" with line, \"dat08\" with line, \"dat09\" with line \n"); 02858 }else if(_links.length() >= 11){ 02859 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line, \"dat04\" with line, \"dat05\" with line, \"dat06\" with line, \"dat07\" with line, \"dat08\" with line, \"dat09\" with line, \"dat10\" with line \n"); 02860 } 02861 fflush(gnuplot); 02862 char tmp[8]; 02863 gets(tmp); 02864 pclose(gnuplot); 02865 } 02866 #endif //JJJTEST 02867 02868 return err; 02869 }
|
|
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 }
|
|
|
|
sets/returns fitting status.
|
|
|
|
sets/returns fitting status.
00625 { 00626 return (_state >> TrackFitShift) & TrackFitMask; 00627 }
|
|
calculates an intersection of this track and a cylinder.
|
|
calculates an intersection of this track and a cylinder.
00306 { 00307 00308 00309 int status(0); // return value 00310 //--------------------------------------------------------------------- 00311 // value | ext | status 00312 //--------------------------------------------------------------------- 00313 // 1. | OK | 00314 // -1. | NO | charge = 0 00315 // 0. | NO | | tanl | < 0.1 ( neglect | lamda | < 5.7 deg. ) 00316 // | | or | dPhi | > 2 pi ( neglect curly track ) 00317 // | | or cannot reach to r=rhole at z = zb or zf. 00318 // 2. | OK | backward , ext point set on z = zb 00319 // 3. | OK | forward , ext point set on z = zf 00320 //--------------------------------------------------------------------- 00321 // * when value = 0,2,3 , ext(z) <= zb or ext(z) >= zf 00322 00323 //--- debug 00324 // std::cout << " " << std::endl; 00325 // std::cout << "HelCyl called .. rhole=" << rhole << " rCyl=" << rCyl ; 00326 // std::cout << " zb=" << zb << " zf=" << zf << " epsl=" << epsl << std::endl; 00327 //--- debug end 00328 00329 // Check of Charge 00330 00331 if ( int(_charge) == 0 ) { 00332 std::cout << "HelCyl gets a straight line !!" << std::endl; 00333 return -1 ; 00334 } 00335 00336 // parameters 00337 00338 HepPoint3D CenterCyl( 0., 0., 0. ); 00339 HepPoint3D CenterTrk = _helix->center(); 00340 double rTrk = fabs( _helix->radius() ); 00341 00342 double rPivot = fabs( _helix->pivot().perp() ); 00343 00344 double phi0 = _helix->a()[1]; 00345 double tanl = _helix->a()[4]; 00346 // double zdz = _helix->pivot().z() + _helix->a()[3]; 00347 double dPhi; 00348 double zee; 00349 00350 00351 // Calculate intersections between cylinder and track 00352 // if return value = 2 track hitting barrel part 00353 00354 HepPoint3D Cross1, Cross2; 00355 00356 if (intersection( CenterTrk,_charge * rTrk ,CenterCyl,rCyl, 00357 epsl, 00358 Cross1,Cross2) 00359 == 2 ) { 00360 00361 double phiCyl = atan2( _charge * ( CenterTrk.y() - Cross1.y() ), 00362 _charge * ( CenterTrk.x() - Cross1.x() ) ); 00363 phiCyl = ( phiCyl > 0. ) ? phiCyl : phiCyl + 2. * M_PI; 00364 00365 dPhi = phiCyl - phi0; 00366 00367 // dPhi region ( at cylinder ) 00368 // -pi <= dPhi < pi 00369 00370 00371 double PhiYobun = 1./ fabs( _helix->radius() ); 00372 double zero = 0.00001; 00373 00374 if( _charge >=0. ){ 00375 if( dPhi > PhiYobun ) dPhi -= 2. * M_PI; 00376 if( -2. * M_PI - zero <= dPhi <= ( -2.* M_PI + PhiYobun ) ) 00377 dPhi += 2. * M_PI; 00378 } 00379 00380 if( _charge < 0. ){ 00381 if( dPhi < -PhiYobun ) dPhi += 2. * M_PI; 00382 if( 2. * M_PI + zero >= dPhi >= ( 2. * M_PI - PhiYobun ) ) 00383 dPhi -= 2. * M_PI; 00384 } 00385 00386 if( dPhi < - M_PI ) dPhi += 2. * M_PI; 00387 if( dPhi >= M_PI ) dPhi -= 2. * M_PI; 00388 00389 //--debug 00390 // std::cout << "dPhi = " << dPhi << std::endl; 00391 //--debug end 00392 00393 xp.setX( Cross1.x() ); 00394 xp.setY( Cross1.y() ); 00395 xp.setZ( _helix->x(dPhi).z() ); 00396 // xp.setZ( zdz - _charge * rTrk * tanl * dPhi ); 00397 00398 if ( xp.z() > zb && xp.z() < zf ) { 00399 phi = dPhi; 00400 //--- debug --- 00401 // std::cout << "return1 ( ext success )" << std::endl; 00402 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00403 //--- debug ---- 00404 return 1 ; 00405 } 00406 } 00407 00408 00409 // tracks hitting endcaps 00410 00411 if ( fabs(tanl) < 0.1 ) { 00412 //--- debug --- 00413 // std::cout << "return0 ( ext failed , |tanl| < 0.1 )" << std::endl; 00414 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00415 //--- debug --- 00416 return 0; 00417 } 00418 00419 if ( tanl > 0. ) { 00420 zee = zf ; 00421 status = 3 ; 00422 } 00423 else { 00424 zee = zb ; 00425 status = 2 ; 00426 } 00427 00428 dPhi = _charge * ( _helix->x(0.).z() - zee )/rTrk/tanl; 00429 // dPhi = _charge * ( zdz - zee )/rTrk/tanl; 00430 00431 // Requre dPhi < 2*pi 00432 00433 if ( fabs(dPhi) > 2. * M_PI ) { 00434 //--- debug --- 00435 // std::cout << " return0 ( ext failed , dPhi > 2pi )" << std::endl; 00436 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00437 //--- debug --- 00438 return 0 ; 00439 } 00440 00441 xp.setX( _helix->x(dPhi).x() ); 00442 xp.setY( _helix->x(dPhi).y() ); 00443 xp.setZ( zee ); 00444 00445 double test = xp.perp2() - rhole*rhole ; 00446 if ( test < 0. ) { 00447 //--- debug --- 00448 // std::cout << "return0 ( cannot reach to rhole at z=edge )" << std::endl; 00449 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00450 //--- debug --- 00451 return 0 ; 00452 } 00453 00454 phi = dPhi ; 00455 //--- debug --- 00456 // std::cout << "return" << status << std::endl; 00457 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00458 //--- debug --- 00459 00460 return status ; 00461 00462 }
|
|
returns helix parameter.
|
|
returns helix parameter.
00472 { 00473 #ifdef TRKRECO_DEBUG 00474 // if (! _fitted) std::cout << "TTrack::helix !!! helix not updated" << std::endl; 00475 #endif 00476 return * _helix; 00477 }
|
|
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 }
|
|
returns signed impact parameter to the origin.
|
|
returns signed impact parameter to the origin.
|
|
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 }
|
|
returns a pointer to TTrackMC.
|
|
returns a pointer to TTrackMC.
00247 {
00248 return _mc;
00249 }
|
|
|
|
sets/returns mother/daughter.
|
|
00644 { 00645 if (a) _state |= (TrackHasMother << TrackRelationShift); 00646 else _state &= (~(TrackHasMother << TrackRelationShift)); 00647 return _mother = a; 00648 }
|
|
sets/returns mother/daughter.
00638 {
00639 return _mother;
00640 }
|
|
moves pivot to the inner most hit.
|
|
moves pivot to the inner most hit.
00246 { 00247 unsigned n = _links.length(); 00248 if (! n) { 00249 std::cout << "TTrack::movePivot !!! can't move a pivot" 00250 << " because of no link"; 00251 std::cout << std::endl; 00252 return; 00253 } 00254 00255 //...Check cores... 00256 const AList<TMLink> & cores = TTrackBase::cores(); 00257 const AList<TMLink> * links = & cores; 00258 if (cores.length() == 0) links = & _links; 00259 00260 //...Hit loop... 00261 unsigned innerMost = 0; 00262 unsigned innerMostLayer = (* links)[0]->wire()->layerId(); 00263 n = links->length(); 00264 for (unsigned i = 1; i < n; i++) { 00265 TMLink * l = (* links)[i]; 00266 if (l->wire()->layerId() < innerMostLayer) { 00267 innerMost = i; 00268 innerMostLayer = l->wire()->layerId(); 00269 } 00270 } 00271 00272 //...Move pivot... 00273 HepPoint3D newPivot = (* links)[innerMost]->positionOnWire(); 00274 if (quality() & TrackQuality2D) 00275 newPivot.setZ(0.); 00276 _helix->pivot(newPivot); 00277 }
|
|
|
|
returns/sets name.
|
|
00517 { 00518 return _name = a; 00519 }
|
|
returns/sets name.
00511 {
00512 return _name;
00513 }
|
|
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.
00481 { 00482 #ifdef TRKRECO_DEBUG 00483 if (! _fitted) std::cout << "TTrack::ndf !!! ndf not updated" << std::endl; 00484 #endif 00485 return _ndf; 00486 }
|
|
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 }
|
|
returns type.
Reimplemented from TTrackBase. |
|
returns type.
Reimplemented from TTrackBase. 00554 {
00555 return Track;
00556 }
|
|
|
|
00235 { 00236 return _links[i]; 00237 }
|
|
returns momentum.
|
|
returns momentum.
|
|
returns Pt.
|
|
returns Pt.
|
|
returns magnitude of momentum.
|
|
returns magnitude of momentum.
00535 { 00536 return (1. / fabs(_helix->a()[2])) * 00537 sqrt(1. + _helix->a()[4] * _helix->a()[4]); 00538 }
|
|
returns Pz.
|
|
returns Pz.
|
|
|
|
sets/returns quality.
|
|
00615 { 00616 // _state = ((a << TrackQualityShift) & TrackQualityMask) | 00617 // (_state & (~ (TrackQualityMask << TrackQualityShift))); 00618 _state = ((a & TrackQualityMask) << TrackQualityShift) | 00619 (_state & (~ (TrackQualityMask << TrackQualityShift))); 00620 return quality(); 00621 }
|
|
sets/returns quality.
00609 { 00610 return (_state >> TrackQualityShift) & TrackQualityMask; 00611 }
|
|
returns signed radius.
|
|
returns signed radius.
|
|
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 }
|
|
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function. (using stereo wire as axial wire(z=0))
|
|
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function. (using stereo wire as axial wire(z=0))
00285 { 00286 unsigned n = _links.length(); 00287 AList<TMLink> bad; 00288 for (unsigned i = 0; i < n; ++i) { 00289 if (_links[i]->pull() > maxSigma) bad.append(_links[i]); 00290 } 00291 _links.remove(bad); 00292 if (bad.length()){ 00293 _fitted = false; 00294 fit2D(); 00295 } 00296 list.append(bad); 00297 }
|
|
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 }
|
|
|
|
returns AList<TSegment>.
|
|
00584 {
00585 return _segments;
00586 }
|
|
returns AList<TSegment>.
00578 {
00579 return _segments;
00580 }
|
|
returns/sets internal state.(for bank output)
|
|
returns/sets internal state.(for bank output)
00666 {
00667 return _state;
00668 }
|
|
calculates arc length and z for a stereo hit. uses these functions for curl tracks(included svd version).
|
|
|
|
|
|
|
|
calculates arc length and z for a stereo hit. uses these functions for curl tracks(included svd version).
01992 { 01993 if(list.length() == 0)return -1; 01994 01995 HepPoint3D center = _helix->center(); 01996 HepPoint3D tmp(-999., -999., 0.); 01997 double r = fabs(_helix->curv()); 01998 for(unsigned i = 0, size = list.length(); i < size; ++i){ 01999 TMDCWireHit &h = *const_cast<TMDCWireHit*>(list[i]->hit()); 02000 HepVector3D X = 0.5*(h.wire()->forwardPosition() + 02001 h.wire()->backwardPosition()); 02002 HepVector3D x = HepVector3D(X.x(), X.y(), 0.); 02003 HepVector3D w = x - center; 02004 HepVector3D V = h.wire()->direction(); 02005 HepVector3D v = HepVector3D(V.x(), V.y(), 0.); 02006 double vmag2 = v.mag2(); 02007 double vmag = sqrt(vmag2); 02008 //...temporary 02009 for(unsigned j = 0; j < 4; ++j) 02010 list[i]->arcZ(tmp,j); 02011 02012 //...stereo? 02013 if (vmag == 0.) continue; 02014 02015 double drift = h.drift(WireHitLeft); 02016 double R[2] = {r + drift, r - drift}; 02017 double wv = w.dot(v); 02018 double d2[2]; 02019 d2[0] = vmag2*R[0]*R[0] + (wv*wv - vmag2*w.mag2()); //...= v^2*(r^2 - w^2*sin()^2)...outer 02020 d2[1] = vmag2*R[1]*R[1] + (wv*wv - vmag2*w.mag2()); //...= v^2*(r^2 - w^2*sin()^2)...inner 02021 02022 //...No crossing in R/Phi plane... 02023 if (d2[0] < 0. && d2[1] < 0.) continue; 02024 02025 bool ok_inner(true); 02026 bool ok_outer(true); 02027 double d[2] = {-1., -1.}; 02028 //...outer 02029 if(d2[0] >= 0.){ 02030 d[0] = sqrt(d2[0]); 02031 }else{ 02032 ok_outer = false; 02033 } 02034 if(d2[1] >= 0.){ 02035 d[1] = sqrt(d2[1]); 02036 }else{ 02037 ok_inner = false; 02038 } 02039 02040 //...Cal. length and z to crossing points... 02041 double l[2][2]; 02042 double z[2][2]; 02043 //...outer 02044 if(ok_outer){ 02045 l[0][0] = (- wv + d[0]) / vmag2; //...= (-wvcos()+d)/v/v = (-wcos() + (r^2 - w^2*sin()^2)^0.5)/v 02046 l[1][0] = (- wv - d[0]) / vmag2; //...= (-wvcos()+d)/v/v = (-wcos() - (r^2 - w^2*sin()^2)^0.5)/v 02047 z[0][0] = X.z() + l[0][0]*V.z(); 02048 z[1][0] = X.z() + l[1][0]*V.z(); 02049 } 02050 //...inner 02051 if(ok_inner){ 02052 l[0][1] = (- wv + d[1]) / vmag2; //...= (-wvcos()+d)/v/v = (-wcos() + (r^2 - w^2*sin()^2)^0.5)/v 02053 l[1][1] = (- wv - d[1]) / vmag2; //...= (-wvcos()+d)/v/v = (-wcos() - (r^2 - w^2*sin()^2)^0.5)/v 02054 z[0][1] = X.z() + l[0][1]*V.z(); 02055 z[1][1] = X.z() + l[1][1]*V.z(); 02056 } 02057 02058 //...Cal. xy position of crossing points... 02059 HepVector3D p[2][2]; 02060 #if 1 02061 HepVector3D tp[2][2]; 02062 #endif 02063 if(ok_outer){ 02064 p[0][0] = x + l[0][0] * v; 02065 p[1][0] = x + l[1][0] * v; 02066 #if 1 02067 tp[0][0] = p[0][0]; 02068 tp[1][0] = p[1][0]; 02069 #endif 02070 HepVector3D tmp_pc = p[0][0] - center; 02071 HepVector3D pc0 = HepVector3D(tmp_pc.x(), tmp_pc.y(), 0.); 02072 p[0][0] -= drift/pc0.mag()*pc0; 02073 tmp_pc = p[1][0] - center; 02074 HepVector3D pc1 = HepVector3D(tmp_pc.x(), tmp_pc.y(), 0.); 02075 p[1][0] -= drift/pc1.mag()*pc1; 02076 } 02077 #define JJTEST 0 02078 if(ok_inner){ 02079 p[0][1] = x + l[0][1] * v; 02080 p[1][1] = x + l[1][1] * v; 02081 #if JJTEST 02082 tp[0][1] = p[0][1]; 02083 tp[1][1] = p[1][1]; 02084 #endif 02085 HepVector3D tmp_pc = p[0][1] - center; 02086 HepVector3D pc0 = HepVector3D(tmp_pc.x(), tmp_pc.y(), 0.); 02087 p[0][1] += drift/pc0.mag()*pc0; 02088 tmp_pc = p[1][1] - center; 02089 HepVector3D pc1 = HepVector3D(tmp_pc.x(), tmp_pc.y(), 0.); 02090 p[1][1] += drift/pc1.mag()*pc1; 02091 } 02092 02093 //...boolean 02094 bool ok_xy[2][2]; 02095 if(ok_outer){ 02096 ok_xy[0][0] = true; 02097 ok_xy[1][0] = true; 02098 }else{ 02099 ok_xy[0][0] = false; 02100 ok_xy[1][0] = false; 02101 } 02102 if(ok_inner){ 02103 ok_xy[0][1] = true; 02104 ok_xy[1][1] = true; 02105 }else{ 02106 ok_xy[0][1] = false; 02107 ok_xy[1][1] = false; 02108 } 02109 if(ok_outer){ 02110 if (_charge * (center.x() * p[0][0].y() - center.y() * p[0][0].x()) < 0.) 02111 ok_xy[0][0] = false; 02112 if (_charge * (center.x() * p[1][0].y() - center.y() * p[1][0].x()) < 0.) 02113 ok_xy[1][0] = false; 02114 } 02115 if(ok_inner){ 02116 if (_charge * (center.x() * p[0][1].y() - center.y() * p[0][1].x()) < 0.) 02117 ok_xy[0][1] = false; 02118 if (_charge * (center.x() * p[1][1].y() - center.y() * p[1][1].x()) < 0.) 02119 ok_xy[1][1] = false; 02120 } 02121 if(!ok_inner && ok_outer && (!ok_xy[0][0]) && (!ok_xy[1][0])){ 02122 continue; 02123 } 02124 if(ok_inner && !ok_outer && (!ok_xy[0][1]) && (!ok_xy[1][1])){ 02125 continue; 02126 } 02127 02128 //...Check z position... 02129 if(ok_xy[0][0]){ 02130 if (z[0][0] < h.wire()->backwardPosition().z() || 02131 z[0][0] > h.wire()->forwardPosition().z()) ok_xy[0][0] = false; 02132 } 02133 if(ok_xy[1][0]){ 02134 if (z[1][0] < h.wire()->backwardPosition().z() || 02135 z[1][0] > h.wire()->forwardPosition().z()) ok_xy[1][0] = false; 02136 } 02137 if(ok_xy[0][1]){ 02138 if (z[0][1] < h.wire()->backwardPosition().z() || 02139 z[0][1] > h.wire()->forwardPosition().z()) ok_xy[0][1] = false; 02140 } 02141 if(ok_xy[1][1]){ 02142 if (z[1][1] < h.wire()->backwardPosition().z() || 02143 z[1][1] > h.wire()->forwardPosition().z()) ok_xy[1][1] = false; 02144 } 02145 if ((!ok_xy[0][0]) && (!ok_xy[1][0]) && 02146 (!ok_xy[0][1]) && (!ok_xy[1][1])){ 02147 continue; 02148 } 02149 double cosdPhi, dPhi; 02150 unsigned index; 02151 index = 0; 02152 if(ok_xy[0][0]){ 02153 //...cal. arc length... 02154 cosdPhi = - center.dot((p[0][0] - center).unit()) / center.mag(); 02155 if(fabs(cosdPhi) < 1.0){ 02156 dPhi = acos(cosdPhi); 02157 }else if(cosdPhi >= 1.0){ 02158 dPhi = 0.; 02159 }else{ 02160 dPhi = M_PI; 02161 } 02162 list[i]->arcZ(HepPoint3D(r*dPhi, z[0][0], 0.), index); 02163 //std::cout << r*dPhi << ", " << z[0][0] << std::endl; 02164 ++index; 02165 } 02166 if(ok_xy[1][0]){ 02167 //...cal. arc length... 02168 cosdPhi = - center.dot((p[1][0] - center).unit()) / center.mag(); 02169 if(fabs(cosdPhi) < 1.0){ 02170 dPhi = acos(cosdPhi); 02171 }else if(cosdPhi >= 1.0){ 02172 dPhi = 0.; 02173 }else{ 02174 dPhi = M_PI; 02175 } 02176 list[i]->arcZ(HepPoint3D(r*dPhi, z[1][0], 0.), index); 02177 //std::cout << r*dPhi << ", " << z[1][0] << std::endl; 02178 ++index; 02179 } 02180 if(ok_xy[0][1]){ 02181 //...cal. arc length... 02182 cosdPhi = - center.dot((p[0][1] - center).unit()) / center.mag(); 02183 if(fabs(cosdPhi) < 1.0){ 02184 dPhi = acos(cosdPhi); 02185 }else if(cosdPhi >= 1.0){ 02186 dPhi = 0.; 02187 }else{ 02188 dPhi = M_PI; 02189 } 02190 list[i]->arcZ(HepPoint3D(r*dPhi, z[0][1], 0.), index); 02191 //std::cout << r*dPhi << ", " << z[0][1] << std::endl; 02192 ++index; 02193 } 02194 if(ok_xy[1][1]){ 02195 //...cal. arc length... 02196 cosdPhi = - center.dot((p[1][1] - center).unit()) / center.mag(); 02197 if(fabs(cosdPhi) < 1.0){ 02198 dPhi = acos(cosdPhi); 02199 }else if(cosdPhi >= 1.0){ 02200 dPhi = 0.; 02201 }else{ 02202 dPhi = M_PI; 02203 } 02204 list[i]->arcZ(HepPoint3D(r*dPhi, z[1][1], 0.), index); 02205 //std::cout << r*dPhi << ", " << z[1][1] << std::endl; 02206 ++index; 02207 } 02208 02209 #if JJTEST 02210 double gmaxX = -9999. ,gminX = 9999.; 02211 double gmaxY = -9999. ,gminY = 9999.; 02212 FILE *gnuplot, *data; 02213 double step = 100.; 02214 double dStep = 2.*M_PI/step; 02215 if((data = fopen("dat1","w")) != NULL){ 02216 if(ok_xy[0][0]){ 02217 for(int ii=0;ii<step;++ii){ 02218 double X = tp[0][0].x() + drift*cos(dStep*static_cast<double>(ii)); 02219 double Y = tp[0][0].y() + drift*sin(dStep*static_cast<double>(ii)); 02220 fprintf(data,"%lf, %lf\n",X,Y); 02221 if(gmaxX < X)gmaxX = X; 02222 if(gminX > X)gminX = X; 02223 if(gmaxY < Y)gmaxY = Y; 02224 if(gminY > Y)gminY = Y; 02225 } 02226 } 02227 fclose(data); 02228 } 02229 if((data = fopen("dat2","w")) != NULL){ 02230 if(ok_xy[1][0]){ 02231 for(int ii=0;ii<step;++ii){ 02232 double X = tp[1][0].x() + drift*cos(dStep*static_cast<double>(ii)); 02233 double Y = tp[1][0].y() + drift*sin(dStep*static_cast<double>(ii)); 02234 fprintf(data,"%lf, %lf\n",X,Y); 02235 if(gmaxX < X)gmaxX = X; 02236 if(gminX > X)gminX = X; 02237 if(gmaxY < Y)gmaxY = Y; 02238 if(gminY > Y)gminY = Y; 02239 } 02240 } 02241 fclose(data); 02242 } 02243 if((data = fopen("dat3","w")) != NULL){ 02244 if(ok_xy[0][1]){ 02245 for(int ii=0;ii<step;++ii){ 02246 double X = tp[0][1].x() + drift*cos(dStep*static_cast<double>(ii)); 02247 double Y = tp[0][1].y() + drift*sin(dStep*static_cast<double>(ii)); 02248 fprintf(data,"%lf, %lf\n",X,Y); 02249 if(gmaxX < X)gmaxX = X; 02250 if(gminX > X)gminX = X; 02251 if(gmaxY < Y)gmaxY = Y; 02252 if(gminY > Y)gminY = Y; 02253 } 02254 } 02255 fclose(data); 02256 } 02257 if((data = fopen("dat4","w")) != NULL){ 02258 if(ok_xy[1][1]){ 02259 for(int ii=0;ii<step;++ii){ 02260 double X = tp[1][1].x() + drift*cos(dStep*static_cast<double>(ii)); 02261 double Y = tp[1][1].y() + drift*sin(dStep*static_cast<double>(ii)); 02262 fprintf(data,"%lf, %lf\n",X,Y); 02263 if(gmaxX < X)gmaxX = X; 02264 if(gminX > X)gminX = X; 02265 if(gmaxY < Y)gmaxY = Y; 02266 if(gminY > Y)gminY = Y; 02267 } 02268 } 02269 fclose(data); 02270 } 02271 HepVector3D tX = h.wire()->forwardPosition()-h.wire()->backwardPosition(); 02272 HepVector3D tDist(tX.x(), tX.y(), 0.); 02273 double tD = tDist.mag(); 02274 double vvvM = 1./ v.mag(); 02275 HepVector3D tDire = vvvM*v; 02276 step = 2.; 02277 dStep = tD/step; 02278 if((data = fopen("dat5","w")) != NULL){ 02279 for(int ii=0;ii<step+1;++ii){ 02280 double X = h.wire()->backwardPosition().x()+dStep*static_cast<double>(ii)*tDire.x(); 02281 double Y = h.wire()->backwardPosition().y()+dStep*static_cast<double>(ii)*tDire.y(); 02282 fprintf(data,"%lf, %lf\n",X,Y); 02283 if(gmaxX < X)gmaxX = X; 02284 if(gminX > X)gminX = X; 02285 if(gmaxY < Y)gmaxY = Y; 02286 if(gminY > Y)gminY = Y; 02287 } 02288 fclose(data); 02289 } 02290 if((data = fopen("dat6","w")) != NULL){ 02291 double X = h.wire()->backwardPosition().x(); 02292 double Y = h.wire()->backwardPosition().y(); 02293 fprintf(data,"%lf, %lf\n",X,Y); 02294 if(gmaxX < X)gmaxX = X; 02295 if(gminX > X)gminX = X; 02296 if(gmaxY < Y)gmaxY = Y; 02297 if(gminY > Y)gminY = Y; 02298 fclose(data); 02299 } 02300 if((data = fopen("dat7","w")) != NULL){ 02301 double X = h.wire()->forwardPosition().x(); 02302 double Y = h.wire()->forwardPosition().y(); 02303 fprintf(data,"%lf, %lf\n",X,Y); 02304 if(gmaxX < X)gmaxX = X; 02305 if(gminX > X)gminX = X; 02306 if(gmaxY < Y)gmaxY = Y; 02307 if(gminY > Y)gminY = Y; 02308 fclose(data); 02309 } 02310 step = 300.; 02311 dStep = 2.*M_PI/step; 02312 if((data = fopen("dat8","w")) != NULL){ 02313 for(int ii=0;ii<step;++ii){ 02314 double X = center.x() + r*cos(dStep*static_cast<double>(ii)); 02315 double Y = center.y() + r*sin(dStep*static_cast<double>(ii)); 02316 fprintf(data,"%lf, %lf\n",X,Y); 02317 } 02318 fclose(data); 02319 } 02320 if((data = fopen("dat9","w")) != NULL){ 02321 if(ok_xy[0][0]){ 02322 double X = p[0][0].x(); 02323 double Y = p[0][0].y(); 02324 fprintf(data,"%lf, %lf\n",X,Y); 02325 } 02326 fclose(data); 02327 } 02328 if((data = fopen("dat10","w")) != NULL){ 02329 if(ok_xy[1][0]){ 02330 double X = p[1][0].x(); 02331 double Y = p[1][0].y(); 02332 fprintf(data,"%lf, %lf\n",X,Y); 02333 } 02334 fclose(data); 02335 } 02336 if((data = fopen("dat11","w")) != NULL){ 02337 if(ok_xy[0][1]){ 02338 double X = p[0][1].x(); 02339 double Y = p[0][1].y(); 02340 fprintf(data,"%lf, %lf\n",X,Y); 02341 } 02342 fclose(data); 02343 } 02344 if((data = fopen("dat12","w")) != NULL){ 02345 if(ok_xy[1][1]){ 02346 double X = p[1][1].x(); 02347 double Y = p[1][1].y(); 02348 fprintf(data,"%lf, %lf\n",X,Y); 02349 } 02350 fclose(data); 02351 } 02352 std::cout << "Drift Distance = " << drift << ", xy1cm -> z" << V.z()/v.mag() << "cm, xyDist(cm) = " << tD << std::endl; 02353 if(tX.z()<0.)std::cout << "ERROR : F < B" << std::endl; 02354 if((gnuplot = popen("gnuplot","w")) != NULL){ 02355 fprintf(gnuplot,"set size 0.721,1.0 \n"); 02356 fprintf(gnuplot,"set xrange [%f:%f] \n",gminX,gmaxX); 02357 fprintf(gnuplot,"set yrange [%f:%f] \n",gminY,gmaxY); 02358 fprintf(gnuplot,"plot \"dat1\" with line, \"dat2\" with line, \"dat3\" with line, \"dat4\" with line, \"dat5\" with line, \"dat6\", \"dat7\", \"dat8\" with line, \"dat9\", \"dat10\", \"dat11\", \"dat12\" \n"); 02359 fflush(gnuplot); 02360 char tmp[8]; 02361 gets(tmp); 02362 pclose(gnuplot); 02363 } 02364 #endif 02365 } 02366 return 0; 02367 }
|
|
|
|
|
|
|
|
calculates arc length for a point.
|
|
calculates arc length and z for a segment. Results are stored in TMLink.
|
|
calculates arc length and z for a stereo hit.
|
|
calculates arc length for a point.
03535 { 03536 03537 //...Cal. arc length... 03538 HepPoint3D center = _helix->center(); 03539 HepPoint3D xy = p; 03540 xy.setZ(0.); 03541 double cosdPhi = - center.dot((xy - center).unit()) / center.mag(); 03542 double dPhi; 03543 if (fabs(cosdPhi) <= 1.0) { 03544 dPhi = acos(cosdPhi); 03545 } 03546 else if (cosdPhi > 1.0) { 03547 dPhi = 0.0; 03548 } 03549 else { 03550 dPhi = M_PI; 03551 } 03552 03553 //...Finish... 03554 sz.setX(_helix->curv() * dPhi); 03555 sz.setY(p.z()); 03556 sz.setZ(0.); 03557 03558 return 0; 03559 }
|
|
calculates arc length and z for a segment. Results are stored in TMLink.
03503 { 03504 03505 //...Pick up a wire which represents segment position... 03506 AList<TMLink> links = segment.cores(); 03507 unsigned n = links.length(); 03508 // std::cout<<" szPosition TTrack:: segment.cores().length():"<<n<<endl; 03509 // for (unsigned i = 1; i < n; i++) { 03510 // std::cout<<"drift distance"<<links[i]->hit()->drift()<<endl; 03511 // } 03512 if (! n) return -1; 03513 TMLink * minL = links[0]; 03514 float minDist = links[0]->drift(); 03515 // std::cout<<"minDist szPosition TTrack:"<<minDist<<endl; 03516 for (unsigned i = 1; i < n; i++) { 03517 if (links[i]->hit()->drift() < minDist) { 03518 minDist = links[i]->drift(); 03519 // std::cout<<"minDist szPosition TTrack:"<<minDist<<endl; 03520 minL = links[i]; 03521 } 03522 } 03523 03524 //...sz calculation... 03525 a.position(minL->position()); 03526 a.leftRight(2); 03527 a.hit(minL->hit()); 03528 int err = szPosition(a); 03529 // std::cout<<"err of szPosition TTrack:"<<err<<endl; 03530 if (err) return -2; 03531 return 0; 03532 }
|
|
calculates arc length and z for a stereo hit.
03347 { 03348 const TMDCWireHit & h = * link.hit(); 03349 HepVector3D X = 0.5 * (h.wire()->forwardPosition() 03350 + h.wire()->backwardPosition()); 03351 // double theta = atan2(X.y(), X.x()); 03352 // HepVector3D lr(h.distance(WireHitLeft) * sin(theta), 03353 // - h.distance(WireHitLeft) * cos(theta), 03354 // 0.); 03355 03356 HepVector3D xx = HepVector3D(X.x(), X.y(), 0.); 03357 HepPoint3D center = _helix->center(); 03358 HepVector3D yy = center - xx; 03359 HepVector3D ww = HepVector3D(yy.x(), yy.y(), 0.); 03360 double wwmag2 = ww.mag2(); 03361 double wwmag = sqrt(wwmag2); 03362 HepVector3D lr(h.drift(WireHitLeft)/wwmag * ww.x(), 03363 h.drift(WireHitLeft)/wwmag * ww.y(), 03364 0.); 03365 03366 //...Check left or right... 03367 // // change to bes3 .. test.. 03368 if (link.leftRight() == WireHitRight) lr = - lr; 03369 // if (link.leftRight() == WireHitLeft) lr = - lr; 03370 else if (link.leftRight() == 2) lr = ORIGIN; 03371 X += lr; 03372 03373 //...Prepare vectors... 03374 // HepPoint3D center = _helix->center(); 03375 HepPoint3D tmp(-9999., -9999., 0.); 03376 HepVector3D x = HepVector3D(X.x(), X.y(), 0.); 03377 HepVector3D w = x - center; 03378 // //modified the next sentence because the direction are different from belle. 03379 HepVector3D V = h.wire()->direction(); 03380 // // to bes3 03381 // // HepVector3D V = - h.wire()->direction(); 03382 // std::cout<<"TTrack::wire direction:"<<h.wire()->direction()<<endl; 03383 HepVector3D v = HepVector3D(V.x(), V.y(), 0.); 03384 double vmag2 = v.mag2(); 03385 double vmag = sqrt(vmag2); 03386 03387 double r = _helix->curv(); 03388 double wv = w.dot(v); 03389 // //zsl for bes3 03390 // wv = abs(wv); 03391 double d2 = wv * wv - vmag2 * (w.mag2() - r * r); 03392 // std::cout<<"sz,Track::vmag:"<<vmag<<", helix_r:"<<r<<", wv:"<<wv<<", d:"<<sqrt(d2)<<endl; 03393 03394 //...No crossing in R/Phi plane... This is too tight... 03395 03396 if (d2 < 0.) { 03397 link.position(tmp); 03398 03399 #ifdef TRKRECO_DEBUG 03400 std::cout << "TTrack !!! stereo: 0. > d2 = " << d2 << " " 03401 << link.leftRight() << std::endl; 03402 #endif 03403 return -1; 03404 } 03405 double d = sqrt(d2); 03406 03407 //...Cal. length to crossing points... 03408 double l[2]; 03409 l[0] = (- wv + d) / vmag2; 03410 l[1] = (- wv - d) / vmag2; 03411 03412 //...Cal. z of crossing points... 03413 bool ok[2]; 03414 ok[0] = true; 03415 ok[1] = true; 03416 double z[2]; 03417 z[0] = X.z() + l[0] * V.z(); 03418 z[1] = X.z() + l[1] * V.z(); 03419 // std::cout<<"X.z():"<<X.z()<<endl; 03420 // std::cout<<"szPosition::z(0),z(1),and leftRight:"<<z[0]<<","<<z[1]<<","<<link.leftRight()<<endl; 03421 // std::cout<<"szPosition::wire backwardPosition and forwardPosition:"<< h.wire()->backwardPosition().z()<<","<<h.wire()->forwardPosition().z()<<endl; 03422 #ifdef TRKRECO_DEBUG_DETAIL 03423 // std::cout << " l0, l1 = " << l[0] << ", " << l[1] << std::endl; 03424 // std::cout << " z0, z1 = " << z[0] << ", " << z[1] << std::endl; 03425 #endif 03426 03427 //...Check z position... 03428 //modified because Belle backward and forward are different from BESIII 03429 /* if (link.leftRight() == 2) { 03430 if (z[0] > h.wire()->backwardPosition().z()+20. 03431 || z[0] < h.wire()->forwardPosition().z()-20.) ok[0] = false; 03432 if (z[1] > h.wire()->backwardPosition().z()+20. 03433 || z[1] < h.wire()->forwardPosition().z()-20.) ok[1] = false; 03434 } 03435 else { 03436 if (z[0] > h.wire()->backwardPosition().z() 03437 || z[0] < h.wire()->forwardPosition().z() ) ok[0] = false; 03438 if (z[1] > h.wire()->backwardPosition().z() 03439 || z[1] < h.wire()->forwardPosition().z() ) ok[1] = false; 03440 } 03441 if ((! ok[0]) && (! ok[1])) { 03442 link.position(tmp); 03443 return -2; 03444 }*/ 03445 //belle... 03446 if (link.leftRight() == 2) { 03447 if (z[0] < h.wire()->backwardPosition().z() - 20. 03448 || z[0] > h.wire()->forwardPosition().z() + 20.) ok[0] = false; 03449 if (z[1] < h.wire()->backwardPosition().z()-20. 03450 || z[1] > h.wire()->forwardPosition().z()+20.) ok[1] = false; 03451 } 03452 else { 03453 if (z[0] < h.wire()->backwardPosition().z() 03454 || z[0] > h.wire()->forwardPosition().z()) ok[0] = false; 03455 if (z[1] < h.wire()->backwardPosition().z() 03456 || z[1] > h.wire()->forwardPosition().z()) ok[1] = false; 03457 } 03458 if ((! ok[0]) && (! ok[1])) { 03459 link.position(tmp); 03460 return -2; 03461 } 03462 03463 //...Cal. xy position of crossing points... 03464 HepVector3D p[2]; 03465 p[0] = x + l[0] * v; 03466 p[1] = x + l[1] * v; 03467 /* if (_charge * (center.x() * p[0].y() - center.y() * p[0].x()) < 0.) //liuqg, cosmic... 03468 ok[0] = false; 03469 if (_charge * (center.x() * p[1].y() - center.y() * p[1].x()) < 0.) 03470 ok[1] = false; 03471 if ((! ok[0]) && (! ok[1])){ 03472 // double tmp1 = _charge * (center.x() * p[0].y() - center.y() * p[0].x()); 03473 // double tmp2 = _charge * (center.x() * p[1].y() - center.y() * p[1].x()) ; 03474 // if (link.leftRight() == 2) std::cout<<tmp1<<" "<<tmp2<<std::endl; 03475 link.position(tmp); 03476 return -3; 03477 } 03478 */ 03479 //...Which one is the best?... Study needed... 03480 unsigned best = 0; 03481 if (ok[1]) best = 1; 03482 03483 //...Cal. arc length... 03484 double cosdPhi = - center.dot((p[best] - center).unit()) / center.mag(); 03485 double dPhi; 03486 if(fabs(cosdPhi)<=1.0) { 03487 dPhi = acos(cosdPhi); 03488 } else if (cosdPhi>1.0) { 03489 dPhi = 0.0; 03490 } else { 03491 dPhi = M_PI; 03492 } 03493 03494 //...Finish... 03495 tmp.setX(r * dPhi); 03496 tmp.setY(z[best]); 03497 link.position(tmp); 03498 03499 return 0; 03500 }
|
|
|
|
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 type.
Reimplemented from TTrackBase. |
|
returns type. Definition is depending on an object type.
Reimplemented from TTrackBase. 00560 { 00561 return defineType(); 00562 }
|
|
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 }
|
|
|
|
|
|
|
|
|
|
|
|
Reimplemented from TTrackBase. |
|
|
|
Reimplemented from TTrackBase. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reimplemented from TTrackBase. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|