CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkRep.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: TrkRep.h,v 1.2 2006/03/28 01:02:36 zhangy Exp $
4//
5// Description: Base class for internal track representation classes -- e.g.
6// HelixRep, KalRep. Owns and maintains a TrkHotList; and keeps a
7// pointer to the track that owns the Rep.
8//
9// Environment:
10// Software developed for the BaBar Detector at the SLAC B-Factory.
11//
12// Authors: Steve Schaffner
13//
14//------------------------------------------------------------------------
15
16#ifndef TRKREP_HH
17#define TRKREP_HH
18#include <memory>
19#include "MdcRecoUtil/PdtPid.h"
22#include "TrkBase/TrkFit.h"
23#include "TrkBase/TrkHotList.h"
25// These 3 are needed for the OSF compiler:
28#include "CLHEP/Vector/ThreeVector.h"
29// the following is needed by the Sun compiler
31
32class TrkHitOnTrk;
33#include <iosfwd>
34class TrkDifTraj;
35class TrkErrCode;
36class TrkExchangePar;
37class TrkRecoTrk;
38class TrkVolume;
39class IfdKey;
40class TrkContext;
41
42// Class interface //
43class TrkRep : public TrkFitStatus, public TrkFit, public TrkHitOnTrkUpdater {
44
45public:
46 //******************************************
47 // Constructors and such
48 //******************************************
49// construct from a hotlist -- The rep will not take ownership of anything passed
50// -- it will _clone_ the hots passed on inHots
51 TrkRep(const TrkHotList& inHots, TrkRecoTrk* trk,
52 PdtPid::PidType hypo);
53 TrkRep(TrkHotList& inHots, TrkRecoTrk* trk,
54 PdtPid::PidType hypo, bool stealHots=false);
55// construct from a hotlist -- The rep will always _TAKE OWNERSHIP_ of the hots
56// and if takeownership==true, ALSO of the list.
57 TrkRep(const TrkHotList* inHots, TrkRecoTrk* trk,
58 PdtPid::PidType hypo);
59 TrkRep(TrkHotList* inHots, TrkRecoTrk* trk,
60 PdtPid::PidType hypo, bool takeownership=false);
61 // For reps w/o hits stored
62 TrkRep(TrkRecoTrk* trk, PdtPid::PidType hypo, int nAct, int nSvt,
63 int nMdc, double startFoundRange, double endFoundRange);
64// rep without explicit hotlist
65 TrkRep(TrkRecoTrk* trk, PdtPid::PidType hypo, bool createHotList=false);
66 // copy ctor
67 TrkRep(const TrkRep& oldRep, TrkRecoTrk* trk, PdtPid::PidType hypo);
68 virtual ~TrkRep();
69 // clone() used to copy tracks; cloneNewHypo() for new hypos within track
70 virtual TrkRep* clone(TrkRecoTrk* newTrack) const = 0;
72 bool operator== (const TrkRep&);
73
74 //******************************************
75 // Global quantities:
76 //******************************************
77 virtual ChisqConsistency chisqConsistency() const;
78 virtual int nActive() const;
79 virtual int nSvt() const;
80 virtual int nMdc() const;
81 virtual PdtPid::PidType particleType() const;
82 TrkRecoTrk* parentTrack() {return _parentTrack;}
83 const TrkRecoTrk* parentTrack() const {return _parentTrack;}
84 double startValidRange() const;
85 double endValidRange() const;
86 virtual double startFoundRange() const;
87 virtual double endFoundRange() const;
88 virtual const IfdKey& myKey() const;
89 double trackT0() const;
90
91 //******************************************
92 // Information about track at a given position
93 //******************************************
94 virtual HepPoint3D position(double fltL) const;
95 virtual Hep3Vector direction(double fltL) const;
96 virtual double arrivalTime(double fltL) const;
97 virtual BesPointErr positionErr(double fltL) const;
98 virtual BesVectorErr directionErr(double fltL) const;
99
100 //******************************************
101 // Hit (list) handling
102 //******************************************
103 // Simple implementations of these are present in the base class;
104 // complicated reps (e.g. Kalman) may wish to override.
105 virtual void addHot(TrkHitOnTrk *theHot);
106 virtual void removeHot(TrkHitOnTrk *theHot);
107 virtual void activateHot(TrkHitOnTrk *theHot);
108 virtual void deactivateHot(TrkHitOnTrk *theHot);
109 virtual TrkHotList* hotList() {return _hotList.get();}
110 virtual const TrkHotList* hotList() const {return _hotList.get();}
111 virtual void updateHots();
112 virtual bool resid(const TrkHitOnTrk *theHot,
113 double &residual, double &residErr,
114 bool exclude=false) const;
115
116 // Distinguishes hotLists that actually hold hits from those that just hold
117 // info (e.g. nActive) about the hits used to create the fit
118 bool hitCapable() const {return hotList()->hitCapable();}
119
120
121 //******************************************
122 // Fitting stuff
123 //******************************************
124 virtual TrkErrCode fit() = 0;
125
126protected:
127 TrkRep& operator= (const TrkRep&);
128 const TrkContext& trkContext() const;
129
130 //protected, not private, so derived classes can create in copy ctor
131 std::auto_ptr<TrkHotList> _hotList;
132
133private:
134 void init(TrkRecoTrk* trk, PdtPid::PidType hypo);
135
136 PdtPid::PidType _partHypo;
137 TrkRecoTrk* _parentTrack;
138 mutable double _betainv; // cache for arrivalTime
139};
140
141#endif
Definition: IfdKey.h:48
PidType
Definition: PdtPid.h:11
Definition: TrkFit.h:23
virtual bool hitCapable() const =0
Definition: TrkRep.h:43
std::auto_ptr< TrkHotList > _hotList
Definition: TrkRep.h:131
virtual void removeHot(TrkHitOnTrk *theHot)
Definition: TrkRep.cxx:147
virtual TrkRep * cloneNewHypo(PdtPid::PidType hypo)=0
virtual HepPoint3D position(double fltL) const
Definition: TrkRep.cxx:180
double trackT0() const
Definition: TrkRep.cxx:208
virtual ~TrkRep()
Definition: TrkRep.cxx:129
virtual double arrivalTime(double fltL) const
Definition: TrkRep.cxx:192
TrkRecoTrk * parentTrack()
Definition: TrkRep.h:82
virtual int nSvt() const
Definition: TrkRep.cxx:336
virtual int nActive() const
Definition: TrkRep.cxx:330
const TrkRecoTrk * parentTrack() const
Definition: TrkRep.h:83
virtual BesPointErr positionErr(double fltL) const
Definition: TrkRep.cxx:214
bool hitCapable() const
Definition: TrkRep.h:118
virtual double endFoundRange() const
Definition: TrkRep.cxx:302
virtual TrkErrCode fit()=0
TrkRep & operator=(const TrkRep &)
Definition: TrkRep.cxx:111
virtual PdtPid::PidType particleType() const
Definition: TrkRep.cxx:308
virtual void deactivateHot(TrkHitOnTrk *theHot)
Definition: TrkRep.cxx:167
virtual TrkRep * clone(TrkRecoTrk *newTrack) const =0
virtual const IfdKey & myKey() const
Definition: TrkRep.cxx:314
virtual void activateHot(TrkHitOnTrk *theHot)
Definition: TrkRep.cxx:154
virtual bool resid(const TrkHitOnTrk *theHot, double &residual, double &residErr, bool exclude=false) const
Definition: TrkRep.cxx:348
virtual void updateHots()
Definition: TrkRep.cxx:323
double endValidRange() const
Definition: TrkRep.cxx:290
virtual ChisqConsistency chisqConsistency() const
Definition: TrkRep.cxx:363
double startValidRange() const
Definition: TrkRep.cxx:284
const TrkContext & trkContext() const
virtual BesVectorErr directionErr(double fltL) const
Definition: TrkRep.cxx:272
virtual const TrkHotList * hotList() const
Definition: TrkRep.h:110
virtual TrkHotList * hotList()
Definition: TrkRep.h:109
virtual void addHot(TrkHitOnTrk *theHot)
Definition: TrkRep.cxx:140
virtual double startFoundRange() const
Definition: TrkRep.cxx:296
virtual Hep3Vector direction(double fltL) const
Definition: TrkRep.cxx:186
virtual int nMdc() const
Definition: TrkRep.cxx:342
bool operator==(const TrkRep &)
Definition: TrkRep.cxx:134