TSegment Class Reference

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

#include <TSegment.h>

Inheritance diagram for TSegment:

TTrackBase List of all members.

Public Member Functions

 TSegment ()
 Constructor.
 TSegment (const AList< TMLink > &)
virtual ~TSegment ()
 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 HepPoint3DouterPosition (void) const
const HepPoint3DlineTsf (void) const
 return line of Tsf for pos and dir
const HepPoint3DlineTsf (const HepPoint3D &)
const HepVector3Ddirection (void) const
 returns direction.
double distance (const TSegment &) 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.
const AList< TMLink > & inners (void) const
 returns TMLinks in inner/outer-most layer.
const AList< TMLink > & outers (void) const
const TMLinkcenter (void) const
 returns a TMLink which is the closest to the center.
unsigned width (void) const
 returns width.
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< TSegmentsplit (void) const
 returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned.
AList< TSegmentsplitTsf (AList< TMLink > &)
int solveDualHits (void)
double duality (void) const
void solveLR (void)
 solve LR of hit in TSF.
void solveThreeHits (void)
AList< TTrack > & tracks (void)
AList< TSegment > & innerLinks (void)
const AList< TSegment > & innerLinks (void) const
AList< TSegment > & outerLinks (void)
const AList< TSegment > & outerLinks (void) const
unsigned state (void) const
unsigned state (unsigned)
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< TSegmentsplitAV (void) const
AList< TSegmentsplitParallel (void) const
AList< TSegmentsplitComplicated (void) const
AList< TSegmentsplitDual (void) const
void update (void) const
 updates cache.
void updateType (void) const
 updates type.
void updateDuality (void) const
 updates duality.
void fitLine (TMLink *seed, TMLink *outer, HepPoint3D line[4]) const
AList< TSegmentappendByLine (TMLink *seed, TMLink *outer, AList< TMLink > &seedNeighbors, AList< TMLink > &restHits, const HepPoint3D line[4])
double distance2 (TMLink *, HepPoint3D) const
double maxdDistance (TMLink *) const
HepPoint3D leastSquaresFitting1 (const AList< TMLink > &links, const HepPoint3D tsfLine) const
HepPoint3D leastSquaresFitting (const AList< TMLink > &links, const HepPoint3D tsfLine) const
HepPoint3D positionTsf (const AList< TMLink > &links, const HepPoint3D line) const
void segSalvage (AList< TMLink > &)
void expandSeg (const int, AList< TMLink > &)
HepPoint3D closestPoint (const HepPoint3D &p, const HepPoint3D line) const

Private Attributes

AList< TTrack_tracks
AList< TSegment_innerLinks
AList< TSegment_outerLinks
unsigned _state
HepPoint3D _position
HepPoint3D _outerPosition
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
double _times [11]
HepPoint3D _lineTsf
AList< TMLink_usedHitsOfSecond

Static Private Attributes

static TMDC_cdc = 0

Detailed Description

A class to relate TMDCWireHit and TTrack objects.

Definition at line 43 of file TSegment.h.


Constructor & Destructor Documentation

TSegment::TSegment (  ) 

Constructor.

Definition at line 30 of file TSegment.cxx.

References TTrackBase::_fitted, and _times.

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

00031 : TTrackBase(),
00032   _innerWidth(0),
00033   _outerWidth(0),
00034   _nLayer(0),
00035   _clusterType(0),
00036   _duality(0.),
00037   _nDual(0),
00038   _angle(0.),
00039   _state(0),
00040   _lineTsf(0.,0.,0.) {
00041 //    _times = 4.0;
00042 //    if (_links[0]->wire()->stereo()) _times = 7.0;
00043     _times[0] = 7;
00044     _times[1] = 7;
00045     _times[2] = 4;
00046     _times[3] = 4;
00047     _times[4] = 4;
00048     _times[5] = 5;
00049     _times[6] = 5;
00050     _times[7] = 5;
00051     _times[8] = 5;
00052     _times[9] = 4;
00053     _times[10] = 4;
00054     _fitted = false;
00055 }

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

Definition at line 57 of file TSegment.cxx.

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

00058 : TTrackBase(a),
00059   _innerWidth(0),
00060   _outerWidth(0),
00061   _nLayer(0),
00062   _clusterType(0),
00063   _duality(0.),
00064   _nDual(0),
00065   _angle(0.),
00066   _state(0),
00067   _lineTsf(0.,0.,0.) {
00068     _links.sort(SortByWireId);
00069 //    _times = 4.0;
00070 //    if (_links[0]->wire()->stereo()) _times = 7.0;
00071     _times[0] = 7;
00072     _times[1] = 7;
00073     _times[2] = 4;
00074     _times[3] = 4;
00075     _times[4] = 4;
00076     _times[5] = 5;
00077     _times[6] = 5;
00078     _times[7] = 5;
00079     _times[8] = 5;
00080     _times[9] = 4;
00081     _times[10] = 4;
00082     _fitted = false;
00083 }  //the above two innitial function are temporary for tsf!!!

TSegment::~TSegment (  )  [virtual]

Destructor.

Definition at line 112 of file TSegment.cxx.

00112                     {
00113 }


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

AList< TSegment > TSegment::appendByLine ( TMLink seed,
TMLink outer,
AList< TMLink > &  seedNeighbors,
AList< TMLink > &  restHits,
const HepPoint3D  line[4] 
) [private]

Definition at line 1244 of file TSegment.cxx.

References _times, distance2(), genRecEmupikp::i, TMDCWire::id(), ganga-rec::j, lineTsf(), maxdDistance(), delete_small_size::size, TMDCWire::superLayerId(), TSegment(), update(), and TMLink::wire().

Referenced by splitTsf().

01244                                                                                                                                        {
01245     AList<TSegment> list;
01246     list.removeAll();
01247 
01248     const unsigned slId = seed->wire()->superLayerId();
01249 
01250 //cout<<"seed: lId:"<<seed->wire()->layerId()<<" loId:"<<seed->wire()->localId()<<endl;
01251 //cout<<"outer: lId:"<<outer->wire()->layerId()<<" loId:"<<outer->wire()->localId()<<endl;
01252     for (int i = 0; i < 4; ++i) {
01253         AList<TMLink> seeds;
01254         for (int j = 0, size = restHits.length(); j < size; ++j) {
01255             TMLink * l = restHits[j];
01256             if (l->wire()->id() == outer->wire()->id()) continue;
01257 //cout<<"restHits: lId:"<<l->wire()->layerId()<<" loId:"<<l->wire()->localId()<<endl;
01258             double maxdis = maxdDistance(l) * _times[slId];
01259             double dis = distance2(l, line[i]);
01260 //cout<<"maxdis: "<<maxdis<<"  dis: "<<dis<<endl;
01261             if(seeds.hasMember(l)) continue;
01262             if (fabs(dis - l->cDrift()) < maxdis) seeds.append(l);
01263             else continue;
01264         }
01265         seeds.append(seed);
01266         seeds.append(outer);
01267         unsigned nHitsLayer[4] = {0, 0, 0, 0};
01268         unsigned nLayers = 0;
01269         //check...at least 3 layers.
01270         for (int j = 0; j < seeds.length(); ++j)
01271             ++nHitsLayer[seeds[j]->wire()->localLayerId()];
01272         for (int j = 0; j < 4; ++j)
01273             if (nHitsLayer[j] > 0) ++nLayers;
01274         if (nLayers < 3) continue;
01275 
01276         //check the neighbor hits in the first locallayer.
01277         for (int k = 0; k < seedNeighbors.length(); ++k) {
01278             TMLink * l =seedNeighbors[k];
01279 //cout<<"seedNeighbors: lId:"<<l->wire()->layerId()<<" loId:"<<l->wire()->localId()<<endl;
01280             double maxdis = maxdDistance(l) * _times[slId];
01281             double dis = distance2(l, line[i]);
01282 //cout<<"maxdis: "<<maxdis<<"  dis: "<<dis<<endl;
01283             if(seeds.hasMember(l)) continue;
01284             if (fabs(dis - l->cDrift()) < maxdis) seeds.append(l);
01285             else continue;
01286         }
01287 
01288         //update tag of each link.
01289         for (int k = 0; k < seeds.length(); ++k) {
01290             unsigned a = seeds[k]->tsfTag();
01291             ++a;
01292             seeds[k]->tsfTag(a);
01293         }
01294 
01295         //creat segment and update.
01296         TSegment * seg = new TSegment(seeds);
01297         seg->lineTsf(line[i]);
01298         seg->update();
01299 
01300         list.append(seg);
01301     }
01302 
01303     //salvage in new line...after update
01304 //    AList<TMLink> all;
01305 //    all.removeAll();
01306 //    all.append(restHits);
01307 //    all.append(seedNeighbors);
01308 //    for (int j = 0; j < list.length(); ++j) 
01309 //      list[j]->segSalvage(all);
01310 
01311     //expand 3layers segment
01312 /*    unsigned sl = seed->wire()->superLayerId();
01313     if(sl != 10) {
01314         for( int i = 0; i < list.length(); ++i) {
01315             AList<TMLink> segLinks = list[i]->links();
01316             unsigned nHits[4] = {0,0,0,0};
01317             int emptyLayer = -1;
01318             for(int j = 0; j < segLinks.length(); ++j)
01319                 ++nHits[segLinks[j]->wire()->localLayerId()];
01320             for (int j = 0; j < 4; ++j) {
01321                 if(nHits[j] == 0) emptyLayer = j;
01322                 if (emptyLayer != -1) break;
01323             }
01324             if(emptyLayer == -1) continue;
01325 
01326             for(int j = 0; j < all.length(); ++j){
01327                 TMLink *l = all[j];
01328                 if (l->wire()->localLayerId() == emptyLayer){
01329                     double maxdis = maxdDistance(l) * _times;
01330                     double dis = distance2(l, list[i]->lineTsf());
01331                 cout<<"layer:  "<<l->wire()->layerId()<<"  local: "<<l->wire()->localId()<<endl;
01332                 cout<<"maxdis: "<<maxdis<<"  dis in empty layer: "<<dis<<endl;
01333                 }
01334             }
01335 
01336 //          list[i]->expandSeg(emptyLayer, all);
01337         }
01338     }
01339 */
01340     return list;
01341 }

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 }

