152 throw cms::Exception(
"LogicError") <<
"Asking to create trajectories to an un-initialized CkfTrajectoryBuilder.\nYou have to call clone(const MeasurementTrackerEvent *data) and then call trajectories on it instead.\n";
176 candidates.push_back( startingTraj);
177 boost::shared_ptr<const TrajectorySeed> sharedSeed(
new TrajectorySeed(seed));
185 unsigned int nIter=1;
196 while ( !candidates.empty()) {
199 for (
auto traj=candidates.begin(); traj!=candidates.end(); traj++) {
200 std::vector<TM> meas;
214 std::vector<TM>::const_iterator
last;
217 if (meas.front().recHit()->isValid()) {
220 else last = meas.end();
223 for(
auto itm = meas.begin(); itm !=
last; itm++) {
228 newCand.push_back(
std::move(newTraj)); std::push_heap(newCand.begin(),newCand.end(),trajCandLess);
272 std::pop_heap(newCand.begin(),newCand.end(),trajCandLess);
290 std::sort_heap(newCand.begin(),newCand.end(),trajCandLess);
293 candidates.swap(newCand);
295 LogDebug(
"CkfPattern") <<result.size()<<
" candidates after "<<nIter++<<
" CKF iteration: \n" 297 <<
"\n "<<candidates.size()<<
" running candidates are: \n" 308 auto && predictedState = tm.predictedState();
309 auto &&
hit = tm.recHit();
310 if (
hit->isValid()) {
324 std::vector<TrajectoryMeasurement> &
result)
const 328 std::pair<TSOS,std::vector<const DetLayer*> > && stateAndLayers =
findStateAndLayers(seed,traj);
329 if (stateAndLayers.second.empty())
return;
331 auto layerBegin = stateAndLayers.second.begin();
332 auto layerEnd = stateAndLayers.second.end();
333 LogDebug(
"CkfPattern")<<
"looping on "<< stateAndLayers.second.size()<<
" layers.";
335 for (
auto il = layerBegin; il != layerEnd; il++) {
337 LogDebug(
"CkfPattern")<<
"looping on a layer in findCompatibleMeasurements.\n last layer: "<<traj.
lastLayer()<<
" current layer: "<<(*il);
339 TSOS stateToUse = stateAndLayers.first;
342 LogDebug(
"CkfPattern")<<
" self propagating in findCompatibleMeasurements.\n from: \n"<<stateToUse;
347 stateToUse = middle.
extrapolate(stateToUse, center, *fwdPropagator);
349 if (!stateToUse.
isValid())
continue;
350 LogDebug(
"CkfPattern")<<
"to: "<<stateToUse;
354 std::vector<TrajectoryMeasurement> &&
tmp = layerMeasurements.measurements((**il),stateToUse, *fwdPropagator, *
theEstimator);
357 if ( result.empty()) result.swap(tmp);
360 result.insert( result.end()-invalidHits,
361 std::make_move_iterator(tmp.begin()), std::make_move_iterator(tmp.end()));
368 if ( result.size() > 1) {
372 LogDebug(
"CkfPattern")<<
"starting from:\n" 373 <<
"x: "<<stateAndLayers.first.globalPosition()<<
"\n" 374 <<
"p: "<<stateAndLayers.first.globalMomentum()<<
"\n" 378 bool afterInvalid =
false;
379 for (vector<TM>::const_iterator
i=result.begin();
380 i!=result.end();
i++) {
381 if ( !
i->recHit().isValid()) afterInvalid =
true;
382 if (afterInvalid &&
i->recHit().isValid()) {
383 edm::LogError(
"CkfPattern") <<
"CkfTrajectoryBuilder error: valid hit after invalid!" ;
T getParameter(std::string const &) const
static std::string dumpCandidates(collection &candidates)
std::vector< Trajectory > TrajectoryContainer
TempTrajectory buildTrajectories(const TrajectorySeed &, TrajectoryContainer &ret, const TrajectoryFilter *) const override
bool theAlwaysUseInvalidHits
bool empty() const
True if trajectory has no measurements.
const Propagator * forwardPropagator(const TrajectorySeed &seed) const
virtual TrajectoryContainer trajectories(const TrajectorySeed &seed) const override
trajectories building starting from a seed
CkfTrajectoryBuilder(const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
virtual bool analyzeMeasurementsDebugger(Trajectory &traj, const std::vector< TrajectoryMeasurement > &meas, const MeasurementTrackerEvent *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
const TrajectoryStateUpdator * theUpdator
static std::string dumpMeasurements(const std::vector< TrajectoryMeasurement > &v)
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
bool theIntermediateCleaning
const TransientTrackingRecHitBuilder * theTTRHBuilder
void addToResult(boost::shared_ptr< const TrajectorySeed > const &seed, TempTrajectory &traj, TrajectoryContainer &result, bool inOut=false) const
StateAndLayers findStateAndLayers(const TrajectorySeed &seed, const TempTrajectory &traj) const
const MeasurementTrackerEvent * theMeasurementTracker
std::vector< TempTrajectory > TempTrajectoryContainer
float chiSquared() const
Value of the raw Chi2 of the trajectory, not normalised to the N.D.F.
std::vector< std::vector< double > > tmp
void emplace(Args &&...args)
bool toBeContinued(TempTrajectory &traj, bool inOut=false) const
virtual void findCompatibleMeasurements(const TrajectorySeed &seed, const TempTrajectory &traj, std::vector< TrajectoryMeasurement > &result) const
void updateTrajectory(TempTrajectory &traj, TM &&tm) const
void setEvent_(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
int theMaxCand
set Event for the internal MeasurementTracker data member
std::vector< Trajectory > TrajectoryContainer
const Chi2MeasurementEstimatorBase * theEstimator
TempTrajectory createStartingTrajectory(const TrajectorySeed &seed) const
void limitedCandidates(const TrajectorySeed &seed, TempTrajectory &startingTraj, TrajectoryContainer &result) const