CMS 3D CMS Logo

TrackEfficiencyMonitor Class Reference

Monitoring source to measure the track efficiency. More...

#include <DQM/TrackerMonitorTrack/src/TrackEfficiencyMonitor.cc>

Inheritance diagram for TrackEfficiencyMonitor:

edm::EDAnalyzer

List of all members.

Public Types

enum  SemiCylinder { Up, Down }

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (edm::EventSetup const &iSetup)
SemiCylinder checkSemiCylinder (const Track &)
int compatibleLayers (TrajectoryStateOnSurface theTSOS)
virtual void endJob (void)
std::pair
< TrajectoryStateOnSurface,
const DetLayer * > 
findNextLayer (TrajectoryStateOnSurface startTSOS, std::vector< const DetLayer * > trackCompatibleLayers, bool isUpMuon)
void testSTATracks (edm::Handle< TrackCollection > tkTracks, edm::Handle< TrackCollection > staTracks)
void testTrackerTracks (edm::Handle< TrackCollection > tkTracks, edm::Handle< TrackCollection > staTracks)
 TrackEfficiencyMonitor (const edm::ParameterSet &)
bool trackerAcceptance (TrajectoryStateOnSurface theTSOS, double theRadius, double theMaxZ)
 ~TrackEfficiencyMonitor ()

Private Attributes

edm::ESHandle< MagneticFieldbField
edm::ParameterSet conf_
MonitorElementdeltaX
MonitorElementdeltaY
DQMStoredqmStore_
int failedToPropagate
bool findDetLayer
std::string histname
bool isBFieldOff_
ESHandle< MeasurementTrackermeasurementTrackerHandle
MonitorElementmuonCompatibleLayers
MonitorElementmuonD0
MonitorElementmuonEta
MonitorElementmuonPhi
MonitorElementmuonX
MonitorElementmuonY
MonitorElementmuonZ
int nCompatibleLayers
MonitorElementsignDeltaX
MonitorElementsignDeltaY
edm::ESHandle
< GeometricSearchTracker
theGeometricSearchTracker
double theMaxZ_
MuonServiceProxy * theMuonServiceProxy
const DirectTrackerNavigationtheNavigation
edm::ESHandle< PropagatorthePropagator
edm::ESHandle< PropagatorthePropagatorCyl
double theRadius_
edm::InputTag theSTATracksLabel_
edm::InputTag theTKTracksLabel_
edm::ESHandle
< GeometricSearchTracker
theTracker
edm::ESHandle
< TransientTrackBuilder
theTTrackBuilder
MonitorElementtrackCompatibleLayers
MonitorElementtrackD0
bool trackEfficiency_
MonitorElementtrackEta
MonitorElementtrackPhi
MonitorElementtrackX
MonitorElementtrackY
MonitorElementtrackZ


Detailed Description

Monitoring source to measure the track efficiency.

Definition at line 40 of file TrackEfficiencyMonitor.h.


Member Enumeration Documentation

enum TrackEfficiencyMonitor::SemiCylinder

Enumerator:
Up 
Down 

Definition at line 48 of file TrackEfficiencyMonitor.h.

00048 {Up,Down};


Constructor & Destructor Documentation

TrackEfficiencyMonitor::TrackEfficiencyMonitor ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 53 of file TrackEfficiencyMonitor.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), isBFieldOff_, theMaxZ_, theRadius_, theSTATracksLabel_, theTKTracksLabel_, and trackEfficiency_.

00055 {
00056   dqmStore_            = edm::Service<DQMStore>().operator->(); 
00057  
00058   theRadius_           = iConfig.getParameter<double>("theRadius");
00059   theMaxZ_             = iConfig.getParameter<double>("theMaxZ");
00060   isBFieldOff_         = iConfig.getParameter<bool>("isBFieldOff");
00061   trackEfficiency_     = iConfig.getParameter<bool>("trackEfficiency");
00062   theTKTracksLabel_    = iConfig.getParameter<InputTag>("TKTrackCollection");
00063   theSTATracksLabel_   = iConfig.getParameter<InputTag>("STATrackCollection");
00064   
00065  
00066   conf_ = iConfig;
00067 }

TrackEfficiencyMonitor::~TrackEfficiencyMonitor (  ) 

Definition at line 72 of file TrackEfficiencyMonitor.cc.

00074 {}


Member Function Documentation

void TrackEfficiencyMonitor::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 261 of file TrackEfficiencyMonitor.cc.

References bField, edm::EventSetup::get(), edm::Event::getByLabel(), isBFieldOff_, muon::isGoodMuon(), measurementTrackerHandle, nCompatibleLayers, edm::ESHandle< T >::product(), testSTATracks(), testTrackerTracks(), theNavigation, thePropagator, theSTATracksLabel_, theTKTracksLabel_, theTracker, theTTrackBuilder, and trackEfficiency_.