const TMLink& TSegment::center ( void   )  const

returns a TMLink which is the closest to the center.

Referenced by rangeX(), and solveLR().

HepPoint3D TSegment::closestPoint ( const HepPoint3D p,
const HepPoint3D  line 
) const [private]

Definition at line 1643 of file TSegment.cxx.

Referenced by leastSquaresFitting1(), positionTsf(), and solveLR().

01643                                                                         {
01644     HepPoint3D Dir(-line.y(), line.x(), 0);
01645     Dir = Dir.unit();
01646     HepPoint3D PointOnLine(1, -(line.x()+line.z())/line.y(), 0);
01647     double dis = (p - PointOnLine).dot(Dir);
01648     HepPoint3D tmp(dis*Dir.x(), dis*Dir.y(), 0.);
01649     HepPoint3D closestPoint = PointOnLine + tmp;
01650 
01651     double disPLine = fabs(p.x()*line.x()+p.y()*line.y()+line.z())/sqrt(line.x()*line.x()+line.y()*line.y());
01652     double disP1P2 = sqrt((p.x()-closestPoint.x())*(p.x()-closestPoint.x())+(p.y()-closestPoint.y())*(p.y()-closestPoint.y()));
01653     if (fabs(disPLine-disP1P2)>0.00001) cout<<"TSegment::closestPoint: dis p -> line = "<<disPLine<<" dis p -> pos  = "<<disP1P2<<endl;
01654     return closestPoint;
01655 }

unsigned TSegment::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 319 of file TSegment.h.

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

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

00319                                 {
00320     if (! nLinks()) return 0;
00321     if (_clusterType == 0) updateType();
00322     return _clusterType;
00323 }

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 & TSegment::direction ( void   )  const [inline]

returns direction.

Definition at line 284 of file TSegment.h.

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

Referenced by TConformalFinder::direction().

00284                               {
00285     if (! _fitted) update();
00286     return _direction;
00287 }

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 TSegment::distance ( const HepPoint3D ,
const HepVector3D  
) const

Definition at line 249 of file TSegment.cxx.

References _position, and M_PI.

00249                                                                     {
00250     HepVector3D dir = _position - p;
00251     if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI);
00252     else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x());
00253 
00254     float radial = fabs(v.unit().dot(dir));
00255     float radial2 = radial * radial;
00256 
00257     return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.;
00258 }

double TSegment::distance ( const TSegment  )  const

calculates distance between two clusters. Smaller value indicates closer.

Definition at line 237 of file TSegment.cxx.

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

Referenced by solveDualHits(), and updateDuality().

00237                                            {
00238     HepVector3D dir = c.position() - _position;
00239     if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI);
00240     else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x());
00241 
00242     float radial = fabs(_direction.dot(dir));
00243     float radial2 = radial * radial;
00244 
00245     return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.;
00246 }

double TSegment::distance2 ( TMLink ,
HepPoint3D   
) const [private]

Definition at line 1344 of file TSegment.cxx.

References TMLink::positionD(), and x.

Referenced by appendByLine(), and segSalvage().

01344                                                        {
01345     double x = hit->positionD().x();
01346     double y = hit->positionD().y();
01347     double a = line.x();
01348     double b = line.y();
01349     double c = line.z();
01350     return fabs(a * x + b * y + c) / sqrt(a * a + b * b);
01351 }

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 TSegment::duality ( void   )  const [inline]

Definition at line 327 of file TSegment.h.

References _duality.

00327                             {
00328     return _duality;
00329 }

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

dumps debug information.

Reimplemented from TTrackBase.

Definition at line 116 of file TSegment.cxx.

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

Referenced by TConformalFinder::link(), solveDualHits(), and superLayerId().

00116                                                                  {
00117     if (! _fitted) update();
00118     bool def = false;
00119     if (msg == "") def = true;
00120 
00121     if (def || msg.find("cluster") != std::string::npos || msg.find("detail") != std::string::npos) {
00122         std::cout << pre;
00123         std::cout << "#links=" << _links.length();
00124         std::cout << "(" << _innerWidth << "," << _outerWidth << ":";
00125         std::cout << clusterType() << ")," << _nDual << "," << _duality << ",";
00126         std::cout << _angle << std::endl;
00127     }
00128     if (def || msg.find("vector") != std::string::npos || msg.find("detail") != std::string::npos) {
00129         std::cout << pre;
00130         std::cout << "pos" << _position << "," << "dir" << _direction;
00131         std::cout << std::endl;
00132     }
00133     if (def || msg.find("state") != std::string::npos || msg.find("detail") != std::string::npos) {
00134         std::cout << pre;
00135         std::cout << "state=" << _state << std::cout << std::endl;
00136     }
00137     if (def || msg.find("link") != std::string::npos || msg.find("detail") != std::string::npos) {
00138         std::cout << pre;
00139         std::cout << "unique links=" << NUniqueLinks(* this);
00140         std::cout << ",major links=" << NMajorLinks(* this);
00141         std::cout << ",branches=" << NLinkBranches(* this);
00142         std::cout << std::endl;
00143     }
00144     if (! def) TTrackBase::dump(msg, pre);
00145 }

void TSegment::expandSeg ( const   int,
AList< TMLink > &   
) [private]

Definition at line 1545 of file TSegment.cxx.

References _cdc, TTrackBase::_links, TMDC::getTMDC(), genRecEmupikp::i, TMDC::layer(), max, min, TMDCLayer::nWires(), TMDCLayer::offset(), phi0, pi, and update().

01545                                                              {
01546     if(empty>=4 || empty<0) return;
01547     AList<TMLink> linksOnEmptyLayer;
01548     for (int i = 0; i < allLinks.length(); ++i)
01549         if (allLinks[i]->wire()->localLayerId() == empty) linksOnEmptyLayer.append(allLinks[i]);
01550 
01551     if (linksOnEmptyLayer.length()==0) return;
01552 
01553     if (_cdc == 0) _cdc = TMDC::getTMDC();
01554     float maxPhi[4] = {0.,0.,0.,0.};
01555     float minPhi[4] = {999.,999.,999.,999.};
01556     float max = 0., min = 999.;
01557     for (int i = 0; i < _links.length(); ++i) {
01558         TMLink *l = _links[i];
01559         unsigned lId = l->wire()->layerId();
01560         int local = l->wire()->localId();
01561         unsigned loId = l->wire()->localLayerId();
01562         float phi0 = _cdc->layer(lId)->offset();
01563         int nWir = (int) _cdc->layer(lId)->nWires();
01564         float phi = phi0 + local*2*pi/nWir;
01565 
01566         if (phi > maxPhi[loId]) maxPhi[loId] = phi;
01567         if (phi < minPhi[loId]) minPhi[loId] = phi;
01568         if (phi > max) max = phi;
01569         if (phi < min) min = phi;
01570     }
01571 
01572     AList<TMLink> tmpList;
01573     for (int i = 0; i < linksOnEmptyLayer.length(); ++i) {
01574         TMLink *l = linksOnEmptyLayer[i];
01575         unsigned lId = l->wire()->layerId();
01576         int local = l->wire()->localId();
01577         float phi0 = _cdc->layer(lId)->offset();
01578         int nWir = (int) _cdc->layer(lId)->nWires();
01579         float phi = phi0 + local*2*pi/nWir;
01580 
01581         if (empty != 0 || empty != 3) {
01582             if (phi <= maxPhi[empty + 1] && phi >= minPhi[empty - 1]) tmpList.append(l);
01583             else if (phi <= maxPhi[empty - 1] && phi >= minPhi[empty + 1]) tmpList.append(l);
01584             else if (tmpList.length() == 0 && phi <= max && phi >= min) tmpList.append(l);
01585         }
01586         if (empty == 0 || empty == 3) {
01587             if (phi <= maxPhi[1] && phi >= minPhi[2]) tmpList.append(l);
01588             else if (phi <= maxPhi[2] && phi >= minPhi[1]) tmpList.append(l);
01589             else if (tmpList.length() == 0 && phi <= max && phi >= min) tmpList.append(l);
01590         }
01591     }
01592 
01593     for(int i = 0; i < tmpList.length(); ++i) {
01594         TMLink * l = tmpList[i];
01595         _links.append(l);
01596         unsigned a = l->tsfTag();
01597         ++a;
01598         l->tsfTag(a);
01599     }
01600     update();
01601 }

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 }

