CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

TrackEfficiencyMonitor Class Reference

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

Inheritance diagram for TrackEfficiencyMonitor:
edm::EDAnalyzer

List of all members.

Public Types

enum  SemiCylinder { Up, Down }
typedef reco::Track Track
typedef reco::TrackCollection TrackCollection

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (void)
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_
edm::ESHandle< MeasurementTrackermeasurementTrackerHandle
MonitorElementmuonCompatibleLayers
MonitorElementmuonD0
MonitorElementmuonEta
MonitorElementmuonPhi
MonitorElementmuonX
MonitorElementmuonY
MonitorElementmuonZ
int nCompatibleLayers
MonitorElementsignDeltaX
MonitorElementsignDeltaY
edm::ESHandle
< GeometricSearchTracker
theGeometricSearchTracker
double theMaxZ_
MuonServiceProxytheMuonServiceProxy
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 Typedef Documentation

Definition at line 42 of file TrackEfficiencyMonitor.h.

Definition at line 43 of file TrackEfficiencyMonitor.h.


Member Enumeration Documentation

Enumerator:
Up 
Down 

Definition at line 50 of file TrackEfficiencyMonitor.h.

{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_, cmsCodeRules::cppFunctionSkipper::operator, theMaxZ_, theRadius_, theSTATracksLabel_, theTKTracksLabel_, and trackEfficiency_.

{
  dqmStore_            = edm::Service<DQMStore>().operator->(); 
 
  theRadius_           = iConfig.getParameter<double>("theRadius");
  theMaxZ_             = iConfig.getParameter<double>("theMaxZ");
  isBFieldOff_         = iConfig.getParameter<bool>("isBFieldOff");
  trackEfficiency_     = iConfig.getParameter<bool>("trackEfficiency");
  theTKTracksLabel_    = iConfig.getParameter<edm::InputTag>("TKTrackCollection");
  theSTATracksLabel_   = iConfig.getParameter<edm::InputTag>("STATrackCollection");
  
 
  conf_ = iConfig;
}
TrackEfficiencyMonitor::~TrackEfficiencyMonitor ( )

Definition at line 72 of file TrackEfficiencyMonitor.cc.

{}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 260 of file TrackEfficiencyMonitor.cc.

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

{
   

  edm::Handle<reco::TrackCollection> tkTracks;
  iEvent.getByLabel(theTKTracksLabel_, tkTracks);
  edm::Handle<reco::TrackCollection> staTracks;
  iEvent.getByLabel(theSTATracksLabel_, staTracks);
  edm::ESHandle<NavigationSchool> nav;
  iSetup.get<NavigationSchoolRecord>().get("CosmicNavigationSchool", nav); 
  NavigationSetter setter(*nav.product());
  iSetup.get<CkfComponentsRecord>().get(measurementTrackerHandle);
 
  nCompatibleLayers = 0; 
  
  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theTTrackBuilder);
  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny",thePropagator);
  iSetup.get<IdealMagneticFieldRecord>().get(bField); 
  iSetup.get<TrackerRecoGeometryRecord>().get(theTracker);
  theNavigation = new DirectTrackerNavigation(theTracker);
  
  
  if(trackEfficiency_){
  //---------------------------------------------------
  // Select muons with good quality
  // If B field is on, no up-down matching between the muons
  //---------------------------------------------------  
  bool isGoodMuon = false;
  double mudd0 = 0., mudphi = 0., muddsz = 0., mudeta = 0.;
  if(isBFieldOff_)
  {
    if ( staTracks->size() == 2 )
    {
      for ( unsigned int bindex = 0; bindex < staTracks->size(); ++bindex ) 
      {
        
        if (0 == bindex){
           mudd0+=(*staTracks)[bindex].d0(); 
           mudphi+=(*staTracks)[bindex].phi();
           muddsz+=(*staTracks)[bindex].dsz(); 
           mudeta+=(*staTracks)[bindex].eta();}
        if (1 == bindex){
           mudd0-=(*staTracks)[bindex].d0(); 
           mudphi-=(*staTracks)[bindex].phi();
           muddsz-=(*staTracks)[bindex].dsz(); 
           mudeta-=(*staTracks)[bindex].eta();}
       }
      if ((fabs(mudd0)<15.0)&&(fabs(mudphi)<0.045)&&(fabs(muddsz)<20.0)&&(fabs(mudeta)<0.060))  isGoodMuon = true;
     }
     
    if(isGoodMuon) testTrackerTracks(tkTracks,staTracks);
  
  }
  else if ( staTracks->size() == 1 || staTracks->size() == 2) testTrackerTracks(tkTracks,staTracks);
  }
  
  
  if(!trackEfficiency_ && tkTracks->size() == 1 ){
    if( (tkTracks->front()).normalizedChi2() < 5 &&
    (tkTracks->front()).hitPattern().numberOfValidHits() > 8)
     testSTATracks(tkTracks,staTracks);  
  }
  
  
  delete theNavigation;
   
}
void TrackEfficiencyMonitor::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 80 of file TrackEfficiencyMonitor.cc.