00263 {
00264    
00265   using namespace edm;
00266 
00267   edm::Handle<reco::TrackCollection> tkTracks;
00268   iEvent.getByLabel(theTKTracksLabel_, tkTracks);
00269   edm::Handle<reco::TrackCollection> staTracks;
00270   iEvent.getByLabel(theSTATracksLabel_, staTracks);
00271   edm::ESHandle<NavigationSchool> nav;
00272   iSetup.get<NavigationSchoolRecord>().get("CosmicNavigationSchool", nav); 
00273   NavigationSetter setter(*nav.product());
00274   iSetup.get<CkfComponentsRecord>().get(measurementTrackerHandle);
00275  
00276   nCompatibleLayers = 0; 
00277   
00278   iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theTTrackBuilder);
00279   iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny",thePropagator);
00280   iSetup.get<IdealMagneticFieldRecord>().get(bField); 
00281   iSetup.get<TrackerRecoGeometryRecord>().get(theTracker);
00282   theNavigation = new DirectTrackerNavigation(theTracker);
00283   
00284   
00285   if(trackEfficiency_){
00286   //---------------------------------------------------
00287   // Select muons with good quality
00288   // If B field is on, no up-down matching between the muons
00289   //---------------------------------------------------  
00290   bool isGoodMuon = false;
00291   double mudd0 = 0., mudphi = 0., muddsz = 0., mudeta = 0.;
00292   if(isBFieldOff_)
00293   {
00294     if ( staTracks->size() == 2 )
00295     {
00296       for ( unsigned int bindex = 0; bindex < staTracks->size(); ++bindex ) 
00297       {
00298         
00299         if (0 == bindex){
00300            mudd0+=(*staTracks)[bindex].d0(); 
00301            mudphi+=(*staTracks)[bindex].phi();
00302            muddsz+=(*staTracks)[bindex].dsz(); 
00303            mudeta+=(*staTracks)[bindex].eta();}
00304         if (1 == bindex){
00305            mudd0-=(*staTracks)[bindex].d0(); 
00306            mudphi-=(*staTracks)[bindex].phi();
00307            muddsz-=(*staTracks)[bindex].dsz(); 
00308            mudeta-=(*staTracks)[bindex].eta();}
00309        }
00310       if ((fabs(mudd0)<15.0)&&(fabs(mudphi)<0.045)&&(fabs(muddsz)<20.0)&&(fabs(mudeta)<0.060))  isGoodMuon = true;
00311      }
00312      
00313     if(isGoodMuon) testTrackerTracks(tkTracks,staTracks);
00314   
00315   }
00316   else if ( staTracks->size() == 1 || staTracks->size() == 2) testTrackerTracks(tkTracks,staTracks);
00317   }
00318   
00319   
00320   if(!trackEfficiency_ && tkTracks->size() == 1 ){
00321     if( (tkTracks->front()).normalizedChi2() < 5 &&
00322     (tkTracks->front()).hitPattern().numberOfValidHits() > 8)
00323      testSTATracks(tkTracks,staTracks);  
00324   }
00325   
00326   
00327   delete theNavigation;
00328    
00329 }

void TrackEfficiencyMonitor::beginJob ( edm::EventSetup const &  iSetup  )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 80 of file TrackEfficiencyMonitor.cc.

References DQMStore::book1D(), conf_, deltaX, deltaY, dqmStore_, edm::ParameterSet::getParameter(), histname, muonCompatibleLayers, muonD0, muonEta, muonPhi, muonX, muonY, muonZ, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), signDeltaX, signDeltaY, trackCompatibleLayers, trackD0, trackEta, trackPhi, trackX, trackY, and trackZ.

