39 std::unique_ptr<TrajectoryFilter>
filter)
51 iDesc.
add<
int>(
"maxCand", 5);
52 iDesc.
add<
double>(
"lostHitPenalty", 30.);
53 iDesc.
add<
double>(
"foundHitBonus", 0.);
54 iDesc.
add<
int>(
"minHitForDoubleBonus", 8888);
55 iDesc.
add<
bool>(
"intermediateCleaning",
true);
56 iDesc.
add<
bool>(
"alwaysUseInvalidHits",
true);
80 unsigned int& nCandPerSeed,
84 <<
"Asking to create trajectories to an un-initialized CkfTrajectoryBuilder.\nYou have to call clone(const " 85 "MeasurementTrackerEvent *data) and then call trajectories on it instead.\n";
105 unsigned int nIter = 1;
106 unsigned int nCands = 0;
107 unsigned int prevNewCandSize = 0;
123 std::vector<TM> meas;
135 std::vector<TM>::const_iterator
last;
139 if (meas.front().recHit()->isValid()) {
140 last = find_if(meas.begin(), meas.end(), [](
auto const& meas) {
return !meas.recHit()->isValid(); });
145 for (
auto itm = meas.begin(); itm !=
last; itm++) {
151 bool better = trajCandLess(newTraj, newCand.front());
154 std::pop_heap(newCand.begin(), newCand.end(), trajCandLess);
155 newCand.back().swap(newTraj);
156 std::push_heap(newCand.begin(), newCand.end(), trajCandLess);
162 std::make_heap(newCand.begin(), newCand.end(), trajCandLess);
174 nCands += newCand.size() - prevNewCandSize;
175 prevNewCandSize = newCand.size();
188 LogDebug(
"CkfPattern") <<
result.size() <<
" candidates after " << nIter++ <<
" CKF iteration: \n" 190 <<
" running candidates are: \n" 197 auto&& predictedState = tm.predictedState();
198 auto&&
hit = tm.recHit();
199 if (
hit->isValid()) {
203 traj.
emplace(predictedState,
hit, 0, tm.layer());
209 std::vector<TrajectoryMeasurement>&
result)
const {
213 if (stateAndLayers.second.empty())
216 auto layerBegin = stateAndLayers.second.begin();
217 auto layerEnd = stateAndLayers.second.end();
218 LogDebug(
"CkfPattern") <<
"looping on " << stateAndLayers.second.size() <<
" layers.";
220 for (
auto il = layerBegin; il != layerEnd; il++) {
221 LogDebug(
"CkfPattern") <<
"looping on a layer in findCompatibleMeasurements.\n last layer: " << traj.
lastLayer()
222 <<
" current layer: " << (*il);
224 TSOS stateToUse = stateAndLayers.first;
227 LogDebug(
"CkfPattern") <<
" self propagating in findCompatibleMeasurements.\n from: \n" << stateToUse;
232 stateToUse = middle.
extrapolate(stateToUse, center, *fwdPropagator);
236 LogDebug(
"CkfPattern") <<
"to: " << stateToUse;
240 std::vector<TrajectoryMeasurement>&&
tmp =
241 layerMeasurements.measurements((**il), stateToUse, *fwdPropagator, *
theEstimator);
249 result.end() - invalidHits, std::make_move_iterator(
tmp.begin()), std::make_move_iterator(
tmp.end()));
260 LogDebug(
"CkfPattern") <<
"starting from:\n" 261 <<
"x: " << stateAndLayers.first.globalPosition() <<
"\n" 262 <<
"p: " << stateAndLayers.first.globalMomentum() <<
"\n" 266 bool afterInvalid =
false;
267 for (vector<TM>::const_iterator
i =
result.begin();
i !=
result.end();
i++) {
268 if (!
i->recHit().isValid())
270 if (afterInvalid &&
i->recHit().isValid()) {
271 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
int theMinHitForDoubleBonus
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
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.
void buildTrajectories(const TrajectorySeed &, TrajectoryContainer &ret, unsigned int &nCandPerSeed, const TrajectoryFilter *) const override