TSegment0 Class Reference

A class to relate TMDCWireHit and TTrack objects. More...

#include <TSegment0.h>

Inheritance diagram for TSegment0:

TTrackBase List of all members.

Public Member Functions

 TSegment0 ()
 Constructor.
 TSegment0 (const AList< TMLink > &)
virtual ~TSegment0 ()
 Destructor.
virtual unsigned objectType (void) const
 returns type.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
unsigned superLayerId () const
 returns super layer id.
const HepPoint3Dposition (void) const
 returns position.
const HepVector3Ddirection (void) const
 returns direction.
double distance (const TSegment0 &) const
 calculates distance between two clusters. Smaller value indicates closer.
double distance (const HepPoint3D &, const HepVector3D &) const
Range rangeX (double min, double max) const
 returns Range of x-coordinate of TMLinks.
unsigned innerWidth (void) const
 returns inner width.
unsigned outerWidth (void) const
 returns outer width.
unsigned innerMostLayer (void) const
 returns inner most layer.
unsigned outerMostLayer (void) const
 returns outer most layer.
unsigned clusterType (void) const
 returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside), 4:A shape, 5:X shape, 6:parallel, 7:complicated.
AList< TSegment0split (void) const
 returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned.
int solveDualHits (void)
double duality (void) const
AList< TTrack > & tracks (void)
AList< TSegment0 > & innerLinks (void)
virtual unsigned type (void) const
 returns type. Definition is depending on an object class.
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 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.
virtual int approach (TMLink &) const
 calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.
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
TMLinkoperator[] (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

AList< TSegment0splitAV (void) const
AList< TSegment0splitParallel (void) const
AList< TSegment0splitComplicated (void) const
AList< TSegment0splitDual (void) const
void update (void) const
 updates cache.
void updateType (void) const
 updates type.
void updateDuality (void) const
 updates duality.

Private Attributes

AList< TTrack_tracks
AList< TSegment0_innerLinks
HepPoint3D _position
HepVector3D _direction
unsigned _innerWidth
unsigned _outerWidth
unsigned _innerMostLayer
unsigned _outerMostLayer
AList< TMLink_inners
AList< TMLink_outers
unsigned _nLayer
unsigned _clusterType
double _duality
unsigned _nDual
double _angle

Detailed Description

A class to relate TMDCWireHit and TTrack objects.

Definition at line 41 of file TSegment0.h.


Constructor & Destructor Documentation

TSegment0::TSegment0 (  ) 

Constructor.

Definition at line 22 of file TSegment0.cxx.

References TTrackBase::_fitted.

Referenced by splitAV(), splitComplicated(), splitDual(), and splitParallel().

00023 : TTrackBase(),
00024   _innerWidth(0),
00025   _outerWidth(0),
00026   _nLayer(0),
00027   _clusterType(0),
00028   _duality(0.),
00029   _nDual(0),
00030   _angle(0.) {
00031     _fitted = false;
00032 }

TSegment0::TSegment0 ( const AList< TMLink > &   ) 

Definition at line 34 of file TSegment0.cxx.

References TTrackBase::_fitted, TTrackBase::_links, and SortByWireId().

00035 : TTrackBase(a),
00036   _innerWidth(0),
00037   _outerWidth(0),
00038   _nLayer(0),
00039   _clusterType(0),
00040   _duality(0.),
00041   _nDual(0),
00042   _angle(0.) {
00043     _links.sort(SortByWireId);
00044     _fitted = false;
00045 }

TSegment0::~TSegment0 (  )  [virtual]

Destructor.

Definition at line 47 of file TSegment0.cxx.

00047                       {
00048 }


Member Function Documentation

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(), splitAV(), TSegment::splitAV(), 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 }

int TTrackBase::approach ( TMLink  )  const [virtual, inherited]

calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.

Reimplemented in TTrack.

Definition at line 95 of file TTrackBase.cxx.

Referenced by TTrackBase::appendByApproach(), and TTrackBase::testByApproach().

00095                                    {
00096     std::cout << "TTrackBase::approach !!! not implemented" << std::endl;
00097     return -1;
00098 }

unsigned TSegment0::clusterType ( void   )  const [inline]

returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside), 4:A shape, 5:X shape, 6:parallel, 7:complicated.

Definition at line 214 of file TSegment0.h.

References _clusterType, TTrackBase::nLinks(), and updateType().

Referenced by dump(), split(), and splitAV().

00214                                  {
00215     if (! nLinks()) return 0;
00216     if (_clusterType == 0) updateType();
00217     return _clusterType;
00218 }

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(), TTrack::movePivot(), TRunge::SetFlightLength(), and TTrack::szPosition().

00317                                      {
00318     if (mask)
00319         std::cout << "TTrackBase::cores !!! mask is not supported" << std::endl;
00320     if (! _updated) update();
00321     return _cores;
00322 }

const HepVector3D & TSegment0::direction ( void   )  const [inline]

returns direction.

Definition at line 179 of file TSegment0.h.

References _direction, TTrackBase::_fitted, and update().

Referenced by TConformalFinder0::findBestLink().

00179                                {
00180     if (! _fitted) update();
00181     return _direction;
00182 }

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(), TTrack::fit2D(), and TTrackBase::testByApproach().

00089                                          {
00090     std::cout << "TTrackBase::distance !!! not implemented" << std::endl;
00091     return 0.;
00092 }

double TSegment0::distance ( const HepPoint3D ,
const HepVector3D  
) const