00082 {
00083   using namespace edm;
00084   std::string MEFolderName = conf_.getParameter<std::string>("FolderName"); 
00085   std::string AlgoName     = conf_.getParameter<std::string>("AlgoName");
00086   
00087   
00088   dqmStore_->setCurrentFolder(MEFolderName);
00089   
00090   //
00091   int    muonXBin = conf_.getParameter<int>   ("muonXBin");
00092   double muonXMin = conf_.getParameter<double>("muonXMin");
00093   double muonXMax = conf_.getParameter<double>("muonXMax");
00094  
00095   histname = "muonX_";
00096   muonX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonXBin, muonXMin, muonXMax);
00097   muonX->setAxisTitle("");
00098   
00099   //
00100   int    muonYBin = conf_.getParameter<int>   ("muonYBin");
00101   double muonYMin = conf_.getParameter<double>("muonYMin");
00102   double muonYMax = conf_.getParameter<double>("muonYMax");
00103  
00104   histname = "muonY_";
00105   muonY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonYBin, muonYMin, muonYMax);
00106   muonY->setAxisTitle("");
00107   
00108   //
00109   int    muonZBin = conf_.getParameter<int>   ("muonZBin");
00110   double muonZMin = conf_.getParameter<double>("muonZMin");
00111   double muonZMax = conf_.getParameter<double>("muonZMax");
00112  
00113   histname = "muonZ_";
00114   muonZ = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonZBin, muonZMin, muonZMax);
00115   muonZ->setAxisTitle("");
00116   
00117   //
00118   int    muonEtaBin = conf_.getParameter<int>   ("muonEtaBin");
00119   double muonEtaMin = conf_.getParameter<double>("muonEtaMin");
00120   double muonEtaMax = conf_.getParameter<double>("muonEtaMax");
00121  
00122   histname = "muonEta_";
00123   muonEta = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonEtaBin, muonEtaMin, muonEtaMax);
00124   muonEta->setAxisTitle("");
00125   
00126   //
00127   int    muonPhiBin = conf_.getParameter<int>   ("muonPhiBin");
00128   double muonPhiMin = conf_.getParameter<double>("muonPhiMin");
00129   double muonPhiMax = conf_.getParameter<double>("muonPhiMax");
00130  
00131   histname = "muonPhi_";
00132   muonPhi = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonPhiBin, muonPhiMin, muonPhiMax);
00133   muonPhi->setAxisTitle("");
00134   
00135   //
00136   int    muonD0Bin = conf_.getParameter<int>   ("muonD0Bin");
00137   double muonD0Min = conf_.getParameter<double>("muonD0Min");
00138   double muonD0Max = conf_.getParameter<double>("muonD0Max");
00139  
00140   histname = "muonD0_";
00141   muonD0 = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonD0Bin, muonD0Min, muonD0Max);
00142   muonD0->setAxisTitle("");
00143   
00144   //
00145   int    muonCompatibleLayersBin = conf_.getParameter<int>   ("muonCompatibleLayersBin");
00146   double muonCompatibleLayersMin = conf_.getParameter<double>("muonCompatibleLayersMin");
00147   double muonCompatibleLayersMax = conf_.getParameter<double>("muonCompatibleLayersMax");
00148  
00149   histname = "muonCompatibleLayers_";
00150   muonCompatibleLayers = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonCompatibleLayersBin, muonCompatibleLayersMin, muonCompatibleLayersMax);
00151   muonCompatibleLayers->setAxisTitle("");
00152 
00153   //------------------------------------------------------------------------------------
00154   
00155   //
00156   int    trackXBin = conf_.getParameter<int>   ("trackXBin");
00157   double trackXMin = conf_.getParameter<double>("trackXMin");
00158   double trackXMax = conf_.getParameter<double>("trackXMax");
00159  
00160   histname = "trackX_";
00161   trackX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackXBin, trackXMin, trackXMax);
00162   trackX->setAxisTitle("");
00163   
00164   //
00165   int    trackYBin = conf_.getParameter<int>   ("trackYBin");
00166   double trackYMin = conf_.getParameter<double>("trackYMin");
00167   double trackYMax = conf_.getParameter<double>("trackYMax");
00168  
00169   histname = "trackY_";
00170   trackY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackYBin, trackYMin, trackYMax);
00171   trackY->setAxisTitle("");
00172   
00173   //
00174   int    trackZBin = conf_.getParameter<int>   ("trackZBin");
00175   double trackZMin = conf_.getParameter<double>("trackZMin");
00176   double trackZMax = conf_.getParameter<double>("trackZMax");
00177  
00178   histname = "trackZ_";
00179   trackZ = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackZBin, trackZMin, trackZMax);
00180   trackZ->setAxisTitle("");
00181   
00182   //
00183   int    trackEtaBin = conf_.getParameter<int>   ("trackEtaBin");
00184   double trackEtaMin = conf_.getParameter<double>("trackEtaMin");
00185   double trackEtaMax = conf_.getParameter<double>("trackEtaMax");
00186  
00187   histname = "trackEta_";
00188   trackEta = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackEtaBin, trackEtaMin, trackEtaMax);
00189   trackEta->setAxisTitle("");
00190   
00191   //
00192   int    trackPhiBin = conf_.getParameter<int>   ("trackPhiBin");
00193   double trackPhiMin = conf_.getParameter<double>("trackPhiMin");
00194   double trackPhiMax = conf_.getParameter<double>("trackPhiMax");
00195  
00196   histname = "trackPhi_";
00197   trackPhi = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackPhiBin, trackPhiMin, trackPhiMax);
00198   trackPhi->setAxisTitle("");
00199   
00200   //
00201   int    trackD0Bin = conf_.getParameter<int>   ("trackD0Bin");
00202   double trackD0Min = conf_.getParameter<double>("trackD0Min");
00203   double trackD0Max = conf_.getParameter<double>("trackD0Max");
00204  
00205   histname = "trackD0_";
00206   trackD0 = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackD0Bin, trackD0Min, trackD0Max);
00207   trackD0->setAxisTitle("");
00208   
00209   //
00210   int    trackCompatibleLayersBin = conf_.getParameter<int>   ("trackCompatibleLayersBin");
00211   double trackCompatibleLayersMin = conf_.getParameter<double>("trackCompatibleLayersMin");
00212   double trackCompatibleLayersMax = conf_.getParameter<double>("trackCompatibleLayersMax");
00213  
00214   histname = "trackCompatibleLayers_";
00215   trackCompatibleLayers = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackCompatibleLayersBin, trackCompatibleLayersMin, trackCompatibleLayersMax);
00216   trackCompatibleLayers->setAxisTitle("");
00217 
00218   //------------------------------------------------------------------------------------
00219  
00220   //
00221   int    deltaXBin = conf_.getParameter<int>   ("deltaXBin");
00222   double deltaXMin = conf_.getParameter<double>("deltaXMin");
00223   double deltaXMax = conf_.getParameter<double>("deltaXMax");
00224  
00225   histname = "deltaX_";
00226   deltaX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, deltaXBin, deltaXMin, deltaXMax);
00227   deltaX->setAxisTitle("");
00228   
00229   //
00230   int    deltaYBin = conf_.getParameter<int>   ("deltaYBin");
00231   double deltaYMin = conf_.getParameter<double>("deltaYMin");
00232   double deltaYMax = conf_.getParameter<double>("deltaYMax");
00233  
00234   histname = "deltaY_";
00235   deltaY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, deltaYBin, deltaYMin, deltaYMax);
00236   deltaY->setAxisTitle("");
00237   
00238   //
00239   int    signDeltaXBin = conf_.getParameter<int>   ("signDeltaXBin");
00240   double signDeltaXMin = conf_.getParameter<double>("signDeltaXMin");
00241   double signDeltaXMax = conf_.getParameter<double>("signDeltaXMax");
00242  
00243   histname = "signDeltaX_";
00244   signDeltaX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, signDeltaXBin, signDeltaXMin, signDeltaXMax);
00245   signDeltaX->setAxisTitle("");
00246   
00247   //
00248   int    signDeltaYBin = conf_.getParameter<int>   ("signDeltaYBin");
00249   double signDeltaYMin = conf_.getParameter<double>("signDeltaYMin");
00250   double signDeltaYMax = conf_.getParameter<double>("signDeltaYMax");
00251  
00252   histname = "signDeltaY_";
00253   signDeltaY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, signDeltaYBin, signDeltaYMin, signDeltaYMax);
00254   signDeltaY->setAxisTitle("");
00255   
00256 }