References ExpressReco_HICollisions_FallBack::AlgoName, 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.

{
  std::string MEFolderName = conf_.getParameter<std::string>("FolderName"); 
  std::string AlgoName     = conf_.getParameter<std::string>("AlgoName");
  
  
  dqmStore_->setCurrentFolder(MEFolderName);
  
  //
  int    muonXBin = conf_.getParameter<int>   ("muonXBin");
  double muonXMin = conf_.getParameter<double>("muonXMin");
  double muonXMax = conf_.getParameter<double>("muonXMax");
 
  histname = "muonX_";
  muonX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonXBin, muonXMin, muonXMax);
  muonX->setAxisTitle("");
  
  //
  int    muonYBin = conf_.getParameter<int>   ("muonYBin");
  double muonYMin = conf_.getParameter<double>("muonYMin");
  double muonYMax = conf_.getParameter<double>("muonYMax");
 
  histname = "muonY_";
  muonY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonYBin, muonYMin, muonYMax);
  muonY->setAxisTitle("");
  
  //
  int    muonZBin = conf_.getParameter<int>   ("muonZBin");
  double muonZMin = conf_.getParameter<double>("muonZMin");
  double muonZMax = conf_.getParameter<double>("muonZMax");
 
  histname = "muonZ_";
  muonZ = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonZBin, muonZMin, muonZMax);
  muonZ->setAxisTitle("");
  
  //
  int    muonEtaBin = conf_.getParameter<int>   ("muonEtaBin");
  double muonEtaMin = conf_.getParameter<double>("muonEtaMin");
  double muonEtaMax = conf_.getParameter<double>("muonEtaMax");
 
  histname = "muonEta_";
  muonEta = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonEtaBin, muonEtaMin, muonEtaMax);
  muonEta->setAxisTitle("");
  
  //
  int    muonPhiBin = conf_.getParameter<int>   ("muonPhiBin");
  double muonPhiMin = conf_.getParameter<double>("muonPhiMin");
  double muonPhiMax = conf_.getParameter<double>("muonPhiMax");
 
  histname = "muonPhi_";
  muonPhi = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonPhiBin, muonPhiMin, muonPhiMax);
  muonPhi->setAxisTitle("");
  
  //
  int    muonD0Bin = conf_.getParameter<int>   ("muonD0Bin");
  double muonD0Min = conf_.getParameter<double>("muonD0Min");
  double muonD0Max = conf_.getParameter<double>("muonD0Max");
 
  histname = "muonD0_";
  muonD0 = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonD0Bin, muonD0Min, muonD0Max);
  muonD0->setAxisTitle("");
  
  //
  int    muonCompatibleLayersBin = conf_.getParameter<int>   ("muonCompatibleLayersBin");
  double muonCompatibleLayersMin = conf_.getParameter<double>("muonCompatibleLayersMin");
  double muonCompatibleLayersMax = conf_.getParameter<double>("muonCompatibleLayersMax");
 
  histname = "muonCompatibleLayers_";
  muonCompatibleLayers = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonCompatibleLayersBin, muonCompatibleLayersMin, muonCompatibleLayersMax);
  muonCompatibleLayers->setAxisTitle("");

  //------------------------------------------------------------------------------------
  
  //
  int    trackXBin = conf_.getParameter<int>   ("trackXBin");
  double trackXMin = conf_.getParameter<double>("trackXMin");
  double trackXMax = conf_.getParameter<double>("trackXMax");
 
  histname = "trackX_";
  trackX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackXBin, trackXMin, trackXMax);
  trackX->setAxisTitle("");
  
  //
  int    trackYBin = conf_.getParameter<int>   ("trackYBin");
  double trackYMin = conf_.getParameter<double>("trackYMin");
  double trackYMax = conf_.getParameter<double>("trackYMax");
 
  histname = "trackY_";
  trackY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackYBin, trackYMin, trackYMax);
  trackY->setAxisTitle("");
  
  //
  int    trackZBin = conf_.getParameter<int>   ("trackZBin");
  double trackZMin = conf_.getParameter<double>("trackZMin");
  double trackZMax = conf_.getParameter<double>("trackZMax");
 
  histname = "trackZ_";
  trackZ = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackZBin, trackZMin, trackZMax);
  trackZ->setAxisTitle("");
  
  //
  int    trackEtaBin = conf_.getParameter<int>   ("trackEtaBin");
  double trackEtaMin = conf_.getParameter<double>("trackEtaMin");
  double trackEtaMax = conf_.getParameter<double>("trackEtaMax");
 
  histname = "trackEta_";
  trackEta = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackEtaBin, trackEtaMin, trackEtaMax);
  trackEta->setAxisTitle("");
  
  //
  int    trackPhiBin = conf_.getParameter<int>   ("trackPhiBin");
  double trackPhiMin = conf_.getParameter<double>("trackPhiMin");
  double trackPhiMax = conf_.getParameter<double>("trackPhiMax");
 
  histname = "trackPhi_";
  trackPhi = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackPhiBin, trackPhiMin, trackPhiMax);
  trackPhi->setAxisTitle("");
  
  //
  int    trackD0Bin = conf_.getParameter<int>   ("trackD0Bin");
  double trackD0Min = conf_.getParameter<double>("trackD0Min");
  double trackD0Max = conf_.getParameter<double>("trackD0Max");
 
  histname = "trackD0_";
  trackD0 = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackD0Bin, trackD0Min, trackD0Max);
  trackD0->setAxisTitle("");
  
  //
  int    trackCompatibleLayersBin = conf_.getParameter<int>   ("trackCompatibleLayersBin");
  double trackCompatibleLayersMin = conf_.getParameter<double>("trackCompatibleLayersMin");
  double trackCompatibleLayersMax = conf_.getParameter<double>("trackCompatibleLayersMax");
 
  histname = "trackCompatibleLayers_";
  trackCompatibleLayers = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackCompatibleLayersBin, trackCompatibleLayersMin, trackCompatibleLayersMax);
  trackCompatibleLayers->setAxisTitle("");

  //------------------------------------------------------------------------------------
 
  //
  int    deltaXBin = conf_.getParameter<int>   ("deltaXBin");
  double deltaXMin = conf_.getParameter<double>("deltaXMin");
  double deltaXMax = conf_.getParameter<double>("deltaXMax");
 
  histname = "deltaX_";
  deltaX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, deltaXBin, deltaXMin, deltaXMax);
  deltaX->setAxisTitle("");
  
  //
  int    deltaYBin = conf_.getParameter<int>   ("deltaYBin");
  double deltaYMin = conf_.getParameter<double>("deltaYMin");
  double deltaYMax = conf_.getParameter<double>("deltaYMax");
 
  histname = "deltaY_";
  deltaY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, deltaYBin, deltaYMin, deltaYMax);
  deltaY->setAxisTitle("");
  
  //
  int    signDeltaXBin = conf_.getParameter<int>   ("signDeltaXBin");
  double signDeltaXMin = conf_.getParameter<double>("signDeltaXMin");
  double signDeltaXMax = conf_.getParameter<double>("signDeltaXMax");
 
  histname = "signDeltaX_";
  signDeltaX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, signDeltaXBin, signDeltaXMin, signDeltaXMax);
  signDeltaX->setAxisTitle("");
  
  //
  int    signDeltaYBin = conf_.getParameter<int>   ("signDeltaYBin");
  double signDeltaYMin = conf_.getParameter<double>("signDeltaYMin");
  double signDeltaYMax = conf_.getParameter<double>("signDeltaYMax");
 
  histname = "signDeltaY_";
  signDeltaY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, signDeltaYBin, signDeltaYMin, signDeltaYMax);
  signDeltaY->setAxisTitle("");
  
}
TrackEfficiencyMonitor::SemiCylinder TrackEfficiencyMonitor::checkSemiCylinder ( const Track tk)