void TSegment::fitLine ( TMLink seed,
TMLink outer,
HepPoint3D  line[4] 
) const [private]

Definition at line 1207 of file TSegment.cxx.

References TMLink::cDrift(), and TMLink::positionD().

Referenced by splitTsf().

01207                                                                        {
01208     double ax = seed->positionD().x();
01209     double ay = seed->positionD().y();
01210     double ar = seed->cDrift();
01211     double bx = outer->positionD().x();
01212     double by = outer->positionD().y();
01213     double br = outer->cDrift();
01214     //calculate ...
01215     double dis = sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
01216     double costheta = (bx - ax) / dis;
01217     double sintheta = (by - ay) / dis;
01218     double c1 = (ax * ax - bx * bx + ay * ay - by * by) / (2 * dis);
01219     double c2 = (ax * by - bx * ay) / dis;
01220 //cout<<"dis of circles = "<<dis<<"   radius of circles N1 = "<<ar<<"  N2 = "<<br<<endl;
01221     line[0].setX((br - ar) * costheta + sqrt(dis * dis - (ar - br) * (ar - br)) * sintheta);
01222     line[0].setY((br - ar) * sintheta - sqrt(dis * dis - (ar - br) * (ar - br)) * costheta);
01223     line[0].setZ((br - ar) * c1 - sqrt(dis * dis - (ar - br) * (ar - br)) * c2 + 0.5 * dis * (ar + br));
01224     line[1].setX((br - ar) * costheta - sqrt(dis * dis - (ar - br) * (ar - br)) * sintheta);
01225     line[1].setY((br - ar) * sintheta + sqrt(dis * dis - (ar - br) * (ar - br)) * costheta);
01226     line[1].setZ((br - ar) * c1 + sqrt(dis * dis - (ar - br) * (ar - br)) * c2 + 0.5 * dis * (ar + br));
01227     line[2].setX((br + ar) * costheta + sqrt(dis * dis - (ar + br) * (ar + br)) * sintheta);
01228     line[2].setY((br + ar) * sintheta - sqrt(dis * dis - (ar + br) * (ar + br)) * costheta);
01229     line[2].setZ((br + ar) * c1 - sqrt(dis * dis - (ar + br) * (ar + br)) * c2 + 0.5 * dis * (br - ar));
01230     line[3].setX((br + ar) * costheta - sqrt(dis * dis - (ar + br) * (ar + br)) * sintheta);
01231     line[3].setY((br + ar) * sintheta + sqrt(dis * dis - (ar + br) * (ar + br)) * costheta);
01232     line[3].setZ((br + ar) * c1 + sqrt(dis * dis - (ar + br) * (ar + br)) * c2 + 0.5 * dis * (br - ar));
01233 /*    for (int i = 0; i < 4; ++i) {
01234         double d1 = distance2(seed, line[i]);
01235         double d2 = distance2(outer, line[i]);
01236         cout<<"dis of line to seed = "<<d1<<"  dis to outer = "<<d2<<endl;
01237         cout<<"radius of seed      = "<<ar<<"  rad to outer = "<<br<<endl;
01238     }
01239 *///check the calculation of line. right!!
01240     return;
01241 }

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 }

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

Definition at line 372 of file TSegment.h.

References _innerLinks.

00372                                {
00373     return _innerLinks;
00374 }

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

Definition at line 366 of file TSegment.h.

References _innerLinks.

Referenced by TConformalFinder::slowFinding2D().

00366                          {
00367     return _innerLinks;
00368 }

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

returns inner most layer.

Definition at line 305 of file TSegment.h.

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

Referenced by width().

00305                                    {
00306     if (! _fitted) update();
00307     return _innerMostLayer;
00308 }

const AList< TMLink > & TSegment::inners ( void   )  const [inline]

returns TMLinks in inner/outer-most layer.

Definition at line 263 of file TSegment.h.

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

00263                            {
00264     if (! _fitted) update();
00265     return _inners;
00266 }

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

returns inner width.

Definition at line 291 of file TSegment.h.

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

00291                                {
00292     if (! _fitted) update();
00293     return _innerWidth;
00294 }

HepPoint3D TSegment::leastSquaresFitting ( const AList< TMLink > &  links,
const HepPoint3D  tsfLine 
) const [private]

Definition at line 1431 of file TSegment.cxx.

References a0, genRecEmupikp::i, genRecEmupikp::line, and maxdDistance().

01431                                                                                          {
01432     HepPoint3D line0;
01433     line0.setX(tsfLine.x()/sqrt(tsfLine.x()*tsfLine.x()+tsfLine.y()*tsfLine.y()));
01434     line0.setY(tsfLine.y()/sqrt(tsfLine.x()*tsfLine.x()+tsfLine.y()*tsfLine.y()));
01435     line0.setZ(tsfLine.z()/sqrt(tsfLine.x()*tsfLine.x()+tsfLine.y()*tsfLine.y()));
01436 
01437 //    cout<<"tsfLine = "<<tsfLine<<endl;
01438     HepPoint3D line;
01439     int n = links.length();
01440     int nTrial = 0;
01441 
01442     while(1){
01443         if (nTrial>15) break;
01444         double a0 = line0.x();
01445         double b0 = line0.y();
01446         double c0 = line0.z();
01447 //cout<<"nTrial: "<<nTrial<<"    line0"<<a0<<" "<<b0<<" "<<c0<<endl;
01448 
01449         if (b0 == 0) {
01450             cout<<"b0 == 0 TSegment::leastSquaresFitting!"<<endl;
01451             break;
01452         }
01453 
01454         double a = 0., b = 0., c = 0.;
01455         double sumSigX2 = 0., sumSigX = 0., sumSig = 0.;
01456         for (int i = 0; i < n; ++i) {
01457             const HepPoint3D & p = links[i]->positionD();
01458             double X = p.x();
01459             double Y = p.y();
01460             double Sig = maxdDistance(links[i]);
01461             Sig = 1./(Sig*Sig);
01462             sumSigX2 += Sig*(X-Y*a0/b0)*(X-Y*a0/b0);
01463             sumSigX += Sig*(X-Y*a0/b0);
01464             sumSig += Sig;
01465         }
01466         double detM = sumSigX2*sumSig - sumSigX*sumSigX;
01467         double M11 = sumSig/detM;
01468         double M12 = -sumSigX/detM;
01469         double M21 = M12;
01470         double M22 = sumSigX2/detM;
01471         for (int i = 0; i < n; ++i) {
01472             const HepPoint3D & p = links[i]->positionD();
01473             double X = p.x();
01474             double Y = p.y();
01475             double DRIFT = links[i]->cDrift();
01476             if (a0*p.x() + b0*p.y() + c0*p.z() < 0) DRIFT = (-1) * DRIFT;
01477             double Sig = maxdDistance(links[i]);
01478             Sig = 1./(Sig*Sig);
01479             double D = DRIFT-Y/b0;
01480             a += ((X-Y*a0/b0)*M11+M12)*Sig*D;
01481             c += ((X-Y*a0/b0)*M21+M22)*Sig*D;
01482         }
01483 
01484         b = (1 - a0*a)/b0;
01485 
01486         line.setX(a/sqrt(a*a+b*b));
01487         line.setY(b/sqrt(a*a+b*b));
01488         line.setZ(c/sqrt(a*a+b*b));
01489         a = line.x();
01490         b = line.y();
01491         c = line.z();
01492 //      cout<<"line = "<<line<<endl;
01493         double chi2 = 0.;
01494         for (int i = 0; i< n; ++i){
01495             const HepPoint3D & p = links[i]->positionD();
01496             double dis = fabs(a*p.x()+b*p.y()+c);
01497             double DRIFT = links[i]->cDrift();
01498             double Sig = maxdDistance(links[i]);
01499 //cout<<"dis: "<<dis<<"  DRIFT: "<<DRIFT<<"  Sig: "<<Sig<<endl;
01500             Sig = 1./(Sig*Sig);
01501             chi2 += (dis - DRIFT)*(dis - DRIFT)*Sig;
01502         }
01503 //cout<<"chi2 = "<<chi2<<endl;
01504 
01505         //check...
01506         if(fabs(a-a0)<0.00001) break;
01507         //get line para...
01508         line0 = line;
01509         ++nTrial;
01510 /*      if(nTrial>9){
01511             cout<<"length of links = "<<n<<endl;
01512             for(int i = 0; i<n; ++i){
01513                 const HepPoint3D & p = links[i]->positionD();
01514                 cout<<"layer: "<<links[i]->wire()->layerId()<<" localId:"<<links[i]->wire()->localId()<<endl;
01515                 cout<<"drift: "<<links[i]->cDrift()<<" dis0: "<<a0*p.x() + b0*p.y() + c0*p.z()
01516                     <<" dis1:"<<a*p.x() + b*p.y() + c*p.z()<<endl;
01517             }
01518         }*/
01519     }
01520     return line;
01521 }

HepPoint3D TSegment::leastSquaresFitting1 ( const AList< TMLink > &  links,
const HepPoint3D  tsfLine 
) const [private]

Definition at line 1372 of file TSegment.cxx.

