Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:02

0001 #ifndef B2GDQM_H
0002 #define B2GDQM_H
0003 
0004 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 #include "FWCore/Framework/interface/LuminosityBlock.h"
0008 #include "FWCore/Framework/interface/Run.h"
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/Framework/interface/EventSetup.h"
0011 #include "FWCore/Utilities/interface/InputTag.h"
0012 #include "DataFormats/Candidate/interface/Candidate.h"
0013 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0014 
0015 // Trigger stuff
0016 #include "DataFormats/Common/interface/TriggerResults.h"
0017 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0018 
0019 #include "DataFormats/Common/interface/Handle.h"
0020 #include "FWCore/Framework/interface/DataKeyTags.h"
0021 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0022 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0023 #include "DataFormats/MuonReco/interface/Muon.h"
0024 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0025 #include <DataFormats/EgammaCandidates/interface/GsfElectron.h>
0026 
0027 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0028 #include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h"
0029 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0030 #include "DataFormats/VertexReco/interface/Vertex.h"
0031 
0032 #include "DQMServices/Core/interface/DQMStore.h"
0033 
0034 // ParticleFlow
0035 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0036 
0037 // EGamma
0038 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0039 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0040 #include "DataFormats/EgammaCandidates/interface/Electron.h"
0041 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
0042 
0043 // Muon
0044 #include "DataFormats/MuonReco/interface/Muon.h"
0045 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0046 #include "DataFormats/MuonReco/interface/MuonSelectors.h"
0047 #include "DataFormats/MuonReco/interface/MuonIsolation.h"
0048 
0049 // Jets
0050 #include "DataFormats/JetReco/interface/PFJetCollection.h"
0051 #include "DataFormats/JetReco/interface/BasicJetCollection.h"
0052 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
0053 
0054 // MET
0055 #include "DataFormats/METReco/interface/CaloMETCollection.h"
0056 #include "DataFormats/METReco/interface/PFMETCollection.h"
0057 #include "DataFormats/METReco/interface/GenMETCollection.h"
0058 #include "DataFormats/METReco/interface/CaloMET.h"
0059 #include "DataFormats/METReco/interface/PFMET.h"
0060 #include "DataFormats/METReco/interface/MET.h"
0061 #include "DataFormats/METReco/interface/METCollection.h"
0062 
0063 //
0064 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0065 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
0066 
0067 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0068 
0069 #include "DataFormats/Math/interface/deltaPhi.h"
0070 
0071 #include <iostream>
0072 #include <fstream>
0073 #include <string>
0074 #include <vector>
0075 #include <map>
0076 #include <cmath>
0077 
0078 class B2GDQM : public DQMEDAnalyzer {
0079 public:
0080   B2GDQM(const edm::ParameterSet& ps);
0081   ~B2GDQM() override;
0082 
0083 protected:
0084   void analyze(edm::Event const& e, edm::EventSetup const& eSetup) override;
0085 
0086   virtual void analyzeJets(edm::Event const& e, edm::EventSetup const& eSetup);
0087   virtual void analyzeSemiMu(edm::Event const& e, edm::EventSetup const& eSetup);
0088   virtual void analyzeSemiE(edm::Event const& e, edm::EventSetup const& eSetup);
0089   virtual void analyzeAllHad(edm::Event const& e, edm::EventSetup const& eSetup);
0090 
0091 private:
0092   void bookHistograms(DQMStore::IBooker& bei, edm::Run const&, edm::EventSetup const&) override;
0093   int nLumiSecs_;
0094   int nEvents_, irun, ievt;
0095 
0096   HLTConfigProvider hltConfigProvider_;
0097   bool isValidHltConfig_;
0098 
0099   // Variables from config file
0100   edm::InputTag theTriggerResultsCollection;
0101   edm::EDGetTokenT<edm::TriggerResults> triggerToken_;
0102 
0103   edm::Handle<edm::TriggerResults> triggerResults_;
0104 
0105   std::vector<edm::InputTag> jetLabels_;
0106   std::vector<edm::EDGetTokenT<edm::View<reco::Jet> > > jetTokens_;
0107   edm::InputTag PFMETLabel_;
0108   edm::EDGetTokenT<std::vector<reco::PFMET> > PFMETToken_;
0109 
0110   // EDIT from 2019 (S. Rappoccio): Change CMS top tagger algorithm from ancient Run 1
0111   // definition to modern soft-drop based tagger.
0112   edm::InputTag sdjetLabel_;
0113   edm::EDGetTokenT<edm::View<reco::BasicJet> > sdjetToken_;
0114 
0115   edm::InputTag muonLabel_;
0116   edm::EDGetTokenT<edm::View<reco::Muon> > muonToken_;
0117 
0118   edm::InputTag electronLabel_;
0119   edm::EDGetTokenT<edm::View<reco::GsfElectron> > electronToken_;
0120 
0121   ///////////////////////////
0122   // Parameters
0123   ///////////////////////////
0124 
0125   std::vector<double> jetPtMins_;
0126 
0127   double allHadPtCut_;        // pt of both jets
0128   double allHadRapidityCut_;  // rapidity difference |y0-y1| max
0129   double allHadDeltaPhiCut_;  // |phi0 - phi1| min
0130 
0131   double semiMu_HadJetPtCut_;  // min pt of hadronic-side jet
0132   double semiMu_LepJetPtCut_;  // min pt of leptonic-side jet
0133   double semiMu_dphiHadCut_;   // min deltaPhi between muon and hadronic-side jet
0134   double semiMu_dRMin_;        // min deltaR between muon and nearest jet for 2d cut
0135   double semiMu_ptRel_;        // max ptRel between muon and nearest jet for 2d cut
0136   std::shared_ptr<StringCutObjectSelector<reco::Muon> > muonSelect_;  // Selection on all muons
0137 
0138   double semiE_HadJetPtCut_;  // pt of hadronic-side jet
0139   double semiE_LepJetPtCut_;  // min pt of leptonic-side jet
0140   double semiE_dphiHadCut_;   // min deltaPhi between electron and hadronic-side
0141                               // jet
0142   double semiE_dRMin_;        // min deltaR between electron and nearest jet for 2d
0143                               // cut
0144   double semiE_ptRel_;        // max ptRel between electron and nearest jet for 2d cut
0145   std::shared_ptr<StringCutObjectSelector<reco::GsfElectron> > elecSelect_;  // Kinematic selection on all electrons
0146 
0147   std::string PFJetCorService_;
0148   ///////////////////////////
0149   // Histograms
0150   ///////////////////////////
0151   std::vector<MonitorElement*> pfJet_pt;
0152   std::vector<MonitorElement*> pfJet_y;
0153   std::vector<MonitorElement*> pfJet_phi;
0154   std::vector<MonitorElement*> pfJet_m;
0155   std::vector<MonitorElement*> pfJet_chef;
0156   std::vector<MonitorElement*> pfJet_nhef;
0157   std::vector<MonitorElement*> pfJet_cemf;
0158   std::vector<MonitorElement*> pfJet_nemf;
0159   std::vector<MonitorElement*> boostedJet_subjetPt;
0160   std::vector<MonitorElement*> boostedJet_subjetY;
0161   std::vector<MonitorElement*> boostedJet_subjetPhi;
0162   std::vector<MonitorElement*> boostedJet_subjetM;
0163   std::vector<MonitorElement*> boostedJet_subjetN;
0164   std::vector<MonitorElement*> boostedJet_massDrop;
0165   std::vector<MonitorElement*> boostedJet_wMass;
0166   MonitorElement* pfMet_pt;
0167   MonitorElement* pfMet_phi;
0168 
0169   MonitorElement* semiMu_muPt;
0170   MonitorElement* semiMu_muEta;
0171   MonitorElement* semiMu_muPhi;
0172   MonitorElement* semiMu_muDRMin;
0173   MonitorElement* semiMu_muPtRel;
0174   MonitorElement* semiMu_hadJetDR;
0175   MonitorElement* semiMu_hadJetPt;
0176   MonitorElement* semiMu_hadJetY;
0177   MonitorElement* semiMu_hadJetPhi;
0178   MonitorElement* semiMu_hadJetMass;
0179   MonitorElement* semiMu_hadJetWMass;
0180   MonitorElement* semiMu_mttbar;
0181 
0182   MonitorElement* semiE_ePt;
0183   MonitorElement* semiE_eEta;
0184   MonitorElement* semiE_ePhi;
0185   MonitorElement* semiE_eDRMin;
0186   MonitorElement* semiE_ePtRel;
0187   MonitorElement* semiE_hadJetDR;
0188   MonitorElement* semiE_hadJetPt;
0189   MonitorElement* semiE_hadJetY;
0190   MonitorElement* semiE_hadJetPhi;
0191   MonitorElement* semiE_hadJetMass;
0192   MonitorElement* semiE_hadJetWMass;
0193   MonitorElement* semiE_mttbar;
0194 
0195   MonitorElement* allHad_pt0;
0196   MonitorElement* allHad_y0;
0197   MonitorElement* allHad_phi0;
0198   MonitorElement* allHad_mass0;
0199   MonitorElement* allHad_wMass0;
0200   MonitorElement* allHad_pt1;
0201   MonitorElement* allHad_y1;
0202   MonitorElement* allHad_phi1;
0203   MonitorElement* allHad_mass1;
0204   MonitorElement* allHad_wMass1;
0205   MonitorElement* allHad_mttbar;
0206 };
0207 
0208 #endif