BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/TrkBase/TrkBase/TrkRecoTrk.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: TrkRecoTrk.h,v 1.4 2008/04/01 03:13:19 zhangy Exp $
4//
5// Description:
6// This is the standard reconstructed charged track class. Only a few
7// functions, describing the track as a whole, are in this interface.
8// The remainder of the information can be obtained through one of the
9// four interfaces available here (TrkFit, TrkFitStatus, TrkHitList,
10// TrkExtInterface -- see comments below for details).
11// The interface you get will be for a particular mass hypothesis (if
12// leave out the particle-type argument, you will get the interface for
13// the default type for that track). Some interfaces may not be available
14// for some tracks: some kinds of tracks don't have hit lists, for example,
15// and sometimes fits fail for some hypotheses. In such cases, you get
16// a null pointer returned to you -- so test it.
17// All hypotheses should have the same kind of internal representation
18// A single fit may represent more than one particle
19// type; whichFit(hypo) tells you which fit is actually being used when
20// you ask about "hypo".
21//
22// Track creation:
23// Only FitMaker objects are allowed to create tracks, and only they can
24// change the TrkRep inside an existing track. The RecoTrk ctor permits
25// tracks to be created without Reps, but FitMakers are required (by
26// fiat, not by syntax) to install a Rep in a track before finishing
27// with it.
28//
29// Environment:
30// Software developed for the BaBar Detector at the SLAC B-Factory.
31//
32// Author List:
33// Steve Schaffner
34//------------------------------------------------------------------------
35#ifndef TRKRECOTRK_HH
36#define TRKRECOTRK_HH
37
38#include <map>
39#include <set>
40#include <iosfwd>
41#include <functional>
42#include "TrkBase/TrkId.h"
43//#include "GaudiKernel/ObjectVector.h"
44//#include "GaudiKernel/ContainedObject.h"
45#include "MdcRecoUtil/PdtPid.h"
46#include "TrkBase/TrkDirection.h"
47#include "TrkBase/TrkHitList.h"
48#include "TrkBase/TrkStoreHypo.h"
49#include "TrkBase/TrkFit.h"
50#include "TrkBase/TrkFitStatus.h"
51//yzhang for store to TDS
52#include "MdcRecEvent/RecMdcTrack.h"
53#include "MdcRecEvent/RecMdcHit.h"
54//zhangy
55
56class TrkRep;
57class TrkRepIter;
58class TrkContext;
59class TrkFundHit;
60class TrkExchangePar;
61class TrkVolume;
62class TrkFit;
63class TrkExtInterface;
64class TrkFitStatus;
65class TrkErrCode;
66class BField;
67class TrkIdManager;
68class TrkRecoTrkImpl;
69
70//class TrkRecoTrk : public ContainedObject {//yzhang
72public:
73 typedef std::unary_function<TrkRecoTrk,bool> predicate_type;
74 //*********************************
75 //Global track quantities:
76 //*********************************
77 const TrkId& id() const;
78 PdtPid::PidType defaultType() const {return _defaultType;}
80 int fitNumber(PdtPid::PidType hypo) const;
81 double trackT0() const;
82 const BField& bField() const {return *_bField;}
83
84 TrkErrCode addFit(PdtPid::PidType hypo,bool fit=true); // also fits if requested
85 // Note: resetT0() requires refit to make fit current
86 void resetT0(double time); // also updates hits
87
88 //**********************************************************
89 // To get information about the track as fitted to a particular mass
90 // hypothesis, use one of the following interfaces. In each case,
91 // you can either specify a hypothesis, or omit the argument and get the
92 // default hypothesis for this track.
93 //**********************************************************
94
95 //**********************************************************
96 // (1) Standard information about the fitted track (momentum, position,
97 // charge, chisq etc).
98 //**********************************************************
99 const TrkFit* fitResult() const;
100 const TrkFit* fitResult(PdtPid::PidType hypo) const;
101
102
103 //**********************************************************
104 // (2) Interface for accessing and manipulating the track's list of hits,
105 // and for fitting the track.
106 //**********************************************************
108 const TrkHitList* hits() const {return hits(defaultType());}
110 const TrkHitList* hits(PdtPid::PidType hypo) const;
111
112 // same for hots. This is more direct
114 const TrkHotList* hots() const {return hots(defaultType());}
116 const TrkHotList* hots(PdtPid::PidType hypo) const;
117
118
119
120 //**********************************************************
121 // (3) Specialized information about the fit; of interest mostly to experts
122 //**********************************************************
123 const TrkFitStatus* status() const;
124 const TrkFitStatus* status(PdtPid::PidType hypo) const;
127
128
129 //********************************************************
130 // Attach an extended interface for a specific track representation; returns
131 // false if this track doesn't have the right kind of TrkRep in it.
132 //********************************************************
134 bool attach(TrkExtInterface&, PdtPid::PidType hypo) const;
135
136
137 //**************************************************
138 // Constructors and such (normal ctor is protected)
139 //**************************************************
140 // Copy constructor (leaves original unchanged):
141 TrkRecoTrk(const TrkRecoTrk& right);
142 // Destructor
143 virtual ~TrkRecoTrk();
144 const TrkRecoTrk& operator=(const TrkRecoTrk& right);
145 bool operator==(const TrkRecoTrk &other) const;
146 bool operator<(const TrkRecoTrk &other) const;
147
148 //**********************************************************
149 // Printing
150 //**********************************************************
151 virtual void print(std::ostream& ) const;
152 virtual void printAll(std::ostream& ) const;
153 //**********************************************************
154 // Persistence
155 //**********************************************************
156 // Mark a particular hypo at a particular flight length for storage.
157 // This only works for the mini. Several 'lists' of storage requests
158 // may be associated with each track
159 void markForStore(PdtPid::PidType hypo,double fltlen,const char* listname="Default");
160 const std::set<TrkStoreHypo>& storageRequests(const char* listname="Default") const;
161 // clear out all marked stores
162 void clearStorageRequests(const char* listname="Default");
163 // return the set of fit storage lists known to this track
164 void storageLists(std::set<std::string>& storage) const;
165 //protected: //yzhang debug
166 // TrkRep* getRep(PdtPid::PidType hypo);
167 // const TrkRep* getRep(PdtPid::PidType hypo) const;
168
169private:
170 //*** Data members ***
171 TrkRecoTrkImpl* _impl; // the reps live here; owned by trk;
172 // the reason they're stashed away in this class
173 // is because (for #($*)( reasons) ooddlx must
174 // parse code which needs to know that TrkRecoTrk
175 // inherits from AbsEvtObj -- but ooddlx cannot
176 // deal with somewhat complex ANSI C++ constructions
177 // (e.g. namespaces). Stashing the reps into
178 // TrkRecoTrkImpl, which can be fwd declared as we
179 // only use a pointer to it insures that ooddlx
180 // doesn't get 'confused' by real ANSI C++...
181 TrkId _id; // unique id # in event
182 std::vector<int> _fitNumber; //number of times fit has been altered
183 // keep track of the storage requests, by list. This is sorted first by hypo, then
184 // by flightlength.
185 std::map<std::string,std::set<TrkStoreHypo> > _storage;
186 PdtPid::PidType _defaultType;
187 double _trackT0;
188 const BField* _bField;
189protected:
191 const TrkRep* getRep(PdtPid::PidType hypo) const;
192 // protected functio
193 void copyReps(const TrkRecoTrk& rhs);
194 // The following takes ownership of the argument; it replaces the default Rep
195 // and zeroes others.
196 void setRep(TrkRep*);
197 // Make hypothesis <hypo> use fit currently used for hypo <fit>:
199 void changeDefault(PdtPid::PidType newHypo);
200
201 // return the list of unique distinct Reps attached to this track
202 std::pair<TrkRepIter,TrkRepIter> uniqueReps() const;
203 // return the list of the 5 reps this track is pointing at
204 std::pair<TrkRepIter,TrkRepIter> allReps() const;
205 void setFitNumber(PdtPid::PidType hypo, int newNumber);
206 void updateReps();
207 // addHypoTo takes ownership of newRep!
208 void addHypoTo(TrkRep* newRep, PdtPid::PidType hypo);
209 // a couple of lame functions to limp past inconsistencies between the persistent
210 // design and the tracking design. Ugh
211 void setIdManager(TrkIdManager* idMan);
212 void setBField(const BField* field);
213 // Constructors are protected (construct through FitMaker)
214 TrkRecoTrk(PdtPid::PidType defaultPart, const TrkContext&, double t0);
215 // persistence constructor. BField and IdManager must be set later
216 TrkRecoTrk(PdtPid::PidType defaultPart,long idnum,double t0);
217public:
218 // Access to TrkRep, for testing only; use it at your peril
219 const TrkRep* testRep( PdtPid::PidType hypo ) const { return getRep(hypo);}
220 friend class TrkFitMaker;
221 friend class TrkHitOnTrk;
222 friend class TrkHitList;
223 friend class KalMiniTrkK;
225};
226
227std::ostream& operator<<(std::ostream& os, const TrkRecoTrk& tk);
228
229//typedef ObjectVector<TrkRecoTrk> TrkRecoTrkCol;
230
231#endif
Double_t time
std::ostream & operator<<(std::ostream &os, const TrkRecoTrk &tk)
void repointHypo(PdtPid::PidType hypo, PdtPid::PidType fit)
Definition: TrkRecoTrk.cxx:343
virtual void print(std::ostream &) const
double trackT0() const
Definition: TrkRecoTrk.cxx:140
PdtPid::PidType whichFit(PdtPid::PidType hypo) const
Definition: TrkRecoTrk.cxx:146
void addHypoTo(TrkRep *newRep, PdtPid::PidType hypo)
Definition: TrkRecoTrk.cxx:430
void clearStorageRequests(const char *listname="Default")
Definition: TrkRecoTrk.cxx:480
void changeDefault(PdtPid::PidType newHypo)
Definition: TrkRecoTrk.cxx:296
int fitNumber(PdtPid::PidType hypo) const
Definition: TrkRecoTrk.cxx:157
void setFitNumber(PdtPid::PidType hypo, int newNumber)
Definition: TrkRecoTrk.cxx:424
void markForStore(PdtPid::PidType hypo, double fltlen, const char *listname="Default")
Definition: TrkRecoTrk.cxx:455
void setRep(TrkRep *)
Definition: TrkRecoTrk.cxx:332
const TrkRecoTrk & operator=(const TrkRecoTrk &right)
Definition: TrkRecoTrk.cxx:120
void resetT0(double time)
Definition: TrkRecoTrk.cxx:244
void updateReps()
Definition: TrkRecoTrk.cxx:251
std::pair< TrkRepIter, TrkRepIter > uniqueReps() const
Definition: TrkRecoTrk.cxx:529
bool operator<(const TrkRecoTrk &other) const
Definition: TrkRecoTrk.cxx:267
bool operator==(const TrkRecoTrk &other) const
Definition: TrkRecoTrk.cxx:261
virtual ~TrkRecoTrk()
Definition: TrkRecoTrk.cxx:114
void copyReps(const TrkRecoTrk &rhs)
Definition: TrkRecoTrk.cxx:314
const TrkId & id() const
Definition: TrkRecoTrk.cxx:134
void setIdManager(TrkIdManager *idMan)
Definition: TrkRecoTrk.cxx:436
TrkRep * getRep(PdtPid::PidType hypo)
Definition: TrkRecoTrk.cxx:277
std::pair< TrkRepIter, TrkRepIter > allReps() const
Definition: TrkRecoTrk.cxx:511
const TrkRep * testRep(PdtPid::PidType hypo) const
void storageLists(std::set< std::string > &storage) const
Definition: TrkRecoTrk.cxx:485
std::unary_function< TrkRecoTrk, bool > predicate_type
const TrkFit * fitResult() const
Definition: TrkRecoTrk.cxx:387
virtual void printAll(std::ostream &) const
const TrkFitStatus * status() const
Definition: TrkRecoTrk.cxx:400
bool attach(TrkExtInterface &, PdtPid::PidType hypo)
Definition: TrkRecoTrk.cxx:366
const std::set< TrkStoreHypo > & storageRequests(const char *listname="Default") const
Definition: TrkRecoTrk.cxx:469
void setBField(const BField *field)
Definition: TrkRecoTrk.cxx:449
TrkErrCode addFit(PdtPid::PidType hypo, bool fit=true)
Definition: TrkRecoTrk.cxx:220