Definition at line 580 of file TrackEfficiencyMonitor.cc.

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

Referenced by testSTATracks(), and testTrackerTracks().

{
  return tk.innerPosition().phi() > 0 ? TrackEfficiencyMonitor::Up : TrackEfficiencyMonitor::Down;
}
int TrackEfficiencyMonitor::compatibleLayers ( TrajectoryStateOnSurface  theTSOS)

Definition at line 638 of file TrackEfficiencyMonitor.cc.

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

Referenced by testTrackerTracks().

{  
  //---------------------------------------------------   
  // check the number of compatible layers
  //---------------------------------------------------   
  
  std::vector< BarrelDetLayer*> barrelTOBLayers = measurementTrackerHandle->geometricSearchTracker()->tobLayers() ;
  
  unsigned int layers = 0;
  for ( unsigned int k=0 ; k < barrelTOBLayers.size() ; k++ ) 
  {  
    const DetLayer* firstLay = barrelTOBLayers[barrelTOBLayers.size() -1 - k];  
    
    //Propagator*  theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
    
    
    
    Propagator* theTmpPropagator = &*thePropagator->clone();
    theTmpPropagator->setPropagationDirection(alongMomentum); 
    
    TrajectoryStateOnSurface startTSOS = theTmpPropagator->propagate(*theTSOS.freeState(),firstLay->surface());
    
    std::vector< const DetLayer*> trackCompatibleLayers;
    
    findDetLayer      = true;
    bool isUpMuon     = false;
    bool firstdtep    = true; 
    
    if(startTSOS.isValid())
    {
      
      if(firstdtep) layers++; 
      
      int nwhile = 0;
      
      //for other compatible layers 
      while ( startTSOS.isValid() &&  firstLay && findDetLayer)
      {
        
        if(firstdtep && startTSOS.globalPosition().y()> 0) isUpMuon = true;
        
        if(firstdtep){
          std::vector< const DetLayer*> firstCompatibleLayers;
          firstCompatibleLayers.push_back(firstLay);
          std::pair<TrajectoryStateOnSurface, const  DetLayer* > nextLayer = findNextLayer(theTSOS, firstCompatibleLayers, isUpMuon );
          firstdtep = false;
        }
        else{
          trackCompatibleLayers =  firstLay->nextLayers(*(startTSOS.freeState()),alongMomentum);
          if (trackCompatibleLayers.size()!=0 ){ 
            std::pair<TrajectoryStateOnSurface, const  DetLayer* > nextLayer = findNextLayer(startTSOS, trackCompatibleLayers, isUpMuon );
            if (firstLay != nextLayer.second ){
              firstLay  = nextLayer.second;
              startTSOS = nextLayer.first;
              layers++;         
            }
            else firstLay=0;
          }
        }
        nwhile++;
        if(nwhile > 100) break;
                
      }
      delete theTmpPropagator;
      break;
    }
    delete theTmpPropagator;
  }
  return layers;
  
}
void TrackEfficiencyMonitor::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 332 of file TrackEfficiencyMonitor.cc.

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

