#include <TTrack.h>
Inheritance diagram for TTrack:
Public Member Functions | |
TTrack () | |
Default constructor. | |
TTrack (const TCircle &) | |
Constructor. | |
TTrack (const TTrack &) | |
Copy constructor. | |
TTrack (const T3DLine &) | |
Constructor. | |
TTrack (const Helix &) | |
Constructor. | |
TTrack (const TRunge &) | |
virtual | ~TTrack () |
Destructor. | |
const std::string & | name (void) const |
returns/sets name. | |
const std::string & | name (const std::string &newName) |
TTrack * | mother (void) const |
sets/returns mother/daughter. | |
TTrack * | mother (TTrack *) |
TTrack * | daughter (void) const |
TTrack * | daughter (TTrack *) |
unsigned | objectType (void) const |
returns type. | |
unsigned | type (void) const |
returns type. Definition is depending on an object type. | |
unsigned | finder (void) const |
sets/returns finder. | |
unsigned | finder (unsigned finderMask) |
void | setFinderType (unsigned) |
unsigned | getFinderType (void) const |
unsigned | quality (void) const |
sets/returns quality. | |
unsigned | quality (unsigned qualityMask) |
unsigned | fitting (void) const |
sets/returns fitting status. | |
unsigned | fitting (unsigned fitMask) |
unsigned | state (void) const |
returns/sets internal state.(for bank output) | |
void | assign (unsigned maskForWireHit) |
assigns wire hits to this track. | |
void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
double | charge (void) const |
returns charge. | |
const Helix & | helix (void) const |
returns helix parameter. | |
Hep3Vector | p (void) const |
returns momentum. | |
double | ptot (void) const |
returns magnitude of momentum. | |
double | pt (void) const |
returns Pt. | |
double | pz (void) const |
returns Pz. | |
double | impact (void) const |
returns signed impact parameter to the origin. | |
TPoint2D | center (void) const |
returns position of helix center. | |
double | radius (void) const |
returns signed radius. | |
unsigned | ndf (void) const |
returns NDF. | |
double | chi2 (void) const |
returns chi2. | |
double | confidenceLevel (void) const |
returns confidence level. | |
AList< TSegment > & | segments (void) |
returns AList<TSegment>. | |
const AList< TSegment > & | segments (void) 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 | approach2D (TMLink &) const |
int | szPosition (TMLink &link) const |
calculates arc length and z for a stereo hit. | |
int | szPosition (const TSegment &segment, TMLink &link) const |
calculates arc length and z for a segment. Results are stored in TMLink. | |
int | szPosition (const HepPoint3D &p, HepPoint3D &szPosition) const |
calculates arc length for a point. | |
int | stereoHitForCurl (TMLink &link, AList< HepPoint3D > &arcZList) const |
int | stereoHitForCurl (TMLink &link, TMLink &link1) const |
int | stereoHitForCurl (TMLink &link, TMLink &link1, TMLink &link2) const |
void | deleteListForCurl (AList< HepPoint3D > &l1, AList< HepPoint3D > &l2) const |
void | deleteListForCurl (AList< HepPoint3D > &l1, AList< HepPoint3D > &l2, AList< HepPoint3D > &l3) const |
int | stereoHitForCurl (AList< TMLink > &) const |
calculates arc length and z for a stereo hit. uses these functions for curl tracks(included svd version). | |
double | charge (double) |
sets charge. | |
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. | |
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 | movePivot (void) |
moves pivot to the inner most hit. | |
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 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 > & | 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 > & | links (unsigned mask=0) const |
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0. | |
unsigned | nLinks (unsigned mask=0) const |
returns # of masked TMLinks assigned to this track object. | |
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. | |
unsigned | nCores (unsigned mask=0) const |
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0. | |
void | update (void) const |
update cache. | |
void | append (TMLink &) |
appends a TMLink. | |
void | append (const AList< TMLink > &) |
appends TMLinks. | |
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 | remove (TMLink &a) |
removes a TMLink. | |
void | remove (const AList< TMLink > &) |
removes TMLinks. | |
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 int | DropWorst () |
virtual void | removeLinks (void) |
virtual double | distance (const TMLink &) const |
returns distance to a position of TMLink in TMLink space. | |
unsigned | testByApproach (const TMLink &list, double sigma) const |
returns # of good hits to be appended. | |
unsigned | testByApproach (const AList< TMLink > &list, double sigma) const |
virtual int | fit (void) |
fits itself by a default fitter. Error was happened if return value is not zero. | |
const TMFitter *const | fitter (void) const |
returns a pointer to a default fitter. | |
const TMFitter *const | fitter (const TMFitter *) |
sets a default fitter. | |
void | falseFit () |
false Fit | |
TMLink * | operator[] (unsigned i) const |
const TTrackHEP *const | hep (void) const |
returns TTrackHEP. | |
unsigned | nHeps (void) const |
returns # of contributed TTrackHEP tracks. | |
const TTrackMC *const | mc (void) const |
returns a pointer to TTrackMC. | |
bool | fitted (void) const |
returns true if fitted. | |
bool | fittedWithCathode (void) const |
returns true if fitted with cathode hits(TEMPORARY). | |
Protected Attributes | |
AList< TMLink > | _links |
bool | _fitted |
bool | _fittedWithCathode |
TTrackMC * | _mc |
Private Member Functions | |
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 (const TMLink &link, double dPhi, Vector &dxda, Vector &dyda, Vector &dzda) const |
int | dxda2D (const TMLink &link, double dPhi, Vector &dxda, Vector &dyda) const |
int | dxda2D (double dPhi, Vector &dxda, Vector &dyda) const |
unsigned | defineType (void) const |
Private Attributes | |
unsigned | _findertype |
unsigned | _state |
double | _charge |
AList< TSegment > | _segments |
TTrack * | _mother |
TTrack * | _daughter |
AList< TMLink > | _finalHits |
AList< TMLink > | _associateHits |
Helix * | _helix |
unsigned | _ndf |
double | _chi2 |
std::string | _name |
unsigned | _type |
IMagneticFieldSvc * | m_pmgnIMF |
Static Private Attributes | |
static const THelixFitter | _fitter = THelixFitter("TTrack Default Helix Fitter") |
Friends | |
class | TTrackManager |
class | TrkReco |
class | THelixFitter |
class | TCosmicFitter |
class | Refit |
class | TBuilder |
class | TBuilder0 |
class | TBuilderCosmic |
class | TBuilderCurl |
class | TPMCurlFinder |
class | TCurlFinder |
Definition at line 129 of file TTrack.h.
TTrack::TTrack | ( | ) |
Default constructor.
Definition at line 207 of file TTrack.cxx.
References m_pmgnIMF.
00208 : TTrackBase(), 00209 _charge(1.), 00210 _helix(new Helix(ORIGIN, Vector(5, 0), SymMatrix(5, 0))), 00211 _ndf(0), 00212 _chi2(0.), 00213 _name("empty track"), 00214 _state(0), 00215 _mother(0), 00216 _daughter(0) { 00217 //jialk 00218 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00219 if(scmgn!=StatusCode::SUCCESS) { 00220 std::cout<< __FILE__<<" "<<__LINE__<<" Unable to open Magnetic field service"<<std::endl; 00221 } 00222 }
TTrack::TTrack | ( | const TCircle & | ) |
Constructor.
Definition at line 81 of file TTrack.cxx.
References _charge, TTrackBase::_fitted, TTrackBase::_fittedWithCathode, _fitter, _helix, TTrackBase::_links, Helix::a(), TCircle::center(), cos(), TTrackBase::fitter(), IMagneticFieldSvc::getReferField(), genRecEmupikp::i, M_PI, m_pmgnIMF, ORIGIN, and TCircle::radius().
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<< __FILE__<<" "<<__LINE__<<" Unable to open Magnetic field service"<<std::endl; 00097 } 00098 00099 //_fitter.setMagneticFieldPointer(m_pmgnIMF);//yzhang add 2012-05-04 00100 //cout<<"TTrack: "<<m_pmgnIMF->getReferField()<<endl; 00101 //...Set a defualt fitter... 00102 fitter(& TTrack::_fitter); 00103 00104 //...Calculate helix parameters... 00105 Vector a(5); 00106 a[1] = fmod(atan2(_charge * (c.center().y() - ORIGIN.y()), 00107 _charge * (c.center().x() - ORIGIN.x())) 00108 + 4. * M_PI, 00109 2. * M_PI); 00110 // a[2] = Helix::ConstantAlpha / c.radius(); 00111 // a[2] = 333.564095 / c.radius(); 00112 const double Bz = -1000*m_pmgnIMF->getReferField(); 00113 a[2] = 333.564095/ (c.radius() * Bz); 00114 a[0] = (c.center().x() - ORIGIN.x()) / cos(a[1]) - c.radius(); 00115 a[3] = 0.; 00116 a[4] = 0.; 00117 _helix->a(a); 00118 00119 //...Update links... 00120 unsigned n = _links.length(); 00121 for (unsigned i = 0; i < n; i++) 00122 _links[i]->track(this); 00123 00124 _fitted = false; 00125 _fittedWithCathode = false; 00126 /* 00127 //jialk 00128 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00129 if(scmgn!=StatusCode::SUCCESS) { 00130 std::cout<< __FILE__<<" "<<__LINE__<<" Unable to open Magnetic field service"<<std::endl; 00131 } 00132 */ 00133 }
TTrack::TTrack | ( | const TTrack & | ) |
Copy constructor.
Definition at line 135 of file TTrack.cxx.
References m_pmgnIMF.
00136 : TTrackBase((TTrackBase &) a), 00137 _charge(a._charge), 00138 _segments(a._segments), 00139 _helix(new Helix(* a._helix)), 00140 _ndf(a._ndf), 00141 _chi2(a._chi2), 00142 _name("copy of " + a._name), 00143 _type(a._type), 00144 // _catHits(a._catHits), 00145 _state(a._state), 00146 _mother(a._mother), 00147 _daughter(a._daughter) { 00148 //jialk 00149 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00150 if(scmgn!=StatusCode::SUCCESS) { 00151 std::cout<< __FILE__<<" "<<__LINE__<<" Unable to open Magnetic field service"<<std::endl; 00152 } 00153 }
TTrack::TTrack | ( | const T3DLine & | ) |
Constructor.
TTrack::TTrack | ( | const Helix & | ) |
Constructor.
Definition at line 181 of file TTrack.cxx.
References _charge, TTrackBase::_fitted, TTrackBase::_fittedWithCathode, _fitter, _helix, TTrackBase::fitter(), Helix::kappa(), and m_pmgnIMF.
00182 : TTrackBase(), 00183 _helix(new Helix(h)), 00184 _ndf(0), 00185 _chi2(0.), 00186 _name("none"), 00187 _type(0), 00188 _state(0), 00189 _mother(0), 00190 _daughter(0) { 00191 00192 //...Set a defualt fitter... 00193 fitter(& TTrack::_fitter); 00194 00195 if(_helix->kappa() > 0.)_charge = 1.; 00196 else _charge = -1.; 00197 00198 _fitted = false; 00199 _fittedWithCathode = false; 00200 //jialk 00201 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00202 if(scmgn!=StatusCode::SUCCESS) { 00203 std::cout<< __FILE__<<" "<<__LINE__<<" Unable to open Magnetic field service"<<std::endl; 00204 } 00205 }
TTrack::TTrack | ( | const TRunge & | ) |
Definition at line 168 of file TTrack.cxx.
References _charge, _helix, and Helix::kappa().
00169 : TTrackBase((TTrackBase &) a), 00170 _helix(new Helix( a.helix())), 00171 _ndf(a.ndf()), 00172 _chi2(a.chi2()), 00173 _name("no"), 00174 _type(0), 00175 _state(0), 00176 _mother(0), 00177 _daughter(0) { 00178 if(_helix->kappa() > 0.)_charge = 1.; 00179 else _charge = -1.; 00180 }
TTrack::~TTrack | ( | ) | [virtual] |
Destructor.
Definition at line 224 of file TTrack.cxx.
References _helix.
00224 { 00225 delete _helix; 00226 }
void TTrackBase::append | ( | const AList< TMLink > & | ) | [inherited] |
appends TMLinks.
Definition at line 384 of file TTrackBase.cxx.
References TTrackBase::_fitted, TTrackBase::_fittedWithCathode, TTrackBase::_links, TTrackBase::_updated, genRecEmupikp::i, and WireHitUsed.
00384 { 00385 AList<TMLink> tmp; 00386 for (unsigned i = 0; i < a.length(); i++) { 00387 if ((_links.hasMember(a[i])) || (a[i]->hit()->state() & WireHitUsed)) { 00388 #ifdef TRKRECO_DEBUG_DETAIL 00389 std::cout << " TTrackBase::append(list) !!! "; 00390 std::cout << a[i]->wire()->name(); 00391 std::cout << " Hey!, this is already used! Don't mess with me."; 00392 std::cout << std::endl; 00393 #endif 00394 continue; 00395 } 00396 else { 00397 tmp.append(a[i]); 00398 } 00399 } 00400 _links.append(tmp); 00401 _updated = false; 00402 _fitted = false; 00403 _fittedWithCathode = false; // added by matsu ( 1999/05/24 ) 00404 }
void TTrackBase::append | ( | TMLink & | ) | [inherited] |
appends a TMLink.
Definition at line 362 of file TTrackBase.cxx.
References TTrackBase::_fitted, TTrackBase::_fittedWithCathode, TTrackBase::_links, TTrackBase::_updated, TMLink::hit(), TMDCWire::name(), TMDCWireHit::state(), TMLink::wire(), and WireHitUsed.
Referenced by TBuilderCosmic::buildStereo(), TBuilder0::buildStereo(), TBuilder::buildStereo(), TBuilder0::buildStereo0(), TBuilderCurl::buildStereoMC(), TBuilder::buildStereoNew(), THistogram::clusters(), THistogram::clusters0(), TCurlFinder::dividing2DTrack(), TrkReco::execute(), TConformalFinder::link(), TCurlFinder::make2DTrack(), TTrackManager::merge(), TTrackManager::salvageAssociateHits(), TSegment0::splitAV(), TSegment::splitAV(), TSegment0::splitParallel(), TSegment::splitParallel(), and TConformalFinder0::standardFinding().
00362 { 00363 if ((a.hit()->state() & WireHitUsed)) { 00364 #ifdef TRKRECO_DEBUG_DETAIL 00365 std::cout << "TTrackBase::append !!! " << a.wire()->name() 00366 << " this is already used by another track!" << std::endl; 00367 #endif 00368 return; 00369 } 00370 if (_links.hasMember(a)) { 00371 #ifdef TRKRECO_DEBUG_DETAIL 00372 std::cout << "TTrackBase::append !!! " << a.wire()->name() 00373 << " this is already included in this track!" << std::endl; 00374 #endif 00375 return; 00376 } 00377 _links.append(a); 00378 _updated = false; 00379 _fitted = false; 00380 _fittedWithCathode = false; // added by matsu ( 1999/05/24 ) 00381 }
void TTrackBase::appendByApproach | ( | AList< TMLink > & | list, | |
double | maxSigma | |||
) | [inherited] |
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
Definition at line 101 of file TTrackBase.cxx.
References TTrackBase::_fitted, TTrackBase::_links, TTrackBase::_updated, TTrackBase::approach(), TTrackBase::distance(), showlog::err, genRecEmupikp::i, and WireHitUsed.
Referenced by TBuilder0::appendClusters(), and TTrackManager::salvage().
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 }
void TTrackBase::appendByDistance | ( | AList< TMLink > & | list, | |
double | maxDistance | |||
) | [inherited] |
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
Definition at line 152 of file TTrackBase.cxx.
00152 { 00153 std::cout << "TTrackBase::appendByDistance !!! not implemented" << std::endl; 00154 list.removeAll(); 00155 }
Definition at line 3059 of file TTrack.cxx.
References _helix, Helix::center(), cos(), TMLink::dPhi(), first, IMagneticFieldSvc::getReferField(), Helix::kappa(), m_pmgnIMF, Helix::phi0(), TMLink::positionOnTrack(), TMLink::positionOnWire(), sin(), Helix::tanl(), w, TMLink::wire(), x, and Helix::x().
03059 { 03060 //...Cal. dPhi to rotate... 03061 const TMDCWire & w = * link.wire(); 03062 double wp[3]; w.xyPosition(wp); 03063 double wb[3]; w.backwardPosition(wb); 03064 double v[3]; 03065 v[0] = w.direction().x(); 03066 v[1] = w.direction().y(); 03067 v[2] = w.direction().z(); 03068 //...Sag correction... 03069 if (doSagCorrection) { 03070 HepVector3D dir = w.direction(); 03071 HepPoint3D xw(wp[0], wp[1], wp[2]); 03072 HepPoint3D wireBackwardPosition(wb[0], wb[1], wb[2]); 03073 w.wirePosition(link.positionOnTrack().z(), 03074 xw, 03075 wireBackwardPosition, 03076 dir); 03077 v[0] = dir.x(); 03078 v[1] = dir.y(); 03079 v[2] = dir.z(); 03080 wp[0] = xw.x(); 03081 wp[1] = xw.y(); 03082 wp[2] = xw.z(); 03083 wb[0] = wireBackwardPosition.x(); 03084 wb[1] = wireBackwardPosition.y(); 03085 wb[2] = wireBackwardPosition.z(); 03086 } 03087 //...Cal. dPhi to rotate... 03088 const HepPoint3D & xc = _helix->center(); 03089 double xt[3]; _helix->x(0., xt); 03090 double x0 = - xc.x(); 03091 double y0 = - xc.y(); 03092 double x1 = wp[0] + x0; 03093 double y1 = wp[1] + y0; 03094 x0 += xt[0]; 03095 y0 += xt[1]; 03096 double dPhi = atan2(x0 * y1 - y0 * x1, x0 * x1 + y0 * y1); 03097 //...Setup... 03098 double kappa = _helix->kappa(); 03099 double phi0 = _helix->phi0(); 03100 //yzhang 2012-08-30 03101 //...Axial case... 03102 // if (w.axial()) { 03103 // link.positionOnTrack(_helix->x(dPhi)); 03104 // HepPoint3D x(wp[0], wp[1], wp[2]); 03105 // x.setZ(link.positionOnTrack().z()); 03106 // link.positionOnWire(x); 03107 // link.dPhi(dPhi); 03108 // return 0; 03109 // } 03110 #ifdef TRKRECO_DEBUG 03111 double firstdfdphi = 0.; 03112 static bool first = true; 03113 if (first) { 03114 // extern BelleTupleManager * BASF_Histogram; 03115 // BelleTupleManager * m = BASF_Histogram; 03116 // h_nTrial = m->histogram("TTrack::approach nTrial", 100, 0., 100.); 03117 } 03118 #endif 03119 03120 //...Stereo case... 03121 // double rho = Helix::ConstantAlpha / kappa; 03122 // double rho = 333.564095 / kappa; 03123 // yzhang 2012-05-03 delete 03124 //double rho = 333.564095/ kappa; 03125 //yzhang add 03126 Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 03127 if(m_pmgnIMF==NULL) { 03128 std::cout<< __FILE__<<" "<<__LINE__<<" Unable to open Magnetic field service"<<std::endl; 03129 } 03130 const double Bz = -1000*m_pmgnIMF->getReferField(); 03131 double rho = 333.564095/(kappa * Bz); 03132 //zhangy 03133 double tanLambda = _helix->tanl(); 03134 static Vector x(3); 03135 double t_x[3]; 03136 double t_dXdPhi[3]; 03137 const double convergence = 1.0e-5; 03138 double l; 03139 unsigned nTrial = 0; 03140 while (nTrial < 100) { 03141 03142 x = link.positionOnTrack(_helix->x(dPhi)); 03143 t_x[0] = x[0]; 03144 t_x[1] = x[1]; 03145 t_x[2] = x[2]; 03146 03147 l = v[0] * t_x[0] + v[1] * t_x[1] + v[2] * t_x[2] 03148 - v[0] * wb[0] - v[1] * wb[1] - v[2] * wb[2]; 03149 03150 double rcosPhi = rho * cos(phi0 + dPhi); 03151 double rsinPhi = rho * sin(phi0 + dPhi); 03152 t_dXdPhi[0] = rsinPhi; 03153 t_dXdPhi[1] = - rcosPhi; 03154 t_dXdPhi[2] = - rho * tanLambda; 03155 03156 //...f = d(Distance) / d phi... 03157 double t_d2Xd2Phi[2]; 03158 t_d2Xd2Phi[0] = rcosPhi; 03159 t_d2Xd2Phi[1] = rsinPhi; 03160 03161 //...iw new... 03162 double n[3]; 03163 n[0] = t_x[0] - wb[0]; 03164 n[1] = t_x[1] - wb[1]; 03165 n[2] = t_x[2] - wb[2]; 03166 03167 double a[3]; 03168 a[0] = n[0] - l * v[0]; 03169 a[1] = n[1] - l * v[1]; 03170 a[2] = n[2] - l * v[2]; 03171 double dfdphi = a[0] * t_dXdPhi[0] 03172 + a[1] * t_dXdPhi[1] 03173 + a[2] * t_dXdPhi[2]; 03174 03175 #ifdef TRKRECO_DEBUG 03176 if (nTrial == 0) { 03177 // break; 03178 firstdfdphi = dfdphi; 03179 } 03180 03181 //...Check bad case... 03182 if (nTrial > 3) { 03183 std::cout << "TTrack::approach ... " << w.name() << " " 03184 << "dfdphi(0)=" << firstdfdphi 03185 << ",(" << nTrial << ")=" << dfdphi << endl; 03186 } 03187 #endif 03188 03189 //...Is it converged?... 03190 if (fabs(dfdphi) < convergence) 03191 break; 03192 03193 double dv = v[0] * t_dXdPhi[0] 03194 + v[1] * t_dXdPhi[1] 03195 + v[2] * t_dXdPhi[2]; 03196 double t0 = t_dXdPhi[0] * t_dXdPhi[0] 03197 + t_dXdPhi[1] * t_dXdPhi[1] 03198 + t_dXdPhi[2] * t_dXdPhi[2]; 03199 double d2fd2phi = t0 - dv * dv 03200 + a[0] * t_d2Xd2Phi[0] 03201 + a[1] * t_d2Xd2Phi[1]; 03202 // + a[2] * t_d2Xd2Phi[2]; 03203 03204 dPhi -= dfdphi / d2fd2phi; 03205 03206 // cout << "nTrial=" << nTrial << endl; 03207 // cout << "iw f,df,dphi=" << dfdphi << "," << d2fd2phi << "," << dPhi << endl; 03208 03209 ++nTrial; 03210 } 03211 03212 //...Cal. positions... 03213 link.positionOnWire(HepPoint3D(wb[0] + l * v[0], 03214 wb[1] + l * v[1], 03215 wb[2] + l * v[2])); 03216 link.dPhi(dPhi); 03217 03218 #ifdef TRKRECO_DEBUG 03219 // h_nTrial->accumulate((float) nTrial + .5); 03220 #endif 03221 03222 return nTrial; 03223 }
int TTrack::approach | ( | TMLink & | ) | const [virtual] |
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.
Definition at line 296 of file TTrack.cxx.
00296 { 00297 return approach(l, false); 00298 }
int TTrack::approach2D | ( | TMLink & | ) | const |
Definition at line 2891 of file TTrack.cxx.
References _helix, Helix::a(), Helix::center(), TMLink::dPhi(), TMLink::positionOnTrack(), TMLink::positionOnWire(), w, TMLink::wire(), and Helix::x().
Referenced by fit2D().
02891 { 02892 02893 const TMDCWire &w = *l.wire(); 02894 double kappa = _helix->a()[2]; 02895 double phi0 = _helix->a()[1]; 02896 HepPoint3D xc(_helix->center()); 02897 HepPoint3D xw(w.xyPosition()); 02898 HepPoint3D xt(_helix->x()); 02899 HepVector3D v0(xt-xc); 02900 HepVector3D v1(xw-xc); 02901 02902 double vCrs = v0.x() * v1.y() - v0.y() * v1.x(); 02903 double vDot = v0.x() * v1.x() + v0.y() * v1.y(); 02904 double dPhi = atan2(vCrs, vDot); 02905 02906 xt = _helix->x(dPhi); 02907 xt.setZ(0.); 02908 l.positionOnTrack(xt); 02909 xw.setZ(0.); 02910 l.positionOnWire(xw); 02911 l.dPhi(dPhi); 02912 return 0; 02913 }
void TTrack::assign | ( | unsigned | maskForWireHit | ) |
assigns wire hits to this track.
Definition at line 3635 of file TTrack.cxx.
References TTrackBase::_links, TMLink::hit(), TMDCWire::name(), TMDCWireHit::state(), TMDCWireHit::track(), TMDCWireHit::wire(), and WireHitUsed.
Referenced by TCurlFinder::makeWithMC().
03635 { 03636 hitMask |= WireHitUsed; 03637 03638 unsigned n = _links.length(); 03639 for (unsigned i = 0; i < n; i++) { 03640 TMLink * l = _links[i]; 03641 const TMDCWireHit * h = l->hit(); 03642 #ifdef TRKRECO_DEBUG 03643 if (h->track()) { 03644 std::cout << "TTrack::assign !!! hit(" << h->wire()->name(); 03645 std::cout << ") already assigned" << std::endl; 03646 } 03647 #endif 03648 03649 //...This function will be moved to TTrackManager... 03650 h->track((TTrack *) this); 03651 h->state(h->state() | hitMask); 03652 } 03653 }
Definition at line 717 of file TTrack.h.
References _associateHits.
00717 { 00718 _associateHits = list; 00719 return _associateHits; 00720 }
const AList< TMLink > & TTrack::associateHits | ( | void | ) | const [inline] |
sets/returns a list of associated TMLink which are used for table output.
Definition at line 724 of file TTrack.h.
References _associateHits.
00724 { 00725 return _associateHits; 00726 }
TPoint2D TTrack::center | ( | void | ) | const [inline] |
returns position of helix center.
Definition at line 595 of file TTrack.h.
References _helix, and Helix::center().
Referenced by TConformalFinder::crossPoints().
double TTrack::charge | ( | double | ) | [inline] |
double TTrack::charge | ( | void | ) | const [inline] |
returns charge.
Definition at line 504 of file TTrack.h.
References _charge.
Referenced by TBuilderCurl::buildStereo(), TBuilderCosmic::buildStereo(), TBuilder0::buildStereo(), TBuilder::buildStereo(), TBuilder0::buildStereo0(), TBuilderCurl::buildStereoMC(), calVirtualCircle(), TTrackMC::compare(), TConformalFinder::crossPoints(), TCurlFinder::findCloseHits(), TBuilderCurl::makeLine(), moveLR(), TCurlFinder::salvage3DTrack(), and TBuilderCurl::setArcZ().
00504 { 00505 return _charge; 00506 }
double TTrack::chi2 | ( | void | ) | const [inline] |
double TTrack::confidenceLevel | ( | void | ) | const [inline] |
returns confidence level.
Definition at line 547 of file TTrack.h.
References _chi2, _ndf, and chisq2confLevel().
00547 { 00548 return chisq2confLevel((int) _ndf, _chi2); 00549 }
const AList< TMLink > & TTrackBase::cores | ( | unsigned | mask = 0 |
) | const [inherited] |
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
Definition at line 317 of file TTrackBase.cxx.
References TTrackBase::_cores, TTrackBase::_updated, and TTrackBase::update().
Referenced by TBuilder::buildStereoNew(), TConformalFinder::expand(), movePivot(), TRunge::SetFlightLength(), and szPosition().
00317 { 00318 if (mask) 00319 std::cout << "TTrackBase::cores !!! mask is not supported" << std::endl; 00320 if (! _updated) update(); 00321 return _cores; 00322 }
Definition at line 663 of file TTrack.h.
References _daughter, _state, TrackHasDaughter, and TrackRelationShift.
00663 { 00664 if (a) _state |= (TrackHasDaughter << TrackRelationShift); 00665 else _state &= (~(TrackHasDaughter << TrackRelationShift)); 00666 return _daughter = a; 00667 }
TTrack * TTrack::daughter | ( | void | ) | const [inline] |
Definition at line 657 of file TTrack.h.
References _daughter.
Referenced by TCurlFinder::makeCurlTracks().
00657 { 00658 return _daughter; 00659 }
unsigned TTrack::defineType | ( | void | ) | const [private] |
Definition at line 3015 of file TTrack.cxx.
References _type, impact(), pt(), radius(), TrackTypeCircle, TrackTypeCosmic, TrackTypeCurl, and TrackTypeNormal.
Referenced by type().
03015 { 03016 bool highPt = true; 03017 if (pt() < 0.2) highPt = false; //Bes 03018 bool fromIP = true; 03019 if (fabs(impact()) > 8.3) fromIP = false; 03020 03021 if (fromIP && highPt) return _type = TrackTypeNormal; 03022 else if (fromIP && (! highPt)) return _type = TrackTypeCurl; 03023 03024 if ((fabs(radius()) * 2. + fabs(impact())) < 81.) //Bes 03025 return _type = TrackTypeCircle; 03026 return _type = TrackTypeCosmic; 03027 }
void TTrack::deleteListForCurl | ( | AList< HepPoint3D > & | l1, | |
AList< HepPoint3D > & | l2, | |||
AList< HepPoint3D > & | l3 | |||
) | const |
void TTrack::deleteListForCurl | ( | AList< HepPoint3D > & | l1, | |
AList< HepPoint3D > & | l2 | |||
) | const |
double TTrackBase::distance | ( | const TMLink & | ) | const [virtual, inherited] |
returns distance to a position of TMLink in TMLink space.
Reimplemented in TLine0, and TMLine.
Definition at line 89 of file TTrackBase.cxx.
Referenced by TTrackBase::appendByApproach(), fit2D(), and TTrackBase::testByApproach().
00089 { 00090 std::cout << "TTrackBase::distance !!! not implemented" << std::endl; 00091 return 0.; 00092 }
int TTrackBase::DropWorst | ( | ) | [virtual, inherited] |
Definition at line 212 of file TTrackBase.cxx.
References TTrackBase::_fitted, TTrackBase::_links, TTrackBase::_updated, and genRecEmupikp::i.
Referenced by TrkReco::execute().
00212 { 00213 AList<TMLink> bad; 00214 int jbad=-1; 00215 double sigma=0; 00216 unsigned n = _links.length(); 00217 double chi2=0; 00218 for (unsigned i = 0; i < n; i++){ 00219 // if(g_sigmalyr1)g_sigmalyr1->fill(sqrt(_links[i]->pull()),_links[i]->wire()->layerId()); 00220 chi2+=_links[i]->pull(); 00221 if (_links[i]->pull() > sigma){ 00222 jbad=i; 00223 sigma = _links[i]->pull(); 00224 } 00225 } 00226 00227 chi2=chi2/n; 00228 //if(sigma>9){bad.append(_links[jbad]);if(g_sigmalyr)g_sigmalyr->fill(sqrt(sigma),_links[jbad]->wire()->layerId());} 00229 // if(sigma>20.25&&chi2>2.08){bad.append(_links[jbad]);} 00230 if(sigma>9){bad.append(_links[jbad]);} 00231 if (bad.length()) { 00232 _links.remove(bad); 00233 _fitted = false; 00234 _updated = false; 00235 } 00236 return bad.length(); 00237 }
void TTrack::dump | ( | const std::string & | message = std::string("") , |
|
const std::string & | prefix = std::string("") | |||
) | const [virtual] |
dumps debug information.
Reimplemented from TTrackBase.
Definition at line 229 of file TTrack.cxx.
References _charge, _chi2, _helix, TTrackBase::_links, _ndf, Helix::a(), Helix::center(), TTrackBase::dump(), genRecEmupikp::i, TTrackBase::nCores(), RealDBUtil::npos, p(), Helix::pivot(), pt(), and deljobs::string.
00229 { 00230 bool def = false; 00231 if (msg == "") def = true; 00232 std::string pre = pre0; 00233 std::string tab; 00234 for (unsigned i = 0; i < pre.length(); i++) 00235 tab += " "; 00236 if (def || msg.find("track") != std::string::npos || msg.find("detail") != std::string::npos) { 00237 std::cout << pre 00238 << p() << "(pt=" << pt() << ")" << std::endl 00239 << tab 00240 << "links=" << _links.length() 00241 << "(cores=" << nCores() 00242 << "),chrg=" << _charge 00243 << ",ndf=" << _ndf 00244 << ",chi2=" << _chi2 00245 << std::endl; 00246 pre = tab; 00247 } 00248 if (msg.find("helix") != std::string::npos || msg.find("detail") != std::string::npos) { 00249 std::cout << pre 00250 << "pivot=" << _helix->pivot() 00251 << ",center=" << _helix->center() << std::endl 00252 << pre 00253 << "helix=(" << _helix->a()[0] << "," << _helix->a()[1]<< "," 00254 << _helix->a()[2] << "," << _helix->a()[3] << "," 00255 << _helix->a()[4] << ")" << std::endl; 00256 pre = tab; 00257 } 00258 if (! def) TTrackBase::dump(msg, pre); 00259 }
int TTrack::dxda | ( | const TMLink & | link, | |
double | dPhi, | |||
Vector & | dxda, | |||
Vector & | dyda, | |||
Vector & | dzda | |||
) | const [private] |
calculates dXda. 'link' and 'dPhi' are inputs. Others are outputs.
Definition at line 789 of file TTrack.cxx.
References _helix, Helix::a(), cos(), IMagneticFieldSvc::getReferField(), genRecEmupikp::i, m_pmgnIMF, phi0, sin(), v, w, TMLink::wire(), x, and Helix::x().
Referenced by fit2D().
00793 { 00794 00795 //...Setup... 00796 const TMDCWire & w = * link.wire(); 00797 Vector a = _helix->a(); 00798 double dRho = a[0]; 00799 double phi0 = a[1]; 00800 double kappa = a[2]; 00801 // double rho = Helix::ConstantAlpha / kappa; 00802 // double rho = 333.564095 / kappa; 00803 const double Bz = -1000*m_pmgnIMF->getReferField(); 00804 double rho = 333.564095/(kappa * Bz); 00805 double tanLambda = a[4]; 00806 00807 double sinPhi0 = sin(phi0); 00808 double cosPhi0 = cos(phi0); 00809 double sinPhi0dPhi = sin(phi0 + dPhi); 00810 double cosPhi0dPhi = cos(phi0 + dPhi); 00811 Vector dphida(5); 00812 00813 //yzhang 2012-08-30 00814 //...Axial case... 00815 // if (w.axial()) { 00816 // HepPoint3D d = _helix->center() - w.xyPosition(); 00817 // double dmag2 = d.mag2(); 00818 // 00819 // dphida[0] = (sinPhi0 * d.x() - cosPhi0 * d.y()) / dmag2; 00820 // dphida[1] = (dRho + rho) * (cosPhi0 * d.x() + sinPhi0 * d.y()) 00821 // / dmag2 - 1.; 00822 // dphida[2] = (- rho / kappa) * (sinPhi0 * d.x() - cosPhi0 * d.y()) 00823 // / dmag2; 00824 // dphida[3] = 0.; 00825 // dphida[4] = 0.; 00826 // } 00827 // 00828 // //...Stereo case... 00829 // else { 00830 HepPoint3D onTrack = _helix->x(dPhi); 00831 HepVector3D v = w.direction(); 00832 Vector c(3); 00833 c = HepPoint3D(w.backwardPosition() - (v * w.backwardPosition()) * v); 00834 00835 Vector x(3); 00836 x = onTrack; 00837 00838 Vector dxdphi(3); 00839 dxdphi[0] = rho * sinPhi0dPhi; 00840 dxdphi[1] = - rho * cosPhi0dPhi; 00841 dxdphi[2] = - rho * tanLambda; 00842 00843 Vector d2xdphi2(3); 00844 d2xdphi2[0] = rho * cosPhi0dPhi; 00845 d2xdphi2[1] = rho * sinPhi0dPhi; 00846 d2xdphi2[2] = 0.; 00847 00848 double dxdphi_dot_v = dxdphi[0]*v.x() + dxdphi[1]*v.y() + dxdphi[2]*v.z(); 00849 double x_dot_v = x[0]*v.x() + x[1]*v.y() + x[2]*v.z(); 00850 00851 double dfdphi = - (dxdphi[0] - dxdphi_dot_v*v.x()) * dxdphi[0] 00852 - (dxdphi[1] - dxdphi_dot_v*v.y()) * dxdphi[1] 00853 - (dxdphi[2] - dxdphi_dot_v*v.z()) * dxdphi[2] 00854 - (x[0] - c[0] - x_dot_v*v.x()) * d2xdphi2[0] 00855 - (x[1] - c[1] - x_dot_v*v.y()) * d2xdphi2[1]; 00856 /* - (x[2] - c[2] - x_dot_v*v.z()) * d2xdphi2[2]; = 0. */ 00857 00858 00859 //dxda_phi, dyda_phi, dzda_phi : phi is fixed 00860 Vector dxda_phi(5); 00861 dxda_phi[0] = cosPhi0; 00862 dxda_phi[1] = -(dRho + rho)*sinPhi0 + rho*sinPhi0dPhi; 00863 dxda_phi[2] = -(rho/kappa)*( cosPhi0 - cosPhi0dPhi ); 00864 dxda_phi[3] = 0.; 00865 dxda_phi[4] = 0.; 00866 00867 Vector dyda_phi(5); 00868 dyda_phi[0] = sinPhi0; 00869 dyda_phi[1] = (dRho + rho)*cosPhi0 - rho*cosPhi0dPhi; 00870 dyda_phi[2] = -(rho/kappa)*( sinPhi0 - sinPhi0dPhi ); 00871 dyda_phi[3] = 0.; 00872 dyda_phi[4] = 0.; 00873 00874 Vector dzda_phi(5); 00875 dzda_phi[0] = 0.; 00876 dzda_phi[1] = 0.; 00877 dzda_phi[2] = (rho/kappa)*tanLambda*dPhi; 00878 dzda_phi[3] = 1.; 00879 dzda_phi[4] = -rho*dPhi; 00880 00881 Vector d2xdphida(5); 00882 d2xdphida[0] = 0.; 00883 d2xdphida[1] = rho*cosPhi0dPhi; 00884 d2xdphida[2] = -(rho/kappa)*sinPhi0dPhi; 00885 d2xdphida[3] = 0.; 00886 d2xdphida[4] = 0.; 00887 00888 Vector d2ydphida(5); 00889 d2ydphida[0] = 0.; 00890 d2ydphida[1] = rho*sinPhi0dPhi; 00891 d2ydphida[2] = (rho/kappa)*cosPhi0dPhi; 00892 d2ydphida[3] = 0.; 00893 d2ydphida[4] = 0.; 00894 00895 Vector d2zdphida(5); 00896 d2zdphida[0] = 0.; 00897 d2zdphida[1] = 0.; 00898 d2zdphida[2] = (rho/kappa)*tanLambda; 00899 d2zdphida[3] = 0.; 00900 d2zdphida[4] = -rho; 00901 00902 Vector dfda(5); 00903 for( int i = 0; i < 5; i++ ){ 00904 double d_dot_v = v.x()*dxda_phi[i] 00905 + v.y()*dyda_phi[i] 00906 + v.z()*dzda_phi[i]; 00907 dfda[i] = - (dxda_phi[i] - d_dot_v*v.x()) * dxdphi[0] 00908 - (dyda_phi[i] - d_dot_v*v.y()) * dxdphi[1] 00909 - (dzda_phi[i] - d_dot_v*v.z()) * dxdphi[2] 00910 - (x[0] - c[0] - x_dot_v*v.x()) * d2xdphida[i] 00911 - (x[1] - c[1] - x_dot_v*v.y()) * d2ydphida[i] 00912 - (x[2] - c[2] - x_dot_v*v.z()) * d2zdphida[i]; 00913 dphida[i] = - dfda[i] /dfdphi; 00914 } 00915 //} 00916 00917 dxda[0] = cosPhi0 + rho * sinPhi0dPhi * dphida[0]; 00918 dxda[1] = - (dRho + rho) * sinPhi0 + rho * sinPhi0dPhi * (1. + dphida[1]); 00919 dxda[2] = - rho / kappa * (cosPhi0 - cosPhi0dPhi) 00920 + rho * sinPhi0dPhi * dphida[2]; 00921 dxda[3] = rho * sinPhi0dPhi * dphida[3]; 00922 dxda[4] = rho * sinPhi0dPhi * dphida[4]; 00923 00924 dyda[0] = sinPhi0 - rho * cosPhi0dPhi * dphida[0]; 00925 dyda[1] = (dRho + rho) * cosPhi0 - rho * cosPhi0dPhi * (1. + dphida[1]); 00926 dyda[2] = - rho / kappa * (sinPhi0 - sinPhi0dPhi) 00927 - rho * cosPhi0dPhi * dphida[2]; 00928 dyda[3] = - rho * cosPhi0dPhi * dphida[3]; 00929 dyda[4] = - rho * cosPhi0dPhi * dphida[4]; 00930 00931 dzda[0] = - rho * tanLambda * dphida[0]; 00932 dzda[1] = - rho * tanLambda * dphida[1]; 00933 dzda[2] = rho / kappa * tanLambda * dPhi - rho * tanLambda * dphida[2]; 00934 dzda[3] = 1. - rho * tanLambda * dphida[3]; 00935 dzda[4] = - rho * dPhi - rho * tanLambda * dphida[4]; 00936 00937 return 0; 00938 }
Definition at line 2966 of file TTrack.cxx.
References _helix, Helix::a(), Helix::center(), cos(), IMagneticFieldSvc::getReferField(), m_pmgnIMF, and sin().
02968 { 02969 02970 //...Setup... 02971 double kappa = (_helix->a())[2]; 02972 if(kappa == 0.){ 02973 std::cout << "Error(?) : kappa == 0 in dxda2D of TrkReco." << std::endl; 02974 return 1; 02975 } 02976 double dRho = (_helix->a())[0]; 02977 double phi0 = (_helix->a())[1]; 02978 // double rho = Helix::ConstantAlpha / kappa; 02979 // double rho = 333.564095 / kappa; 02980 const double Bz = -1000*m_pmgnIMF->getReferField(); 02981 double rho = 333.564095/(kappa * Bz); 02982 02983 double sinPhi0 = sin(phi0); 02984 double cosPhi0 = cos(phi0); 02985 double sinPhi0dPhi = sin(phi0 + dPhi); 02986 double cosPhi0dPhi = cos(phi0 + dPhi); 02987 Vector dphida(3); 02988 02989 HepPoint3D d = _helix->center(); // d = center - (0,0,0) 02990 d.setZ(0.); 02991 double dmag2 = d.mag2(); 02992 02993 if(dmag2 == 0.){ 02994 std::cout << "Error(?) : Distance(center-xyPosition) == 0 in dxda2D of TrkReco." << std::endl; 02995 return 1; 02996 } 02997 02998 dphida[0] = (sinPhi0*d.x()-cosPhi0*d.y())/dmag2; 02999 dphida[1] = (dRho+rho)*(cosPhi0*d.x()+sinPhi0 * d.y())/dmag2 - 1.; 03000 dphida[2] = (-rho/kappa)*(sinPhi0*d.x()-cosPhi0*d.y())/dmag2; 03001 03002 dxda[0] = cosPhi0+rho*sinPhi0dPhi*dphida[0]; 03003 dxda[1] = -(dRho+rho)*sinPhi0+rho*sinPhi0dPhi*(1.+dphida[1]); 03004 dxda[2] = -rho/kappa*(cosPhi0-cosPhi0dPhi)+rho*sinPhi0dPhi*dphida[2]; 03005 03006 dyda[0] = sinPhi0-rho*cosPhi0dPhi*dphida[0]; 03007 dyda[1] = (dRho+rho)*cosPhi0-rho*cosPhi0dPhi*(1.+dphida[1]); 03008 dyda[2] = -rho/kappa*(sinPhi0-sinPhi0dPhi)-rho*cosPhi0dPhi*dphida[2]; 03009 03010 return 0; 03011 }
int TTrack::dxda2D | ( | const TMLink & | link, | |
double | dPhi, | |||
Vector & | dxda, | |||
Vector & | dyda | |||
) | const [private] |
Definition at line 2916 of file TTrack.cxx.
References _helix, Helix::a(), Helix::center(), cos(), IMagneticFieldSvc::getReferField(), m_pmgnIMF, sin(), w, and TMLink::wire().
02919 { 02920 02921 //...Setup... 02922 double kappa = (_helix->a())[2]; 02923 if(kappa == 0.){ 02924 std::cout << "Error(?) : kappa == 0 in dxda2D of TrkReco." << std::endl; 02925 return 1; 02926 } 02927 const TMDCWire &w = *link.wire(); 02928 double dRho = (_helix->a())[0]; 02929 double phi0 = (_helix->a())[1]; 02930 // double rho = Helix::ConstantAlpha / kappa; 02931 // double rho = 333.564095 / kappa; 02932 const double Bz = -1000*m_pmgnIMF->getReferField(); 02933 double rho = 333.564095/(kappa * Bz); 02934 02935 double sinPhi0 = sin(phi0); 02936 double cosPhi0 = cos(phi0); 02937 double sinPhi0dPhi = sin(phi0 + dPhi); 02938 double cosPhi0dPhi = cos(phi0 + dPhi); 02939 Vector dphida(3); 02940 02941 HepPoint3D d = _helix->center() - w.xyPosition(); 02942 d.setZ(0.); 02943 double dmag2 = d.mag2(); 02944 02945 if(dmag2 == 0.){ 02946 std::cout << "Error(?) : Distance(center-xyPosition) == 0 in dxda2D of TrkReco." << std::endl; 02947 return 1; 02948 } 02949 02950 dphida[0] = (sinPhi0*d.x()-cosPhi0*d.y())/dmag2; 02951 dphida[1] = (dRho+rho)*(cosPhi0*d.x()+sinPhi0 * d.y())/dmag2 - 1.; 02952 dphida[2] = (-rho/kappa)*(sinPhi0*d.x()-cosPhi0*d.y())/dmag2; 02953 02954 dxda[0] = cosPhi0+rho*sinPhi0dPhi*dphida[0]; 02955 dxda[1] = -(dRho+rho)*sinPhi0+rho*sinPhi0dPhi*(1.+dphida[1]); 02956 dxda[2] = -rho/kappa*(cosPhi0-cosPhi0dPhi)+rho*sinPhi0dPhi*dphida[2]; 02957 02958 dyda[0] = sinPhi0-rho*cosPhi0dPhi*dphida[0]; 02959 dyda[1] = (dRho+rho)*cosPhi0-rho*cosPhi0dPhi*(1.+dphida[1]); 02960 dyda[2] = -rho/kappa*(sinPhi0-sinPhi0dPhi)-rho*cosPhi0dPhi*dphida[2]; 02961 02962 return 0; 02963 }
int TTrack::dxda2D | ( | const TMLink & | link, | |
double | dPhi, | |||
Vector & | dxda, | |||
Vector & | dyda, | |||
Vector & | dzda | |||
) | const [private] |
void TTrackBase::falseFit | ( | ) | [inline, inherited] |
false Fit
Definition at line 229 of file TTrackBase.h.
References TTrackBase::_fitted, and TTrackBase::_fittedWithCathode.
00229 { 00230 _fitted = false; 00231 _fittedWithCathode = false; 00232 }
Definition at line 704 of file TTrack.h.
References _finalHits.
00704 { 00705 _finalHits = list; 00706 return _finalHits; 00707 }
const AList< TMLink > & TTrack::finalHits | ( | void | ) | const [inline] |
sets/returns a list of TMLink which are used for table output.
Definition at line 711 of file TTrack.h.
References _finalHits.
Referenced by TTrackMC::compare().
00711 { 00712 return _finalHits; 00713 }
unsigned TTrack::finder | ( | unsigned | finderMask | ) | [inline] |
Definition at line 607 of file TTrack.h.
References _state, finder(), and TrackFinderMask.
00607 { 00608 _state |= (a & TrackFinderMask); 00609 return finder(); 00610 }
unsigned TTrack::finder | ( | void | ) | const [inline] |
sets/returns finder.
Definition at line 601 of file TTrack.h.
References _state, and TrackFinderMask.
Referenced by finder(), and TTrackManager::salvage().
00601 { 00602 return _state & TrackFinderMask; 00603 }
int TTrackBase::fit | ( | void | ) | [virtual, inherited] |
fits itself by a default fitter. Error was happened if return value is not zero.
Definition at line 357 of file TTrackBase.cxx.
References TTrackBase::_fitter, and TMFitter::fit().
Referenced by TBuilder0::buildRphi(), TBuilder::buildRphi(), TBuilderCosmic::buildStereo(), TBuilder0::buildStereo0(), and TConformalFinder::expand().
int TTrack::fit2D | ( | unsigned | = 0 , |
|
double | = 0.1 , |
|||
double | = 0.015 | |||
) |
fits itself with r-phi view. Error was happened if return value is not zero.
Definition at line 2542 of file TTrack.cxx.
References _chi2, _helix, TTrackBase::_links, _ndf, Helix::a(), approach2D(), Helix::center(), chi2(), cos(), counter, TMDCWireHit::dDrift(), TTrackBase::distance(), TMLink::dPhi(), TMDCWireHit::drift(), TMDCWireHit::dump(), dxda(), Helix::Ea(), showlog::err, TMLink::fit2D(), TMLink::hit(), M_PI, name(), TMLink::positionOnTrack(), TMLink::positionOnWire(), Helix::radius(), sin(), TMLink::update(), TMLink::wire(), WireHitLeft, WireHitRight, Helix::x(), and TMDCWire::xyPosition().
Referenced by refine2D().
02542 { 02543 #ifdef TRKRECO_DEBUG_DETAIL 02544 std::cout << " TTrack::fit2D(r-phi) ..." << std::endl; 02545 #endif 02546 //if(_fitted)return 0; 02547 02548 //...Check # of hits... 02549 02550 //std::cout << "# = " << _links.length() << std::endl; 02551 //...Setup... 02552 unsigned nTrial(0); 02553 Vector a(_helix->a()); 02554 double chi2; 02555 double chi2Old = 1.0e+99; 02556 Vector dchi2da(3); 02557 SymMatrix d2chi2d2a(3,0); 02558 Vector da(5), dxda(3), dyda(3); 02559 Vector dDda(3); 02560 const double convergence = 1.0e-5; 02561 Vector f(3); 02562 int err = 0; 02563 double factor = 1.0; 02564 unsigned usedWireNumber = 0; 02565 02566 //...Fitting loop... 02567 while(nTrial < 100){ 02568 //...Set up... 02569 chi2 = 0.; 02570 for (unsigned j=0;j<3;++j) dchi2da[j] = 0.; 02571 d2chi2d2a = SymMatrix(3, 0); 02572 usedWireNumber = 0; 02573 02574 //...Loop with hits... 02575 unsigned i = 0; 02576 while (TMLink * l = _links[i++]) { 02577 if(l->fit2D() == 0)continue; 02578 const TMDCWireHit &h = *l->hit(); 02579 02580 //...Cal. closest points... 02581 if(approach2D(*l) != 0)continue; 02582 double dPhi = l->dPhi(); 02583 const HepPoint3D & onTrack = l->positionOnTrack(); 02584 const HepPoint3D & onWire = l->positionOnWire(); 02585 HepPoint3D onTrack2(onTrack.x(),onTrack.y(),0.); 02586 HepPoint3D onWire2(onWire.x(),onWire.y(),0.); 02587 02588 //...Obtain drift distance and its error... 02589 unsigned leftRight = WireHitRight; 02590 if (onWire2.cross(onTrack2).z() < 0.) leftRight = WireHitLeft; 02591 double distance = h.drift(leftRight); 02592 double eDistance = h.dDrift(leftRight); 02593 double eDistance2 = eDistance * eDistance; 02594 if(eDistance == 0.){ 02595 std::cout << "Error(?) : Drift Distance Error = 0 in fit2D of TrkReco." << std::endl; 02596 continue; 02597 } 02598 02599 //...Residual... 02600 HepVector3D v = onTrack2 - onWire2; 02601 double vmag = v.mag(); 02602 double dDistance = vmag - distance; 02603 02604 //...dxda... 02605 if(this->dxda2D(*l, dPhi, dxda, dyda) != 0)continue; 02606 02607 //...Chi2 related... 02608 //Vector3 vw(0.,0.,1.); 02609 dDda = (vmag > 0.) 02610 ? (v.x()*dxda+v.y()*dyda)/vmag 02611 : Vector(3,0); 02612 if(vmag<=0.0){ 02613 std::cout << " in fit2D " << onTrack << ", " << onWire; 02614 h.dump(); 02615 continue; 02616 } 02617 dchi2da += (dDistance/eDistance2)*dDda; 02618 d2chi2d2a += vT_times_v(dDda)/eDistance2; 02619 double pChi2 = dDistance*dDistance/eDistance2; 02620 chi2 += pChi2; 02621 02622 //...Store results... 02623 l->update(onTrack2, onWire2, leftRight, pChi2); 02624 ++usedWireNumber; 02625 } 02626 if(ipFlag != 0){ 02627 double kappa = _helix->a()[2]; 02628 double phi0 = _helix->a()[1]; 02629 HepPoint3D xc(_helix->center()); 02630 HepPoint3D onWire(0.,0.,0.); 02631 HepPoint3D xt(_helix->x()); 02632 HepVector3D v0(xt-xc); 02633 HepVector3D v1(onWire-xc); 02634 double vCrs = v0.x() * v1.y() - v0.y() * v1.x(); 02635 double vDot = v0.x() * v1.x() + v0.y() * v1.y(); 02636 double dPhi = atan2(vCrs, vDot); 02637 HepPoint3D onTrack(_helix->x(dPhi).x(),_helix->x(dPhi).y(),0.); 02638 double distance = ipDistance; 02639 double eDistance = ipError; 02640 double eDistance2 = eDistance * eDistance; 02641 02642 HepVector3D v = onTrack - onWire; 02643 double vmag = v.mag(); 02644 double dDistance = vmag - distance; 02645 02646 if(this->dxda2D(dPhi, dxda, dyda) != 0)goto ipOff; 02647 02648 dDda = (vmag > 0.) 02649 ? (v.x()*dxda+v.y()*dyda)/vmag 02650 : Vector(3,0); 02651 if(vmag<=0.0){ 02652 goto ipOff; 02653 } 02654 dchi2da += (dDistance/eDistance2)*dDda; 02655 d2chi2d2a += vT_times_v(dDda)/eDistance2; 02656 double pChi2 = dDistance*dDistance/eDistance2; 02657 chi2 += pChi2; 02658 02659 ++usedWireNumber; 02660 } 02661 ipOff: 02662 if(usedWireNumber < 4){ 02663 err = -2; 02664 break; 02665 } 02666 02667 //...Check condition... 02668 double change = chi2Old - chi2; 02669 if(fabs(change) < convergence)break; 02670 if(change < 0.){ 02671 #ifdef TRKRECO_DEBUG_DETAIL 02672 std::cout << "chi2Old, chi2=" << chi2Old <<" "<< chi2 << std::endl; 02673 #endif 02674 //change to the old value. 02675 a += factor*da; 02676 _helix->a(a); 02677 02678 chi2 = 0.; 02679 for (unsigned j=0;j<3;++j) dchi2da[j] = 0.; 02680 d2chi2d2a = SymMatrix(3,0); 02681 usedWireNumber = 0; 02682 02683 //...Loop with hits... 02684 unsigned i = 0; 02685 while (TMLink *l = _links[i++]) { 02686 if(l->fit2D() == 0)continue; 02687 const TMDCWireHit & h = * l->hit(); 02688 02689 //...Cal. closest points... 02690 if(approach2D(*l) != 0)continue; 02691 double dPhi = l->dPhi(); 02692 const HepPoint3D & onTrack = l->positionOnTrack(); 02693 const HepPoint3D & onWire = l->positionOnWire(); 02694 HepPoint3D onTrack2(onTrack.x(),onTrack.y(),0.); 02695 HepPoint3D onWire2(onWire.x(),onWire.y(),0.); 02696 02697 //...Obtain drift distance and its error... 02698 unsigned leftRight = WireHitRight; 02699 if (onWire2.cross(onTrack2).z() < 0.) leftRight = WireHitLeft; 02700 double distance = h.drift(leftRight); 02701 double eDistance = h.dDrift(leftRight); 02702 double eDistance2 = eDistance * eDistance; 02703 02704 //...Residual... 02705 HepVector3D v = onTrack2 - onWire2; 02706 double vmag = v.mag(); 02707 double dDistance = vmag - distance; 02708 02709 //...dxda... 02710 if(this->dxda2D(*l, dPhi, dxda, dyda) != 0)continue; 02711 02712 //...Chi2 related... 02713 dDda = (vmag>0.) 02714 ? (v.x()*dxda + v.y()*dyda)/vmag 02715 : Vector(3,0); 02716 if(vmag<=0.0) { 02717 std::cout << " in fit2D " << onTrack << ", " << onWire; 02718 h.dump(); 02719 continue; 02720 } 02721 dchi2da += (dDistance/eDistance2)*dDda; 02722 d2chi2d2a += vT_times_v(dDda)/eDistance2; 02723 double pChi2 = dDistance*dDistance/eDistance2; 02724 chi2 += pChi2; 02725 02726 //...Store results... 02727 l->update(onTrack2, onWire2, leftRight, pChi2); 02728 ++usedWireNumber; 02729 } 02730 if(ipFlag != 0){ 02731 double kappa = _helix->a()[2]; 02732 double phi0 = _helix->a()[1]; 02733 HepPoint3D xc(_helix->center()); 02734 HepPoint3D onWire(0.,0.,0.); 02735 HepPoint3D xt(_helix->x()); 02736 HepVector3D v0(xt-xc); 02737 HepVector3D v1(onWire-xc); 02738 double vCrs = v0.x() * v1.y() - v0.y() * v1.x(); 02739 double vDot = v0.x() * v1.x() + v0.y() * v1.y(); 02740 double dPhi = atan2(vCrs, vDot); 02741 HepPoint3D onTrack(_helix->x(dPhi).x(),_helix->x(dPhi).y(),0.); 02742 double distance = ipDistance; 02743 double eDistance = ipError; 02744 double eDistance2 = eDistance * eDistance; 02745 02746 HepVector3D v = onTrack - onWire; 02747 double vmag = v.mag(); 02748 double dDistance = vmag - distance; 02749 02750 if(this->dxda2D(dPhi, dxda, dyda) != 0)goto ipOff2; 02751 02752 dDda = (vmag > 0.) 02753 ? (v.x()*dxda+v.y()*dyda)/vmag 02754 : Vector(3,0); 02755 if(vmag<=0.0){ 02756 goto ipOff2; 02757 } 02758 dchi2da += (dDistance/eDistance2)*dDda; 02759 d2chi2d2a += vT_times_v(dDda)/eDistance2; 02760 double pChi2 = dDistance*dDistance/eDistance2; 02761 chi2 += pChi2; 02762 02763 ++usedWireNumber; 02764 } 02765 ipOff2: 02766 if(usedWireNumber < 4){ 02767 err = -2; 02768 break; 02769 } 02770 //break; 02771 factor *= 0.75; 02772 #ifdef TRKRECO_DEBUG_DETAIL 02773 std::cout << "factor = " << factor << std::endl; 02774 std::cout << "chi2 = " << chi2 << std::endl; 02775 #endif 02776 if(factor < 0.01)break; 02777 } 02778 02779 chi2Old = chi2; 02780 02781 //...Cal. helix parameters for next loop... 02782 f = solve(d2chi2d2a, dchi2da); 02783 da[0] = f[0]; 02784 da[1] = f[1]; 02785 da[2] = f[2]; 02786 da[3] = 0.; 02787 da[4] = 0.; 02788 02789 a -= factor*da; 02790 _helix->a(a); 02791 ++nTrial; 02792 } 02793 if(err){ 02794 return err; 02795 } 02796 02797 //...Cal. error matrix... 02798 SymMatrix Ea(5,0); 02799 unsigned dim = 3; 02800 SymMatrix Eb = d2chi2d2a; 02801 SymMatrix Ec = Eb.inverse(err); 02802 Ea[0][0] = Ec[0][0]; 02803 Ea[0][1] = Ec[0][1]; 02804 Ea[0][2] = Ec[0][2]; 02805 Ea[1][1] = Ec[1][1]; 02806 Ea[1][2] = Ec[1][2]; 02807 Ea[2][2] = Ec[2][2]; 02808 02809 //...Store information... 02810 if(!err){ 02811 _helix->a(a); 02812 _helix->Ea(Ea); 02813 }else{ 02814 err = -2; 02815 } 02816 02817 _ndf = usedWireNumber-dim; 02818 _chi2 = chi2; 02819 02820 //_fitted = true; 02821 02822 #define JJJTEST 0 02823 #if JJJTEST 02824 double gmaxX = -9999. ,gminX = 9999.; 02825 double gmaxY = -9999. ,gminY = 9999.; 02826 FILE *gnuplot, *data; 02827 double step = 200.; 02828 double dStep = 2.*M_PI/step; 02829 for(int i=0,size = _links.length();i<size;++i){ 02830 TMLink * l = _links[i]; 02831 double drift = l->hit()->distance(0); 02832 char name[100] = "dat"; 02833 char counter[10] = ""; 02834 sprintf(counter,"%02d",i); 02835 strcat(name,counter); 02836 if((data = fopen(name,"w")) != NULL){ 02837 for(int ii=0;ii<step;++ii){ 02838 double X = l->wire()->xyPosition().x() + drift*cos(dStep*static_cast<double>(ii)); 02839 double Y = l->wire()->xyPosition().y() + drift*sin(dStep*static_cast<double>(ii)); 02840 fprintf(data,"%lf, %lf\n",X,Y); 02841 if(gmaxX < X)gmaxX = X; 02842 if(gminX > X)gminX = X; 02843 if(gmaxY < Y)gmaxY = Y; 02844 if(gminY > Y)gminY = Y; 02845 } 02846 fclose(data); 02847 } 02848 } 02849 step = 300.; 02850 dStep = 2.*M_PI/step; 02851 if((data = fopen("datc","w")) != NULL){ 02852 for(int ii=0;ii<step;++ii){ 02853 double X = _helix->center().x() + _helix->radius()*cos(dStep*static_cast<double>(ii)); 02854 double Y = _helix->center().y() + _helix->radius()*sin(dStep*static_cast<double>(ii)); 02855 fprintf(data,"%lf, %lf\n",X,Y); 02856 } 02857 fclose(data); 02858 } 02859 if((gnuplot = popen("gnuplot","w")) != NULL){ 02860 fprintf(gnuplot,"set size 0.721,1.0 \n"); 02861 fprintf(gnuplot,"set xrange [%f:%f] \n",gminX,gmaxX); 02862 fprintf(gnuplot,"set yrange [%f:%f] \n",gminY,gmaxY); 02863 if(_links.length() == 4){ 02864 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line \n"); 02865 }else if(_links.length() == 5){ 02866 fprintf(gnuplot,"plot \"datc\" with line, \"dat00\" with line, \"dat01\" with line, \"dat02\" with line, \"dat03\" with line, \"dat04\" with line \n"); 02867 }else if(_links.length() == 6){ 02868 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"); 02869 }else if(_links.length() == 7){ 02870 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"); 02871 }else if(_links.length() == 8){ 02872 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"); 02873 }else if(_links.length() == 9){ 02874 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"); 02875 }else if(_links.length() == 10){ 02876 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"); 02877 }else if(_links.length() >= 11){ 02878 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"); 02879 } 02880 fflush(gnuplot); 02881 char tmp[8]; 02882 gets(tmp); 02883 pclose(gnuplot); 02884 } 02885 #endif //JJJTEST 02886 02887 return err; 02888 }
bool TTrackBase::fitted | ( | void | ) | const [inline, inherited] |
returns true if fitted.
Definition at line 222 of file TTrackBase.h.
References TTrackBase::_fitted.
Referenced by TCosmicFitter::fit(), TBuilder::searchLine(), and TMSelector::select().
00222 { 00223 return _fitted; 00224 }
bool TTrackBase::fittedWithCathode | ( | void | ) | const [inline, inherited] |
returns true if fitted with cathode hits(TEMPORARY).
Definition at line 243 of file TTrackBase.h.
References TTrackBase::_fittedWithCathode.
00243 { 00244 return _fittedWithCathode; 00245 }
sets a default fitter.
Definition at line 261 of file TTrackBase.h.
References TTrackBase::_fitted, and TTrackBase::_fitter.
const TMFitter *const TTrackBase::fitter | ( | void | ) | const [inline, inherited] |
returns a pointer to a default fitter.
Definition at line 255 of file TTrackBase.h.
References TTrackBase::_fitter.
Referenced by T3DLine::T3DLine(), TCircle::TCircle(), TLine0::TLine0(), TMLine::TMLine(), TRunge::TRunge(), and TTrack().
00255 { 00256 return _fitter; 00257 }
unsigned TTrack::fitting | ( | unsigned | fitMask | ) | [inline] |
Definition at line 636 of file TTrack.h.
References _state, fitting(), TrackFitMask, and TrackFitShift.
00636 { 00637 _state |= ((a << TrackFitShift) & TrackFitMask); 00638 return fitting(); 00639 }
unsigned TTrack::fitting | ( | void | ) | const [inline] |
sets/returns fitting status.
Definition at line 630 of file TTrack.h.
References _state, TrackFitMask, and TrackFitShift.
Referenced by fitting().
00630 { 00631 return (_state >> TrackFitShift) & TrackFitMask; 00632 }
unsigned TTrack::getFinderType | ( | void | ) | const [inline] |
Definition at line 680 of file TTrack.h.
References _findertype.
00680 { 00681 return _findertype; 00682 }
int TTrack::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.
Definition at line 316 of file TTrack.cxx.
References _charge, _helix, Helix::a(), Helix::center(), intersection(), M_PI, phi0, Helix::pivot(), Helix::radius(), test, Helix::x(), and zero.
00322 { 00323 00324 00325 int status(0); // return value 00326 //--------------------------------------------------------------------- 00327 // value | ext | status 00328 //--------------------------------------------------------------------- 00329 // 1. | OK | 00330 // -1. | NO | charge = 0 00331 // 0. | NO | | tanl | < 0.1 ( neglect | lamda | < 5.7 deg. ) 00332 // | | or | dPhi | > 2 pi ( neglect curly track ) 00333 // | | or cannot reach to r=rhole at z = zb or zf. 00334 // 2. | OK | backward , ext point set on z = zb 00335 // 3. | OK | forward , ext point set on z = zf 00336 //--------------------------------------------------------------------- 00337 // * when value = 0,2,3 , ext(z) <= zb or ext(z) >= zf 00338 00339 //--- debug 00340 // std::cout << " " << std::endl; 00341 // std::cout << "HelCyl called .. rhole=" << rhole << " rCyl=" << rCyl ; 00342 // std::cout << " zb=" << zb << " zf=" << zf << " epsl=" << epsl << std::endl; 00343 //--- debug end 00344 00345 // Check of Charge 00346 00347 if ( int(_charge) == 0 ) { 00348 std::cout << "HelCyl gets a straight line !!" << std::endl; 00349 return -1 ; 00350 } 00351 00352 // parameters 00353 00354 HepPoint3D CenterCyl( 0., 0., 0. ); 00355 HepPoint3D CenterTrk = _helix->center(); 00356 double rTrk = fabs( _helix->radius() ); 00357 00358 double rPivot = fabs( _helix->pivot().perp() ); 00359 00360 double phi0 = _helix->a()[1]; 00361 double tanl = _helix->a()[4]; 00362 // double zdz = _helix->pivot().z() + _helix->a()[3]; 00363 double dPhi; 00364 double zee; 00365 00366 00367 // Calculate intersections between cylinder and track 00368 // if return value = 2 track hitting barrel part 00369 00370 HepPoint3D Cross1, Cross2; 00371 00372 if (intersection( CenterTrk,_charge * rTrk ,CenterCyl,rCyl, 00373 epsl, 00374 Cross1,Cross2) 00375 == 2 ) { 00376 00377 double phiCyl = atan2( _charge * ( CenterTrk.y() - Cross1.y() ), 00378 _charge * ( CenterTrk.x() - Cross1.x() ) ); 00379 phiCyl = ( phiCyl > 0. ) ? phiCyl : phiCyl + 2. * M_PI; 00380 00381 dPhi = phiCyl - phi0; 00382 00383 // dPhi region ( at cylinder ) 00384 // -pi <= dPhi < pi 00385 00386 00387 double PhiYobun = 1./ fabs( _helix->radius() ); 00388 double zero = 0.00001; 00389 00390 if( _charge >=0. ){ 00391 if( dPhi > PhiYobun ) dPhi -= 2. * M_PI; 00392 if( -2. * M_PI - zero <= dPhi <= ( -2.* M_PI + PhiYobun ) ) 00393 dPhi += 2. * M_PI; 00394 } 00395 00396 if( _charge < 0. ){ 00397 if( dPhi < -PhiYobun ) dPhi += 2. * M_PI; 00398 if( 2. * M_PI + zero >= dPhi >= ( 2. * M_PI - PhiYobun ) ) 00399 dPhi -= 2. * M_PI; 00400 } 00401 00402 if( dPhi < - M_PI ) dPhi += 2. * M_PI; 00403 if( dPhi >= M_PI ) dPhi -= 2. * M_PI; 00404 00405 //--debug 00406 // std::cout << "dPhi = " << dPhi << std::endl; 00407 //--debug end 00408 00409 xp.setX( Cross1.x() ); 00410 xp.setY( Cross1.y() ); 00411 xp.setZ( _helix->x(dPhi).z() ); 00412 // xp.setZ( zdz - _charge * rTrk * tanl * dPhi ); 00413 00414 if ( xp.z() > zb && xp.z() < zf ) { 00415 phi = dPhi; 00416 //--- debug --- 00417 // std::cout << "return1 ( ext success )" << std::endl; 00418 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00419 //--- debug ---- 00420 return 1 ; 00421 } 00422 } 00423 00424 00425 // tracks hitting endcaps 00426 00427 if ( fabs(tanl) < 0.1 ) { 00428 //--- debug --- 00429 // std::cout << "return0 ( ext failed , |tanl| < 0.1 )" << std::endl; 00430 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00431 //--- debug --- 00432 return 0; 00433 } 00434 00435 if ( tanl > 0. ) { 00436 zee = zf ; 00437 status = 3 ; 00438 } 00439 else { 00440 zee = zb ; 00441 status = 2 ; 00442 } 00443 00444 dPhi = _charge * ( _helix->x(0.).z() - zee )/rTrk/tanl; 00445 // dPhi = _charge * ( zdz - zee )/rTrk/tanl; 00446 00447 // Requre dPhi < 2*pi 00448 00449 if ( fabs(dPhi) > 2. * M_PI ) { 00450 //--- debug --- 00451 // std::cout << " return0 ( ext failed , dPhi > 2pi )" << std::endl; 00452 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00453 //--- debug --- 00454 return 0 ; 00455 } 00456 00457 xp.setX( _helix->x(dPhi).x() ); 00458 xp.setY( _helix->x(dPhi).y() ); 00459 xp.setZ( zee ); 00460 00461 double test = xp.perp2() - rhole*rhole ; 00462 if ( test < 0. ) { 00463 //--- debug --- 00464 // std::cout << "return0 ( cannot reach to rhole at z=edge )" << std::endl; 00465 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00466 //--- debug --- 00467 return 0 ; 00468 } 00469 00470 phi = dPhi ; 00471 //--- debug --- 00472 // std::cout << "return" << status << std::endl; 00473 // std::cout << " xp:= " << xp.x() << ", " << xp.y() << ", " << xp.z() << std::endl; 00474 //--- debug --- 00475 00476 return status ; 00477 00478 }
const Helix & TTrack::helix | ( | void | ) | const [inline] |
returns helix parameter.
Definition at line 477 of file TTrack.h.
References _helix.
Referenced by TBuilderCurl::buildStereo(), TBuilderCosmic::buildStereo(), TBuilder0::buildStereo(), TBuilder::buildStereo(), TBuilder0::buildStereo0(), TBuilderCurl::buildStereoMC(), calVirtualCircle(), TTrackMC::compare(), TCurlFinder::distance(), TConformalFinder0::findCloseClusters(), TFastFinder::findCloseHits(), TCurlFinder::findCloseHits(), TConformalFinder0::findCloseHits(), TCurlFinder::makeCurlTracks(), TCurlFinder::mask3DTrack(), TTrackManager::merge(), TCurlFinder::merge3DTrack(), TCurlFinder::plotTrack(), TCurlFinder::salvage3DTrack(), and TCurlFinder::trace3DTrack().
00477 { 00478 #ifdef TRKRECO_DEBUG 00479 // if (! _fitted) std::cout << "TTrack::helix !!! helix not updated" << std::endl; 00480 #endif 00481 return * _helix; 00482 }
const TTrackHEP *const TTrackBase::hep | ( | void | ) | const [inherited] |
returns TTrackHEP.
Definition at line 407 of file TTrackBase.cxx.
References TTrackBase::_hep, TTrackBase::_links, TTrackBase::_nHeps, genRecEmupikp::i, ganga-rec::j, max, and TTrackBase::mc().
Referenced by TTrackBase::nHeps().
00407 { 00408 unsigned n = _links.length(); 00409 CAList<TTrackHEP> hepList; 00410 CList<unsigned> hepCounter; 00411 for (unsigned i = 0; i < n; i++) { 00412 const TTrackHEP * hep = _links[i]->hit()->mc()->hep(); 00413 unsigned nH = hepList.length(); 00414 bool found = false; 00415 for (unsigned j = 0; j < nH; j++) { 00416 if (hepList[j] == hep) { 00417 found = true; 00418 ++(* hepCounter[j]); 00419 } 00420 } 00421 00422 if (! found) { 00423 hepList.append(hep); 00424 unsigned c = 0; 00425 hepCounter.append(c); 00426 } 00427 } 00428 00429 _nHeps = hepList.length(); 00430 _hep = 0; 00431 unsigned max = 0; 00432 for (unsigned i = 0; i < _nHeps; i++) { 00433 if ((* hepCounter[i]) > max) { 00434 max = (* hepCounter[i]); 00435 _hep = hepList[i]; 00436 } 00437 } 00438 00439 return _hep; 00440 }
double TTrack::impact | ( | void | ) | const [inline] |
returns signed impact parameter to the origin.
Definition at line 571 of file TTrack.h.
References _helix, Helix::center(), and Helix::radius().
Referenced by TBuilderCurl::buildStereo(), TBuilderCurl::buildStereoMC(), and defineType().
const AList< TMLink > & TTrackBase::links | ( | unsigned | mask = 0 |
) | const [inherited] |
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
Definition at line 297 of file TTrackBase.cxx.
References TTrackBase::_links.
Referenced by TConformalFinder0::appendCluster(), TBuilder::build(), TBuilderCurl::buildStereo(), TBuilderCosmic::buildStereo(), TBuilder0::buildStereo0(), TBuilderCurl::buildStereoMC(), TBuilder::buildStereoNew(), TBuilderCurl::check(), TCurlFinder::check2DCircle(), TCurlFinder::check3DTrack(), TCurlFinder::dividing2DTrack(), TCurlFinder::dumpType1(), TCurlFinder::dumpType2(), TrkReco::execute(), TConformalFinder0::findCloseClusters(), TFastFinder::findCloseHits(), TConformalFinder0::findCloseHits(), TConformalFinder0::findClusterLink(), TCosmicFitter::fit(), TCurlFinder::fitWDD(), TCurlFinder::make2DTrack(), TCurlFinder::make3DTrack(), TCurlFinder::makeWithMC(), TCurlFinder::mask3DTrack(), TTrackManager::merge(), movePivot(), TCurlFinder::plotCircle(), TCurlFinder::plotTrack(), TMSelector::preSelect(), TCurlFinder::removeStereo(), TConformalFinder::salvage(), TCurlFinder::salvage3DTrack(), TBuilder::searchLine(), TMDCTsf::segments(), TBuilderCurl::setArcZ(), TConformalFinder::slowFinding2D(), TSegment0::splitAV(), TSegment::splitAV(), TSegment::splitTsf(), TConformalFinder::stereoSegments(), TSegment0::superLayerId(), TSegment::superLayerId(), szPosition(), TCurlFinder::trace2DTrack(), TCurlFinder::trace3DTrack(), and TSegment::width().
00297 { 00298 if (mask == 0) return _links; 00299 00300 std::cout << "TTrackBase::links !!! mask is not supportted yet" << std::endl; 00301 return _links; 00302 }
const TTrackMC *const TTrackBase::mc | ( | void | ) | const [inline, inherited] |
returns a pointer to TTrackMC.
Definition at line 249 of file TTrackBase.h.
References TTrackBase::_mc.
Referenced by TTrackBase::dump(), and TTrackBase::hep().
00249 { 00250 return _mc; 00251 }
Definition at line 649 of file TTrack.h.
References _mother, _state, TrackHasMother, and TrackRelationShift.
00649 { 00650 if (a) _state |= (TrackHasMother << TrackRelationShift); 00651 else _state &= (~(TrackHasMother << TrackRelationShift)); 00652 return _mother = a; 00653 }
TTrack * TTrack::mother | ( | void | ) | const [inline] |
void TTrack::movePivot | ( | void | ) |
moves pivot to the inner most hit.
Definition at line 262 of file TTrack.cxx.
References _helix, TTrackBase::_links, TTrackBase::cores(), genRecEmupikp::i, TTrackBase::links(), Helix::pivot(), quality(), and TrackQuality2D.
00262 { 00263 unsigned n = _links.length(); 00264 if (! n) { 00265 std::cout << "TTrack::movePivot !!! can't move a pivot" 00266 << " because of no link"; 00267 std::cout << std::endl; 00268 return; 00269 } 00270 00271 //...Check cores... 00272 const AList<TMLink> & cores = TTrackBase::cores(); 00273 const AList<TMLink> * links = & cores; 00274 if (cores.length() == 0) links = & _links; 00275 00276 //...Hit loop... 00277 unsigned innerMost = 0; 00278 unsigned innerMostLayer = (* links)[0]->wire()->layerId(); 00279 n = links->length(); 00280 for (unsigned i = 1; i < n; i++) { 00281 TMLink * l = (* links)[i]; 00282 if (l->wire()->layerId() < innerMostLayer) { 00283 innerMost = i; 00284 innerMostLayer = l->wire()->layerId(); 00285 } 00286 } 00287 00288 //...Move pivot... 00289 HepPoint3D newPivot = (* links)[innerMost]->positionOnWire(); 00290 if (quality() & TrackQuality2D) 00291 newPivot.setZ(0.); 00292 _helix->pivot(newPivot); 00293 }
const std::string & TTrack::name | ( | const std::string & | newName | ) | [inline] |
const std::string & TTrack::name | ( | void | ) | const [inline] |
returns/sets name.
Definition at line 516 of file TTrack.h.
References _name.
Referenced by TTrackMC::dump(), fit2D(), TConformalFinder::resolveSegments(), and TTrackManager::salvageAssociateHits().
00516 { 00517 return _name; 00518 }
unsigned TTrackBase::nCores | ( | unsigned | mask = 0 |
) | const [inherited] |
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
Definition at line 325 of file TTrackBase.cxx.
References TTrackBase::_cores, TTrackBase::_updated, and TTrackBase::update().
Referenced by dump(), and TConformalFinder::expand().
00325 { 00326 if (mask) 00327 std::cout << "TTrackBase::nCores !!! mask is not supported" << std::endl; 00328 if (! _updated) update(); 00329 return _cores.length(); 00330 }
unsigned TTrack::ndf | ( | void | ) | const [inline] |
unsigned TTrackBase::nHeps | ( | void | ) | const [inherited] |
returns # of contributed TTrackHEP tracks.
Definition at line 443 of file TTrackBase.cxx.
References TTrackBase::_nHeps, and TTrackBase::hep().
unsigned TTrackBase::nLinks | ( | unsigned | mask = 0 |
) | const [inherited] |
returns # of masked TMLinks assigned to this track object.
Definition at line 305 of file TTrackBase.cxx.
References TTrackBase::_links, and genRecEmupikp::i.
Referenced by TBuilderCurl::buildStereo(), TBuilderCurl::buildStereoMC(), TBuilderCurl::check(), TCurlFinder::check2DCircle(), TCurlFinder::check3DTrack(), TSegment0::clusterType(), TSegment::clusterType(), TCurlFinder::dividing2DTrack(), TCurlFinder::dumpType1(), TCurlFinder::dumpType2(), TCurlFinder::make2DTrack(), TCurlFinder::makeWithMC(), TCurlFinder::merge3DTrack(), TCurlFinder::plotCircle(), TCurlFinder::plotTrack(), TMSelector::preSelect(), TCurlFinder::salvage3DTrack(), TBuilderCurl::setArcZ(), TSegment0::splitComplicated(), TSegment::splitComplicated(), TSegment0::splitParallel(), TSegment::splitParallel(), TSegment0::updateType(), and TSegment::updateType().
00305 { 00306 unsigned n = _links.length(); 00307 if (mask == 0) return n; 00308 unsigned nn = 0; 00309 for (unsigned i = 0; i < n; i++) { 00310 const TMDCWireHit & h = * _links[i]->hit(); 00311 if (h.state() & mask) ++nn; 00312 } 00313 return nn; 00314 }
unsigned TTrack::objectType | ( | void | ) | const [inline, virtual] |
returns type.
Reimplemented from TTrackBase.
Definition at line 559 of file TTrack.h.
References Track.
00559 { 00560 return Track; 00561 }
TMLink * TTrackBase::operator[] | ( | unsigned | i | ) | const [inline, inherited] |
Hep3Vector TTrack::p | ( | void | ) | const [inline] |
returns momentum.
Definition at line 553 of file TTrack.h.
References _helix, and Helix::momentum().
Referenced by TTrackMC::compare(), and dump().
double TTrack::pt | ( | void | ) | const [inline] |
returns Pt.
Definition at line 528 of file TTrack.h.
References _helix, and Helix::a().
Referenced by TBuilderCurl::buildStereo(), TBuilderCurl::buildStereoMC(), TTrackMC::compare(), defineType(), dump(), TTrackManager::maskNormal(), and TTrackManager::merge().
double TTrack::ptot | ( | void | ) | const [inline] |
double TTrack::pz | ( | void | ) | const [inline] |
returns Pz.
Definition at line 534 of file TTrack.h.
References _helix, and Helix::a().
Referenced by TBuilderCurl::buildStereo(), and TTrackMC::compare().
unsigned TTrack::quality | ( | unsigned | qualityMask | ) | [inline] |
Definition at line 620 of file TTrack.h.
References _state, quality(), TrackQualityMask, and TrackQualityShift.
00620 { 00621 // _state = ((a << TrackQualityShift) & TrackQualityMask) | 00622 // (_state & (~ (TrackQualityMask << TrackQualityShift))); 00623 _state = ((a & TrackQualityMask) << TrackQualityShift) | 00624 (_state & (~ (TrackQualityMask << TrackQualityShift))); 00625 return quality(); 00626 }
unsigned TTrack::quality | ( | void | ) | const [inline] |
sets/returns quality.
Definition at line 614 of file TTrack.h.
References _state, TrackQualityMask, and TrackQualityShift.
Referenced by movePivot(), and quality().
00614 { 00615 return (_state >> TrackQualityShift) & TrackQualityMask; 00616 }
double TTrack::radius | ( | void | ) | const [inline] |
returns signed radius.
Definition at line 577 of file TTrack.h.
References _helix, and Helix::radius().
Referenced by calVirtualCircle(), TConformalFinder::crossPoints(), and defineType().
void TTrackBase::refine | ( | double | maxSigma | ) | [virtual, inherited] |
removes bad points by pull. The bad points are masked not to be used in fit.
Definition at line 194 of file TTrackBase.cxx.
References TTrackBase::_fitted, TTrackBase::_updated, Dump(), and TTrackBase::refineMain().
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 }
void TTrackBase::refine | ( | AList< TMLink > & | list, | |
double | maxSigma | |||
) | [virtual, inherited] |
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
Definition at line 170 of file TTrackBase.cxx.
References TTrackBase::_fitted, TTrackBase::_links, TTrackBase::_updated, Dump(), and TTrackBase::refineMain().
Referenced by TBuilder0::appendClusters(), TBuilderCurl::buildStereo(), TBuilderCosmic::buildStereo(), TBuilder0::buildStereo(), TBuilder::buildStereo(), TBuilder0::buildStereo0(), and TBuilderCurl::buildStereoMC().
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 }
void TTrack::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))
Definition at line 301 of file TTrack.cxx.
References TTrackBase::_fitted, TTrackBase::_links, fit2D(), and genRecEmupikp::i.
00301 { 00302 unsigned n = _links.length(); 00303 AList<TMLink> bad; 00304 for (unsigned i = 0; i < n; ++i) { 00305 if (_links[i]->pull() > maxSigma) bad.append(_links[i]); 00306 } 00307 _links.remove(bad); 00308 if (bad.length()){ 00309 _fitted = false; 00310 fit2D(); 00311 } 00312 list.append(bad); 00313 }
void TTrackBase::remove | ( | const AList< TMLink > & | ) | [inline, inherited] |
removes TMLinks.
Definition at line 213 of file TTrackBase.h.
References TTrackBase::_fitted, TTrackBase::_fittedWithCathode, TTrackBase::_links, and TTrackBase::_updated.
00213 { 00214 _links.remove(a); 00215 _updated = false; 00216 _fitted = false; 00217 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 ) 00218 }
void TTrackBase::remove | ( | TMLink & | a | ) | [inline, inherited] |
removes a TMLink.
Definition at line 204 of file TTrackBase.h.
References TTrackBase::_fitted, TTrackBase::_fittedWithCathode, TTrackBase::_links, and TTrackBase::_updated.
Referenced by TConformalFinder0::appendClusters2(), TBuilder::buildStereoNew(), TCurlFinder::dividing2DTrack(), TCurlFinder::makeWithMC(), TTrackManager::maskCurl(), TTrackManager::maskNormal(), TCurlFinder::removeStereo(), TBuilder::searchLine(), TConformalFinder0::specialFinding(), TSegment0::splitComplicated(), and TSegment::splitComplicated().
00204 { 00205 _links.remove(a); 00206 _updated = false; 00207 _fitted = false; 00208 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 ) 00209 }
void TTrackBase::removeLinks | ( | void | ) | [virtual, inherited] |
Definition at line 189 of file TTrackBase.cxx.
References TTrackBase::_links.
Referenced by TBuilderCosmic::buildStereo(), and TrkReco::execute().
00189 { 00190 _links.removeAll(); 00191 }
const AList< TSegment > & TTrack::segments | ( | void | ) | const [inline] |
AList< TSegment > & TTrack::segments | ( | void | ) | [inline] |
returns AList<TSegment>.
Definition at line 583 of file TTrack.h.
References _segments.
Referenced by TBuilder::buildStereoNew(), TConformalFinder::expand(), and TConformalFinder::salvage().
00583 { 00584 return _segments; 00585 }
void TTrack::setFinderType | ( | unsigned | ) | [inline] |
Definition at line 676 of file TTrack.h.
References _findertype.
00676 { 00677 _findertype=type; 00678 }
unsigned TTrack::state | ( | void | ) | const [inline] |
int TTrack::stereoHitForCurl | ( | AList< TMLink > & | ) | const |
calculates arc length and z for a stereo hit. uses these functions for curl tracks(included svd version).
Definition at line 2009 of file TTrack.cxx.
References _helix, TMDCWire::backwardPosition(), Helix::center(), cos(), Helix::curv(), TMDCWire::direction(), TMDCWireHit::drift(), TMDCWire::forwardPosition(), M_PI, sin(), delete_small_size::size, unit, TMDCWireHit::wire(), WireHitLeft, and x.
02010 { 02011 if(list.length() == 0)return -1; 02012 02013 HepPoint3D center = _helix->center(); 02014 HepPoint3D tmp(-999., -999., 0.); 02015 double r = fabs(_helix->curv()); 02016 for(unsigned i = 0, size = list.length(); i < size; ++i){ 02017 TMDCWireHit &h = *const_cast<TMDCWireHit*>(list[i]->hit()); 02018 HepVector3D X = 0.5*(h.wire()->forwardPosition() + 02019 h.wire()->backwardPosition()); 02020 HepVector3D x = HepVector3D(X.x(), X.y(), 0.); 02021 HepVector3D w = x - center; 02022 HepVector3D V = h.wire()->direction(); 02023 HepVector3D v = HepVector3D(V.x(), V.y(), 0.); 02024 double vmag2 = v.mag2(); 02025 double vmag = sqrt(vmag2); 02026 //...temporary 02027 for(unsigned j = 0; j < 4; ++j) 02028 list[i]->arcZ(tmp,j); 02029 02030 //...stereo? 02031 if (vmag == 0.) continue; 02032 02033 double drift = h.drift(WireHitLeft); 02034 double R[2] = {r + drift, r - drift}; 02035 double wv = w.dot(v); 02036 double d2[2]; 02037 d2[0] = vmag2*R[0]*R[0] + (wv*wv - vmag2*w.mag2()); //...= v^2*(r^2 - w^2*sin()^2)...outer 02038 d2[1] = vmag2*R[1]*R[1] + (wv*wv - vmag2*w.mag2()); //...= v^2*(r^2 - w^2*sin()^2)...inner 02039 02040 //...No crossing in R/Phi plane... 02041 if (d2[0] < 0. && d2[1] < 0.) continue; 02042 02043 bool ok_inner(true); 02044 bool ok_outer(true); 02045 double d[2] = {-1., -1.}; 02046 //...outer 02047 if(d2[0] >= 0.){ 02048 d[0] = sqrt(d2[0]); 02049 }else{ 02050 ok_outer = false; 02051 } 02052 if(d2[1] >= 0.){ 02053 d[1] = sqrt(d2[1]); 02054 }else{ 02055 ok_inner = false; 02056 } 02057 02058 //...Cal. length and z to crossing points... 02059 double l[2][2]; 02060 double z[2][2]; 02061 //...outer 02062 if(ok_outer){ 02063 l[0][0] = (- wv + d[0]) / vmag2; //...= (-wvcos()+d)/v/v = (-wcos() + (r^2 - w^2*sin()^2)^0.5)/v 02064 l[1][0] = (- wv - d[0]) / vmag2; //...= (-wvcos()+d)/v/v = (-wcos() - (r^2 - w^2*sin()^2)^0.5)/v 02065 z[0][0] = X.z() + l[0][0]*V.z(); 02066 z[1][0] = X.z() + l[1][0]*V.z(); 02067 } 02068 //...inner 02069 if(ok_inner){ 02070 l[0][1] = (- wv + d[1]) / vmag2; //...= (-wvcos()+d)/v/v = (-wcos() + (r^2 - w^2*sin()^2)^0.5)/v 02071 l[1][1] = (- wv - d[1]) / vmag2; //...= (-wvcos()+d)/v/v = (-wcos() - (r^2 - w^2*sin()^2)^0.5)/v 02072 z[0][1] = X.z() + l[0][1]*V.z(); 02073 z[1][1] = X.z() + l[1][1]*V.z(); 02074 } 02075 02076 //...Cal. xy position of crossing points... 02077 HepVector3D p[2][2]; 02078 #if 1 02079 HepVector3D tp[2][2]; 02080 #endif 02081 if(ok_outer){ 02082 p[0][0] = x + l[0][0] * v; 02083 p[1][0] = x + l[1][0] * v; 02084 #if 1 02085 tp[0][0] = p[0][0]; 02086 tp[1][0] = p[1][0]; 02087 #endif 02088 HepVector3D tmp_pc = p[0][0] - center; 02089 HepVector3D pc0 = HepVector3D(tmp_pc.x(), tmp_pc.y(), 0.); 02090 p[0][0] -= drift/pc0.mag()*pc0; 02091 tmp_pc = p[1][0] - center; 02092 HepVector3D pc1 = HepVector3D(tmp_pc.x(), tmp_pc.y(), 0.); 02093 p[1][0] -= drift/pc1.mag()*pc1; 02094 } 02095 #define JJTEST 0 02096 if(ok_inner){ 02097 p[0][1] = x + l[0][1] * v; 02098 p[1][1] = x + l[1][1] * v; 02099 #if JJTEST 02100 tp[0][1] = p[0][1]; 02101 tp[1][1] = p[1][1]; 02102 #endif 02103 HepVector3D tmp_pc = p[0][1] - center; 02104 HepVector3D pc0 = HepVector3D(tmp_pc.x(), tmp_pc.y(), 0.); 02105 p[0][1] += drift/pc0.mag()*pc0; 02106 tmp_pc = p[1][1] - center; 02107 HepVector3D pc1 = HepVector3D(tmp_pc.x(), tmp_pc.y(), 0.); 02108 p[1][1] += drift/pc1.mag()*pc1; 02109 } 02110 02111 //...boolean 02112 bool ok_xy[2][2]; 02113 if(ok_outer){ 02114 ok_xy[0][0] = true; 02115 ok_xy[1][0] = true; 02116 }else{ 02117 ok_xy[0][0] = false; 02118 ok_xy[1][0] = false; 02119 } 02120 if(ok_inner){ 02121 ok_xy[0][1] = true; 02122 ok_xy[1][1] = true; 02123 }else{ 02124 ok_xy[0][1] = false; 02125 ok_xy[1][1] = false; 02126 } 02127 if(ok_outer){ 02128 if (_charge * (center.x() * p[0][0].y() - center.y() * p[0][0].x()) < 0.) 02129 ok_xy[0][0] = false; 02130 if (_charge * (center.x() * p[1][0].y() - center.y() * p[1][0].x()) < 0.) 02131 ok_xy[1][0] = false; 02132 } 02133 if(ok_inner){ 02134 if (_charge * (center.x() * p[0][1].y() - center.y() * p[0][1].x()) < 0.) 02135 ok_xy[0][1] = false; 02136 if (_charge * (center.x() * p[1][1].y() - center.y() * p[1][1].x()) < 0.) 02137 ok_xy[1][1] = false; 02138 } 02139 if(!ok_inner && ok_outer && (!ok_xy[0][0]) && (!ok_xy[1][0])){ 02140 continue; 02141 } 02142 if(ok_inner && !ok_outer && (!ok_xy[0][1]) && (!ok_xy[1][1])){ 02143 continue; 02144 } 02145 02146 //...Check z position... 02147 if(ok_xy[0][0]){ 02148 if (z[0][0] < h.wire()->backwardPosition().z() || 02149 z[0][0] > h.wire()->forwardPosition().z()) ok_xy[0][0] = false; 02150 } 02151 if(ok_xy[1][0]){ 02152 if (z[1][0] < h.wire()->backwardPosition().z() || 02153 z[1][0] > h.wire()->forwardPosition().z()) ok_xy[1][0] = false; 02154 } 02155 if(ok_xy[0][1]){ 02156 if (z[0][1] < h.wire()->backwardPosition().z() || 02157 z[0][1] > h.wire()->forwardPosition().z()) ok_xy[0][1] = false; 02158 } 02159 if(ok_xy[1][1]){ 02160 if (z[1][1] < h.wire()->backwardPosition().z() || 02161 z[1][1] > h.wire()->forwardPosition().z()) ok_xy[1][1] = false; 02162 } 02163 if ((!ok_xy[0][0]) && (!ok_xy[1][0]) && 02164 (!ok_xy[0][1]) && (!ok_xy[1][1])){ 02165 continue; 02166 } 02167 double cosdPhi, dPhi; 02168 unsigned index; 02169 index = 0; 02170 if(ok_xy[0][0]){ 02171 //...cal. arc length... 02172 cosdPhi = - center.dot((p[0][0] - center).unit()) / center.mag(); 02173 if(fabs(cosdPhi) < 1.0){ 02174 dPhi = acos(cosdPhi); 02175 }else if(cosdPhi >= 1.0){ 02176 dPhi = 0.; 02177 }else{ 02178 dPhi = M_PI; 02179 } 02180 list[i]->arcZ(HepPoint3D(r*dPhi, z[0][0], 0.), index); 02181 //std::cout << r*dPhi << ", " << z[0][0] << std::endl; 02182 ++index; 02183 } 02184 if(ok_xy[1][0]){ 02185 //...cal. arc length... 02186 cosdPhi = - center.dot((p[1][0] - center).unit()) / center.mag(); 02187 if(fabs(cosdPhi) < 1.0){ 02188 dPhi = acos(cosdPhi); 02189 }else if(cosdPhi >= 1.0){ 02190 dPhi = 0.; 02191 }else{ 02192 dPhi = M_PI; 02193 } 02194 list[i]->arcZ(HepPoint3D(r*dPhi, z[1][0], 0.), index); 02195 //std::cout << r*dPhi << ", " << z[1][0] << std::endl; 02196 ++index; 02197 } 02198 if(ok_xy[0][1]){ 02199 //...cal. arc length... 02200 cosdPhi = - center.dot((p[0][1] - center).unit()) / center.mag(); 02201 if(fabs(cosdPhi) < 1.0){ 02202 dPhi = acos(cosdPhi); 02203 }else if(cosdPhi >= 1.0){ 02204 dPhi = 0.; 02205 }else{ 02206 dPhi = M_PI; 02207 } 02208 list[i]->arcZ(HepPoint3D(r*dPhi, z[0][1], 0.), index); 02209 //std::cout << r*dPhi << ", " << z[0][1] << std::endl; 02210 ++index; 02211 } 02212 if(ok_xy[1][1]){ 02213 //...cal. arc length... 02214 cosdPhi = - center.dot((p[1][1] - center).unit()) / center.mag(); 02215 if(fabs(cosdPhi) < 1.0){ 02216 dPhi = acos(cosdPhi); 02217 }else if(cosdPhi >= 1.0){ 02218 dPhi = 0.; 02219 }else{ 02220 dPhi = M_PI; 02221 } 02222 list[i]->arcZ(HepPoint3D(r*dPhi, z[1][1], 0.), index); 02223 //std::cout << r*dPhi << ", " << z[1][1] << std::endl; 02224 ++index; 02225 } 02226 02227 #if JJTEST 02228 double gmaxX = -9999. ,gminX = 9999.; 02229 double gmaxY = -9999. ,gminY = 9999.; 02230 FILE *gnuplot, *data; 02231 double step = 100.; 02232 double dStep = 2.*M_PI/step; 02233 if((data = fopen("dat1","w")) != NULL){ 02234 if(ok_xy[0][0]){ 02235 for(int ii=0;ii<step;++ii){ 02236 double X = tp[0][0].x() + drift*cos(dStep*static_cast<double>(ii)); 02237 double Y = tp[0][0].y() + drift*sin(dStep*static_cast<double>(ii)); 02238 fprintf(data,"%lf, %lf\n",X,Y); 02239 if(gmaxX < X)gmaxX = X; 02240 if(gminX > X)gminX = X; 02241 if(gmaxY < Y)gmaxY = Y; 02242 if(gminY > Y)gminY = Y; 02243 } 02244 } 02245 fclose(data); 02246 } 02247 if((data = fopen("dat2","w")) != NULL){ 02248 if(ok_xy[1][0]){ 02249 for(int ii=0;ii<step;++ii){ 02250 double X = tp[1][0].x() + drift*cos(dStep*static_cast<double>(ii)); 02251 double Y = tp[1][0].y() + drift*sin(dStep*static_cast<double>(ii)); 02252 fprintf(data,"%lf, %lf\n",X,Y); 02253 if(gmaxX < X)gmaxX = X; 02254 if(gminX > X)gminX = X; 02255 if(gmaxY < Y)gmaxY = Y; 02256 if(gminY > Y)gminY = Y; 02257 } 02258 } 02259 fclose(data); 02260 } 02261 if((data = fopen("dat3","w")) != NULL){ 02262 if(ok_xy[0][1]){ 02263 for(int ii=0;ii<step;++ii){ 02264 double X = tp[0][1].x() + drift*cos(dStep*static_cast<double>(ii)); 02265 double Y = tp[0][1].y() + drift*sin(dStep*static_cast<double>(ii)); 02266 fprintf(data,"%lf, %lf\n",X,Y); 02267 if(gmaxX < X)gmaxX = X; 02268 if(gminX > X)gminX = X; 02269 if(gmaxY < Y)gmaxY = Y; 02270 if(gminY > Y)gminY = Y; 02271 } 02272 } 02273 fclose(data); 02274 } 02275 if((data = fopen("dat4","w")) != NULL){ 02276 if(ok_xy[1][1]){ 02277 for(int ii=0;ii<step;++ii){ 02278 double X = tp[1][1].x() + drift*cos(dStep*static_cast<double>(ii)); 02279 double Y = tp[1][1].y() + drift*sin(dStep*static_cast<double>(ii)); 02280 fprintf(data,"%lf, %lf\n",X,Y); 02281 if(gmaxX < X)gmaxX = X; 02282 if(gminX > X)gminX = X; 02283 if(gmaxY < Y)gmaxY = Y; 02284 if(gminY > Y)gminY = Y; 02285 } 02286 } 02287 fclose(data); 02288 } 02289 HepVector3D tX = h.wire()->forwardPosition()-h.wire()->backwardPosition(); 02290 HepVector3D tDist(tX.x(), tX.y(), 0.); 02291 double tD = tDist.mag(); 02292 double vvvM = 1./ v.mag(); 02293 HepVector3D tDire = vvvM*v; 02294 step = 2.; 02295 dStep = tD/step; 02296 if((data = fopen("dat5","w")) != NULL){ 02297 for(int ii=0;ii<step+1;++ii){ 02298 double X = h.wire()->backwardPosition().x()+dStep*static_cast<double>(ii)*tDire.x(); 02299 double Y = h.wire()->backwardPosition().y()+dStep*static_cast<double>(ii)*tDire.y(); 02300 fprintf(data,"%lf, %lf\n",X,Y); 02301 if(gmaxX < X)gmaxX = X; 02302 if(gminX > X)gminX = X; 02303 if(gmaxY < Y)gmaxY = Y; 02304 if(gminY > Y)gminY = Y; 02305 } 02306 fclose(data); 02307 } 02308 if((data = fopen("dat6","w")) != NULL){ 02309 double X = h.wire()->backwardPosition().x(); 02310 double Y = h.wire()->backwardPosition().y(); 02311 fprintf(data,"%lf, %lf\n",X,Y); 02312 if(gmaxX < X)gmaxX = X; 02313 if(gminX > X)gminX = X; 02314 if(gmaxY < Y)gmaxY = Y; 02315 if(gminY > Y)gminY = Y; 02316 fclose(data); 02317 } 02318 if((data = fopen("dat7","w")) != NULL){ 02319 double X = h.wire()->forwardPosition().x(); 02320 double Y = h.wire()->forwardPosition().y(); 02321 fprintf(data,"%lf, %lf\n",X,Y); 02322 if(gmaxX < X)gmaxX = X; 02323 if(gminX > X)gminX = X; 02324 if(gmaxY < Y)gmaxY = Y; 02325 if(gminY > Y)gminY = Y; 02326 fclose(data); 02327 } 02328 step = 300.; 02329 dStep = 2.*M_PI/step; 02330 if((data = fopen("dat8","w")) != NULL){ 02331 for(int ii=0;ii<step;++ii){ 02332 double X = center.x() + r*cos(dStep*static_cast<double>(ii)); 02333 double Y = center.y() + r*sin(dStep*static_cast<double>(ii)); 02334 fprintf(data,"%lf, %lf\n",X,Y); 02335 } 02336 fclose(data); 02337 } 02338 if((data = fopen("dat9","w")) != NULL){ 02339 if(ok_xy[0][0]){ 02340 double X = p[0][0].x(); 02341 double Y = p[0][0].y(); 02342 fprintf(data,"%lf, %lf\n",X,Y); 02343 } 02344 fclose(data); 02345 } 02346 if((data = fopen("dat10","w")) != NULL){ 02347 if(ok_xy[1][0]){ 02348 double X = p[1][0].x(); 02349 double Y = p[1][0].y(); 02350 fprintf(data,"%lf, %lf\n",X,Y); 02351 } 02352 fclose(data); 02353 } 02354 if((data = fopen("dat11","w")) != NULL){ 02355 if(ok_xy[0][1]){ 02356 double X = p[0][1].x(); 02357 double Y = p[0][1].y(); 02358 fprintf(data,"%lf, %lf\n",X,Y); 02359 } 02360 fclose(data); 02361 } 02362 if((data = fopen("dat12","w")) != NULL){ 02363 if(ok_xy[1][1]){ 02364 double X = p[1][1].x(); 02365 double Y = p[1][1].y(); 02366 fprintf(data,"%lf, %lf\n",X,Y); 02367 } 02368 fclose(data); 02369 } 02370 std::cout << "Drift Distance = " << drift << ", xy1cm -> z" << V.z()/v.mag() << "cm, xyDist(cm) = " << tD << std::endl; 02371 if(tX.z()<0.)std::cout << "ERROR : F < B" << std::endl; 02372 if((gnuplot = popen("gnuplot","w")) != NULL){ 02373 fprintf(gnuplot,"set size 0.721,1.0 \n"); 02374 fprintf(gnuplot,"set xrange [%f:%f] \n",gminX,gmaxX); 02375 fprintf(gnuplot,"set yrange [%f:%f] \n",gminY,gmaxY); 02376 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"); 02377 fflush(gnuplot); 02378 char tmp[8]; 02379 gets(tmp); 02380 pclose(gnuplot); 02381 } 02382 #endif 02383 } 02384 return 0; 02385 }
int TTrack::stereoHitForCurl | ( | TMLink & | link, | |
AList< HepPoint3D > & | arcZList | |||
) | const |
Referenced by TBuilderCurl::setArcZ().
int TTrack::szPosition | ( | const HepPoint3D & | p, | |
HepPoint3D & | szPosition | |||
) | const |
calculates arc length for a point.
Definition at line 3608 of file TTrack.cxx.
References _helix, Helix::center(), Helix::curv(), M_PI, and unit.
03608 { 03609 03610 //...Cal. arc length... 03611 HepPoint3D center = _helix->center(); 03612 HepPoint3D xy = p; 03613 xy.setZ(0.); 03614 double cosdPhi = - center.dot((xy - center).unit()) / center.mag(); 03615 double dPhi; 03616 if (fabs(cosdPhi) <= 1.0) { 03617 dPhi = acos(cosdPhi); 03618 } 03619 else if (cosdPhi > 1.0) { 03620 dPhi = 0.0; 03621 } 03622 else { 03623 dPhi = M_PI; 03624 } 03625 03626 //...Finish... 03627 sz.setX(_helix->curv() * dPhi); 03628 sz.setY(p.z()); 03629 sz.setZ(0.); 03630 03631 return 0; 03632 }
calculates arc length and z for a segment. Results are stored in TMLink.
Definition at line 3570 of file TTrack.cxx.
References TTrackBase::cores(), showlog::err, TMLink::hit(), TMLink::leftRight(), TTrackBase::links(), TMLink::position(), and szPosition().
03570 { 03571 03572 //...Pick up a wire which represents segment position... 03573 AList<TMLink> links = segment.cores(); 03574 unsigned n = links.length(); 03575 // std::cout<<" szPosition TTrack:: segment.cores().length():"<<n<<endl; 03576 // for (unsigned i = 1; i < n; i++) { 03577 // std::cout<<"drift distance"<<links[i]->hit()->drift()<<endl; 03578 // } 03579 if (! n) return -1; 03580 TMLink * minL = links[0]; 03581 float minDist = links[0]->drift(); 03582 #ifdef TRKRECO_DEBUG_DETAIL 03583 std::cout<<"minDist szPosition TTrack:"<<minDist<<endl; 03584 #endif 03585 for (unsigned i = 1; i < n; i++) { 03586 if (links[i]->hit()->drift() < minDist) { 03587 minDist = links[i]->drift(); 03588 #ifdef TRKRECO_DEBUG_DETAIL 03589 std::cout<<"minDist szPosition TTrack:"<<minDist<<endl; 03590 #endif 03591 minL = links[i]; 03592 } 03593 } 03594 03595 //...sz calculation... 03596 a.position(minL->position()); 03597 a.leftRight(2); 03598 a.hit(minL->hit()); 03599 int err = szPosition(a); 03600 #ifdef TRKRECO_DEBUG_DETAIL 03601 std::cout<<"err of szPosition TTrack:"<<err<<endl; 03602 #endif 03603 if (err) return -2; 03604 return 0; 03605 }
int TTrack::szPosition | ( | TMLink & | link | ) | const |
calculates arc length and z for a stereo hit.
Definition at line 3372 of file TTrack.cxx.
References _helix, TMDCWire::backwardPosition(), Helix::center(), Helix::curv(), TMDCWire::direction(), TMDCWireHit::drift(), TMDCWire::forwardPosition(), IMagneticFieldSvc::getReferField(), TMLink::hit(), TMLink::leftRight(), M_PI, m_pmgnIMF, ORIGIN, TMLink::position(), unit, w, TMDCWireHit::wire(), WireHitLeft, and WireHitRight.
Referenced by TBuilderCosmic::buildStereo(), TBuilder0::buildStereo(), TBuilder::buildStereo(), TBuilder0::buildStereo0(), and szPosition().
03372 { 03373 const TMDCWireHit & h = * link.hit(); 03374 HepVector3D X = 0.5 * (h.wire()->forwardPosition() 03375 + h.wire()->backwardPosition()); 03376 // double theta = atan2(X.y(), X.x()); 03377 // HepVector3D lr(h.distance(WireHitLeft) * sin(theta), 03378 // - h.distance(WireHitLeft) * cos(theta), 03379 // 0.); 03380 03381 HepVector3D xx = HepVector3D(X.x(), X.y(), 0.); 03382 HepPoint3D center = _helix->center(); 03383 HepVector3D yy = center - xx; 03384 HepVector3D ww = HepVector3D(yy.x(), yy.y(), 0.); 03385 double wwmag2 = ww.mag2(); 03386 double wwmag = sqrt(wwmag2); 03387 HepVector3D lr(h.drift(WireHitLeft)/wwmag * ww.x(), 03388 h.drift(WireHitLeft)/wwmag * ww.y(), 03389 0.); 03390 03391 #ifdef TRKRECO_DEBUG_DETAIL 03392 std::cout<<"old lr "<<lr<<endl; 03393 std::cout<<"old X "<<X<<endl; 03394 std::cout<<"link.leftRight "<<link.leftRight()<<endl; 03395 #endif 03396 //...Check left or right... 03397 // // change to bes3 .. test.. 03398 //if (link.leftRight() == WireHitRight) { 03399 //lr = - lr; 03400 //} 03401 //if (link.leftRight() == WireHitLeft) lr = - lr; 03402 //else if (link.leftRight() == 2) lr = ORIGIN; 03403 03404 //yzhang 2012-05-07 03405 const double Bz = -1000*m_pmgnIMF->getReferField(); 03406 #ifdef TRKRECO_DEBUG_DETAIL 03407 std::cout<<"charge "<<_charge<<" Bz "<<Bz<<endl; 03408 #endif 03409 if (_charge*Bz > 0){ //yzhang 2012-05-07 03410 if (link.leftRight() == WireHitRight){ 03411 lr = - lr;//right 03412 } 03413 }else{ 03414 if (link.leftRight() == WireHitLeft){ 03415 lr = - lr;//left 03416 } 03417 } 03418 if (link.leftRight() == 2) lr = ORIGIN; 03419 //zhangy 03420 03421 X += lr; 03422 03423 //...Prepare vectors... 03424 // HepPoint3D center = _helix->center(); 03425 HepPoint3D tmp(-9999., -9999., 0.); 03426 HepVector3D x = HepVector3D(X.x(), X.y(), 0.); 03427 HepVector3D w = x - center; 03428 // //modified the next sentence because the direction are different from belle. 03429 HepVector3D V = h.wire()->direction(); 03430 // // to bes3 03431 // // HepVector3D V = - h.wire()->direction(); 03432 03433 HepVector3D v = HepVector3D(V.x(), V.y(), 0.); 03434 double vmag2 = v.mag2(); 03435 double vmag = sqrt(vmag2); 03436 03437 double r = _helix->curv(); 03438 double wv = w.dot(v); 03439 // //zsl for bes3 03440 // wv = abs(wv); 03441 double d2 = wv * wv - vmag2 * (w.mag2() - r * r); 03442 #ifdef TRKRECO_DEBUG_DETAIL 03443 std::cout<<"lr "<<lr<<endl; 03444 std::cout<<"forwardPosition "<<h.wire()->forwardPosition()<<endl; 03445 std::cout<<"backwardPosition "<<h.wire()->backwardPosition()<<endl; 03446 std::cout<<"X "<<X<<endl; 03447 std::cout<<"center "<<center<<endl; 03448 std::cout<<"xx "<<xx<<endl; 03449 std::cout<<"ww "<<ww<<endl; 03450 std::cout<<"TTrack::wire direction:"<<h.wire()->direction()<<endl; 03451 std::cout<<"x "<<x<<endl; 03452 std::cout<<"w "<<w<<endl; 03453 std::cout<<"sz,Track::vmag:"<<vmag<<", helix_r:"<<r<<", wv:"<<wv<<", d:"<<sqrt(d2)<<endl; 03454 #endif 03455 03456 //...No crossing in R/Phi plane... This is too tight... 03457 03458 if (d2 < 0.) { 03459 link.position(tmp); 03460 03461 #ifdef TRKRECO_DEBUG 03462 std::cout << "TTrack !!! stereo: 0. > d2 = " << d2 << " " 03463 << link.leftRight() << std::endl; 03464 #endif 03465 return -1; 03466 } 03467 double d = sqrt(d2); 03468 03469 //...Cal. length to crossing points... 03470 double l[2]; 03471 l[0] = (- wv + d) / vmag2; 03472 l[1] = (- wv - d) / vmag2; 03473 03474 //...Cal. z of crossing points... 03475 bool ok[2]; 03476 ok[0] = true; 03477 ok[1] = true; 03478 double z[2]; 03479 z[0] = X.z() + l[0] * V.z(); 03480 z[1] = X.z() + l[1] * V.z(); 03481 #ifdef TRKRECO_DEBUG_DETAIL 03482 std::cout<<"X.z():"<<X.z()<<endl; 03483 std::cout<<"szPosition::z(0) "<<z[0]<<" z(1)"<<z[1]<<" leftRight "<<link.leftRight()<<endl; 03484 std::cout<<"szPosition::wire backwardPosition and forwardPosition:"<< h.wire()->backwardPosition().z()<<","<<h.wire()->forwardPosition().z()<<endl; 03485 std::cout << " l0, l1 = " << l[0] << ", " << l[1] << std::endl; 03486 std::cout << " z0, z1 = " << z[0] << ", " << z[1] << std::endl; 03487 std::cout << " backward = " << h.wire()->backwardPosition().z() << std::endl; 03488 std::cout << " forward = " << h.wire()->forwardPosition().z() << std::endl; 03489 #endif 03490 03491 //...Check z position... //yzhang change 2012-05-03 03492 //modified because Belle backward and forward are different from BESIII 03493 03494 /* 03495 if (link.leftRight() == 2) { 03496 if (z[0] > h.wire()->backwardPosition().z()+20. 03497 || z[0] < h.wire()->forwardPosition().z()-20.) ok[0] = false; 03498 if (z[1] > h.wire()->backwardPosition().z()+20. 03499 || z[1] < h.wire()->forwardPosition().z()-20.) ok[1] = false; 03500 } 03501 else { 03502 if (z[0] > h.wire()->backwardPosition().z() 03503 || z[0] < h.wire()->forwardPosition().z() ) ok[0] = false; 03504 if (z[1] > h.wire()->backwardPosition().z() 03505 || z[1] < h.wire()->forwardPosition().z() ) ok[1] = false; 03506 } 03507 if ((! ok[0]) && (! ok[1])) { 03508 link.position(tmp); 03509 return -2; 03510 }*/ 03511 //belle... 03512 if (link.leftRight() == 2) { 03513 if (z[0] < h.wire()->backwardPosition().z() - 20. 03514 || z[0] > h.wire()->forwardPosition().z() + 20.) ok[0] = false; 03515 if (z[1] < h.wire()->backwardPosition().z()-20. 03516 || z[1] > h.wire()->forwardPosition().z()+20.) ok[1] = false; 03517 } 03518 else { 03519 if (z[0] < h.wire()->backwardPosition().z() 03520 || z[0] > h.wire()->forwardPosition().z()) ok[0] = false; 03521 if (z[1] < h.wire()->backwardPosition().z() 03522 || z[1] > h.wire()->forwardPosition().z()) ok[1] = false; 03523 } 03524 if ((! ok[0]) && (! ok[1])) { 03525 link.position(tmp); 03526 return -2; 03527 } 03528 03529 03530 //...Cal. xy position of crossing points... 03531 HepVector3D p[2]; 03532 p[0] = x + l[0] * v; 03533 p[1] = x + l[1] * v; 03534 /* if (_charge * (center.x() * p[0].y() - center.y() * p[0].x()) < 0.) //liuqg, cosmic... 03535 ok[0] = false; 03536 if (_charge * (center.x() * p[1].y() - center.y() * p[1].x()) < 0.) 03537 ok[1] = false; 03538 if ((! ok[0]) && (! ok[1])){ 03539 // double tmp1 = _charge * (center.x() * p[0].y() - center.y() * p[0].x()); 03540 // double tmp2 = _charge * (center.x() * p[1].y() - center.y() * p[1].x()) ; 03541 // if (link.leftRight() == 2) std::cout<<tmp1<<" "<<tmp2<<std::endl; 03542 link.position(tmp); 03543 return -3; 03544 } 03545 */ 03546 //...Which one is the best?... Study needed... 03547 unsigned best = 0; 03548 if (ok[1]) best = 1; 03549 03550 //...Cal. arc length... 03551 double cosdPhi = - center.dot((p[best] - center).unit()) / center.mag(); 03552 double dPhi; 03553 if(fabs(cosdPhi)<=1.0) { 03554 dPhi = acos(cosdPhi); 03555 } else if (cosdPhi>1.0) { 03556 dPhi = 0.0; 03557 } else { 03558 dPhi = M_PI; 03559 } 03560 03561 //...Finish... 03562 tmp.setX(r * dPhi); 03563 tmp.setY(z[best]); 03564 link.position(tmp); 03565 03566 return 0; 03567 }
unsigned TTrackBase::testByApproach | ( | const AList< TMLink > & | list, | |
double | sigma | |||
) | const [inherited] |
Definition at line 240 of file TTrackBase.cxx.
References genRecEmupikp::i, and TTrackBase::testByApproach().
00240 { 00241 #ifdef TRKRECO_DEBUG_DETAIL 00242 std::cout << " TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl; 00243 #endif 00244 00245 unsigned nOK = 0; 00246 unsigned n = list.length(); 00247 for (unsigned i = 0; i < n; i++) { 00248 TMLink & l = * list[i]; 00249 nOK += testByApproach(l, maxSigma); 00250 } 00251 return nOK; 00252 }
unsigned TTrackBase::testByApproach | ( | const TMLink & | list, | |
double | sigma | |||
) | const [inherited] |
returns # of good hits to be appended.
Definition at line 255 of file TTrackBase.cxx.
References TTrackBase::approach(), TMDCWireHit::dDrift(), TMLink::distance(), TTrackBase::distance(), TMDCWireHit::drift(), TMLink::dump(), showlog::err, TMLink::hit(), and TMLink::pull().
Referenced by TTrackBase::testByApproach().
00255 { 00256 #ifdef TRKRECO_DEBUG_DETAIL 00257 std::cout << " TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl; 00258 #endif 00259 TMLink l = link; 00260 00261 //...Calculate closest approach... 00262 int err = approach(l); 00263 if (err < 0) return 0; 00264 //...Calculate sigma... 00265 float distance = l.distance(); 00266 float diff = fabs(distance - l.hit()->drift()); 00267 float sigma = diff / l.hit()->dDrift(); 00268 l.pull(sigma * sigma); 00269 00270 //...For debug... 00271 #ifdef TRKRECO_DEBUG_DETAIL 00272 std::cout << " sigma=" << sigma; 00273 std::cout << ",dist=" << distance; 00274 std::cout << ",diff=" << diff << ","; 00275 if (sigma < maxSigma) std::cout << "ok,"; 00276 else std::cout << "X,"; 00277 l.dump("mc"); 00278 #endif 00279 00280 //...Make sigma cut... 00281 if (sigma < maxSigma) return 1; 00282 00283 return 0; 00284 }
unsigned TTrack::type | ( | void | ) | const [inline, virtual] |
returns type. Definition is depending on an object type.
Reimplemented from TTrackBase.
Definition at line 565 of file TTrack.h.
References defineType().
00565 { 00566 return defineType(); 00567 }
void TTrackBase::update | ( | void | ) | const [inherited] |
update cache.
Reimplemented in TSegment, and TSegment0.
Definition at line 75 of file TTrackBase.cxx.
References TTrackBase::_cores, TTrackBase::_links, TTrackBase::_updated, genRecEmupikp::i, TMDCWireHit::state(), WireHitFittingValid, and WireHitInvalidForFit.
Referenced by TTrackBase::cores(), TTrackBase::dump(), and TTrackBase::nCores().
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 }
friend class TBuilderCosmic [friend] |
friend class TBuilderCurl [friend] |
friend class TCosmicFitter [friend] |
friend class TCurlFinder [friend] |
friend class THelixFitter [friend] |
friend class TTrackManager [friend] |
AList<TMLink> TTrack::_associateHits [private] |
double TTrack::_charge [private] |
double TTrack::_chi2 [private] |
Definition at line 362 of file TTrack.h.
Referenced by chi2(), confidenceLevel(), dump(), fit2D(), and TCurlFinder::makeCurlTracks().
TTrack* TTrack::_daughter [private] |
AList<TMLink> TTrack::_finalHits [private] |
unsigned TTrack::_findertype [private] |
bool TTrackBase::_fitted [mutable, protected, inherited] |
Definition at line 162 of file TTrackBase.h.
Referenced by TMLine::a(), TLine0::a(), TTrackBase::append(), TTrackBase::appendByApproach(), TMLine::appendByszdistance(), TLine0::appendByszdistance(), TMLine::appendSLY(), TLine0::appendSLY(), TMLine::b(), TLine0::b(), TCircle::center(), TCircle::charge(), chi2(), TMLine::chi2(), TLine0::chi2(), TSegment0::direction(), TSegment::direction(), TMLine::distance(), TLine0::distance(), TTrackBase::DropWorst(), TSegment0::dump(), TSegment::dump(), TCircle::dump(), TTrackBase::falseFit(), THelixFitter::fit(), TCosmicFitter::fit(), TMLine::fit2(), TLine0::fit2(), TMLine::fit2p(), TLine0::fit2p(), TMLine::fit2s(), TLine0::fit2s(), TMLine::fit2sp(), TLine0::fit2sp(), TCircle::fitForCurl(), TTrackBase::fitted(), TTrackBase::fitter(), TCircle::impact(), TSegment0::innerMostLayer(), TSegment::innerMostLayer(), TSegment::inners(), TSegment0::innerWidth(), TSegment::innerWidth(), ndf(), TSegment0::outerMostLayer(), TSegment::outerMostLayer(), TSegment::outers(), TSegment0::outerWidth(), TSegment::outerWidth(), TSegment0::position(), TSegment::position(), TCircle::pt(), TCircle::radius(), TMLine::reducedChi2(), TLine0::reducedChi2(), TTrackBase::refine(), TMLine::refine(), TLine0::refine(), refine2D(), TTrackBase::remove(), TMLine::removeChits(), TLine0::removeChits(), TMLine::removeSLY(), TLine0::removeSLY(), T3DLine::T3DLine(), TRunge::TRunge(), TSegment::TSegment(), TSegment0::TSegment0(), TTrack(), TSegment0::update(), TSegment::update(), TSegment0::updateType(), and TSegment::updateType().
bool TTrackBase::_fittedWithCathode [mutable, protected, inherited] |
Definition at line 163 of file TTrackBase.h.
Referenced by TTrackBase::append(), TTrackBase::falseFit(), TTrackBase::fittedWithCathode(), TTrackBase::remove(), T3DLine::T3DLine(), TRunge::TRunge(), and TTrack().
const THelixFitter TTrack::_fitter = THelixFitter("TTrack Default Helix Fitter") [static, private] |
Helix* TTrack::_helix [private] |
Definition at line 360 of file TTrack.h.
Referenced by approach(), approach2D(), TBuilderCurl::buildStereo(), TBuilderCosmic::buildStereo(), TBuilder0::buildStereo(), TBuilder::buildStereo(), TBuilder0::buildStereo0(), TBuilderCurl::buildStereoMC(), center(), dump(), dxda(), dxda2D(), fit2D(), HelCyl(), helix(), impact(), movePivot(), p(), pt(), ptot(), pz(), radius(), stereoHitForCurl(), szPosition(), TTrack(), and ~TTrack().
AList<TMLink> TTrackBase::_links [protected, inherited] |
Definition at line 161 of file TTrackBase.h.
Referenced by TTrackBase::append(), TTrackBase::appendByApproach(), TMLine::appendByszdistance(), TLine0::appendByszdistance(), TMLine::appendSLY(), TLine0::appendSLY(), assign(), TBuilderCurl::buildStereo(), TMLine::chi2(), TLine0::chi2(), TTrackBase::DropWorst(), TTrackBase::dump(), dump(), TSegment0::dump(), TSegment::dump(), TMLine::dump(), TLine0::dump(), TCircle::dump(), TSegment::expandSeg(), TMLine::fit2(), TLine0::fit2(), fit2D(), TMLine::fit2p(), TLine0::fit2p(), TMLine::fit2s(), TLine0::fit2s(), TMLine::fit2sp(), TLine0::fit2sp(), TCircle::fitForCurl(), TTrackBase::hep(), TTrackBase::links(), movePivot(), TTrackBase::nLinks(), TTrackBase::operator[](), TSegment0::rangeX(), TSegment::rangeX(), TMLine::reducedChi2(), TLine0::reducedChi2(), TTrackBase::refine(), TMLine::refine(), TLine0::refine(), refine2D(), TTrackBase::refineMain(), TTrackBase::remove(), TMLine::removeChits(), TLine0::removeChits(), TTrackBase::removeLinks(), TMLine::removeSLY(), TLine0::removeSLY(), TSegment::segSalvage(), TSegment0::solveDualHits(), TSegment::solveDualHits(), TSegment::solveLR(), TSegment::solveThreeHits(), TSegment0::splitAV(), TSegment::splitAV(), TSegment0::splitComplicated(), TSegment::splitComplicated(), TSegment0::splitDual(), TSegment::splitDual(), TSegment0::splitParallel(), TSegment::splitParallel(), TSegment::splitTsf(), TSegment::TSegment(), TSegment0::TSegment0(), TTrack(), TTrackBase::update(), TSegment0::update(), TSegment::update(), TSegment0::updateDuality(), TSegment::updateDuality(), TSegment0::updateType(), and TSegment::updateType().
TTrackMC* TTrackBase::_mc [protected, inherited] |
TTrack* TTrack::_mother [private] |
std::string TTrack::_name [private] |
unsigned TTrack::_ndf [private] |
Definition at line 361 of file TTrack.h.
Referenced by confidenceLevel(), dump(), fit2D(), TCurlFinder::makeCurlTracks(), and ndf().
AList<TSegment> TTrack::_segments [private] |
unsigned TTrack::_state [private] |
unsigned TTrack::_type [mutable, private] |
IMagneticFieldSvc* TTrack::m_pmgnIMF [mutable, private] |
Definition at line 382 of file TTrack.h.
Referenced by approach(), dxda(), dxda2D(), szPosition(), and TTrack().