CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
TrajectorySegmentBuilder Class Reference

#include <TrajectorySegmentBuilder.h>

Public Member Functions

TempTrajectoryContainer segments (const TSOS startingState)
 new segments within layer More...
 
 TrajectorySegmentBuilder (const LayerMeasurements *theInputLayerMeasurements, const DetLayer &layer, const Propagator &propagator, const TrajectoryStateUpdator &updator, const MeasurementEstimator &estimator, bool lockHits, bool bestHitOnly, int maxCand)
 constructor from layer and helper objects More...
 
 ~TrajectorySegmentBuilder ()
 destructor More...
 

Private Types

typedef TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
 
typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
 
typedef FreeTrajectoryState FTS
 
typedef std::vector< TempTrajectoryTempTrajectoryContainer
 
typedef TrajectoryMeasurement TM
 
typedef TrajectoryMeasurementGroup TMG
 
typedef std::vector< TrajectoryTrajectoryContainer
 
typedef TrajectoryStateOnSurface TSOS
 

Private Member Functions

std::vector< TempTrajectoryaddGroup (TempTrajectory const &traj, std::vector< TrajectoryMeasurementGroup >::const_iterator begin, std::vector< TrajectoryMeasurementGroup >::const_iterator end)
 
void cleanCandidates (std::vector< TempTrajectory > &candidates) const
 clean a set of candidates More...
 
void lockMeasurement (const TM &measurement)
 mark a hit as used More...
 
std::vector< TrajectoryMeasurementredoMeasurements (const TempTrajectory &traj, const DetGroup &detGroup) const
 retrieve compatible hits from a DetGroup More...
 
std::vector< TrajectoryMeasurementunlockedMeasurements (const std::vector< TM > &measurements) const
 get list of unused hits More...
 
void updateCandidates (TempTrajectory const &traj, const std::vector< TM > &measurements, TempTrajectoryContainer &candidates)
 creation of new candidates from a segment and a collection of hits More...
 
void updateCandidatesWithBestHit (TempTrajectory const &traj, TM measurements, TempTrajectoryContainer &candidates)
 creation of a new candidate from a segment and the best hit out of a collection More...
 
void updateTrajectory (TempTrajectory &traj, TM tm) const
 update of a trajectory with a hit More...
 
void updateWithInvalidHit (TempTrajectory &traj, const std::vector< TMG > &groups, TempTrajectoryContainer &candidates) const
 

Private Attributes

bool theBestHitOnly
 
bool theDbgFlg
 
const MeasurementEstimatortheEstimator
 
const PropagatortheFullPropagator
 
const PropagatortheGeomPropagator
 
const DetLayertheLayer
 
const LayerMeasurementstheLayerMeasurements
 
ConstRecHitContainer theLockedHits
 
bool theLockHits
 
int theMaxCand
 
const TrajectoryStateUpdatortheUpdator
 

Detailed Description

Definition at line 31 of file TrajectorySegmentBuilder.h.

Member Typedef Documentation

◆ ConstRecHitContainer

Definition at line 40 of file TrajectorySegmentBuilder.h.

◆ ConstRecHitPointer

Definition at line 41 of file TrajectorySegmentBuilder.h.

◆ FTS

Definition at line 34 of file TrajectorySegmentBuilder.h.

◆ TempTrajectoryContainer

Definition at line 39 of file TrajectorySegmentBuilder.h.

◆ TM

Definition at line 36 of file TrajectorySegmentBuilder.h.

◆ TMG

Definition at line 37 of file TrajectorySegmentBuilder.h.

◆ TrajectoryContainer

Definition at line 38 of file TrajectorySegmentBuilder.h.

◆ TSOS

Definition at line 35 of file TrajectorySegmentBuilder.h.

Constructor & Destructor Documentation

◆ TrajectorySegmentBuilder()

TrajectorySegmentBuilder::TrajectorySegmentBuilder ( const LayerMeasurements theInputLayerMeasurements,
const DetLayer layer,
const Propagator propagator,
const TrajectoryStateUpdator updator,
const MeasurementEstimator estimator,
bool  lockHits,
bool  bestHitOnly,
int  maxCand 
)
inline

constructor from layer and helper objects

Definition at line 45 of file TrajectorySegmentBuilder.h.

53  : theLayerMeasurements(theInputLayerMeasurements),
54  theLayer(layer),
59  // theGeomPropagator(propagator.propagationDirection()),

◆ ~TrajectorySegmentBuilder()