{ 
  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
  std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
  if(outputMEsInRootFile){
    dqmStore_->showDirStructure(); 
    dqmStore_->save(outputFileName); 
    }

  //if ( theNavigation ) delete theNavigation; 

}
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(), Propagator::propagate(), Propagator::setPropagationDirection(), and thePropagator.

Referenced by compatibleLayers().

{
  
  //Propagator*  theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
  
  
  Propagator* theTmpPropagator = &*thePropagator->clone();
  theTmpPropagator->setPropagationDirection(alongMomentum); 
  
  
  std::vector<const DetLayer*>::iterator itl;
  findDetLayer = false;
  for (itl=trackCompatibleLayers.begin();itl!=trackCompatibleLayers.end();++itl) {
    TrajectoryStateOnSurface tsos = theTmpPropagator->propagate(*(sTSOS.freeState()),(**itl).surface());
    if (tsos.isValid()) 
    {
      sTSOS = tsos;
      findDetLayer = true; 
      
      break;
    }
  }
  std::pair<TrajectoryStateOnSurface,  const DetLayer* >  blabla;
  blabla.first = sTSOS;
  blabla.second = &**itl;
  delete theTmpPropagator;
  return blabla;
}
void TrackEfficiencyMonitor::testSTATracks ( edm::Handle< TrackCollection tkTracks,
edm::Handle< TrackCollection staTracks 
)

