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()) {
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;
333 LogDebug(
"CkfPattern") <<
" self propagating in findCompatibleMeasurements.\n from: \n" << stateToUse;
338 stateToUse = middle.
extrapolate(stateToUse, center, *fwdPropagator);
342 LogDebug(
"CkfPattern") <<
"to: " << stateToUse;
346 std::vector<TrajectoryMeasurement>&&
tmp =
347 layerMeasurements.measurements((**il), stateToUse, *fwdPropagator, *
theEstimator);
355 result.end() - invalidHits, std::make_move_iterator(
tmp.begin()), std::make_move_iterator(
tmp.end()));
366 LogDebug(
"CkfPattern") <<
"starting from:\n"
367 <<
"x: " << stateAndLayers.first.globalPosition() <<
"\n"
368 <<
"p: " << stateAndLayers.first.globalMomentum() <<
"\n"
372 bool afterInvalid =
false;
373 for (vector<TM>::const_iterator
i =
result.begin();
i !=
result.end();
i++) {
374 if (!
i->recHit().isValid())
376 if (afterInvalid &&
i->recHit().isValid()) {
377 edm::LogError(
"CkfPattern") <<
"CkfTrajectoryBuilder error: valid hit after invalid!";