TrajectorySegmentBuilder::~TrajectorySegmentBuilder ( )
inline

destructor

Definition at line 65 of file TrajectorySegmentBuilder.h.

65 {}

Member Function Documentation

◆ addGroup()

TrajectorySegmentBuilder::TempTrajectoryContainer TrajectorySegmentBuilder::addGroup ( TempTrajectory const &  traj,
std::vector< TrajectoryMeasurementGroup >::const_iterator  begin,
std::vector< TrajectoryMeasurementGroup >::const_iterator  end 
)
private

Definition at line 216 of file TrajectorySegmentBuilder.cc.

218  {
219  vector<TempTrajectory> ret;
220  if (begin == end) {
221  //std::cout << "TrajectorySegmentBuilder::addGroup" << " traj.empty()=" << traj.empty() << "EMPTY" << std::endl;
222  if
223  UNLIKELY(theDbgFlg) cout << "TSB::addGroup : no groups left" << endl;
224  if (!traj.empty())
225  ret.push_back(traj);
226  return ret;
227  }
228 
229  if
231  cout << "TSB::addGroup : traj.size() = " << traj.measurements().size() << " first group at "
232  << &(*begin)
233  // << " nr. of candidates = " << candidates.size()
234  << endl;
235 
236  TempTrajectoryContainer updatedTrajectories;
237  updatedTrajectories.reserve(2);
238  if (traj.measurements().empty()) {
239  if (theMaxCand == 1) {
240  auto&& firstMeasurements = unlockedMeasurements(begin->measurements());
241  if (!firstMeasurements.empty())
242  updateCandidatesWithBestHit(traj, std::move(firstMeasurements.front()), updatedTrajectories);
243  } else {
244  updateCandidates(traj, begin->measurements(), updatedTrajectories);
245  }
246  if
248  cout << "TSB::addGroup : updating with first group - " << updatedTrajectories.size() << " trajectories" << endl;
249  } else {
250  auto&& meas = redoMeasurements(traj, begin->detGroup());
251  if (!meas.empty()) {
252  if (theBestHitOnly) {
253  updateCandidatesWithBestHit(traj, std::move(meas.front()), updatedTrajectories);
254  } else {
255  updateCandidates(traj, std::move(meas), updatedTrajectories);
256  }
257  if
259  cout << "TSB::addGroup : updating" << updatedTrajectories.size() << " trajectories-1" << endl;
260  }
261  }
262  // keep old trajectory
263  //
264  updatedTrajectories.push_back(traj);
265 
266  if (begin + 1 != end) {
267  ret.reserve(4); // a good upper bound
268  for (auto const& ut : updatedTrajectories) {
269  if
271  cout << "TSB::addGroup : trying to extend candidate at " << &ut << " size " << ut.measurements().size() << endl;
272  vector<TempTrajectory>&& finalTrajectories = addGroup(ut, begin + 1, end);
273  if
275  cout << "TSB::addGroup : " << finalTrajectories.size() << " finalised candidates before cleaning" << endl;
276  //B.M. to be ported later
277  // V.I. only mark invalidate
278  cleanCandidates(finalTrajectories);
279 
280  if
282  int ntf = 0;
283  for (auto const& t : finalTrajectories)
284  if (t.isValid())
285  ++ntf;
286  cout << "TSB::addGroup : got " << ntf << " finalised candidates" << endl;
287  }
288 
289  for (auto& t : finalTrajectories)
290  if (t.isValid())
291  ret.push_back(std::move(t));
292 
293  // ret.insert(ret.end(),make_move_iterator(finalTrajectories.begin()),
294  // make_move_iterator(finalTrajectories.end()));
295  }
296  } else {
297  ret.reserve(updatedTrajectories.size());
298  for (auto& t : updatedTrajectories)
299  if (!t.empty())
300  ret.push_back(std::move(t));
301  }
302 
303  //std::cout << "TrajectorySegmentBuilder::addGroup" <<
304  // " traj.empty()=" << traj.empty() <<
305  // " end-begin=" << (end-begin) <<
306  // " #updated=" << updatedTrajectories.size() <<
307  // " #result=" << ret.size() << std::endl;
308  return ret;
309 }

References begin, gather_cfg::cout, cmsutils::bqueue< T >::empty(), TempTrajectory::empty(), end, TempTrajectory::measurements(), eostools::move(), runTheMatrix::ret, cmsutils::bqueue< T >::size(), OrderedSet::t, and UNLIKELY.

◆ cleanCandidates()