Definition at line 489 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().

{

   
   reco::TransientTrack tkTT = theTTrackBuilder->build(tkTracks->front());
   double ipX   = tkTT.impactPointState().globalPosition().x();
   double ipY   = tkTT.impactPointState().globalPosition().y();
   double ipZ   = tkTT.impactPointState().globalPosition().z();
   double eta   = tkTT.impactPointState().globalDirection().eta();
   double phi   = tkTT.impactPointState().globalDirection().phi();
   double d0    = (*tkTracks)[0].d0();

   TrajectoryStateOnSurface tkInner = tkTT.innermostMeasurementState();
   LocalVector diffLocal;   
   TrajectoryStateOnSurface staState;      
   bool isTrack = false;
   
   
   if(!staTracks->empty()){     
        
       //---------------------------------------------------   
       //look for associated muons
       //---------------------------------------------------   
       
    float DR2min = 1000;
    reco::TrackCollection::const_iterator closestTrk = staTracks->end();
       //----------------------loop on tracker tracks:
    for(reco::TrackCollection::const_iterator staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
      if(checkSemiCylinder(*staTrack) == TrackEfficiencyMonitor::Up){
      
        reco::TransientTrack staTT = theTTrackBuilder->build(*staTrack); 
        failedToPropagate = 1;  
        staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());       

       
          if(staState.isValid())
          {
            failedToPropagate = 0;
            diffLocal = tkInner.localPosition() - staState.localPosition();
               
            double DR2 = diffLocal.x()*diffLocal.x()+diffLocal.y()*diffLocal.y();
            if (DR2<DR2min) { DR2min = DR2; closestTrk = staTrack;}
            if ( pow(DR2,0.5) < 100. ) isTrack = true;
           }
          }     
      }
    }
   
   if(failedToPropagate == 0)
      {         
         
         trackX->Fill(ipX);
         trackY->Fill(ipY);
         trackZ->Fill(ipZ);
         trackEta->Fill(eta);
         trackPhi->Fill(phi);
         trackD0->Fill(d0);

         if(isTrack)
         { 
            muonX->Fill(ipX);
            muonY->Fill(ipY);
            muonZ->Fill(ipZ);
            muonEta->Fill(eta);
            muonPhi->Fill(phi);
            muonD0->Fill(d0);
          }     
        }



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

Definition at line 349 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(), metname, 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().

