#include <RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h>
Public Types | |
typedef std::vector < TempTrajectory > | TempTrajectoryContainer |
typedef std::vector< Trajectory > | TrajectoryContainer |
Public Member Functions | |
CkfTrajectoryBuilder (const edm::ParameterSet &conf, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *recHitBuilder, const MeasurementTracker *measurementTracker, const TrajectoryFilter *filter) | |
virtual void | setEvent (const edm::Event &event) const |
set Event for the internal MeasurementTracker data member | |
virtual void | trajectories (const TrajectorySeed &seed, TrajectoryContainer &ret) const |
trajectories building starting from a seed | |
virtual TrajectoryContainer | trajectories (const TrajectorySeed &seed) const |
trajectories building starting from a seed | |
~CkfTrajectoryBuilder () | |
Protected Member Functions | |
virtual void | findCompatibleMeasurements (const TempTrajectory &traj, std::vector< TrajectoryMeasurement > &result) const |
void | limitedCandidates (TempTrajectory &startingTraj, TrajectoryContainer &result) const |
void | updateTrajectory (TempTrajectory &traj, const TM &tm) const |
Protected Attributes | |
bool | theAlwaysUseInvalidHits |
bool | theIntermediateCleaning |
Tells whether an intermediary cleaning stage should take place during TB. | |
float | theLostHitPenalty |
Chi**2 Penalty for each lost hit. | |
int | theMaxCand |
Maximum number of trajectory candidates to propagate to the next layer. |
Definition at line 32 of file CkfTrajectoryBuilder.h.
typedef std::vector<TempTrajectory> CkfTrajectoryBuilder::TempTrajectoryContainer |
typedef std::vector<Trajectory> CkfTrajectoryBuilder::TrajectoryContainer |
CkfTrajectoryBuilder::CkfTrajectoryBuilder | ( | const edm::ParameterSet & | conf, | |
const TrajectoryStateUpdator * | updator, | |||
const Propagator * | propagatorAlong, | |||
const Propagator * | propagatorOpposite, | |||
const Chi2MeasurementEstimatorBase * | estimator, | |||
const TransientTrackingRecHitBuilder * | recHitBuilder, | |||
const MeasurementTracker * | measurementTracker, | |||
const TrajectoryFilter * | filter | |||
) |
Definition at line 93 of file CkfTrajectoryBuilder.cc.
References edm::ParameterSet::getParameter(), theAlwaysUseInvalidHits, theIntermediateCleaning, theLostHitPenalty, and theMaxCand.
00100 : 00101 00102 BaseCkfTrajectoryBuilder(conf, 00103 updator, propagatorAlong,propagatorOpposite, 00104 estimator, recHitBuilder, measurementTracker,filter) 00105 { 00106 theMaxCand = conf.getParameter<int>("maxCand"); 00107 theLostHitPenalty = conf.getParameter<double>("lostHitPenalty"); 00108 theIntermediateCleaning = conf.getParameter<bool>("intermediateCleaning"); 00109 theAlwaysUseInvalidHits = conf.getParameter<bool>("alwaysUseInvalidHits"); 00110 }
CkfTrajectoryBuilder::~CkfTrajectoryBuilder | ( | ) | [inline] |
void CkfTrajectoryBuilder::findCompatibleMeasurements | ( | const TempTrajectory & | traj, | |
std::vector< TrajectoryMeasurement > & | result | |||
) | const [protected, virtual] |
Reimplemented in MuonCkfTrajectoryBuilder.
Definition at line 231 of file CkfTrajectoryBuilder.cc.
References dumpMeasurements(), TransverseImpactPointExtrapolator::extrapolate(), BaseCkfTrajectoryBuilder::findStateAndLayers(), i, TrajectoryStateOnSurface::isValid(), TempTrajectory::lastLayer(), LogDebug, LayerMeasurements::measurements(), middle, python::multivaluedict::sort(), BaseCkfTrajectoryBuilder::theEstimator, BaseCkfTrajectoryBuilder::theForwardPropagator, BaseCkfTrajectoryBuilder::theLayerMeasurements, and tmp.
Referenced by limitedCandidates().
00233 { 00234 int invalidHits = 0; 00235 std::pair<TSOS,std::vector<const DetLayer*> > stateAndLayers = findStateAndLayers(traj); 00236 if (stateAndLayers.second.empty()) return; 00237 00238 vector<const DetLayer*>::iterator layerBegin = stateAndLayers.second.begin(); 00239 vector<const DetLayer*>::iterator layerEnd = stateAndLayers.second.end(); 00240 LogDebug("CkfPattern")<<"looping on "<< stateAndLayers.second.size()<<" layers."; 00241 for (vector<const DetLayer*>::iterator il = layerBegin; 00242 il != layerEnd; il++) { 00243 00244 LogDebug("CkfPattern")<<"looping on a layer in findCompatibleMeasurements.\n last layer: "<<traj.lastLayer()<<" current layer: "<<(*il); 00245 00246 TSOS stateToUse = stateAndLayers.first; 00247 if ((*il)==traj.lastLayer()) 00248 { 00249 LogDebug("CkfPattern")<<" self propagating in findCompatibleMeasurements.\n from: \n"<<stateToUse; 00250 //self navigation case 00251 // go to a middle point first 00252 TransverseImpactPointExtrapolator middle; 00253 GlobalPoint center(0,0,0); 00254 stateToUse = middle.extrapolate(stateToUse, center, *theForwardPropagator); 00255 00256 if (!stateToUse.isValid()) continue; 00257 LogDebug("CkfPattern")<<"to: "<<stateToUse; 00258 } 00259 00260 vector<TrajectoryMeasurement> tmp = theLayerMeasurements->measurements((**il),stateAndLayers.first, *theForwardPropagator, *theEstimator); 00261 00262 if ( !tmp.empty()) { 00263 if ( result.empty()) result = tmp; 00264 else { 00265 // keep one dummy TM at the end, skip the others 00266 result.insert( result.end()-invalidHits, tmp.begin(), tmp.end()); 00267 } 00268 invalidHits++; 00269 } 00270 } 00271 00272 // sort the final result, keep dummy measurements at the end 00273 if ( result.size() > 1) { 00274 sort( result.begin(), result.end()-invalidHits, TrajMeasLessEstim()); 00275 } 00276 00277 LogDebug("CkfPattern")<<"starting from:\n" 00278 <<"x: "<<stateAndLayers.first.globalPosition()<<"\n" 00279 <<"p: "<<stateAndLayers.first.globalMomentum()<<"\n" 00280 <<dumpMeasurements(result); 00281 00282 #ifdef DEBUG_INVALID 00283 bool afterInvalid = false; 00284 for (vector<TM>::const_iterator i=result.begin(); 00285 i!=result.end(); i++) { 00286 if ( ! i->recHit().isValid()) afterInvalid = true; 00287 if (afterInvalid && i->recHit().isValid()) { 00288 edm::LogError("CkfPattern") << "CkfTrajectoryBuilder error: valid hit after invalid!" ; 00289 } 00290 } 00291 #endif 00292 00293 //analyseMeasurements( result, traj); 00294 00295 }
void CkfTrajectoryBuilder::limitedCandidates | ( | TempTrajectory & | startingTraj, | |
TrajectoryContainer & | result | |||
) | const [protected] |
Definition at line 142 of file CkfTrajectoryBuilder.cc.
References BaseCkfTrajectoryBuilder::addToResult(), BaseCkfTrajectoryBuilder::analyzeMeasurementsDebugger(), IntermediateTrajectoryCleaner::clean(), dumpCandidates(), findCompatibleMeasurements(), prof2calltree::last, LogDebug, BaseCkfTrajectoryBuilder::qualityFilter(), python::multivaluedict::sort(), theAlwaysUseInvalidHits, BaseCkfTrajectoryBuilder::theEstimator, BaseCkfTrajectoryBuilder::theForwardPropagator, theIntermediateCleaning, theLostHitPenalty, theMaxCand, BaseCkfTrajectoryBuilder::theMeasurementTracker, BaseCkfTrajectoryBuilder::theTTRHBuilder, BaseCkfTrajectoryBuilder::toBeContinued(), and updateTrajectory().
Referenced by trajectories().
00144 { 00145 uint nIter=1; 00146 TempTrajectoryContainer candidates; // = TrajectoryContainer(); 00147 TempTrajectoryContainer newCand; // = TrajectoryContainer(); 00148 candidates.push_back( startingTraj); 00149 00150 while ( !candidates.empty()) { 00151 00152 newCand.clear(); 00153 for (TempTrajectoryContainer::iterator traj=candidates.begin(); 00154 traj!=candidates.end(); traj++) { 00155 std::vector<TM> meas; 00156 findCompatibleMeasurements(*traj, meas); 00157 00158 // --- method for debugging 00159 if(!analyzeMeasurementsDebugger(*traj,meas, 00160 theMeasurementTracker, 00161 theForwardPropagator,theEstimator, 00162 theTTRHBuilder)) return; 00163 // --- 00164 00165 if ( meas.empty()) { 00166 if ( qualityFilter( *traj)) addToResult( *traj, result); 00167 } 00168 else { 00169 std::vector<TM>::const_iterator last; 00170 if ( theAlwaysUseInvalidHits) last = meas.end(); 00171 else { 00172 if (meas.front().recHit()->isValid()) { 00173 last = find_if( meas.begin(), meas.end(), RecHitIsInvalid()); 00174 } 00175 else last = meas.end(); 00176 } 00177 00178 for( std::vector<TM>::const_iterator itm = meas.begin(); 00179 itm != last; itm++) { 00180 TempTrajectory newTraj = *traj; 00181 updateTrajectory( newTraj, *itm); 00182 00183 if ( toBeContinued(newTraj)) { 00184 newCand.push_back(newTraj); 00185 } 00186 else { 00187 if ( qualityFilter(newTraj)) addToResult( newTraj, result); 00189 } 00190 } 00191 } 00192 00193 if ((int)newCand.size() > theMaxCand) { 00194 sort( newCand.begin(), newCand.end(), TrajCandLess<TempTrajectory>(theLostHitPenalty)); 00195 newCand.erase( newCand.begin()+theMaxCand, newCand.end()); 00196 } 00197 } 00198 00199 if (theIntermediateCleaning) IntermediateTrajectoryCleaner::clean(newCand); 00200 00201 candidates.swap(newCand); 00202 00203 LogDebug("CkfPattern") <<result.size()<<" candidates after "<<nIter++<<" CKF iteration: \n" 00204 <<dumpCandidates(result) 00205 <<"\n "<<candidates.size()<<" running candidates are: \n" 00206 <<dumpCandidates(candidates); 00207 00208 } 00209 }
void CkfTrajectoryBuilder::setEvent | ( | const edm::Event & | event | ) | const [virtual] |
set Event for the internal MeasurementTracker data member
Implements BaseCkfTrajectoryBuilder.
Definition at line 112 of file CkfTrajectoryBuilder.cc.
References BaseCkfTrajectoryBuilder::theMeasurementTracker, and MeasurementTracker::update().
00113 { 00114 theMeasurementTracker->update(event); 00115 }
void CkfTrajectoryBuilder::trajectories | ( | const TrajectorySeed & | seed, | |
CkfTrajectoryBuilder::TrajectoryContainer & | result | |||
) | const [virtual] |
trajectories building starting from a seed
limitedCandidates( startingTraj, regionalCondition, result); FIXME: restore regionalCondition
Reimplemented from TrajectoryBuilder.
Definition at line 127 of file CkfTrajectoryBuilder.cc.
References BaseCkfTrajectoryBuilder::createStartingTrajectory(), and limitedCandidates().
00128 { 00129 // analyseSeed( seed); 00130 00131 TempTrajectory startingTraj = createStartingTrajectory( seed ); 00132 00135 limitedCandidates( startingTraj, result); 00136 00137 // analyseResult(result); 00138 }
CkfTrajectoryBuilder::TrajectoryContainer CkfTrajectoryBuilder::trajectories | ( | const TrajectorySeed & | seed | ) | const [virtual] |
trajectories building starting from a seed
Implements BaseCkfTrajectoryBuilder.
Definition at line 118 of file CkfTrajectoryBuilder.cc.
References HLT_VtxMuL3::result.
00119 { 00120 TrajectoryContainer result; 00121 result.reserve(5); 00122 trajectories(seed, result); 00123 return result; 00124 }
void CkfTrajectoryBuilder::updateTrajectory | ( | TempTrajectory & | traj, | |
const TM & | tm | |||
) | const [protected] |
Definition at line 213 of file CkfTrajectoryBuilder.cc.
References TrajectoryMeasurement::estimate(), TrajectoryMeasurement::layer(), TrajectoryMeasurement::predictedState(), TempTrajectory::push(), TrajectoryMeasurement::recHit(), BaseCkfTrajectoryBuilder::theUpdator, tmp, and TrajectoryStateUpdator::update().
Referenced by limitedCandidates().
00215 { 00216 TSOS predictedState = tm.predictedState(); 00217 TM::ConstRecHitPointer hit = tm.recHit(); 00218 00219 if ( hit->isValid()) { 00220 TM tmp = TM( predictedState, theUpdator->update( predictedState, *hit), 00221 hit, tm.estimate(), tm.layer()); 00222 traj.push(tmp ); 00223 } 00224 else { 00225 traj.push( TM( predictedState, hit, 0, tm.layer())); 00226 } 00227 }
bool CkfTrajectoryBuilder::theAlwaysUseInvalidHits [protected] |
Definition at line 65 of file CkfTrajectoryBuilder.h.
Referenced by CkfTrajectoryBuilder(), and limitedCandidates().
bool CkfTrajectoryBuilder::theIntermediateCleaning [protected] |
Tells whether an intermediary cleaning stage should take place during TB.
Definition at line 63 of file CkfTrajectoryBuilder.h.
Referenced by CkfTrajectoryBuilder(), and limitedCandidates().
float CkfTrajectoryBuilder::theLostHitPenalty [protected] |
Chi**2 Penalty for each lost hit.
Definition at line 62 of file CkfTrajectoryBuilder.h.
Referenced by CkfTrajectoryBuilder(), and limitedCandidates().
int CkfTrajectoryBuilder::theMaxCand [protected] |
Maximum number of trajectory candidates to propagate to the next layer.
Definition at line 60 of file CkfTrajectoryBuilder.h.
Referenced by CkfTrajectoryBuilder(), and limitedCandidates().