void TrajectorySegmentBuilder::cleanCandidates ( std::vector< TempTrajectory > &  candidates) const
private

clean a set of candidates

Definition at line 483 of file TrajectorySegmentBuilder.cc.

483  {
484  //
485  // remove candidates which are subsets of others
486  // assumptions: no invalid hits and no duplicates
487  //
488  if (candidates.size() <= 1)
489  return;
490  //RecHitEqualByChannels recHitEqual(false,true);
491  //
492  const int NC = candidates.size();
493  int index[NC];
494  for (int i = 0; i != NC; ++i)
495  index[i] = i;
496  std::sort(index, index + NC, [&candidates](int i, int j) { return lessByFoundHits(candidates[i], candidates[j]); });
497  // cout << "SortedCandidates.foundHits";
498  // for (auto i1 : index)
499  // cout << " " << candidates[i1].foundHits();
500  // cout << endl;
501  //
502  for (auto i1 = index; i1 != index + NC - 1; ++i1) {
503  // get measurements of candidate to be checked
504  const TempTrajectory::DataContainer& measurements1 = candidates[*i1].measurements();
505  for (auto i2 = i1 + 1; i2 != index + NC; ++i2) {
506  // no duplicates: two candidates of same size are different
507  if (candidates[*i2].foundHits() == candidates[*i1].foundHits())
508  continue;
509  // get measurements of "reference"
510  const TempTrajectory::DataContainer& measurements2 = candidates[*i2].measurements();
511  //
512  // use the fact that TMs are ordered:
513  // start search in trajectory#1 from last hit match found
514  //
515  bool allFound(true);
516  TempTrajectory::DataContainer::const_iterator from2 = measurements2.rbegin(), im2end = measurements2.rend();
517  for (TempTrajectory::DataContainer::const_iterator im1 = measurements1.rbegin(), im1end = measurements1.rend();
518  im1 != im1end;
519  --im1) {
520  // redundant protection - segments should not contain invalid RecHits
521  // assert( im1->recHit()->isValid());
522  bool found(false);
523  for (TempTrajectory::DataContainer::const_iterator im2 = from2; im2 != im2end; --im2) {
524  // redundant protection - segments should not contain invalid RecHits
525  // assert (im2->recHit()->isValid());
526  if (im1->recHitR().hit()->sharesInput(im2->recHitR().hit(), TrackingRecHit::all)) {
527  found = true;
528  from2 = im2;
529  --from2;
530  break;
531  }
532  }
533  if (!found) {
534  allFound = false;
535  break;
536  }
537  }
538  if (allFound) {
539  candidates[*i1].invalidate();
540  statCount.invalid();
541  }
542  }
543  }
544 }

References TrackingRecHit::all, HLT_2018_cff::candidates, newFWLiteAna::found, mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, dqmiolumiharvest::j, lessByFoundHits(), cmsutils::bqueue< T >::rbegin(), and cmsutils::bqueue< T >::rend().

◆ lockMeasurement()

void TrajectorySegmentBuilder::lockMeasurement ( const TM measurement)
private

mark a hit as used

Definition at line 480 of file TrajectorySegmentBuilder.cc.

480 { theLockedHits.push_back(measurement.recHit()); }

References TrajectoryMeasurement::recHit().

◆ redoMeasurements()

vector< TrajectoryMeasurement > TrajectorySegmentBuilder::redoMeasurements ( const TempTrajectory traj,
const DetGroup detGroup 
) const
private

retrieve compatible hits from a DetGroup

Definition at line 339 of file TrajectorySegmentBuilder.cc.

