Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DQMOffline_Muon_MuonRecoAnalyzer_h
0002 #define DQMOffline_Muon_MuonRecoAnalyzer_h
0003 /** \class MuRecoAnalyzer
0004  *
0005  *  DQM monitoring source for muon reco track
0006  *
0007  *  \author G. Mila - INFN Torino
0008  */
0009 
0010 #include <memory>
0011 #include <fstream>
0012 #include "FWCore/Framework/interface/Frameworkfwd.h"
0013 #include "FWCore/Utilities/interface/InputTag.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/Framework/interface/MakerMacros.h"
0017 #include "FWCore/ServiceRegistry/interface/Service.h"
0018 
0019 #include "DQMServices/Core/interface/DQMStore.h"
0020 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0021 
0022 #include "DataFormats/MuonReco/interface/Muon.h"
0023 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0024 #include "DataFormats/VertexReco/interface/Vertex.h"
0025 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0026 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0027 #include "DataFormats/Scalers/interface/DcsStatus.h"
0028 
0029 class MuonRecoAnalyzer : public DQMEDAnalyzer {
0030 public:
0031   /// Constructor
0032   MuonRecoAnalyzer(const edm::ParameterSet&);
0033 
0034   /// Destructor
0035   ~MuonRecoAnalyzer() override;
0036 
0037   /// Inizialize parameters for histo binning
0038   void analyze(const edm::Event&, const edm::EventSetup&) override;
0039   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0040 
0041   //calculate residual & pull:
0042   void GetRes(reco::TrackRef t1, reco::TrackRef t2, std::string par, float& res, float& pull);
0043 
0044   //Functions needed by the SoftMuon MVA monitoring
0045   double getDeltaR(reco::Track track1, reco::Track track2);
0046 
0047   int getPv(int tidx, const reco::VertexCollection* vc);
0048 
0049 private:
0050   // ----------member data ---------------------------
0051   edm::ParameterSet parameters;
0052 
0053   edm::EDGetTokenT<edm::View<reco::Muon> > theMuonCollectionLabel_;
0054   edm::EDGetTokenT<reco::VertexCollection> theVertexLabel_;
0055   edm::EDGetTokenT<reco::BeamSpot> theBeamSpotLabel_;
0056   edm::EDGetTokenT<DcsStatusCollection> dcsStatusCollection_;
0057 
0058   // Switch for verbosity
0059   std::string metname;
0060   bool doMVA;
0061   bool useGEM;
0062   int maxGEMhitsSoftMuonMVA;
0063 
0064   //histo binning parameters
0065   int etaBin;
0066   double etaMin;
0067   double etaMax;
0068 
0069   int thetaBin;
0070   double thetaMin;
0071   double thetaMax;
0072 
0073   int phiBin;
0074   double phiMin;
0075   double phiMax;
0076 
0077   int chi2Bin;
0078   double chi2Min;
0079   double chi2Max;
0080 
0081   int pBin;
0082   double pMin;
0083   double pMax;
0084 
0085   int ptBin;
0086   double ptMin;
0087   double ptMax;
0088 
0089   int pResBin;
0090   double pResMin;
0091   double pResMax;
0092 
0093   int rhBin;
0094   double rhMin;
0095   double rhMax;
0096 
0097   int tunePBin;
0098   double tunePMin;
0099   double tunePMax;
0100 
0101   //the histos
0102   MonitorElement* muReco;
0103   // global muon
0104   std::vector<MonitorElement*> etaGlbTrack;
0105   std::vector<MonitorElement*> etaResolution;
0106   std::vector<MonitorElement*> thetaGlbTrack;
0107   std::vector<MonitorElement*> thetaResolution;
0108   std::vector<MonitorElement*> phiGlbTrack;
0109   std::vector<MonitorElement*> phiResolution;
0110   std::vector<MonitorElement*> chi2OvDFGlbTrack;
0111   std::vector<MonitorElement*> probchi2GlbTrack;
0112   std::vector<MonitorElement*> pGlbTrack;
0113   std::vector<MonitorElement*> ptGlbTrack;
0114   std::vector<MonitorElement*> qGlbTrack;
0115   std::vector<MonitorElement*> qOverpResolution;
0116   std::vector<MonitorElement*> qOverptResolution;
0117   std::vector<MonitorElement*> oneOverpResolution;
0118   std::vector<MonitorElement*> oneOverptResolution;
0119   std::vector<MonitorElement*> rhAnalysis;
0120   std::vector<MonitorElement*> muVStkSytemRotation;
0121   std::vector<MonitorElement*> phiVsetaGlbTrack;
0122   std::vector<MonitorElement*> phiVsetaGlbTrack_badlumi;
0123 
0124   //Soft MVA Muon
0125   MonitorElement* ptSoftMuonMVA;
0126   MonitorElement* deltaRSoftMuonMVA;
0127   MonitorElement* gNchi2SoftMuonMVA;
0128   MonitorElement* vMuHitsSoftMuonMVA;
0129   MonitorElement* mNuStationsSoftMuonMVA;
0130   MonitorElement* dxyRefSoftMuonMVA;
0131   MonitorElement* dzRefSoftMuonMVA;
0132   MonitorElement* LWHSoftMuonMVA;
0133   MonitorElement* valPixHitsSoftMuonMVA;
0134   MonitorElement* innerChi2SoftMuonMVA;
0135   MonitorElement* outerChi2SoftMuonMVA;
0136   MonitorElement* iValFracSoftMuonMVA;
0137   MonitorElement* segCompSoftMuonMVA;
0138   MonitorElement* chi2LocMomSoftMuonMVA;
0139   MonitorElement* chi2LocPosSoftMuonMVA;
0140   MonitorElement* glbTrackTailProbSoftMuonMVA;
0141   MonitorElement* NTrkVHitsSoftMuonMVA;
0142   MonitorElement* kinkFinderSoftMuonMVA;
0143   MonitorElement* vRPChitsSoftMuonMVA;
0144   MonitorElement* glbKinkFinderSoftMuonMVA;
0145   MonitorElement* glbKinkFinderLogSoftMuonMVA;
0146   MonitorElement* staRelChi2SoftMuonMVA;
0147   MonitorElement* glbDeltaEtaPhiSoftMuonMVA;
0148   MonitorElement* trkRelChi2SoftMuonMVA;
0149   MonitorElement* vDThitsSoftMuonMVA;
0150   MonitorElement* vCSChitsSoftMuonMVA;
0151   MonitorElement* vGEMhitsSoftMuonMVA;
0152   MonitorElement* timeAtIpInOutSoftMuonMVA;
0153   MonitorElement* timeAtIpInOutErrSoftMuonMVA;
0154   MonitorElement* getMuonHitsPerStationSoftMuonMVA;
0155   MonitorElement* QprodSoftMuonMVA;
0156 
0157   MonitorElement* tunePResolution;
0158 
0159   MonitorElement* etaPull;
0160   MonitorElement* thetaPull;
0161   MonitorElement* phiPull;
0162   MonitorElement* qOverpPull;
0163   MonitorElement* qOverptPull;
0164   MonitorElement* oneOverpPull;
0165   MonitorElement* oneOverptPull;
0166 
0167   // tracker muon
0168   MonitorElement* etaTrack;
0169   MonitorElement* thetaTrack;
0170   MonitorElement* phiTrack;
0171   MonitorElement* chi2OvDFTrack;
0172   MonitorElement* probchi2Track;
0173   MonitorElement* pTrack;
0174   MonitorElement* ptTrack;
0175   MonitorElement* qTrack;
0176   // sta muon
0177   MonitorElement* etaStaTrack;
0178   MonitorElement* thetaStaTrack;
0179   MonitorElement* phiStaTrack;
0180   MonitorElement* chi2OvDFStaTrack;
0181   MonitorElement* probchi2StaTrack;
0182   MonitorElement* pStaTrack;
0183   MonitorElement* ptStaTrack;
0184   MonitorElement* qStaTrack;
0185   // efficiency
0186   std::vector<MonitorElement*> etaEfficiency;
0187   std::vector<MonitorElement*> phiEfficiency;
0188 
0189   bool IsminiAOD;
0190   std::string theFolder;
0191 };
0192 #endif  // DQMOffline_Muon_MuonRecoAnalyzer_h