BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkHitOnTrk Class Referenceabstract

#include <TrkHitOnTrk.h>

+ Inheritance diagram for TrkHitOnTrk:

Public Types

typedef std::unary_function< TrkHitOnTrk, boolpredicate_type
 

Public Member Functions

 TrkHitOnTrk (const TrkFundHit *, double tolerance)
 
virtual ~TrkHitOnTrk ()
 
virtual TrkHitOnTrkclone (TrkRep *parentRep, const TrkDifTraj *trkTraj=0) const =0
 
const TrkRecoTrkgetParentTrack () const
 
const TrkRepgetParentRep () const
 
PdtPid::PidType particleType () const
 
const TrkFundHithit () const
 
TrkFundHithit ()
 
const TrkDifTrajtrkTraj () const
 
virtual const MdcHitOnTrackmdcHitOnTrack () const
 
virtual const SvtHitOnTrack * svtHitOnTrack () const
 
bool isActive () const
 
bool isUsable () const
 
bool mustUse () const
 
virtual TrkEnums::TrkViewInfo whatView () const =0
 
virtual unsigned layerNumber () const =0
 
double hitRms () const
 
double weight () const
 
double fltLen () const
 
double hitLen () const
 
virtual int ambig () const
 
virtual void setAmbig (int newambig)
 
bool operator== (const TrkHitOnTrk &) const
 
bool operator< (const TrkHitOnTrk &rhs) const
 
virtual const TrajectoryhitTraj () const =0
 
bool hasResidual () const
 
TrkErrCode getFitStuff (HepVector &derivs, double &deltaChi) const
 
TrkErrCode getFitStuff (double &deltaChi) const
 
double resid (bool exclude=false) const
 
bool resid (double &resid, double &residErr, bool exclude=false) const
 
double residual () const
 
virtual bool timeResid (double &resid, double &error) const =0
 
virtual bool timeAbsolute (double &time, double &error) const =0
 
TrkRecoTrkparentTrack () const
 
void setActivity (bool turnOn)
 
void setUsability (int usability)
 
void setFltLen (double f)
 
void setHitRms (double newRms)
 
virtual void print (std::ostream &) const
 
virtual void printAll (std::ostream &) const
 

Protected Member Functions

 TrkHitOnTrk (const TrkHitOnTrk &hitToBeCopied, TrkRep *newRep, const TrkDifTraj *trkTraj=0)
 
void setHitResid (double newResid)
 
TrkRepparentRep () const
 
void setHitLen (double h)
 
void setUsedHit ()
 
void setUnusedHit ()
 
virtual TrkErrCode updateMeasurement (const TrkDifTraj *traj, bool maintainAmbiguity)=0
 
TrkErrCode updatePoca (const TrkDifTraj *trkTraj, bool maintainAmbiguity)
 

Protected Attributes

TrkRep_parentRep
 
TrkFundHit_theHit
 
bool _isActive
 
int _isUsable
 
double _hitRms
 
double _trkLen
 
double _hitLen
 
double _resid
 
const TrkDifTraj_trkTraj
 
TrkPoca_poca
 
double _tolerance
 

Friends

class TrkHotList
 
class TrkRecoTrk
 
class TrkRep
 
class TrkHitOnTrkUpdater
 
class TrkBase::Functors::updateMeasurement
 
class TrkBase::Functors::setActive
 
class TrkBase::Functors::setParent
 

Detailed Description

Definition at line 52 of file TrkHitOnTrk.h.

Member Typedef Documentation

◆ predicate_type

typedef std::unary_function<TrkHitOnTrk,bool> TrkHitOnTrk::predicate_type

Definition at line 58 of file TrkHitOnTrk.h.

Constructor & Destructor Documentation

◆ TrkHitOnTrk() [1/2]

TrkHitOnTrk::TrkHitOnTrk ( const TrkFundHit hit,
double  tolerance 
)

Definition at line 33 of file TrkHitOnTrk.cxx.