340  {
341  vector<TM> result;
342  //
343  // loop over all dets
344  //
345  if
346  UNLIKELY(theDbgFlg) cout << "TSB::redoMeasurements : nr. of measurements / group =";
347 
349 
350  for (auto const& det : detGroup) {
351  pair<bool, TrajectoryStateOnSurface> compat = GeomDetCompatibilityChecker().isCompatible(
353 
354  if
355  UNLIKELY(theDbgFlg && !compat.first) std::cout << " 0";
356 
357  if (!compat.first)
358  continue;
359 
360  MeasurementDetWithData mdet = theLayerMeasurements->idToDet(det.det()->geographicalId());
361  // verify also that first (and only!) not be inactive..
362  if (mdet.measurements(compat.second, theEstimator, tmps) && tmps.hits[0]->isValid())
363  for (std::size_t i = 0; i != tmps.size(); ++i)
364  result.emplace_back(compat.second, std::move(tmps.hits[i]), tmps.distances[i], &theLayer);
365 
366  if
367  UNLIKELY(theDbgFlg) std::cout << " " << tmps.size();
368  tmps.clear();
369  }
370 
371  if
372  UNLIKELY(theDbgFlg) cout << endl;
373 
374  std::sort(result.begin(), result.end(), TrajMeasLessEstim());
375 
376  return result;
377 }

References tracking::TempMeasurements::clear(), gather_cfg::cout, tracking::TempMeasurements::distances, tracking::TempMeasurements::hits, mps_fire::i, GeomDetCompatibilityChecker::isCompatible(), TempTrajectory::lastMeasurement(), MeasurementDetWithData::measurements(), eostools::move(), mps_fire::result, tracking::TempMeasurements::size(), UNLIKELY, and TrajectoryMeasurement::updatedState().

◆ segments()

TrajectorySegmentBuilder::TempTrajectoryContainer TrajectorySegmentBuilder::segments ( const TSOS  startingState)

new segments within layer

Definition at line 65 of file TrajectorySegmentBuilder.cc.

65  {
66  //
67  // create empty trajectory
68  //
69  theLockedHits.clear();
70  TempTrajectory startingTrajectory(theFullPropagator.propagationDirection(), 0);
71  //
72  // get measurement groups
73  //
74  auto&& measGroups =
76 
77 #ifdef DBG_TSB
78  cout << "TSB: number of measurement groups = " << measGroups.size() << endl;
79  // theDbgFlg = measGroups.size()>1;
80  theDbgFlg = true;
81 #else
82  theDbgFlg = false;
83 #endif
84 
85 #ifdef TSB_TRUNCATE
86  // V.I. to me makes things slower...
87 
88  //
89  // check number of combinations
90  //
91  constexpr long long MAXCOMB = 100000000;
92  long long ncomb(1);
93  int ngrp(0);
94  bool truncate(false);
95  for (auto const& gr : measGroups) {
96  ++ngrp;
97  int nhit(0);
98  for (auto const& m : gr.measurements())
99  if
100  LIKELY(m.recHitR().isValid()) nhit++;
101 
102  if (nhit > 1)
103  ncomb *= nhit;
104  if
105  UNLIKELY(ncomb > MAXCOMB) {
106  edm::LogInfo("TrajectorySegmentBuilder")
107  << " found " << measGroups.size() << " groups and more than " << static_cast<unsigned int>(MAXCOMB)
108  << " combinations - limiting to " << (ngrp - 1) << " groups";
109  truncate = true;
110 
111  statCount.truncated();
112 
113  break;
114  }
115  }
116  // cout << "Groups / combinations = " << measGroups.size() << " " << ncomb << endl;
117  if
118  UNLIKELY(truncate && ngrp > 0) measGroups.resize(ngrp - 1);
119 
120 #endif
121 
122 #ifdef DBG_TSB
123  if (theDbgFlg) {
124  int ntot(1);
125  for (vector<TMG>::const_iterator ig = measGroups.begin(); ig != measGroups.end(); ++ig) {
126  int ngrp(0);
127  const vector<TM>& measurements = ig->measurements();
128  for (vector<TM>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
129  if (im->recHit()->isValid())
130  ngrp++;
131  }
132  cout << " " << ngrp;
133  if (ngrp > 0)
134  ntot *= ngrp;
135  }
136  cout << endl;
137  cout << "TrajectorySegmentBuilder::partialTrajectories:: det ids & hit types / group" << endl;
138  for (vector<TMG>::const_iterator ig = measGroups.begin(); ig != measGroups.end(); ++ig) {
139  const vector<TM>& measurements = ig->measurements();
140  for (vector<TM>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
141  if (im != measurements.begin())
142  cout << " / ";
143  if (im->recHit()->det())
144  cout << im->recHit()->det()->geographicalId().rawId() << " " << im->recHit()->getType();
145  else
146  cout << "no det";
147  }
148  cout << endl;
149  }
150 
151  // if ( measGroups.size()>4 ) {
152  cout << typeid(theLayer).name() << endl;
153  cout << startingState.localError().matrix() << endl;
154  // for (vector<TMG>::const_iterator ig=measGroups.begin();
155  // ig!=measGroups.end(); ig++) {
156  // cout << "Nr. of measurements = " << ig->measurements().size() << endl;
157  // const DetGroup& dg = ig->detGroup();
158  // for ( DetGroup::const_iterator id=dg.begin();
159  // id!=dg.end(); id++ ) {
160  // GlobalPoint p(id->det()->position());
161  // GlobalVector v(id->det()->toGlobal(LocalVector(0.,0.,1.)));
162  // cout << p.perp() << " " << p.phi() << " " << p.z() << " ; "
163  // << v.phi() << " " << v.z() << endl;
164  // }
165  // }
166  // }
167  }
168 #endif
169 
170  TempTrajectoryContainer candidates = addGroup(startingTrajectory, measGroups.begin(), measGroups.end());
171 
172  if
173  UNLIKELY(theDbgFlg) cout << "TSB: back with " << candidates.size() << " candidates" << endl;
174 
175  //
176  // add invalid hit - try to get first detector hit by the extrapolation
177  //
178 
179  updateWithInvalidHit(startingTrajectory, measGroups, candidates);
180 
181  if
182  UNLIKELY(theDbgFlg) cout << "TSB: " << candidates.size() << " candidates after invalid hit" << endl;
183 
184  statCount.incr(measGroups.size(), candidates.size(), theLockedHits.size());
185 
186  theLockedHits.clear();
187 
188  return candidates;
189 }

References HLT_2018_cff::candidates, gather_cfg::cout, LIKELY, TrajectoryStateOnSurface::localError(), visualization-live-secondInstance_cfg::m, LocalTrajectoryError::matrix(), Skims_PA_cff::name, and UNLIKELY.

◆ unlockedMeasurements()

vector< TrajectoryMeasurement > TrajectorySegmentBuilder::unlockedMeasurements ( const std::vector< TM > &  measurements) const
private

get list of unused hits

Definition at line 452 of file TrajectorySegmentBuilder.cc.

452  {
453  // if ( !theLockHits ) return measurements;
454 
455  vector<TM> result;
456  result.reserve(measurements.size());
457 
458  //RecHitEqualByChannels recHitEqual(false,true);
459 
460  for (auto const& m : measurements) {
461  auto const& testHit = m.recHitR();
462  if
463  UNLIKELY(!testHit.isValid()) continue;
464  bool found(false);
465  if
467  for (auto const& h : theLockedHits) {
468  if (h->hit()->sharesInput(testHit.hit(), TrackingRecHit::all)) {
469  found = true;
470  break;
471  }
472  }
473  }
474  if
475  LIKELY(!found) result.push_back(m);
476  }
477  return result;
478 }

