test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackEfficiencyMonitor.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Jeremy Andrea
5  */
6 
9 //#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
13 
18 #include <string>
19 
20 // needed to compute the efficiency
21 
28 
35 
38 
41 
45 
46 
47 
48 //-----------------------------------------------------------------------------------
50 //-----------------------------------------------------------------------------------
51 {
53 
54  theRadius_ = iConfig.getParameter<double>("theRadius");
55  theMaxZ_ = iConfig.getParameter<double>("theMaxZ");
56  isBFieldOff_ = iConfig.getParameter<bool>("isBFieldOff");
57  trackEfficiency_ = iConfig.getParameter<bool>("trackEfficiency");
58  theTKTracksLabel_ = iConfig.getParameter<edm::InputTag>("TKTrackCollection");
59  theSTATracksLabel_ = iConfig.getParameter<edm::InputTag>("STATrackCollection");
60 
61  theTKTracksToken_ = consumes<reco::TrackCollection>(theTKTracksLabel_);
62  theSTATracksToken_ = consumes<reco::TrackCollection>(theSTATracksLabel_);
63 
64  conf_ = iConfig;
65 }
66 
67 
68 
69 //-----------------------------------------------------------------------------------
71 //-----------------------------------------------------------------------------------
72 {}
73 
74 //-----------------------------------------------------------------------------------
76  edm::Run const & /* iRun */,
77  edm::EventSetup const & /* iSetup */)
78 //-----------------------------------------------------------------------------------
79 {
80  std::string MEFolderName = conf_.getParameter<std::string>("FolderName");
82 
83 
84  ibooker.setCurrentFolder(MEFolderName);
85 
86  //
87  int muonXBin = conf_.getParameter<int> ("muonXBin");
88  double muonXMin = conf_.getParameter<double>("muonXMin");
89  double muonXMax = conf_.getParameter<double>("muonXMax");
90 
91  histname = "muonX_";
92  muonX = ibooker.book1D(histname+AlgoName, histname+AlgoName, muonXBin, muonXMin, muonXMax);
93  muonX->setAxisTitle("");
94 
95  //
96  int muonYBin = conf_.getParameter<int> ("muonYBin");
97  double muonYMin = conf_.getParameter<double>("muonYMin");
98  double muonYMax = conf_.getParameter<double>("muonYMax");
99 
100  histname = "muonY_";
101  muonY = ibooker.book1D(histname+AlgoName, histname+AlgoName, muonYBin, muonYMin, muonYMax);
102  muonY->setAxisTitle("");
103 
104  //
105  int muonZBin = conf_.getParameter<int> ("muonZBin");
106  double muonZMin = conf_.getParameter<double>("muonZMin");
107  double muonZMax = conf_.getParameter<double>("muonZMax");
108 
109  histname = "muonZ_";
110  muonZ = ibooker.book1D(histname+AlgoName, histname+AlgoName, muonZBin, muonZMin, muonZMax);
111  muonZ->setAxisTitle("");
112 
113  //
114  int muonEtaBin = conf_.getParameter<int> ("muonEtaBin");
115  double muonEtaMin = conf_.getParameter<double>("muonEtaMin");
116  double muonEtaMax = conf_.getParameter<double>("muonEtaMax");
117 
118  histname = "muonEta_";
119  muonEta = ibooker.book1D(histname+AlgoName, histname+AlgoName, muonEtaBin, muonEtaMin, muonEtaMax);
120  muonEta->setAxisTitle("");
121 
122  //
123  int muonPhiBin = conf_.getParameter<int> ("muonPhiBin");
124  double muonPhiMin = conf_.getParameter<double>("muonPhiMin");
125  double muonPhiMax = conf_.getParameter<double>("muonPhiMax");
126 
127  histname = "muonPhi_";
128  muonPhi = ibooker.book1D(histname+AlgoName, histname+AlgoName, muonPhiBin, muonPhiMin, muonPhiMax);
129  muonPhi->setAxisTitle("");
130 
131  //
132  int muonD0Bin = conf_.getParameter<int> ("muonD0Bin");
133  double muonD0Min = conf_.getParameter<double>("muonD0Min");
134  double muonD0Max = conf_.getParameter<double>("muonD0Max");
135 
136  histname = "muonD0_";
137  muonD0 = ibooker.book1D(histname+AlgoName, histname+AlgoName, muonD0Bin, muonD0Min, muonD0Max);
138  muonD0->setAxisTitle("");
139 
140  //
141  int muonCompatibleLayersBin = conf_.getParameter<int> ("muonCompatibleLayersBin");
142  double muonCompatibleLayersMin = conf_.getParameter<double>("muonCompatibleLayersMin");
143  double muonCompatibleLayersMax = conf_.getParameter<double>("muonCompatibleLayersMax");
144 
145  histname = "muonCompatibleLayers_";
146  muonCompatibleLayers = ibooker.book1D(histname+AlgoName, histname+AlgoName, muonCompatibleLayersBin, muonCompatibleLayersMin, muonCompatibleLayersMax);
148 
149  //------------------------------------------------------------------------------------
150 
151  //
152  int trackXBin = conf_.getParameter<int> ("trackXBin");
153  double trackXMin = conf_.getParameter<double>("trackXMin");
154  double trackXMax = conf_.getParameter<double>("trackXMax");
155 
156  histname = "trackX_";
157  trackX = ibooker.book1D(histname+AlgoName, histname+AlgoName, trackXBin, trackXMin, trackXMax);
158  trackX->setAxisTitle("");
159 
160  //
161  int trackYBin = conf_.getParameter<int> ("trackYBin");
162  double trackYMin = conf_.getParameter<double>("trackYMin");
163  double trackYMax = conf_.getParameter<double>("trackYMax");
164 
165  histname = "trackY_";
166  trackY = ibooker.book1D(histname+AlgoName, histname+AlgoName, trackYBin, trackYMin, trackYMax);
167  trackY->setAxisTitle("");
168 
169  //
170  int trackZBin = conf_.getParameter<int> ("trackZBin");
171  double trackZMin = conf_.getParameter<double>("trackZMin");
172  double trackZMax = conf_.getParameter<double>("trackZMax");
173 
174  histname = "trackZ_";
175  trackZ = ibooker.book1D(histname+AlgoName, histname+AlgoName, trackZBin, trackZMin, trackZMax);
176  trackZ->setAxisTitle("");
177 
178  //
179  int trackEtaBin = conf_.getParameter<int> ("trackEtaBin");
180  double trackEtaMin = conf_.getParameter<double>("trackEtaMin");
181  double trackEtaMax = conf_.getParameter<double>("trackEtaMax");
182 
183  histname = "trackEta_";
184  trackEta = ibooker.book1D(histname+AlgoName, histname+AlgoName, trackEtaBin, trackEtaMin, trackEtaMax);
185  trackEta->setAxisTitle("");
186 
187  //
188  int trackPhiBin = conf_.getParameter<int> ("trackPhiBin");
189  double trackPhiMin = conf_.getParameter<double>("trackPhiMin");
190  double trackPhiMax = conf_.getParameter<double>("trackPhiMax");
191 
192  histname = "trackPhi_";
193  trackPhi = ibooker.book1D(histname+AlgoName, histname+AlgoName, trackPhiBin, trackPhiMin, trackPhiMax);
194  trackPhi->setAxisTitle("");
195 
196  //
197  int trackD0Bin = conf_.getParameter<int> ("trackD0Bin");
198  double trackD0Min = conf_.getParameter<double>("trackD0Min");
199  double trackD0Max = conf_.getParameter<double>("trackD0Max");
200 
201  histname = "trackD0_";
202  trackD0 = ibooker.book1D(histname+AlgoName, histname+AlgoName, trackD0Bin, trackD0Min, trackD0Max);
203  trackD0->setAxisTitle("");
204 
205  //
206  int trackCompatibleLayersBin = conf_.getParameter<int> ("trackCompatibleLayersBin");
207  double trackCompatibleLayersMin = conf_.getParameter<double>("trackCompatibleLayersMin");
208  double trackCompatibleLayersMax = conf_.getParameter<double>("trackCompatibleLayersMax");
209 
210  histname = "trackCompatibleLayers_";
211  trackCompatibleLayers = ibooker.book1D(histname+AlgoName, histname+AlgoName, trackCompatibleLayersBin, trackCompatibleLayersMin, trackCompatibleLayersMax);
213 
214  //------------------------------------------------------------------------------------
215 
216  //
217  int deltaXBin = conf_.getParameter<int> ("deltaXBin");
218  double deltaXMin = conf_.getParameter<double>("deltaXMin");
219  double deltaXMax = conf_.getParameter<double>("deltaXMax");
220 
221  histname = "deltaX_";
222  deltaX = ibooker.book1D(histname+AlgoName, histname+AlgoName, deltaXBin, deltaXMin, deltaXMax);
223  deltaX->setAxisTitle("");
224 
225  //
226  int deltaYBin = conf_.getParameter<int> ("deltaYBin");
227  double deltaYMin = conf_.getParameter<double>("deltaYMin");
228  double deltaYMax = conf_.getParameter<double>("deltaYMax");
229 
230  histname = "deltaY_";
231  deltaY = ibooker.book1D(histname+AlgoName, histname+AlgoName, deltaYBin, deltaYMin, deltaYMax);
232  deltaY->setAxisTitle("");
233 
234  //
235  int signDeltaXBin = conf_.getParameter<int> ("signDeltaXBin");
236  double signDeltaXMin = conf_.getParameter<double>("signDeltaXMin");
237  double signDeltaXMax = conf_.getParameter<double>("signDeltaXMax");
238 
239  histname = "signDeltaX_";
240  signDeltaX = ibooker.book1D(histname+AlgoName, histname+AlgoName, signDeltaXBin, signDeltaXMin, signDeltaXMax);
242 
243  //
244  int signDeltaYBin = conf_.getParameter<int> ("signDeltaYBin");
245  double signDeltaYMin = conf_.getParameter<double>("signDeltaYMin");
246  double signDeltaYMax = conf_.getParameter<double>("signDeltaYMax");
247 
248  histname = "signDeltaY_";
249  signDeltaY = ibooker.book1D(histname+AlgoName, histname+AlgoName, signDeltaYBin, signDeltaYMin, signDeltaYMax);
251 
252 }
253 
254 
255 //-----------------------------------------------------------------------------------
257 //-----------------------------------------------------------------------------------
258 {
259 
260 }
261 
262 
263 
264 //-----------------------------------------------------------------------------------
266 //-----------------------------------------------------------------------------------
267 {
268 
269 
271  iEvent.getByToken(theTKTracksToken_, tkTracks);
273  iEvent.getByToken(theSTATracksToken_, staTracks);
275  iSetup.get<NavigationSchoolRecord>().get("CosmicNavigationSchool", nav);
277 
278  nCompatibleLayers = 0;
279 
280  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theTTrackBuilder);
281  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny",thePropagator);
282  iSetup.get<IdealMagneticFieldRecord>().get(bField);
285 
286 
287  if(trackEfficiency_){
288  //---------------------------------------------------
289  // Select muons with good quality
290  // If B field is on, no up-down matching between the muons
291  //---------------------------------------------------
292  bool isGoodMuon = false;
293  double mudd0 = 0., mudphi = 0., muddsz = 0., mudeta = 0.;
294  if(isBFieldOff_)
295  {
296  if ( staTracks->size() == 2 )
297  {
298  for ( unsigned int bindex = 0; bindex < staTracks->size(); ++bindex )
299  {
300 
301  if (0 == bindex){
302  mudd0+=(*staTracks)[bindex].d0();
303  mudphi+=(*staTracks)[bindex].phi();
304  muddsz+=(*staTracks)[bindex].dsz();
305  mudeta+=(*staTracks)[bindex].eta();}
306  if (1 == bindex){
307  mudd0-=(*staTracks)[bindex].d0();
308  mudphi-=(*staTracks)[bindex].phi();
309  muddsz-=(*staTracks)[bindex].dsz();
310  mudeta-=(*staTracks)[bindex].eta();}
311  }
312  if ((fabs(mudd0)<15.0)&&(fabs(mudphi)<0.045)&&(fabs(muddsz)<20.0)&&(fabs(mudeta)<0.060)) isGoodMuon = true;
313  }
314 
315  if(isGoodMuon) testTrackerTracks(tkTracks,staTracks, *nav.product());
316 
317  }
318  else if ( staTracks->size() == 1 || staTracks->size() == 2) testTrackerTracks(tkTracks,staTracks, *nav.product());
319  }
320 
321 
322  if(!trackEfficiency_ && tkTracks->size() == 1 ){
323  if( (tkTracks->front()).normalizedChi2() < 5 &&
324  (tkTracks->front()).hitPattern().numberOfValidHits() > 8)
325  testSTATracks(tkTracks,staTracks);
326  }
327 
328 
329  delete theNavigation;
330 
331 }
332 
333 
334 
335 //-----------------------------------------------------------------------------------
337 //-----------------------------------------------------------------------------------
338 {
339  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
341  if(outputMEsInRootFile){
343  dqmStore_->save(outputFileName);
344  }
345 
346  //if ( theNavigation ) delete theNavigation;
347 
348 }
349 
350 
351 
352 //-----------------------------------------------------------------------------------
354 //-----------------------------------------------------------------------------------
355 {
356 
357  const std::string metname = "testStandAloneMuonTracks";
358 
359  //---------------------------------------------------
360  // get the index of the "up" muon
361  // histograms will only be computed for the "up" muon
362  //---------------------------------------------------
363 
364  int nUpMuon = 0;
365  int idxUpMuon = -1;
366  for(unsigned int i =0; i< staTracks->size(); i++){
367  if( checkSemiCylinder((*staTracks)[i]) == TrackEfficiencyMonitor::Up ){
368  nUpMuon++;
369  idxUpMuon = i;
370  }
371  }
372 
373 
374  if( nUpMuon == 1)
375  {
376 
377  //---------------------------------------------------
378  //get the muon informations
379  //---------------------------------------------------
380 
381  reco::TransientTrack staTT = theTTrackBuilder->build((*staTracks)[idxUpMuon]);
382  double ipX = staTT.impactPointState().globalPosition().x();
383  double ipY = staTT.impactPointState().globalPosition().y();
384  double ipZ = staTT.impactPointState().globalPosition().z();
385  double eta = staTT.impactPointState().globalDirection().eta();
386  double phi = staTT.impactPointState().globalDirection().phi();
387  double d0 = (*staTracks)[idxUpMuon].d0();
388 
390  TrajectoryStateOnSurface theTSOSCompLayers = staTT.outermostMeasurementState();
391 
392 
393  //---------------------------------------------------
394  //check if the muon is in the tracker acceptance
395  //---------------------------------------------------
396  bool isInTrackerAcceptance = false;
397  isInTrackerAcceptance = trackerAcceptance( theTSOS, theRadius_ , theMaxZ_ );
398 
399  //---------------------------------------------------st
400  //count the number of compatible layers
401  //---------------------------------------------------
402  nCompatibleLayers = compatibleLayers(navigationSchool, theTSOSCompLayers);
403 
404  if(isInTrackerAcceptance && (*staTracks)[idxUpMuon].hitPattern().numberOfValidHits() > 28)
405  {
406  //---------------------------------------------------
407  //count the number of good muon candidates
408  //---------------------------------------------------
409 
410  TrajectoryStateOnSurface staState;
411  LocalVector diffLocal;
412 
413 
414  bool isTrack = false;
415  if(!tkTracks->empty())
416  {
417  //---------------------------------------------------
418  //look for associated tracks
419  //---------------------------------------------------
420  float DR2min = 1000;
421  reco::TrackCollection::const_iterator closestTrk = tkTracks->end();
422 
423  for(reco::TrackCollection::const_iterator tkTrack = tkTracks->begin(); tkTrack != tkTracks->end(); ++tkTrack)
424  {
425  reco::TransientTrack tkTT = theTTrackBuilder->build(*tkTrack);
427  staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());
428  failedToPropagate = 1;
429 
430  if(staState.isValid())
431  {
432  failedToPropagate = 0;
433  diffLocal = tkInner.localPosition() - staState.localPosition();
434  double DR2 = diffLocal.x()*diffLocal.x()+diffLocal.y()*diffLocal.y();
435  if (DR2<DR2min) { DR2min = DR2; closestTrk = tkTrack;}
436  if ( pow(DR2,0.5) < 100. ) isTrack = true;
437  }
438  }
439 
440 
441  if (DR2min != 1000)
442  {
443 
444  reco::TransientTrack tkTT = theTTrackBuilder->build(*closestTrk);
446  staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());
447  deltaX->Fill(diffLocal.x());
448  deltaY->Fill(diffLocal.y());
449  signDeltaX->Fill(diffLocal.x()/(tkInner.localError().positionError().xx() + staState.localError().positionError().xx()));
450  signDeltaY->Fill(diffLocal.y()/(tkInner.localError().positionError().yy() + staState.localError().positionError().yy()));
451 
452  }
453  }
454 
455 
456  if(failedToPropagate == 0)
457  {
458  muonX->Fill(ipX);
459  muonY->Fill(ipY);
460  muonZ->Fill(ipZ);
461  muonEta->Fill(eta);
462  muonPhi->Fill(phi);
463  muonD0->Fill(d0);
465 
466  if(isTrack)
467  {
468  trackX->Fill(ipX);
469  trackY->Fill(ipY);
470  trackZ->Fill(ipZ);
471  trackEta->Fill(eta);
472  trackPhi->Fill(phi);
473  trackD0->Fill(d0);
475  }
476  }
477  }
478  }
479 
480 }
481 
482 
483 
484 
485 
486 
487 
488 
489 
490 
491 
492 //-----------------------------------------------------------------------------------
494 //-----------------------------------------------------------------------------------
495 {
496 
497 
498  reco::TransientTrack tkTT = theTTrackBuilder->build(tkTracks->front());
499  double ipX = tkTT.impactPointState().globalPosition().x();
500  double ipY = tkTT.impactPointState().globalPosition().y();
501  double ipZ = tkTT.impactPointState().globalPosition().z();
502  double eta = tkTT.impactPointState().globalDirection().eta();
503  double phi = tkTT.impactPointState().globalDirection().phi();
504  double d0 = (*tkTracks)[0].d0();
505 
507  LocalVector diffLocal;
508  TrajectoryStateOnSurface staState;
509  bool isTrack = false;
510 
511 
512  if(!staTracks->empty()){
513 
514  //---------------------------------------------------
515  //look for associated muons
516  //---------------------------------------------------
517 
518  float DR2min = 1000;
519  reco::TrackCollection::const_iterator closestTrk = staTracks->end();
520  //----------------------loop on tracker tracks:
521  for(reco::TrackCollection::const_iterator staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
523 
524  reco::TransientTrack staTT = theTTrackBuilder->build(*staTrack);
525  failedToPropagate = 1;
526  staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());
527 
528 
529  if(staState.isValid())
530  {
531  failedToPropagate = 0;
532  diffLocal = tkInner.localPosition() - staState.localPosition();
533 
534  double DR2 = diffLocal.x()*diffLocal.x()+diffLocal.y()*diffLocal.y();
535  if (DR2<DR2min) { DR2min = DR2; closestTrk = staTrack;}
536  if ( pow(DR2,0.5) < 100. ) isTrack = true;
537  }
538  }
539  }
540  }
541 
542  if(failedToPropagate == 0)
543  {
544 
545  trackX->Fill(ipX);
546  trackY->Fill(ipY);
547  trackZ->Fill(ipZ);
548  trackEta->Fill(eta);
549  trackPhi->Fill(phi);
550  trackD0->Fill(d0);
551 
552  if(isTrack)
553  {
554  muonX->Fill(ipX);
555  muonY->Fill(ipY);
556  muonZ->Fill(ipZ);
557  muonEta->Fill(eta);
558  muonPhi->Fill(phi);
559  muonD0->Fill(d0);
560  }
561  }
562 
563 
564 
565 }
566 
567 
568 
569 
570 
571 
572 
573 
574 
575 
576 
577 
578 
579 
580 
581 
582 
583 //-----------------------------------------------------------------------------------
585 //-----------------------------------------------------------------------------------
586 {
588 }
589 
590 
591 
592 //-----------------------------------------------------------------------------------
593 bool TrackEfficiencyMonitor::trackerAcceptance( TrajectoryStateOnSurface theTSOS, double theRadius, double theMaxZ)
594 //-----------------------------------------------------------------------------------
595 {
596 
597  //---------------------------------------------------
598  // check if the muon is in the tracker acceptance
599  // check the compatibility with a cylinder of radius "theRadius"
600  //---------------------------------------------------
601 
602  //Propagator* theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
603 
604  //Propagator* theTmpPropagator = &*thePropagator;
605  Propagator* theTmpPropagator = &*thePropagator->clone();
606 
607  if (theTSOS.globalPosition().y() <0 ) theTmpPropagator->setPropagationDirection(oppositeToMomentum);
608  else theTmpPropagator->setPropagationDirection(alongMomentum);
609 
612  const Cylinder::CylinderPointer cyl = Cylinder::build(pos0, rot0, theRadius);
613  TrajectoryStateOnSurface tsosAtCyl = theTmpPropagator->propagate(*theTSOS.freeState(), *cyl);
614  double accept = false;
615  if ( tsosAtCyl.isValid() ) {
616  if (fabs(tsosAtCyl.globalPosition().z())<theMaxZ ) {
619  const Cylinder::CylinderPointer cyl2 = Cylinder::build(pos02, rot02, theRadius -10);
620  TrajectoryStateOnSurface tsosAtCyl2 = theTmpPropagator->propagate(*tsosAtCyl.freeState(), *cyl2);
621  if ( tsosAtCyl2.isValid() ) {
624  const Cylinder::CylinderPointer cyl3 = Cylinder::build(pos03, rot03, theRadius );
625  TrajectoryStateOnSurface tsosAtCyl3 = theTmpPropagator->propagate(*tsosAtCyl2.freeState(), *cyl3);
626  if ( tsosAtCyl3.isValid() ) {
627  accept=true;
628  }
629  }
630 
631  }
632  }
633  delete theTmpPropagator;
634  //muon propagated to the barrel cylinder
635  return accept;
636 
637 }
638 
639 
640 
641 //-----------------------------------------------------------------------------------
643 //-----------------------------------------------------------------------------------
644 {
645  //---------------------------------------------------
646  // check the number of compatible layers
647  //---------------------------------------------------
648 
649  std::vector< const BarrelDetLayer*> barrelTOBLayers = measurementTrackerHandle->geometricSearchTracker()->tobLayers() ;
650 
651  unsigned int layers = 0;
652  for ( unsigned int k=0 ; k < barrelTOBLayers.size() ; k++ )
653  {
654  const DetLayer* firstLay = barrelTOBLayers[barrelTOBLayers.size() -1 - k];
655 
656  //Propagator* theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
657 
658 
659 
660  Propagator* theTmpPropagator = &*thePropagator->clone();
661  theTmpPropagator->setPropagationDirection(alongMomentum);
662 
663  TrajectoryStateOnSurface startTSOS = theTmpPropagator->propagate(*theTSOS.freeState(),firstLay->surface());
664 
665  std::vector< const DetLayer*> trackCompatibleLayers;
666 
667  findDetLayer = true;
668  bool isUpMuon = false;
669  bool firstdtep = true;
670 
671  if(startTSOS.isValid())
672  {
673 
674  if(firstdtep) layers++;
675 
676  int nwhile = 0;
677 
678  //for other compatible layers
679  while ( startTSOS.isValid() && firstLay && findDetLayer)
680  {
681 
682  if(firstdtep && startTSOS.globalPosition().y()> 0) isUpMuon = true;
683 
684  if(firstdtep){
685  std::vector< const DetLayer*> firstCompatibleLayers;
686  firstCompatibleLayers.push_back(firstLay);
687  std::pair<TrajectoryStateOnSurface, const DetLayer* > nextLayer = findNextLayer(theTSOS, firstCompatibleLayers, isUpMuon );
688  firstdtep = false;
689  }
690  else{
691  trackCompatibleLayers = navigationSchool.nextLayers(*firstLay, *(startTSOS.freeState()),alongMomentum);
692  if (trackCompatibleLayers.size()!=0 ){
693  std::pair<TrajectoryStateOnSurface, const DetLayer* > nextLayer = findNextLayer(startTSOS, trackCompatibleLayers, isUpMuon );
694  if (firstLay != nextLayer.second ){
695  firstLay = nextLayer.second;
696  startTSOS = nextLayer.first;
697  layers++;
698  }
699  else firstLay=0;
700  }
701  }
702  nwhile++;
703  if(nwhile > 100) break;
704 
705  }
706  delete theTmpPropagator;
707  break;
708  }
709  delete theTmpPropagator;
710  }
711  return layers;
712 
713 }
714 
715 
716 
717 
718 //-----------------------------------------------------------------------------------
719 std::pair<TrajectoryStateOnSurface, const DetLayer*> TrackEfficiencyMonitor::findNextLayer( TrajectoryStateOnSurface sTSOS, const std::vector< const DetLayer*>& trackCompatibleLayers , bool isUpMuon )
720 //-----------------------------------------------------------------------------------
721 {
722 
723  //Propagator* theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
724 
725 
726  Propagator* theTmpPropagator = &*thePropagator->clone();
727  theTmpPropagator->setPropagationDirection(alongMomentum);
728 
729 
730  std::vector<const DetLayer*>::const_iterator itl;
731  findDetLayer = false;
732  for (itl=trackCompatibleLayers.begin();itl!=trackCompatibleLayers.end();++itl) {
733  TrajectoryStateOnSurface tsos = theTmpPropagator->propagate(*(sTSOS.freeState()),(**itl).surface());
734  if (tsos.isValid())
735  {
736  sTSOS = tsos;
737  findDetLayer = true;
738 
739  break;
740  }
741  }
742  std::pair<TrajectoryStateOnSurface, const DetLayer* > blabla;
743  blabla.first = sTSOS;
744  blabla.second = &**itl;
745  delete theTmpPropagator;
746  return blabla;
747 }
748 
T getParameter(std::string const &) const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< MagneticField > bField
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:140
float xx() const
Definition: LocalError.h:24
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
const std::string metname
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::ESHandle< GeometricSearchTracker > theTracker
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
void testTrackerTracks(edm::Handle< TrackCollection > tkTracks, edm::Handle< TrackCollection > staTracks, const NavigationSchool &navigationSchool)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
LocalError positionError() const
TrajectoryStateOnSurface innermostMeasurementState() const
void Fill(long long x)
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
Definition: Cylinder.h:51
MonitorElement * muonCompatibleLayers
int iEvent
Definition: GenABIO.cc:230
const SurfaceType & surface() const
float yy() const
Definition: LocalError.h:26
FreeTrajectoryState const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
edm::ESHandle< MeasurementTracker > measurementTrackerHandle
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const LocalTrajectoryError & localError() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
TrajectoryStateOnSurface outermostMeasurementState() const
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
edm::EDGetTokenT< reco::TrackCollection > theTKTracksToken_
edm::ESHandle< Propagator > thePropagator
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
std::pair< TrajectoryStateOnSurface, const DetLayer * > findNextLayer(TrajectoryStateOnSurface startTSOS, const std::vector< const DetLayer * > &trackCompatibleLayers, bool isUpMuon)
edm::ESHandle< TransientTrackBuilder > theTTrackBuilder
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&...args) const
NavigationDirection.
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
const DirectTrackerNavigation * theNavigation
T eta() const
Definition: PV3DBase.h:76
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2632
bool trackerAcceptance(TrajectoryStateOnSurface theTSOS, double theRadius, double theMaxZ)
int compatibleLayers(const NavigationSchool &navigationSchool, TrajectoryStateOnSurface theTSOS)
TrackEfficiencyMonitor(const edm::ParameterSet &)
TrajectoryStateOnSurface impactPointState() const
void showDirStructure(void) const
Definition: DQMStore.cc:3427
SemiCylinder checkSemiCylinder(const Track &)
MonitorElement * trackCompatibleLayers
T x() const
Definition: PV3DBase.h:62
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void testSTATracks(edm::Handle< TrackCollection > tkTracks, edm::Handle< TrackCollection > staTracks)
edm::EDGetTokenT< reco::TrackCollection > theSTATracksToken_
Definition: Run.h:43
GlobalVector globalDirection() const