33 :
34 _parentRep(0),
35 _theHit(const_cast<TrkFundHit*>(hit)),
36 _isActive(true),
37 _isUsable(true),
38 //make caches invalid
39 _hitRms(-9.e50),
40 _trkLen(0.0),
41 _hitLen(0.0),
42 _trkTraj(0),
43 _poca(0),
44 _tolerance(tolerance)
45{ }
double _hitLen
Definition: TrkHitOnTrk.h:169
TrkRep * _parentRep
Definition: TrkHitOnTrk.h:163
double _trkLen
Definition: TrkHitOnTrk.h:168
const TrkDifTraj * _trkTraj
Definition: TrkHitOnTrk.h:171
const TrkFundHit * hit() const
Definition: TrkHitOnTrk.h:75
TrkPoca * _poca
Definition: TrkHitOnTrk.h:172
bool _isActive
Definition: TrkHitOnTrk.h:165
TrkFundHit * _theHit
Definition: TrkHitOnTrk.h:164
double _tolerance
Definition: TrkHitOnTrk.h:173
double _hitRms
Definition: TrkHitOnTrk.h:167

◆ ~TrkHitOnTrk()

TrkHitOnTrk::~TrkHitOnTrk ( )
virtual

Definition at line 87 of file TrkHitOnTrk.cxx.

88{
89 delete _poca;
90 if ( hit() != 0 && getParentRep() != 0 ) {
92 }
93}
const TrkRep * getParentRep() const
Definition: TrkHitOnTrk.h:73
void setUnusedHit()

◆ TrkHitOnTrk() [2/2]

TrkHitOnTrk::TrkHitOnTrk ( const TrkHitOnTrk hitToBeCopied,
TrkRep newRep,
const TrkDifTraj trkTraj = 0 
)
protected

Definition at line 48 of file TrkHitOnTrk.cxx.

50 : _parentRep(newRep),
51 _theHit(oldHit._theHit),
52 _isActive(oldHit._isActive),
53 _isUsable(oldHit._isUsable),
54 _hitRms(oldHit._hitRms),
55 _trkLen(oldHit._trkLen),
56 _hitLen(oldHit._hitLen),
57 _resid(9999.9),
58 _trkTraj(0),
59 _poca(0),
60 _tolerance(oldHit._tolerance)
61{
62 assert (0 != newRep);
63 if( oldHit._trkTraj!=0 && trkTraj!=0 && oldHit._trkTraj == trkTraj ) {
64 // re-use cache as traj are the same
65 _resid=oldHit._resid;
67 _poca = (oldHit._poca==0 ? 0 :new TrkPoca(*oldHit._poca));
68 } else {
69 double fl = oldHit.fltLen();
70 double dum;
71 const TrkSimpTraj *t1= (oldHit._trkTraj==0?0:oldHit._trkTraj->localTrajectory(fl,dum));
72 const TrkSimpTraj *t2= (trkTraj==0?0:trkTraj->localTrajectory(fl,dum));
73 if( t1 != 0 && t2 != 0 && t1->parameters()->parameter() == t2->parameters()->parameter() ) {
74 // re-use cache as traj are sufficiently equiv
75 _resid=oldHit._resid;
77 _poca = (oldHit._poca==0 ? 0: new TrkPoca(*oldHit._poca));
78
79 }
80 }
81 // Only record hots if on default TrkRep
83 setUsedHit();
84 }
85}
HepVector & parameter()
Definition: DifIndepPar.h:51
virtual const TrkSimpTraj * localTrajectory(double fltLen, double &localFlt) const =0
const TrkRecoTrk * getParentTrack() const
double _resid
Definition: TrkHitOnTrk.h:170
void setUsedHit()
const TrkDifTraj * trkTraj() const
Definition: TrkHitOnTrk.h:77
PdtPid::PidType defaultType() const
Definition: TrkRecoTrk.h:78
virtual PdtPid::PidType particleType() const
Definition: TrkRep.cxx:308
TrkParams * parameters()
Definition: TrkSimpTraj.h:80

Member Function Documentation

◆ ambig()

int TrkHitOnTrk::ambig ( ) const
virtual

Reimplemented in MdcHitOnTrack.

Definition at line 181 of file TrkHitOnTrk.cxx.

182{
183 return 0;// by default no ambiguity
184}

◆ clone()

virtual TrkHitOnTrk * TrkHitOnTrk::clone ( TrkRep parentRep,
const TrkDifTraj trkTraj = 0 
) const
pure virtual

