Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:05

0001 #ifndef TrackEfficiencyMonitor_H
0002 #define TrackEfficiencyMonitor_H
0003 // -*- C++ -*-
0004 //
0005 // Package:    TrackEfficiencyMonitor
0006 // Class:      TrackEfficiencyMonitor
0007 //
0008 /**\class TrackEfficiencyMonitor TrackEfficiencyMonitor.cc DQM/TrackerMonitorTrack/src/TrackEfficiencyMonitor.cc
0009 Monitoring source to measure the track efficiency
0010 */
0011 //  Original Author:  Jeremy Andrea
0012 // Insertion in DQM:  Anne-Catherine Le Bihan
0013 //          Created:  Thu 28 22:45:30 CEST 2008
0014 
0015 // system includes
0016 #include <memory>
0017 #include <fstream>
0018 
0019 // user includes
0020 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0021 #include "DQMServices/Core/interface/DQMStore.h"
0022 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0023 #include "DataFormats/MuonReco/interface/MuonSelectors.h"
0024 #include "FWCore/Framework/interface/Event.h"
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026 #include "FWCore/Framework/interface/MakerMacros.h"
0027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0028 #include "FWCore/ServiceRegistry/interface/Service.h"
0029 #include "FWCore/Utilities/interface/EDGetToken.h"
0030 #include "RecoMuon/GlobalTrackingTools/interface/DirectTrackerNavigation.h"
0031 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
0032 #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h"
0033 #include "RecoTracker/Record/interface/CkfComponentsRecord.h"
0034 #include "RecoTracker/Record/interface/NavigationSchoolRecord.h"
0035 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
0036 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
0037 
0038 namespace reco {
0039   class TransientTrack;
0040 }
0041 class NavigationSchool;
0042 
0043 class TrackEfficiencyMonitor : public DQMEDAnalyzer {
0044 public:
0045   typedef reco::Track Track;
0046   typedef reco::TrackCollection TrackCollection;
0047   explicit TrackEfficiencyMonitor(const edm::ParameterSet&);
0048   ~TrackEfficiencyMonitor() override;
0049   void analyze(const edm::Event&, const edm::EventSetup&) override;
0050 
0051   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0052 
0053   enum SemiCylinder { Up, Down };
0054   std::pair<TrajectoryStateOnSurface, const DetLayer*> findNextLayer(
0055       TrajectoryStateOnSurface startTSOS, const std::vector<const DetLayer*>& trackCompatibleLayers, bool isUpMuon);
0056   SemiCylinder checkSemiCylinder(const Track&);
0057   void testTrackerTracks(edm::Handle<TrackCollection> tkTracks,
0058                          edm::Handle<TrackCollection> staTracks,
0059                          const NavigationSchool& navigationSchool);
0060   void testSTATracks(edm::Handle<TrackCollection> tkTracks, edm::Handle<TrackCollection> staTracks);
0061   bool trackerAcceptance(TrajectoryStateOnSurface theTSOS, double theRadius, double theMaxZ);
0062   int compatibleLayers(const NavigationSchool& navigationSchool, TrajectoryStateOnSurface theTSOS);
0063 
0064 private:
0065   // ----------member data ---------------------------
0066 
0067   std::string histname;  //for naming the histograms
0068 
0069   DQMStore* dqmStore_;
0070   edm::ParameterSet conf_;
0071 
0072   double theRadius_;
0073   double theMaxZ_;
0074   bool isBFieldOff_;
0075   bool trackEfficiency_;  //1 if one wants to measure the tracking efficiency
0076                           //0 if one wants to measure the muon reco efficiency
0077 
0078   edm::InputTag theTKTracksLabel_;
0079   edm::InputTag theSTATracksLabel_;
0080   edm::EDGetTokenT<reco::TrackCollection> theTKTracksToken_;
0081   edm::EDGetTokenT<reco::TrackCollection> theSTATracksToken_;
0082 
0083   int failedToPropagate;
0084   int nCompatibleLayers;
0085   bool findDetLayer;
0086 
0087   MonitorElement* muonX;
0088   MonitorElement* muonY;
0089   MonitorElement* muonZ;
0090   MonitorElement* muonEta;
0091   MonitorElement* muonPhi;
0092   MonitorElement* muonD0;
0093   MonitorElement* muonCompatibleLayers;
0094 
0095   MonitorElement* trackX;
0096   MonitorElement* trackY;
0097   MonitorElement* trackZ;
0098   MonitorElement* trackEta;
0099   MonitorElement* trackPhi;
0100   MonitorElement* trackD0;
0101   MonitorElement* trackCompatibleLayers;
0102 
0103   MonitorElement* deltaX;
0104   MonitorElement* deltaY;
0105   MonitorElement* signDeltaX;
0106   MonitorElement* signDeltaY;
0107   MonitorElement* GlobalMuonPtEtaPhiLowPt;
0108   MonitorElement* StandaloneMuonPtEtaPhiLowPt;
0109   MonitorElement* GlobalMuonPtEtaPhiHighPt;
0110   MonitorElement* StandaloneMuonPtEtaPhiHighPt;
0111   const DirectTrackerNavigation* theNavigation;
0112   MuonServiceProxy* theMuonServiceProxy;
0113 
0114   const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> ttbToken_;
0115   const edm::ESGetToken<Propagator, TrackingComponentsRecord> propToken_;
0116   const edm::ESGetToken<NavigationSchool, NavigationSchoolRecord> navToken_;
0117   const edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> gstToken_;
0118   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> mfToken_;
0119   const edm::ESGetToken<MeasurementTracker, CkfComponentsRecord> mtToken_;
0120 
0121   edm::EDGetTokenT<edm::View<reco::Muon> > muonToken_;
0122 
0123   const Propagator* thePropagator;
0124   const TransientTrackBuilder* theTTrackBuilder;
0125   const GeometricSearchTracker* theTracker;
0126   const MagneticField* bField;
0127   const MeasurementTracker* measurementTracker;
0128 };
0129 #endif