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