Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:26

0001 #include "DQMOffline/Trigger/plugins/JetDQM.h"
0002 //#include "DataFormats/Math/interface/deltaR.h"
0003 
0004 JetDQM::JetDQM() = default;
0005 
0006 JetDQM::~JetDQM() = default;
0007 
0008 void JetDQM::initialise(const edm::ParameterSet& iConfig) {
0009   jetpt_variable_binning_ =
0010       iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double> >("jetptBinning");
0011   jet1pt_variable_binning_ =
0012       iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double> >("jet1ptBinning");
0013   jet2pt_variable_binning_ =
0014       iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double> >("jet2ptBinning");
0015   mjj_variable_binning_ =
0016       iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double> >("mjjBinning");
0017   jeteta_binning_ =
0018       getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("jetetaPSet"));
0019   detajj_binning_ =
0020       getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("detajjPSet"));
0021   dphijj_binning_ =
0022       getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("dphijjPSet"));
0023   mindphijmet_binning_ = getHistoPSet(
0024       iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("mindphijmetPSet"));
0025   ls_binning_ =
0026       getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("jetlsPSet"));
0027 }
0028 
0029 void JetDQM::bookHistograms(DQMStore::IBooker& ibooker) {
0030   std::string histname, histtitle;
0031 
0032   histname = "jet1pt";
0033   histtitle = "PFJet1 pT";
0034   bookME(ibooker, jet1ptME_, histname, histtitle, jet1pt_variable_binning_);
0035   setMETitle(jet1ptME_, "PFJet1 p_{T} [GeV]", "events / [GeV]");
0036 
0037   histname = "jet2pt";
0038   histtitle = "PFJet2 pT";
0039   bookME(ibooker, jet2ptME_, histname, histtitle, jet2pt_variable_binning_);
0040   setMETitle(jet2ptME_, "PFJet2 p_{T} [GeV]", "events / [GeV]");
0041 
0042   histname = "jet1eta";
0043   histtitle = "PFJet1 eta";
0044   bookME(ibooker, jet1etaME_, histname, histtitle, jeteta_binning_.nbins, jeteta_binning_.xmin, jeteta_binning_.xmax);
0045   setMETitle(jet1etaME_, "PFJet1 #eta", "events / [rad]");
0046 
0047   histname = "jet2eta";
0048   histtitle = "PFJet2 eta";
0049   bookME(ibooker, jet2etaME_, histname, histtitle, jeteta_binning_.nbins, jeteta_binning_.xmin, jeteta_binning_.xmax);
0050   setMETitle(jet2etaME_, "PFJet2 #eta", "events / [rad]");
0051 
0052   histname = "cjetpt";
0053   histtitle = "central PFJet pT";
0054   bookME(ibooker, cjetptME_, histname, histtitle, jetpt_variable_binning_);
0055   setMETitle(cjetptME_, "central PFJet p_{T} [GeV]", "events / [GeV]");
0056 
0057   histname = "fjetpt";
0058   histtitle = "forward PFJet pT";
0059   bookME(ibooker, fjetptME_, histname, histtitle, jetpt_variable_binning_);
0060   setMETitle(fjetptME_, "forward PFJet p_{T} [GeV]", "events / [GeV]");
0061 
0062   histname = "cjeteta";
0063   histtitle = "central PFJet eta";
0064   bookME(ibooker, cjetetaME_, histname, histtitle, jeteta_binning_.nbins, jeteta_binning_.xmin, jeteta_binning_.xmax);
0065   setMETitle(cjetetaME_, "central PFJet #eta", "events / [rad]");
0066 
0067   histname = "fjeteta";
0068   histtitle = "forward PFJet eta";
0069   bookME(ibooker, fjetetaME_, histname, histtitle, jeteta_binning_.nbins, jeteta_binning_.xmin, jeteta_binning_.xmax);
0070   setMETitle(fjetetaME_, "forward PFJet #eta", "events / [rad]");
0071 
0072   histname = "mjj";
0073   histtitle = "PFDiJet M";
0074   bookME(ibooker, mjjME_, histname, histtitle, mjj_variable_binning_);
0075   setMETitle(mjjME_, "PFDiJet M [GeV]", "events / [GeV]");
0076 
0077   histname = "detajj";
0078   histtitle = "PFDiJet DeltaEta";
0079   bookME(ibooker, detajjME_, histname, histtitle, detajj_binning_.nbins, detajj_binning_.xmin, detajj_binning_.xmax);
0080   setMETitle(detajjME_, "PFDiJet #Delta#eta", "events / [rad]");
0081 
0082   histname = "dphijj";
0083   histtitle = "PFDiJet DeltaPhi";
0084   bookME(ibooker, dphijjME_, histname, histtitle, dphijj_binning_.nbins, dphijj_binning_.xmin, dphijj_binning_.xmax);
0085   setMETitle(dphijjME_, "PFDiJet #Delta#phi", "events / [rad]");
0086 
0087   histname = "mindphijmet";
0088   histtitle = "minDeltaPhi(PFJets,MET)";
0089   bookME(ibooker,
0090          mindphijmetME_,
0091          histname,
0092          histtitle,
0093          mindphijmet_binning_.nbins,
0094          mindphijmet_binning_.xmin,
0095          mindphijmet_binning_.xmax);
0096   setMETitle(mindphijmetME_, "min#Delta#phi(jets,MET)", "events / [rad]");
0097 
0098   histname = "jet1etaVsLS";
0099   histtitle = "PFJet1 eta vs LS";
0100   bookME(ibooker,
0101          jet1etaVsLS_,
0102          histname,
0103          histtitle,
0104          ls_binning_.nbins,
0105          ls_binning_.xmin,
0106          ls_binning_.xmax,
0107          jeteta_binning_.xmin,
0108          jeteta_binning_.xmax);
0109   setMETitle(jet1etaVsLS_, "LS", "PF Jet1 #eta");
0110 
0111   histname = "mjjVsLS";
0112   histtitle = "PFDiJet M vs LS";
0113   bookME(ibooker, mjjVsLS_, histname, histtitle, ls_binning_.nbins, ls_binning_.xmin, ls_binning_.xmax, 0, 14000);
0114   setMETitle(mjjVsLS_, "LS", "PFDiJet M [GeV]");
0115 
0116   histname = "mindphijmetVsLS";
0117   histtitle = "minDeltaPhi(PFJets,MET) vs LS";
0118   bookME(ibooker,
0119          mindphijmetVsLS_,
0120          histname,
0121          histtitle,
0122          ls_binning_.nbins,
0123          ls_binning_.xmin,
0124          ls_binning_.xmax,
0125          mindphijmet_binning_.xmin,
0126          mindphijmet_binning_.xmax);
0127   setMETitle(mindphijmetVsLS_, "LS", "min#Delta#phi(jets,MET)");
0128 }
0129 
0130 void JetDQM::fillHistograms(const std::vector<reco::PFJet>& jets,
0131                             const reco::PFMET& pfmet,
0132                             const int ls,
0133                             const bool passCond) {
0134   // filling histograms (denominator)
0135   if (!jets.empty()) {
0136     double eta1 = jets[0].eta();
0137     jet1ptME_.denominator->Fill(jets[0].pt());
0138     jet1etaME_.denominator->Fill(eta1);
0139     jet1etaVsLS_.denominator->Fill(ls, eta1);
0140     if (jets.size() > 1) {
0141       double eta2 = jets[1].eta();
0142       jet2ptME_.denominator->Fill(jets[1].pt());
0143       jet2etaME_.denominator->Fill(eta2);
0144       if (fabs(eta1) < fabs(eta2)) {
0145         cjetetaME_.denominator->Fill(eta1);
0146         fjetetaME_.denominator->Fill(eta2);
0147         cjetptME_.denominator->Fill(jets[0].pt());
0148         fjetptME_.denominator->Fill(jets[1].pt());
0149       } else {
0150         cjetetaME_.denominator->Fill(eta2);
0151         fjetetaME_.denominator->Fill(eta1);
0152         cjetptME_.denominator->Fill(jets[1].pt());
0153         fjetptME_.denominator->Fill(jets[0].pt());
0154       }
0155       double mass = (jets[0].p4() + jets[1].p4()).mass();
0156       mjjME_.denominator->Fill(mass);
0157       mjjVsLS_.denominator->Fill(ls, mass);
0158       detajjME_.denominator->Fill(fabs(eta1 - eta2));
0159       dphijjME_.denominator->Fill(fabs(reco::deltaPhi(jets[0].phi(), jets[1].phi())));
0160 
0161       double mindphi = fabs(reco::deltaPhi(jets[0].phi(), pfmet.phi()));
0162       for (unsigned ij(0); ij < jets.size(); ++ij) {
0163         if (ij > 4)
0164           break;
0165         double dphi = fabs(reco::deltaPhi(jets[ij].phi(), pfmet.phi()));
0166         if (dphi < mindphi)
0167           mindphi = dphi;
0168       }
0169 
0170       mindphijmetME_.denominator->Fill(mindphi);
0171       mindphijmetVsLS_.denominator->Fill(ls, mindphi);
0172     }
0173   }  //at least 1 jet
0174 
0175   // applying selection for numerator
0176   if (passCond) {
0177     // filling histograms (num_genTriggerEventFlag_)
0178     if (!jets.empty()) {
0179       double eta1 = jets[0].eta();
0180       jet1ptME_.numerator->Fill(jets[0].pt());
0181       jet1etaME_.numerator->Fill(eta1);
0182       jet1etaVsLS_.numerator->Fill(ls, eta1);
0183       if (jets.size() > 1) {
0184         double eta2 = jets[1].eta();
0185         jet2ptME_.numerator->Fill(jets[1].pt());
0186         jet2etaME_.numerator->Fill(eta2);
0187         if (fabs(eta1) < fabs(eta2)) {
0188           cjetetaME_.numerator->Fill(eta1);
0189           fjetetaME_.numerator->Fill(eta2);
0190           cjetptME_.numerator->Fill(jets[0].pt());
0191           fjetptME_.numerator->Fill(jets[1].pt());
0192         } else {
0193           cjetetaME_.numerator->Fill(eta2);
0194           fjetetaME_.numerator->Fill(eta1);
0195           cjetptME_.numerator->Fill(jets[1].pt());
0196           fjetptME_.numerator->Fill(jets[0].pt());
0197         }
0198         double mass = (jets[0].p4() + jets[1].p4()).mass();
0199         mjjME_.numerator->Fill(mass);
0200         mjjVsLS_.numerator->Fill(ls, mass);
0201         detajjME_.numerator->Fill(fabs(eta1 - eta2));
0202         dphijjME_.numerator->Fill(fabs(reco::deltaPhi(jets[0].phi(), jets[1].phi())));
0203 
0204         double mindphi = fabs(reco::deltaPhi(jets[0].phi(), pfmet.phi()));
0205         for (unsigned ij(0); ij < jets.size(); ++ij) {
0206           if (ij > 4)
0207             break;
0208           double dphi = fabs(reco::deltaPhi(jets[ij].phi(), pfmet.phi()));
0209           if (dphi < mindphi)
0210             mindphi = dphi;
0211         }
0212 
0213         mindphijmetME_.numerator->Fill(mindphi);
0214         mindphijmetVsLS_.numerator->Fill(ls, mindphi);
0215       }
0216     }  //at least 1 jet
0217   }
0218 }
0219 
0220 void JetDQM::fillJetDescription(edm::ParameterSetDescription& histoPSet) {
0221   edm::ParameterSetDescription jetetaPSet;
0222   fillHistoPSetDescription(jetetaPSet);
0223   histoPSet.add<edm::ParameterSetDescription>("jetetaPSet", jetetaPSet);
0224 
0225   edm::ParameterSetDescription detajjPSet;
0226   fillHistoPSetDescription(detajjPSet);
0227   histoPSet.add<edm::ParameterSetDescription>("detajjPSet", detajjPSet);
0228 
0229   edm::ParameterSetDescription dphijjPSet;
0230   fillHistoPSetDescription(dphijjPSet);
0231   histoPSet.add<edm::ParameterSetDescription>("dphijjPSet", dphijjPSet);
0232 
0233   edm::ParameterSetDescription mindphijmetPSet;
0234   fillHistoPSetDescription(mindphijmetPSet);
0235   histoPSet.add<edm::ParameterSetDescription>("mindphijmetPSet", mindphijmetPSet);
0236 
0237   std::vector<double> bins = {0.,   20.,  40.,  60.,  80.,  100., 120., 140., 160., 180.,  200., 220.,
0238                               240., 260., 280., 300., 350., 400., 450., 500,  750,  1000., 1500.};
0239   histoPSet.add<std::vector<double> >("jetptBinning", bins);
0240 
0241   std::vector<double> pt1bins = {0.,   20.,  40.,  60.,  80.,  90.,  100., 110., 120., 130., 140., 150.,  160.,
0242                                  180., 210., 240., 270., 300., 330., 360., 400., 450., 500., 750., 1000., 1500.};
0243   histoPSet.add<std::vector<double> >("jet1ptBinning", pt1bins);
0244 
0245   std::vector<double> pt2bins = {0.,   20.,  40.,  45.,  50.,  55.,  60.,  65.,  70.,  80.,  90.,  100.,
0246                                  110., 120., 150., 180., 210., 240., 270., 300., 350., 400., 1000.};
0247   histoPSet.add<std::vector<double> >("jet2ptBinning", pt2bins);
0248 
0249   std::vector<double> mjjbins = {0.,  200, 400, 600,  620,  640,  660,  680,  700,  720,  740,  760,  780, 800,
0250                                  850, 900, 950, 1000, 1200, 1400, 1600, 1800, 2000, 2500, 3000, 4000, 6000};
0251   histoPSet.add<std::vector<double> >("mjjBinning", mjjbins);
0252 
0253   edm::ParameterSetDescription lsPSet;
0254   fillHistoLSPSetDescription(lsPSet);
0255   histoPSet.add<edm::ParameterSetDescription>("jetlsPSet", lsPSet);
0256 }