TrackEfficiencyMonitor::SemiCylinder TrackEfficiencyMonitor::checkSemiCylinder ( const Track tk  ) 

Definition at line 582 of file TrackEfficiencyMonitor.cc.

References Down, reco::Track::innerPosition(), and Up.

Referenced by testSTATracks(), and testTrackerTracks().

00584 {
00585   return tk.innerPosition().phi() > 0 ? TrackEfficiencyMonitor::Up : TrackEfficiencyMonitor::Down;
00586 }

int TrackEfficiencyMonitor::compatibleLayers ( TrajectoryStateOnSurface  theTSOS  ) 

Definition at line 640 of file TrackEfficiencyMonitor.cc.

References alongMomentum, findDetLayer, findNextLayer(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), k, layers, measurementTrackerHandle, DetLayer::nextLayers(), Propagator::propagate(), Propagator::setPropagationDirection(), GeometricSearchDet::surface(), thePropagator, trackCompatibleLayers, and PV3DBase< T, PVType, FrameType >::y().

Referenced by testTrackerTracks().

00642 {  
00643   //---------------------------------------------------   
00644   // check the number of compatible layers
00645   //---------------------------------------------------   
00646   
00647   std::vector< BarrelDetLayer*> barrelTOBLayers = measurementTrackerHandle->geometricSearchTracker()->tobLayers() ;
00648   
00649   unsigned int layers = 0;
00650   for ( unsigned int k=0 ; k < barrelTOBLayers.size() ; k++ ) 
00651   {  
00652     const DetLayer* firstLay = barrelTOBLayers[barrelTOBLayers.size() -1 - k];  
00653     
00654     //Propagator*  theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
00655     
00656     
00657     
00658     Propagator* theTmpPropagator = &*thePropagator->clone();
00659     theTmpPropagator->setPropagationDirection(alongMomentum); 
00660     
00661     TrajectoryStateOnSurface startTSOS = theTmpPropagator->propagate(*theTSOS.freeState(),firstLay->surface());
00662     
00663     std::vector< const DetLayer*> trackCompatibleLayers;
00664     
00665     findDetLayer      = true;
00666     bool isUpMuon     = false;
00667     bool firstdtep    = true; 
00668     
00669     if(startTSOS.isValid())
00670     {
00671       
00672       if(firstdtep) layers++; 
00673       
00674       int nwhile = 0;
00675       
00676       //for other compatible layers 
00677       while ( startTSOS.isValid() &&  firstLay && findDetLayer)
00678       {
00679         
00680         if(firstdtep && startTSOS.globalPosition().y()> 0) isUpMuon = true;
00681         
00682         if(firstdtep){
00683           std::vector< const DetLayer*> firstCompatibleLayers;
00684           firstCompatibleLayers.push_back(firstLay);
00685           std::pair<TrajectoryStateOnSurface, const  DetLayer* > nextLayer = findNextLayer(theTSOS, firstCompatibleLayers, isUpMuon );
00686           firstdtep = false;
00687         }
00688         else{
00689           trackCompatibleLayers =  firstLay->nextLayers(*(startTSOS.freeState()),alongMomentum);
00690           std::pair<TrajectoryStateOnSurface, const  DetLayer* > nextLayer = findNextLayer(startTSOS, trackCompatibleLayers, isUpMuon );
00691           if(trackCompatibleLayers.size()!=0  && firstLay != nextLayer.second ){
00692             firstLay  = nextLayer.second;
00693             startTSOS = nextLayer.first;
00694             layers++;         
00695           }
00696           else firstLay=0;
00697         }
00698         nwhile++;
00699         if(nwhile > 100) break;
00700                 
00701       }
00702       delete theTmpPropagator;
00703       break;
00704     }
00705     delete theTmpPropagator;
00706   }
00707   return layers;
00708   
00709 }

