#include <TrkRecoTrk.h>
|
|
|
|
|
00097 : 00098 _impl(new TrkRecoTrkImpl), 00099 _id(rhs._id.idManager()), 00100 _fitNumber(PdtPid::nPidType,(int)0), 00101 _storage(rhs._storage), 00102 _trackT0( rhs._trackT0), 00103 _bField(rhs._bField) 00104 { 00105 _defaultType = rhs.defaultType(); 00106 unsigned i=0; 00107 for (TrkRecoTrkImpl::hitListIter iface = _impl->_hitInterfaces.begin(); 00108 iface!= _impl->_hitInterfaces.end(); ++iface) { 00109 iface->reset( new TrkHitList(this, (PdtPid::PidType)i++) ); //cast 00110 } 00111 copyReps(rhs); 00112 }
|
|
00115 {
00116 delete _impl;
00117 }
|
|
00063 : 00064 _impl(new TrkRecoTrkImpl), 00065 _id(ctext.getId()), 00066 _fitNumber(PdtPid::nPidType,(int)0), 00067 _defaultType(defaultPart), 00068 _trackT0(t0), 00069 _bField( ctext.bField() ) 00070 { 00071 // No TrkRep is defined here; must be created in appropriate FitMaker. 00072 unsigned i=0; 00073 for (TrkRecoTrkImpl::hitListIter iface = _impl->_hitInterfaces.begin(); 00074 iface!= _impl->_hitInterfaces.end(); ++iface) { 00075 iface->reset( new TrkHitList(this, (PdtPid::PidType)i++) ); //cast 00076 } 00077 }
|
|
00080 : 00081 _impl(new TrkRecoTrkImpl), 00082 _id(idnum,0), 00083 _fitNumber(PdtPid::nPidType,(int)0), 00084 _defaultType(defaultPart), 00085 _trackT0(t0), 00086 _bField(0) 00087 { 00088 // No TrkRep is defined here; must be created in appropriate FitMaker. 00089 unsigned i=0; 00090 for (TrkRecoTrkImpl::hitListIter iface = _impl->_hitInterfaces.begin(); 00091 iface!= _impl->_hitInterfaces.end(); ++iface) { 00092 iface->reset( new TrkHitList(this, (PdtPid::PidType)i++) ); //cast 00093 } 00094 }
|
|
|
|
|
|
|
|
|
|
|
|
00221 { 00222 // If there is no fit, create one. If hypo points to a fit for a different 00223 // particle type, create a fit of type hypo, and point at that. Carry 00224 // out the fit if needed. 00225 if (hits() == 0) { 00226 // Unfittable rep 00227 return TrkErrCode(TrkErrCode::fail, 11, 00228 "TrkRecoTrk::addFit(): cannot add a fit to this track."); 00229 } 00230 if (whichFit(hypo) == hypo) { 00231 return TrkErrCode(TrkErrCode::succeed, 11, 00232 "TrkRecoTrk::addFit(): requested fit already exists."); 00233 } 00234 _impl->_reps[hypo].reset( _impl->_reps[defaultType()]->cloneNewHypo(hypo) ); 00235 TrkErrCode fitErr(TrkErrCode::succeed, 1); 00236 if (fit && !_impl->_reps[hypo]->fitCurrent()) { 00237 fitErr = _impl->_reps[hypo]->fit(); 00238 } 00239 ++_fitNumber[hypo]; 00240 return fitErr; 00241 }
|
|
|
|
|
|
|
|
00512 { 00513 typedef std::vector<TrkRep*> RPL; 00514 boost::shared_ptr<RPL> x( new RPL ); 00515 //std::cout << " TrkRecoTrk::allReps" << std::endl;//yzhang debug 00516 00517 for (TrkRecoTrkImpl::repConstIter i=_impl->_reps.begin();i!=_impl->_reps.end();++i) { 00518 x->push_back(i->get()); 00519 /* 00520 i->get()->printType(std::cout);//yzhang debug 00521 i->get()->printAll(std::cout);//yzhang debug 00522 */ 00523 } 00524 //std::cout << "------ " << std::endl;//yzhang debug 00525 return std::make_pair(TrkRepIter(x,0),TrkRepIter(x,x->size())); 00526 }
|
|
|
|
|
|
|
|
|
|
00082 {return *_bField;}
|
|
00082 {return *_bField;}
|
|
|
|
00297 { 00298 if (newHypo == defaultType()) return; 00299 assert(whichFit(newHypo) != PdtPid::null); 00300 00301 TrkHotList *oldList = getRep(defaultType())->hotList(); 00302 std::for_each(oldList->begin(), 00303 oldList->end(), 00304 std::mem_fun_ref(&TrkHitOnTrk::setUnusedHit)); 00305 assert(getRep(newHypo) != 0); 00306 TrkHotList *newList= getRep(newHypo)->hotList(); 00307 std::for_each(newList->begin(), 00308 newList->end(), 00309 std::mem_fun_ref(&TrkHitOnTrk::setUsedHit)); 00310 _defaultType = newHypo; 00311 }
|
|
|
|
00480 { 00481 _storage[std::string(listname)].clear(); 00482 }
|
|
|
|
00315 { 00316 TrkRecoTrkImpl::repIter lhs = _impl->_reps.begin(); 00317 for (TrkRecoTrkImpl::repIter i=rhs._impl->_reps.begin();i!=rhs._impl->_reps.end();++i,++lhs) { 00318 TrkRecoTrkImpl::repIter j=std::find(rhs._impl->_reps.begin(),i,*i); 00319 if (j==i) { // first time this one is seen 00320 lhs->reset( (*i)->clone(this) ); 00321 (*lhs)->setValid((*i)->fitValid()); 00322 (*lhs)->setCurrent((*i)->fitCurrent()); 00323 } else { 00324 *lhs = *(_impl->_reps.begin()+(j-rhs._impl->_reps.begin())); 00325 } 00326 } 00327 assert(_fitNumber.size()==rhs._fitNumber.size()); 00328 std::copy(rhs._fitNumber.begin(),rhs._fitNumber.end(),_fitNumber.begin()); 00329 }
|
|
00078 {return _defaultType;}
|
|
00078 {return _defaultType;}
|
|
|
|
00158 { 00159 PdtPid::PidType used = whichFit(hypo); 00160 if (used == PdtPid::null) return -1; 00161 int index = used; 00162 return _fitNumber[index]; 00163 }
|
|
|
|
|
|
|
|
00388 { 00389 return fitResult(defaultType()); 00390 }
|
|
|
|
|
|
00288 { 00289 assert(hypo>=PdtPid::electron && hypo<= PdtPid::proton); 00290 const TrkRep* theRep = _impl->_reps[hypo].get(); 00291 if(hypo == defaultType())assert(0 != theRep); 00292 return theRep; 00293 }
|
|
00278 { 00279 assert(hypo>=PdtPid::electron && hypo<= PdtPid::proton); 00280 TrkRep* theRep = _impl->_reps[hypo].get(); 00281 // insist the default rep exist 00282 if(hypo == defaultType())assert(0 != theRep); 00283 return theRep; 00284 }
|
|
|
|
|
|
00108 {return hits(defaultType());}
|
|
00107 {return hits(defaultType());}
|
|
00381 { 00382 const TrkRep* rp = getRep(hypo); 00383 return rp==0?0:_impl->_hitInterfaces[hypo].get(); 00384 }
|
|
00374 { 00375 const TrkRep* rp = getRep(hypo); 00376 return rp==0?0:_impl->_hitInterfaces[hypo].get(); 00377 }
|
|
00108 {return hits(defaultType());}
|
|
00107 {return hits(defaultType());}
|
|
|
|
|
|
00114 {return hots(defaultType());}
|
|
00113 {return hots(defaultType());}
|
|
|
|
|
|
00114 {return hots(defaultType());}
|
|
00113 {return hots(defaultType());}
|
|
|
|
00135 {
00136 return _id;
00137 }
|
|
|
|
00456 { 00457 // first, translate to the real hypo 00458 PdtPid::PidType realhypo = whichFit(hypo); 00459 // Then, make sure this hypo has a valid fit 00460 if(getRep(realhypo)!= 0 && getRep(realhypo)->fitValid()) 00461 // add an entry in the toStore list (if it's unique) 00462 _storage[std::string(listname)].insert(TrkStoreHypo(realhypo,fltlen)); 00463 else 00464 // It's an error to try to store invalid fits 00465 std::cout<<"ErrMsg(error) "<< "Invalid fits cannot be marked for storage" << std::endl; 00466 }
|
|
|
|
|
|
|
|
00121 { 00122 if (&right == this) return *this; 00123 _trackT0 = right._trackT0; 00124 _defaultType = right.defaultType(); 00125 copyReps(right); 00126 _bField = right._bField; 00127 // AbsEvtObj::operator=(right); 00128 _id.setNewValue(right._id); 00129 _storage = right._storage; 00130 return *this; 00131 }
|
|
|
|
|
|
|
|
00167 { 00168 ostr << "Trk: " << id() << " def: " 00169 << Pdt::lookup(defaultType())->name() 00170 << " fitNumber:" << fitNumber(defaultType()); 00171 const TrkFit* daFit = fitResult(); 00172 const TrkHitList* daList = hits(); 00173 const TrkFitStatus* daStatus = status(); 00174 if (daList != 0) { 00175 ostr << " nhit: " << daList->nHit(); 00176 } 00177 if (daFit != 0) { 00178 ostr << " nactive: " << daFit->nActive() << " chisq: " << daFit->chisq(); 00179 } 00180 if (daStatus != 0) { 00181 ostr << " 3-d: " << (daStatus->is2d() == 0); 00182 } 00183 ostr << " t0: " << _trackT0 << "\n"; 00184 if (daFit != 0) { 00185 TrkExchangePar par = daFit->helix(0.); 00186 ostr << "phi0: " << par.phi0() 00187 << " om: "<< par.omega() 00188 << " d0: " << par.d0() << " z0: " << par.z0() 00189 << " ct: " << par.tanDip(); 00190 } 00191 ostr << std::endl; 00192 }
|
|
|
|
00196 { 00197 // This should be expanded to print other hypotheses as well 00198 ostr << "Trk: " << id() << " def: " 00199 << Pdt::lookup(defaultType())->name() 00200 << " fitNumber:" << fitNumber(defaultType()); 00201 const TrkFit* daFit = fitResult(); 00202 const TrkHitList* daList = hits(); 00203 const TrkFitStatus* daStatus = status(); 00204 if (daList != 0) { 00205 ostr << " nhit: " << daList->nHit(); 00206 } 00207 if (daFit != 0) { 00208 ostr << " nactive: " << daFit->nActive() << " chisq: " << daFit->chisq(); 00209 } 00210 if (daStatus != 0) { 00211 ostr << " 3-d: " << (daStatus->is2d() == 0); 00212 } 00213 ostr << " t0: " << _trackT0 << "\n"; 00214 getRep(defaultType())->printAll(ostr); 00215 // allReps();//yzhang debug 00216 ostr << std::endl; 00217 }
|
|
|
|
00344 { 00345 // Do we have to do anything? 00346 if (fit == hypo || getRep(fit) == getRep(hypo)) return; 00347 00348 if (hypo == defaultType()) { 00349 std::cout << "ErrMsg(error) "<< 00350 "TrkRecoTrk: can't make default hypothesis point at different fit" 00351 << std::endl; 00352 return; 00353 } 00354 _impl->_reps[hypo] = _impl->_reps[fit]; 00355 }
|
|
|
|
00245 { 00246 _trackT0 = t; 00247 updateReps(); 00248 }
|
|
|
|
00450 { 00451 _bField = field; 00452 }
|
|
|
|
00425 { 00426 _fitNumber[hypo] = newNumber; 00427 }
|
|
|
|
00437 { 00438 _id.setIdManager(idMan); 00439 }
|
|
|
|
00333 { 00334 // Sets the default rep to be r, clears out other reps., and sets 00335 // non-default rep ptrs to point at default. Increments all fit numbers. 00336 std::fill(_impl->_reps.begin(),_impl->_reps.end(),boost::shared_ptr<TrkRep>(r)); 00337 std::transform(_fitNumber.begin(),_fitNumber.end(), 00338 _fitNumber.begin(), 00339 std::bind2nd(std::plus<int>(),1)); 00340 }
|
|
|
|
|
|
|
|
|
|
00419 { 00420 return getRep(hypo); 00421 }
|
|
00413 { 00414 return status(defaultType()); 00415 }
|
|
00407 { 00408 return getRep(hypo); 00409 }
|
|
00401 { 00402 return status(defaultType()); 00403 }
|
|
|
|
00485 { 00486 // clear the output set 00487 storage.clear(); 00488 // iterate over all the storage requests 00489 std::map<std::string,std::set<TrkStoreHypo> >::const_iterator miter = _storage.begin(); 00490 while(miter != _storage.end()){ 00491 storage.insert(miter->first); 00492 miter++; 00493 } 00494 }
|
|
|
|
00469 { 00470 static std::set<TrkStoreHypo> empty; // empty set to return if list doesn't exist 00471 std::map<std::string,std::set<TrkStoreHypo> >::const_iterator foundit = 00472 _storage.find(std::string(listname)); 00473 if(foundit != _storage.end()) 00474 return foundit->second; 00475 else 00476 return empty; 00477 }
|
|
00219 { return getRep(hypo);}
|
|
00219 { return getRep(hypo);}
|
|
|
|
00141 {
00142 return _trackT0;
00143 }
|
|
|
|
00530 { 00531 typedef std::vector<TrkRep*> RPL; 00532 boost::shared_ptr<RPL> x( new RPL ); 00533 for (TrkRecoTrkImpl::repConstIter i=_impl->_reps.begin();i!=_impl->_reps.end();++i) { 00534 if (std::find(x->begin(),x->end(),i->get())==x->end()) x->push_back(i->get()); 00535 00536 } 00537 return std::make_pair(TrkRepIter(x,0),TrkRepIter(x,x->size())); 00538 }
|
|
|
|
00252 { 00253 std::pair<TrkRepIter,TrkRepIter> x = uniqueReps(); 00254 std::for_each(x.first,x.second,std::mem_fun_ref(&TrkRep::updateHots)); 00255 std::transform(_fitNumber.begin(),_fitNumber.end(), 00256 _fitNumber.begin(), 00257 std::bind2nd(std::plus<int>(),1)); 00258 }
|
|
|
|
00147 { 00148 if (_impl->_reps[hypo].get() == 0) { 00149 return hypo; 00150 } 00151 // return _repPtr[hypo]->fitValid() ? _repPtr[hypo]->particleType() 00152 // : PdtPid::null; 00153 return _impl->_reps[hypo]->particleType(); 00154 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|