References _lineTsf, closestPoint(), genRecEmupikp::i, genRecEmupikp::line, maxdDistance(), unit, and v.

01372                                                                                           {
01373     HepPoint3D line0;
01374     line0.setX(tsfLine.x()/sqrt(tsfLine.x()*tsfLine.x()+tsfLine.y()*tsfLine.y()));
01375     line0.setY(tsfLine.y()/sqrt(tsfLine.x()*tsfLine.x()+tsfLine.y()*tsfLine.y()));
01376     line0.setZ(tsfLine.z()/sqrt(tsfLine.x()*tsfLine.x()+tsfLine.y()*tsfLine.y()));
01377 
01378     HepPoint3D line;
01379     unsigned n = links.length();
01380     unsigned nTrial = 0;
01381     while(1){
01382     if (nTrial > 10) break;
01383     double a = 0., b = 0.;
01384     double sumXSig = 0., sumYSig = 0., sumX2Sig = 0., sumXYSig = 0., sumSig = 0.;
01385     for (unsigned i = 0; i < n; i++) {
01386         const HepPoint3D & p = links[i]->positionD();
01387         double d = links[i]->cDrift();
01388         HepPoint3D posOnLine = closestPoint(p, _lineTsf);
01389         HepPoint3D v = (posOnLine - p).unit();
01390         const HepPoint3D p1 = p + d*v;
01391         double Sig = maxdDistance(links[i]);
01392         Sig = 1./(Sig*Sig);
01393         double X = p1.x();
01394         double Y = p1.y();
01395         sumXSig  += X*Sig;
01396         sumYSig  += Y*Sig;
01397         sumX2Sig += X * X * Sig;
01398         sumXYSig += X * Y * Sig;
01399         sumSig += Sig;
01400     }
01401 
01402     b = (sumXYSig * sumSig - sumXSig * sumYSig) / (sumX2Sig * sumSig - sumXSig * sumXSig);
01403     a = (sumYSig - sumXSig * b) / sumSig;
01404 
01405     line.set(b/sqrt(1+b*b), -1/sqrt(1+b*b), a/sqrt(1+b*b));
01406 //cout<<"n: "<<nTrial<<"  line = "<<line<<endl;
01407 
01408     double chi2 = 0.;
01409     for (unsigned i = 0; i < n; i++) {
01410         const HepPoint3D & p = links[i]->positionD();
01411         double d = links[i]->cDrift();
01412         double Sig = maxdDistance(links[i]);
01413         Sig = 1./(Sig*Sig);
01414         double dis = fabs(p.x()*line.x()+p.y()*line.y()+line.z()) - d;
01415         chi2 += dis * dis * Sig;
01416     }
01417     if (nTrial > 6) {
01418         cout<<"n = "<<n<<"  nTrial = "<<nTrial<<"  line0 = "<<line0<<endl;
01419         cout<<"chi2 in TSF = "<<chi2<<endl;
01420     }
01421 
01422     if (fabs(line.x()-line0.x()) < 0.0001) break;
01423 
01424     line0 = line;
01425     ++nTrial;
01426     }//while...
01427     return line;
01428 }

const HepPoint3D & TSegment::lineTsf ( const HepPoint3D  )  [inline]

Definition at line 409 of file TSegment.h.

References _lineTsf.

00409                                      {
00410     return _lineTsf = a;
00411 }

const HepPoint3D & TSegment::lineTsf ( void   )  const [inline]

return line of Tsf for pos and dir

Definition at line 403 of file TSegment.h.

References _lineTsf.

Referenced by appendByLine().

00403                             {
00404     return _lineTsf;
00405 }

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(), TSegment0::splitAV(), splitAV(), splitTsf(), TConformalFinder::stereoSegments(), TSegment0::superLayerId(), superLayerId(), TTrack::szPosition(), TCurlFinder::trace2DTrack(), TCurlFinder::trace3DTrack(), and 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 }

double TSegment::maxdDistance ( TMLink  )  const [private]

Definition at line 1113 of file TSegment.cxx.

References TMLink::dDrift(), TMDCWire::layerId(), TMDCWire::superLayerId(), and TMLink::wire().

Referenced by appendByLine(), leastSquaresFitting(), leastSquaresFitting1(), and segSalvage().

01113                                      {
01114     unsigned sl = l->wire()->superLayerId();
01115     unsigned lId = l->wire()->layerId();
01116     double _averR[11] = {9.7, 14.5, 22.14, 28.62, 35.1, 42.39, 48.87, 55.35, 61.83, 69.12, 74.79};
01117     double _averR2[43] = { 7.885, 9.07, 10.29, 11.525,
01118                         12.72, 13.875, 15.01, 16.16,
01119                         19.7, 21.3, 22.955, 24.555,
01120                         26.215, 27.82, 29.465, 31.06,
01121                         32.69, 34.265, 35.875, 37.455,
01122                         39.975, 41.52, 43.12, 44.76,
01123                         46.415, 48.02, 49.685, 51.37,
01124                         53.035, 54.595, 56.215, 57.855,
01125                         59.475, 60.995, 62.565, 64.165,
01126                         66.68, 68.285, 69.915, 71.57,
01127                         73.21, 74.76, 76.345};
01128     double radius = _averR2[lId];
01129     const double singleSigma = l->dDrift();
01130     return 2 * singleSigma / (radius * radius);
01131 }

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

returns type.

Reimplemented from TTrackBase.

Definition at line 333 of file TSegment.h.

References Segment.

00333                                {
00334     return Segment;
00335 }

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 }

const AList< TSegment > & TSegment::outerLinks ( void   )  const [inline]

Definition at line 384 of file TSegment.h.

References _outerLinks.

00384                                {
00385     return _outerLinks;
00386 }

AList< TSegment > & TSegment::outerLinks ( void   )  [inline]

Definition at line 378 of file TSegment.h.

References _outerLinks.

Referenced by OuterMostUniqueLink().

00378                          {
00379     return _outerLinks;
00380 }

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

returns outer most layer.

Definition at line 312 of file TSegment.h.

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

Referenced by width().

00312                                    {
00313     if (! _fitted) update();
00314     return _outerMostLayer;
00315 }

const HepPoint3D& TSegment::outerPosition ( void   )  const

const AList< TMLink > & TSegment::outers ( void   )  const [inline]

Definition at line 270 of file TSegment.h.

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

Referenced by solveDualHits().

00270                            {
00271     if (! _fitted) update();
00272     return _outers;
00273 }

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

returns outer width.

Definition at line 298 of file TSegment.h.

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

00298                                {
00299     if (! _fitted) update();
00300     return _outerWidth;
00301 }

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

returns position.

Definition at line 277 of file TSegment.h.

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

Referenced by TConformalFinder::direction(), distance(), TConformalFinder::linkSegments(), rangeX(), and update().

00277                              {
00278     if (! _fitted) update();
00279     return _position;
00280 }

HepPoint3D TSegment::positionTsf ( const AList< TMLink > &  links,
const HepPoint3D  line 
) const [private]

Definition at line 1354 of file TSegment.cxx.

References _lineTsf, closestPoint(), genRecEmupikp::i, unit, and v.

01354                                                                               {
01355     HepPoint3D sumPos(0., 0., 0.);
01356     int n = 0;
01357     for(int i = 0; i < links.length(); ++i){
01358         const HepPoint3D & p = links[i]->positionD();
01359         double d = links[i]->cDrift();
01360         HepPoint3D posOnLine = closestPoint(p, _lineTsf);
01361         HepPoint3D v = (posOnLine - p).unit();
01362         const HepPoint3D p1 = p + d*v;
01363         sumPos += p1;
01364         ++n;
01365     }
01366     sumPos *= (1. / double(n));
01367     HepPoint3D posTsf = closestPoint(sumPos, line);
01368     return posTsf;
01369 }

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

returns Range of x-coordinate of TMLinks.

Definition at line 261 of file TSegment.cxx.

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

00261                                              {
00262 #ifdef TRKRECO_DEBUG_DETAIL
00263     if (min > max) {
00264         std::cout << "TSegment::range !!! bad arguments:min,max=";
00265         std::cout << min << "," << max << std::endl;
00266     }
00267 #endif
00268 
00269     unsigned n = _links.length();
00270     if (n == 0) return Range(0., 0.);
00271 
00272     //...Search for a center...
00273     bool found = false;
00274     double center;
00275     for (unsigned i = 0; i < n; i++) {
00276         double x = _links[i]->position().x();
00277         if (x < min || x > max) continue;
00278         center = x;
00279         found = true;
00280         break;
00281     }
00282     if (! found) return Range(0., 0.);
00283 
00284 #ifdef TRKRECO_DEBUG_DETAIL
00285 //     std::cout << "    center=" << center << std::endl;
00286 #endif
00287 
00288     double distanceR = 0.;
00289     double distanceL = 0.;
00290     double distanceMax = max - min;
00291     for (unsigned i = 0; i < n; i++) {
00292         double x = _links[i]->position().x();
00293         if (x < min || x > max) continue;
00294 
00295         double distance0, distance1;
00296         if (x > center) {
00297             distance0 = x - center;
00298             distance1 = distanceMax - distance0;
00299         }
00300         else {
00301             distance1 = center - x;
00302             distance0 = distanceMax - distance1;
00303         }
00304 
00305         if (distance0 < distance1) {
00306             if (distance0 > distanceR) distanceR = distance0;
00307         }
00308         else {
00309             if (distance1 > distanceL) distanceL = distance1;
00310         }
00311 
00312 #ifdef TRKRECO_DEBUG_DETAIL
00313 //      std::cout << "    ";
00314 //      std::cout << _links[i]->wire()->layerId() << "-";
00315 //      std::cout << _links[i]->wire()->localId() << ",";
00316 //      std::cout << _links[i]->position().x();
00317 //      std::cout << ",0,1=" << distance0 << "," << distance1;
00318 //      std::cout << ",l,r=" << distanceL << "," << distanceR;
00319 //      std::cout << std::endl;
00320 #endif
00321     }
00322 
00323     double right = center + distanceR;
00324     double left = center - distanceL;
00325 
00326     return Range(left, right);
00327 }

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(), TSegment0::splitComplicated(), and 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 }

