Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:10

0001 #ifndef Validation_RecoMuon_MuonTrackAnalyzer_H
0002 #define Validation_RecoMuon_MuonTrackAnalyzer_H
0003 
0004 /** \class MuonTrackAnalyzer
0005  *  Analyzer of the StandAlone muon tracks
0006  *
0007  *  \author R. Bellan - INFN Torino <riccardo.bellan@cern.ch>
0008  */
0009 
0010 // Base Class Headers
0011 #include "FWCore/Utilities/interface/InputTag.h"
0012 
0013 #include "DQMServices/Core/interface/DQMStore.h"
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015 
0016 #include "FWCore/Framework/interface/ESHandle.h"
0017 
0018 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0019 
0020 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0021 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0022 #include "DataFormats/TrackReco/interface/Track.h"
0023 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0024 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0025 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0026 #include <DQMServices/Core/interface/DQMEDAnalyzer.h>
0027 
0028 namespace edm {
0029   class ParameterSet;
0030   class Event;
0031   class EventSetup;
0032 }  // namespace edm
0033 namespace reco {
0034   class TransientTrack;
0035 }
0036 
0037 class TFile;
0038 class TH1F;
0039 class TH2F;
0040 class HTrackVariables;
0041 class HTrack;
0042 
0043 class TrajectoryStateOnSurface;
0044 class FreeTrajectoryState;
0045 class MuonServiceProxy;
0046 class MuonPatternRecoDumper;
0047 class TrajectorySeed;
0048 class MuonUpdatorAtVertex;
0049 
0050 class MuonTrackAnalyzer : public DQMEDAnalyzer {
0051 public:
0052   enum EtaRange { all, barrel, endcap };
0053 
0054 public:
0055   /// Constructor
0056   MuonTrackAnalyzer(const edm::ParameterSet &pset);
0057 
0058   /// Destructor
0059   ~MuonTrackAnalyzer() override;
0060 
0061   // Operations
0062 
0063   void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override;
0064   void tracksAnalysis(const edm::Event &event,
0065                       const edm::EventSetup &eventSetup,
0066                       edm::Handle<edm::SimTrackContainer> simTracks);
0067   void seedsAnalysis(const edm::Event &event,
0068                      const edm::EventSetup &eventSetup,
0069                      edm::Handle<edm::SimTrackContainer> simTracks);
0070 
0071   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0072 
0073 protected:
0074 private:
0075   bool isInTheAcceptance(double eta);
0076   bool checkMuonSimHitPresence(const edm::Event &event, edm::Handle<edm::SimTrackContainer> simTracks);
0077 
0078   std::pair<SimTrack, double> getSimTrack(TrajectoryStateOnSurface &tsos,
0079                                           edm::Handle<edm::SimTrackContainer> simTracks);
0080 
0081   void fillPlots(const edm::Event &event, edm::Handle<edm::SimTrackContainer> &simTracks);
0082   void fillPlots(reco::TransientTrack &track, SimTrack &simTrack);
0083   void fillPlots(TrajectoryStateOnSurface &recoTSOS, SimTrack &simState, HTrack *, MuonPatternRecoDumper &);
0084   void fillPlots(FreeTrajectoryState &recoFTS, SimTrack &simTrack, HTrack *histo, MuonPatternRecoDumper &debug);
0085 
0086   TrajectoryStateOnSurface getSeedTSOS(const TrajectorySeed &seed);
0087 
0088   DQMStore *dbe_;
0089   std::string dirName_;
0090 
0091   std::string out;
0092   std::string subsystemname_;
0093   edm::ParameterSet pset;
0094   //TFile* theFile;
0095 
0096   EtaRange theEtaRange;
0097 
0098   edm::InputTag theSimTracksLabel;
0099   edm::InputTag theSeedsLabel;
0100   edm::InputTag theTracksLabel;
0101   edm::InputTag theCSCSimHitLabel;
0102   edm::InputTag theDTSimHitLabel;
0103   edm::InputTag theRPCSimHitLabel;
0104 
0105   edm::EDGetTokenT<edm::SimTrackContainer> theSimTracksToken;
0106   edm::EDGetTokenT<TrajectorySeedCollection> theSeedsToken;
0107   edm::EDGetTokenT<reco::TrackCollection> theTracksToken;
0108   edm::EDGetTokenT<std::vector<PSimHit> > theCSCSimHitToken;
0109   edm::EDGetTokenT<std::vector<PSimHit> > theDTSimHitToken;
0110   edm::EDGetTokenT<std::vector<PSimHit> > theRPCSimHitToken;
0111 
0112   bool doTracksAnalysis;
0113   bool doSeedsAnalysis;
0114   std::string theSeedPropagatorName;
0115 
0116   MuonServiceProxy *theService;
0117   MuonUpdatorAtVertex *theUpdator;
0118 
0119   // Histograms
0120   MonitorElement *hChi2;
0121   MonitorElement *hChi2Norm;
0122   MonitorElement *hHitsPerTrack;
0123   MonitorElement *hDof;
0124   MonitorElement *hChi2Prob;
0125 
0126   MonitorElement *hNumberOfTracks;
0127   MonitorElement *hNumberOfTracksVsEta;
0128   MonitorElement *hChargeVsEta;
0129   MonitorElement *hChargeVsPt;
0130   MonitorElement *hPtRecVsPtGen;
0131 
0132   MonitorElement *hChi2VsEta;
0133   MonitorElement *hChi2NormVsEta;
0134   MonitorElement *hHitsPerTrackVsEta;
0135   MonitorElement *hDofVsEta;
0136   MonitorElement *hChi2ProbVsEta;
0137   MonitorElement *hDeltaPtVsEta;
0138   MonitorElement *hDeltaPt_In_Out_VsEta;
0139 
0140   HTrackVariables *hSimTracks;
0141 
0142   HTrack *hRecoSeedInner;
0143   HTrack *hRecoSeedPCA;
0144   HTrack *hRecoTracksPCA;
0145   HTrack *hRecoTracksInner;
0146   HTrack *hRecoTracksOuter;
0147 
0148   // Counters
0149   int numberOfSimTracks;
0150   int numberOfRecTracks;
0151 };
0152 #endif