145 unsigned int& nCandPerSeed,
149 <<
"Asking to create trajectories to an un-initialized CkfTrajectoryBuilder.\nYou have to call clone(const "
150 "MeasurementTrackerEvent *data) and then call trajectories on it instead.\n";
181 unsigned int nIter = 1;
182 unsigned int nCands = 0;
183 unsigned int prevNewCandSize = 0;
194 std::vector<TM> meas;
206 std::vector<TM>::const_iterator
last;
210 if (meas.front().recHit()->isValid()) {
211 last = find_if(meas.begin(), meas.end(), [](
auto const& meas) {
return !meas.recHit()->isValid(); });
216 for (
auto itm = meas.begin(); itm !=
last; itm++) {
222 std::push_heap(newCand.begin(), newCand.end(), trajCandLess);
233 nCands += newCand.size() - prevNewCandSize;
234 prevNewCandSize = newCand.size();
269 std::pop_heap(newCand.begin(), newCand.end(), trajCandLess);
287 std::sort_heap(newCand.begin(), newCand.end(), trajCandLess);
293 LogDebug(
"CkfPattern") <<
result.size() <<
" candidates after " << nIter++ <<
" CKF iteration: \n"
295 <<
" running candidates are: \n"
302 auto&& predictedState = tm.predictedState();
303 auto&&
hit = tm.recHit();
304 if (
hit->isValid()) {
308 traj.
emplace(predictedState,
hit, 0, tm.layer());
314 std::vector<TrajectoryMeasurement>&
result)
const {
318 if (stateAndLayers.second.empty())
321 auto layerBegin = stateAndLayers.second.begin();
322 auto layerEnd = stateAndLayers.second.end();
323 LogDebug(
"CkfPattern") <<
"looping on " << stateAndLayers.second.size() <<
" layers.";
325 for (
auto il = layerBegin; il != layerEnd; il++) {
326 LogDebug(
"CkfPattern") <<
"looping on a layer in findCompatibleMeasurements.\n last layer: " << traj.
lastLayer()
327 <<
" current layer: " << (*il);
329 TSOS stateToUse = stateAndLayers.first;
332 LogDebug(
"CkfPattern") <<
" self propagating in findCompatibleMeasurements.\n from: \n" << stateToUse;
337 stateToUse = middle.
extrapolate(stateToUse, center, *fwdPropagator);
341 LogDebug(
"CkfPattern") <<
"to: " << stateToUse;
345 std::vector<TrajectoryMeasurement>&&
tmp =
346 layerMeasurements.measurements((**il), stateToUse, *fwdPropagator, *
theEstimator);
354 result.end() - invalidHits, std::make_move_iterator(
tmp.begin()), std::make_move_iterator(
tmp.end()));
365 LogDebug(
"CkfPattern") <<
"starting from:\n"
366 <<
"x: " << stateAndLayers.first.globalPosition() <<
"\n"
367 <<
"p: " << stateAndLayers.first.globalMomentum() <<
"\n"
371 bool afterInvalid =
false;
372 for (vector<TM>::const_iterator
i =
result.begin();
i !=
result.end();
i++) {
373 if (!
i->recHit().isValid())
375 if (afterInvalid &&
i->recHit().isValid()) {
376 edm::LogError(
"CkfPattern") <<
"CkfTrajectoryBuilder error: valid hit after invalid!";