void TSegment::segSalvage ( AList< TMLink > &   )  [private]

Definition at line 1524 of file TSegment.cxx.

References _lineTsf, TTrackBase::_links, _times, distance2(), genRecEmupikp::i, genRecEmupikp::line, maxdDistance(), and update().

01524                                           {
01525     HepPoint3D line = _lineTsf;
01526     AList<TMLink> segLinks = _links;
01527     for (int i = 0; i < links.length(); ++i) {
01528         TMLink * l = links[i];
01529         if(segLinks.hasMember(l)) continue;
01530         const unsigned slId = l->wire()->superLayerId();
01531         double maxdis = maxdDistance(l) * (_times[slId]);
01532         double dis = distance2(l, line);
01533         if (fabs(dis - l->cDrift()) < maxdis) {
01534             _links.append(l);
01535             unsigned a = l->tsfTag();
01536             ++a;
01537             l->tsfTag(a);
01538         }
01539         else continue;
01540     }
01541     update();
01542 }

int TSegment::solveDualHits ( void   ) 

Definition at line 736 of file TSegment.cxx.

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

Referenced by splitComplicated(), and splitParallel().

00736                             {
00737     updateType();
00738     if (_clusterType == 0) return 0;
00739     if (_nDual == 0) return 0;
00740     update();
00741     return 0;
00742 
00743     updateType();
00744     if (_clusterType == 0) return 0;
00745     if (_nDual == 0) return 0;
00746 
00747     AList<TMLink> seeds;
00748     AList<TMLink> duals;
00749     for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00750         AList<TMLink> list = SameLayer(_links, i);
00751 
00752         if (list.length() == 1) {
00753             seeds.append(list[0]);
00754         }
00755         else if (list.length() == 2) {
00756             if (Width(list) > 1) {
00757                 const TMDCWireHit * h0 = list[0]->hit();
00758                 const TMDCWireHit * h1 = list[1]->hit();
00759                 double distance = (h0->xyPosition() - h1->xyPosition()).mag();
00760                 distance = fabs(distance - 
00761                                 list[0]->drift() - 
00762                                 list[1]->drift());
00763                 if (distance > 0.5) duals.append(list);
00764 #ifdef TRKRECO_DEBUG_DETAIL
00765                 h0->dump("", "        ");
00766                 h1->dump("", "        ");
00767                 std::cout << "        lyr=" << i;
00768                 std::cout << ", duality distance = " << distance << std::endl;
00769 #endif
00770             }
00771         }
00772         else if (list.length() == 0) {
00773             continue;
00774         }
00775 #ifdef TRKRECO_DEBUG_DETAIL
00776         else {
00777             std::cout << "TSegment::solveDualHits !!! this is not expected 2";
00778             std::cout << std::endl;
00779             this->dump("cluster hits mc", "    ");
00780         }
00781 #endif
00782     }
00783 
00784     //...Solve them...
00785     if (seeds.length() < 2) return -1;
00786     AList<TMLink> outers = InOut(seeds);
00787     const HepPoint3D & p = outers[0]->xyPosition();
00788     HepVector3D v = (outers[1]->xyPosition() - p).unit();
00789     unsigned n = duals.length() / 2;
00790     for (unsigned i = 0; i < n; i++) {
00791         TMLink * t0 = duals[i * 2 + 0];
00792         TMLink * t1 = duals[i * 2 + 1];
00793         HepVector3D x0 = t0->xyPosition() - p;
00794         HepVector3D x1 = t1->xyPosition() - p;
00795         double d0 = (x0 - (x0.dot(v) * v)).mag();
00796         double d1 = (x1 - (x1.dot(v) * v)).mag();
00797         if (d0 < d1) _links.remove(t1);
00798         else         _links.remove(t0);
00799     }
00800     update();
00801     return n;
00802 }

void TSegment::solveLR ( void   ) 

solve LR of hit in TSF.

Definition at line 1604 of file TSegment.cxx.

References _lineTsf, TTrackBase::_links, center(), closestPoint(), genRecEmupikp::i, solveThreeHits(), state(), unit, WireHitPatternLeft, and WireHitPatternRight.

01604                       {
01605     unsigned n = _links.length();
01606     //initial...
01607     if (n <= 3) {
01608       solveThreeHits();
01609       return;
01610     }
01611     for (int i = 0; i < n; ++i) {
01612         TMLink *l = _links[i];
01613         if (l->hit()->state() & WireHitPatternRight){
01614             unsigned newState = l->hit()->state()&(~WireHitPatternRight);
01615             l->hit()->state(newState);
01616         }
01617         if (l->hit()->state() & WireHitPatternLeft){
01618             unsigned newState = l->hit()->state()&(~WireHitPatternLeft);
01619             l->hit()->state(newState);
01620         }
01621     }
01622 
01623     HepPoint3D originCon(0., 0., 0.);
01624     HepPoint3D dirZ(0., 0., 1.);
01625     HepPoint3D center = closestPoint(originCon, _lineTsf);
01626     HepPoint3D v1 = (center - originCon).unit();
01627     HepPoint3D v2 = dirZ.cross(v1);
01628     for (int i = 0; i < n; ++i) {
01629 //      cout<<"layerId: "<<_links[i]->wire()->layerId()<<"  localId: "<<_links[i]->wire()->localId()<<endl;
01630         const HepPoint3D & p = _links[i]->positionD();
01631         unsigned state = _links[i]->hit()->state();
01632 
01633         double cosA = (p - center).unit().dot(v1.unit());
01634         double cosB = (p - center).unit().dot(v2.unit());
01635         if (cosA*cosB < 0) state |= WireHitPatternLeft;
01636         else state |= WireHitPatternRight;
01637 
01638         _links[i]->hit()->state(state);
01639     }
01640 }

void TSegment::solveThreeHits ( void   ) 

Definition at line 1658 of file TSegment.cxx.

References TTrackBase::_links, genRecEmupikp::i, ganga-rec::j, state(), w, WireHitNeighborHit, WireHitPatternLeft, and WireHitPatternRight.

Referenced by solveLR().

01658                              {
01659     unsigned n = _links.length();
01660 
01661     for (unsigned i = 0; i < n; i++) {
01662         const TMDCWireHit * h = _links[i]->hit();
01663         const TMDCWire * w = h->wire();
01664         unsigned state = h->state();
01665 
01666         //...Cache pointers to a neighbor...
01667         const TMDCWire * neighbor[6];
01668         for (unsigned j = 0; j < 6; j++) neighbor[j] = w->neighbor(j);
01669 
01670         //...Decide hit pattern...
01671         unsigned pattern = 0;
01672         for (unsigned j = 0; j < 6; j++) {
01673             if (neighbor[j])
01674                 if (neighbor[j]->hit())
01675                     pattern += (1 << j);
01676         }
01677         state |= (pattern << WireHitNeighborHit);
01678 
01679         //...Solve LR locally...
01680         if ((pattern == 34) || (pattern == 42) ||
01681             (pattern == 40) || (pattern == 10) ||
01682             (pattern == 35) || (pattern == 50))
01683             state |= WireHitPatternRight;
01684         else if ((pattern == 17) || (pattern == 21) ||
01685                  (pattern == 20) || (pattern ==  5) ||
01686                  (pattern == 19) || (pattern == 49))
01687             state |= WireHitPatternLeft;
01688 
01689         //...Store it...
01690         h->state(state);
01691     }
01692 }

AList< TSegment > TSegment::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 388 of file TSegment.cxx.

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

Referenced by splitComplicated(), and splitParallel().

00388                           {
00389     AList<TSegment> list;
00390 
00391     //...Do not split if cluster type is 1, 2, or 7...
00392     unsigned t = clusterType();
00393 #ifdef TRKRECO_DEBUG_DETAIL
00394     std::cout << "    ... splitting : type=" << t << std::endl;
00395 #endif 
00396     if (t == 0) return list;
00397     else if (t == 2) {
00398         // beta 5
00399         //if (_nDual > 2 && _duality > 0.7 && _angle > 0.7) return splitDual();
00400 
00401         // 1.67g
00402         // if (_nDual > 2 && _duality > 0.7) return splitDual();
00403 
00404         if (_nDual > 2 && _duality > 0.7 && _angle > 0.7) return splitDual();
00405         return list;
00406     }
00407     else if (t == 1) return list;
00408     else if (t == 7) return list;
00409 
00410     //...Parallel...
00411     else if (t == 6) return splitParallel();
00412     // else if (t == 6) return list;
00413 
00414     //...Avoid splitting of X or parallel...(future implementation)...
00415     else if (t > 4) return splitComplicated();
00416 
00417     //...A or V...
00418     return splitAV();
00419 }

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

