BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/TrkBase/include/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 "TrkBase/TrkId.h"
39#include <functional>
40#include <iosfwd>
41#include <map>
42#include <set>
43// #include "GaudiKernel/ObjectVector.h"
44// #include "GaudiKernel/ContainedObject.h"
45#include "MdcRecoUtil/PdtPid.h"
46#include "TrkBase/TrkDirection.h"
47#include "TrkBase/TrkFit.h"
48#include "TrkBase/TrkFitStatus.h"
49#include "TrkBase/TrkHitList.h"
50#include "TrkBase/TrkStoreHypo.h"
51// yzhang for store to TDS
52#include "MdcRecEvent/RecMdcHit.h"
53#include "MdcRecEvent/RecMdcTrack.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 TrkIdManager;
67class TrkRecoTrkImpl;
68namespace MdcPatRec {
69 class BField;
70}
71
72// class TrkRecoTrk : public ContainedObject {//yzhang
73class TrkRecoTrk {
74public:
75 typedef std::unary_function<TrkRecoTrk, bool> predicate_type;
76 //*********************************
77 // Global track quantities:
78 //*********************************
79 const TrkId& id() const;
80 PdtPid::PidType defaultType() const { return _defaultType; }
82 int fitNumber( PdtPid::PidType hypo ) const;
83 double trackT0() const;
84 const MdcPatRec::BField& bField() const { return *_bField; }
85
86 TrkErrCode addFit( PdtPid::PidType hypo, bool fit = true ); // also fits if requested
87 // Note: resetT0() requires refit to make fit current
88 void resetT0( double time ); // also updates hits
89
90 //**********************************************************
91 // To get information about the track as fitted to a particular mass
92 // hypothesis, use one of the following interfaces. In each case,
93 // you can either specify a hypothesis, or omit the argument and get the
94 // default hypothesis for this track.
95 //**********************************************************
96
97 //**********************************************************
98 // (1) Standard information about the fitted track (momentum, position,
99 // charge, chisq etc).
100 //**********************************************************
101 const TrkFit* fitResult() const;
102 const TrkFit* fitResult( PdtPid::PidType hypo ) const;
103
104 //**********************************************************
105 // (2) Interface for accessing and manipulating the track's list of hits,
106 // and for fitting the track.
107 //**********************************************************
108 TrkHitList* hits() { return hits( defaultType() ); }
109 const TrkHitList* hits() const { return hits( defaultType() ); }
111 const TrkHitList* hits( PdtPid::PidType hypo ) const;
112
113 // same for hots. This is more direct
114 TrkHotList* hots() { return hots( defaultType() ); }
115 const TrkHotList* hots() const { return hots( defaultType() ); }
117 const TrkHotList* hots( PdtPid::PidType hypo ) const;
118
119 //**********************************************************
120 // (3) Specialized information about the fit; of interest mostly to experts
121 //**********************************************************
122 const TrkFitStatus* status() const;
123 const TrkFitStatus* status( PdtPid::PidType hypo ) const;
126
127 //********************************************************
128 // Attach an extended interface for a specific track representation; returns
129 // false if this track doesn't have the right kind of TrkRep in it.
130 //********************************************************
133
134 //**************************************************
135 // Constructors and such (normal ctor is protected)
136 //**************************************************
137 // Copy constructor (leaves original unchanged):
138 TrkRecoTrk( const TrkRecoTrk& right );
139 // Destructor
140 virtual ~TrkRecoTrk();
141 const TrkRecoTrk& operator=( const TrkRecoTrk& right );
142 bool operator==( const TrkRecoTrk& other ) const;
143 bool operator<( const TrkRecoTrk& other ) const;
144
145 //**********************************************************
146 // Printing
147 //**********************************************************
148 virtual void print( std::ostream& ) const;
149 virtual void printAll( std::ostream& ) const;
150 //**********************************************************
151 // Persistence
152 //**********************************************************
153 // Mark a particular hypo at a particular flight length for storage.
154 // This only works for the mini. Several 'lists' of storage requests
155 // may be associated with each track
156 void markForStore( PdtPid::PidType hypo, double fltlen, const char* listname = "Default" );
157 const std::set<TrkStoreHypo>& storageRequests( const char* listname = "Default" ) const;
158 // clear out all marked stores
159 void clearStorageRequests( const char* listname = "Default" );
160 // return the set of fit storage lists known to this track
161 void storageLists( std::set<std::string>& storage ) const;
162 // protected: //yzhang debug
163 // TrkRep* getRep(PdtPid::PidType hypo);
164 // const TrkRep* getRep(PdtPid::PidType hypo) const;
165
166private:
167 //*** Data members ***
168 TrkRecoTrkImpl* _impl; // the reps live here; owned by trk;
169 // the reason they're stashed away in this class
170 // is because (for #($*)( reasons) ooddlx must
171 // parse code which needs to know that TrkRecoTrk
172 // inherits from AbsEvtObj -- but ooddlx cannot
173 // deal with somewhat complex ANSI C++ constructions
174 // (e.g. namespaces). Stashing the reps into
175 // TrkRecoTrkImpl, which can be fwd declared as we
176 // only use a pointer to it insures that ooddlx
177 // doesn't get 'confused' by real ANSI C++...
178 TrkId _id; // unique id # in event
179 std::vector<int> _fitNumber; // number of times fit has been altered
180 // keep track of the storage requests, by list. This is sorted first by hypo, then
181 // by flightlength.
182 std::map<std::string, std::set<TrkStoreHypo>> _storage;
183 PdtPid::PidType _defaultType;
184 double _trackT0;
185 const MdcPatRec::BField* _bField;
186
187protected:
189 const TrkRep* getRep( PdtPid::PidType hypo ) const;
190 // protected functio
191 void copyReps( const TrkRecoTrk& rhs );
192 // The following takes ownership of the argument; it replaces the default Rep
193 // and zeroes others.
194 void setRep( TrkRep* );
195 // Make hypothesis <hypo> use fit currently used for hypo <fit>:
198
199 // return the list of unique distinct Reps attached to this track
200 std::pair<TrkRepIter, TrkRepIter> uniqueReps() const;
201 // return the list of the 5 reps this track is pointing at
202 std::pair<TrkRepIter, TrkRepIter> allReps() const;
203 void setFitNumber( PdtPid::PidType hypo, int newNumber );
205 // addHypoTo takes ownership of newRep!
206 void addHypoTo( TrkRep* newRep, PdtPid::PidType hypo );
207 // a couple of lame functions to limp past inconsistencies between the persistent
208 // design and the tracking design. Ugh
210 void setBField( const MdcPatRec::BField* field );
211 // Constructors are protected (construct through FitMaker)
212 TrkRecoTrk( PdtPid::PidType defaultPart, const TrkContext&, double t0 );
213 // persistence constructor. BField and IdManager must be set later
214 TrkRecoTrk( PdtPid::PidType defaultPart, long idnum, double t0 );
215
216public:
217 // Access to TrkRep, for testing only; use it at your peril
218 const TrkRep* testRep( PdtPid::PidType hypo ) const { return getRep( hypo ); }
219 friend class TrkFitMaker;
220 friend class TrkHitOnTrk;
221 friend class TrkHitList;
222 friend class KalMiniTrkK;
223 friend class TrkKalMiniCompositeK;
224};
225
226std::ostream& operator<<( std::ostream& os, const TrkRecoTrk& tk );
227
228// typedef ObjectVector<TrkRecoTrk> TrkRecoTrkCol;
229
230#endif
Double_t time
std::ostream & operator<<(std::ostream &os, const TrkRecoTrk &tk)
void repointHypo(PdtPid::PidType hypo, PdtPid::PidType fit)
TrkFitStatus * status()
virtual void print(std::ostream &) const
double trackT0() const
PdtPid::PidType whichFit(PdtPid::PidType hypo) const
void addHypoTo(TrkRep *newRep, PdtPid::PidType hypo)
std::unary_function< TrkRecoTrk, bool > predicate_type
virtual ~TrkRecoTrk()
TrkHitList * hits(PdtPid::PidType hypo)
void clearStorageRequests(const char *listname="Default")
TrkRecoTrk(PdtPid::PidType defaultPart, const TrkContext &, double t0)
void changeDefault(PdtPid::PidType newHypo)
int fitNumber(PdtPid::PidType hypo) const
void setFitNumber(PdtPid::PidType hypo, int newNumber)
void markForStore(PdtPid::PidType hypo, double fltlen, const char *listname="Default")
void setRep(TrkRep *)
const TrkRecoTrk & operator=(const TrkRecoTrk &right)
void resetT0(double time)
TrkRecoTrk(const TrkRecoTrk &right)
void updateReps()
std::pair< TrkRepIter, TrkRepIter > uniqueReps() const
TrkFitStatus * status(PdtPid::PidType hypo)
TrkHotList * hots(PdtPid::PidType hypo)
bool operator<(const TrkRecoTrk &other) const
bool operator==(const TrkRecoTrk &other) const
TrkRecoTrk(PdtPid::PidType defaultPart, long idnum, double t0)
void copyReps(const TrkRecoTrk &rhs)
const TrkId & id() const
void setIdManager(TrkIdManager *idMan)
TrkRep * getRep(PdtPid::PidType hypo)
std::pair< TrkRepIter, TrkRepIter > allReps() const
const TrkRep * testRep(PdtPid::PidType hypo) const
const TrkRep * getRep(PdtPid::PidType hypo) const
void storageLists(std::set< std::string > &storage) const
const TrkHotList * hots(PdtPid::PidType hypo) const
bool attach(TrkExtInterface &, PdtPid::PidType hypo) const
const TrkFit * fitResult() const
virtual void printAll(std::ostream &) const
const TrkFitStatus * status() const
bool attach(TrkExtInterface &, PdtPid::PidType hypo)
const TrkHitList * hits(PdtPid::PidType hypo) const
const TrkFitStatus * status(PdtPid::PidType hypo) const
const std::set< TrkStoreHypo > & storageRequests(const char *listname="Default") const
void setBField(const MdcPatRec::BField *field)
const TrkFit * fitResult(PdtPid::PidType hypo) const
TrkErrCode addFit(PdtPid::PidType hypo, bool fit=true)