void TrackEfficiencyMonitor::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 334 of file TrackEfficiencyMonitor.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), iggi_31X_cfg::outputFileName, DQMStore::save(), and DQMStore::showDirStructure().

00336 { 
00337   bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
00338   std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
00339   if(outputMEsInRootFile){
00340     dqmStore_->showDirStructure(); 
00341     dqmStore_->save(outputFileName); 
00342     }
00343 
00344   //if ( theNavigation ) delete theNavigation; 
00345 
00346 }

std::pair< TrajectoryStateOnSurface, const DetLayer * > TrackEfficiencyMonitor::findNextLayer ( TrajectoryStateOnSurface  startTSOS,
std::vector< const DetLayer * >  trackCompatibleLayers,
bool  isUpMuon 
)

Definition at line 715 of file TrackEfficiencyMonitor.cc.

References alongMomentum, findDetLayer, TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::isValid(), itl, Propagator::propagate(), Propagator::setPropagationDirection(), and thePropagator.

Referenced by compatibleLayers().

00717 {
00718   
00719   //Propagator*  theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
00720   
00721   
00722   Propagator* theTmpPropagator = &*thePropagator->clone();
00723   theTmpPropagator->setPropagationDirection(alongMomentum); 
00724   
00725   
00726   std::vector<const DetLayer*>::iterator itl;
00727   findDetLayer = false;
00728   for (itl=trackCompatibleLayers.begin();itl!=trackCompatibleLayers.end();++itl) {
00729     TrajectoryStateOnSurface tsos = theTmpPropagator->propagate(*(sTSOS.freeState()),(**itl).surface());
00730     if (tsos.isValid()) 
00731     {
00732       sTSOS = tsos;
00733       findDetLayer = true; 
00734       
00735       break;
00736     }
00737   }
00738   std::pair<TrajectoryStateOnSurface,  const DetLayer* >  blabla;
00739   blabla.first = sTSOS;
00740   blabla.second = &**itl;
00741   delete theTmpPropagator;
00742   return blabla;
00743 }

void TrackEfficiencyMonitor::testSTATracks ( edm::Handle< TrackCollection >  tkTracks,
edm::Handle< TrackCollection >  staTracks 
)

Definition at line 491 of file TrackEfficiencyMonitor.cc.

References checkSemiCylinder(), debug_cff::d0, eta, PV3DBase< T, PVType, FrameType >::eta(), failedToPropagate, MonitorElement::Fill(), TrajectoryStateOnSurface::globalDirection(), TrajectoryStateOnSurface::globalPosition(), reco::TransientTrack::impactPointState(), reco::TransientTrack::innermostMeasurementState(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localPosition(), muonD0, muonEta, muonPhi, muonX, muonY, muonZ, reco::TransientTrack::outermostMeasurementState(), PV3DBase< T, PVType, FrameType >::phi(), phi, funct::pow(), TrajectoryStateOnSurface::surface(), thePropagator, theTTrackBuilder, trackD0, trackEta, trackPhi, trackX, trackY, trackZ, Up, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

00493 {
00494 
00495    
00496    reco::TransientTrack tkTT = theTTrackBuilder->build(tkTracks->front());
00497    double ipX   = tkTT.impactPointState().globalPosition().x();
00498    double ipY   = tkTT.impactPointState().globalPosition().y();
00499    double ipZ   = tkTT.impactPointState().globalPosition().z();
00500    double eta   = tkTT.impactPointState().globalDirection().eta();
00501    double phi   = tkTT.impactPointState().globalDirection().phi();
00502    double d0    = (*tkTracks)[0].d0();
00503 
00504    TrajectoryStateOnSurface tkInner = tkTT.innermostMeasurementState();
00505    LocalVector diffLocal;   
00506    TrajectoryStateOnSurface staState;      
00507    bool isTrack = false;
00508    
00509    
00510    if(!staTracks->empty()){     
00511         
00512        //---------------------------------------------------   
00513        //look for associated muons
00514        //---------------------------------------------------   
00515        
00516     float DR2min = 1000;
00517     reco::TrackCollection::const_iterator closestTrk = staTracks->end();
00518        //----------------------loop on tracker tracks:
00519     for(reco::TrackCollection::const_iterator staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
00520       if(checkSemiCylinder(*staTrack) == TrackEfficiencyMonitor::Up){
00521       
00522         reco::TransientTrack staTT = theTTrackBuilder->build(*staTrack); 
00523         failedToPropagate = 1;  
00524         staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());       
00525 
00526        
00527           if(staState.isValid())
00528           {
00529             failedToPropagate = 0;
00530             diffLocal = tkInner.localPosition() - staState.localPosition();
00531                
00532             double DR2 = diffLocal.x()*diffLocal.x()+diffLocal.y()*diffLocal.y();
00533             if (DR2<DR2min) { DR2min = DR2; closestTrk = staTrack;}
00534             if ( pow(DR2,0.5) < 100. ) isTrack = true;
00535            }
00536           }     
00537       }
00538     }
00539    
00540    if(failedToPropagate == 0)
00541       {         
00542          
00543          trackX->Fill(ipX);
00544          trackY->Fill(ipY);
00545          trackZ->Fill(ipZ);
00546          trackEta->Fill(eta);
00547          trackPhi->Fill(phi);
00548          trackD0->Fill(d0);
00549 
00550          if(isTrack)
00551          { 
00552             muonX->Fill(ipX);
00553             muonY->Fill(ipY);
00554             muonZ->Fill(ipZ);
00555             muonEta->Fill(eta);
00556             muonPhi->Fill(phi);
00557             muonD0->Fill(d0);
00558           }     
00559         }
00560 
00561 
00562 
00563 }