◆ fltLen()

◆ getFitStuff() [1/2]

TrkErrCode TrkHitOnTrk::getFitStuff ( double &  deltaChi) const

Definition at line 271 of file TrkHitOnTrk.cxx.

272{
273 assert (_trkTraj == &(getParentRep()->traj()));
274 deltaChi=_resid/hitRms(); // NOTE: use _INTERNAL_ residual
276}
double hitRms() const
Definition: TrkHitOnTrk.h:89

◆ getFitStuff() [2/2]

TrkErrCode TrkHitOnTrk::getFitStuff ( HepVector &  derivs,
double &  deltaChi 
) const

Definition at line 248 of file TrkHitOnTrk.cxx.

249{
250 if (_poca==0 || _poca->status().failure()) {
252 }
253 // FIXME: I wish I could tell poca to NOT iterate
254 // and ONLY compute the distance & derivatives...
256 if (poca.status().failure()) {
258 }
259 if (derivs.num_row() != 0) {
260 poca.fetchDerivs(derivs);
261 } else {
262 derivs = poca.derivs();
263 }
264 double sigInv = 1. / hitRms();
265 deltaChi = _resid * sigInv; // NOTE: use _INTERNAL_ residual
266 derivs *= sigInv;
268}
int failure() const
Definition: TrkErrCode.h:61
double fltLen() const
Definition: TrkHitOnTrk.h:91
virtual const Trajectory * hitTraj() const =0
double hitLen() const
Definition: TrkHitOnTrk.h:92
const TrkErrCode & status() const
Definition: TrkPocaBase.h:62

Referenced by TrkHelixRep::resid(), and MdcTrack::storeTrack().

◆ getParentRep()

◆ getParentTrack()

const TrkRecoTrk * TrkHitOnTrk::getParentTrack ( ) const

Definition at line 152 of file TrkHitOnTrk.cxx.

153{
154 return getParentRep()->parentTrack();
155}
TrkRecoTrk * parentTrack()
Definition: TrkRep.h:82

Referenced by TrkHitOnTrk().

◆ hasResidual()

bool TrkHitOnTrk::hasResidual ( ) const
inline

Definition at line 104 of file TrkHitOnTrk.h.

104{ return _poca != 0; }

Referenced by TrkBase::Predicates::hasResidual::operator()(), and TrkRep::resid().

◆ hit() [1/2]

TrkFundHit * TrkHitOnTrk::hit ( )
inline

Definition at line 76 of file TrkHitOnTrk.h.

76{return _theHit;}

◆ hit() [2/2]

◆ hitLen()

double TrkHitOnTrk::hitLen ( ) const
inline

◆ hitRms()

double TrkHitOnTrk::hitRms ( ) const
inline

◆ hitTraj()

virtual const Trajectory * TrkHitOnTrk::hitTraj ( ) const
pure virtual

Implemented in MdcHitOnTrack, and TrkBmSpotOnTrk.

Referenced by getFitStuff(), and updatePoca().

◆ isActive()

◆ isUsable()

bool TrkHitOnTrk::isUsable ( ) const
inline

Definition at line 201 of file TrkHitOnTrk.h.

201{return (_isUsable > 0);}

Referenced by setActivity(), and setUsability().

◆ layerNumber()

virtual unsigned TrkHitOnTrk::layerNumber ( ) const
pure virtual

◆ mdcHitOnTrack()

const MdcHitOnTrack * TrkHitOnTrk::mdcHitOnTrack ( ) const
virtual

◆ mustUse()

bool TrkHitOnTrk::mustUse ( ) const
inline

Definition at line 202 of file TrkHitOnTrk.h.

202{return (_isUsable > 1);}

Referenced by setUsability().

◆ operator<()

bool TrkHitOnTrk::operator< ( const TrkHitOnTrk rhs) const
inline

Definition at line 99 of file TrkHitOnTrk.h.

99{ return fltLen()<rhs.fltLen();}

◆ operator==()

bool TrkHitOnTrk::operator== ( const TrkHitOnTrk rhs) const

Definition at line 175 of file TrkHitOnTrk.cxx.

176{
177 return this == &rhs;
178}

◆ parentRep()

TrkRep * TrkHitOnTrk::parentRep ( ) const
inlineprotected

