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