References TrackingRecHit::all, newFWLiteAna::found, LIKELY, visualization-live-secondInstance_cfg::m, mps_fire::result, and UNLIKELY.

◆ updateCandidates()

void TrajectorySegmentBuilder::updateCandidates ( TempTrajectory const &  traj,
const std::vector< TM > &  measurements,
TempTrajectoryContainer candidates 
)
private

creation of new candidates from a segment and a collection of hits

Definition at line 311 of file TrajectorySegmentBuilder.cc.

313  {
314  //
315  // generate updated candidates with all valid hits
316  //
317  for (auto im = measurements.begin(); im != measurements.end(); ++im) {
318  if (im->recHit()->isValid()) {
319  candidates.push_back(traj);
320  updateTrajectory(candidates.back(), *im);
321  if (theLockHits)
322  lockMeasurement(*im);
323  }
324  }
325 }

References HLT_2018_cff::candidates.

◆ updateCandidatesWithBestHit()

void TrajectorySegmentBuilder::updateCandidatesWithBestHit ( TempTrajectory const &  traj,
TM  measurements,
TempTrajectoryContainer candidates 
)
private

creation of a new candidate from a segment and the best hit out of a collection

Definition at line 327 of file TrajectorySegmentBuilder.cc.

329  {
330  // here we arrive with only valid hits and sorted.
331  //so the best is the first!
332 
333  if (theLockHits)
334  lockMeasurement(measurement);
335  candidates.push_back(traj);
336  updateTrajectory(candidates.back(), std::move(measurement));
337 }

References HLT_2018_cff::candidates, and eostools::move().

◆ updateTrajectory()

void TrajectorySegmentBuilder::updateTrajectory ( TempTrajectory traj,
TM  tm 
) const
private

update of a trajectory with a hit

Definition at line 191 of file TrajectorySegmentBuilder.cc.

