156 std::unique_ptr<MeasurementTrackerEvent> dataWithMasks;
162 dataWithMasks = std::make_unique<MeasurementTrackerEvent>(*
data, *stripMask, *pixelMask);
171 dataWithMasks = std::make_unique<MeasurementTrackerEvent>(*
data, *pixelMask, *phase2OTMask);
180 es, static_cast<TkTransientTrackingRecHitBuilder const*>(
theTrajectoryBuilder->hitBuilder())->cloner());
188 auto output = std::make_unique<TrackCandidateCollection>();
189 auto outputT = std::make_unique<std::vector<Trajectory>>();
190 auto outputSeedStopInfos = std::make_unique<std::vector<SeedStopInfo>>(collseed->size());
194 <<
" nSeed=" << (*collseed).size();
206 if (!(*collseed).empty()) {
207 unsigned int lastCleanResult = 0;
208 std::vector<Trajectory> rawResult;
209 rawResult.reserve(collseed->size() * 4);
219 using Lock = std::unique_lock<std::mutex>;
222 size_t collseed_size = collseed->size();
224 unsigned int indeces[collseed_size];
225 for (
auto i = 0
U;
i < collseed_size; ++
i)
233 auto const&
seeds = *collseed;
235 float val[collseed_size];
236 for (
auto i = 0
U;
i < collseed_size; ++
i) {
254 std::sort(indeces, indeces + collseed_size, [&](
unsigned int i,
unsigned int j) {
return val[
i] <
val[
j]; });
259 std::atomic<unsigned int> ntseed(0);
260 auto theLoop = [&](
size_t ii) {
261 auto j = indeces[
ii];
266 std::vector<Trajectory> theTmpTrajectories;
268 LogDebug(
"CkfPattern") <<
"======== Begin to look for trajectories from seed " <<
j <<
" ========\n";
274 LogDebug(
"CkfTrackCandidateMakerBase") <<
" Seed cleaning kills seed " <<
j;
281 theTmpTrajectories.clear();
282 unsigned int nCandPerSeed = 0;
286 (*outputSeedStopInfos)[
j].setCandidatesPerSeed(nCandPerSeed);
287 if (theTmpTrajectories.empty()) {
293 LogDebug(
"CkfPattern") <<
"======== In-out trajectory building found " << theTmpTrajectories.size()
294 <<
" trajectories from seed " <<
j <<
" ========\n" 301 LogDebug(
"CkfPattern") <<
"======== In-out trajectory cleaning gave the following " 302 << theTmpTrajectories.size() <<
" valid trajectories from seed " <<
j <<
" ========\n" 312 LogDebug(
"CkfPattern") <<
"======== Out-in trajectory building found " << theTmpTrajectories.size()
313 <<
" valid/invalid trajectories from seed " <<
j <<
" ========\n" 315 if (theTmpTrajectories.empty()) {
325 LogDebug(
"CkfPattern") <<
"======== Trajectory cleaning gave the following " << theTmpTrajectories.size()
326 <<
" valid trajectories from seed " <<
j <<
" ========\n" 331 for (vector<Trajectory>::iterator
it = theTmpTrajectories.begin();
it != theTmpTrajectories.end();
it++) {
333 it->setSeedRef(collseed->refAt(
j));
346 theTmpTrajectories.clear();
348 LogDebug(
"CkfPattern") <<
"rawResult trajectories found so far = " << rawResult.size();
355 std::remove_if(rawResult.begin() + lastCleanResult, rawResult.end(), std::not_fn(&
Trajectory::isValid)),
357 lastCleanResult = rawResult.size();
364 tbb::parallel_for(0UL, collseed_size, 1UL, theLoop);
367 #pragma omp parallel for schedule(dynamic, 4) 369 for (
size_t j = 0;
j < collseed_size;
j++) {
373 assert(ntseed == collseed_size);
379 #ifdef VI_REPRODUCIBLE 382 return a.seedRef().key() <
b.seedRef().key();
391 LogDebug(
"CkfPattern") <<
"======== Final cleaning of entire event found " << rawResult.size()
392 <<
" valid/invalid trajectories =======" << endl
395 LogDebug(
"CkfPattern") <<
"removing invalid trajectories.";
398 for (
const auto& traj : rawResult) {
399 if (!traj.isValid()) {
400 const auto seedIndex = traj.seedRef().key();
407 vector<Trajectory>& unsmoothedResult(rawResult);
408 unsmoothedResult.erase(
409 std::remove_if(unsmoothedResult.begin(), unsmoothedResult.end(), std::not_fn(&
Trajectory::isValid)),
410 unsmoothedResult.end());
411 unsmoothedResult.shrink_to_fit();
414 for (
auto it = unsmoothedResult.begin(), ed = unsmoothedResult.end();
it != ed; ++
it) {
416 if (
it->lastMeasurement().updatedState().isValid() &&
it->lastMeasurement().recHit().get() !=
nullptr &&
417 it->lastMeasurement().recHit()->isValid()) {
427 auto initId =
it->lastMeasurement().recHitR().rawId();
430 hits.push_back(
it->lastMeasurement().recHit()->hit()->clone());
434 trajectory.setSeedRef(
it->seedRef());
435 trajectory.setStopReason(
it->stopReason());
438 trajectory.reserve(meas.size());
439 for (
auto itmeas = meas.rbegin(), endmeas = meas.rend(); itmeas != endmeas; ++itmeas) {
446 <<
"Last measurement of the trajectory is invalid, cannot reverse it";
455 output->reserve(unsmoothedResult.size());
458 for (vector<Trajectory>::const_iterator
it = unsmoothedResult.begin();
it != unsmoothedResult.end(); ++
it) {
460 <<
" hits from trajectory";
463 LogDebug(
"CkfPattern") <<
"not along momentum... " << std::endl;
468 LogDebug(
"CkfPattern") <<
"getting initial state.";
470 std::pair<TrajectoryStateOnSurface, const GeomDet*> initState;
476 LogDebug(
"CkfPattern") <<
"removing last hit";
477 trialTrajectory.
pop();
486 failed = (!initState.first.isValid()) || initState.second ==
nullptr ||
491 const auto seedIndex =
it->seedRef().key();
498 LogDebug(
"CkfPattern") <<
"propagating to hit front in case of splitting.";
507 LogDebug(
"CkfPattern") <<
"pushing a TrackCandidate.";
512 LogTrace(
"CkfPattern|TrackingRegressionTest")
513 <<
"========== CkfTrackCandidateMaker Info ==========" 514 <<
"number of Seed: " << collseed->size() <<
'\n' 521 outputT->swap(unsmoothedResult);
virtual void deleteAssocDebugger()
static std::string dumpCandidates(collection &candidates)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
bool theTrackCandidateOutput
constexpr bool isNotFinite(T x)
edm::EDGetTokenT< StripClusterMask > maskStrips_
std::unique_ptr< TransientInitialStateEstimator > theInitialState
virtual void clean(TempTrajectoryContainer &) const
virtual void printHitsDebugger(edm::Event &e)
Log< level::Error, false > LogError
unsigned int theMaxNSeeds
std::unique_ptr< RedundantSeedCleaner > theSeedCleaner
static std::string regressionTest(const TrackerGeometry &tracker, std::vector< Trajectory > &unsmoothedResult)
edm::EDGetTokenT< PixelClusterMask > maskPixels_
std::vector< TrajectoryMeasurement > DataContainer
const TrajectoryCleaner * theTrajectoryCleaner
std::unique_ptr< BaseCkfTrajectoryBuilder > theTrajectoryBuilder
edm::EDGetTokenT< MeasurementTrackerEvent > theMTELabel
unsigned int maxSeedsBeforeCleaning_
edm::EDGetTokenT< Phase2OTClusterMask > maskPhase2OTs_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken
edm::EDGetTokenT< edm::View< TrajectorySeed > > theSeedLabel
bool const skipPhase2Clusters_
void setNLoops(int8_t value)
bool doSeedingRegionRebuilding
edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropagatorToken
void setEventSetup(const edm::EventSetup &es)
Initialize EventSetup objects at each event.
char data[epos_bytes_allocation]
Log< level::Warning, false > LogWarning
virtual void countSeedsDebugger()
bool cleanTrajectoryAfterInOut