void TrackEfficiencyMonitor::testTrackerTracks ( edm::Handle< TrackCollection >  tkTracks,
edm::Handle< TrackCollection >  staTracks 
)

Definition at line 351 of file TrackEfficiencyMonitor.cc.

References checkSemiCylinder(), compatibleLayers(), debug_cff::d0, deltaX, deltaY, eta, PV3DBase< T, PVType, FrameType >::eta(), failedToPropagate, MonitorElement::Fill(), TrajectoryStateOnSurface::globalDirection(), TrajectoryStateOnSurface::globalPosition(), i, reco::TransientTrack::impactPointState(), reco::TransientTrack::innermostMeasurementState(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), muonCompatibleLayers, muonD0, muonEta, muonPhi, muonX, muonY, muonZ, nCompatibleLayers, reco::TransientTrack::outermostMeasurementState(), PV3DBase< T, PVType, FrameType >::phi(), phi, LocalTrajectoryError::positionError(), funct::pow(), signDeltaX, signDeltaY, TrajectoryStateOnSurface::surface(), theMaxZ_, thePropagator, theRadius_, theTTrackBuilder, trackCompatibleLayers, trackD0, trackerAcceptance(), trackEta, trackPhi, trackX, trackY, trackZ, Up, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

00353 {
00354   
00355   const std::string metname = "testStandAloneMuonTracks";
00356 
00357   //---------------------------------------------------
00358   // get the index of the "up" muon
00359   // histograms will only be computed for the "up" muon
00360   //---------------------------------------------------
00361  
00362   int nUpMuon = 0;
00363   int idxUpMuon = -1;
00364   for(unsigned int i =0; i< staTracks->size(); i++){
00365      if( checkSemiCylinder((*staTracks)[i]) == TrackEfficiencyMonitor::Up ){
00366         nUpMuon++;
00367         idxUpMuon = i;
00368      }
00369   }
00370     
00371    
00372   if( nUpMuon == 1)
00373   {
00374     
00375     //---------------------------------------------------
00376     //get the muon informations
00377     //---------------------------------------------------
00378     
00379     reco::TransientTrack staTT = theTTrackBuilder->build((*staTracks)[idxUpMuon]);
00380     double ipX   = staTT.impactPointState().globalPosition().x();
00381     double ipY   = staTT.impactPointState().globalPosition().y();
00382     double ipZ   = staTT.impactPointState().globalPosition().z();
00383     double eta   = staTT.impactPointState().globalDirection().eta();
00384     double phi   = staTT.impactPointState().globalDirection().phi();
00385     double d0    = (*staTracks)[idxUpMuon].d0();
00386     
00387     TrajectoryStateOnSurface theTSOS = staTT.outermostMeasurementState(); 
00388     TrajectoryStateOnSurface theTSOSCompLayers = staTT.outermostMeasurementState(); 
00389     
00390     
00391     //---------------------------------------------------
00392     //check if the muon is in the tracker acceptance
00393     //---------------------------------------------------    
00394     bool isInTrackerAcceptance = false;   
00395     isInTrackerAcceptance = trackerAcceptance( theTSOS, theRadius_ , theMaxZ_ );
00396     
00397     //---------------------------------------------------st
00398     //count the number of compatible layers
00399     //---------------------------------------------------       
00400     nCompatibleLayers = compatibleLayers(theTSOSCompLayers);
00401     
00402     if(isInTrackerAcceptance && (*staTracks)[idxUpMuon].hitPattern().numberOfValidHits() > 28)
00403     {
00404       //---------------------------------------------------
00405       //count the number of good muon candidates
00406       //---------------------------------------------------   
00407         
00408       TrajectoryStateOnSurface staState;      
00409       LocalVector diffLocal;   
00410      
00411          
00412       bool isTrack = false;
00413       if(!tkTracks->empty())
00414       {
00415        //---------------------------------------------------   
00416        //look for associated tracks
00417        //---------------------------------------------------   
00418         float DR2min = 1000;
00419         reco::TrackCollection::const_iterator closestTrk = tkTracks->end();
00420 
00421        for(reco::TrackCollection::const_iterator tkTrack = tkTracks->begin(); tkTrack != tkTracks->end(); ++tkTrack)
00422        {
00423           reco::TransientTrack tkTT = theTTrackBuilder->build(*tkTrack);
00424           TrajectoryStateOnSurface tkInner = tkTT.innermostMeasurementState();
00425           staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());      
00426           failedToPropagate = 1;
00427             
00428           if(staState.isValid())
00429           {
00430             failedToPropagate = 0;
00431             diffLocal = tkInner.localPosition() - staState.localPosition();
00432             double DR2 = diffLocal.x()*diffLocal.x()+diffLocal.y()*diffLocal.y();
00433             if (DR2<DR2min) { DR2min = DR2; closestTrk = tkTrack;}
00434             if ( pow(DR2,0.5) < 100. ) isTrack = true;
00435             }
00436           }
00437          
00438           
00439           if (DR2min != 1000) 
00440           { 
00441             
00442             reco::TransientTrack tkTT = theTTrackBuilder->build(*closestTrk);
00443             TrajectoryStateOnSurface tkInner = tkTT.innermostMeasurementState();
00444             staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());
00445             deltaX->Fill(diffLocal.x());
00446             deltaY->Fill(diffLocal.y());
00447             signDeltaX->Fill(diffLocal.x()/(tkInner.localError().positionError().xx() + staState.localError().positionError().xx()));
00448             signDeltaY->Fill(diffLocal.y()/(tkInner.localError().positionError().yy() + staState.localError().positionError().yy()));
00449                    
00450            } 
00451         }
00452       
00453       
00454       if(failedToPropagate == 0)
00455       {       
00456          muonX->Fill(ipX);
00457          muonY->Fill(ipY);
00458          muonZ->Fill(ipZ);
00459          muonEta->Fill(eta);
00460          muonPhi->Fill(phi);
00461          muonD0->Fill(d0);
00462          muonCompatibleLayers->Fill(nCompatibleLayers);
00463 
00464          if(isTrack)
00465          { 
00466             trackX->Fill(ipX);
00467             trackY->Fill(ipY);
00468             trackZ->Fill(ipZ);
00469             trackEta->Fill(eta);
00470             trackPhi->Fill(phi);
00471             trackD0->Fill(d0);
00472             trackCompatibleLayers->Fill(nCompatibleLayers);
00473           }     
00474         }
00475      }
00476    }
00477     
00478 }