191  {
192  auto&& predictedState = tm.predictedState();
193  auto&& hit = tm.recHit();
194 
195  if (hit->isValid()) {
196  auto&& upState = theUpdator.update(predictedState, *hit);
197  traj.emplace(std::move(predictedState), std::move(upState), std::move(hit), tm.estimate(), tm.layer());
198 
199  // TrajectoryMeasurement tm(traj.lastMeasurement());
200  // if ( tm.updatedState().isValid() ) {
201  // if ( !hit.det().surface()->bounds().inside(tm.updatedState().localPosition(),
202  // tm.updatedState().localError().positionError(),3.f) ) {
203  // cout << "Incompatibility after update for det at " << hit.det().position() << ":" << endl;
204  // cout << tm.predictedState().localPosition() << " "
205  // << tm.predictedState().localError().positionError() << endl;
206  // cout << hit.localPosition() << " " << hit.localPositionError() << endl;
207  // cout << tm.updatedState().localPosition() << " "
208  // << tm.updatedState().localError().positionError() << endl;
209  // }
210  // }
211  } else {
212  traj.emplace(std::move(predictedState), std::move(hit), 0, tm.layer());
213  }
214 }

References TempTrajectory::emplace(), TrajectoryMeasurement::estimate(), TrajectoryMeasurement::layer(), eostools::move(), TrajectoryMeasurement::predictedState(), and TrajectoryMeasurement::recHit().

◆ updateWithInvalidHit()

void TrajectorySegmentBuilder::updateWithInvalidHit ( TempTrajectory traj,
const std::vector< TMG > &  groups,
TempTrajectoryContainer candidates 
) const
private

Definition at line 379 of file TrajectorySegmentBuilder.cc.

381  {
382  //
383  // first try to find an inactive hit with dets crossed by the prediction,
384  // then take any inactive hit
385  //
386  // loop over groups
387  for (int iteration = 0; iteration < 2; iteration++) {
388  for (auto const& gr : groups) {
389  auto const& measurements = gr.measurements();
390  for (auto im = measurements.rbegin(); im != measurements.rend(); ++im) {
391  auto const& hit = im->recHitR();
392  if ((hit.getType() == TrackingRecHit::valid) | (hit.getType() == TrackingRecHit::missing))
393  continue;
394  //
395  // check, if the extrapolation traverses the Det or
396  // if 2nd iteration
397  //
398  if (hit.det()) {
399  auto const& predState = im->predictedState();
400  if (iteration > 0 ||
401  (predState.isValid() && hit.det()->surface().bounds().inside(predState.localPosition()))) {
402  // add the hit
403  candidates.push_back(traj);
404  updateTrajectory(candidates.back(), *im);
405  if
407  cout << "TrajectorySegmentBuilder::updateWithInvalidHit "
408  << "added inactive hit" << endl;
409  return;
410  }
411  }
412  }
413  }
414  }
415  //
416  // No suitable inactive hit: add a missing one
417  //
418  for (int iteration = 0; iteration < 2; iteration++) {
419  //
420  // loop over groups
421  //
422  for (auto const& gr : groups) {
423  auto const& measurements = gr.measurements();
424  for (auto im = measurements.rbegin(); im != measurements.rend(); ++im) {
425  // only use invalid hits
426  auto const& hit = im->recHitR();
427  if
428  LIKELY(hit.isValid()) continue;
429 
430  // check, if the extrapolation traverses the Det
431  auto const& predState = im->predictedState();
432  if (iteration > 0 || (predState.isValid() && hit.surface()->bounds().inside(predState.localPosition()))) {
433  // add invalid hit
434  candidates.push_back(traj);
435  updateTrajectory(candidates.back(), *im);
436  return;
437  }
438  }
439  }
440  if
441  UNLIKELY(theDbgFlg && iteration == 0)
443  << " did not find invalid hit on 1st iteration" << endl;
444  }
445 
446  if
449  << " did not find invalid hit" << endl;
450 }

References HLT_2018_cff::candidates, gather_cfg::cout, align_cfg::iteration, LIKELY, TrackingRecHit::missing, UNLIKELY, and TrackingRecHit::valid.

Member Data Documentation

◆ theBestHitOnly

bool TrajectorySegmentBuilder::theBestHitOnly
private

Definition at line 116 of file TrajectorySegmentBuilder.h.

◆ theDbgFlg

bool TrajectorySegmentBuilder::theDbgFlg
private

Definition at line 120 of file TrajectorySegmentBuilder.h.

◆ theEstimator

const MeasurementEstimator& TrajectorySegmentBuilder::theEstimator
private

Definition at line 111 of file TrajectorySegmentBuilder.h.

◆ theFullPropagator

const Propagator& TrajectorySegmentBuilder::theFullPropagator
private

