CMS 3D CMS Logo

GroupedCkfTrajectoryBuilder.cc
Go to the documentation of this file.
1 #include <algorithm>
2 #include <array>
3 
6 
9 
13 #include "GroupedTrajCandLess.h"
25 
34 
36 
37 // only included for RecHit comparison operator:
39 
41 
42 // for looper reconstruction
46 
48 
49 // #define STAT_TSB
50 
51 namespace {
52 #ifdef STAT_TSB
53  struct StatCount {
54  long long totSeed;
55  long long totTraj;
56  long long totRebuilt;
57  long long totInvCand;
58  void zero() { totSeed = totTraj = totRebuilt = totInvCand = 0; }
59  void traj(long long t) { totTraj += t; }
60  void seed() { ++totSeed; }
61  void rebuilt(long long t) { totRebuilt += t; }
62  void invalid() { ++totInvCand; }
63  void print() const {
64  std::cout << "GroupedCkfTrajectoryBuilder stat\nSeed/Traj/Rebuilt " << totSeed << '/' << totTraj << '/'
65  << totRebuilt << std::endl;
66  }
67  StatCount() { zero(); }
68  ~StatCount() { print(); }
69  };
70  StatCount statCount;
71 
72 #else
73  struct StatCount {
74  void traj(long long) {}
75  void seed() {}
76  void rebuilt(long long) {}
77  void invalid() {}
78  };
79  CMS_THREAD_SAFE StatCount statCount;
80 #endif
81 
82 } // namespace
83 
84 using namespace std;
85 
86 //#define DBG2_GCTB
87 
88 //#define STANDARD_INTERMEDIARYCLEAN
89 
90 #ifdef STANDARD_INTERMEDIARYCLEAN
92 #endif
93 
94 /* ====== B.M. to be ported layer ===========
95 #ifdef DBG_GCTB
96 #include "RecoTracker/CkfPattern/src/ShowCand.h"
97 #endif
98 // #define DBG2_GCTB
99 #ifdef DBG2_GCTB
100 #include "RecoTracker/CkfPattern/src/SimIdPrinter.h"
101 #include "Tracker/TkDebugTools/interface/LayerFinderByDet.h"
102 #include "Tracker/TkLayout/interface/TkLayerName.h"
103 #endif
104 =================================== */
105 
106 namespace {
107 
109 
110 }
111 
114  BaseCkfTrajectoryBuilder::createTrajectoryFilter(
115  conf.getParameter<edm::ParameterSet>("trajectoryFilter"), iC),
116  conf.getParameter<bool>("useSameTrajFilter")
117  ? BaseCkfTrajectoryBuilder::createTrajectoryFilter(
118  conf.getParameter<edm::ParameterSet>("trajectoryFilter"), iC)
119  : BaseCkfTrajectoryBuilder::createTrajectoryFilter(
120  conf.getParameter<edm::ParameterSet>("inOutTrajectoryFilter"), iC)) {
121  // fill data members from parameters (eventually data members could be dropped)
122  //
123  theMaxCand = conf.getParameter<int>("maxCand");
124  theLostHitPenalty = conf.getParameter<double>("lostHitPenalty");
125  theFoundHitBonus = conf.getParameter<double>("foundHitBonus");
126  theIntermediateCleaning = conf.getParameter<bool>("intermediateCleaning");
127  theAlwaysUseInvalid = conf.getParameter<bool>("alwaysUseInvalidHits");
128  theLockHits = conf.getParameter<bool>("lockHits");
129  theBestHitOnly = conf.getParameter<bool>("bestHitOnly");
131  theRequireSeedHitsInRebuild = conf.getParameter<bool>("requireSeedHitsInRebuild");
132  theKeepOriginalIfRebuildFails = conf.getParameter<bool>("keepOriginalIfRebuildFails");
133  theMinNrOfHitsForRebuild = max(0, conf.getParameter<int>("minNrOfHitsForRebuild"));
134  maxPt2ForLooperReconstruction = conf.existsAs<double>("maxPtForLooperReconstruction")
135  ? conf.getParameter<double>("maxPtForLooperReconstruction")
136  : 0;
138  maxDPhiForLooperReconstruction = conf.existsAs<double>("maxDPhiForLooperReconstruction")
139  ? conf.getParameter<double>("maxDPhiForLooperReconstruction")
140  : 2.0;
141 
142  /* ======= B.M. to be ported layer ===========
143  bool setOK = thePropagator->setMaxDirectionChange(1.6);
144  if (!setOK)
145  cout << "GroupedCkfTrajectoryBuilder WARNING: "
146  << "propagator does not support setMaxDirectionChange"
147  << endl;
148  // addStopCondition(theMinPtStopCondition);
149 
150  theConfigurableCondition = createAlgo<TrajectoryFilter>(componentConfig("StopCondition"));
151  ===================================== */
152 }
153 
154 /*
155  void GroupedCkfTrajectoryBuilder::setEvent(const edm::Event& event) const
156  {
157  theMeasurementTracker->update(event);
158 }
159 */
160 
162 
164  const TrajectorySeed& seed) const {
166  ret.reserve(10);
167  unsigned int tmp;
168  buildTrajectories(seed, ret, tmp, nullptr);
169  return ret;
170 }
171 
173  const TrajectorySeed& seed, const TrackingRegion& region) const {
175  ret.reserve(10);
176  unsigned int tmp;
177  RegionalTrajectoryFilter regionalCondition(region);
178  buildTrajectories(seed, ret, tmp, &regionalCondition);
179  return ret;
180 }
181 
184  unsigned int tmp;
185  buildTrajectories(seed, ret, tmp, nullptr);
186 }
187 
190  const TrackingRegion& region) const {
191  RegionalTrajectoryFilter regionalCondition(region);
192  unsigned int tmp;
193  buildTrajectories(seed, ret, tmp, &regionalCondition);
194 }
195 
197  TempTrajectory const& startingTraj = createStartingTrajectory(seed);
198  rebuildTrajectories(startingTraj, seed, result);
199 }
200 
202  const TrajectorySeed& seed,
203  TrajectoryContainer& result) const {
205 
206  TrajectoryContainer final;
207 
208  // better the seed to be always the same...
209  std::shared_ptr<const TrajectorySeed> sharedSeed;
210  if (result.empty())
211  sharedSeed.reset(new TrajectorySeed(seed));
212  else
213  sharedSeed = result.front().sharedSeed();
214 
215  work.reserve(result.size());
216  for (auto&& traj : result)
217  if (traj.isValid())
218  work.emplace_back(std::move(traj));
219 
220  rebuildSeedingRegion(seed, startingTraj, work);
221 
222  // we clean here now
224  cleaner.clean(work);
225 
226  for (auto const& it : work)
227  if (it.isValid()) {
228  final.push_back(it.toTrajectory());
229  final.back().setSharedSeed(sharedSeed);
230  }
231 
232  result.swap(final);
233 
234  statCount.rebuilt(result.size());
235 }
236 
239  unsigned int& nCandPerSeed,
240  const TrajectoryFilter* regionalCondition) const {
241  if (theMeasurementTracker == nullptr) {
242  throw cms::Exception("LogicError")
243  << "Asking to create trajectories to an un-initialized GroupedCkfTrajectoryBuilder.\nYou have to call "
244  "clone(const MeasurementTrackerEvent *data) and then call trajectories on it instead.\n";
245  }
246 
247  statCount.seed();
248  //
249  // Build trajectory outwards from seed
250  //
251 
252  analyseSeed(seed);
253 
254  TempTrajectory const& startingTraj = createStartingTrajectory(seed);
255 
256  work_.clear();
257  const bool inOut = true;
258  nCandPerSeed = groupedLimitedCandidates(seed, startingTraj, regionalCondition, forwardPropagator(seed), inOut, work_);
259  if (work_.empty())
260  return startingTraj;
261 
262  // cleaning now done here...
264  cleaner.clean(work_);
265 
266  std::shared_ptr<const TrajectorySeed> pseed(new TrajectorySeed(seed));
267  for (auto const& it : work_)
268  if (it.isValid()) {
269  result.push_back(it.toTrajectory());
270  result.back().setSharedSeed(pseed);
271  }
272  work_.clear();
273  if (work_.capacity() > work_MaxSize_) {
274  TempTrajectoryContainer().swap(work_);
275  work_.reserve(work_MaxSize_ / 2);
276  }
277 
278  analyseResult(result);
279 
280  LogDebug("CkfPattern") << "GroupedCkfTrajectoryBuilder: returning result of size " << result.size();
281  statCount.traj(result.size());
282 
283 #ifdef VI_DEBUG
284  int kt = 0;
285  for (auto const& traj : result) {
286  int chit[7] = {};
287  for (auto const& tm : traj.measurements()) {
288  auto const& hit = tm.recHitR();
289  if (!hit.isValid())
290  ++chit[0];
291  if (hit.det() == nullptr)
292  ++chit[1];
294  continue;
295  if (hit.dimension() != 2) {
296  ++chit[2];
297  } else if (trackerHitRTTI::isFromDet(hit)) {
298  auto const& thit = static_cast<BaseTrackerRecHit const&>(hit);
299  auto const& clus = thit.firstClusterRef();
300  if (clus.isPixel())
301  ++chit[3];
302  else if (thit.isMatched()) {
303  ++chit[4];
304  } else if (thit.isProjected()) {
305  ++chit[5];
306  } else {
307  ++chit[6];
308  }
309  }
310  }
311 
312  std::cout << "ckf " << kt++ << ": ";
313  for (auto c : chit)
314  std::cout << c << '/';
315  std::cout << std::endl;
316  }
317 #endif
318 
319  return startingTraj;
320 }
321 
322 unsigned int GroupedCkfTrajectoryBuilder::groupedLimitedCandidates(const TrajectorySeed& seed,
323  TempTrajectory const& startingTraj,
324  const TrajectoryFilter* regionalCondition,
325  const Propagator* propagator,
326  bool inOut,
327  TempTrajectoryContainer& result) const {
328  unsigned int nIter = 1;
329  unsigned int nCands = 0; // ignore startingTraj
330  unsigned int prevNewCandSize = 0;
332  TempTrajectoryContainer newCand;
333  candidates.push_back(startingTraj);
334 
335  while (!candidates.empty()) {
336  newCand.clear();
337  for (TempTrajectoryContainer::iterator traj = candidates.begin(); traj != candidates.end(); traj++) {
338  if (!advanceOneLayer(seed, *traj, regionalCondition, propagator, inOut, newCand, result)) {
339  LogDebug("CkfPattern") << "GCTB: terminating after advanceOneLayer==false";
340  continue;
341  }
342 
343  LogDebug("CkfPattern") << "newCand(1): after advanced one layer:\n" << PrintoutHelper::dumpCandidates(newCand);
344  // account only new candidates, i.e.
345  // - 1 candidate -> 1 candidate, don't increase count
346  // - 1 candidate -> 2 candidates, increase count by 1
347  nCands += newCand.size() - prevNewCandSize;
348  prevNewCandSize = newCand.size();
349 
350  if ((int)newCand.size() > theMaxCand) {
351  //ShowCand()(newCand);
352 
353  std::nth_element(newCand.begin(),
354  newCand.begin() + theMaxCand,
355  newCand.end(),
357  newCand.erase(newCand.begin() + theMaxCand, newCand.end());
358  }
359  LogDebug("CkfPattern") << "newCand(2): after removing extra candidates.\n"
360  << PrintoutHelper::dumpCandidates(newCand);
361  }
362 
363  LogDebug("CkfPattern") << "newCand.size() at end = " << newCand.size();
364  /*
365  if (theIntermediateCleaning) {
366  candidates.clear();
367  candidates = groupedIntermediaryClean(newCand);
368  } else {
369  candidates.swap(newCand);
370  }
371 */
373 #ifdef STANDARD_INTERMEDIARYCLEAN
375 #else
376  groupedIntermediaryClean(newCand);
377 #endif
378  }
379  candidates.swap(newCand);
380 
381  LogDebug("CkfPattern") << "candidates(3): " << result.size() << " candidates after " << nIter++
382  << " groupedCKF iteration: \n"
383  << PrintoutHelper::dumpCandidates(result) << "\n " << candidates.size()
384  << " running candidates are: \n"
386  }
387 
388  return nCands;
389 }
390 
391 #ifdef EDM_ML_DEBUG
392 std::string whatIsTheNextStep(TempTrajectory const& traj,
393  std::pair<TrajectoryStateOnSurface, std::vector<const DetLayer*> >& stateAndLayers) {
394  std::stringstream buffer;
395  vector<const DetLayer*>& nl = stateAndLayers.second;
396  // #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
397  // #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
398  //B.M. TkLayerName layerName;
399  //B.M. buffer << "Started from " << layerName(traj.lastLayer())
400  const BarrelDetLayer* sbdl = dynamic_cast<const BarrelDetLayer*>(traj.lastLayer());
401  const ForwardDetLayer* sfdl = dynamic_cast<const ForwardDetLayer*>(traj.lastLayer());
402  if (sbdl) {
403  buffer << "Started from " << traj.lastLayer() << " r=" << sbdl->specificSurface().radius()
404  << " phi=" << sbdl->specificSurface().phi() << endl;
405  } else if (sfdl) {
406  buffer << "Started from " << traj.lastLayer() << " z " << sfdl->specificSurface().position().z() << " phi "
407  << sfdl->specificSurface().phi() << endl;
408  }
409  buffer << "Trying to go to";
410  for (vector<const DetLayer*>::iterator il = nl.begin(); il != nl.end(); il++) {
411  //B.M. buffer << " " << layerName(*il) << " " << *il << endl;
412  const BarrelDetLayer* bdl = dynamic_cast<const BarrelDetLayer*>(*il);
413  const ForwardDetLayer* fdl = dynamic_cast<const ForwardDetLayer*>(*il);
414 
415  if (bdl)
416  buffer << " r " << bdl->specificSurface().radius() << endl;
417  if (fdl)
418  buffer << " z " << fdl->specificSurface().position().z() << endl;
419  //buffer << " " << *il << endl;
420  }
421  return buffer.str();
422 }
423 
424 std::string whatIsTheStateToUse(TrajectoryStateOnSurface& initial,
425  TrajectoryStateOnSurface& stateToUse,
426  const DetLayer* l) {
427  std::stringstream buffer;
428  buffer << "GCTB: starting from "
429  << " r / phi / z = " << stateToUse.globalPosition().perp() << " / " << stateToUse.globalPosition().phi()
430  << " / " << stateToUse.globalPosition().z()
431  << " , pt / phi / pz /charge = " << stateToUse.globalMomentum().perp() << " / "
432  << stateToUse.globalMomentum().phi() << " / " << stateToUse.globalMomentum().z() << " / "
433  << stateToUse.charge() << " for layer at " << l << endl;
434  buffer << " errors:";
435  for (int i = 0; i < 5; i++)
436  buffer << " " << sqrt(stateToUse.curvilinearError().matrix()(i, i));
437  buffer << endl;
438 
439  //buffer << "GCTB: starting from r / phi / z = " << initial.globalPosition().perp()
440  //<< " / " << initial.globalPosition().phi()
441  //<< " / " << initial.globalPosition().z() << " , pt / pz = "
442  //<< initial.globalMomentum().perp() << " / "
443  //<< initial.globalMomentum().z() << " for layer at "
444  //<< l << endl;
445  //buffer << " errors:";
446  //for ( int i=0; i<5; i++ ) buffer << " " << sqrt(initial.curvilinearError().matrix()(i,i));
447  //buffer << endl;
448  return buffer.str();
449 }
450 #endif
451 
452 bool GroupedCkfTrajectoryBuilder::advanceOneLayer(const TrajectorySeed& seed,
453  TempTrajectory& traj,
454  const TrajectoryFilter* regionalCondition,
455  const Propagator* propagator,
456  bool inOut,
457  TempTrajectoryContainer& newCand,
458  TempTrajectoryContainer& result) const {
459  std::pair<TSOS, std::vector<const DetLayer*> >&& stateAndLayers = findStateAndLayers(seed, traj);
460 
462  if (
463  //stateAndLayers.second.size()==0 &&
464  traj.lastLayer()->location() == 0) {
465  float pt2 = stateAndLayers.first.globalMomentum().perp2();
466  if (pt2 < maxPt2ForLooperReconstruction && pt2 > (0.3f * 0.3f))
467  stateAndLayers.second.push_back(traj.lastLayer());
468  }
469  }
470 
471  auto layerBegin = stateAndLayers.second.begin();
472  auto layerEnd = stateAndLayers.second.end();
473 
474  // if (nl.empty()) {
475  // addToResult(traj,result,inOut);
476  // return false;
477  // }
478 
479 #ifdef EDM_ML_DEBUG
480  LogDebug("CkfPattern") << whatIsTheNextStep(traj, stateAndLayers);
481 #endif
482 
483  bool foundSegments(false);
484  bool foundNewCandidates(false);
485  for (auto il = layerBegin; il != layerEnd; il++) {
486  TSOS stateToUse = stateAndLayers.first;
487 
488  double dPhiCacheForLoopersReconstruction(0);
489  if UNLIKELY (!traj.empty() && (*il) == traj.lastLayer()) {
491  // ------ For loopers reconstruction
492  //cout<<" self propagating in advanceOneLayer (for loopers) \n";
493  const BarrelDetLayer* sbdl = dynamic_cast<const BarrelDetLayer*>(traj.lastLayer());
494  if (sbdl) {
495  HelixBarrelCylinderCrossing cylinderCrossing(stateToUse.globalPosition(),
496  stateToUse.globalMomentum(),
497  stateToUse.transverseCurvature(),
498  propagator->propagationDirection(),
499  sbdl->specificSurface());
500  if (!cylinderCrossing.hasSolution())
501  continue;
502  GlobalPoint starting = stateToUse.globalPosition();
503  GlobalPoint target1 = cylinderCrossing.position1();
504  GlobalPoint target2 = cylinderCrossing.position2();
505 
506  GlobalPoint farther =
507  fabs(starting.phi() - target1.phi()) > fabs(starting.phi() - target2.phi()) ? target1 : target2;
508 
509  const Bounds& bounds(sbdl->specificSurface().bounds());
510  float length = 0.5f * bounds.length();
511 
512  /*
513  cout << "starting: " << starting << endl;
514  cout << "target1: " << target1 << endl;
515  cout << "target2: " << target2 << endl;
516  cout << "dphi: " << (target1.phi()-target2.phi()) << endl;
517  cout << "length: " << length << endl;
518  */
519 
520  /*
521  float deltaZ = bounds.thickness()/2.f/fabs(tan(stateToUse.globalDirection().theta()) ) ;
522  if(stateToUse.hasError())
523  deltaZ += 3*sqrt(stateToUse.cartesianError().position().czz());
524  if( fabs(farther.z()) > length + deltaZ ) continue;
525  */
526  if (fabs(farther.z()) * 0.95f > length)
527  continue;
528 
529  Geom::Phi<float> tmpDphi = target1.phi() - target2.phi();
531  continue;
532  GlobalPoint target(0.5f * (target1.basicVector() + target2.basicVector()));
533  //cout << "target: " << target << endl;
534 
536  stateToUse = extrapolator.extrapolate(stateToUse, target, *propagator);
537  if (!stateToUse.isValid())
538  continue; //SK: consider trying the original? probably not
539 
540  //dPhiCacheForLoopersReconstruction = fabs(target1.phi()-target2.phi())*2.;
541  dPhiCacheForLoopersReconstruction = std::abs(tmpDphi);
542  traj.incrementLoops();
543  } else { // not barrel
544  continue;
545  }
546  } else { // loopers not requested (why else???)
547  // ------ For cosmics reconstruction
548  LogDebug("CkfPattern") << " self propagating in advanceOneLayer.\n from: \n" << stateToUse;
549  //self navigation case
550  // go to a middle point first
552  GlobalPoint center(0, 0, 0);
553  stateToUse = middle.extrapolate(stateToUse, center, *(forwardPropagator(seed)));
554 
555  if (!stateToUse.isValid())
556  continue;
557  LogDebug("CkfPattern") << "to: " << stateToUse;
558  }
559  } // last layer...
560 
561  //unsigned int maxCandidates = theMaxCand > 21 ? theMaxCand*2 : 42; //limit the number of returned segments
562  LayerMeasurements layerMeasurements(theMeasurementTracker->measurementTracker(), *theMeasurementTracker);
563  TrajectorySegmentBuilder layerBuilder(
564  &layerMeasurements, **il, *propagator, *theUpdator, *theEstimator, theLockHits, theBestHitOnly, theMaxCand);
565 
566 #ifdef EDM_ML_DEBUG
567  LogDebug("CkfPattern") << whatIsTheStateToUse(stateAndLayers.first, stateToUse, *il);
568 #endif
569 
570  auto&& segments = layerBuilder.segments(stateToUse);
571 
572  LogDebug("CkfPattern") << "GCTB: number of segments = " << segments.size();
573 
574  if (!segments.empty())
575  foundSegments = true;
576 
577  for (auto is = segments.begin(); is != segments.end(); is++) {
578  //
579  // assume "invalid hit only" segment is last in list
580  //
581  auto const& measurements = is->measurements();
582  if (!theAlwaysUseInvalid && is != segments.begin() && measurements.size() == 1 &&
583  (measurements.front().recHit()->getType() == TrackingRecHit::missing))
584  break;
585 
586  //---- avoid to add the same hits more than once in the trajectory ----
587  bool toBeRejected(false);
588  for (auto revIt = measurements.rbegin(); revIt != measurements.rend(); --revIt) {
589  // int tmpCounter(0);
590  for (auto newTrajMeasIt = traj.measurements().rbegin(); newTrajMeasIt != traj.measurements().rend();
591  --newTrajMeasIt) {
592  //if(tmpCounter==2) break;
593  if (revIt->recHitR().geographicalId() == newTrajMeasIt->recHitR().geographicalId() &&
594  (revIt->recHitR().geographicalId() != DetId(0))) {
595  toBeRejected = true;
596  goto rejected; //break; // see http://stackoverflow.com/questions/1257744/can-i-use-break-to-exit-multiple-nested-for-loops
597  }
598  // tmpCounter++;
599  }
600  }
601 
602  rejected:; // http://xkcd.com/292/
603  if (toBeRejected) {
604 #ifdef VI_DEBUG
605  cout << "WARNING: neglect candidate because it contains the same hit twice \n";
606  cout << "-- discarded track's pt,eta,#found/lost: "
607  << traj.lastMeasurement().updatedState().globalMomentum().perp() << " , "
608  << traj.lastMeasurement().updatedState().globalMomentum().eta() << " , " << traj.foundHits() << '/'
609  << traj.lostHits() << "\n";
610 #endif
611  traj.setDPhiCacheForLoopersReconstruction(dPhiCacheForLoopersReconstruction);
612  continue; //Are we sure about this????
613  }
614  // ------------------------
615 
616  //
617  // create new candidate
618  //
619  TempTrajectory newTraj(traj);
620  traj.setDPhiCacheForLoopersReconstruction(dPhiCacheForLoopersReconstruction);
621  newTraj.join(*is);
622 
623  //std::cout << "DEBUG: newTraj after push found,lost: "
624  // << newTraj.foundHits() << " , "
625  // << newTraj.lostHits() << " , "
626  // << newTraj.measurements().size() << std::endl;
627 
628  //GIO// for ( vector<TM>::const_iterator im=measurements.begin();
629  //GIO// im!=measurements.end(); im++ ) newTraj.push(*im);
630  //if ( toBeContinued(newTraj,regionalCondition) ) { TOBE FIXED
631  if (toBeContinued(newTraj, inOut)) {
632  // Have added one more hit to track candidate
633 
634  LogDebug("CkfPattern") << "GCTB: adding updated trajectory to candidates: inOut=" << inOut
635  << " hits=" << newTraj.foundHits();
636 
637  newTraj.setStopReason(StopReason::NOT_STOPPED);
638  newCand.push_back(std::move(newTraj));
639  foundNewCandidates = true;
640  } else {
641  // Have finished building this track. Check if it passes cuts.
642 
643  LogDebug("CkfPattern") << "GCTB: adding completed trajectory to results if passes cuts: inOut=" << inOut
644  << " hits=" << newTraj.foundHits();
645  moveToResult(std::move(newTraj), result, inOut);
646  }
647  } // loop over segs
648  } // loop over layers
649 
650  if (!foundSegments) {
651  LogDebug("CkfPattern") << "GCTB: adding input trajectory to result";
652  if (!stateAndLayers.second.empty())
654  addToResult(traj, result, inOut);
655  }
656  return foundNewCandidates;
657 }
658 
659 namespace {
662  struct LayersInTraj {
663  static constexpr int N = 3;
664  TempTrajectory* traj;
665  std::array<DetLayer const*, N> layers;
666  int tot;
667  void fill(TempTrajectory& t) {
668  traj = &t;
669  tot = 0;
670  const TempTrajectory::DataContainer& measurements = traj->measurements();
671 
672  auto currl = layers[tot] = measurements.back().layer();
674  --ifirst;
675  for (TempTrajectory::DataContainer::const_iterator im = ifirst; im != measurements.rend(); --im) {
676  if (im->layer() != currl) {
677  ++tot;
678  currl = im->layer();
679  if (tot < N)
680  layers[tot] = currl;
681  }
682  }
683  ++tot;
684  }
685 
686  //void verify() {
687  // for (vector<const DetLayer*>::const_iterator iter = result.begin(); iter != result.end(); iter++)
688  // if (!*iter) edm::LogWarning("CkfPattern")<< "Warning: null det layer!! ";
689  // }
690  };
691 } // namespace
692 
693 //TempTrajectoryContainer
694 void GroupedCkfTrajectoryBuilder::groupedIntermediaryClean(TempTrajectoryContainer& theTrajectories) const {
695  //if (theTrajectories.empty()) return TrajectoryContainer();
696  //TrajectoryContainer result;
697  if (theTrajectories.empty())
698  return;
699  //RecHitEqualByChannels recHitEqualByChannels(false, false);
700  LayersInTraj layers[theTrajectories.size()];
701  int ntraj = 0;
702  for (auto& t : theTrajectories) {
703  if (t.isValid() && t.lastMeasurement().recHitR().isValid())
704  layers[ntraj++].fill(t);
705  }
706 
707  if (ntraj < 2)
708  return;
709 
710  for (int ifirst = 0; ifirst != ntraj - 1; ++ifirst) {
711  auto firstTraj = layers[ifirst].traj;
712  if (!firstTraj->isValid())
713  continue;
714  const TempTrajectory::DataContainer& firstMeasurements = firstTraj->measurements();
715 
716  int firstLayerSize = layers[ifirst].tot;
717  if (firstLayerSize < 4)
718  continue;
719  auto const& firstLayers = layers[ifirst].layers;
720 
721  for (int isecond = ifirst + 1; isecond != ntraj; ++isecond) {
722  auto secondTraj = layers[isecond].traj;
723  if (!secondTraj->isValid())
724  continue;
725 
726  const TempTrajectory::DataContainer& secondMeasurements = secondTraj->measurements();
727 
728  int secondLayerSize = layers[isecond].tot;
729  //
730  // only candidates using the same last 3 layers are compared
731  //
732  if (firstLayerSize != secondLayerSize)
733  continue; // V.I. why equal???
734  auto const& secondLayers = layers[isecond].layers;
735  if (firstLayers[0] != secondLayers[0] || firstLayers[1] != secondLayers[1] || firstLayers[2] != secondLayers[2])
736  continue;
737 
738  TempTrajectory::DataContainer::const_iterator im1 = firstMeasurements.rbegin();
739  TempTrajectory::DataContainer::const_iterator im2 = secondMeasurements.rbegin();
740  //
741  // check for identical hits in the last layer
742  //
743  bool unequal(false);
744  const DetLayer* layerPtr = firstLayers[0];
745  while (im1 != firstMeasurements.rend() && im2 != secondMeasurements.rend()) {
746  if (im1->layer() != layerPtr || im2->layer() != layerPtr)
747  break;
748  if (!(im1->recHit()->isValid()) || !(im2->recHit()->isValid()) ||
749  !im1->recHit()->hit()->sharesInput(im2->recHit()->hit(), TrackingRecHit::some)) {
751  unequal = true;
752  break;
753  }
754  --im1;
755  --im2;
756  }
757  if (im1 == firstMeasurements.rend() || im2 == secondMeasurements.rend() || im1->layer() == layerPtr ||
758  im2->layer() == layerPtr || unequal)
759  continue;
760  //
761  // check for invalid hits in the layer -2
762  // compare only candidates with invalid / valid combination
763  //
764  layerPtr = firstLayers[1];
765  bool firstValid(true);
766  while (im1 != firstMeasurements.rend() && im1->layer() == layerPtr) {
767  if (!im1->recHit()->isValid())
768  firstValid = false;
769  --im1;
770  }
771  bool secondValid(true);
772  while (im2 != secondMeasurements.rend() && im2->layer() == layerPtr) {
773  if (!im2->recHit()->isValid())
774  secondValid = false;
775  --im2;
776  }
777  if (!tkxor(firstValid, secondValid))
778  continue;
779  //
780  // ask for identical hits in layer -3
781  //
782  unequal = false;
783  layerPtr = firstLayers[2];
784  while (im1 != firstMeasurements.rend() && im2 != secondMeasurements.rend()) {
785  if (im1->layer() != layerPtr || im2->layer() != layerPtr)
786  break;
787  if (!(im1->recHit()->isValid()) || !(im2->recHit()->isValid()) ||
788  !im1->recHit()->hit()->sharesInput(im2->recHit()->hit(), TrackingRecHit::some)) {
790  unequal = true;
791  break;
792  }
793  --im1;
794  --im2;
795  }
796  if (im1 == firstMeasurements.rend() || im2 == secondMeasurements.rend() || im1->layer() == layerPtr ||
797  im2->layer() == layerPtr || unequal)
798  continue;
799 
800  if (!firstValid) {
801  firstTraj->invalidate();
802  break;
803  } else {
804  secondTraj->invalidate(); // V.I. why break?
805  break;
806  }
807  } // second
808  } // first
809  /*
810  for (TempTrajectoryContainer::const_iterator it = theTrajectories.begin();
811  it != theTrajectories.end(); it++) {
812  if(it->isValid()) result.push_back( *it);
813  }
814 
815  return result;
816 */
817  theTrajectories.erase(
818  std::remove_if(theTrajectories.begin(), theTrajectories.end(), std::not_fn(&TempTrajectory::isValid)),
819  theTrajectories.end());
820 }
821 
823  TempTrajectory const& startingTraj,
824  TempTrajectoryContainer& result) const {
825  //
826  // Rebuilding of trajectories. Candidates are taken from result,
827  // which will be replaced with the solutions after rebuild
828  // (assume vector::swap is more efficient than building new container)
829  //
830  LogDebug("CkfPattern") << "Starting to rebuild " << result.size() << " tracks";
831  //
832  // Fitter (need to create it here since the propagation direction
833  // might change between different starting trajectories)
834  //
835  auto hitCloner = static_cast<TkTransientTrackingRecHitBuilder const*>(hitBuilder())->cloner();
836  KFTrajectoryFitter fitter(backwardPropagator(seed), &updator(), &estimator(), 3, nullptr, &hitCloner);
837  //
838  std::vector<const TrackingRecHit*> seedHits;
839 
840  unsigned int nSeed = seed.nHits();
841  //seedHits.reserve(nSeed);
842  TempTrajectoryContainer rebuiltTrajectories;
843 
844  for (TempTrajectoryContainer::iterator it = result.begin(); it != result.end(); it++) {
845  // Refit - keep existing trajectory in case fit is not possible
846  // or fails
847  //
848 
849  auto&& reFitted = backwardFit(*it, nSeed, fitter, seedHits);
850  if UNLIKELY (!reFitted.isValid()) {
851  rebuiltTrajectories.push_back(std::move(*it));
852  LogDebug("CkfPattern") << "RebuildSeedingRegion skipped as backward fit failed";
853  // << "after reFitted.size() " << reFitted.size();
854  continue;
855  }
856  //LogDebug("CkfPattern")<<"after reFitted.size() " << reFitted.size();
857  //
858  // Rebuild seeding part. In case it fails: keep initial trajectory
859  // (better to drop it??)
860  //
861  int nRebuilt = rebuildSeedingRegion(seed, seedHits, reFitted, rebuiltTrajectories);
862  // Loop over the last nRebuilt trajectories and propagate back the
863  // real cause that stopped the original in-out trajectory, since
864  // that's the one we want to monitor
865  for (size_t i = rebuiltTrajectories.size() - 1; i < rebuiltTrajectories.size() - nRebuilt - 1; --i) {
866  rebuiltTrajectories[i].setStopReason(it->stopReason());
867  }
868 
869  if (nRebuilt == 0 && !theKeepOriginalIfRebuildFails)
870  it->invalidate(); // won't use original in-out track
871 
872  if (nRebuilt < 0)
873  rebuiltTrajectories.push_back(std::move(*it));
874  }
875  //
876  // Replace input trajectories with new ones
877  //
878  result.swap(rebuiltTrajectories);
879  result.erase(std::remove_if(result.begin(), result.end(), std::not_fn(&TempTrajectory::isValid)), result.end());
880 }
881 
883  const std::vector<const TrackingRecHit*>& seedHits,
884  TempTrajectory& candidate,
885  TempTrajectoryContainer& result) const {
886  //
887  // Starting from track found by in-out tracking phase, extrapolate it inwards through
888  // the seeding region if possible in towards smaller Tracker radii, searching for additional
889  // hits.
890  // The resulting trajectories are returned in result,
891  // the count is the return value.
892  //
893  TempTrajectoryContainer rebuiltTrajectories;
894 #ifdef DBG2_GCTB
895  /* const LayerFinderByDet layerFinder;
896  if ( !seedHits.empty() && seedHits.front().isValid() ) {
897  DetLayer* seedLayer = layerFinder(seedHits.front().det());
898  cout << "Seed hit at " << seedHits.front().globalPosition()
899  << " " << seedLayer << endl;
900  cout << "Started from "
901  << candidate.lastMeasurement().updatedState().globalPosition().perp() << " "
902  << candidate.lastMeasurement().updatedState().globalPosition().z() << endl;
903  pair<bool,TrajectoryStateOnSurface> layerComp(false,TrajectoryStateOnSurface());
904  if ( seedLayer ) layerComp =
905  seedLayer->compatible(candidate.lastMeasurement().updatedState(),
906  propagator(),estimator());
907  pair<bool,TrajectoryStateOnSurface> detComp =
908  seedHits.front().det().compatible(candidate.lastMeasurement().updatedState(),
909  propagator(),estimator());
910  cout << " layer compatibility = " << layerComp.first;
911  cout << " det compatibility = " << detComp.first;
912  if ( detComp.first ) {
913  cout << " estimate = "
914  << estimator().estimate(detComp.second,seedHits.front()).second ;
915  }
916  cout << endl;
917  }*/
918  cout << "Before backward building: #measurements = " << candidate.measurements().size(); //<< endl;;
919 #endif
920  //
921  // Use standard building with standard cuts. Maybe better to use different
922  // cuts from "forward" building (e.g. no check on nr. of invalid hits)?
923  //
924  const bool inOut = false;
925  groupedLimitedCandidates(seed, candidate, nullptr, backwardPropagator(seed), inOut, rebuiltTrajectories);
926 
927  LogDebug("CkfPattern") << " After backward building: " << PrintoutHelper::dumpCandidates(rebuiltTrajectories);
928 
929  //
930  // Check & count resulting candidates
931  //
932  int nrOfTrajectories(0);
933  bool orig_ok = false;
934  //const RecHitEqualByChannels recHitEqual(false,false);
935  //vector<TM> oldMeasurements(candidate.measurements());
936  for (TempTrajectoryContainer::iterator it = rebuiltTrajectories.begin(); it != rebuiltTrajectories.end(); it++) {
937  TempTrajectory::DataContainer newMeasurements(it->measurements());
938  //
939  // Verify presence of seeding hits?
940  //
942  orig_ok = true;
943  // no hits found (and possibly some invalid hits discarded): drop track
944  if (newMeasurements.size() <= candidate.measurements().size()) {
945  LogDebug("CkfPattern") << "newMeasurements.size()<=candidate.measurements().size()";
946  continue;
947  }
948  // verify presence of hits
949  //GIO//if ( !verifyHits(newMeasurements.begin()+candidate.measurements().size(),
950  //GIO// newMeasurements.end(),seedHits) ){
951  if (!verifyHits(newMeasurements.rbegin(), newMeasurements.size() - candidate.measurements().size(), seedHits)) {
952  LogDebug("CkfPattern") << "seed hits not found in rebuild";
953  continue;
954  }
955  }
956  //
957  // construct final trajectory in the right order
958  //
959  // save & count result
960  nrOfTrajectories++;
961  result.emplace_back(seed.direction(), seed.nHits());
962  TempTrajectory& reversedTrajectory = result.back();
963  reversedTrajectory.setNLoops(it->nLoops());
964  for (TempTrajectory::DataContainer::const_iterator im = newMeasurements.rbegin(), ed = newMeasurements.rend();
965  im != ed;
966  --im) {
967  reversedTrajectory.push(*im);
968  }
969 
970  LogDebug("CkgPattern") << "New traj direction = " << reversedTrajectory.direction() << "\n"
971  << PrintoutHelper::dumpMeasurements(reversedTrajectory.measurements());
972  } // rebuiltTrajectories
973 
974  // If nrOfTrajectories = 0 and orig_ok = true, this means that a track was actually found on the
975  // out-in step (meeting those requirements) but did not have the seed hits in it.
976  // In this case when we return we will go ahead and use the original in-out track.
977 
978  // If nrOfTrajectories = 0 and orig_ok = false, this means that the out-in step failed to
979  // find any track. Two cases are a technical failure in fitting the original seed hits or
980  // because the track did not meet the out-in criteria (which may be stronger than the out-in
981  // criteria). In this case we will NOT allow the original in-out track to be used.
982 
983  if ((nrOfTrajectories == 0) && orig_ok) {
984  nrOfTrajectories = -1;
985  }
986  return nrOfTrajectories;
987 }
988 
989 TempTrajectory GroupedCkfTrajectoryBuilder::backwardFit(TempTrajectory& candidate,
990  unsigned int nSeed,
991  const TrajectoryFitter& fitter,
992  std::vector<const TrackingRecHit*>& remainingHits) const {
993  //
994  // clear array of non-fitted hits
995  //
996  remainingHits.clear();
997 
998  LogDebug("CkfPattern") << "nSeed " << nSeed << endl
999  << "Old traj direction = " << candidate.direction() << endl
1001 
1002  //
1003  // backward fit trajectory.
1004  // (Will try to fit only hits outside the seeding region. However,
1005  // if there are not enough of these, it will also use the seeding hits).
1006  //
1007  // const unsigned int nHitAllMin(5);
1008  // const unsigned int nHit2dMin(2);
1009  unsigned int nHit(0); // number of valid hits after seeding region
1010  //unsigned int nHit2d(0); // number of valid hits after seeding region with 2D info
1011  // use all hits except the first n (from seed), but require minimum
1012  // specified in configuration.
1013  // Swapped over next two lines.
1014  unsigned int nHitMin = std::max(candidate.foundHits() - nSeed, theMinNrOfHitsForRebuild);
1015  // unsigned int nHitMin = oldMeasurements.size()-nSeed;
1016  // we want to rebuild only if the number of VALID measurements excluding the seed measurements is higher than the cut
1018  return TempTrajectory();
1019 
1020  LogDebug("CkfPattern") /* << "nHitMin " << nHitMin*/ << "Sizes: " << candidate.measurements().size() << " / ";
1021  //
1022  // create input trajectory for backward fit
1023  //
1024  Trajectory fwdTraj(oppositeDirection(candidate.direction()));
1025  fwdTraj.setNLoops(candidate.nLoops());
1026  //const TrajectorySeed seed = TrajectorySeed(PTrajectoryStateOnDet(), TrajectorySeed::recHitContainer(), oppositeDirection(candidate.direction()));
1027  //Trajectory fwdTraj(seed, oppositeDirection(candidate.direction()));
1028 
1029  const DetLayer* bwdDetLayer[candidate.measurements().size()];
1030  int nl = 0;
1031  for (auto const& tm : candidate.measurements()) {
1032  const TrackingRecHit* hit = tm.recHitR().hit();
1033  //
1034  // add hits until required number is reached
1035  //
1036  if (nHit < nHitMin) { //|| nHit2d<theMinNrOf2dHitsForRebuild ) {
1037  fwdTraj.push(tm);
1038  bwdDetLayer[nl++] = tm.layer();
1039  //
1040  // count valid / 2D hits
1041  //
1042  if LIKELY (hit->isValid()) {
1043  nHit++;
1044  //if ( hit.isMatched() ||
1045  // hit.det().detUnits().front()->type().module()==pixel )
1046  //nHit2d++;
1047  }
1048  }
1049  //if (nHit==nHitMin) lastBwdDetLayer=im->layer();
1050  //
1051  // keep remaining (valid) hits for verification
1052  //
1053  else if (hit->isValid()) {
1054  //std::cout << "Adding a remaining hit" << std::endl;
1055  remainingHits.push_back(hit);
1056  }
1057  }
1058  //
1059  // Fit only if required number of valid hits can be used
1060  //
1061  if UNLIKELY (nHit < nHitMin)
1062  return TempTrajectory();
1063 
1064  //
1065  // Do the backward fit (important: start from scaled, not random cov. matrix!)
1066  //
1067  TrajectoryStateOnSurface firstTsos(fwdTraj.firstMeasurement().updatedState());
1068  //cout << "firstTsos "<< firstTsos << endl;
1069  firstTsos.rescaleError(10.);
1070  //TrajectoryContainer bwdFitted(fitter.fit(fwdTraj.seed(),fwdTraj.recHits(),firstTsos));
1071  Trajectory&& bwdFitted =
1072  fitter.fitOne(TrajectorySeed({}, {}, oppositeDirection(candidate.direction())), fwdTraj.recHits(), firstTsos);
1073  if UNLIKELY (!bwdFitted.isValid())
1074  return TempTrajectory();
1075 
1076  LogDebug("CkfPattern") << "Obtained bwdFitted trajectory with measurement size " << bwdFitted.measurements().size();
1077  TempTrajectory fitted(fwdTraj.direction(), nSeed);
1078  fitted.setNLoops(fwdTraj.nLoops());
1079  vector<TM> const& tmsbf = bwdFitted.measurements();
1080  int iDetLayer = 0;
1081  //this is ugly but the TM in the fitted track do not contain the DetLayer.
1082  //So we have to cache the detLayer pointers and replug them in.
1083  //For the backward building it would be enaugh to cache the last DetLayer,
1084  //but for the intermediary cleaning we need all
1085  for (vector<TM>::const_iterator im = tmsbf.begin(); im != tmsbf.end(); im++) {
1086  fitted.emplace((*im).forwardPredictedState(),
1087  (*im).backwardPredictedState(),
1088  (*im).updatedState(),
1089  (*im).recHit(),
1090  (*im).estimate(),
1091  bwdDetLayer[iDetLayer]);
1092 
1093  LogDebug("CkfPattern") << PrintoutHelper::dumpMeasurement(*im);
1094  iDetLayer++;
1095  }
1096  /*
1097  TM lastMeas = bwdFitted.front().lastMeasurement();
1098  fitted.pop();
1099  fitted.push(TM(lastMeas.forwardPredictedState(),
1100  lastMeas.backwardPredictedState(),
1101  lastMeas.updatedState(),
1102  lastMeas.recHit(),
1103  lastMeas.estimate(),
1104  lastBwdDetLayer));
1105  */
1106 
1107  return fitted;
1108 }
1109 
1110 bool GroupedCkfTrajectoryBuilder::verifyHits(TempTrajectory::DataContainer::const_iterator rbegin,
1111  size_t maxDepth,
1112  const std::vector<const TrackingRecHit*>& hits) const {
1113  //
1114  // verify presence of the seeding hits
1115  //
1116  LogDebug("CkfPattern") << "Checking for " << hits.size() << " hits in " << maxDepth << " measurements" << endl;
1117 
1118  auto rend = rbegin;
1119  while (maxDepth > 0) {
1120  --maxDepth;
1121  --rend;
1122  }
1123  for (auto ir = hits.begin(); ir != hits.end(); ir++) {
1124  // assume that all seeding hits are valid!
1125  bool foundHit(false);
1126  for (auto im = rbegin; im != rend; --im) {
1127  if (im->recHit()->isValid() && (*ir)->sharesInput(im->recHit()->hit(), TrackingRecHit::some)) {
1128  foundHit = true;
1129  break;
1130  }
1131  }
1132  if (!foundHit)
1133  return false;
1134  }
1135  return true;
1136 }
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:367
BaseCkfTrajectoryBuilder::addToResult
void addToResult(std::shared_ptr< const TrajectorySeed > const &seed, TempTrajectory &traj, TrajectoryContainer &result, bool inOut=false) const
Definition: BaseCkfTrajectoryBuilder.cc:142
Chi2MeasurementEstimator.h
TrajMeasLessEstim.h
TrajectoryFilter
Definition: TrajectoryFilter.h:28
HelixBarrelCylinderCrossing.h
BaseCkfTrajectoryBuilder
Definition: BaseCkfTrajectoryBuilder.h:53
electrons_cff.bool
bool
Definition: electrons_cff.py:393
mps_fire.i
i
Definition: mps_fire.py:428
TempTrajectory::direction
PropagationDirection direction() const
Definition: TempTrajectory.cc:118
MeasurementTrackerEvent.h
MessageLogger.h
PrintoutHelper::dumpCandidates
static std::string dumpCandidates(collection &candidates)
Definition: PrintoutHelper.h:69
GroupedCkfTrajectoryBuilder::theMaxCand
int theMaxCand
Definition: GroupedCkfTrajectoryBuilder.h:170
GroupedTrajCandLess
Definition: GroupedTrajCandLess.h:13
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
TrajectoryCleanerBySharedHits.h
TempTrajectory::push
void push(const TrajectoryMeasurement &tm)
Definition: TempTrajectory.h:108
DetLayer
Definition: DetLayer.h:21
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
GroupedCkfTrajectoryBuilder::theAlwaysUseInvalid
bool theAlwaysUseInvalid
Definition: GroupedCkfTrajectoryBuilder.h:178
GroupedCkfTrajectoryBuilder::theBestHitOnly
bool theBestHitOnly
Definition: GroupedCkfTrajectoryBuilder.h:181
edm
HLT enums.
Definition: AlignableModifier.h:19
TempTrajectory
Definition: TempTrajectory.h:40
GroupedCkfTrajectoryBuilder.h
TransientRecHitRecord.h
BaseCkfTrajectoryBuilder::TrajectoryContainer
std::vector< Trajectory > TrajectoryContainer
Definition: BaseCkfTrajectoryBuilder.h:62
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
GroupedCkfTrajectoryBuilder::theKeepOriginalIfRebuildFails
bool theKeepOriginalIfRebuildFails
Definition: GroupedCkfTrajectoryBuilder.h:190
gather_cfg.cout
cout
Definition: gather_cfg.py:144
BaseCkfTrajectoryBuilder::theEstimator
const Chi2MeasurementEstimatorBase * theEstimator
Definition: BaseCkfTrajectoryBuilder.h:173
ALCARECOTkAlBeamHalo_cff.nHitMin
nHitMin
Definition: ALCARECOTkAlBeamHalo_cff.py:34
GroupedCkfTrajectoryBuilder::theLostHitPenalty
float theLostHitPenalty
Definition: GroupedCkfTrajectoryBuilder.h:172
BaseCkfTrajectoryBuilder::findStateAndLayers
StateAndLayers findStateAndLayers(const TrajectorySeed &seed, const TempTrajectory &traj) const
Definition: BaseCkfTrajectoryBuilder.cc:191
TrajectoryStateOnSurface::charge
TrackCharge charge() const
Definition: TrajectoryStateOnSurface.h:68
Bounds
Definition: Bounds.h:18
trackerHitRTTI::isUndef
bool isUndef(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:24
TrajectoryMeasurement.h
TrajectoryMeasurement::updatedState
TrajectoryStateOnSurface const & updatedState() const
Definition: TrajectoryMeasurement.h:184
TrajectoryStateOnSurface::transverseCurvature
double transverseCurvature() const
Definition: TrajectoryStateOnSurface.h:70
GroupedCkfTrajectoryBuilder::maxPt2ForLooperReconstruction
float maxPt2ForLooperReconstruction
Definition: GroupedCkfTrajectoryBuilder.h:195
align_cfg.firstValid
firstValid
Definition: align_cfg.py:68
TransverseImpactPointExtrapolator
Definition: TransverseImpactPointExtrapolator.h:26
SiPixelPI::zero
Definition: SiPixelPayloadInspectorHelper.h:39
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
CTPPSpixelLocalTrackReconstructionInfo::invalid
GeometricSearchDet::position
virtual const Surface::PositionType & position() const
Returns position of the surface.
Definition: GeometricSearchDet.h:31
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
TrajectoryStateUpdator.h
TkTransientTrackingRecHitBuilder.h
HLT_FULL_cff.maxDepth
maxDepth
Definition: HLT_FULL_cff.py:8735
Bounds::length
virtual float length() const =0
cmsutils::bqueue::back
const T & back() const
Definition: bqueue.h:195
PrintoutHelper::dumpMeasurement
static std::string dumpMeasurement(const TrajectoryMeasurement &tm)
Definition: PrintoutHelper.cc:41
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
IntermediateTrajectoryCleaner.h
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
fileCollector.seed
seed
Definition: fileCollector.py:127
Propagator
Definition: Propagator.h:44
edmIntegrityCheck.work
work
Definition: edmIntegrityCheck.py:75
DetId
Definition: DetId.h:17
GeometricSearchTracker.h
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
DetLayer::location
virtual Location location() const =0
Which part of the detector (barrel, endcap)
TempTrajectory::setNLoops
void setNLoops(signed char value)
Definition: TempTrajectory.h:259
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
BaseCkfTrajectoryBuilder::toBeContinued
bool toBeContinued(TempTrajectory &traj, bool inOut=false) const
Definition: BaseCkfTrajectoryBuilder.cc:111
LayerMeasurements
Definition: LayerMeasurements.h:18
TempTrajectory::isValid
bool isValid() const
Definition: TempTrajectory.h:224
GroupedCkfTrajectoryBuilder::theRequireSeedHitsInRebuild
bool theRequireSeedHitsInRebuild
Definition: GroupedCkfTrajectoryBuilder.h:183
DetGroup.h
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
cmsutils::bqueue::size
size_type size() const
Definition: bqueue.h:201
GroupedCkfTrajectoryBuilder::GroupedCkfTrajectoryBuilder
GroupedCkfTrajectoryBuilder(const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
constructor from ParameterSet
Definition: GroupedCkfTrajectoryBuilder.cc:112
BaseCkfTrajectoryBuilder::theUpdator
const TrajectoryStateUpdator * theUpdator
Definition: BaseCkfTrajectoryBuilder.h:170
PrintoutHelper::dumpMeasurements
static std::string dumpMeasurements(const std::vector< TrajectoryMeasurement > &v)
Definition: PrintoutHelper.cc:21
TempTrajectory::lastMeasurement
const TrajectoryMeasurement & lastMeasurement() const
Definition: TempTrajectory.h:159
LayerMeasurements.h
GroupedCkfTrajectoryBuilder::buildTrajectories
TempTrajectory buildTrajectories(const TrajectorySeed &seed, TrajectoryContainer &ret, unsigned int &nCandPerSeed, const TrajectoryFilter *) const override
common part of both public trajectory building methods
Definition: GroupedCkfTrajectoryBuilder.cc:237
TempTrajectory::measurements
const DataContainer & measurements() const
Definition: TempTrajectory.h:177
BaseCkfTrajectoryBuilder::backwardPropagator
const Propagator * backwardPropagator(const TrajectorySeed &seed) const
Definition: BaseCkfTrajectoryBuilder.h:163
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
TempTrajectory::foundHits
int foundHits() const
Definition: TempTrajectory.h:184
N
#define N
Definition: blowfish.cc:9
BaseCkfTrajectoryBuilder::theMeasurementTracker
const MeasurementTrackerEvent * theMeasurementTracker
Definition: BaseCkfTrajectoryBuilder.h:175
BaseCkfTrajectoryBuilder::hitBuilder
const TransientTrackingRecHitBuilder * hitBuilder() const
Definition: BaseCkfTrajectoryBuilder.h:104
cmsutils::bqueue< TrajectoryMeasurement >
BaseCkfTrajectoryBuilder::moveToResult
void moveToResult(TempTrajectory &&traj, TempTrajectoryContainer &result, bool inOut=false) const
Definition: BaseCkfTrajectoryBuilder.cc:178
GroupedCkfTrajectoryBuilder::theLockHits
bool theLockHits
Definition: GroupedCkfTrajectoryBuilder.h:180
CMS_THREAD_SAFE
#define CMS_THREAD_SAFE
Definition: thread_safety_macros.h:4
Point3DBase< float, GlobalTag >
TrackingRecHit::some
Definition: TrackingRecHit.h:59
GroupedCkfTrajectoryBuilder::rebuildSeedingRegion
void rebuildSeedingRegion(const TrajectorySeed &, TrajectoryContainer &result) const override
Definition: GroupedCkfTrajectoryBuilder.cc:196
cmsutils::bqueue::rbegin
const_iterator rbegin() const
Definition: bqueue.h:197
TempTrajectory::setDPhiCacheForLoopersReconstruction
void setDPhiCacheForLoopersReconstruction(float dphi)
Definition: TempTrajectory.h:254
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BaseCkfTrajectoryBuilder::TempTrajectoryContainer
std::vector< TempTrajectory > TempTrajectoryContainer
Definition: BaseCkfTrajectoryBuilder.h:63
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
FastTrajectoryCleaner::clean
void clean(TempTrajectoryContainer &) const override
Definition: FastTrajectoryCleaner.cc:7
HelixArbitraryPlaneCrossing.h
KFUpdator.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
cmsutils::_bqueue_itr
Definition: bqueue.h:39
GroupedTrajCandLess.h
TempTrajectory::lostHits
int lostHits() const
Definition: TempTrajectory.h:194
ParameterSet
Definition: Functions.h:16
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
BaseCkfTrajectoryBuilder::setEvent_
virtual void setEvent_(const edm::Event &iEvent, const edm::EventSetup &iSetup)=0
TrackingRecHit::missing
Definition: TrackingRecHit.h:47
thread_safety_macros.h
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88338
RegionalTrajectoryFilter.h
trackerHitRTTI::isFromDet
bool isFromDet(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:36
Geom::Phi< float >
BaseCkfTrajectoryBuilder::forwardPropagator
const Propagator * forwardPropagator(const TrajectorySeed &seed) const
Definition: BaseCkfTrajectoryBuilder.h:160
GroupedCkfTrajectoryBuilder::work_MaxSize_
Definition: GroupedCkfTrajectoryBuilder.h:201
GroupedCkfTrajectoryBuilder::updator
const TrajectoryStateUpdator & updator() const
Definition: GroupedCkfTrajectoryBuilder.h:66
edm::EventSetup
Definition: EventSetup.h:57
GroupedCkfTrajectoryBuilder::rebuildTrajectories
void rebuildTrajectories(TempTrajectory const &startingTraj, const TrajectorySeed &, TrajectoryContainer &result) const override
Definition: GroupedCkfTrajectoryBuilder.cc:201
HLT_FULL_cff.pt2
pt2
Definition: HLT_FULL_cff.py:9938
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
TrajectorySeed::recHits
RecHitRange recHits() const
Definition: TrajectorySeed.h:52
OmniClusterRef.h
BarrelDetLayer
Definition: BarrelDetLayer.h:22
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
BasicSingleTrajectoryState.h
TempTrajectory::incrementLoops
void incrementLoops()
Definition: TempTrajectory.h:260
TrajectoryStateOnSurface::rescaleError
void rescaleError(double factor)
Definition: TrajectoryStateOnSurface.h:82
TrackingRecHit
Definition: TrackingRecHit.h:21
FastTrajectoryCleaner.h
TrajectorySegmentBuilder
Definition: TrajectorySegmentBuilder.h:31
Trajectory.h
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
TrajectoryFitter
Definition: TrajectoryFitter.h:19
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
TrajectorySegmentBuilder.h
ForwardDetLayer
Definition: ForwardDetLayer.h:22
GroupedCkfTrajectoryBuilder::theMinNrOfHitsForRebuild
unsigned int theMinNrOfHitsForRebuild
Definition: GroupedCkfTrajectoryBuilder.h:185
StopReason::NOT_STOPPED
Trajectory
Definition: Trajectory.h:38
GroupedCkfTrajectoryBuilder::maxDPhiForLooperReconstruction
float maxDPhiForLooperReconstruction
Definition: GroupedCkfTrajectoryBuilder.h:197
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
HLT_FULL_cff.candidates
candidates
Definition: HLT_FULL_cff.py:55051
TrackingComponentsRecord.h
Exception
Definition: hltDiff.cc:246
TrajectoryStateOnSurface::curvilinearError
const CurvilinearTrajectoryError & curvilinearError() const
Definition: TrajectoryStateOnSurface.h:72
TempTrajectory::setStopReason
void setStopReason(StopReason s)
Definition: TempTrajectory.h:263
cmsutils::bqueue::rend
const_iterator rend() const
Definition: bqueue.h:198
FastTrajectoryCleaner
Definition: FastTrajectoryCleaner.h:14
TransverseImpactPointExtrapolator.h
GroupedCkfTrajectoryBuilder::theMinNrOf2dHitsForRebuild
unsigned int theMinNrOf2dHitsForRebuild
Definition: GroupedCkfTrajectoryBuilder.h:188
DetLayer.h
TrajectorySeed
Definition: TrajectorySeed.h:18
TransverseImpactPointExtrapolator::extrapolate
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
Definition: TransverseImpactPointExtrapolator.cc:23
TempTrajectory::lastLayer
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
Definition: TempTrajectory.h:237
RegionalTrajectoryFilter
Definition: RegionalTrajectoryFilter.h:13
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TempTrajectory::nLoops
signed char nLoops() const
Definition: TempTrajectory.h:257
KFTrajectoryFitter.h
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
TrackingRegion
Definition: TrackingRegion.h:41
HelixBarrelCylinderCrossing
Definition: HelixBarrelCylinderCrossing.h:16
TransientTrackingRecHitBuilder.h
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GroupedCkfTrajectoryBuilder::estimator
const Chi2MeasurementEstimatorBase & estimator() const
Definition: GroupedCkfTrajectoryBuilder.h:67
TrajectoryMeasurement::layer
const DetLayer * layer() const
Definition: TrajectoryMeasurement.h:194
GroupedCkfTrajectoryBuilder::theIntermediateCleaning
bool theIntermediateCleaning
Definition: GroupedCkfTrajectoryBuilder.h:175
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
GroupedCkfTrajectoryBuilder::theFoundHitBonus
float theFoundHitBonus
Definition: GroupedCkfTrajectoryBuilder.h:173
GroupedCkfTrajectoryBuilder::trajectories
TrajectoryContainer trajectories(const TrajectorySeed &) const override
set Event for the internal MeasurementTracker data member
Definition: GroupedCkfTrajectoryBuilder.cc:163
TrajectoryFitter::fitOne
virtual Trajectory fitOne(const Trajectory &traj, fitType type=standard) const =0
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
BarrelDetLayer::specificSurface
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
Definition: BarrelDetLayer.h:39
TempTrajectory.h
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
StopReason::NO_SEGMENTS_FOR_VALID_LAYERS
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
CurvilinearTrajectoryError::matrix
const AlgebraicSymMatrix55 & matrix() const
Definition: CurvilinearTrajectoryError.h:61
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
BaseCkfTrajectoryBuilder::createStartingTrajectory
TempTrajectory createStartingTrajectory(const TrajectorySeed &seed) const
Definition: BaseCkfTrajectoryBuilder.cc:102
Trajectory::isValid
bool isValid() const
Definition: Trajectory.h:257
hit
Definition: SiStripHitEffFromCalibTree.cc:88
ForwardDetLayer::specificSurface
virtual const BoundDisk & specificSurface() const final
Definition: ForwardDetLayer.h:39
MeasurementTracker.h
IntermediateTrajectoryCleaner::clean
static void clean(TempTrajectoryContainer &tracks)
Definition: IntermediateTrajectoryCleaner.cc:10
HelixBarrelPlaneCrossingByCircle.h
TempTrajectory::empty
bool empty() const
True if trajectory has no measurements.
Definition: TempTrajectory.h:210