Definition at line 177 of file TrkHitOnTrk.h.

177{ return _parentRep;}

Referenced by parentTrack(), TrkRep::resid(), setActivity(), and setUsability().

◆ parentTrack()

TrkRecoTrk * TrkHitOnTrk::parentTrack ( ) const

Definition at line 146 of file TrkHitOnTrk.cxx.

147{
148 return parentRep()->parentTrack();
149}
TrkRep * parentRep() const
Definition: TrkHitOnTrk.h:177

Referenced by MdcTrackListBase::arbitrateHits(), and TrkBase::Predicates::isHotOnTrack::operator()().

◆ particleType()

PdtPid::PidType TrkHitOnTrk::particleType ( ) const

Definition at line 158 of file TrkHitOnTrk.cxx.

159{
160 return getParentRep()->particleType();
161}

◆ print()

void TrkHitOnTrk::print ( std::ostream &  ) const
virtual

Definition at line 131 of file TrkHitOnTrk.cxx.

132{
133 hit()->printAll(o);
134 o << " hitlen " << hitLen()
135 << " fltlen " << fltLen()
136 << " act " << (isActive() != 0) << endl;
137}
virtual void printAll(std::ostream &os) const
Definition: TrkFundHit.cxx:103
bool isActive() const
Definition: TrkHitOnTrk.h:200

Referenced by printAll().

◆ printAll()

void TrkHitOnTrk::printAll ( std::ostream &  ) const
virtual

Definition at line 140 of file TrkHitOnTrk.cxx.

141{
142 print(o);
143}
virtual void print(std::ostream &) const

◆ resid() [1/2]

double TrkHitOnTrk::resid ( bool  exclude = false) const

Definition at line 191 of file TrkHitOnTrk.cxx.

192{
193 double r(-99999.9),re(-9999.9);
194 bool s=getParentRep()->resid(this,r,re,exclude);
195 if (!s && r<-99999.8) {
196#ifdef MDCPATREC_ROUTINE
197 std::cout<<"ErrMsg(routine) "
198 << "error calling parentRep()->residual()" << std::endl;
199#endif
200 }
201 return r;
202}
XmlRpcServer s
Definition: HelloServer.cpp:11
virtual bool resid(const TrkHitOnTrk *theHot, double &residual, double &residErr, bool exclude=false) const
Definition: TrkRep.cxx:348

Referenced by MdcTrackListBase::arbitrateHits(), MdcHitOnTrack::dcaToWire(), MdcTrkRecon::fillTrackList(), resid(), and MdcTrack::storeTrack().

◆ resid() [2/2]

bool TrkHitOnTrk::resid ( double &  resid,
double &  residErr,
bool  exclude = false 
) const

Definition at line 205 of file TrkHitOnTrk.cxx.

206{
207 assert(getParentRep()!=0);
208 return getParentRep()->resid(this,resid,residErr,exclude);
209}
double resid(bool exclude=false) const

◆ residual()

double TrkHitOnTrk::residual ( ) const

Definition at line 212 of file TrkHitOnTrk.cxx.

213{
214 assert (_trkTraj == &(getParentRep()->traj()));
215 return _resid;
216}

Referenced by TrkHelixRep::resid(), and TrkRep::resid().

◆ setActivity()

void TrkHitOnTrk::setActivity ( bool  turnOn)

Definition at line 96 of file TrkHitOnTrk.cxx.

97{
98 if (!isUsable() || isActive()==turnOn) return;
99 if (getParentRep() != 0) { // needed until Rep-less HoTs go away
100 turnOn ? parentRep()->activateHot(this)
101 : parentRep()->deactivateHot(this);
102 } else {
103 _isActive = turnOn;
104 }
105}
bool isUsable() const
Definition: TrkHitOnTrk.h:201
virtual void deactivateHot(TrkHitOnTrk *theHot)
Definition: TrkRep.cxx:167
virtual void activateHot(TrkHitOnTrk *theHot)
Definition: TrkRep.cxx:154

Referenced by MdcTrackListBase::arbitrateHits(), MdcTrackList::dropMultiHotInLayer(), and MdcTrackList::pickHits().

◆ setAmbig()

void TrkHitOnTrk::setAmbig ( int  newambig)
virtual