Definition at line 422 of file TSegment.cxx.

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

Referenced by split().

00422                             {
00423     unsigned t = clusterType();
00424     AList<TMLink> seeds[2];
00425 
00426     //...Calculate corner of V or A...
00427     const AList<TMLink> * corners;
00428     if (t == 3) corners = & _outers;
00429     else        corners = & _inners;
00430     HepPoint3D corner;
00431     for (unsigned i = 0; i < corners->length(); i++)
00432         corner += (* corners)[i]->wire()->xyPosition();
00433     corner *= 1. / (float) corners->length();
00434     seeds[0].append(* corners);
00435     seeds[1].append(* corners);
00436 
00437     //...Calculdate edges...
00438     const AList<TMLink> * links;
00439     if (t == 3) links = & _inners;
00440     else        links = & _outers;
00441     AList<TMLink> edge = Edges(* links);
00442     HepPoint3D edgePos[2];
00443     HepVector3D v[2];
00444     for (unsigned i = 0; i < 2; i++) {
00445         edgePos[i] = edge[i]->wire()->xyPosition();
00446         v[i] = (edgePos[i] - corner).unit();
00447     }
00448     seeds[0].append(edge[0]);
00449     seeds[1].append(edge[1]);
00450 
00451 #ifdef TRKRECO_DEBUG_DETAIL
00452     std::cout << "    corner:" << corner << std::endl;
00453     std::cout << "    edge:" << edgePos[0] << "(";
00454     std::cout << edge[0]->wire()->layerId() << "-";
00455     std::cout << edge[0]->wire()->localId() << ")";
00456     std::cout << v[0] << std::endl;
00457     std::cout << "         ";
00458     std::cout << edgePos[1] << "(";
00459     std::cout << edge[1]->wire()->layerId() << "-";
00460     std::cout << edge[1]->wire()->localId() << ")";
00461     std::cout << v[1] << std::endl;
00462 #endif
00463 
00464     //...Examine each hits...
00465     unsigned n = _links.length();
00466     for (unsigned i = 0; i < n; i++) {
00467         TMLink * l = _links[i];
00468         if (edge.member(l)) continue;
00469         if (corners->member(l)) continue;
00470 
00471         HepVector3D p = l->wire()->xyPosition() - corner;
00472         double p2 = p.mag2();
00473 
00474         double dist[2];
00475         for (unsigned j = 0; j < 2; j++) {
00476             dist[j] = v[j].dot(p);
00477             double d2 = dist[j] * dist[j];
00478             dist[j] = (p2 - d2) > 0. ? sqrt(p2 - d2) : 0.;
00479         }
00480         if (dist[0] < dist[1]) seeds[0].append(l);
00481         else                   seeds[1].append(l);
00482 
00483 #ifdef TRKRECO_DEBUG_DETAIL
00484         std::cout << "        p:" << p << std::endl;
00485         std::cout << "    " << l->wire()->layerId() << "-";
00486         std::cout << l->wire()->localId() << ":" << dist[0];
00487         std::cout << "," << dist[1] << std::endl;
00488 #endif
00489     }
00490 
00491     AList<TSegment> list;
00492     for (unsigned i = 0; i < 2; i++) {
00493         if (seeds[i].length()) {
00494             TSegment * nc = new TSegment(seeds[i]);
00495             AList<TSegment> ncx = nc->split();
00496             if (ncx.length() == 0) {
00497                 nc->solveDualHits();
00498                 list.append(nc);
00499             }
00500             else {
00501                 list.append(ncx);
00502                 delete nc;
00503             }
00504         }
00505     }
00506     return list;
00507 }

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

Definition at line 510 of file TSegment.cxx.

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

Referenced by split().

00510                                      {
00511 
00512     //...Select best hits...
00513     AList<TSegment> newClusters;
00514     AList<TMLink> goodHits;
00515     unsigned n = _links.length();
00516     for (unsigned i = 0; i < n; i++) {
00517         const TMDCWireHit * h = _links[i]->hit();
00518         unsigned state = h->state();
00519         if (! (state & WireHitContinuous)) continue;
00520         if (! (state & WireHitIsolated)) continue;
00521         if ((! (state & WireHitPatternLeft)) &&
00522             (! (state & WireHitPatternRight))) continue;
00523         goodHits.append(_links[i]);
00524     }
00525     if (goodHits.length() == 0) return newClusters;
00526 
00527     //...Main loop...
00528     goodHits.sort(SortByWireId);
00529     AList<TMLink> original(_links);
00530     while (goodHits.length()) {
00531 
00532         //...Select an edge hit...
00533         TMLink * seed = goodHits.last();
00534         const TMDCWire * wire = seed->wire();
00535         unsigned localId = wire->localId();
00536         AList<TMLink> used;
00537         unsigned nn = _links.length();
00538         for (unsigned i = 0; i < nn; i++) {
00539             TMLink * t = _links[i];
00540             const TMDCWire * w = t->wire();
00541 
00542             //...Straight?...
00543             if (abs((int) w->localId() - (int) localId) < 2) used.append(t);
00544         }
00545 
00546 #ifdef TRKRECO_DEBUG_DETAIL
00547         std::cout << "        seed is " << seed->wire()->name() << std::endl;
00548         std::cout << "            ";
00549         for (unsigned i = 0; i < used.length(); i++) {
00550             std::cout << used[i]->wire()->name() << ",";
00551         }
00552         std::cout << std::endl;
00553 #endif
00554 
00555         //...Create new cluster...
00556         if (used.length() == 0) continue;
00557         if (used.length() == nLinks()) return newClusters;
00558         TSegment * c = new TSegment(used);
00559         AList<TSegment> cx = c->split();
00560         if (cx.length() == 0) {
00561             c->solveDualHits();
00562             newClusters.append(c);
00563         }
00564         else {
00565             newClusters.append(cx);
00566             delete c;
00567         }
00568         goodHits.remove(used);
00569         original.remove(used);
00570     }
00571 
00572     //...Remainings...
00573     if ((original.length()) && (original.length() < nLinks())) {
00574         TSegment * c = new TSegment(original);
00575         AList<TSegment> cx = c->split();
00576         if (cx.length() == 0) {
00577             c->solveDualHits();
00578             newClusters.append(c);
00579         }
00580         else {
00581             newClusters.append(cx);
00582             delete c;
00583         }
00584     }
00585 
00586     return newClusters;
00587 }

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

Definition at line 686 of file TSegment.cxx.

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

Referenced by split().

00686                               {
00687 #ifdef TRKRECO_DEBUG_DETAIL
00688     std::cout << "    TSegment::splitDual called" << std::endl;
00689 #endif
00690     AList<TMLink> seeds[2];
00691     AList<TMLink> unknown;
00692     for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00693         AList<TMLink> list = SameLayer(_links, i);
00694 
00695         if (list.length() == 2) {
00696             if (Width(list) == 2) {
00697                 seeds[0].append(list[0]);
00698                 seeds[1].append(list[1]);
00699                 continue;
00700             }
00701         }
00702         unknown.append(list);
00703     }
00704 
00705     if (unknown.length() > 0) {
00706 #ifdef TRKRECO_DEBUG_DETAIL
00707         if (seeds[0].length() == 0)
00708             std::cout << "TSegment::splitDual !!! no TMLink for seed 0" << std::endl;
00709         if (seeds[1].length() == 0)
00710             std::cout << "TSegment::splitDual !!! no TMLink for seed 1" << std::endl;
00711 #endif  
00712         const HepPoint3D & p0 = seeds[0][0]->xyPosition();
00713         const HepPoint3D & p1 = seeds[1][0]->xyPosition();
00714         HepVector3D v0 = (seeds[0].last()->xyPosition() - p0).unit();
00715         HepVector3D v1 = (seeds[1].last()->xyPosition() - p1).unit();
00716 
00717         for (unsigned i = 0; i < unknown.length(); i++) {
00718             TMLink * t = unknown[i];
00719             HepVector3D x0 = t->xyPosition() - p0;
00720             double d0 = (x0 - (x0.dot(v0) * v0)).mag();
00721             HepVector3D x1 = t->xyPosition() - p1;
00722             double d1 = (x1 - (x1.dot(v0) * v0)).mag();
00723 
00724             if (d0 < d1) seeds[0].append(t);
00725             else         seeds[1].append(t);
00726         }
00727     }
00728 
00729     AList<TSegment> newClusters;
00730     newClusters.append(new TSegment(seeds[0]));
00731     newClusters.append(new TSegment(seeds[1]));
00732     return newClusters;
00733 }

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

Definition at line 590 of file TSegment.cxx.

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

Referenced by split().

