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