7 #include "TLorentzVector.h"
23 triggerResults_ = consumes<TriggerResults>(
25 hltPaths_ = ps.
getParameter<vector<string> >(
"hltPaths");
26 hltPaths_sig_ = ps.
getParameter<vector<string> >(
"hltPaths_sig");
27 hltPaths_trig_ = ps.
getParameter<vector<string> >(
"hltPaths_trig");
29 vertex_ = consumes<reco::VertexCollection>(
35 muons_ = consumes<reco::MuonCollection>(
41 elecs_ = consumes<reco::GsfElectronCollection>(
48 MassWindow_up_ = ps.
getParameter<
double>(
"MassWindow_up");
49 MassWindow_down_ = ps.
getParameter<
double>(
"MassWindow_down");
51 for (
int i = 0;
i < 100; ++
i) {
62 const char*
fileName = outputFile_.c_str();
93 MuIso_CombRelIso03_ = 0;
96 ElecIso_CombRelIso_ = 0;
117 dbe_->setCurrentFolder(moduleName_);
119 Events_ =
dbe_->book1D(
"00_Events",
"Isolated dilepton events", 5, 0., 5.);
120 Events_->setBinLabel(2,
"#mu #mu", 1);
121 Events_->setBinLabel(3,
"#mu e", 1);
122 Events_->setBinLabel(4,
"e e", 1);
125 dbe_->book1D(
"01_Trigs",
"Fired muon/electron triggers", 15, 0., 15.);
127 dbe_->book1D(
"02_TriggerEff",
"HL Trigger Efficiencies", 10, 0., 10.);
128 TriggerEff_->setTitle(
129 "HL Trigger Efficiencies #epsilon_{signal} = #frac{[signal] && "
130 "[control]}{[control]}");
131 Ntracks_ =
dbe_->book1D(
"Ntracks",
"Number of tracks", 50, 0., 50.);
133 Nmuons_ =
dbe_->book1D(
"03_Nmuons",
"Number of muons", 20, 0., 10.);
135 dbe_->book1D(
"04_Nmuons_iso",
"Number of isolated muons", 20, 0., 10.);
136 Nmuons_charge_ =
dbe_->book1D(
"Nmuons_charge",
137 "Number of muons * moun charge", 19, -10., 10.);
138 VxVy_muons_ =
dbe_->book2D(
"VxVy_muons",
"Vertex x-y-positon (global)", 40,
139 -1., 1., 40, -1., 1.);
141 dbe_->book1D(
"Vz_muons",
"Vertex z-positon (global)", 40, -20., 20.);
142 pT_muons_ =
dbe_->book1D(
"pT_muons",
"P_T of muons", 40, 0., 200.);
143 eta_muons_ =
dbe_->book1D(
"eta_muons",
"Eta of muons", 50, -5., 5.);
144 phi_muons_ =
dbe_->book1D(
"phi_muons",
"Phi of muons", 40, -4., 4.);
146 Nelecs_ =
dbe_->book1D(
"05_Nelecs",
"Number of electrons", 20, 0., 10.);
147 Nelecs_iso_ =
dbe_->book1D(
"06_Nelecs_iso",
"Number of isolated electrons",
149 Nelecs_charge_ =
dbe_->book1D(
"Nelecs_charge",
150 "Number of elecs * elec charge", 19, -10., 10.);
152 dbe_->book1D(
"HoverE_elecs",
"Hadronic over Ecal energy", 50, 0., 1.);
153 pT_elecs_ =
dbe_->book1D(
"pT_elecs",
"P_T of electrons", 40, 0., 200.);
154 eta_elecs_ =
dbe_->book1D(
"eta_elecs",
"Eta of electrons", 50, -5., 5.);
155 phi_elecs_ =
dbe_->book1D(
"phi_elecs",
"Phi of electrons", 40, -4., 4.);
157 MuIso_emEt03_ =
dbe_->book1D(
"MuIso_emEt03",
"Muon emEt03", 20, 0., 20.);
158 MuIso_hadEt03_ =
dbe_->book1D(
"MuIso_hadEt03",
"Muon hadEt03", 20, 0., 20.);
159 MuIso_hoEt03_ =
dbe_->book1D(
"MuIso_hoEt03",
"Muon hoEt03", 20, 0., 20.);
160 MuIso_nJets03_ =
dbe_->book1D(
"MuIso_nJets03",
"Muon nJets03", 10, 0., 10.);
162 dbe_->book1D(
"MuIso_nTracks03",
"Muon nTracks03", 20, 0., 20.);
163 MuIso_sumPt03_ =
dbe_->book1D(
"MuIso_sumPt03",
"Muon sumPt03", 20, 0., 40.);
164 MuIso_CombRelIso03_ =
165 dbe_->book1D(
"07_MuIso_CombRelIso03",
"Muon CombRelIso03", 20, 0., 1.);
167 ElecIso_cal_ =
dbe_->book1D(
"ElecIso_cal",
"Electron Iso_cal", 21, -1., 20.);
168 ElecIso_trk_ =
dbe_->book1D(
"ElecIso_trk",
"Electron Iso_trk", 21, -2., 40.);
169 ElecIso_CombRelIso_ =
170 dbe_->book1D(
"08_ElecIso_CombRelIso",
"Electron CombRelIso", 20, 0., 1.);
172 const int nbins = 200;
177 float bins[nbins + 1];
181 double log = logmin + (logmax - logmin) *
i / nbins;
185 dimassRC_ =
dbe_->book1D(
"09_dimassRC",
"Dilepton mass RC", 50, 0., 200.);
186 dimassWC_ =
dbe_->book1D(
"11_dimassWC",
"Dilepton mass WC", 50, 0., 200.);
188 dbe_->book1D(
"10_dimassRC_LOGX",
"Dilepton mass RC LOG", nbins, &bins[0]);
190 dbe_->book1D(
"12_dimassWC_LOGX",
"Dilepton mass WC LOG", nbins, &bins[0]);
192 dbe_->book1D(
"dimassRC_LOG10",
"Dilepton mass RC LOG", 50, 0., 2.5);
194 dbe_->book1D(
"dimassWC_LOG10",
"Dilepton mass WC LOG", 50, 0., 2.5);
197 dbe_->book1D(
"13_D_eta_muons",
"#Delta eta_muons", 20, -5., 5.);
199 dbe_->book1D(
"14_D_phi_muons",
"#Delta phi_muons", 20, -5., 5.);
200 D_eta_elecs_ =
dbe_->book1D(
"D_eta_elecs",
"#Delta eta_elecs", 20, -5., 5.);
201 D_phi_elecs_ =
dbe_->book1D(
"D_phi_elecs",
"#Delta phi_elecs", 20, -5., 5.);
202 D_eta_lepts_ =
dbe_->book1D(
"D_eta_lepts",
"#Delta eta_lepts", 20, -5., 5.);
203 D_phi_lepts_ =
dbe_->book1D(
"D_phi_lepts",
"#Delta phi_lepts", 20, -5., 5.);
216 const int N_TriggerPaths = hltPaths_.size();
217 const int N_SignalPaths = hltPaths_sig_.size();
218 const int N_ControlPaths = hltPaths_trig_.size();
220 bool Fired_Signal_Trigger[100] = {
false};
221 bool Fired_Control_Trigger[100] = {
false};
232 double DilepMass = 0.;
234 double vertex_X = 100.;
235 double vertex_Y = 100.;
236 double vertex_Z = 100.;
249 int numberTracks = primaryVertex.
tracksSize();
251 bool fake = primaryVertex.
isFake();
253 Ntracks_->Fill(numberTracks);
255 if (!fake && numberTracks > 3) {
257 vertex_X = primaryVertex.
x();
258 vertex_Y = primaryVertex.
y();
259 vertex_Z = primaryVertex.
z();
272 int N_Triggers = trigResults->size();
276 for (
int i_Trig = 0; i_Trig < N_Triggers; ++i_Trig) {
278 if (trigResults.
product()->accept(i_Trig)) {
282 for (
int i = 0;
i < N_TriggerPaths;
i++) {
287 Trigs_->setBinLabel(
i + 1, hltPaths_[
i], 1);
293 for (
int j = 0;
j < N_SignalPaths; ++
j) {
296 Fired_Signal_Trigger[
j] =
true;
299 for (
int k = 0;
k < N_ControlPaths; ++
k) {
302 Fired_Control_Trigger[
k] =
true;
315 reco::MuonCollection::const_iterator
muon;
319 Nmuons_->Fill(muons->size());
321 N_leptons = N_leptons + muons->size();
323 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
325 float N_muons = muons->size();
326 float Q_muon = muon->charge();
328 Nmuons_charge_->Fill(N_muons * Q_muon);
330 double track_X = 100.;
331 double track_Y = 100.;
332 double track_Z = 100.;
334 if (muon->isGlobalMuon()) {
338 track_X = track->vx();
339 track_Y = track->vy();
340 track_Z = track->vz();
342 VxVy_muons_->Fill(track_X, track_Y);
343 Vz_muons_->Fill(track_Z);
348 if (track_X > vertex_X_cut_)
continue;
349 if (track_Y > vertex_Y_cut_)
continue;
350 if (track_Z > vertex_Z_cut_)
continue;
351 if (muon->pt() < muon_pT_cut_)
continue;
352 if (
abs(muon->eta()) > muon_eta_cut_)
continue;
356 double muonCombRelIso = 1.;
358 if (muon->pt() != 0.)
363 MuIso_CombRelIso03_->Fill(muonCombRelIso);
365 MuIso_emEt03_->Fill(muIso03.
emEt);
366 MuIso_hadEt03_->Fill(muIso03.
hadEt);
367 MuIso_hoEt03_->Fill(muIso03.
hoEt);
368 MuIso_nJets03_->Fill(muIso03.
nJets);
369 MuIso_nTracks03_->Fill(muIso03.
nTracks);
370 MuIso_sumPt03_->Fill(muIso03.
sumPt);
372 if (muonCombRelIso < muon_iso_cut_) ++N_iso_mu;
375 Nmuons_iso_->Fill(N_iso_mu);
385 reco::GsfElectronCollection::const_iterator elec;
389 Nelecs_->Fill(elecs->size());
391 N_leptons = N_leptons + elecs->size();
393 for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
395 float N_elecs = elecs->size();
396 float Q_elec = elec->charge();
397 float HoverE = elec->hcalOverEcal();
399 HoverE_elecs_->Fill(HoverE);
401 Nelecs_charge_->Fill(N_elecs * Q_elec);
403 double track_X = 100.;
404 double track_Y = 100.;
405 double track_Z = 100.;
409 track_X = track->vx();
410 track_Y = track->vy();
411 track_Z = track->vz();
415 if (track_X > vertex_X_cut_)
continue;
416 if (track_Y > vertex_Y_cut_)
continue;
417 if (track_Z > vertex_Z_cut_)
continue;
418 if (elec->pt() < elec_pT_cut_)
continue;
419 if (
abs(elec->eta()) > elec_eta_cut_)
continue;
420 if (HoverE > elec_emf_cut_)
continue;
423 elec->dr03IsolationVariables();
425 double elecCombRelIso = 1.;
427 if (elec->et() != 0.)
432 ElecIso_CombRelIso_->Fill(elecCombRelIso);
435 ElecIso_trk_->Fill(elecIso.
tkSumPt);
437 if (elecCombRelIso < elec_iso_cut_) ++N_iso_el;
440 Nelecs_iso_->Fill(N_iso_el);
451 if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
452 vertex_Z < vertex_Z_cut_) {
458 reco::MuonCollection::const_reference mu1 = muons->at(0);
459 reco::MuonCollection::const_reference mu2 = muons->at(1);
462 sqrt((mu1.energy() + mu2.energy()) * (mu1.energy() + mu2.energy()) -
463 (mu1.px() + mu2.px()) * (mu1.px() + mu2.px()) -
464 (mu1.py() + mu2.py()) * (mu1.py() + mu2.py()) -
465 (mu1.pz() + mu2.pz()) * (mu1.pz() + mu2.pz()));
469 if (mu1.charge() * mu2.charge() < 0.) {
471 dimassRC_LOG10_->Fill(log10(DilepMass));
472 dimassRC_->Fill(DilepMass);
473 dimassRC_LOGX_->Fill(DilepMass);
475 if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
477 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
479 pT_muons_->Fill(muon->pt());
480 eta_muons_->Fill(muon->eta());
481 phi_muons_->Fill(muon->phi());
484 D_eta_muons_->Fill(mu1.eta() - mu2.eta());
485 D_phi_muons_->Fill(mu1.phi() - mu2.phi());
489 if (mu1.isGlobalMuon() && mu2.isGlobalMuon()) {
491 outfile <<
"--------------------"
493 outfile <<
" Run : " << N_run <<
"\n";
494 outfile <<
" Event : " << N_event <<
"\n";
495 outfile <<
"LumiBlock : " << N_lumi <<
"\n";
498 outfile <<
"--------------------"
500 outfile <<
"DilepMass : " << DilepMass <<
"\n";
501 outfile <<
"Mu1 Pt : " << mu1.pt() <<
"\n";
502 outfile <<
"Mu1 Eta : " << mu1.eta() <<
"\n";
503 outfile <<
"Mu1 Phi : " << mu1.phi() <<
"\n";
504 outfile <<
"Mu2 Pt : " << mu2.pt() <<
"\n";
505 outfile <<
"Mu2 Eta : " << mu2.eta() <<
"\n";
506 outfile <<
"Mu2 Phi : " << mu2.phi() <<
"\n";
507 outfile <<
"--------------------"
514 for (
int k = 0;
k < N_SignalPaths; ++
k) {
516 if (Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k]) ++N_sig[
k];
518 if (Fired_Control_Trigger[k]) ++N_trig[
k];
521 Eff[
k] = N_sig[
k] /
static_cast<float>(N_trig[
k]);
523 TriggerEff_->setBinContent(k + 1, Eff[k]);
524 TriggerEff_->setBinLabel(k + 1,
525 "#frac{[" + hltPaths_sig_[k] +
"]}{vs. [" +
526 hltPaths_trig_[k] +
"]}",
534 if (mu1.charge() * mu2.charge() > 0.) {
536 dimassWC_LOG10_->Fill(log10(DilepMass));
537 dimassWC_->Fill(DilepMass);
538 dimassWC_LOGX_->Fill(DilepMass);
542 if (mu1.isGlobalMuon() && mu2.isGlobalMuon()) {
544 outfile <<
"---------------------"
546 outfile <<
" Run : " << N_run <<
"\n";
547 outfile <<
" Event : " << N_event <<
"\n";
548 outfile <<
"LumiBlock : " << N_lumi <<
"\n";
551 outfile <<
"---------------------"
553 outfile <<
"DilepMass : " << DilepMass <<
"\n";
554 outfile <<
"Mu1 Pt : " << mu1.pt() <<
"\n";
555 outfile <<
"Mu1 Eta : " << mu1.eta() <<
"\n";
556 outfile <<
"Mu1 Phi : " << mu1.phi() <<
"\n";
557 outfile <<
"Mu2 Pt : " << mu2.pt() <<
"\n";
558 outfile <<
"Mu2 Eta : " << mu2.eta() <<
"\n";
559 outfile <<
"Mu2 Phi : " << mu2.phi() <<
"\n";
560 outfile <<
"---------------------"
572 if (N_iso_el > 0 && N_iso_mu > 0) {
576 if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
577 vertex_Z < vertex_Z_cut_) {
583 reco::MuonCollection::const_reference mu1 = muons->at(0);
584 reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
587 sqrt((mu1.energy() + el1.energy()) * (mu1.energy() + el1.energy()) -
588 (mu1.px() + el1.px()) * (mu1.px() + el1.px()) -
589 (mu1.py() + el1.py()) * (mu1.py() + el1.py()) -
590 (mu1.pz() + el1.pz()) * (mu1.pz() + el1.pz()));
594 if (mu1.charge() * el1.charge() < 0.) {
596 dimassRC_LOG10_->Fill(log10(DilepMass));
597 dimassRC_->Fill(DilepMass);
598 dimassRC_LOGX_->Fill(DilepMass);
600 if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
602 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
604 pT_muons_->Fill(muon->pt());
605 eta_muons_->Fill(muon->eta());
606 phi_muons_->Fill(muon->phi());
609 for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
611 pT_elecs_->Fill(elec->pt());
612 eta_elecs_->Fill(elec->eta());
613 phi_elecs_->Fill(elec->phi());
616 D_eta_lepts_->Fill(mu1.eta() - el1.eta());
617 D_phi_lepts_->Fill(mu1.phi() - el1.phi());
621 if (mu1.isGlobalMuon() && el1.isElectron()) {
623 outfile <<
"--------------------"
625 outfile <<
" Run : " << N_run <<
"\n";
626 outfile <<
" Event : " << N_event <<
"\n";
627 outfile <<
"LumiBlock : " << N_lumi <<
"\n";
630 outfile <<
"--------------------"
632 outfile <<
"DilepMass : " << DilepMass <<
"\n";
633 outfile <<
"Mu1 Pt : " << mu1.pt() <<
"\n";
634 outfile <<
"Mu1 Eta : " << mu1.eta() <<
"\n";
635 outfile <<
"Mu1 Phi : " << mu1.phi() <<
"\n";
636 outfile <<
"El1 Pt : " << el1.pt() <<
"\n";
637 outfile <<
"El1 Eta : " << el1.eta() <<
"\n";
638 outfile <<
"El1 Phi : " << el1.phi() <<
"\n";
639 outfile <<
"--------------------"
646 for (
int k = 0;
k < N_SignalPaths; ++
k) {
648 if (Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k]) ++N_sig[
k];
650 if (Fired_Control_Trigger[k]) ++N_trig[
k];
653 Eff[
k] = N_sig[
k] /
static_cast<float>(N_trig[
k]);
655 TriggerEff_->setBinContent(k + 1, Eff[k]);
656 TriggerEff_->setBinLabel(k + 1,
657 "#frac{[" + hltPaths_sig_[k] +
"]}{vs. [" +
658 hltPaths_trig_[k] +
"]}",
666 if (mu1.charge() * el1.charge() > 0.) {
668 dimassWC_LOG10_->Fill(log10(DilepMass));
669 dimassWC_->Fill(DilepMass);
670 dimassWC_LOGX_->Fill(DilepMass);
683 if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
684 vertex_Z < vertex_Z_cut_) {
690 reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
691 reco::GsfElectronCollection::const_reference el2 = elecs->at(1);
694 sqrt((el1.energy() + el2.energy()) * (el1.energy() + el2.energy()) -
695 (el1.px() + el2.px()) * (el1.px() + el2.px()) -
696 (el1.py() + el2.py()) * (el1.py() + el2.py()) -
697 (el1.pz() + el2.pz()) * (el1.pz() + el2.pz()));
701 if (el1.charge() * el2.charge() < 0.) {
703 dimassRC_LOG10_->Fill(log10(DilepMass));
704 dimassRC_->Fill(DilepMass);
705 dimassRC_LOGX_->Fill(DilepMass);
707 if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
709 for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
711 pT_elecs_->Fill(elec->pt());
712 eta_elecs_->Fill(elec->eta());
713 phi_elecs_->Fill(elec->phi());
716 D_eta_elecs_->Fill(el1.eta() - el2.eta());
717 D_phi_elecs_->Fill(el1.phi() - el2.phi());
721 if (el1.isElectron() && el2.isElectron()) {
723 outfile <<
"--------------------"
725 outfile <<
" Run : " << N_run <<
"\n";
726 outfile <<
" Event : " << N_event <<
"\n";
727 outfile <<
"LumiBlock : " << N_lumi <<
"\n";
730 outfile <<
"--------------------"
732 outfile <<
"DilepMass : " << DilepMass <<
"\n";
733 outfile <<
"El1 Pt : " << el1.pt() <<
"\n";
734 outfile <<
"El1 Eta : " << el1.eta() <<
"\n";
735 outfile <<
"El1 Phi : " << el1.phi() <<
"\n";
736 outfile <<
"El2 Pt : " << el2.pt() <<
"\n";
737 outfile <<
"El2 Eta : " << el2.eta() <<
"\n";
738 outfile <<
"El2 Phi : " << el2.phi() <<
"\n";
739 outfile <<
"--------------------"
746 for (
int k = 0;
k < N_SignalPaths; ++
k) {
748 if (Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k]) ++N_sig[
k];
750 if (Fired_Control_Trigger[k]) ++N_trig[
k];
753 Eff[
k] = N_sig[
k] /
static_cast<float>(N_trig[
k]);
755 TriggerEff_->setBinContent(k + 1, Eff[k]);
756 TriggerEff_->setBinLabel(k + 1,
757 "#frac{[" + hltPaths_sig_[k] +
"]}{vs. [" +
758 hltPaths_trig_[k] +
"]}",
766 if (el1.charge() * el2.charge() > 0.) {
768 dimassWC_LOG10_->Fill(log10(DilepMass));
769 dimassWC_->Fill(DilepMass);
770 dimassWC_LOGX_->Fill(DilepMass);
781 if (fileOutput_)
outfile.close();
T getParameter(std::string const &) const
static AlgebraicMatrix initialize()
T getUntrackedParameter(std::string const &, T const &) const
void endRun(const edm::Run &, const edm::EventSetup &)
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
float sumPt
sum-pt of tracks
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double y() const
y coordinate
unsigned long long EventNumber_t
edm::LuminosityBlockNumber_t luminosityBlock() const
float hcalDepth1TowerSumEt
TopDiLeptonDQM(const edm::ParameterSet &)
int nJets
number of jets in the cone
Abs< T >::type abs(const T &t)
double z() const
y coordinate
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
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int nTracks
number of tracks in the cone (excluding veto region)
double x() const
x coordinate
T const * product() const
std::string const & triggerName(unsigned int index) const
Power< A, B >::type pow(const A &a, const B &b)
size_t tracksSize() const
number of tracks
void beginRun(const edm::Run &, const edm::EventSetup &)