157 std::unique_ptr<MeasurementTrackerEvent> dataWithMasks;
163 dataWithMasks = std::make_unique<MeasurementTrackerEvent>(*
data, *stripMask, *pixelMask);
172 dataWithMasks = std::make_unique<MeasurementTrackerEvent>(*
data, *pixelMask, *phase2OTMask);
181 es, static_cast<TkTransientTrackingRecHitBuilder const*>(
theTrajectoryBuilder->hitBuilder())->cloner());
189 auto output = std::make_unique<TrackCandidateCollection>();
190 auto outputT = std::make_unique<std::vector<Trajectory>>();
191 auto outputSeedStopInfos = std::make_unique<std::vector<SeedStopInfo>>(collseed->size());
195 <<
" nSeed=" << (*collseed).size();
207 if (!(*collseed).empty()) {
208 unsigned int lastCleanResult = 0;
209 std::vector<Trajectory> rawResult;
210 rawResult.reserve(collseed->size() * 4);
220 using Lock = std::unique_lock<std::mutex>;
223 size_t collseed_size = collseed->size();
225 unsigned int indeces[collseed_size];
226 for (
auto i = 0
U;
i < collseed_size; ++
i)
234 auto const&
seeds = *collseed;
236 float val[collseed_size];
237 for (
auto i = 0
U;
i < collseed_size; ++
i) {
255 std::sort(indeces, indeces + collseed_size, [&](
unsigned int i,
unsigned int j) {
return val[
i] <
val[
j]; });
260 std::atomic<unsigned int> ntseed(0);
261 auto theLoop = [&](
size_t ii) {
262 auto j = indeces[
ii];
267 std::vector<Trajectory> theTmpTrajectories;
269 LogDebug(
"CkfPattern") <<
"======== Begin to look for trajectories from seed " <<
j <<
" ========\n";
275 LogDebug(
"CkfTrackCandidateMakerBase") <<
" Seed cleaning kills seed " <<
j;
282 theTmpTrajectories.clear();
283 unsigned int nCandPerSeed = 0;
284 auto const& startTraj =
288 (*outputSeedStopInfos)[
j].setCandidatesPerSeed(nCandPerSeed);
289 if (theTmpTrajectories.empty()) {
295 LogDebug(
"CkfPattern") <<
"======== In-out trajectory building found " << theTmpTrajectories.size()
296 <<
" trajectories from seed " <<
j <<
" ========\n" 303 LogDebug(
"CkfPattern") <<
"======== In-out trajectory cleaning gave the following " 304 << theTmpTrajectories.size() <<
" valid trajectories from seed " <<
j <<
" ========\n" 314 LogDebug(
"CkfPattern") <<
"======== Out-in trajectory building found " << theTmpTrajectories.size()
315 <<
" valid/invalid trajectories from seed " <<
j <<
" ========\n" 317 if (theTmpTrajectories.empty()) {
327 LogDebug(
"CkfPattern") <<
"======== Trajectory cleaning gave the following " << theTmpTrajectories.size()
328 <<
" valid trajectories from seed " <<
j <<
" ========\n" 333 for (vector<Trajectory>::iterator
it = theTmpTrajectories.begin();
it != theTmpTrajectories.end();
it++) {
335 it->setSeedRef(collseed->refAt(
j));
348 theTmpTrajectories.clear();
350 LogDebug(
"CkfPattern") <<
"rawResult trajectories found so far = " << rawResult.size();
357 std::remove_if(rawResult.begin() + lastCleanResult, rawResult.end(), std::not_fn(&
Trajectory::isValid)),
359 lastCleanResult = rawResult.size();
366 tbb::parallel_for(0UL, collseed_size, 1UL, theLoop);
369 #pragma omp parallel for schedule(dynamic, 4) 371 for (
size_t j = 0;
j < collseed_size;
j++) {
375 assert(ntseed == collseed_size);
381 #ifdef VI_REPRODUCIBLE 384 return a.seedRef().key() <
b.seedRef().key();
393 LogDebug(
"CkfPattern") <<
"======== Final cleaning of entire event found " << rawResult.size()
394 <<
" valid/invalid trajectories =======" << endl
397 LogDebug(
"CkfPattern") <<
"removing invalid trajectories.";
400 for (
const auto& traj : rawResult) {
401 if (!traj.isValid()) {
402 const auto seedIndex = traj.seedRef().key();
409 vector<Trajectory>& unsmoothedResult(rawResult);
410 unsmoothedResult.erase(
411 std::remove_if(unsmoothedResult.begin(), unsmoothedResult.end(), std::not_fn(&
Trajectory::isValid)),
412 unsmoothedResult.end());
413 unsmoothedResult.shrink_to_fit();
416 for (
auto it = unsmoothedResult.begin(), ed = unsmoothedResult.end();
it != ed; ++
it) {
418 if (
it->lastMeasurement().updatedState().isValid() &&
it->lastMeasurement().recHit().get() !=
nullptr &&
419 it->lastMeasurement().recHit()->isValid()) {
429 auto initId =
it->lastMeasurement().recHitR().rawId();
432 hits.push_back(
it->lastMeasurement().recHit()->hit()->clone());
436 trajectory.setSeedRef(
it->seedRef());
437 trajectory.setStopReason(
it->stopReason());
440 trajectory.reserve(meas.size());
441 for (
auto itmeas = meas.rbegin(), endmeas = meas.rend(); itmeas != endmeas; ++itmeas) {
448 <<
"Last measurement of the trajectory is invalid, cannot reverse it";
457 output->reserve(unsmoothedResult.size());
460 for (vector<Trajectory>::const_iterator
it = unsmoothedResult.begin();
it != unsmoothedResult.end(); ++
it) {
462 <<
" hits from trajectory";
465 LogDebug(
"CkfPattern") <<
"not along momentum... " << std::endl;
470 LogDebug(
"CkfPattern") <<
"getting initial state.";
472 std::pair<TrajectoryStateOnSurface, const GeomDet*> initState;
478 LogDebug(
"CkfPattern") <<
"removing last hit";
479 trialTrajectory.
pop();
488 failed = (!initState.first.isValid()) || initState.second ==
nullptr ||
493 const auto seedIndex =
it->seedRef().key();
500 LogDebug(
"CkfPattern") <<
"propagating to hit front in case of splitting.";
509 LogDebug(
"CkfPattern") <<
"pushing a TrackCandidate.";
514 LogTrace(
"CkfPattern|TrackingRegressionTest")
515 <<
"========== CkfTrackCandidateMaker Info ==========" 516 <<
"number of Seed: " << collseed->size() <<
'\n' 523 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
void setNLoops(signed char value)
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_
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