25 jetIDSelect_(nullptr),
45 elecSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
51 elecIso_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate>>(
69 muonSelect_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate, true>>(
75 muonIso_ = std::make_unique<StringCutObjectSelector<reco::PFCandidate, true>>(
149 hists_[
"invMass_"] = ibooker.
book1D(
"InvMass",
"M(lep1, lep2)", 80, 0., 320.);
151 hists_[
"invMassLog_"] = ibooker.
book1D(
"InvMassLog",
"log_{10}(M(lep1, lep2))", 80, .1, 2.5);
154 hists_[
"invMassWC_"] = ibooker.
book1D(
"InvMassWC",
"M_{WC}(L1, L2)", 80, 0., 320.);
157 hists_[
"invMassWCLog_"] = ibooker.
book1D(
"InvMassLogWC",
"log_{10}(M_{WC})", 80, .1, 2.5);
159 hists_[
"decayChannel_"] = ibooker.
book1D(
"DecayChannel",
"Decay Channel", 3, 0, 3);
161 hists_[
"elecMuEff_"] = ibooker.
book1D(
"ElecMuEff",
"Eff(e/#mu paths)", nElecMu, 0., nElecMu);
163 hists_[
"elecMuMon_"] = ibooker.
book1D(
"ElecMuMon",
"Mon(e/#mu paths)", nElecMu, 0., nElecMu);
165 hists_[
"diMuonEff_"] = ibooker.
book1D(
"DiMuonEff",
"Eff(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
167 hists_[
"diMuonMon_"] = ibooker.
book1D(
"DiMuonMon",
"Mon(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
169 hists_[
"lep1Pt_"] = ibooker.
book1D(
"Lep1Pt",
"pt(lep1)", 50, 0., 200.);
171 hists_[
"lep2Pt_"] = ibooker.
book1D(
"Lep2Pt",
"pt(lep2)", 50, 0., 200.);
173 hists_[
"jetMult_"] = ibooker.
book1D(
"JetMult",
"N_{30}(jet)", 21, -0.5, 20.5);
175 hists_[
"metCalo_"] = ibooker.
book1D(
"METCalo",
"MET_{Calo}", 50, 0., 200.);
181 hists_[
"decayChannel_"]->setBinLabel(1,
"#mu e", 1);
182 hists_[
"decayChannel_"]->setBinLabel(2,
"#mu #mu", 1);
183 hists_[
"decayChannel_"]->setBinLabel(3,
"e e", 1);
190 hists_[
"sumEtaL1L2_"] = ibooker.
book1D(
"SumEtaL1L2",
"<#eta>(lep1, lep2)", 100, -5., 5.);
192 hists_[
"dEtaL1L2_"] = ibooker.
book1D(
"DEtaL1L2",
"#Delta#eta(lep1,lep2)", 80, -4., 4.);
194 hists_[
"dPhiL1L2_"] = ibooker.
book1D(
"DPhiL1L2",
"#Delta#phi(lep1,lep2)", 64, -3.2, 3.2);
196 hists_[
"elecPt_"] = ibooker.
book1D(
"ElecPt",
"pt(e)", 50, 0., 200.);
199 hists_[
"elecRelIso_"] = ibooker.
book1D(
"ElecRelIso",
"Iso_{Rel}(e)", 50, 0., 1.);
201 hists_[
"muonPt_"] = ibooker.
book1D(
"MuonPt",
"pt(#mu)", 50, 0., 200.);
203 hists_[
"muonRelIso_"] = ibooker.
book1D(
"MuonRelIso",
"Iso_{Rel}(#mu) (#Delta#beta Corrected)", 50, 0., 1.);
205 hists_[
"jet1Pt_"] = ibooker.
book1D(
"Jet1Pt",
"pt_{L2L3}(jet1)", 60, 0., 300.);
207 hists_[
"jet2Pt_"] = ibooker.
book1D(
"Jet2Pt",
"pt_{L2L3}(jet2)", 60, 0., 300.);
209 hists_[
"metPflow_"] = ibooker.
book1D(
"METPflow",
"MET_{Pflow}", 50, 0., 200.);
211 hists_[
"metTC_"] = ibooker.
book1D(
"METTC",
"MET_{TC}", 50, 0., 200.);
213 hists_[
"muonDelZ_"] = ibooker.
book1D(
"MuonDelZ",
"d_{z}(#mu)", 50, -25., 25.);
215 hists_[
"muonDelXY_"] = ibooker.
book2D(
"MuonDelXY",
"d_{xy}(#mu)", 50, -1., 1., 50, -1., 1.);
217 hists_[
"lepMultIso_"] = ibooker.
book2D(
"LepMultIso",
"N_{Iso}(e) vs N_{Iso}(#mu)", 5, 0., 5., 5, 0., 5.);
220 hists_[
"muonDelXY_"]->setAxisTitle(
"x [cm]", 1);
221 hists_[
"muonDelXY_"]->setAxisTitle(
"y [cm]", 2);
223 hists_[
"lepMultIso_"]->setAxisTitle(
"N_{Iso}(#mu)", 1);
224 hists_[
"lepMultIso_"]->setAxisTitle(
"N_{Iso}(elec)", 2);
231 hists_[
"elecMultIso_"] = ibooker.
book1D(
"ElecMultIso",
"N_{Iso}(e)", 11, -0.5, 10.5);
233 hists_[
"muonMultIso_"] = ibooker.
book1D(
"MuonMultIso",
"N_{Iso}(#mu)", 11, -0.5, 10.5);
236 hists_[
"muonChHadIso_"] = ibooker.
book1D(
"MuonChHadIsoComp",
"ChHad_{IsoComponent}(#mu)", 50, 0., 5.);
239 hists_[
"muonNeHadIso_"] = ibooker.
book1D(
"MuonNeHadIsoComp",
"NeHad_{IsoComponent}(#mu)", 50, 0., 5.);
242 hists_[
"muonPhIso_"] = ibooker.
book1D(
"MuonPhIsoComp",
"Photon_{IsoComponent}(#mu)", 50, 0., 5.);
245 hists_[
"elecChHadIso_"] = ibooker.
book1D(
"ElectronChHadIsoComp",
"ChHad_{IsoComponent}(e)", 50, 0., 5.);
248 hists_[
"elecNeHadIso_"] = ibooker.
book1D(
"ElectronNeHadIsoComp",
"NeHad_{IsoComponent}(e)", 50, 0., 5.);
251 hists_[
"elecPhIso_"] = ibooker.
book1D(
"ElectronPhIsoComp",
"Photon_{IsoComponent}(e)", 50, 0., 5.);
253 hists_[
"jet1Eta_"] = ibooker.
book1D(
"Jet1Eta",
"#eta(jet1)", 30, -5., 5.);
255 hists_[
"jet2Eta_"] = ibooker.
book1D(
"Jet2Eta",
"#eta(jet2)", 30, -5., 5.);
257 hists_[
"jet1PtRaw_"] = ibooker.
book1D(
"Jet1PtRaw",
"pt_{Raw}(jet1)", 60, 0., 300.);
259 hists_[
"jet2PtRaw_"] = ibooker.
book1D(
"Jet2PtRaw",
"pt_{Raw}(jet2)", 60, 0., 300.);
261 hists_[
"dEtaJet1Jet2_"] = ibooker.
book1D(
"DEtaJet1Jet2",
"#Delta#eta(jet1,jet2)", 80, -4., 4.);
263 hists_[
"dEtaJet1Lep1_"] = ibooker.
book1D(
"DEtaJet1Lep1",
"#Delta#eta(jet1,lep1)", 80, -4., 4.);
265 hists_[
"dEtaLep1MET_"] = ibooker.
book1D(
"DEtaLep1MET",
"#Delta#eta(lep1,MET)", 80, -4., 4.);
267 hists_[
"dEtaJet1MET_"] = ibooker.
book1D(
"DEtaJet1MET",
"#Delta#eta(jet1,MET)", 80, -4., 4.);
269 hists_[
"dPhiJet1Jet2_"] = ibooker.
book1D(
"DPhiJet1Jet2",
"#Delta#phi(jet1,jet2)", 64, -3.2, 3.2);
271 hists_[
"dPhiJet1Lep1_"] = ibooker.
book1D(
"DPhiJet1Lep1",
"#Delta#phi(jet1,lep1)", 64, -3.2, 3.2);
273 hists_[
"dPhiLep1MET_"] = ibooker.
book1D(
"DPhiLep1MET",
"#Delta#phi(lep1,MET)", 64, -3.2, 3.2);
275 hists_[
"dPhiJet1MET_"] = ibooker.
book1D(
"DPhiJet1MET",
"#Delta#phi(jet1,MET)", 64, -3.2, 3.2);
277 hists_[
"diMuonLogger_"] = ibooker.
book2D(
"DiMuonLogger",
"Logged DiMuon Events", 8, 0., 8., 10, 0., 10.);
279 hists_[
"diElecLogger_"] = ibooker.
book2D(
"DiElecLogger",
"Logged DiElec Events", 8, 0., 8., 10, 0., 10.);
281 hists_[
"elecMuLogger_"] = ibooker.
book2D(
"ElecMuLogger",
"Logged ElecMu Events", 8, 0., 8., 10, 0., 10.);
306 if (!
event.eventAuxiliary().run())
308 fill(
"RunNumb_",
event.eventAuxiliary().run());
321 std::vector<const reco::PFCandidate*> isoMuons;
330 if (muonit->muonRef().isNull())
334 if (
muon->innerTrack().isNull())
337 if (
muon->isGlobalMuon()) {
338 fill(
"muonDelZ_",
muon->innerTrack()->vz());
339 fill(
"muonDelXY_",
muon->innerTrack()->vx(),
muon->innerTrack()->vy());
343 double chHadPt =
muon->pfIsolationR04().sumChargedHadronPt;
344 double neHadEt =
muon->pfIsolationR04().sumNeutralHadronEt;
345 double phoEt =
muon->pfIsolationR04().sumPhotonEt;
347 double pfRelIso = (chHadPt +
std::max(0., neHadEt + phoEt - 0.5 *
muon->pfIsolationR04().sumPUPt)) /
350 fill(
"muonRelIso_", pfRelIso);
352 fill(
"muonChHadIso_", chHadPt);
353 fill(
"muonNeHadIso_", neHadEt);
354 fill(
"muonPhIso_", phoEt);
357 isoMuons.push_back(&(*muonit));
362 fill(
"muonMultIso_", isoMuons.size());
373 std::vector<const reco::PFCandidate*> isoElecs;
384 if (elec->gsfElectronRef().isNull()) {
392 double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
393 double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
394 double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
396 (el_ChHadIso +
std::max(0., el_NeHadIso + el_PhIso - 0.5 * gsf_el->pfIsolationVariables().sumPUPt)) /
398 fill(
"elecRelIso_", el_pfRelIso);
399 fill(
"elecChHadIso_", el_ChHadIso);
400 fill(
"elecNeHadIso_", el_NeHadIso);
401 fill(
"elecPhIso_", el_PhIso);
403 isoElecs.push_back(&(*elec));
407 fill(
"elecMultIso_", isoElecs.size());
420 if (
setup.find(edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>())) {
424 <<
"-----------------------------------------------------------------"
425 "-------------------- \n"
426 <<
" No JetCorrectionsRecord available from EventSetup: "
428 <<
" - Jets will not be corrected. "
430 <<
" - If you want to change this add the following lines to your "
434 <<
" ## load jet corrections "
437 "process.load(\"JetMETCorrections.Configuration."
438 "JetCorrectionServicesAllAlgos_cff\") \n"
439 <<
" process.prefer(\"ak5CaloL2L3\") "
443 <<
"-----------------------------------------------------------------"
444 "-------------------- \n";
448 unsigned int mult = 0;
450 std::vector<reco::Jet> leadingJets;
468 if (dynamic_cast<const reco::CaloJet*>(&*
jet)) {
472 if (!jetSelect(
sel)) {
475 }
else if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
490 for (std::vector<const reco::PFCandidate*>::const_iterator elec = isoElecs.begin(); elec != isoElecs.end();
505 leadingJets.push_back(monitorJet);
506 fill(
"jet1Pt_", monitorJet.
pt());
511 leadingJets.push_back(monitorJet);
512 fill(
"jet2Pt_", monitorJet.
pt());
517 if (leadingJets.size() > 1) {
518 fill(
"dEtaJet1Jet2_", leadingJets[0].
eta() - leadingJets[1].
eta());
520 if (!isoMuons.empty()) {
521 if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
522 fill(
"dEtaJet1Lep1_", isoMuons[0]->
eta() - leadingJets[0].
eta());
526 if (!isoElecs.empty()) {
527 if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
528 fill(
"dEtaJet1Lep1_", isoElecs[0]->
eta() - leadingJets[0].
eta());
551 if (
met->begin() !=
met->end()) {
552 unsigned int idx = met_ -
mets_.begin();
555 fill(
"metCalo_",
met->begin()->et());
556 if (!leadingJets.empty()) {
557 fill(
"dEtaJet1MET_", leadingJets[0].
eta() -
met->begin()->eta());
560 if (!isoMuons.empty()) {
561 if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
562 fill(
"dEtaLep1MET_", isoMuons[0]->
eta() -
met->begin()->eta());
566 if (!isoElecs.empty()) {
567 if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
568 fill(
"dEtaLep1MET_", isoElecs[0]->
eta() -
met->begin()->eta());
574 fill(
"metTC_",
met->begin()->et());
577 fill(
"metPflow_",
met->begin()->et());
591 fill(
"lepMultIso_", isoMuons.size(), isoElecs.size());
594 fill(
"decayChannel_", 0.5);
595 double mass = (isoElecs[0]->p4() + isoMuons[0]->p4()).
mass();
597 fill(
"dEtaL1L2_", isoElecs[0]->
eta() - isoMuons[0]->
eta());
598 fill(
"sumEtaL1L2_", (isoElecs[0]->
eta() + isoMuons[0]->
eta()) / 2);
600 fill(
"elecPt_", isoElecs[0]->
pt());
601 fill(
"muonPt_", isoMuons[0]->
pt());
602 fill(
"lep1Pt_", isoElecs[0]->
pt() > isoMuons[0]->
pt() ? isoElecs[0]->
pt() : isoMuons[0]->
pt());
603 fill(
"lep2Pt_", isoElecs[0]->
pt() > isoMuons[0]->
pt() ? isoMuons[0]->
pt() : isoElecs[0]->
pt());
615 if (!leadingJets.empty())
617 if (leadingJets.size() > 1)
627 fill(
"decayChannel_", 1.5);
628 int charge = isoMuons[0]->charge() * isoMuons[1]->charge();
629 double mass = (isoMuons[0]->p4() + isoMuons[1]->p4()).
mass();
634 fill(
"dEtaL1L2_", isoMuons[0]->
eta() - isoMuons[1]->
eta());
635 fill(
"sumEtaL1L2_", (isoMuons[0]->
eta() + isoMuons[1]->
eta()) / 2);
637 fill(
"muonPt_", isoMuons[0]->
pt());
638 fill(
"muonPt_", isoMuons[1]->
pt());
639 fill(
"lep1Pt_", isoMuons[0]->
pt());
640 fill(
"lep2Pt_", isoMuons[1]->
pt());
652 if (!leadingJets.empty())
654 if (leadingJets.size() > 1)
664 fill(
"decayChannel_", 2.5);
665 int charge = isoElecs[0]->charge() * isoElecs[1]->charge();
666 double mass = (isoElecs[0]->p4() + isoElecs[1]->p4()).
mass();
670 fill(
"dEtaL1L2_", isoElecs[0]->
eta() - isoElecs[1]->
eta());
671 fill(
"sumEtaL1L2_", (isoElecs[0]->
eta() + isoElecs[1]->
eta()) / 2);
673 fill(
"elecPt_", isoElecs[0]->
pt());
674 fill(
"elecPt_", isoElecs[1]->
pt());
675 fill(
"lep1Pt_", isoElecs[0]->
pt());
676 fill(
"lep2Pt_", isoElecs[1]->
pt());
685 if (!leadingJets.empty())
687 if (leadingJets.size() > 1)
698 : vertexSelect_(nullptr),
699 beamspotSelect_(nullptr),
701 ElectronStep(nullptr),
724 std::make_unique<StringCutObjectSelector<reco::BeamSpot>>(
beamspot.getParameter<
std::string>(
"select"));
728 sel_ =
cfg.getParameter<std::vector<edm::ParameterSet>>(
"selection");
730 for (
unsigned int i = 0;
i <
sel_.size(); ++
i) {
733 std::make_pair(
sel_.at(
i),
734 std::make_unique<TopDiLeptonOffline::MonitorEnsemble>(
741 if (
type ==
"muons") {
744 if (
type ==
"elecs") {
750 if (
type ==
"jets") {
753 if (
type ==
"jets/pf") {
756 if (
type ==
"jets/calo") {
769 selIt->second.second->book(ibooker);
784 if (
vertex->empty() || !(*vertexSelect_)(
vertex->front()))
796 unsigned int nJetSteps = -1;
798 unsigned int nPFJetSteps = -1;
800 unsigned int nCaloJetSteps = -1;
806 if (
type ==
"empty") {
825 if (
JetSteps[nJetSteps] !=
nullptr) {