00590                                   {
00591     AList<TMLink> seeds[2];
00592     AList<TSegment> newClusters;
00593     for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00594         AList<TMLink> list = SameLayer(_links, i);
00595         AList<TMLink> outerList = Edges(list);
00596 
00597 #ifdef TRKRECO_DEBUG_DETAIL
00598         if (outerList.length() != 2) {
00599             std::cout << "TSegment::splitParallel !!! ";
00600             std::cout << "This is not a parallel cluster" << std::endl;
00601         }
00602 #endif
00603 
00604         seeds[0].append(outerList[0]);
00605         seeds[1].append(outerList[1]);
00606         if (list.length() == 2) continue;
00607 
00608         const TMDCWire & wire0 = * outerList[0]->wire();
00609         const TMDCWire & wire1 = * outerList[1]->wire();
00610         for (unsigned k = 0; k < list.length(); k++) {
00611             TMLink * t = list[k];
00612             if (t == outerList[0]) continue;
00613             if (t == outerList[1]) continue;
00614 
00615             if (abs(wire0.localIdDifference(* t->wire())) <
00616                 abs(wire1.localIdDifference(* t->wire())))
00617                 seeds[0].append(t);
00618             else
00619                 seeds[1].append(t);
00620         }
00621     }
00622     
00623     if ((seeds[0].length()) && (seeds[0].length() < nLinks())) {
00624         TSegment * c0 = new TSegment(seeds[0]);
00625         AList<TSegment> c0x = c0->split();
00626         if (c0x.length()) {
00627             newClusters.append(c0x);
00628             delete c0;
00629         }
00630         else {
00631             c0->solveDualHits();
00632             newClusters.append(c0);
00633         }
00634     }
00635 
00636     if ((seeds[1].length()) && (seeds[1].length() < nLinks())) {
00637         TSegment * c1 = new TSegment(seeds[1]);
00638         AList<TSegment> c1x = c1->split();
00639         if (c1x.length()) {
00640             newClusters.append(c1x);
00641             delete c1;
00642         }
00643         else {
00644             c1->solveDualHits();
00645             newClusters.append(c1);
00646         }
00647     }
00648 
00649     return newClusters;
00650 }

AList< TSegment > TSegment::splitTsf ( AList< TMLink > &   ) 

Definition at line 1134 of file TSegment.cxx.

References TTrackBase::_links, appendByLine(), fitLine(), genRecEmupikp::i, genRecEmupikp::line, TTrackBase::links(), TMDCWire::localLayerId(), TMLink::tsfTag(), and TMLink::wire().

Referenced by TMDCTsf::segments().

01134                                                 {
01135     //get links in each layer.
01136     AList<TSegment> list;
01137     AList<TMLink> links[4];   //links in each local layer.
01138     AList<TMLink> seeds2;     //links in the outer layer.
01139     AList<TMLink> exTsf;      //links in other local layers.
01140     TMLink *seed;             //link in the mostinner layer.
01141 
01142     for (unsigned i = 0; i < _links.length(); ++i) {
01143         TMLink * l = _links[i];
01144         links[l->wire()->localLayerId()].append(l);
01145     }
01146 
01147     //prepare for segment finding.
01148     if (links[0].length() == 0) {  //find in 234.
01149         if (links[3].length() == 0) return list;
01150         if (links[1].length() != 1) {
01151             cout<<"wrong in tsf, TSegment::splitTsf ...1"<<endl;
01152             return list;
01153         }
01154         seed = links[1][0];
01155         seeds2.append(links[3]);
01156         exTsf.append(links[2]);
01157     }
01158     else if (links[0].length() == 1) { //find in 1234, 124, 134, 123.
01159         seed = links[0][0];
01160         if (links[3].length() > 0) {     //1..4
01161             seeds2.append(links[3]);
01162             exTsf.append(links[1]);
01163             exTsf.append(links[2]);
01164         }
01165         else if (links[2].length() > 0) { //1..3
01166             seeds2.append(links[2]);
01167             exTsf.append(links[1]);
01168         }
01169         else return list;
01170     }
01171     else cout<<"wrong in tsf, TSegment::splitTsf ...2"<<endl;
01172     exTsf.append(seeds2);  //add the outer layer...
01173 
01174     //find segments
01175     for (unsigned i = 0; i < seeds2.length(); ++i) {
01176         if (seed->tsfTag() > 0 && seeds2[i]->tsfTag() > 0) continue;
01177         AList<TSegment> segments;
01178         HepPoint3D line[4];
01179         fitLine(seed, seeds2[i], line);
01180         segments = appendByLine(seed, seeds2[i], seedNeighbors, exTsf, line);
01181         list.append(segments);
01182         segments.removeAll();
01183     }
01184     if (seed->wire()->localLayerId() == 0) {   //for 123
01185         exTsf.removeAll();
01186         seeds2.removeAll();
01187         exTsf.append(links[1]);
01188         exTsf.append(links[2]);   //add the outer layer...
01189         for (int k = 0; k < links[2].length(); ++k){
01190             if (links[2][k]->tsfTag() == 0) seeds2.append(links[2][k]);
01191         }
01192         for (unsigned i = 0; i < seeds2.length(); ++i) {
01193             if (seed->tsfTag() > 0 && seeds2[i]->tsfTag() > 0) continue;
01194             AList<TSegment> segments2;
01195             HepPoint3D line2[4];
01196             fitLine(seed, seeds2[i], line2);
01197             segments2 = appendByLine(seed, seeds2[i], seedNeighbors, exTsf, line2);
01198             list.append(segments2);
01199             segments2.removeAll();
01200         }
01201     }
01202 
01203     return list;
01204 }

unsigned TSegment::state ( unsigned   )  [inline]

Definition at line 396 of file TSegment.h.

References _state.

00396                           {
00397     return _state = a;
00398 }

unsigned TSegment::state ( void   )  const [inline]

Definition at line 390 of file TSegment.h.

References _state.

Referenced by solveLR(), solveThreeHits(), and splitComplicated().

00390                           {
00391     return _state;
00392 }

unsigned TSegment::superLayerId (  )  const [inline]

returns super layer id.

Definition at line 339 of file TSegment.h.

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

00339                                  {
00340     unsigned id = (links())[0]->wire()->superLayerId();
00341 #ifdef TRKRECO_DEBUG
00342     {
00343         const AList<TMLink> & list = links();
00344         unsigned n = list.length();
00345         for (unsigned i = 1; i < n; i++) {
00346             if (list[i]->hit()->wire()->superLayerId() != id) {
00347                 std::cout << "TSegment::superLayerId !!! strange segment found";
00348                 std::cout << std::endl;
00349                 dump();
00350                 break;
00351             }
00352         }
00353     }
00354 #endif
00355     return id;
00356 }

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 > & TSegment::tracks ( void   )  [inline]

Definition at line 360 of file TSegment.h.

References _tracks.

00360                      {
00361     return _tracks;
00362 }

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 TSegment::update ( void   )  const [private]

updates cache.

Reimplemented from TTrackBase.

Definition at line 148 of file TSegment.cxx.

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

Referenced by appendByLine(), direction(), dump(), expandSeg(), innerMostLayer(), inners(), innerWidth(), outerMostLayer(), outers(), outerWidth(), position(), segSalvage(), solveDualHits(), and updateType().

00148                            {
00149     _clusterType = 0;
00150     _position = ORIGIN;
00151     _direction = ORIGIN;
00152     _outerPosition = ORIGIN;
00153     _inners.removeAll();
00154     _outers.removeAll();
00155 
00156     if (_links.length() == 0) return; //tmp for tsf
00157 //    if (_links.length() < 3) return;
00158 
00159     _innerMostLayer = _links[0]->wire()->layerId();
00160     _outerMostLayer = _innerMostLayer;
00161     for (unsigned i = 1; i < _links.length(); i++) {
00162         unsigned id = _links[i]->wire()->layerId();
00163         if (id < _innerMostLayer) _innerMostLayer = id;
00164         else if (id > _outerMostLayer) _outerMostLayer = id;
00165     }
00166     _nLayer = _outerMostLayer - _innerMostLayer + 1;
00167 
00168     double centerX = _links[0]->position().x();
00169     HepPoint3D inner = ORIGIN;
00170     unsigned nInner = 0;
00171     unsigned nOuter = 0;
00172     unsigned n = _links.length();
00173     for (unsigned i = 0; i < n; i++) {
00174         const HepPoint3D & tmp = _links[i]->position();
00175 /*//--------------------------------tsf---------------------------------//
00176         const HepPoint3D & p = _links[i]->positionD();
00177         double d = _links[i]->cDrift();
00178         HepPoint3D posOnLine = closestPoint(p, _lineTsf);
00179         HepPoint3D v = (posOnLine - p).unit();
00180         const HepPoint3D tmp = p + d*v;
00181 *///--------------------------------tsf---------------------------------//
00182         _position += tmp;
00183         unsigned id = _links[i]->wire()->layerId();
00184         if (id == _innerMostLayer) {
00185             inner += tmp;
00186             ++nInner;
00187             _inners.append(_links[i]);
00188         }
00189         if (id == _outerMostLayer) {
00190             _outerPosition += tmp;
00191             ++nOuter;
00192             _outers.append(_links[i]);
00193         }
00194     }
00195 //      TTrackBase::dump("hits");
00196 //      std::cout << "0:nin,nout=" << nInner << "," << nOuter << std::endl;
00197 //      std::cout << "0:in,out=" << inner << ", " << _outerPosition << std::endl;
00198 //      std::cout << "0:npos=" << n << std::endl;
00199 //      std::cout << "0:pos=" << _position << std::endl;
00200 
00201     _innerWidth = Width(_inners);
00202     _outerWidth = Width(_outers);
00203     _position *= (1. / float(n));   //tmp for tsf
00204 
00205     inner *= (1. / (float) nInner);
00206     _outerPosition *= (1. / (float) nOuter);
00207     _direction = (inner - _outerPosition).unit();   //tmp for tsf
00208 
00209 /*//----------------------liuqg add for tsf-----------------------//
00210     if (_links.length() > 3) {
00211         _position = ORIGIN;
00212         _direction = ORIGIN;
00213         HepPoint3D nearLine;
00214         nearLine = _lineTsf;
00215 //      nearLine = leastSquaresFitting1(_links, _lineTsf);
00216 //      _lineTsf = nearLine;
00217         if (nearLine.z() != 0) {
00218             HepPoint3D lineVector;  //exchange line to vector.
00219             lineVector.set(-nearLine.y()/nearLine.z(), nearLine.x()/nearLine.z(), 0.);
00220             _direction = (lineVector).unit();
00221         }
00222         else cout<<"nearLine.z == 0"<<endl;
00223         _position = positionTsf(_links, nearLine);
00224         //cout<<"pos of seg .. = "<<_position<<endl;
00225         //cout<<"dir of seg .. = "<<_direction<<endl;
00226     }
00227 *///----------------------liuqg add for tsf-----------------------//
00228 
00229 //      std::cout << "1:in,out=" << inner << ", " << _outerPosition << std::endl;
00230 //      std::cout << "1:dir=" << _direction << std::endl;
00231 //      std::cout << "1:pos=" << _position << std::endl;
00232 
00233     _fitted = true;
00234 }

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

