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;
287 (*outputSeedStopInfos)[
j].setCandidatesPerSeed(nCandPerSeed);
288 if (theTmpTrajectories.empty()) {
294 LogDebug(
"CkfPattern") <<
"======== In-out trajectory building found " << theTmpTrajectories.size()
295 <<
" trajectories from seed " <<
j <<
" ========\n" 302 LogDebug(
"CkfPattern") <<
"======== In-out trajectory cleaning gave the following " 303 << theTmpTrajectories.size() <<
" valid trajectories from seed " <<
j <<
" ========\n" 313 LogDebug(
"CkfPattern") <<
"======== Out-in trajectory building found " << theTmpTrajectories.size()
314 <<
" valid/invalid trajectories from seed " <<
j <<
" ========\n" 316 if (theTmpTrajectories.empty()) {
326 LogDebug(
"CkfPattern") <<
"======== Trajectory cleaning gave the following " << theTmpTrajectories.size()
327 <<
" valid trajectories from seed " <<
j <<
" ========\n" 332 for (vector<Trajectory>::iterator
it = theTmpTrajectories.begin();
it != theTmpTrajectories.end();
it++) {
334 it->setSeedRef(collseed->refAt(
j));
347 theTmpTrajectories.clear();
349 LogDebug(
"CkfPattern") <<
"rawResult trajectories found so far = " << rawResult.size();
356 std::remove_if(rawResult.begin() + lastCleanResult, rawResult.end(), std::not_fn(&
Trajectory::isValid)),
358 lastCleanResult = rawResult.size();
365 tbb::parallel_for(0UL, collseed_size, 1UL, theLoop);
368 #pragma omp parallel for schedule(dynamic, 4) 370 for (
size_t j = 0;
j < collseed_size;
j++) {
374 assert(ntseed == collseed_size);
380 #ifdef VI_REPRODUCIBLE 383 return a.seedRef().key() <
b.seedRef().key();
392 LogDebug(
"CkfPattern") <<
"======== Final cleaning of entire event found " << rawResult.size()
393 <<
" valid/invalid trajectories =======" << endl
396 LogDebug(
"CkfPattern") <<
"removing invalid trajectories.";
399 for (
const auto& traj : rawResult) {
400 if (!traj.isValid()) {
401 const auto seedIndex = traj.seedRef().key();
408 vector<Trajectory>& unsmoothedResult(rawResult);
409 unsmoothedResult.erase(
410 std::remove_if(unsmoothedResult.begin(), unsmoothedResult.end(), std::not_fn(&
Trajectory::isValid)),
411 unsmoothedResult.end());
412 unsmoothedResult.shrink_to_fit();
415 for (
auto it = unsmoothedResult.begin(), ed = unsmoothedResult.end();
it != ed; ++
it) {
417 if (
it->lastMeasurement().updatedState().isValid() &&
it->lastMeasurement().recHit().get() !=
nullptr &&
418 it->lastMeasurement().recHit()->isValid()) {
428 auto initId =
it->lastMeasurement().recHitR().rawId();
431 hits.push_back(
it->lastMeasurement().recHit()->hit()->clone());
435 trajectory.setSeedRef(
it->seedRef());
436 trajectory.setStopReason(
it->stopReason());
439 trajectory.reserve(meas.size());
440 for (
auto itmeas = meas.rbegin(), endmeas = meas.rend(); itmeas != endmeas; ++itmeas) {
447 <<
"Last measurement of the trajectory is invalid, cannot reverse it";
456 output->reserve(unsmoothedResult.size());
459 for (vector<Trajectory>::const_iterator
it = unsmoothedResult.begin();
it != unsmoothedResult.end(); ++
it) {
461 <<
" hits from trajectory";
464 LogDebug(
"CkfPattern") <<
"not along momentum... " << std::endl;
469 LogDebug(
"CkfPattern") <<
"getting initial state.";
471 std::pair<TrajectoryStateOnSurface, const GeomDet*> initState;
477 LogDebug(
"CkfPattern") <<
"removing last hit";
478 trialTrajectory.
pop();
487 failed = (!initState.first.isValid()) || initState.second ==
nullptr ||
492 const auto seedIndex =
it->seedRef().key();
499 LogDebug(
"CkfPattern") <<
"propagating to hit front in case of splitting.";
508 LogDebug(
"CkfPattern") <<
"pushing a TrackCandidate.";
513 LogTrace(
"CkfPattern|TrackingRegressionTest")
514 <<
"========== CkfTrackCandidateMaker Info ==========" 515 <<
"number of Seed: " << collseed->size() <<
'\n' 522 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