25#include "CLHEP/Vector/ThreeVector.h"
35#include "boost/shared_ptr.hpp"
52 typedef std::vector<boost::shared_ptr<TrkRep> > repList_t;
53 typedef repList_t::const_iterator repConstIter;
54 typedef repList_t::iterator repIter;
56 typedef std::vector<boost::shared_ptr<TrkHitList> > hitList_t;
57 typedef hitList_t::iterator hitListIter;
58 hitList_t _hitInterfaces;
66 _fitNumber(
PdtPid::nPidType,(int)0),
67 _defaultType(defaultPart),
73 for (TrkRecoTrkImpl::hitListIter iface = _impl->_hitInterfaces.begin();
74 iface!= _impl->_hitInterfaces.end(); ++iface) {
83 _fitNumber(
PdtPid::nPidType,(int)0),
84 _defaultType(defaultPart),
90 for (TrkRecoTrkImpl::hitListIter iface = _impl->_hitInterfaces.begin();
91 iface!= _impl->_hitInterfaces.end(); ++iface) {
99 _id(rhs._id.idManager()),
100 _fitNumber(
PdtPid::nPidType,(int)0),
101 _storage(rhs._storage),
102 _trackT0( rhs._trackT0),
107 for (TrkRecoTrkImpl::hitListIter iface = _impl->_hitInterfaces.begin();
108 iface!= _impl->_hitInterfaces.end(); ++iface) {
122 if (&right ==
this)
return *
this;
123 _trackT0 = right._trackT0;
126 _bField = right._bField;
129 _storage = right._storage;
148 if (_impl->_reps[hypo].get() == 0) {
153 return _impl->_reps[hypo]->particleType();
162 return _fitNumber[index];
168 ostr <<
"Trk: " <<
id() <<
" def: "
175 ostr <<
" nhit: " << daList->
nHit();
178 ostr <<
" nactive: " << daFit->
nActive() <<
" chisq: " << daFit->
chisq();
181 ostr <<
" 3-d: " << (daStatus->
is2d() == 0);
183 ostr <<
" t0: " << _trackT0 <<
"\n";
186 ostr <<
"phi0: " << par.
phi0()
187 <<
" om: "<< par.
omega()
188 <<
" d0: " << par.
d0() <<
" z0: " << par.
z0()
189 <<
" ct: " << par.
tanDip();
198 ostr <<
"Trk: " <<
id() <<
" def: "
205 ostr <<
" nhit: " << daList->
nHit();
208 ostr <<
" nactive: " << daFit->
nActive() <<
" chisq: " << daFit->
chisq();
211 ostr <<
" 3-d: " << (daStatus->
is2d() == 0);
213 ostr <<
" t0: " << _trackT0 <<
"\n";
228 "TrkRecoTrk::addFit(): cannot add a fit to this track.");
232 "TrkRecoTrk::addFit(): requested fit already exists.");
234 _impl->_reps[hypo].reset( _impl->_reps[
defaultType()]->cloneNewHypo(hypo) );
236 if (fit && !_impl->_reps[hypo]->fitCurrent()) {
237 fitErr = _impl->_reps[hypo]->fit();
255 std::transform(_fitNumber.begin(),_fitNumber.end(),
257 std::bind2nd(std::plus<int>(),1));
263 return _id == other._id;
269 return _id < other._id;
280 TrkRep* theRep = _impl->_reps[hypo].get();
290 const TrkRep* theRep = _impl->_reps[hypo].get();
302 std::for_each(oldList->
begin(),
305 assert(
getRep(newHypo) != 0);
307 std::for_each(newList->
begin(),
310 _defaultType = newHypo;
316 TrkRecoTrkImpl::repIter lhs = _impl->_reps.begin();
317 for (TrkRecoTrkImpl::repIter i=rhs._impl->_reps.begin();i!=rhs._impl->_reps.end();++i,++lhs) {
318 TrkRecoTrkImpl::repIter j=std::find(rhs._impl->_reps.begin(),i,*i);
320 lhs->reset( (*i)->clone(
this) );
321 (*lhs)->setValid((*i)->fitValid());
322 (*lhs)->setCurrent((*i)->fitCurrent());
324 *lhs = *(_impl->_reps.begin()+(j-rhs._impl->_reps.begin()));
327 assert(_fitNumber.size()==rhs._fitNumber.size());
328 std::copy(rhs._fitNumber.begin(),rhs._fitNumber.end(),_fitNumber.begin());
336 std::fill(_impl->_reps.begin(),_impl->_reps.end(),boost::shared_ptr<TrkRep>(r));
337 std::transform(_fitNumber.begin(),_fitNumber.end(),
339 std::bind2nd(std::plus<int>(),1));
349 std::cout <<
"ErrMsg(error) "<<
350 "TrkRecoTrk: can't make default hypothesis point at different fit"
354 _impl->_reps[hypo] = _impl->_reps[fit];
361 return rp!=0?interface.
attach(rp):0;
369 return rp!=0?interface.
attach(rp):0;
376 return rp==0?0:_impl->_hitInterfaces[hypo].get();
383 return rp==0?0:_impl->_hitInterfaces[hypo].get();
396 return rp==0?0:(rp->
fitValid()?rp:0);
426 _fitNumber[hypo] = newNumber;
432 _impl->_reps[hypo].reset( newRep );
456 const char* listname) {
460 if(
getRep(realhypo)!= 0 &&
getRep(realhypo)->fitValid())
462 _storage[std::string(listname)].insert(
TrkStoreHypo(realhypo,fltlen));
465 std::cout<<
"ErrMsg(error) "<<
"Invalid fits cannot be marked for storage" << std::endl;
468const std::set<TrkStoreHypo>&
470 static std::set<TrkStoreHypo> empty;
471 std::map<std::string,std::set<TrkStoreHypo> >::const_iterator foundit =
472 _storage.find(std::string(listname));
473 if(foundit != _storage.end())
474 return foundit->second;
481 _storage[std::string(listname)].clear();
489 std::map<std::string,std::set<TrkStoreHypo> >::const_iterator miter = _storage.begin();
490 while(miter != _storage.end()){
491 storage.insert(miter->first);
510std::pair<TrkRepIter,TrkRepIter>
513 typedef std::vector<TrkRep*> RPL;
514 boost::shared_ptr<RPL>
x(
new RPL );
517 for (TrkRecoTrkImpl::repConstIter i=_impl->_reps.begin();i!=_impl->_reps.end();++i) {
518 x->push_back(i->get());
528std::pair<TrkRepIter,TrkRepIter>
531 typedef std::vector<TrkRep*> RPL;
532 boost::shared_ptr<RPL>
x(
new RPL );
533 for (TrkRecoTrkImpl::repConstIter i=_impl->_reps.begin();i!=_impl->_reps.end();++i) {
534 if (std::find(
x->begin(),
x->end(),i->get())==
x->end())
x->push_back(i->get());
ostream & operator<<(ostream &os, const TrkRecoTrk &tk)
const char * name() const
static PdtEntry * lookup(const std::string &name)
virtual void printAll(std::ostream &ostr) const =0
virtual double chisq() const =0
virtual bool attach(TrkRep *)
virtual int nActive() const =0
virtual TrkExchangePar helix(double fltL) const =0
hot_iterator begin() const
void setIdManager(TrkIdManager *idMan)
void setNewValue(const TrkId &)
void repointHypo(PdtPid::PidType hypo, PdtPid::PidType fit)
virtual void printAll(std::ostream &) const
PdtPid::PidType whichFit(PdtPid::PidType hypo) const
void addHypoTo(TrkRep *newRep, PdtPid::PidType hypo)
const BField & bField() const
void clearStorageRequests(const char *listname="Default")
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")
const TrkRecoTrk & operator=(const TrkRecoTrk &right)
void resetT0(double time)
PdtPid::PidType defaultType() const
TrkRecoTrk(const TrkRecoTrk &right)
std::pair< TrkRepIter, TrkRepIter > uniqueReps() const
bool operator<(const TrkRecoTrk &other) const
bool operator==(const TrkRecoTrk &other) const
virtual void print(std::ostream &) const
void copyReps(const TrkRecoTrk &rhs)
void setIdManager(TrkIdManager *idMan)
TrkRep * getRep(PdtPid::PidType hypo)
std::pair< TrkRepIter, TrkRepIter > allReps() const
void storageLists(std::set< std::string > &storage) const
const TrkFit * fitResult() const
const TrkFitStatus * status() const
bool attach(TrkExtInterface &, PdtPid::PidType hypo)
const std::set< TrkStoreHypo > & storageRequests(const char *listname="Default") const
void setBField(const BField *field)
TrkErrCode addFit(PdtPid::PidType hypo, bool fit=true)
virtual void updateHots()
virtual TrkHotList * hotList()