00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef TRKHITONTRK_HH
00026 #define TRKHITONTRK_HH
00027 #include "MdcRecoUtil/PdtPid.h"
00028 #include "TrkBase/TrkEnums.h"
00029 #include <iostream>
00030 #include <functional>
00031 #include "CLHEP/Matrix/Vector.h"
00032 using CLHEP::HepVector;
00033 class TrkFundHit;
00034 class MdcHit;
00035 class MdcHitOnTrack;
00036 class SvtHitOnTrack;
00037 class TrkRep;
00038 class TrkDifTraj;
00039 class Trajectory;
00040 class TrkRecoTrk;
00041 class TrkErrCode;
00042 class TrkDifPoca;
00043 class TrkPoca;
00044
00045 class TrkHitOnTrkUpdater;
00046 namespace TrkBase { namespace Functors {
00047 class updateMeasurement;
00048 class setActive;
00049 class setParent;
00050 } }
00051
00052 class TrkHitOnTrk {
00053 friend class TrkHotList;
00054 friend class TrkRecoTrk;
00055
00056 friend class TrkRep;
00057 public:
00058 typedef std::unary_function<TrkHitOnTrk,bool> predicate_type;
00059
00060
00061
00062 TrkHitOnTrk(const TrkFundHit*,double tolerance);
00063 virtual ~TrkHitOnTrk();
00064 virtual TrkHitOnTrk* clone(TrkRep* parentRep, const TrkDifTraj* trkTraj=0) const = 0;
00065 protected:
00066 TrkHitOnTrk(const TrkHitOnTrk& hitToBeCopied, TrkRep* newRep, const TrkDifTraj* trkTraj=0 );
00067 public:
00068
00069
00070
00071
00072 const TrkRecoTrk* getParentTrack() const;
00073 const TrkRep* getParentRep() const {return _parentRep;}
00074 PdtPid::PidType particleType() const;
00075 const TrkFundHit* hit() const {return _theHit;}
00076 TrkFundHit* hit() {return _theHit;}
00077 const TrkDifTraj* trkTraj() const { return _trkTraj;}
00078
00079
00080 virtual const MdcHitOnTrack* mdcHitOnTrack() const;
00081 virtual const SvtHitOnTrack* svtHitOnTrack() const;
00082
00083
00084 inline bool isActive() const;
00085 inline bool isUsable() const;
00086 inline bool mustUse() const;
00087 virtual TrkEnums::TrkViewInfo whatView() const = 0;
00088 virtual unsigned layerNumber() const = 0;
00089 double hitRms() const {return _hitRms;}
00090 double weight() const;
00091 double fltLen() const {return _trkLen;}
00092 double hitLen() const {return _hitLen;}
00093
00094
00095 virtual int ambig() const;
00096 virtual void setAmbig(int newambig);
00097
00098 bool operator==(const TrkHitOnTrk&) const;
00099 bool operator< (const TrkHitOnTrk& rhs) const { return fltLen()<rhs.fltLen();}
00100
00101 virtual const Trajectory* hitTraj() const = 0;
00102
00103
00104 bool hasResidual() const { return _poca != 0; }
00105
00106
00107
00108
00109 TrkErrCode getFitStuff(HepVector& derivs, double& deltaChi) const;
00110 TrkErrCode getFitStuff(double& deltaChi) const;
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 double resid(bool exclude=false) const;
00121
00122
00123
00124
00125
00126 bool resid(double &resid, double &residErr, bool exclude=false) const;
00127
00128
00129 double residual() const;
00130
00131
00132
00133 virtual bool timeResid(double& resid, double& error) const = 0;
00134
00135 virtual bool timeAbsolute(double& time,double& error) const = 0;
00136
00137 TrkRecoTrk* parentTrack() const;
00138
00139
00140
00141
00142 void setActivity(bool turnOn);
00143
00144
00145 void setUsability(int usability);
00146
00147 void setFltLen(double f) {_trkLen = f;}
00148
00149
00150
00151
00152
00153
00154 void setHitRms(double newRms) {_hitRms = newRms;}
00155
00156
00157
00158
00159 virtual void print(std::ostream& ) const;
00160 virtual void printAll(std::ostream& ) const;
00161
00162 protected:
00163 TrkRep* _parentRep;
00164 TrkFundHit* _theHit;
00165 bool _isActive;
00166 int _isUsable;
00167 double _hitRms;
00168 double _trkLen;
00169 double _hitLen;
00170 double _resid;
00171 const TrkDifTraj *_trkTraj;
00172 TrkPoca *_poca;
00173 double _tolerance;
00174
00175 protected:
00176 void setHitResid(double newResid) {_resid = newResid;}
00177 TrkRep* parentRep() const { return _parentRep;}
00178 void setHitLen(double h) {_hitLen = h;}
00179 void setUsedHit();
00180 void setUnusedHit();
00181 virtual TrkErrCode updateMeasurement(const TrkDifTraj* traj, bool maintainAmbiguity) = 0;
00182 TrkErrCode updatePoca(const TrkDifTraj *trkTraj, bool maintainAmbiguity) ;
00183 private:
00184 TrkHitOnTrk& operator= (const TrkHitOnTrk&);
00185 TrkHitOnTrk(const TrkHitOnTrk& hit);
00186
00187
00188
00189
00190 friend class TrkHitOnTrkUpdater;
00191 friend class TrkBase::Functors::updateMeasurement;
00192 friend class TrkBase::Functors::setActive;
00193 friend class TrkBase::Functors::setParent;
00194
00195 TrkHitOnTrk *setActive(bool active) { _isActive = active; return this; }
00196 TrkHitOnTrk *setParent(TrkRep* rep) { _parentRep = rep; return this; }
00197 };
00198
00199
00200 inline bool TrkHitOnTrk::isActive() const {return _isActive;}
00201 inline bool TrkHitOnTrk::isUsable() const {return (_isUsable > 0);}
00202 inline bool TrkHitOnTrk::mustUse() const {return (_isUsable > 1);}
00203
00204 std::ostream& operator<<(std::ostream& o, const TrkHitOnTrk& x) ;
00205 #endif