Definition at line 143 of file TSegment0.cxx.

References _position, and M_PI.

00143                                                                      {
00144     HepVector3D dir = _position - p;
00145     if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI);
00146     else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x());
00147 
00148     float radial = fabs(v.unit().dot(dir));
00149     float radial2 = radial * radial;
00150 
00151     return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.;
00152 }

double TSegment0::distance ( const TSegment0  )  const

calculates distance between two clusters. Smaller value indicates closer.

Definition at line 131 of file TSegment0.cxx.

References _direction, _position, M_PI, and position().

Referenced by TConformalFinder0::findBestLink(), solveDualHits(), and updateDuality().

00131                                              {
00132     HepVector3D dir = c.position() - _position;
00133     if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI);
00134     else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x());
00135 
00136     float radial = fabs(_direction.dot(dir));
00137     float radial2 = radial * radial;
00138 
00139     return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.;
00140 }

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 }

double TSegment0::duality ( void   )  const [inline]

Definition at line 222 of file TSegment0.h.

References _duality.

00222                              {
00223     return _duality;
00224 }

void TSegment0::dump ( const std::string message = std::string(""),
const std::string prefix = std::string("") 
) const [virtual]

dumps debug information.

Reimplemented from TTrackBase.

Definition at line 51 of file TSegment0.cxx.

References _angle, _direction, _duality, TTrackBase::_fitted, _innerWidth, TTrackBase::_links, _nDual, _outerWidth, _position, clusterType(), TTrackBase::dump(), RealDBUtil::npos, and update().

Referenced by TConformalFinder0::appendCluster(), TConformalFinder0::findClusterLink(), solveDualHits(), and superLayerId().

00051                                                                   {
00052     if (! _fitted) update();
00053     bool def = false;
00054     if (msg == "") def = true;
00055 
00056     if (def || msg.find("cluster") != std::string::npos || msg.find("detail") != std::string::npos) {
00057         std::cout << pre;
00058         std::cout << "#links=" << _links.length();
00059         std::cout << "(" << _innerWidth << "," << _outerWidth << ":";
00060         std::cout << clusterType() << ")," << _nDual << "," << _duality << ",";
00061         std::cout << _angle << std::endl;
00062     }
00063     if (def || msg.find("vector") != std::string::npos || msg.find("detail") != std::string::npos) {
00064         std::cout << pre;
00065         std::cout << "pos" << _position << "," << "dir" << _direction;
00066         std::cout << std::endl;
00067     }
00068     if (! def) TTrackBase::dump(msg, pre);
00069 }

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 }

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().

00357                     {
00358     return _fitter->fit(* this);
00359 }

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 }

const TMFitter *const TTrackBase::fitter ( const TMFitter  )  [inline, inherited]

sets a default fitter.

Definition at line 261 of file TTrackBase.h.

References TTrackBase::_fitted, and TTrackBase::_fitter.

00261                                      {
00262     _fitted = false;
00263     return _fitter = a;
00264 }

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::TTrack().

00255                              {
00256     return _fitter;
00257 }

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 }

AList< TSegment0 > & TSegment0::innerLinks ( void   )  [inline]

Definition at line 261 of file TSegment0.h.

References _innerLinks.

00261                           {
00262     return _innerLinks;
00263 }

unsigned TSegment0::innerMostLayer ( void   )  const [inline]

returns inner most layer.

Definition at line 200 of file TSegment0.h.

References TTrackBase::_fitted, _innerMostLayer, and update().

00200                                     {
00201     if (! _fitted) update();
00202     return _innerMostLayer;
00203 }

unsigned TSegment0::innerWidth ( void   )  const [inline]

returns inner width.

Definition at line 186 of file TSegment0.h.

References TTrackBase::_fitted, _innerWidth, and update().

00186                                 {
00187     if (! _fitted) update();
00188     return _innerWidth;
00189 }

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(), TTrack::movePivot(), TCurlFinder::plotCircle(), TCurlFinder::plotTrack(), TMSelector::preSelect(), TCurlFinder::removeStereo(), TConformalFinder::salvage(), TCurlFinder::salvage3DTrack(), TBuilder::searchLine(), TMDCTsf::segments(), TBuilderCurl::setArcZ(), TConformalFinder::slowFinding2D(), splitAV(), TSegment::splitAV(), TSegment::splitTsf(), TConformalFinder::stereoSegments(), superLayerId(), TSegment::superLayerId(), TTrack::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 }

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 TTrack::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 TTrackBase::nHeps ( void   )  const [inherited]

returns # of contributed TTrackHEP tracks.

Definition at line 443 of file TTrackBase.cxx.

References TTrackBase::_nHeps, and TTrackBase::hep().

00443                             {
00444     hep();
00445     return _nHeps;
00446 }

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(), 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(), splitComplicated(), TSegment::splitComplicated(), splitParallel(), TSegment::splitParallel(), 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 TSegment0::objectType ( void   )  const [inline, virtual]

returns type.

Reimplemented from TTrackBase.

Definition at line 228 of file TSegment0.h.

References Segment.

00228                                 {
00229     return Segment;
00230 }

TMLink * TTrackBase::operator[] ( unsigned  i  )  const [inline, inherited]

Definition at line 237 of file TTrackBase.h.

References TTrackBase::_links.

00237                                        {
00238     return _links[i];
00239 }

unsigned TSegment0::outerMostLayer ( void   )  const [inline]

returns outer most layer.

Definition at line 207 of file TSegment0.h.

References TTrackBase::_fitted, _outerMostLayer, and update().