Reimplemented in MdcHitOnTrack.

Definition at line 187 of file TrkHitOnTrk.cxx.

188{} // by default nothing to set

Referenced by updatePoca().

◆ setFltLen()

void TrkHitOnTrk::setFltLen ( double  f)
inline

◆ setHitLen()

void TrkHitOnTrk::setHitLen ( double  h)
inlineprotected

Definition at line 178 of file TrkHitOnTrk.h.

178{_hitLen = h;}

Referenced by MdcHitOnTrack::MdcHitOnTrack().

◆ setHitResid()

void TrkHitOnTrk::setHitResid ( double  newResid)
inlineprotected

◆ setHitRms()

void TrkHitOnTrk::setHitRms ( double  newRms)
inline

Definition at line 154 of file TrkHitOnTrk.h.

154{_hitRms = newRms;}

Referenced by MdcHitOnTrack::MdcHitOnTrack(), and TrkBmSpotOnTrk::updateMeasurement().

◆ setUnusedHit()

void TrkHitOnTrk::setUnusedHit ( )
protected

Definition at line 170 of file TrkHitOnTrk.cxx.

171{
172 if (hit() != 0) hit()->setUnusedHit(this);
173}
const TrkHitOnTrk * setUnusedHit(const TrkHitOnTrk *hit)
Definition: TrkFundHit.cxx:75

Referenced by TrkRecoTrk::changeDefault(), and ~TrkHitOnTrk().

◆ setUsability()

void TrkHitOnTrk::setUsability ( int  usability)

Definition at line 108 of file TrkHitOnTrk.cxx.

109{
110 _isUsable = usability;
111 if (isActive() && !isUsable()) {
112 _isActive = false;
113 if(getParentRep() != 0)parentRep()->deactivateHot(this);
114 }
115 if (!isActive() && mustUse()) {
116 _isActive = true;
117 if(getParentRep() != 0)parentRep()->activateHot(this);
118 }
119}
bool mustUse() const
Definition: TrkHitOnTrk.h:202

Referenced by MdcTrackList::pickHits(), and MdcHitOnTrack::updateMeasurement().

◆ setUsedHit()

void TrkHitOnTrk::setUsedHit ( )
protected

Definition at line 164 of file TrkHitOnTrk.cxx.

165{
166 if (hit() != 0) hit()->setUsedHit(this);
167}
const TrkHitOnTrk * setUsedHit(const TrkHitOnTrk *hit)
Definition: TrkFundHit.cxx:58

Referenced by TrkRecoTrk::changeDefault(), and TrkHitOnTrk().

◆ svtHitOnTrack()

const SvtHitOnTrack * TrkHitOnTrk::svtHitOnTrack ( ) const
virtual

◆ timeAbsolute()

virtual bool TrkHitOnTrk::timeAbsolute ( double &  time,
double &  error 
) const
pure virtual

Implemented in MdcHitOnTrack, and TrkBmSpotOnTrk.

◆ timeResid()

virtual bool TrkHitOnTrk::timeResid ( double &  resid,
double &  error 
) const
pure virtual

Implemented in MdcHitOnTrack, and TrkBmSpotOnTrk.

◆ trkTraj()

const TrkDifTraj * TrkHitOnTrk::trkTraj ( ) const
inline

◆ updateMeasurement()

virtual TrkErrCode TrkHitOnTrk::updateMeasurement ( const TrkDifTraj traj,
bool  maintainAmbiguity 
)
protectedpure virtual

◆ updatePoca()

TrkErrCode TrkHitOnTrk::updatePoca ( const TrkDifTraj trkTraj,
bool  maintainAmbiguity 
)
protected

Definition at line 219 of file TrkHitOnTrk.cxx.

