39 std::unique_ptr<TrajectoryFilter>
filter)
56 iDesc.
add<
int>(
"maxCand", 5);
57 iDesc.
add<
double>(
"lostHitPenalty", 30.);
58 iDesc.
add<
bool>(
"intermediateCleaning",
true);
59 iDesc.
add<
bool>(
"alwaysUseInvalidHits",
true);
162 unsigned int& nCandPerSeed,
166 <<
"Asking to create trajectories to an un-initialized CkfTrajectoryBuilder.\nYou have to call clone(const " 167 "MeasurementTrackerEvent *data) and then call trajectories on it instead.\n";
198 unsigned int nIter = 1;
199 unsigned int nCands = 0;
200 unsigned int prevNewCandSize = 0;
211 std::vector<TM> meas;
223 std::vector<TM>::const_iterator
last;
227 if (meas.front().recHit()->isValid()) {
228 last = find_if(meas.begin(), meas.end(), [](
auto const& meas) {
return !meas.recHit()->isValid(); });
233 for (
auto itm = meas.begin(); itm !=
last; itm++) {
239 std::push_heap(newCand.begin(), newCand.end(), trajCandLess);
250 nCands += newCand.size() - prevNewCandSize;
251 prevNewCandSize = newCand.size();
286 std::pop_heap(newCand.begin(), newCand.end(), trajCandLess);
304 std::sort_heap(newCand.begin(), newCand.end(), trajCandLess);
310 LogDebug(
"CkfPattern") <<
result.size() <<
" candidates after " << nIter++ <<
" CKF iteration: \n" 312 <<
" running candidates are: \n" 319 auto&& predictedState = tm.predictedState();
320 auto&&
hit = tm.recHit();
321 if (
hit->isValid()) {
325 traj.
emplace(predictedState,
hit, 0, tm.layer());
331 std::vector<TrajectoryMeasurement>&
result)
const {
335 if (stateAndLayers.second.empty())
338 auto layerBegin = stateAndLayers.second.begin();
339 auto layerEnd = stateAndLayers.second.end();
340 LogDebug(
"CkfPattern") <<
"looping on " << stateAndLayers.second.size() <<
" layers.";
342 for (
auto il = layerBegin; il != layerEnd; il++) {
343 LogDebug(
"CkfPattern") <<
"looping on a layer in findCompatibleMeasurements.\n last layer: " << traj.
lastLayer()
344 <<
" current layer: " << (*il);
346 TSOS stateToUse = stateAndLayers.first;
349 LogDebug(
"CkfPattern") <<
" self propagating in findCompatibleMeasurements.\n from: \n" << stateToUse;
354 stateToUse = middle.
extrapolate(stateToUse, center, *fwdPropagator);
358 LogDebug(
"CkfPattern") <<
"to: " << stateToUse;
362 std::vector<TrajectoryMeasurement>&&
tmp =
363 layerMeasurements.measurements((**il), stateToUse, *fwdPropagator, *
theEstimator);
371 result.end() - invalidHits, std::make_move_iterator(
tmp.begin()), std::make_move_iterator(
tmp.end()));
382 LogDebug(
"CkfPattern") <<
"starting from:\n" 383 <<
"x: " << stateAndLayers.first.globalPosition() <<
"\n" 384 <<
"p: " << stateAndLayers.first.globalMomentum() <<
"\n" 388 bool afterInvalid =
false;
389 for (vector<TM>::const_iterator
i =
result.begin();
i !=
result.end();
i++) {
390 if (!
i->recHit().isValid())
392 if (afterInvalid &&
i->recHit().isValid()) {
393 edm::LogError(
"CkfPattern") <<
"CkfTrajectoryBuilder error: valid hit after invalid!";
void updateTrajectory(TempTrajectory &traj, TM &&tm) const
void emplace(Args &&... args)
StateAndLayers findStateAndLayers(const TrajectorySeed &seed, const TempTrajectory &traj) const
T getParameter(std::string const &) const
static std::string dumpCandidates(collection &candidates)
std::vector< Trajectory > TrajectoryContainer
bool theAlwaysUseInvalidHits
TempTrajectory createStartingTrajectory(const TrajectorySeed &seed) const
unsigned int limitedCandidates(const TrajectorySeed &seed, TempTrajectory &startingTraj, TrajectoryContainer &result) const
bool toBeContinued(TempTrajectory &traj, bool inOut=false) const
const TrajectoryStateUpdator * theUpdator
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
CkfTrajectoryBuilder(const edm::ParameterSet &conf, edm::ConsumesCollector iC)
Log< level::Error, false > LogError
static std::string dumpMeasurements(const std::vector< TrajectoryMeasurement > &v)
TrajectoryContainer trajectories(const TrajectorySeed &seed) const override
trajectories building starting from a seed
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
bool theIntermediateCleaning
const TransientTrackingRecHitBuilder * theTTRHBuilder
TempTrajectory buildTrajectories(const TrajectorySeed &, TrajectoryContainer &ret, unsigned int &nCandPerSeed, const TrajectoryFilter *) const override
virtual bool analyzeMeasurementsDebugger(Trajectory &traj, const std::vector< TrajectoryMeasurement > &meas, const MeasurementTrackerEvent *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
const MeasurementTrackerEvent * theMeasurementTracker
std::vector< TempTrajectory > TempTrajectoryContainer
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
virtual void findCompatibleMeasurements(const TrajectorySeed &seed, const TempTrajectory &traj, std::vector< TrajectoryMeasurement > &result) const
void addToResult(std::shared_ptr< const TrajectorySeed > const &seed, TempTrajectory &traj, TrajectoryContainer &result, bool inOut=false) const
const Propagator * forwardPropagator(const TrajectorySeed &seed) const
void setEvent_(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
int theMaxCand
set Event for the internal MeasurementTracker data member
std::vector< Trajectory > TrajectoryContainer
const Chi2MeasurementEstimatorBase * theEstimator
bool empty() const
True if trajectory has no measurements.