00207                                     {
00208     if (! _fitted) update();
00209     return _outerMostLayer;
00210 }

unsigned TSegment0::outerWidth ( void   )  const [inline]

returns outer width.

Definition at line 193 of file TSegment0.h.

References TTrackBase::_fitted, _outerWidth, and update().

00193                                 {
00194     if (! _fitted) update();
00195     return _outerWidth;
00196 }

const HepPoint3D & TSegment0::position ( void   )  const [inline]

returns position.

Definition at line 172 of file TSegment0.h.

References TTrackBase::_fitted, _position, and update().

Referenced by distance(), TConformalFinder0::findClusterLink(), rangeX(), and update().

00172                               {
00173     if (! _fitted) update();
00174     return _position;
00175 }

Range TSegment0::rangeX ( double  min,
double  max 
) const

returns Range of x-coordinate of TMLinks.

Definition at line 155 of file TSegment0.cxx.

References TTrackBase::_links, genRecEmupikp::i, position(), and x.

00155                                               {
00156 #ifdef TRKRECO_DEBUG_DETAIL
00157     if (min > max) {
00158         std::cout << "TSegment0::range !!! bad arguments:min,max=";
00159         std::cout << min << "," << max << std::endl;
00160     }
00161 #endif
00162 
00163     unsigned n = _links.length();
00164     if (n == 0) return Range(0., 0.);
00165 
00166     //...Search for a center...
00167     bool found = false;
00168     double center;
00169     for (unsigned i = 0; i < n; i++) {
00170         double x = _links[i]->position().x();
00171         if (x < min || x > max) continue;
00172         center = x;
00173         found = true;
00174         break;
00175     }
00176     if (! found) return Range(0., 0.);
00177 
00178 #ifdef TRKRECO_DEBUG_DETAIL
00179 //     std::cout << "    center=" << center << std::endl;
00180 #endif
00181 
00182     double distanceR = 0.;
00183     double distanceL = 0.;
00184     double distanceMax = max - min;
00185     for (unsigned i = 0; i < n; i++) {
00186         double x = _links[i]->position().x();
00187         if (x < min || x > max) continue;
00188 
00189         double distance0, distance1;
00190         if (x > center) {
00191             distance0 = x - center;
00192             distance1 = distanceMax - distance0;
00193         }
00194         else {
00195             distance1 = center - x;
00196             distance0 = distanceMax - distance1;
00197         }
00198 
00199         if (distance0 < distance1) {
00200             if (distance0 > distanceR) distanceR = distance0;
00201         }
00202         else {
00203             if (distance1 > distanceL) distanceL = distance1;
00204         }
00205 
00206 #ifdef TRKRECO_DEBUG_DETAIL
00207 //      std::cout << "    ";
00208 //      std::cout << _links[i]->wire()->layerId() << "-";
00209 //      std::cout << _links[i]->wire()->localId() << ",";
00210 //      std::cout << _links[i]->position().x();
00211 //      std::cout << ",0,1=" << distance0 << "," << distance1;
00212 //      std::cout << ",l,r=" << distanceL << "," << distanceR;
00213 //      std::cout << std::endl;
00214 #endif
00215     }
00216 
00217     double right = center + distanceR;
00218     double left = center - distanceL;
00219 
00220     return Range(left, right);
00221 }

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 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(), 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 }

int TSegment0::solveDualHits ( void   ) 

Definition at line 624 of file TSegment0.cxx.

References _clusterType, _innerMostLayer, TTrackBase::_links, _nDual, _outerMostLayer, distance(), TMDCWireHit::drift(), dump(), genRecEmupikp::i, InOut(), SameLayer(), unit, updateType(), v, Width(), TMLink::xyPosition(), and TMDCWireHit::xyPosition().

Referenced by splitComplicated(), and splitParallel().

00624                              {
00625     updateType();
00626     if (_clusterType == 0) return 0;
00627     if (_nDual == 0) return 0;
00628 
00629     AList<TMLink> seeds;
00630     AList<TMLink> duals;
00631     for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00632         AList<TMLink> list = SameLayer(_links, i);
00633 
00634         if (list.length() == 1) {
00635             seeds.append(list[0]);
00636         }
00637         else if (list.length() == 2) {
00638             if (Width(list) > 1) {
00639                 const TMDCWireHit * h0 = list[0]->hit();
00640                 const TMDCWireHit * h1 = list[1]->hit();
00641                 double distance = (h0->xyPosition() - h1->xyPosition()).mag();
00642                 distance = fabs(distance - h0->drift() - h1->drift());
00643                 if (distance > 0.5) duals.append(list);
00644 #ifdef TRKRECO_DEBUG_DETAIL
00645 //              h0->dump();
00646 //              h1->dump();
00647 //              std::cout << "duality distance = " << distance << std::endl;
00648 //              std::cout << "i = " << i << std::endl;
00649 #endif
00650             }
00651         }
00652         else if (list.length() == 0) {
00653             continue;
00654         }
00655 #ifdef TRKRECO_DEBUG_DETAIL
00656         else {
00657             std::cout << "TSegment0::solveDualHits !!! this is not expected 2";
00658             std::cout << std::endl;
00659             this->dump("cluster hits mc", "    ");
00660         }
00661 #endif
00662     }
00663 
00664     //...Solve them...
00665     if (seeds.length() < 2) return -1;
00666     AList<TMLink> outers = InOut(seeds);
00667     const HepPoint3D & p = outers[0]->xyPosition();
00668     HepVector3D v = (outers[1]->xyPosition() - p).unit();
00669     unsigned n = duals.length() / 2;
00670     for (unsigned i = 0; i < n; i++) {
00671         TMLink * t0 = duals[i * 2 + 0];
00672         TMLink * t1 = duals[i * 2 + 1];
00673         HepVector3D x0 = t0->xyPosition() - p;
00674         HepVector3D x1 = t1->xyPosition() - p;
00675         double d0 = (x0 - (x0.dot(v) * v)).mag();
00676         double d1 = (x1 - (x1.dot(v) * v)).mag();
00677         if (d0 < d1) _links.remove(t1);
00678         else         _links.remove(t0);
00679     }
00680     return n;
00681 }