220{
222 if (_poca==0) {
223 _poca = new TrkPoca(*_trkTraj,fltLen(),
225 } else {
228 }
229 if(_poca->status().failure()) {
230 if(isActive()){
231#ifdef MDCPATREC_WARNING
232 std::cout<<"ErrMsg(warning) "
233 << " TrkPoca failed in TrkHitOnTrk::updatePoca"
234 << std::endl;
235#endif
236 }
237 delete _poca; _poca=0;
239 }
240 _trkLen = _poca->flt1();
241 _hitLen = _poca->flt2();
242 double dca=_poca->doca();
243 if (!maintainAmb) setAmbig(dca>0?+1:-1);
245}
virtual const TrkDifTraj & traj() const =0
virtual void setAmbig(int newambig)
double flt2() const
Definition: TrkPocaBase.h:68
double flt1() const
Definition: TrkPocaBase.h:65
double doca() const
Definition: TrkPoca.h:56

Referenced by MdcHitOnTrack::updateMeasurement(), and TrkBmSpotOnTrk::updateMeasurement().

◆ weight()

double TrkHitOnTrk::weight ( ) const

Definition at line 122 of file TrkHitOnTrk.cxx.

123{
124 // could be cached
125 double rms=hitRms();
126 assert(rms > 0);
127 return double(1) / ( rms * rms );
128}

Referenced by MdcTrackListBase::arbitrateHits().

◆ whatView()

virtual TrkEnums::TrkViewInfo TrkHitOnTrk::whatView ( ) const
pure virtual

Friends And Related Function Documentation

◆ TrkBase::Functors::setActive

friend class TrkBase::Functors::setActive
friend

Definition at line 192 of file TrkHitOnTrk.h.

◆ TrkBase::Functors::setParent

friend class TrkBase::Functors::setParent
friend

Definition at line 193 of file TrkHitOnTrk.h.

◆ TrkBase::Functors::updateMeasurement

Definition at line 191 of file TrkHitOnTrk.h.

◆ TrkHitOnTrkUpdater

friend class TrkHitOnTrkUpdater
friend

Definition at line 190 of file TrkHitOnTrk.h.

◆ TrkHotList

friend class TrkHotList
friend

Definition at line 53 of file TrkHitOnTrk.h.

◆ TrkRecoTrk

friend class TrkRecoTrk
friend

Definition at line 54 of file TrkHitOnTrk.h.

◆ TrkRep

friend class TrkRep
friend

Definition at line 56 of file TrkHitOnTrk.h.

Member Data Documentation

◆ _hitLen

double TrkHitOnTrk::_hitLen
protected

Definition at line 169 of file TrkHitOnTrk.h.

Referenced by hitLen(), setHitLen(), and updatePoca().

◆ _hitRms

double TrkHitOnTrk::_hitRms
protected

Definition at line 167 of file TrkHitOnTrk.h.

Referenced by hitRms(), and setHitRms().

◆ _isActive

bool TrkHitOnTrk::_isActive
protected

Definition at line 165 of file TrkHitOnTrk.h.

Referenced by isActive(), setActivity(), and setUsability().

◆ _isUsable

int TrkHitOnTrk::_isUsable
protected

Definition at line 166 of file TrkHitOnTrk.h.

Referenced by isUsable(), mustUse(), and setUsability().

◆ _parentRep

TrkRep* TrkHitOnTrk::_parentRep
protected

Definition at line 163 of file TrkHitOnTrk.h.

Referenced by getParentRep(), parentRep(), and TrkHitOnTrkUpdater::setParent().

◆ _poca

◆ _resid

double TrkHitOnTrk::_resid
protected

Definition at line 170 of file TrkHitOnTrk.h.

Referenced by getFitStuff(), residual(), setHitResid(), and TrkHitOnTrk().

◆ _theHit

TrkFundHit* TrkHitOnTrk::_theHit
protected

Definition at line 164 of file TrkHitOnTrk.h.

Referenced by hit().

◆ _tolerance

double TrkHitOnTrk::_tolerance
protected

Definition at line 173 of file TrkHitOnTrk.h.

Referenced by MdcHitOnTrack::dcaToWire(), getFitStuff(), and updatePoca().

◆ _trkLen

double TrkHitOnTrk::_trkLen
protected

Definition at line 168 of file TrkHitOnTrk.h.

Referenced by fltLen(), setFltLen(), and updatePoca().

◆ _trkTraj

const TrkDifTraj* TrkHitOnTrk::_trkTraj
protected

Definition at line 171 of file TrkHitOnTrk.h.

Referenced by getFitStuff(), residual(), TrkHitOnTrk(), trkTraj(), and updatePoca().


The documentation for this class was generated from the following files: