24 jetIDSelect_(nullptr),
44 elecSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
50 elecIso_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
68 muonSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate, true>>(
74 muonIso_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate, true>>(
146 hists_[
"RunNumb_"] = ibooker.
book1D(
"RunNumber",
"Run Nr.", 1.
e4, 1.5e5, 3.e5);
148 hists_[
"invMass_"] = ibooker.
book1D(
"InvMass",
"M(lep1, lep2)", 80, 0., 320.);
150 hists_[
"invMassLog_"] = ibooker.
book1D(
"InvMassLog",
"log_{10}(M(lep1, lep2))", 80, .1, 2.5);
153 hists_[
"invMassWC_"] = ibooker.
book1D(
"InvMassWC",
"M_{WC}(L1, L2)", 80, 0., 320.);
156 hists_[
"invMassWCLog_"] = ibooker.
book1D(
"InvMassLogWC",
"log_{10}(M_{WC})", 80, .1, 2.5);
158 hists_[
"decayChannel_"] = ibooker.
book1D(
"DecayChannel",
"Decay Channel", 3, 0, 3);
160 hists_[
"elecMuEff_"] = ibooker.
book1D(
"ElecMuEff",
"Eff(e/#mu paths)", nElecMu, 0., nElecMu);
162 hists_[
"elecMuMon_"] = ibooker.
book1D(
"ElecMuMon",
"Mon(e/#mu paths)", nElecMu, 0., nElecMu);
164 hists_[
"diMuonEff_"] = ibooker.
book1D(
"DiMuonEff",
"Eff(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
166 hists_[
"diMuonMon_"] = ibooker.
book1D(
"DiMuonMon",
"Mon(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
168 hists_[
"lep1Pt_"] = ibooker.
book1D(
"Lep1Pt",
"pt(lep1)", 50, 0., 200.);
170 hists_[
"lep2Pt_"] = ibooker.
book1D(
"Lep2Pt",
"pt(lep2)", 50, 0., 200.);
172 hists_[
"jetMult_"] = ibooker.
book1D(
"JetMult",
"N_{30}(jet)", 21, -0.5, 20.5);
174 hists_[
"metCalo_"] = ibooker.
book1D(
"METCalo",
"MET_{Calo}", 50, 0., 200.);
180 hists_[
"decayChannel_"]->setBinLabel(1,
"#mu e", 1);
181 hists_[
"decayChannel_"]->setBinLabel(2,
"#mu #mu", 1);
182 hists_[
"decayChannel_"]->setBinLabel(3,
"e e", 1);
189 hists_[
"sumEtaL1L2_"] = ibooker.
book1D(
"SumEtaL1L2",
"<#eta>(lep1, lep2)", 100, -5., 5.);
191 hists_[
"dEtaL1L2_"] = ibooker.
book1D(
"DEtaL1L2",
"#Delta#eta(lep1,lep2)", 80, -4., 4.);
193 hists_[
"dPhiL1L2_"] = ibooker.
book1D(
"DPhiL1L2",
"#Delta#phi(lep1,lep2)", 64, -3.2, 3.2);
195 hists_[
"elecPt_"] = ibooker.
book1D(
"ElecPt",
"pt(e)", 50, 0., 200.);
198 hists_[
"elecRelIso_"] = ibooker.
book1D(
"ElecRelIso",
"Iso_{Rel}(e)", 50, 0., 1.);
200 hists_[
"muonPt_"] = ibooker.
book1D(
"MuonPt",
"pt(#mu)", 50, 0., 200.);
202 hists_[
"muonRelIso_"] = ibooker.
book1D(
"MuonRelIso",
"Iso_{Rel}(#mu) (#Delta#beta Corrected)", 50, 0., 1.);
204 hists_[
"jet1Pt_"] = ibooker.
book1D(
"Jet1Pt",
"pt_{L2L3}(jet1)", 60, 0., 300.);
206 hists_[
"jet2Pt_"] = ibooker.
book1D(
"Jet2Pt",
"pt_{L2L3}(jet2)", 60, 0., 300.);
208 hists_[
"metPflow_"] = ibooker.
book1D(
"METPflow",
"MET_{Pflow}", 50, 0., 200.);
210 hists_[
"metTC_"] = ibooker.
book1D(
"METTC",
"MET_{TC}", 50, 0., 200.);
212 hists_[
"muonDelZ_"] = ibooker.
book1D(
"MuonDelZ",
"d_{z}(#mu)", 50, -25., 25.);
214 hists_[
"muonDelXY_"] = ibooker.
book2D(
"MuonDelXY",
"d_{xy}(#mu)", 50, -1., 1., 50, -1., 1.);
216 hists_[
"lepMultIso_"] = ibooker.
book2D(
"LepMultIso",
"N_{Iso}(e) vs N_{Iso}(#mu)", 5, 0., 5., 5, 0., 5.);
219 hists_[
"muonDelXY_"]->setAxisTitle(
"x [cm]", 1);
220 hists_[
"muonDelXY_"]->setAxisTitle(
"y [cm]", 2);
222 hists_[
"lepMultIso_"]->setAxisTitle(
"N_{Iso}(#mu)", 1);
223 hists_[
"lepMultIso_"]->setAxisTitle(
"N_{Iso}(elec)", 2);
230 hists_[
"elecMultIso_"] = ibooker.
book1D(
"ElecMultIso",
"N_{Iso}(e)", 11, -0.5, 10.5);
232 hists_[
"muonMultIso_"] = ibooker.
book1D(
"MuonMultIso",
"N_{Iso}(#mu)", 11, -0.5, 10.5);
235 hists_[
"muonChHadIso_"] = ibooker.
book1D(
"MuonChHadIsoComp",
"ChHad_{IsoComponent}(#mu)", 50, 0., 5.);
238 hists_[
"muonNeHadIso_"] = ibooker.
book1D(
"MuonNeHadIsoComp",
"NeHad_{IsoComponent}(#mu)", 50, 0., 5.);
241 hists_[
"muonPhIso_"] = ibooker.
book1D(
"MuonPhIsoComp",
"Photon_{IsoComponent}(#mu)", 50, 0., 5.);
244 hists_[
"elecChHadIso_"] = ibooker.
book1D(
"ElectronChHadIsoComp",
"ChHad_{IsoComponent}(e)", 50, 0., 5.);
247 hists_[
"elecNeHadIso_"] = ibooker.
book1D(
"ElectronNeHadIsoComp",
"NeHad_{IsoComponent}(e)", 50, 0., 5.);
250 hists_[
"elecPhIso_"] = ibooker.
book1D(
"ElectronPhIsoComp",
"Photon_{IsoComponent}(e)", 50, 0., 5.);
252 hists_[
"jet1Eta_"] = ibooker.
book1D(
"Jet1Eta",
"#eta(jet1)", 30, -5., 5.);
254 hists_[
"jet2Eta_"] = ibooker.
book1D(
"Jet2Eta",
"#eta(jet2)", 30, -5., 5.);
256 hists_[
"jet1PtRaw_"] = ibooker.
book1D(
"Jet1PtRaw",
"pt_{Raw}(jet1)", 60, 0., 300.);
258 hists_[
"jet2PtRaw_"] = ibooker.
book1D(
"Jet2PtRaw",
"pt_{Raw}(jet2)", 60, 0., 300.);
260 hists_[
"dEtaJet1Jet2_"] = ibooker.
book1D(
"DEtaJet1Jet2",
"#Delta#eta(jet1,jet2)", 80, -4., 4.);
262 hists_[
"dEtaJet1Lep1_"] = ibooker.
book1D(
"DEtaJet1Lep1",
"#Delta#eta(jet1,lep1)", 80, -4., 4.);
264 hists_[
"dEtaLep1MET_"] = ibooker.
book1D(
"DEtaLep1MET",
"#Delta#eta(lep1,MET)", 80, -4., 4.);
266 hists_[
"dEtaJet1MET_"] = ibooker.
book1D(
"DEtaJet1MET",
"#Delta#eta(jet1,MET)", 80, -4., 4.);
268 hists_[
"dPhiJet1Jet2_"] = ibooker.
book1D(
"DPhiJet1Jet2",
"#Delta#phi(jet1,jet2)", 64, -3.2, 3.2);
270 hists_[
"dPhiJet1Lep1_"] = ibooker.
book1D(
"DPhiJet1Lep1",
"#Delta#phi(jet1,lep1)", 64, -3.2, 3.2);
272 hists_[
"dPhiLep1MET_"] = ibooker.
book1D(
"DPhiLep1MET",
"#Delta#phi(lep1,MET)", 64, -3.2, 3.2);
274 hists_[
"dPhiJet1MET_"] = ibooker.
book1D(
"DPhiJet1MET",
"#Delta#phi(jet1,MET)", 64, -3.2, 3.2);
276 hists_[
"diMuonLogger_"] = ibooker.
book2D(
"DiMuonLogger",
"Logged DiMuon Events", 8, 0., 8., 10, 0., 10.);
278 hists_[
"diElecLogger_"] = ibooker.
book2D(
"DiElecLogger",
"Logged DiElec Events", 8, 0., 8., 10, 0., 10.);
280 hists_[
"elecMuLogger_"] = ibooker.
book2D(
"ElecMuLogger",
"Logged ElecMu Events", 8, 0., 8., 10, 0., 10.);
305 if (!
event.eventAuxiliary().run())
307 fill(
"RunNumb_",
event.eventAuxiliary().run());
320 std::vector<const reco::PFCandidate*> isoMuons;
329 if (muonit->muonRef().isNull())
333 if (
muon->innerTrack().isNull())
336 if (
muon->isGlobalMuon()) {
337 fill(
"muonDelZ_",
muon->innerTrack()->vz());
338 fill(
"muonDelXY_",
muon->innerTrack()->vx(),
muon->innerTrack()->vy());
342 double chHadPt =
muon->pfIsolationR04().sumChargedHadronPt;
343 double neHadEt =
muon->pfIsolationR04().sumNeutralHadronEt;
344 double phoEt =
muon->pfIsolationR04().sumPhotonEt;
346 double pfRelIso = (chHadPt +
std::max(0., neHadEt + phoEt - 0.5 *
muon->pfIsolationR04().sumPUPt)) /
349 fill(
"muonRelIso_", pfRelIso);
351 fill(
"muonChHadIso_", chHadPt);
352 fill(
"muonNeHadIso_", neHadEt);
353 fill(
"muonPhIso_", phoEt);
356 isoMuons.push_back(&(*muonit));
361 fill(
"muonMultIso_", isoMuons.size());
372 std::vector<const reco::PFCandidate*> isoElecs;
383 if (elec->gsfElectronRef().isNull()) {
391 double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
392 double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
393 double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
395 (el_ChHadIso +
std::max(0., el_NeHadIso + el_PhIso - 0.5 * gsf_el->pfIsolationVariables().sumPUPt)) /
397 fill(
"elecRelIso_", el_pfRelIso);
398 fill(
"elecChHadIso_", el_ChHadIso);
399 fill(
"elecNeHadIso_", el_NeHadIso);
400 fill(
"elecPhIso_", el_PhIso);
402 isoElecs.push_back(&(*elec));
406 fill(
"elecMultIso_", isoElecs.size());
419 if (
setup.find(edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>())) {
423 <<
"-----------------------------------------------------------------"
424 "-------------------- \n"
425 <<
" No JetCorrectionsRecord available from EventSetup: "
427 <<
" - Jets will not be corrected. "
429 <<
" - If you want to change this add the following lines to your "
433 <<
" ## load jet corrections "
436 "process.load(\"JetMETCorrections.Configuration."
437 "JetCorrectionServicesAllAlgos_cff\") \n"
438 <<
" process.prefer(\"ak5CaloL2L3\") "
442 <<
"-----------------------------------------------------------------"
443 "-------------------- \n";
447 unsigned int mult = 0;
449 std::vector<reco::Jet> leadingJets;
467 if (dynamic_cast<const reco::CaloJet*>(&*
jet)) {
471 if (!jetSelect(
sel)) {
474 }
else if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
489 for (std::vector<const reco::PFCandidate*>::const_iterator elec = isoElecs.begin(); elec != isoElecs.end();
504 leadingJets.push_back(monitorJet);
505 fill(
"jet1Pt_", monitorJet.
pt());
510 leadingJets.push_back(monitorJet);
511 fill(
"jet2Pt_", monitorJet.
pt());
516 if (leadingJets.size() > 1) {
517 fill(
"dEtaJet1Jet2_", leadingJets[0].
eta() - leadingJets[1].
eta());
519 if (!isoMuons.empty()) {
520 if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
521 fill(
"dEtaJet1Lep1_", isoMuons[0]->
eta() - leadingJets[0].
eta());
525 if (!isoElecs.empty()) {
526 if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
527 fill(
"dEtaJet1Lep1_", isoElecs[0]->
eta() - leadingJets[0].
eta());
550 if (
met->begin() !=
met->end()) {
551 unsigned int idx = met_ -
mets_.begin();
554 fill(
"metCalo_",
met->begin()->et());
555 if (!leadingJets.empty()) {
556 fill(
"dEtaJet1MET_", leadingJets[0].
eta() -
met->begin()->eta());
559 if (!isoMuons.empty()) {
560 if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
561 fill(
"dEtaLep1MET_", isoMuons[0]->
eta() -
met->begin()->eta());
565 if (!isoElecs.empty()) {
566 if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
567 fill(
"dEtaLep1MET_", isoElecs[0]->
eta() -
met->begin()->eta());
573 fill(
"metTC_",
met->begin()->et());
576 fill(
"metPflow_",
met->begin()->et());
590 fill(
"lepMultIso_", isoMuons.size(), isoElecs.size());
593 fill(
"decayChannel_", 0.5);
594 double mass = (isoElecs[0]->p4() + isoMuons[0]->p4()).
mass();
596 fill(
"dEtaL1L2_", isoElecs[0]->
eta() - isoMuons[0]->
eta());
597 fill(
"sumEtaL1L2_", (isoElecs[0]->
eta() + isoMuons[0]->
eta()) / 2);
599 fill(
"elecPt_", isoElecs[0]->
pt());
600 fill(
"muonPt_", isoMuons[0]->
pt());
601 fill(
"lep1Pt_", isoElecs[0]->
pt() > isoMuons[0]->
pt() ? isoElecs[0]->
pt() : isoMuons[0]->
pt());
602 fill(
"lep2Pt_", isoElecs[0]->
pt() > isoMuons[0]->
pt() ? isoMuons[0]->
pt() : isoElecs[0]->
pt());
614 if (!leadingJets.empty())
616 if (leadingJets.size() > 1)
626 fill(
"decayChannel_", 1.5);
627 int charge = isoMuons[0]->charge() * isoMuons[1]->charge();
628 double mass = (isoMuons[0]->p4() + isoMuons[1]->p4()).
mass();
633 fill(
"dEtaL1L2_", isoMuons[0]->
eta() - isoMuons[1]->
eta());
634 fill(
"sumEtaL1L2_", (isoMuons[0]->
eta() + isoMuons[1]->
eta()) / 2);
636 fill(
"muonPt_", isoMuons[0]->
pt());
637 fill(
"muonPt_", isoMuons[1]->
pt());
638 fill(
"lep1Pt_", isoMuons[0]->
pt());
639 fill(
"lep2Pt_", isoMuons[1]->
pt());
651 if (!leadingJets.empty())
653 if (leadingJets.size() > 1)
663 fill(
"decayChannel_", 2.5);
664 int charge = isoElecs[0]->charge() * isoElecs[1]->charge();
665 double mass = (isoElecs[0]->p4() + isoElecs[1]->p4()).
mass();
669 fill(
"dEtaL1L2_", isoElecs[0]->
eta() - isoElecs[1]->
eta());
670 fill(
"sumEtaL1L2_", (isoElecs[0]->
eta() + isoElecs[1]->
eta()) / 2);
672 fill(
"elecPt_", isoElecs[0]->
pt());
673 fill(
"elecPt_", isoElecs[1]->
pt());
674 fill(
"lep1Pt_", isoElecs[0]->
pt());
675 fill(
"lep2Pt_", isoElecs[1]->
pt());
684 if (!leadingJets.empty())
686 if (leadingJets.size() > 1)
697 : vertexSelect_(nullptr),
698 beamspotSelect_(nullptr),
700 ElectronStep(nullptr),
723 std::make_unique<StringCutObjectSelector<reco::BeamSpot>>(
beamspot.getParameter<
std::string>(
"select"));
727 sel_ =
cfg.getParameter<std::vector<edm::ParameterSet>>(
"selection");
729 for (
unsigned int i = 0;
i <
sel_.size(); ++
i) {
732 std::make_pair(
sel_.at(
i),
733 std::make_unique<TopDiLeptonOffline::MonitorEnsemble>(
740 if (
type ==
"muons") {
743 if (
type ==
"elecs") {
749 if (
type ==
"jets") {
752 if (
type ==
"jets/pf") {
755 if (
type ==
"jets/calo") {
768 selIt->second.second->book(ibooker);
783 if (
vertex->empty() || !(*vertexSelect_)(
vertex->front()))
795 unsigned int nJetSteps = -1;
797 unsigned int nPFJetSteps = -1;
799 unsigned int nCaloJetSteps = -1;
805 if (
type ==
"empty") {
824 if (
JetSteps[nJetSteps] !=
nullptr) {