AList< TSegment0 > TSegment0::split ( void   )  const

returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned.

Definition at line 281 of file TSegment0.cxx.

References _duality, _nDual, clusterType(), splitAV(), splitComplicated(), splitDual(), splitParallel(), and t().

Referenced by splitComplicated(), and splitParallel().

00281                            {
00282     AList<TSegment0> list;
00283 
00284     //...Do not split if cluster type is 1, 2, or 7...
00285     unsigned t = clusterType();
00286 #ifdef TRKRECO_DEBUG_DETAIL
00287     std::cout << "    ... splitting : type=" << t << std::endl;
00288 #endif 
00289     if (t == 0) return list;
00290     else if (t == 2) {
00291         // beta 5 if (_nDual > 2 && _duality > 0.7 && _angle > 0.7)
00292         //          return splitDual();
00293         if (_nDual > 2 && _duality > 0.7) return splitDual();
00294         return list;
00295     }
00296     else if (t == 1) return list;
00297     else if (t == 7) return list;
00298 
00299     //...Parallel...
00300     else if (t == 6) return splitParallel();
00301 
00302     //...Avoid splitting of X or parallel...(future implementation)...
00303     else if (t > 4) return splitComplicated();
00304 
00305     //...A or V...
00306     return splitAV();
00307 }

AList< TSegment0 > TSegment0::splitAV ( void   )  const [private]

Definition at line 310 of file TSegment0.cxx.

References _inners, TTrackBase::_links, _outers, TTrackBase::append(), clusterType(), check_raw_filter::dist, Edges(), genRecEmupikp::i, ganga-rec::j, TTrackBase::links(), t(), TSegment0(), unit, and v.

Referenced by split().

00310                              {
00311     unsigned t = clusterType();
00312     AList<TMLink> seeds[2];
00313 
00314     //...Calculate corner of V or A...
00315     const AList<TMLink> * corners;
00316     if (t == 3) corners = & _outers;
00317     else        corners = & _inners;
00318     HepPoint3D corner;
00319     for (unsigned i = 0; i < corners->length(); i++)
00320         corner += (* corners)[i]->wire()->xyPosition();
00321     corner *= 1. / (float) corners->length();
00322     seeds[0].append(* corners);
00323     seeds[1].append(* corners);
00324 
00325     //...Calculdate edges...
00326     const AList<TMLink> * links;
00327     if (t == 3) links = & _inners;
00328     else        links = & _outers;
00329     AList<TMLink> edge = Edges(* links);
00330     HepPoint3D edgePos[2];
00331     HepVector3D v[2];
00332     for (unsigned i = 0; i < 2; i++) {
00333         edgePos[i] = edge[i]->wire()->xyPosition();
00334         v[i] = (edgePos[i] - corner).unit();
00335     }
00336     seeds[0].append(edge[0]);
00337     seeds[1].append(edge[1]);
00338 
00339 #ifdef TRKRECO_DEBUG_DETAIL
00340     std::cout << "    corner:" << corner << std::endl;
00341     std::cout << "    edge:" << edgePos[0] << "(";
00342     std::cout << edge[0]->wire()->layerId() << "-";
00343     std::cout << edge[0]->wire()->localId() << ")";
00344     std::cout << v[0] << std::endl;
00345     std::cout << "         ";
00346     std::cout << edgePos[1] << "(";
00347     std::cout << edge[1]->wire()->layerId() << "-";
00348     std::cout << edge[1]->wire()->localId() << ")";
00349     std::cout << v[1] << std::endl;
00350 #endif
00351 
00352     //...Examine each hits...
00353     unsigned n = _links.length();
00354     for (unsigned i = 0; i < n; i++) {
00355         TMLink * l = _links[i];
00356         if (edge.member(l)) continue;
00357         if (corners->member(l)) continue;
00358 
00359         HepVector3D p = l->wire()->xyPosition() - corner;
00360         double p2 = p.mag2();
00361 
00362         double dist[2];
00363         for (unsigned j = 0; j < 2; j++) {
00364             dist[j] = v[j].dot(p);
00365             double d2 = dist[j] * dist[j];
00366             dist[j] = (p2 - d2) > 0. ? sqrt(p2 - d2) : 0.;
00367         }
00368         if (dist[0] < dist[1]) seeds[0].append(l);
00369         else                   seeds[1].append(l);
00370 
00371 #ifdef TRKRECO_DEBUG_DETAIL
00372         std::cout << "        p:" << p << std::endl;
00373         std::cout << "    " << l->wire()->layerId() << "-";
00374         std::cout << l->wire()->localId() << ":" << dist[0];
00375         std::cout << "," << dist[1] << std::endl;
00376 #endif
00377     }
00378 
00379     AList<TSegment0> list;
00380     for (unsigned i = 0; i < 2; i++) {
00381         if (seeds[i].length()) {
00382             TSegment0 * nc = new TSegment0(seeds[i]);
00383             AList<TSegment0> ncx = nc->split();
00384             if (ncx.length() == 0) {
00385                 nc->solveDualHits();
00386                 list.append(nc);
00387             }
00388             else {
00389                 list.append(ncx);
00390                 delete nc;
00391             }
00392         }
00393     }
00394     return list;
00395 }

AList< TSegment0 > TSegment0::splitComplicated ( void   )  const [private]

Definition at line 398 of file TSegment0.cxx.

References TTrackBase::_links, abs, genRecEmupikp::i, TMDCWire::localId(), TMDCWire::name(), TTrackBase::nLinks(), TTrackBase::remove(), solveDualHits(), SortByWireId(), split(), t(), TSegment0(), w, WireHitContinuous, WireHitIsolated, WireHitPatternLeft, and WireHitPatternRight.

Referenced by split().

00398                                       {
00399 
00400     //...Select best hits...
00401     AList<TSegment0> newClusters;
00402     AList<TMLink> goodHits;
00403     unsigned n = _links.length();
00404     for (unsigned i = 0; i < n; i++) {
00405         const TMDCWireHit * h = _links[i]->hit();
00406         unsigned state = h->state();
00407         if (! (state & WireHitContinuous)) continue;
00408         if (! (state & WireHitIsolated)) continue;
00409         if ((! (state & WireHitPatternLeft)) &&
00410             (! (state & WireHitPatternRight))) continue;
00411         goodHits.append(_links[i]);
00412     }
00413     if (goodHits.length() == 0) return newClusters;
00414 
00415     //...Main loop...
00416     goodHits.sort(SortByWireId);
00417     AList<TMLink> original(_links);
00418     while (goodHits.length()) {
00419 
00420         //...Select an edge hit...
00421         TMLink * seed = goodHits.last();
00422         const TMDCWire * wire = seed->wire();
00423         unsigned localId = wire->localId();
00424         AList<TMLink> used;
00425         unsigned nn = _links.length();
00426         for (unsigned i = 0; i < nn; i++) {
00427             TMLink * t = _links[i];
00428             const TMDCWire * w = t->wire();
00429 
00430             //...Straight?...
00431             if (abs((int) w->localId() - (int) localId) < 2) used.append(t);
00432         }
00433 
00434 #ifdef TRKRECO_DEBUG_DETAIL
00435         std::cout << "        seed is " << seed->wire()->name() << std::endl;
00436         std::cout << "            ";
00437         for (unsigned i = 0; i < used.length(); i++) {
00438             std::cout << used[i]->wire()->name() << ",";
00439         }
00440         std::cout << std::endl;
00441 #endif
00442 
00443         //...Create new cluster...
00444         if (used.length() == 0) continue;
00445         if (used.length() == nLinks()) return newClusters;
00446         TSegment0 * c = new TSegment0(used);
00447         AList<TSegment0> cx = c->split();
00448         if (cx.length() == 0) {
00449             c->solveDualHits();
00450             newClusters.append(c);
00451         }
00452         else {
00453             newClusters.append(cx);
00454             delete c;
00455         }
00456         goodHits.remove(used);
00457         original.remove(used);
00458     }
00459 
00460     //...Remainings...
00461     if ((original.length()) && (original.length() < nLinks())) {
00462         TSegment0 * c = new TSegment0(original);
00463         AList<TSegment0> cx = c->split();
00464         if (cx.length() == 0) {
00465             c->solveDualHits();
00466             newClusters.append(c);
00467         }
00468         else {
00469             newClusters.append(cx);
00470             delete c;
00471         }
00472     }
00473 
00474     return newClusters;
00475 }

AList< TSegment0 > TSegment0::splitDual ( void   )  const [private]

Definition at line 574 of file TSegment0.cxx.

References _innerMostLayer, TTrackBase::_links, _outerMostLayer, genRecEmupikp::i, SameLayer(), t(), TSegment0(), unit, and Width().

Referenced by split().

00574                                {
00575 #ifdef TRKRECO_DEBUG_DETAIL
00576     std::cout << "    TSegment0::splitDual called" << std::endl;
00577 #endif
00578     AList<TMLink> seeds[2];
00579     AList<TMLink> unknown;
00580     for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00581         AList<TMLink> list = SameLayer(_links, i);
00582 
00583         if (list.length() == 2) {
00584             if (Width(list) == 2) {
00585                 seeds[0].append(list[0]);
00586                 seeds[1].append(list[1]);
00587                 continue;
00588             }
00589         }
00590         unknown.append(list);
00591     }
00592 
00593     if (unknown.length() > 0) {
00594 #ifdef TRKRECO_DEBUG_DETAIL
00595         if (seeds[0].length() == 0)
00596             std::cout << "TSegment0::splitDual !!! no TMLink for seed 0" << std::endl;
00597         if (seeds[1].length() == 0)
00598             std::cout << "TSegment0::splitDual !!! no TMLink for seed 1" << std::endl;
00599 #endif  
00600         const HepPoint3D & p0 = seeds[0][0]->xyPosition();
00601         const HepPoint3D & p1 = seeds[1][0]->xyPosition();
00602         HepVector3D v0 = (seeds[0].last()->xyPosition() - p0).unit();
00603         HepVector3D v1 = (seeds[1].last()->xyPosition() - p1).unit();
00604 
00605         for (unsigned i = 0; i < unknown.length(); i++) {
00606             TMLink * t = unknown[i];
00607             HepVector3D x0 = t->xyPosition() - p0;
00608             double d0 = (x0 - (x0.dot(v0) * v0)).mag();
00609             HepVector3D x1 = t->xyPosition() - p1;
00610             double d1 = (x1 - (x1.dot(v0) * v0)).mag();
00611 
00612             if (d0 < d1) seeds[0].append(t);
00613             else         seeds[1].append(t);
00614         }
00615     }
00616 
00617     AList<TSegment0> newClusters;
00618     newClusters.append(new TSegment0(seeds[0]));
00619     newClusters.append(new TSegment0(seeds[1]));
00620     return newClusters;
00621 }

AList< TSegment0 > TSegment0::splitParallel ( void   )  const [private]

Definition at line 478 of file TSegment0.cxx.

References _innerMostLayer, TTrackBase::_links, _outerMostLayer, abs, TTrackBase::append(), Edges(), genRecEmupikp::i, TMDCWire::localIdDifference(), TTrackBase::nLinks(), SameLayer(), solveDualHits(), split(), t(), and TSegment0().

Referenced by split().

00478                                    {
00479     AList<TMLink> seeds[2];
00480     AList<TSegment0> newClusters;
00481     for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00482         AList<TMLink> list = SameLayer(_links, i);
00483         AList<TMLink> outerList = Edges(list);
00484 
00485 #ifdef TRKRECO_DEBUG_DETAIL
00486         if (outerList.length() != 2) {
00487             std::cout << "TSegment0::splitParallel !!! ";
00488             std::cout << "This is not a parallel cluster" << std::endl;
00489         }
00490 #endif
00491 
00492         seeds[0].append(outerList[0]);
00493         seeds[1].append(outerList[1]);
00494         if (list.length() == 2) continue;
00495 
00496         const TMDCWire & wire0 = * outerList[0]->wire();
00497         const TMDCWire & wire1 = * outerList[1]->wire();
00498         for (unsigned k = 0; k < list.length(); k++) {
00499             TMLink * t = list[k];
00500             if (t == outerList[0]) continue;
00501             if (t == outerList[1]) continue;
00502 
00503             if (abs(wire0.localIdDifference(* t->wire())) <
00504                 abs(wire1.localIdDifference(* t->wire())))
00505                 seeds[0].append(t);
00506             else
00507                 seeds[1].append(t);
00508         }
00509     }
00510     
00511     if ((seeds[0].length()) && (seeds[0].length() < nLinks())) {
00512         TSegment0 * c0 = new TSegment0(seeds[0]);
00513         AList<TSegment0> c0x = c0->split();
00514         if (c0x.length()) {
00515             newClusters.append(c0x);
00516             delete c0;
00517         }
00518         else {
00519             c0->solveDualHits();
00520             newClusters.append(c0);
00521         }
00522     }
00523 
00524     if ((seeds[1].length()) && (seeds[1].length() < nLinks())) {
00525         TSegment0 * c1 = new TSegment0(seeds[1]);
00526         AList<TSegment0> c1x = c1->split();
00527         if (c1x.length()) {
00528             newClusters.append(c1x);
00529             delete c1;
00530         }
00531         else {
00532             c1->solveDualHits();
00533             newClusters.append(c1);
00534         }
00535     }
00536 
00537     return newClusters;
00538 }

unsigned TSegment0::superLayerId (  )  const [inline]

returns super layer id.

Definition at line 234 of file TSegment0.h.

References dump(), genRecEmupikp::i, and TTrackBase::links().

00234                                   {
00235     unsigned id = (links())[0]->wire()->superLayerId();
00236 #ifdef TRKRECO_DEBUG
00237     {
00238         const AList<TMLink> & list = links();
00239         unsigned n = list.length();
00240         for (unsigned i = 1; i < n; i++) {
00241             if (list[i]->hit()->wire()->superLayerId() != id) {
00242                 std::cout << "TSegment0::superLayerId !!! strange segment found";
00243                 std::cout << std::endl;
00244                 dump();
00245                 break;
00246             }
00247         }
00248     }
00249 #endif
00250     return id;
00251 }

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 }

AList< TTrack > & TSegment0::tracks ( void   )  [inline]

Definition at line 255 of file TSegment0.h.

References _tracks.

00255                       {
00256     return _tracks;
00257 }

unsigned TTrackBase::type ( void   )  const [inline, virtual, inherited]

returns type. Definition is depending on an object class.

Reimplemented in TTrack.

Definition at line 274 of file TTrackBase.h.

00274                            {
00275     return 0;
00276 }

void TSegment0::update ( void   )  const [private]

updates cache.

Reimplemented from TTrackBase.

Definition at line 72 of file TSegment0.cxx.

References _clusterType, _direction, TTrackBase::_fitted, _innerMostLayer, _inners, _innerWidth, TTrackBase::_links, _nLayer, _outerMostLayer, _outers, _outerWidth, _position, genRecEmupikp::i, M_PI, ORIGIN, position(), unit, and Width().

Referenced by direction(), dump(), innerMostLayer(), innerWidth(), outerMostLayer(), outerWidth(), position(), and updateType().

00072                             {
00073     _clusterType = 0;
00074     _position = ORIGIN;
00075     _direction = ORIGIN;
00076     _inners.removeAll();
00077     _outers.removeAll();
00078 
00079     if (_links.length() == 0) return;
00080 
00081     _innerMostLayer = _links[0]->wire()->layerId();
00082     _outerMostLayer = _innerMostLayer;
00083     for (unsigned i = 1; i < _links.length(); i++) {
00084         unsigned id = _links[i]->wire()->layerId();
00085         if (id < _innerMostLayer) _innerMostLayer = id;
00086         else if (id > _outerMostLayer) _outerMostLayer = id;
00087     }
00088     _nLayer = _outerMostLayer - _innerMostLayer + 1;
00089 
00090     double centerX = _links[0]->position().x();
00091     HepPoint3D inner = ORIGIN;
00092     HepPoint3D outer = ORIGIN;
00093     unsigned nInner = 0;
00094     unsigned nOuter = 0;
00095     for (unsigned i = 0; i < _links.length(); i++) {
00096         HepPoint3D tmp = _links[i]->position();
00097         double diff = tmp.x() - centerX;
00098         if (diff > M_PI) {
00099             tmp.setX(centerX - 2. * M_PI + diff);
00100         }
00101         else if (diff < - M_PI) {
00102             tmp.setX(centerX + 2. * M_PI + diff);
00103         }
00104 
00105         _links[i]->conf(tmp);
00106         _position += tmp;
00107         unsigned id = _links[i]->wire()->layerId();
00108         if (id == _innerMostLayer) {
00109             inner += tmp;
00110             ++nInner;
00111             _inners.append(_links[i]);
00112         }
00113         if (id == _outerMostLayer) {
00114             outer += tmp;
00115             ++nOuter;
00116             _outers.append(_links[i]);
00117         }
00118     }
00119     _innerWidth = Width(_inners);
00120     _outerWidth = Width(_outers);
00121     _position *= (1. / (float) _links.length());
00122 
00123     inner *= (1. / (float) nInner);
00124     outer *= (1. / (float) nOuter);
00125     _direction = (inner - outer).unit();
00126 
00127     _fitted = true;
00128 }

void TSegment0::updateDuality ( void   )  const [private]

updates duality.

Definition at line 541 of file TSegment0.cxx.

References _angle, _duality, _innerMostLayer, TTrackBase::_links, _nDual, _outerMostLayer, distance(), TMDCWireHit::drift(), genRecEmupikp::i, ganga-rec::j, SameLayer(), unit, Width(), x, and TMDCWireHit::xyPosition().

Referenced by updateType().

00541                                    {
00542     _duality = 0.;
00543     _nDual = 0;
00544     HepPoint3D x[2];
00545     for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00546         AList<TMLink> list = SameLayer(_links, i);
00547         if (i == _innerMostLayer) {
00548             for (unsigned j = 0; j < list.length(); j++)
00549                 x[0] += list[j]->hit()->xyPosition();
00550             x[0] *= 1. / double(list.length());
00551         }
00552         else if (i == _outerMostLayer) {
00553             for (unsigned j = 0; j < list.length(); j++)
00554                 x[1] += list[j]->hit()->xyPosition();
00555             x[1] *= 1. / double(list.length());
00556         }
00557 
00558         if (list.length() == 2) {
00559             if (Width(list) != 2) continue;
00560             const TMDCWireHit * h0 = list[0]->hit();
00561             const TMDCWireHit * h1 = list[1]->hit();
00562 
00563             double distance = (h0->xyPosition() - h1->xyPosition()).mag();
00564             distance = fabs(distance - h0->drift() - h1->drift());
00565             _duality += distance;
00566             ++_nDual;
00567         }
00568     }
00569     if (_nDual > 0) _duality /= float(_nDual);
00570     _angle = (x[1] - x[0]).unit().dot(x[0].unit());
00571 }

void TSegment0::updateType ( void   )  const [private]

updates type.

Definition at line 224 of file TSegment0.cxx.

References _clusterType, TTrackBase::_fitted, _innerMostLayer, _innerWidth, TTrackBase::_links, _nLayer, _outerMostLayer, _outerWidth, genRecEmupikp::i, ganga-rec::j, TTrackBase::nLinks(), update(), updateDuality(), and Width().

Referenced by clusterType(), and solveDualHits().

00224                                 {
00225     if (! nLinks()) return;
00226     if (! _fitted) update();
00227 
00228     //...Parameter...
00229     unsigned fat = 3;
00230     unsigned tall = 3;
00231 
00232     //...Calculate
00233     updateDuality();
00234 
00235     //...Long or short...
00236     if ((_innerWidth < fat) && (_outerWidth < fat)) {
00237         _clusterType = 1;
00238 
00239         //...Check length across a super layer...
00240         if (_nLayer > tall) _clusterType = 2;
00241         return;
00242     }
00243 
00244     //...A...
00245     else if (_outerWidth < fat) {
00246         _clusterType = 3;
00247         return;
00248     }
00249 
00250     //...V...
00251     else if (_innerWidth < fat) {
00252         _clusterType = 4;
00253         return;
00254     }
00255 
00256     //...X or parallel...
00257     else {
00258         bool space = true;
00259         for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00260             unsigned n = 0;
00261             AList<TMLink> tmp;
00262             for (unsigned j = 0; j < _links.length(); j++)
00263                 if (_links[j]->wire()->layerId() == i) {
00264                     ++n;
00265                     tmp.append(_links[j]);
00266                 }
00267 
00268             if (n == Width(tmp)) {
00269                 space = false;
00270                 break;
00271             }
00272         }
00273 
00274         _clusterType = 5;
00275         if (space) _clusterType = 6;
00276         return;
00277     }
00278 }


Member Data Documentation

double TSegment0::_angle [mutable, private]