bool TrackEfficiencyMonitor::trackerAcceptance ( TrajectoryStateOnSurface  theTSOS,
double  theRadius,
double  theMaxZ 
)

Definition at line 591 of file TrackEfficiencyMonitor.cc.

References alongMomentum, Cylinder::build(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), oppositeToMomentum, Propagator::propagate(), Propagator::setPropagationDirection(), thePropagator, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by testTrackerTracks().

00593 {
00594 
00595   //---------------------------------------------------  
00596   // check if the muon is in the tracker acceptance    
00597   // check the compatibility with a cylinder of radius "theRadius"
00598   //---------------------------------------------------   
00599       
00600   //Propagator*  theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
00601   
00602   //Propagator*  theTmpPropagator = &*thePropagator;
00603   Propagator* theTmpPropagator = &*thePropagator->clone();
00604   
00605   if (theTSOS.globalPosition().y() <0 ) theTmpPropagator->setPropagationDirection(oppositeToMomentum);
00606   else                                  theTmpPropagator->setPropagationDirection(alongMomentum);
00607   
00608   Cylinder::PositionType pos0;
00609   Cylinder::RotationType rot0;
00610   const Cylinder::CylinderPointer cyl = Cylinder::build(pos0, rot0, theRadius);
00611   TrajectoryStateOnSurface tsosAtCyl  = theTmpPropagator->propagate(*theTSOS.freeState(), *cyl);  
00612   double accept = false;
00613   if ( tsosAtCyl.isValid() ) {
00614     if (fabs(tsosAtCyl.globalPosition().z())<theMaxZ ) {
00615       Cylinder::PositionType pos02;
00616       Cylinder::RotationType rot02;
00617       const Cylinder::CylinderPointer cyl2 = Cylinder::build(pos02, rot02, theRadius -10);
00618       TrajectoryStateOnSurface tsosAtCyl2 = theTmpPropagator->propagate(*tsosAtCyl.freeState(), *cyl2);
00619       if ( tsosAtCyl2.isValid() ) {
00620         Cylinder::PositionType pos03;
00621         Cylinder::RotationType rot03;
00622         const Cylinder::CylinderPointer cyl3 = Cylinder::build(pos03, rot03, theRadius );
00623         TrajectoryStateOnSurface tsosAtCyl3 = theTmpPropagator->propagate(*tsosAtCyl2.freeState(), *cyl3);
00624         if ( tsosAtCyl3.isValid() ) {
00625           accept=true;
00626         }
00627       }
00628       
00629     }
00630   }
00631   delete theTmpPropagator;
00632   //muon propagated to the barrel cylinder
00633   return accept;
00634 
00635 }