{
  
  const std::string metname = "testStandAloneMuonTracks";

  //---------------------------------------------------
  // get the index of the "up" muon
  // histograms will only be computed for the "up" muon
  //---------------------------------------------------
 
  int nUpMuon = 0;
  int idxUpMuon = -1;
  for(unsigned int i =0; i< staTracks->size(); i++){
     if( checkSemiCylinder((*staTracks)[i]) == TrackEfficiencyMonitor::Up ){
        nUpMuon++;
        idxUpMuon = i;
     }
  }
    
   
  if( nUpMuon == 1)
  {
    
    //---------------------------------------------------
    //get the muon informations
    //---------------------------------------------------
    
    reco::TransientTrack staTT = theTTrackBuilder->build((*staTracks)[idxUpMuon]);
    double ipX   = staTT.impactPointState().globalPosition().x();
    double ipY   = staTT.impactPointState().globalPosition().y();
    double ipZ   = staTT.impactPointState().globalPosition().z();
    double eta   = staTT.impactPointState().globalDirection().eta();
    double phi   = staTT.impactPointState().globalDirection().phi();
    double d0    = (*staTracks)[idxUpMuon].d0();
    
    TrajectoryStateOnSurface theTSOS = staTT.outermostMeasurementState(); 
    TrajectoryStateOnSurface theTSOSCompLayers = staTT.outermostMeasurementState(); 
    
    
    //---------------------------------------------------
    //check if the muon is in the tracker acceptance
    //---------------------------------------------------    
    bool isInTrackerAcceptance = false;   
    isInTrackerAcceptance = trackerAcceptance( theTSOS, theRadius_ , theMaxZ_ );
    
    //---------------------------------------------------st
    //count the number of compatible layers
    //---------------------------------------------------       
    nCompatibleLayers = compatibleLayers(theTSOSCompLayers);
    
    if(isInTrackerAcceptance && (*staTracks)[idxUpMuon].hitPattern().numberOfValidHits() > 28)
    {
      //---------------------------------------------------
      //count the number of good muon candidates
      //---------------------------------------------------   
        
      TrajectoryStateOnSurface staState;      
      LocalVector diffLocal;   
     
         
      bool isTrack = false;
      if(!tkTracks->empty())
      {
       //---------------------------------------------------   
       //look for associated tracks
       //---------------------------------------------------   
        float DR2min = 1000;
        reco::TrackCollection::const_iterator closestTrk = tkTracks->end();

       for(reco::TrackCollection::const_iterator tkTrack = tkTracks->begin(); tkTrack != tkTracks->end(); ++tkTrack)
       {
          reco::TransientTrack tkTT = theTTrackBuilder->build(*tkTrack);
          TrajectoryStateOnSurface tkInner = tkTT.innermostMeasurementState();
          staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());      
          failedToPropagate = 1;
            
          if(staState.isValid())
          {
            failedToPropagate = 0;
            diffLocal = tkInner.localPosition() - staState.localPosition();
            double DR2 = diffLocal.x()*diffLocal.x()+diffLocal.y()*diffLocal.y();
            if (DR2<DR2min) { DR2min = DR2; closestTrk = tkTrack;}
            if ( pow(DR2,0.5) < 100. ) isTrack = true;
            }
          }
         
          
          if (DR2min != 1000) 
          { 
            
            reco::TransientTrack tkTT = theTTrackBuilder->build(*closestTrk);
            TrajectoryStateOnSurface tkInner = tkTT.innermostMeasurementState();
            staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());
            deltaX->Fill(diffLocal.x());
            deltaY->Fill(diffLocal.y());
            signDeltaX->Fill(diffLocal.x()/(tkInner.localError().positionError().xx() + staState.localError().positionError().xx()));
            signDeltaY->Fill(diffLocal.y()/(tkInner.localError().positionError().yy() + staState.localError().positionError().yy()));
                   
           } 
        }
      
      
      if(failedToPropagate == 0)
      {       
         muonX->Fill(ipX);
         muonY->Fill(ipY);
         muonZ->Fill(ipZ);
         muonEta->Fill(eta);
         muonPhi->Fill(phi);
         muonD0->Fill(d0);
         muonCompatibleLayers->Fill(nCompatibleLayers);

         if(isTrack)
         { 
            trackX->Fill(ipX);
            trackY->Fill(ipY);
            trackZ->Fill(ipZ);
            trackEta->Fill(eta);
            trackPhi->Fill(phi);
            trackD0->Fill(d0);
            trackCompatibleLayers->Fill(nCompatibleLayers);
          }     
        }
     }
   }
    
}
bool TrackEfficiencyMonitor::trackerAcceptance ( TrajectoryStateOnSurface  theTSOS,
double  theRadius,
double  theMaxZ 
)

Definition at line 589 of file TrackEfficiencyMonitor.cc.

References accept(), alongMomentum, newFWLiteAna::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().