Definition at line 136 of file TSegment0.h.

Referenced by dump(), and updateDuality().

unsigned TSegment0::_clusterType [mutable, private]

Definition at line 133 of file TSegment0.h.

Referenced by clusterType(), solveDualHits(), update(), and updateType().

HepVector3D TSegment0::_direction [mutable, private]

Definition at line 125 of file TSegment0.h.

Referenced by direction(), distance(), dump(), and update().

double TSegment0::_duality [mutable, private]

Definition at line 134 of file TSegment0.h.

Referenced by duality(), dump(), split(), and updateDuality().

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(), TTrack::chi2(), TMLine::chi2(), TLine0::chi2(), direction(), TSegment::direction(), TMLine::distance(), TLine0::distance(), TTrackBase::DropWorst(), 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(), innerMostLayer(), TSegment::innerMostLayer(), TSegment::inners(), innerWidth(), TSegment::innerWidth(), TTrack::ndf(), outerMostLayer(), TSegment::outerMostLayer(), TSegment::outers(), outerWidth(), TSegment::outerWidth(), position(), TSegment::position(), TCircle::pt(), TCircle::radius(), TMLine::reducedChi2(), TLine0::reducedChi2(), TTrackBase::refine(), TMLine::refine(), TLine0::refine(), TTrack::refine2D(), TTrackBase::remove(), TMLine::removeChits(), TLine0::removeChits(), TMLine::removeSLY(), TLine0::removeSLY(), T3DLine::T3DLine(), TRunge::TRunge(), TSegment::TSegment(), TSegment0(), TTrack::TTrack(), update(), TSegment::update(), 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::TTrack().

AList<TSegment0> TSegment0::_innerLinks [private]

Definition at line 121 of file TSegment0.h.

Referenced by innerLinks().

unsigned TSegment0::_innerMostLayer [mutable, private]

Definition at line 128 of file TSegment0.h.

Referenced by innerMostLayer(), solveDualHits(), splitDual(), splitParallel(), update(), updateDuality(), and updateType().

AList<TMLink> TSegment0::_inners [mutable, private]

Definition at line 130 of file TSegment0.h.

Referenced by splitAV(), and update().

unsigned TSegment0::_innerWidth [mutable, private]

Definition at line 126 of file TSegment0.h.

Referenced by dump(), innerWidth(), update(), and updateType().

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(), TTrack::assign(), TBuilderCurl::buildStereo(), TMLine::chi2(), TLine0::chi2(), TTrackBase::DropWorst(), TTrackBase::dump(), TTrack::dump(), dump(), TSegment::dump(), TMLine::dump(), TLine0::dump(), TCircle::dump(), TSegment::expandSeg(), TMLine::fit2(), TLine0::fit2(), TTrack::fit2D(), TMLine::fit2p(), TLine0::fit2p(), TMLine::fit2s(), TLine0::fit2s(), TMLine::fit2sp(), TLine0::fit2sp(), TCircle::fitForCurl(), TTrackBase::hep(), TTrackBase::links(), TTrack::movePivot(), TTrackBase::nLinks(), TTrackBase::operator[](), rangeX(), TSegment::rangeX(), TMLine::reducedChi2(), TLine0::reducedChi2(), TTrackBase::refine(), TMLine::refine(), TLine0::refine(), TTrack::refine2D(), TTrackBase::refineMain(), TTrackBase::remove(), TMLine::removeChits(), TLine0::removeChits(), TTrackBase::removeLinks(), TMLine::removeSLY(), TLine0::removeSLY(), TSegment::segSalvage(), solveDualHits(), TSegment::solveDualHits(), TSegment::solveLR(), TSegment::solveThreeHits(), splitAV(), TSegment::splitAV(), splitComplicated(), TSegment::splitComplicated(), splitDual(), TSegment::splitDual(), splitParallel(), TSegment::splitParallel(), TSegment::splitTsf(), TSegment::TSegment(), TSegment0(), TTrack::TTrack(), TTrackBase::update(), update(), TSegment::update(), updateDuality(), TSegment::updateDuality(), updateType(), and TSegment::updateType().

TTrackMC* TTrackBase::_mc [protected, inherited]

Definition at line 165 of file TTrackBase.h.

Referenced by TTrackBase::mc().

unsigned TSegment0::_nDual [mutable, private]

Definition at line 135 of file TSegment0.h.

Referenced by dump(), solveDualHits(), split(), and updateDuality().

unsigned TSegment0::_nLayer [mutable, private]

Definition at line 132 of file TSegment0.h.

Referenced by update(), and updateType().

unsigned TSegment0::_outerMostLayer [mutable, private]

Definition at line 129 of file TSegment0.h.

Referenced by outerMostLayer(), solveDualHits(), splitDual(), splitParallel(), update(), updateDuality(), and updateType().

AList<TMLink> TSegment0::_outers [mutable, private]

Definition at line 131 of file TSegment0.h.

Referenced by splitAV(), and update().

unsigned TSegment0::_outerWidth [mutable, private]

Definition at line 127 of file TSegment0.h.

Referenced by dump(), outerWidth(), update(), and updateType().

HepPoint3D TSegment0::_position [mutable, private]

Definition at line 124 of file TSegment0.h.

Referenced by distance(), dump(), position(), and update().

AList<TTrack> TSegment0::_tracks [private]

Definition at line 120 of file TSegment0.h.

Referenced by tracks().


Generated on Tue Nov 29 23:36:17 2016 for BOSS_7.0.2 by  doxygen 1.4.7