Member Data Documentation

edm::ESHandle<MagneticField> TrackEfficiencyMonitor::bField [private]

Definition at line 110 of file TrackEfficiencyMonitor.h.

Referenced by analyze().

edm::ParameterSet TrackEfficiencyMonitor::conf_ [private]

Definition at line 66 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), endJob(), and TrackEfficiencyMonitor().

MonitorElement* TrackEfficiencyMonitor::deltaX [private]

Definition at line 97 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::deltaY [private]

Definition at line 98 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

DQMStore* TrackEfficiencyMonitor::dqmStore_ [private]

Definition at line 65 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), endJob(), and TrackEfficiencyMonitor().

int TrackEfficiencyMonitor::failedToPropagate [private]

Definition at line 77 of file TrackEfficiencyMonitor.h.

Referenced by testSTATracks(), and testTrackerTracks().

bool TrackEfficiencyMonitor::findDetLayer [private]

Definition at line 79 of file TrackEfficiencyMonitor.h.

Referenced by compatibleLayers(), and findNextLayer().

std::string TrackEfficiencyMonitor::histname [private]

Definition at line 63 of file TrackEfficiencyMonitor.h.

Referenced by beginJob().

bool TrackEfficiencyMonitor::isBFieldOff_ [private]

Definition at line 70 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

ESHandle<MeasurementTracker> TrackEfficiencyMonitor::measurementTrackerHandle [private]

Definition at line 112 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and compatibleLayers().

MonitorElement* TrackEfficiencyMonitor::muonCompatibleLayers [private]

Definition at line 87 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonD0 [private]

Definition at line 86 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonEta [private]

Definition at line 84 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonPhi [private]

Definition at line 85 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonX [private]

Definition at line 81 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonY [private]

Definition at line 82 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonZ [private]

Definition at line 83 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

int TrackEfficiencyMonitor::nCompatibleLayers [private]

Definition at line 78 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::signDeltaX [private]

Definition at line 99 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::signDeltaY [private]

Definition at line 100 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

edm::ESHandle<GeometricSearchTracker> TrackEfficiencyMonitor::theGeometricSearchTracker [private]

Definition at line 105 of file TrackEfficiencyMonitor.h.

double TrackEfficiencyMonitor::theMaxZ_ [private]

Definition at line 69 of file TrackEfficiencyMonitor.h.

Referenced by testTrackerTracks(), and TrackEfficiencyMonitor().

MuonServiceProxy* TrackEfficiencyMonitor::theMuonServiceProxy [private]

Definition at line 103 of file TrackEfficiencyMonitor.h.

const DirectTrackerNavigation* TrackEfficiencyMonitor::theNavigation [private]

Definition at line 102 of file TrackEfficiencyMonitor.h.

Referenced by analyze().

edm::ESHandle<Propagator> TrackEfficiencyMonitor::thePropagator [private]

Definition at line 106 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), compatibleLayers(), findNextLayer(), testSTATracks(), testTrackerTracks(), and trackerAcceptance().

edm::ESHandle<Propagator> TrackEfficiencyMonitor::thePropagatorCyl [private]

Definition at line 107 of file TrackEfficiencyMonitor.h.

double TrackEfficiencyMonitor::theRadius_ [private]

Definition at line 68 of file TrackEfficiencyMonitor.h.

Referenced by testTrackerTracks(), and TrackEfficiencyMonitor().

edm::InputTag TrackEfficiencyMonitor::theSTATracksLabel_ [private]

Definition at line 75 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

edm::InputTag TrackEfficiencyMonitor::theTKTracksLabel_ [private]

Definition at line 74 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

edm::ESHandle<GeometricSearchTracker> TrackEfficiencyMonitor::theTracker [private]

Definition at line 109 of file TrackEfficiencyMonitor.h.

Referenced by analyze().

edm::ESHandle<TransientTrackBuilder> TrackEfficiencyMonitor::theTTrackBuilder [private]

Definition at line 108 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackCompatibleLayers [private]

Definition at line 95 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), compatibleLayers(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackD0 [private]

Definition at line 94 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

bool TrackEfficiencyMonitor::trackEfficiency_ [private]

Definition at line 71 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

MonitorElement* TrackEfficiencyMonitor::trackEta [private]

Definition at line 92 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackPhi [private]

Definition at line 93 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackX [private]

Definition at line 89 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackY [private]

Definition at line 90 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackZ [private]

Definition at line 91 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:34:03 2009 for CMSSW by  doxygen 1.5.4