updates duality.

Definition at line 653 of file TSegment.cxx.

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

Referenced by updateType().

00653                                   {
00654     _duality = 0.;
00655     _nDual = 0;
00656     HepPoint3D x[2];
00657     for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00658         AList<TMLink> list = SameLayer(_links, i);
00659         if (i == _innerMostLayer) {
00660             for (unsigned j = 0; j < list.length(); j++)
00661                 x[0] += list[j]->hit()->xyPosition();
00662             x[0] *= 1. / float(list.length());
00663         }
00664         else if (i == _outerMostLayer) {
00665             for (unsigned j = 0; j < list.length(); j++)
00666                 x[1] += list[j]->hit()->xyPosition();
00667             x[1] *= 1. / float(list.length());
00668         }
00669 
00670         if (list.length() == 2) {
00671             if (Width(list) != 2) continue;
00672             const TMDCWireHit * h0 = list[0]->hit();
00673             const TMDCWireHit * h1 = list[1]->hit();
00674 
00675             double distance = (h0->xyPosition() - h1->xyPosition()).mag();
00676             distance = fabs(distance - list[0]->drift() - list[1]->drift());
00677             _duality += distance;
00678             ++_nDual;
00679         }
00680     }
00681     if (_nDual > 0) _duality /= float(_nDual);
00682     _angle = (x[1] - x[0]).unit().dot(x[0].unit());
00683 }

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

updates type.

Definition at line 330 of file TSegment.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().

00330                                {
00331     if (! nLinks()) return;
00332     if (! _fitted) update();
00333 
00334     //...Parameter...
00335     unsigned fat = 3;
00336     unsigned tall = 3;
00337 //    unsigned tall = 2;
00338 
00339     //...Calculate
00340     updateDuality();
00341 
00342     //...Long or short...
00343     if ((_innerWidth < fat) && (_outerWidth < fat)) {
00344         _clusterType = 1;
00345 
00346         //...Check length across a super layer...
00347         if (_nLayer > tall) _clusterType = 2;
00348         return;
00349     }
00350 
00351     //...A...
00352     else if (_outerWidth < fat) {
00353         _clusterType = 3;
00354         return;
00355     }
00356 
00357     //...V...
00358     else if (_innerWidth < fat) {
00359         _clusterType = 4;
00360         return;
00361     }
00362 
00363     //...X or parallel...
00364     else {
00365         bool space = true;
00366         for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
00367             unsigned n = 0;
00368             AList<TMLink> tmp;
00369             for (unsigned j = 0; j < _links.length(); j++)
00370                 if (_links[j]->wire()->layerId() == i) {
00371                     ++n;
00372                     tmp.append(_links[j]);
00373                 }
00374 
00375             if (n == Width(tmp)) {
00376                 space = false;
00377                 break;
00378             }
00379         }
00380 
00381         _clusterType = 5;
00382         if (space) _clusterType = 6;
00383         return;
00384     }
00385 }

unsigned TSegment::width ( void   )  const

returns width.

Definition at line 1101 of file TSegment.cxx.

References genRecEmupikp::i, innerMostLayer(), TTrackBase::links(), outerMostLayer(), SameLayer(), w, and Width().

01101                           {
01102     unsigned maxWidth = 0;
01103     for (unsigned i = innerMostLayer(); i <= outerMostLayer(); i++) {
01104         AList<TMLink> tmp = SameLayer(links(), i);
01105         unsigned w = Width(tmp);
01106         if (w > maxWidth) maxWidth = w;
01107     }
01108     return maxWidth;
01109 }


Member Data Documentation

double TSegment::_angle [mutable, private]

Definition at line 182 of file TSegment.h.

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

TMDC * TSegment::_cdc = 0 [static, private]

Definition at line 188 of file TSegment.h.

Referenced by expandSeg().

unsigned TSegment::_clusterType [mutable, private]

Definition at line 179 of file TSegment.h.

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

HepVector3D TSegment::_direction [mutable, private]

Definition at line 171 of file TSegment.h.

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

double TSegment::_duality [mutable, private]

Definition at line 180 of file TSegment.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(), TSegment0::direction(), direction(), TMLine::distance(), TLine0::distance(), TTrackBase::DropWorst(), TSegment0::dump(), 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(), innerMostLayer(), inners(), TSegment0::innerWidth(), innerWidth(), TTrack::ndf(), TSegment0::outerMostLayer(), outerMostLayer(), outers(), TSegment0::outerWidth(), outerWidth(), TSegment0::position(), 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(), TSegment0::TSegment0(), TTrack::TTrack(), TSegment0::update(), update(), TSegment0::updateType(), and 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<TSegment> TSegment::_innerLinks [private]

Definition at line 164 of file TSegment.h.

Referenced by innerLinks().

unsigned TSegment::_innerMostLayer [mutable, private]

Definition at line 174 of file TSegment.h.

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

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

Definition at line 176 of file TSegment.h.

Referenced by inners(), splitAV(), and update().

unsigned TSegment::_innerWidth [mutable, private]

Definition at line 172 of file TSegment.h.

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

HepPoint3D TSegment::_lineTsf [mutable, private]

Definition at line 186 of file TSegment.h.

Referenced by leastSquaresFitting1(), lineTsf(), positionTsf(), segSalvage(), and solveLR().

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(), TSegment0::dump(), dump(), TMLine::dump(), TLine0::dump(), TCircle::dump(), 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[](), TSegment0::rangeX(), 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(), segSalvage(), TSegment0::solveDualHits(), solveDualHits(), solveLR(), solveThreeHits(), TSegment0::splitAV(), splitAV(), TSegment0::splitComplicated(), splitComplicated(), TSegment0::splitDual(), splitDual(), TSegment0::splitParallel(), splitParallel(), splitTsf(), TSegment(), TSegment0::TSegment0(), TTrack::TTrack(), TTrackBase::update(), TSegment0::update(), update(), TSegment0::updateDuality(), updateDuality(), TSegment0::updateType(), and updateType().

TTrackMC* TTrackBase::_mc [protected, inherited]

Definition at line 165 of file TTrackBase.h.

Referenced by TTrackBase::mc().

unsigned TSegment::_nDual [mutable, private]

Definition at line 181 of file TSegment.h.

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

unsigned TSegment::_nLayer [mutable, private]

Definition at line 178 of file TSegment.h.

Referenced by update(), and updateType().

AList<TSegment> TSegment::_outerLinks [private]

Definition at line 165 of file TSegment.h.

Referenced by outerLinks().

unsigned TSegment::_outerMostLayer [mutable, private]

Definition at line 175 of file TSegment.h.

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

HepPoint3D TSegment::_outerPosition [mutable, private]

Definition at line 170 of file TSegment.h.

Referenced by update().

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

Definition at line 177 of file TSegment.h.

Referenced by outers(), splitAV(), and update().

unsigned TSegment::_outerWidth [mutable, private]

Definition at line 173 of file TSegment.h.

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

HepPoint3D TSegment::_position [mutable, private]

Definition at line 169 of file TSegment.h.

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

unsigned TSegment::_state [private]

Definition at line 166 of file TSegment.h.

Referenced by dump(), and state().

double TSegment::_times[11] [private]

Definition at line 185 of file TSegment.h.

Referenced by appendByLine(), segSalvage(), and TSegment().

AList<TTrack> TSegment::_tracks [private]

Definition at line 163 of file TSegment.h.

Referenced by tracks().

AList<TMLink> TSegment::_usedHitsOfSecond [private]

Definition at line 192 of file TSegment.h.


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