21 jetIDSelect_(nullptr),
142 hists_[
"RunNumb_"] = ibooker.
book1D(
"RunNumber",
"Run Nr.", 1.
e4, 1.5e5, 3.e5);
144 hists_[
"invMass_"] = ibooker.
book1D(
"InvMass",
"M(lep1, lep2)", 80, 0., 320.);
146 hists_[
"invMassLog_"] = ibooker.
book1D(
"InvMassLog",
"log_{10}(M(lep1, lep2))", 80, .1, 2.5);
149 hists_[
"invMassWC_"] = ibooker.
book1D(
"InvMassWC",
"M_{WC}(L1, L2)", 80, 0., 320.);
152 hists_[
"invMassWCLog_"] = ibooker.
book1D(
"InvMassLogWC",
"log_{10}(M_{WC})", 80, .1, 2.5);
154 hists_[
"decayChannel_"] = ibooker.
book1D(
"DecayChannel",
"Decay Channel", 3, 0, 3);
156 hists_[
"elecMuEff_"] = ibooker.
book1D(
"ElecMuEff",
"Eff(e/#mu paths)", nElecMu, 0., nElecMu);
158 hists_[
"elecMuMon_"] = ibooker.
book1D(
"ElecMuMon",
"Mon(e/#mu paths)", nElecMu, 0., nElecMu);
160 hists_[
"diMuonEff_"] = ibooker.
book1D(
"DiMuonEff",
"Eff(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
162 hists_[
"diMuonMon_"] = ibooker.
book1D(
"DiMuonMon",
"Mon(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
164 hists_[
"lep1Pt_"] = ibooker.
book1D(
"Lep1Pt",
"pt(lep1)", 50, 0., 200.);
166 hists_[
"lep2Pt_"] = ibooker.
book1D(
"Lep2Pt",
"pt(lep2)", 50, 0., 200.);
168 hists_[
"jetMult_"] = ibooker.
book1D(
"JetMult",
"N_{30}(jet)", 21, -0.5, 20.5);
170 hists_[
"metCalo_"] = ibooker.
book1D(
"METCalo",
"MET_{Calo}", 50, 0., 200.);
176 hists_[
"decayChannel_"]->setBinLabel(1,
"#mu e", 1);
177 hists_[
"decayChannel_"]->setBinLabel(2,
"#mu #mu", 1);
178 hists_[
"decayChannel_"]->setBinLabel(3,
"e e", 1);
185 hists_[
"sumEtaL1L2_"] = ibooker.
book1D(
"SumEtaL1L2",
"<#eta>(lep1, lep2)", 100, -5., 5.);
187 hists_[
"dEtaL1L2_"] = ibooker.
book1D(
"DEtaL1L2",
"#Delta#eta(lep1,lep2)", 80, -4., 4.);
189 hists_[
"dPhiL1L2_"] = ibooker.
book1D(
"DPhiL1L2",
"#Delta#phi(lep1,lep2)", 64, -3.2, 3.2);
191 hists_[
"elecPt_"] = ibooker.
book1D(
"ElecPt",
"pt(e)", 50, 0., 200.);
194 hists_[
"elecRelIso_"] = ibooker.
book1D(
"ElecRelIso",
"Iso_{Rel}(e)", 50, 0., 1.);
196 hists_[
"muonPt_"] = ibooker.
book1D(
"MuonPt",
"pt(#mu)", 50, 0., 200.);
198 hists_[
"muonRelIso_"] = ibooker.
book1D(
"MuonRelIso",
"Iso_{Rel}(#mu) (#Delta#beta Corrected)", 50, 0., 1.);
200 hists_[
"jet1Pt_"] = ibooker.
book1D(
"Jet1Pt",
"pt_{L2L3}(jet1)", 60, 0., 300.);
202 hists_[
"jet2Pt_"] = ibooker.
book1D(
"Jet2Pt",
"pt_{L2L3}(jet2)", 60, 0., 300.);
204 hists_[
"metPflow_"] = ibooker.
book1D(
"METPflow",
"MET_{Pflow}", 50, 0., 200.);
206 hists_[
"metTC_"] = ibooker.
book1D(
"METTC",
"MET_{TC}", 50, 0., 200.);
208 hists_[
"muonDelZ_"] = ibooker.
book1D(
"MuonDelZ",
"d_{z}(#mu)", 50, -25., 25.);
210 hists_[
"muonDelXY_"] = ibooker.
book2D(
"MuonDelXY",
"d_{xy}(#mu)", 50, -1., 1., 50, -1., 1.);
212 hists_[
"lepMultIso_"] = ibooker.
book2D(
"LepMultIso",
"N_{Iso}(e) vs N_{Iso}(#mu)", 5, 0., 5., 5, 0., 5.);
215 hists_[
"muonDelXY_"]->setAxisTitle(
"x [cm]", 1);
216 hists_[
"muonDelXY_"]->setAxisTitle(
"y [cm]", 2);
218 hists_[
"lepMultIso_"]->setAxisTitle(
"N_{Iso}(#mu)", 1);
219 hists_[
"lepMultIso_"]->setAxisTitle(
"N_{Iso}(elec)", 2);
226 hists_[
"elecMultIso_"] = ibooker.
book1D(
"ElecMultIso",
"N_{Iso}(e)", 11, -0.5, 10.5);
228 hists_[
"muonMultIso_"] = ibooker.
book1D(
"MuonMultIso",
"N_{Iso}(#mu)", 11, -0.5, 10.5);
231 hists_[
"muonChHadIso_"] = ibooker.
book1D(
"MuonChHadIsoComp",
"ChHad_{IsoComponent}(#mu)", 50, 0., 5.);
234 hists_[
"muonNeHadIso_"] = ibooker.
book1D(
"MuonNeHadIsoComp",
"NeHad_{IsoComponent}(#mu)", 50, 0., 5.);
237 hists_[
"muonPhIso_"] = ibooker.
book1D(
"MuonPhIsoComp",
"Photon_{IsoComponent}(#mu)", 50, 0., 5.);
240 hists_[
"elecChHadIso_"] = ibooker.
book1D(
"ElectronChHadIsoComp",
"ChHad_{IsoComponent}(e)", 50, 0., 5.);
243 hists_[
"elecNeHadIso_"] = ibooker.
book1D(
"ElectronNeHadIsoComp",
"NeHad_{IsoComponent}(e)", 50, 0., 5.);
246 hists_[
"elecPhIso_"] = ibooker.
book1D(
"ElectronPhIsoComp",
"Photon_{IsoComponent}(e)", 50, 0., 5.);
248 hists_[
"jet1Eta_"] = ibooker.
book1D(
"Jet1Eta",
"#eta(jet1)", 30, -5., 5.);
250 hists_[
"jet2Eta_"] = ibooker.
book1D(
"Jet2Eta",
"#eta(jet2)", 30, -5., 5.);
252 hists_[
"jet1PtRaw_"] = ibooker.
book1D(
"Jet1PtRaw",
"pt_{Raw}(jet1)", 60, 0., 300.);
254 hists_[
"jet2PtRaw_"] = ibooker.
book1D(
"Jet2PtRaw",
"pt_{Raw}(jet2)", 60, 0., 300.);
256 hists_[
"dEtaJet1Jet2_"] = ibooker.
book1D(
"DEtaJet1Jet2",
"#Delta#eta(jet1,jet2)", 80, -4., 4.);
258 hists_[
"dEtaJet1Lep1_"] = ibooker.
book1D(
"DEtaJet1Lep1",
"#Delta#eta(jet1,lep1)", 80, -4., 4.);
260 hists_[
"dEtaLep1MET_"] = ibooker.
book1D(
"DEtaLep1MET",
"#Delta#eta(lep1,MET)", 80, -4., 4.);
262 hists_[
"dEtaJet1MET_"] = ibooker.
book1D(
"DEtaJet1MET",
"#Delta#eta(jet1,MET)", 80, -4., 4.);
264 hists_[
"dPhiJet1Jet2_"] = ibooker.
book1D(
"DPhiJet1Jet2",
"#Delta#phi(jet1,jet2)", 64, -3.2, 3.2);
266 hists_[
"dPhiJet1Lep1_"] = ibooker.
book1D(
"DPhiJet1Lep1",
"#Delta#phi(jet1,lep1)", 64, -3.2, 3.2);
268 hists_[
"dPhiLep1MET_"] = ibooker.
book1D(
"DPhiLep1MET",
"#Delta#phi(lep1,MET)", 64, -3.2, 3.2);
270 hists_[
"dPhiJet1MET_"] = ibooker.
book1D(
"DPhiJet1MET",
"#Delta#phi(jet1,MET)", 64, -3.2, 3.2);
272 hists_[
"diMuonLogger_"] = ibooker.
book2D(
"DiMuonLogger",
"Logged DiMuon Events", 8, 0., 8., 10, 0., 10.);
274 hists_[
"diElecLogger_"] = ibooker.
book2D(
"DiElecLogger",
"Logged DiElec Events", 8, 0., 8., 10, 0., 10.);
276 hists_[
"elecMuLogger_"] = ibooker.
book2D(
"ElecMuLogger",
"Logged ElecMu Events", 8, 0., 8., 10, 0., 10.);
301 if (!
event.eventAuxiliary().run())
303 fill(
"RunNumb_",
event.eventAuxiliary().run());
316 std::vector<const reco::PFCandidate*> isoMuons;
325 if (muonit->muonRef().isNull())
329 if (
muon->innerTrack().isNull())
332 if (
muon->isGlobalMuon()) {
333 fill(
"muonDelZ_",
muon->innerTrack()->vz());
334 fill(
"muonDelXY_",
muon->innerTrack()->vx(),
muon->innerTrack()->vy());
338 double chHadPt =
muon->pfIsolationR04().sumChargedHadronPt;
339 double neHadEt =
muon->pfIsolationR04().sumNeutralHadronEt;
340 double phoEt =
muon->pfIsolationR04().sumPhotonEt;
342 double pfRelIso = (chHadPt +
std::max(0., neHadEt + phoEt - 0.5 *
muon->pfIsolationR04().sumPUPt)) /
345 fill(
"muonRelIso_", pfRelIso);
347 fill(
"muonChHadIso_", chHadPt);
348 fill(
"muonNeHadIso_", neHadEt);
349 fill(
"muonPhIso_", phoEt);
352 isoMuons.push_back(&(*muonit));
357 fill(
"muonMultIso_", isoMuons.size());
368 std::vector<const reco::PFCandidate*> isoElecs;
379 if (elec->gsfElectronRef().isNull()) {
387 double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
388 double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
389 double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
391 (el_ChHadIso +
std::max(0., el_NeHadIso + el_PhIso - 0.5 * gsf_el->pfIsolationVariables().sumPUPt)) /
393 fill(
"elecRelIso_", el_pfRelIso);
394 fill(
"elecChHadIso_", el_ChHadIso);
395 fill(
"elecNeHadIso_", el_NeHadIso);
396 fill(
"elecPhIso_", el_PhIso);
398 isoElecs.push_back(&(*elec));
402 fill(
"elecMultIso_", isoElecs.size());
415 if (
setup.find(edm::eventsetup::EventSetupRecordKey::makeKey<JetCorrectionsRecord>())) {
419 <<
"-----------------------------------------------------------------"
420 "-------------------- \n"
421 <<
" No JetCorrectionsRecord available from EventSetup: "
423 <<
" - Jets will not be corrected. "
425 <<
" - If you want to change this add the following lines to your "
429 <<
" ## load jet corrections "
432 "process.load(\"JetMETCorrections.Configuration."
433 "JetCorrectionServicesAllAlgos_cff\") \n"
434 <<
" process.prefer(\"ak5CaloL2L3\") "
438 <<
"-----------------------------------------------------------------"
439 "-------------------- \n";
443 unsigned int mult = 0;
445 std::vector<reco::Jet> leadingJets;
463 if (dynamic_cast<const reco::CaloJet*>(&*
jet)) {
467 if (!jetSelect(
sel)) {
470 }
else if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
485 for (std::vector<const reco::PFCandidate*>::const_iterator elec = isoElecs.begin(); elec != isoElecs.end();
500 leadingJets.push_back(monitorJet);
501 fill(
"jet1Pt_", monitorJet.
pt());
506 leadingJets.push_back(monitorJet);
507 fill(
"jet2Pt_", monitorJet.
pt());
512 if (leadingJets.size() > 1) {
513 fill(
"dEtaJet1Jet2_", leadingJets[0].
eta() - leadingJets[1].
eta());
515 if (!isoMuons.empty()) {
516 if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
517 fill(
"dEtaJet1Lep1_", isoMuons[0]->
eta() - leadingJets[0].
eta());
521 if (!isoElecs.empty()) {
522 if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
523 fill(
"dEtaJet1Lep1_", isoElecs[0]->
eta() - leadingJets[0].
eta());
546 if (
met->begin() !=
met->end()) {
547 unsigned int idx = met_ -
mets_.begin();
550 fill(
"metCalo_",
met->begin()->et());
551 if (!leadingJets.empty()) {
552 fill(
"dEtaJet1MET_", leadingJets[0].
eta() -
met->begin()->eta());
555 if (!isoMuons.empty()) {
556 if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
557 fill(
"dEtaLep1MET_", isoMuons[0]->
eta() -
met->begin()->eta());
561 if (!isoElecs.empty()) {
562 if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
563 fill(
"dEtaLep1MET_", isoElecs[0]->
eta() -
met->begin()->eta());
569 fill(
"metTC_",
met->begin()->et());
572 fill(
"metPflow_",
met->begin()->et());
586 fill(
"lepMultIso_", isoMuons.size(), isoElecs.size());
589 fill(
"decayChannel_", 0.5);
590 double mass = (isoElecs[0]->p4() + isoMuons[0]->p4()).
mass();
592 fill(
"dEtaL1L2_", isoElecs[0]->
eta() - isoMuons[0]->
eta());
593 fill(
"sumEtaL1L2_", (isoElecs[0]->
eta() + isoMuons[0]->
eta()) / 2);
595 fill(
"elecPt_", isoElecs[0]->
pt());
596 fill(
"muonPt_", isoMuons[0]->
pt());
597 fill(
"lep1Pt_", isoElecs[0]->
pt() > isoMuons[0]->
pt() ? isoElecs[0]->
pt() : isoMuons[0]->
pt());
598 fill(
"lep2Pt_", isoElecs[0]->
pt() > isoMuons[0]->
pt() ? isoMuons[0]->
pt() : isoElecs[0]->
pt());
610 if (!leadingJets.empty())
612 if (leadingJets.size() > 1)
622 fill(
"decayChannel_", 1.5);
623 int charge = isoMuons[0]->charge() * isoMuons[1]->charge();
624 double mass = (isoMuons[0]->p4() + isoMuons[1]->p4()).
mass();
629 fill(
"dEtaL1L2_", isoMuons[0]->
eta() - isoMuons[1]->
eta());
630 fill(
"sumEtaL1L2_", (isoMuons[0]->
eta() + isoMuons[1]->
eta()) / 2);
632 fill(
"muonPt_", isoMuons[0]->
pt());
633 fill(
"muonPt_", isoMuons[1]->
pt());
634 fill(
"lep1Pt_", isoMuons[0]->
pt());
635 fill(
"lep2Pt_", isoMuons[1]->
pt());
647 if (!leadingJets.empty())
649 if (leadingJets.size() > 1)
659 fill(
"decayChannel_", 2.5);
660 int charge = isoElecs[0]->charge() * isoElecs[1]->charge();
661 double mass = (isoElecs[0]->p4() + isoElecs[1]->p4()).
mass();
665 fill(
"dEtaL1L2_", isoElecs[0]->
eta() - isoElecs[1]->
eta());
666 fill(
"sumEtaL1L2_", (isoElecs[0]->
eta() + isoElecs[1]->
eta()) / 2);
668 fill(
"elecPt_", isoElecs[0]->
pt());
669 fill(
"elecPt_", isoElecs[1]->
pt());
670 fill(
"lep1Pt_", isoElecs[0]->
pt());
671 fill(
"lep2Pt_", isoElecs[1]->
pt());
680 if (!leadingJets.empty())
682 if (leadingJets.size() > 1)
693 : vertexSelect_(nullptr),
694 beamspotSelect_(nullptr),
696 ElectronStep(nullptr),
722 sel_ =
cfg.getParameter<std::vector<edm::ParameterSet>>(
"selection");
724 for (
unsigned int i = 0;
i <
sel_.size(); ++
i) {
727 std::make_pair(
sel_.at(
i),
735 if (
type ==
"muons") {
738 if (
type ==
"elecs") {
744 if (
type ==
"jets") {
748 if (
type ==
"jets/pf") {
752 if (
type ==
"jets/calo") {
765 selIt->second.second->book(ibooker);
780 if (
vertex->empty() || !(*vertexSelect_)(
vertex->front()))
792 unsigned int nJetSteps = -1;
794 unsigned int nPFJetSteps = -1;
796 unsigned int nCaloJetSteps = -1;
802 if (
type ==
"empty") {
821 if (
JetSteps[nJetSteps] !=
nullptr) {