{

  //---------------------------------------------------  
  // check if the muon is in the tracker acceptance    
  // check the compatibility with a cylinder of radius "theRadius"
  //---------------------------------------------------   
      
  //Propagator*  theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
  
  //Propagator*  theTmpPropagator = &*thePropagator;
  Propagator* theTmpPropagator = &*thePropagator->clone();
  
  if (theTSOS.globalPosition().y() <0 ) theTmpPropagator->setPropagationDirection(oppositeToMomentum);
  else                                  theTmpPropagator->setPropagationDirection(alongMomentum);
  
  Cylinder::PositionType pos0;
  Cylinder::RotationType rot0;
  const Cylinder::CylinderPointer cyl = Cylinder::build(pos0, rot0, theRadius);
  TrajectoryStateOnSurface tsosAtCyl  = theTmpPropagator->propagate(*theTSOS.freeState(), *cyl);  
  double accept = false;
  if ( tsosAtCyl.isValid() ) {
    if (fabs(tsosAtCyl.globalPosition().z())<theMaxZ ) {
      Cylinder::PositionType pos02;
      Cylinder::RotationType rot02;
      const Cylinder::CylinderPointer cyl2 = Cylinder::build(pos02, rot02, theRadius -10);
      TrajectoryStateOnSurface tsosAtCyl2 = theTmpPropagator->propagate(*tsosAtCyl.freeState(), *cyl2);
      if ( tsosAtCyl2.isValid() ) {
        Cylinder::PositionType pos03;
        Cylinder::RotationType rot03;
        const Cylinder::CylinderPointer cyl3 = Cylinder::build(pos03, rot03, theRadius );
        TrajectoryStateOnSurface tsosAtCyl3 = theTmpPropagator->propagate(*tsosAtCyl2.freeState(), *cyl3);
        if ( tsosAtCyl3.isValid() ) {
          accept=true;
        }
      }
      
    }
  }
  delete theTmpPropagator;
  //muon propagated to the barrel cylinder
  return accept;

}

Member Data Documentation

Definition at line 112 of file TrackEfficiencyMonitor.h.

Referenced by analyze().

Definition at line 68 of file TrackEfficiencyMonitor.h.

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

Definition at line 99 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

Definition at line 100 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

Definition at line 67 of file TrackEfficiencyMonitor.h.

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

Definition at line 79 of file TrackEfficiencyMonitor.h.

Referenced by testSTATracks(), and testTrackerTracks().

Definition at line 81 of file TrackEfficiencyMonitor.h.

Referenced by compatibleLayers(), and findNextLayer().

std::string TrackEfficiencyMonitor::histname [private]

Definition at line 65 of file TrackEfficiencyMonitor.h.

Referenced by beginJob().

Definition at line 72 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

Definition at line 114 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and compatibleLayers().

Definition at line 89 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

Definition at line 88 of file TrackEfficiencyMonitor.h.

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

Definition at line 86 of file TrackEfficiencyMonitor.h.

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

Definition at line 87 of file TrackEfficiencyMonitor.h.

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

Definition at line 83 of file TrackEfficiencyMonitor.h.

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

Definition at line 84 of file TrackEfficiencyMonitor.h.

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

Definition at line 85 of file TrackEfficiencyMonitor.h.

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

Definition at line 80 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and testTrackerTracks().

Definition at line 101 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

Definition at line 102 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

Definition at line 107 of file TrackEfficiencyMonitor.h.

Definition at line 71 of file TrackEfficiencyMonitor.h.

Referenced by testTrackerTracks(), and TrackEfficiencyMonitor().

Definition at line 105 of file TrackEfficiencyMonitor.h.

Definition at line 104 of file TrackEfficiencyMonitor.h.

Referenced by analyze().

Definition at line 109 of file TrackEfficiencyMonitor.h.

Definition at line 70 of file TrackEfficiencyMonitor.h.

Referenced by testTrackerTracks(), and TrackEfficiencyMonitor().

Definition at line 77 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

Definition at line 76 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

Definition at line 111 of file TrackEfficiencyMonitor.h.

Referenced by analyze().

Definition at line 110 of file TrackEfficiencyMonitor.h.

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

Definition at line 97 of file TrackEfficiencyMonitor.h.

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

Definition at line 96 of file TrackEfficiencyMonitor.h.

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

Definition at line 73 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

Definition at line 94 of file TrackEfficiencyMonitor.h.

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

Definition at line 95 of file TrackEfficiencyMonitor.h.

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

Definition at line 91 of file TrackEfficiencyMonitor.h.

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

Definition at line 92 of file TrackEfficiencyMonitor.h.

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

Definition at line 93 of file TrackEfficiencyMonitor.h.

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