CMS 3D CMS Logo

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