Definition at line 109 of file TrajectorySegmentBuilder.h.

◆ theGeomPropagator

const Propagator& TrajectorySegmentBuilder::theGeomPropagator
private

Definition at line 113 of file TrajectorySegmentBuilder.h.

◆ theLayer

const DetLayer& TrajectorySegmentBuilder::theLayer
private

Definition at line 108 of file TrajectorySegmentBuilder.h.

◆ theLayerMeasurements

const LayerMeasurements* TrajectorySegmentBuilder::theLayerMeasurements
private

Definition at line 107 of file TrajectorySegmentBuilder.h.

◆ theLockedHits

ConstRecHitContainer TrajectorySegmentBuilder::theLockedHits
private

Definition at line 118 of file TrajectorySegmentBuilder.h.

◆ theLockHits

bool TrajectorySegmentBuilder::theLockHits
private

Definition at line 115 of file TrajectorySegmentBuilder.h.

◆ theMaxCand

int TrajectorySegmentBuilder::theMaxCand
private

Definition at line 117 of file TrajectorySegmentBuilder.h.

◆ theUpdator

const TrajectoryStateUpdator& TrajectorySegmentBuilder::theUpdator
private

Definition at line 110 of file TrajectorySegmentBuilder.h.

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
TrajectorySegmentBuilder::theLockedHits
ConstRecHitContainer theLockedHits
Definition: TrajectorySegmentBuilder.h:118
mps_fire.i
i
Definition: mps_fire.py:355
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
TempTrajectory
Definition: TempTrajectory.h:40
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GeomDetCompatibilityChecker
Definition: GeomDetCompatibilityChecker.h:12
TrajectorySegmentBuilder::unlockedMeasurements
std::vector< TrajectoryMeasurement > unlockedMeasurements(const std::vector< TM > &measurements) const
get list of unused hits
Definition: TrajectorySegmentBuilder.cc:452
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
edm::LogInfo
Definition: MessageLogger.h:254
HLT_2018_cff.maxCand
maxCand
Definition: HLT_2018_cff.py:119
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
TrajectorySegmentBuilder::lockMeasurement
void lockMeasurement(const TM &measurement)
mark a hit as used
Definition: TrajectorySegmentBuilder.cc:480
TrajMeasLessEstim
Definition: TrajMeasLessEstim.h:10
TrajectorySegmentBuilder::theFullPropagator
const Propagator & theFullPropagator
Definition: TrajectorySegmentBuilder.h:109
mathSSE::return
return((rh ^ lh) &mask)
TrajectoryMeasurement::updatedState
TrajectoryStateOnSurface const & updatedState() const
Definition: TrajectoryMeasurement.h:184
LocalTrajectoryError::matrix
const AlgebraicSymMatrix55 & matrix() const
Definition: LocalTrajectoryError.h:60
CTPPSpixelLocalTrackReconstructionInfo::invalid
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
dqmdumpme.first
first
Definition: dqmdumpme.py:55
tracking::TempMeasurements
Definition: TempMeasurements.h:10
end
#define end
Definition: vmac.h:39
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
h
PVValHelper::estimator
estimator
Definition: PVValidationHelpers.h:44
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
HLT_2018_cff.updator
updator
Definition: HLT_2018_cff.py:123
TrajectorySegmentBuilder::theLayer
const DetLayer & theLayer
Definition: TrajectorySegmentBuilder.h:108
TempTrajectory::lastMeasurement
const TrajectoryMeasurement & lastMeasurement() const
Definition: TempTrajectory.h:159
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
Propagator::propagationDirection
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
cmsutils::bqueue< TrajectoryMeasurement >
OrderedSet.t
t
Definition: OrderedSet.py:90
cmsutils::bqueue::rbegin
const_iterator rbegin() const
Definition: bqueue.h:197
GeomDetCompatibilityChecker::isCompatible
static std::pair< bool, TrajectoryStateOnSurface > isCompatible(const GeomDet *theDet, const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est)
Definition: GeomDetCompatibilityChecker.cc:58
TrajectorySegmentBuilder::theUpdator
const TrajectoryStateUpdator & theUpdator
Definition: TrajectorySegmentBuilder.h:110
TrajectoryStateUpdator::update
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
clear
void clear(HadCaloObj &c)
Definition: data.h:124
cmsutils::_bqueue_itr
Definition: bqueue.h:39
TrackingRecHit::all
Definition: TrackingRecHit.h:59
TrackingRecHit::missing
Definition: TrackingRecHit.h:47
HLT_2018_cff.bestHitOnly
bestHitOnly
Definition: HLT_2018_cff.py:175
TrajectorySegmentBuilder::theLockHits
bool theLockHits
Definition: TrajectorySegmentBuilder.h:115
TrajectorySegmentBuilder::theMaxCand
int theMaxCand
Definition: TrajectorySegmentBuilder.h:117
TrajectorySegmentBuilder::redoMeasurements
std::vector< TrajectoryMeasurement > redoMeasurements(const TempTrajectory &traj, const DetGroup &detGroup) const
retrieve compatible hits from a DetGroup
Definition: TrajectorySegmentBuilder.cc:339
HLT_2018_cff.lockHits
lockHits
Definition: HLT_2018_cff.py:166
lessByFoundHits
bool lessByFoundHits(const Trajectory &a, const Trajectory &b)
Definition: TrajectoryLessByFoundHits.h:7
cms::cuda::for
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
Definition: HistoContainer.h:27
TrajectorySegmentBuilder::updateCandidatesWithBestHit
void updateCandidatesWithBestHit(TempTrajectory const &traj, TM measurements, TempTrajectoryContainer &candidates)
creation of a new candidate from a segment and the best hit out of a collection
Definition: TrajectorySegmentBuilder.cc:327
TrackingRecHit::valid
Definition: TrackingRecHit.h:46
TrajectorySegmentBuilder::TempTrajectoryContainer
std::vector< TempTrajectory > TempTrajectoryContainer
Definition: TrajectorySegmentBuilder.h:39
TrajectorySegmentBuilder::updateCandidates
void updateCandidates(TempTrajectory const &traj, const std::vector< TM > &measurements, TempTrajectoryContainer &candidates)
creation of new candidates from a segment and a collection of hits
Definition: TrajectorySegmentBuilder.cc:311
TrajectorySegmentBuilder
Definition: TrajectorySegmentBuilder.h:31
TrajectorySegmentBuilder::addGroup
std::vector< TempTrajectory > addGroup(TempTrajectory const &traj, std::vector< TrajectoryMeasurementGroup >::const_iterator begin, std::vector< TrajectoryMeasurementGroup >::const_iterator end)
Definition: TrajectorySegmentBuilder.cc:216
TrajectorySegmentBuilder::cleanCandidates
void cleanCandidates(std::vector< TempTrajectory > &candidates) const
clean a set of candidates
Definition: TrajectorySegmentBuilder.cc:483
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
LayerMeasurements::groupedMeasurements
std::vector< TrajectoryMeasurementGroup > groupedMeasurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Definition: LayerMeasurements.cc:149
MeasurementDetWithData
Definition: MeasurementDetWithData.h:6
HLT_2018_cff.candidates
candidates
Definition: HLT_2018_cff.py:53513
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
TrajectorySegmentBuilder::updateWithInvalidHit
void updateWithInvalidHit(TempTrajectory &traj, const std::vector< TMG > &groups, TempTrajectoryContainer &candidates) const
Definition: TrajectorySegmentBuilder.cc:379
cmsutils::bqueue::rend
const_iterator rend() const
Definition: bqueue.h:198
TrajectorySegmentBuilder::theEstimator
const MeasurementEstimator & theEstimator
Definition: TrajectorySegmentBuilder.h:111
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
TrajectorySegmentBuilder::theLayerMeasurements
const LayerMeasurements * theLayerMeasurements
Definition: TrajectorySegmentBuilder.h:107
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
mps_fire.result
result
Definition: mps_fire.py:303
TrajectorySegmentBuilder::theBestHitOnly
bool theBestHitOnly
Definition: TrajectorySegmentBuilder.h:116
TempTrajectory::emplace
void emplace(Args &&... args)
Definition: TempTrajectory.h:113
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
align_cfg.iteration
iteration
Definition: align_cfg.py:5
begin
#define begin
Definition: vmac.h:32
TrajectorySegmentBuilder::theDbgFlg
bool theDbgFlg
Definition: TrajectorySegmentBuilder.h:120
hit
Definition: SiStripHitEffFromCalibTree.cc:88
TrajectorySegmentBuilder::theGeomPropagator
const Propagator & theGeomPropagator
Definition: TrajectorySegmentBuilder.h:113
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
TrajectorySegmentBuilder::updateTrajectory
void updateTrajectory(TempTrajectory &traj, TM tm) const
update of a trajectory with a hit
Definition: TrajectorySegmentBuilder.cc:191