12 namespace TopDiLeptonOffline {
38 sources.
getParameter<std::vector<edm::InputTag> >(
"mets"))
117 triggerExtras.
getParameter<std::vector<std::string> >(
"pathsELECMU");
119 triggerExtras.
getParameter<std::vector<std::string> >(
"pathsDIMUON");
162 hists_[
"RunNumb_"] = ibooker.
book1D(
"RunNumber",
"Run Nr.", 1.e4, 1.5e5, 3.e5);
164 hists_[
"invMass_"] = ibooker.
book1D(
"InvMass",
"M(lep1, lep2)", 80, 0., 320.);
167 "log_{10}(M(lep1, lep2))", 80, .1, 2.5);
170 hists_[
"invMassWC_"] = ibooker.
book1D(
"InvMassWC",
"M_{WC}(L1, L2)", 80, 0., 320.);
173 hists_[
"invMassWCLog_"] = ibooker.
book1D(
"InvMassLogWC",
174 "log_{10}(M_{WC})", 80, .1, 2.5);
176 hists_[
"decayChannel_"] = ibooker.
book1D(
"DecayChannel",
"Decay Channel", 3, 0, 3);
179 "Eff(e/#mu paths)", nElecMu, 0., nElecMu);
182 "Mon(e/#mu paths)", nElecMu, 0., nElecMu);
185 "Eff(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
188 "Mon(#mu/#mu paths)", nDiMuon, 0., nDiMuon);
190 hists_[
"lep1Pt_"] = ibooker.
book1D(
"Lep1Pt",
"pt(lep1)", 50, 0., 200.);
192 hists_[
"lep2Pt_"] = ibooker.
book1D(
"Lep2Pt",
"pt(lep2)", 50, 0., 200.);
194 hists_[
"jetMult_"] = ibooker.
book1D(
"JetMult",
"N_{30}(jet)", 21, -0.5, 20.5);
196 hists_[
"metCalo_"] = ibooker.
book1D(
"METCalo",
"MET_{Calo}", 50, 0., 200.);
202 hists_[
"decayChannel_"]->setBinLabel(1,
"#mu e", 1);
203 hists_[
"decayChannel_"]->setBinLabel(2,
"#mu #mu", 1);
204 hists_[
"decayChannel_"]->setBinLabel(3,
"e e", 1);
211 "<#eta>(lep1, lep2)", 100, -5., 5.);
214 "#Delta#eta(lep1,lep2)", 80, -4., 4.);
217 "#Delta#phi(lep1,lep2)", 64, -3.2, 3.2);
219 hists_[
"elecPt_"] = ibooker.
book1D(
"ElecPt",
"pt(e)", 50, 0., 200.);
222 hists_[
"elecRelIso_"] = ibooker.
book1D(
"ElecRelIso",
"Iso_{Rel}(e)", 50, 0., 1.);
224 hists_[
"muonPt_"] = ibooker.
book1D(
"MuonPt",
"pt(#mu)", 50, 0., 200.);
227 "Iso_{Rel}(#mu) (#Delta#beta Corrected)", 50, 0., 1.);
229 hists_[
"jet1Pt_"] = ibooker.
book1D(
"Jet1Pt",
"pt_{L2L3}(jet1)", 60, 0., 300.);
231 hists_[
"jet2Pt_"] = ibooker.
book1D(
"Jet2Pt",
"pt_{L2L3}(jet2)", 60, 0., 300.);
233 hists_[
"metPflow_"] = ibooker.
book1D(
"METPflow",
"MET_{Pflow}", 50, 0., 200.);
235 hists_[
"metTC_"] = ibooker.
book1D(
"METTC",
"MET_{TC}", 50, 0., 200.);
237 hists_[
"muonDelZ_"] = ibooker.
book1D(
"MuonDelZ",
"d_{z}(#mu)", 50, -25., 25.);
240 "d_{xy}(#mu)", 50, -1., 1., 50, -1., 1.);
243 "N_{Iso}(e) vs N_{Iso}(#mu)", 5, 0., 5., 5, 0., 5.);
246 hists_[
"muonDelXY_"]->setAxisTitle(
"x [cm]", 1);
247 hists_[
"muonDelXY_"]->setAxisTitle(
"y [cm]", 2);
249 hists_[
"lepMultIso_"]->setAxisTitle(
"N_{Iso}(#mu)", 1);
250 hists_[
"lepMultIso_"]->setAxisTitle(
"N_{Iso}(elec)", 2);
257 "N_{Iso}(e)", 11, -0.5, 10.5);
260 "N_{Iso}(#mu)", 11, -0.5, 10.5);
263 hists_[
"muonChHadIso_"] = ibooker.
book1D(
"MuonChHadIsoComp",
264 "ChHad_{IsoComponent}(#mu)", 50, 0., 5.);
267 hists_[
"muonNeHadIso_"] = ibooker.
book1D(
"MuonNeHadIsoComp",
268 "NeHad_{IsoComponent}(#mu)", 50, 0., 5.);
272 "Photon_{IsoComponent}(#mu)", 50, 0., 5.);
275 hists_[
"elecChHadIso_"] = ibooker.
book1D(
"ElectronChHadIsoComp",
276 "ChHad_{IsoComponent}(e)", 50, 0., 5.);
279 hists_[
"elecNeHadIso_"] = ibooker.
book1D(
"ElectronNeHadIsoComp",
280 "NeHad_{IsoComponent}(e)", 50, 0., 5.);
283 hists_[
"elecPhIso_"] = ibooker.
book1D(
"ElectronPhIsoComp",
284 "Photon_{IsoComponent}(e)", 50, 0., 5.);
286 hists_[
"jet1Eta_"] = ibooker.
book1D(
"Jet1Eta",
"#eta(jet1)", 30, -5., 5.);
288 hists_[
"jet2Eta_"] = ibooker.
book1D(
"Jet2Eta",
"#eta(jet2)", 30, -5., 5.);
290 hists_[
"jet1PtRaw_"] = ibooker.
book1D(
"Jet1PtRaw",
"pt_{Raw}(jet1)", 60, 0., 300.);
292 hists_[
"jet2PtRaw_"] = ibooker.
book1D(
"Jet2PtRaw",
"pt_{Raw}(jet2)", 60, 0., 300.);
294 hists_[
"dEtaJet1Jet2_"] = ibooker.
book1D(
"DEtaJet1Jet2",
295 "#Delta#eta(jet1,jet2)", 80, -4., 4.);
297 hists_[
"dEtaJet1Lep1_"] = ibooker.
book1D(
"DEtaJet1Lep1",
298 "#Delta#eta(jet1,lep1)", 80, -4., 4.);
301 "#Delta#eta(lep1,MET)", 80, -4., 4.);
304 "#Delta#eta(jet1,MET)", 80, -4., 4.);
306 hists_[
"dPhiJet1Jet2_"] = ibooker.
book1D(
"DPhiJet1Jet2",
307 "#Delta#phi(jet1,jet2)", 64, -3.2, 3.2);
309 hists_[
"dPhiJet1Lep1_"] = ibooker.
book1D(
"DPhiJet1Lep1",
310 "#Delta#phi(jet1,lep1)", 64, -3.2, 3.2);
313 "#Delta#phi(lep1,MET)", 64, -3.2, 3.2);
316 "#Delta#phi(jet1,MET)", 64, -3.2, 3.2);
318 hists_[
"diMuonLogger_"] = ibooker.
book2D(
"DiMuonLogger",
319 "Logged DiMuon Events", 8, 0., 8., 10, 0., 10.);
321 hists_[
"diElecLogger_"] = ibooker.
book2D(
"DiElecLogger",
322 "Logged DiElec Events", 8, 0., 8., 10, 0., 10.);
324 hists_[
"elecMuLogger_"] = ibooker.
book2D(
"ElecMuLogger",
325 "Logged ElecMu Events", 8, 0., 8., 10, 0., 10.);
354 fill(
"InstLumi_", dummy);
364 std::vector<const reco::PFCandidate*> isoMuons;
372 muonit != muons->end(); ++muonit) {
374 if (muonit->muonRef().isNull())
continue;
377 if (muon->innerTrack().
isNull())
continue;
379 if (muon->isGlobalMuon()) {
380 fill(
"muonDelZ_", muon->innerTrack()->vz());
381 fill(
"muonDelXY_", muon->innerTrack()->vx(), muon->innerTrack()->vy());
386 double chHadPt = muon->pfIsolationR04().sumChargedHadronPt;
387 double neHadEt = muon->pfIsolationR04().sumNeutralHadronEt;
388 double phoEt = muon->pfIsolationR04().sumPhotonEt;
392 std::max(0., neHadEt + phoEt - 0.5 * muon->pfIsolationR04().sumPUPt)) /
395 fill(
"muonRelIso_", pfRelIso);
397 fill(
"muonChHadIso_", chHadPt);
398 fill(
"muonNeHadIso_", neHadEt);
399 fill(
"muonPhIso_", phoEt);
406 fill(
"muonMultIso_", isoMuons.size());
417 std::vector<const reco::PFCandidate*> isoElecs;
426 elec != elecs->end(); ++elec) {
427 if (elec->gsfElectronRef().isNull()) {
436 double el_ChHadIso = gsf_el->pfIsolationVariables().sumChargedHadronPt;
437 double el_NeHadIso = gsf_el->pfIsolationVariables().sumNeutralHadronEt;
438 double el_PhIso = gsf_el->pfIsolationVariables().sumPhotonEt;
441 std::max(0., el_NeHadIso + el_PhIso -
442 0.5 * gsf_el->pfIsolationVariables().sumPUPt)) /
444 fill(
"elecRelIso_", el_pfRelIso);
445 fill(
"elecChHadIso_", el_ChHadIso);
446 fill(
"elecNeHadIso_", el_NeHadIso);
447 fill(
"elecPhIso_", el_PhIso);
452 fill(
"elecMultIso_", isoElecs.size());
471 <<
"-----------------------------------------------------------------"
472 "-------------------- \n"
473 <<
" No JetCorrectionsRecord available from EventSetup: "
475 <<
" - Jets will not be corrected. "
477 <<
" - If you want to change this add the following lines to your "
481 <<
" ## load jet corrections "
484 "process.load(\"JetMETCorrections.Configuration."
485 "JetCorrectionServicesAllAlgos_cff\") \n"
486 <<
" process.prefer(\"ak5CaloL2L3\") "
490 <<
"-----------------------------------------------------------------"
491 "-------------------- \n";
495 unsigned int mult = 0;
497 std::vector<reco::Jet> leadingJets;
507 jet != jets->end(); ++
jet) {
508 unsigned int idx =
jet - jets->begin();
510 dynamic_cast<const reco::CaloJet*>(jets->refAt(idx).get())) {
511 if (!(*
jetIDSelect_)((*jetID)[jets->refAt(idx)]))
continue;
514 if (dynamic_cast<const reco::CaloJet*>(&*
jet)) {
518 if (!jetSelect(sel)) {
521 }
else if (dynamic_cast<const reco::PFJet*>(&*
jet)) {
525 if (!jetSelect(sel))
continue;
530 if (!jetSelect(sel))
continue;
534 for (std::vector<const reco::PFCandidate*>::const_iterator elec =
536 elec != isoElecs.end(); ++elec) {
548 monitorJet.
scaleEnergy(corrector ? corrector->correction(*
jet) : 1.);
551 leadingJets.push_back(monitorJet);
552 fill(
"jet1Pt_", monitorJet.
pt());
557 leadingJets.push_back(monitorJet);
558 fill(
"jet2Pt_", monitorJet.
pt());
563 if (leadingJets.size() > 1) {
564 fill(
"dEtaJet1Jet2_", leadingJets[0].
eta() - leadingJets[1].
eta());
565 fill(
"dPhiJet1Jet2_",
567 if (!isoMuons.empty()) {
568 if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
569 fill(
"dEtaJet1Lep1_", isoMuons[0]->
eta() - leadingJets[0].
eta());
570 fill(
"dPhiJet1Lep1_",
574 if (!isoElecs.empty()) {
575 if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
576 fill(
"dEtaJet1Lep1_", isoElecs[0]->
eta() - leadingJets[0].
eta());
577 fill(
"dPhiJet1Lep1_",
582 fill(
"jetMult_", mult);
595 met_ =
mets_.begin();
596 met_ !=
mets_.end(); ++met_) {
601 if (met->begin() != met->end()) {
602 unsigned int idx = met_ -
mets_.begin();
604 caloMET = *met->begin();
605 fill(
"metCalo_", met->begin()->et());
606 if (!leadingJets.empty()) {
607 fill(
"dEtaJet1MET_", leadingJets[0].
eta() - met->begin()->eta());
611 if (!isoMuons.empty()) {
612 if (isoElecs.empty() || isoMuons[0]->pt() > isoElecs[0]->pt()) {
613 fill(
"dEtaLep1MET_", isoMuons[0]->
eta() - met->begin()->eta());
618 if (!isoElecs.empty()) {
619 if (isoMuons.empty() || isoElecs[0]->pt() > isoMuons[0]->pt()) {
620 fill(
"dEtaLep1MET_", isoElecs[0]->
eta() - met->begin()->eta());
627 fill(
"metTC_", met->begin()->et());
630 fill(
"metPflow_", met->begin()->et());
644 fill(
"lepMultIso_", isoMuons.size(), isoElecs.size());
647 fill(
"decayChannel_", 0.5);
648 double mass = (isoElecs[0]->p4() + isoMuons[0]->p4()).mass();
652 fill(
"dEtaL1L2_", isoElecs[0]->
eta() - isoMuons[0]->
eta());
653 fill(
"sumEtaL1L2_", (isoElecs[0]->
eta() + isoMuons[0]->
eta()) / 2);
655 fill(
"elecPt_", isoElecs[0]->
pt());
656 fill(
"muonPt_", isoMuons[0]->
pt());
657 fill(
"lep1Pt_", isoElecs[0]->
pt() > isoMuons[0]->
pt()
659 : isoMuons[0]->
pt());
660 fill(
"lep2Pt_", isoElecs[0]->
pt() > isoMuons[0]->
pt()
662 : isoElecs[0]->
pt());
677 if (leadingJets.size() > 0)
679 if (leadingJets.size() > 1)
689 fill(
"decayChannel_", 1.5);
690 int charge = isoMuons[0]->charge() * isoMuons[1]->charge();
691 double mass = (isoMuons[0]->p4() + isoMuons[1]->p4()).mass();
693 fill(charge < 0 ?
"invMass_" :
"invMassWC_", mass);
694 fill(charge < 0 ?
"invMassLog_" :
"invMassWCLog_", log10(mass));
697 fill(
"dEtaL1L2_", isoMuons[0]->
eta() - isoMuons[1]->
eta());
698 fill(
"sumEtaL1L2_", (isoMuons[0]->
eta() + isoMuons[1]->
eta()) / 2);
700 fill(
"muonPt_", isoMuons[0]->
pt());
701 fill(
"muonPt_", isoMuons[1]->
pt());
702 fill(
"lep1Pt_", isoMuons[0]->
pt());
703 fill(
"lep2Pt_", isoMuons[1]->
pt());
718 if (leadingJets.size() > 0)
720 if (leadingJets.size() > 1)
730 fill(
"decayChannel_", 2.5);
731 int charge = isoElecs[0]->charge() * isoElecs[1]->charge();
732 double mass = (isoElecs[0]->p4() + isoElecs[1]->p4()).mass();
733 fill(charge < 0 ?
"invMass_" :
"invMassWC_", mass);
734 fill(charge < 0 ?
"invMassLog_" :
"invMassWCLog_", log10(mass));
737 fill(
"dEtaL1L2_", isoElecs[0]->
eta() - isoElecs[1]->
eta());
738 fill(
"sumEtaL1L2_", (isoElecs[0]->
eta() + isoElecs[1]->
eta()) / 2);
740 fill(
"elecPt_", isoElecs[0]->
pt());
741 fill(
"elecPt_", isoElecs[1]->
pt());
742 fill(
"lep1Pt_", isoElecs[0]->
pt());
743 fill(
"lep2Pt_", isoElecs[1]->
pt());
755 if (leadingJets.size() > 0)
757 if (leadingJets.size() > 1)
790 vertex_ = consumes<std::vector<reco::Vertex> >(
806 cfg.
getParameter<std::vector<edm::ParameterSet> >(
"selection");
808 for (
unsigned int i = 0;
i <
sel_.size(); ++
i) {
812 std::unique_ptr<TopDiLeptonOffline::MonitorEnsemble>(
817 for (std::vector<std::string>::const_iterator selIt =
selectionOrder_.begin();
821 if (
type ==
"muons") {
825 if (
type ==
"elecs") {
833 if (
type ==
"jets") {
838 if (
type ==
"jets/pf") {
843 if (
type ==
"jets/calo") {
860 selIt->second.second->book(ibooker);
873 if (vertex->empty() || !(*vertexSelect_)(vertex->front()))
return;
880 unsigned int passed = 0;
882 unsigned int nJetSteps = -1;
884 unsigned int nPFJetSteps = -1;
886 unsigned int nCaloJetSteps = -1;
888 for (std::vector<std::string>::const_iterator selIt =
selectionOrder_.begin();
892 if (
type ==
"empty") {
T getParameter(std::string const &) const
std::string selectionStep(const std::string &label)
std::vector< std::string > selectionOrder_
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Jets made from CaloTowers.
virtual void scaleEnergy(double fScale)
scale energy of the jet
std::unique_ptr< SelectionStep< reco::Vertex > > PvStep
Level verbosity_
verbosity level for booking
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< std::unique_ptr< SelectionStep< reco::CaloJet > > > CaloJetSteps
Base class for all types of Jets.
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
void loggerBinLabels(std::string hist)
set labels for event logging histograms
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecIso_
extra isolation criterion on electron
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::vector< edm::ParameterSet > sel_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
Jets made from PFObjects.
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
LuminosityBlockNumber_t luminosityBlock() const
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
std::vector< std::unique_ptr< SelectionStep< reco::Jet > > > JetSteps
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
std::unique_ptr< SelectionStep< reco::PFCandidate > > MuonStep
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
double lowerEdge_
mass window upper and lower edge
MonitorElement * book1D(Args &&...args)
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::vector< std::string > elecMuPaths_
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate > > elecSelect_
extra selection on electrons
std::unique_ptr< SelectionStep< reco::MET > > METStep
std::string jetCorrector_
jetCorrector
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
bool isNull() const
Checks for null.
TopDiLeptonOfflineDQM(const edm::ParameterSet &cfg)
default constructor
std::unique_ptr< SelectionStep< reco::PFCandidate > > ElectronStep
double deltaPhi(double phi1, double phi2)
EventAuxiliary const & eventAuxiliary() const
int elecMuLogged_
number of logged interesting events
void setCurrentFolder(const std::string &fullpath)
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
std::string label_
instance label
MonitorElement * book2D(Args &&...args)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::map< std::string, MonitorElement * > hists_
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
void book(DQMStore::IBooker &ibooker)
book histograms in subdirectory directory
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< TopDiLeptonOffline::MonitorEnsemble > > > selection_
Geom::Phi< T > phi() const
Templated helper class to allow a selection on a certain object collection.
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonSelect_
extra selection on muons
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< std::string > triggerPaths_
trigger paths
static EventSetupRecordKey makeKey()
virtual double et() const final
transverse energy
bool isUninitialized() const
std::string objectType(const std::string &label)
DecayChannel decayChannel(const std::vector< const reco::PFCandidate * > &muons, const std::vector< const reco::PFCandidate * > &elecs) const
determine dileptonic decay channel
std::unique_ptr< StringCutObjectSelector< reco::PFCandidate, true > > muonIso_
extra isolation criterion on muon
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
EventNumber_t event() const
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
virtual double pt() const final
transverse momentum
std::vector< std::unique_ptr< SelectionStep< reco::PFJet > > > PFJetSteps