7 #include "TLorentzVector.h"
22 triggerResults_ = consumes<TriggerResults>(
24 hltPaths_ = ps.
getParameter<vector<string> >(
"hltPaths");
25 hltPaths_sig_ = ps.
getParameter<vector<string> >(
"hltPaths_sig");
26 hltPaths_trig_ = ps.
getParameter<vector<string> >(
"hltPaths_trig");
28 vertex_ = consumes<reco::VertexCollection>(
34 muons_ = consumes<reco::MuonCollection>(
40 elecs_ = consumes<reco::GsfElectronCollection>(
47 MassWindow_up_ = ps.
getParameter<
double>(
"MassWindow_up");
48 MassWindow_down_ = ps.
getParameter<
double>(
"MassWindow_down");
50 for (
int i = 0;
i < 100; ++
i) {
61 const char*
fileName = outputFile_.c_str();
92 MuIso_CombRelIso03_ = 0;
95 ElecIso_CombRelIso_ = 0;
116 dbe_->setCurrentFolder(moduleName_);
118 Events_ =
dbe_->book1D(
"00_Events",
"Isolated dilepton events", 5, 0., 5.);
119 Events_->setBinLabel(2,
"#mu #mu", 1);
120 Events_->setBinLabel(3,
"#mu e", 1);
121 Events_->setBinLabel(4,
"e e", 1);
124 dbe_->book1D(
"01_Trigs",
"Fired muon/electron triggers", 15, 0., 15.);
126 dbe_->book1D(
"02_TriggerEff",
"HL Trigger Efficiencies", 10, 0., 10.);
127 TriggerEff_->setTitle(
128 "HL Trigger Efficiencies #epsilon_{signal} = #frac{[signal] && "
129 "[control]}{[control]}");
130 Ntracks_ =
dbe_->book1D(
"Ntracks",
"Number of tracks", 50, 0., 50.);
132 Nmuons_ =
dbe_->book1D(
"03_Nmuons",
"Number of muons", 20, 0., 10.);
134 dbe_->book1D(
"04_Nmuons_iso",
"Number of isolated muons", 20, 0., 10.);
135 Nmuons_charge_ =
dbe_->book1D(
"Nmuons_charge",
136 "Number of muons * moun charge", 19, -10., 10.);
137 VxVy_muons_ =
dbe_->book2D(
"VxVy_muons",
"Vertex x-y-positon (global)", 40,
138 -1., 1., 40, -1., 1.);
140 dbe_->book1D(
"Vz_muons",
"Vertex z-positon (global)", 40, -20., 20.);
141 pT_muons_ =
dbe_->book1D(
"pT_muons",
"P_T of muons", 40, 0., 200.);
142 eta_muons_ =
dbe_->book1D(
"eta_muons",
"Eta of muons", 50, -5., 5.);
143 phi_muons_ =
dbe_->book1D(
"phi_muons",
"Phi of muons", 40, -4., 4.);
145 Nelecs_ =
dbe_->book1D(
"05_Nelecs",
"Number of electrons", 20, 0., 10.);
146 Nelecs_iso_ =
dbe_->book1D(
"06_Nelecs_iso",
"Number of isolated electrons",
148 Nelecs_charge_ =
dbe_->book1D(
"Nelecs_charge",
149 "Number of elecs * elec charge", 19, -10., 10.);
151 dbe_->book1D(
"HoverE_elecs",
"Hadronic over Ecal energy", 50, 0., 1.);
152 pT_elecs_ =
dbe_->book1D(
"pT_elecs",
"P_T of electrons", 40, 0., 200.);
153 eta_elecs_ =
dbe_->book1D(
"eta_elecs",
"Eta of electrons", 50, -5., 5.);
154 phi_elecs_ =
dbe_->book1D(
"phi_elecs",
"Phi of electrons", 40, -4., 4.);
156 MuIso_emEt03_ =
dbe_->book1D(
"MuIso_emEt03",
"Muon emEt03", 20, 0., 20.);
157 MuIso_hadEt03_ =
dbe_->book1D(
"MuIso_hadEt03",
"Muon hadEt03", 20, 0., 20.);
158 MuIso_hoEt03_ =
dbe_->book1D(
"MuIso_hoEt03",
"Muon hoEt03", 20, 0., 20.);
159 MuIso_nJets03_ =
dbe_->book1D(
"MuIso_nJets03",
"Muon nJets03", 10, 0., 10.);
161 dbe_->book1D(
"MuIso_nTracks03",
"Muon nTracks03", 20, 0., 20.);
162 MuIso_sumPt03_ =
dbe_->book1D(
"MuIso_sumPt03",
"Muon sumPt03", 20, 0., 40.);
163 MuIso_CombRelIso03_ =
164 dbe_->book1D(
"07_MuIso_CombRelIso03",
"Muon CombRelIso03", 20, 0., 1.);
166 ElecIso_cal_ =
dbe_->book1D(
"ElecIso_cal",
"Electron Iso_cal", 21, -1., 20.);
167 ElecIso_trk_ =
dbe_->book1D(
"ElecIso_trk",
"Electron Iso_trk", 21, -2., 40.);
168 ElecIso_CombRelIso_ =
169 dbe_->book1D(
"08_ElecIso_CombRelIso",
"Electron CombRelIso", 20, 0., 1.);
171 const int nbins = 200;
176 float bins[nbins + 1];
180 double log = logmin + (logmax - logmin) *
i / nbins;
184 dimassRC_ =
dbe_->book1D(
"09_dimassRC",
"Dilepton mass RC", 50, 0., 200.);
185 dimassWC_ =
dbe_->book1D(
"11_dimassWC",
"Dilepton mass WC", 50, 0., 200.);
187 dbe_->book1D(
"10_dimassRC_LOGX",
"Dilepton mass RC LOG", nbins, &bins[0]);
189 dbe_->book1D(
"12_dimassWC_LOGX",
"Dilepton mass WC LOG", nbins, &bins[0]);
191 dbe_->book1D(
"dimassRC_LOG10",
"Dilepton mass RC LOG", 50, 0., 2.5);
193 dbe_->book1D(
"dimassWC_LOG10",
"Dilepton mass WC LOG", 50, 0., 2.5);
196 dbe_->book1D(
"13_D_eta_muons",
"#Delta eta_muons", 20, -5., 5.);
198 dbe_->book1D(
"14_D_phi_muons",
"#Delta phi_muons", 20, -5., 5.);
199 D_eta_elecs_ =
dbe_->book1D(
"D_eta_elecs",
"#Delta eta_elecs", 20, -5., 5.);
200 D_phi_elecs_ =
dbe_->book1D(
"D_phi_elecs",
"#Delta phi_elecs", 20, -5., 5.);
201 D_eta_lepts_ =
dbe_->book1D(
"D_eta_lepts",
"#Delta eta_lepts", 20, -5., 5.);
202 D_phi_lepts_ =
dbe_->book1D(
"D_phi_lepts",
"#Delta phi_lepts", 20, -5., 5.);
215 const int N_TriggerPaths = hltPaths_.size();
216 const int N_SignalPaths = hltPaths_sig_.size();
217 const int N_ControlPaths = hltPaths_trig_.size();
219 bool Fired_Signal_Trigger[100] = {
false};
220 bool Fired_Control_Trigger[100] = {
false};
222 int N_run = (evt.
id()).
run();
223 int N_event = (evt.
id()).
event();
231 double DilepMass = 0.;
233 double vertex_X = 100.;
234 double vertex_Y = 100.;
235 double vertex_Z = 100.;
248 int numberTracks = primaryVertex.
tracksSize();
250 bool fake = primaryVertex.
isFake();
252 Ntracks_->Fill(numberTracks);
254 if (!fake && numberTracks > 3) {
256 vertex_X = primaryVertex.
x();
257 vertex_Y = primaryVertex.
y();
258 vertex_Z = primaryVertex.
z();
271 int N_Triggers = trigResults->size();
275 for (
int i_Trig = 0; i_Trig < N_Triggers; ++i_Trig) {
277 if (trigResults.
product()->accept(i_Trig)) {
281 for (
int i = 0;
i < N_TriggerPaths;
i++) {
286 Trigs_->setBinLabel(
i + 1, hltPaths_[
i], 1);
292 for (
int j = 0;
j < N_SignalPaths; ++
j) {
295 Fired_Signal_Trigger[
j] =
true;
298 for (
int k = 0;
k < N_ControlPaths; ++
k) {
301 Fired_Control_Trigger[
k] =
true;
314 reco::MuonCollection::const_iterator
muon;
318 Nmuons_->Fill(muons->size());
320 N_leptons = N_leptons + muons->size();
322 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
324 float N_muons = muons->size();
325 float Q_muon = muon->charge();
327 Nmuons_charge_->Fill(N_muons * Q_muon);
329 double track_X = 100.;
330 double track_Y = 100.;
331 double track_Z = 100.;
333 if (muon->isGlobalMuon()) {
337 track_X = track->vx();
338 track_Y = track->vy();
339 track_Z = track->vz();
341 VxVy_muons_->Fill(track_X, track_Y);
342 Vz_muons_->Fill(track_Z);
347 if (track_X > vertex_X_cut_)
continue;
348 if (track_Y > vertex_Y_cut_)
continue;
349 if (track_Z > vertex_Z_cut_)
continue;
350 if (muon->pt() < muon_pT_cut_)
continue;
351 if (
abs(muon->eta()) > muon_eta_cut_)
continue;
355 double muonCombRelIso = 1.;
357 if (muon->pt() != 0.)
362 MuIso_CombRelIso03_->Fill(muonCombRelIso);
364 MuIso_emEt03_->Fill(muIso03.
emEt);
365 MuIso_hadEt03_->Fill(muIso03.
hadEt);
366 MuIso_hoEt03_->Fill(muIso03.
hoEt);
367 MuIso_nJets03_->Fill(muIso03.
nJets);
368 MuIso_nTracks03_->Fill(muIso03.
nTracks);
369 MuIso_sumPt03_->Fill(muIso03.
sumPt);
371 if (muonCombRelIso < muon_iso_cut_) ++N_iso_mu;
374 Nmuons_iso_->Fill(N_iso_mu);
384 reco::GsfElectronCollection::const_iterator elec;
388 Nelecs_->Fill(elecs->size());
390 N_leptons = N_leptons + elecs->size();
392 for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
394 float N_elecs = elecs->size();
395 float Q_elec = elec->charge();
396 float HoverE = elec->hcalOverEcal();
398 HoverE_elecs_->Fill(HoverE);
400 Nelecs_charge_->Fill(N_elecs * Q_elec);
402 double track_X = 100.;
403 double track_Y = 100.;
404 double track_Z = 100.;
408 track_X = track->vx();
409 track_Y = track->vy();
410 track_Z = track->vz();
414 if (track_X > vertex_X_cut_)
continue;
415 if (track_Y > vertex_Y_cut_)
continue;
416 if (track_Z > vertex_Z_cut_)
continue;
417 if (elec->pt() < elec_pT_cut_)
continue;
418 if (
abs(elec->eta()) > elec_eta_cut_)
continue;
419 if (HoverE > elec_emf_cut_)
continue;
422 elec->dr03IsolationVariables();
424 double elecCombRelIso = 1.;
426 if (elec->et() != 0.)
431 ElecIso_CombRelIso_->Fill(elecCombRelIso);
434 ElecIso_trk_->Fill(elecIso.
tkSumPt);
436 if (elecCombRelIso < elec_iso_cut_) ++N_iso_el;
439 Nelecs_iso_->Fill(N_iso_el);
450 if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
451 vertex_Z < vertex_Z_cut_) {
457 reco::MuonCollection::const_reference mu1 = muons->at(0);
458 reco::MuonCollection::const_reference mu2 = muons->at(1);
461 sqrt((mu1.energy() + mu2.energy()) * (mu1.energy() + mu2.energy()) -
462 (mu1.px() + mu2.px()) * (mu1.px() + mu2.px()) -
463 (mu1.py() + mu2.py()) * (mu1.py() + mu2.py()) -
464 (mu1.pz() + mu2.pz()) * (mu1.pz() + mu2.pz()));
468 if (mu1.charge() * mu2.charge() < 0.) {
470 dimassRC_LOG10_->Fill(log10(DilepMass));
471 dimassRC_->Fill(DilepMass);
472 dimassRC_LOGX_->Fill(DilepMass);
474 if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
476 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
478 pT_muons_->Fill(muon->pt());
479 eta_muons_->Fill(muon->eta());
480 phi_muons_->Fill(muon->phi());
483 D_eta_muons_->Fill(mu1.eta() - mu2.eta());
484 D_phi_muons_->Fill(mu1.phi() - mu2.phi());
488 if (mu1.isGlobalMuon() && mu2.isGlobalMuon()) {
490 outfile <<
"--------------------"
492 outfile <<
" Run : " << N_run <<
"\n";
493 outfile <<
" Event : " << N_event <<
"\n";
494 outfile <<
"LumiBlock : " << N_lumi <<
"\n";
497 outfile <<
"--------------------"
499 outfile <<
"DilepMass : " << DilepMass <<
"\n";
500 outfile <<
"Mu1 Pt : " << mu1.pt() <<
"\n";
501 outfile <<
"Mu1 Eta : " << mu1.eta() <<
"\n";
502 outfile <<
"Mu1 Phi : " << mu1.phi() <<
"\n";
503 outfile <<
"Mu2 Pt : " << mu2.pt() <<
"\n";
504 outfile <<
"Mu2 Eta : " << mu2.eta() <<
"\n";
505 outfile <<
"Mu2 Phi : " << mu2.phi() <<
"\n";
506 outfile <<
"--------------------"
513 for (
int k = 0;
k < N_SignalPaths; ++
k) {
515 if (Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k]) ++N_sig[
k];
517 if (Fired_Control_Trigger[k]) ++N_trig[
k];
520 Eff[
k] = N_sig[
k] /
static_cast<float>(N_trig[
k]);
522 TriggerEff_->setBinContent(k + 1, Eff[k]);
523 TriggerEff_->setBinLabel(k + 1,
524 "#frac{[" + hltPaths_sig_[k] +
"]}{vs. [" +
525 hltPaths_trig_[k] +
"]}",
533 if (mu1.charge() * mu2.charge() > 0.) {
535 dimassWC_LOG10_->Fill(log10(DilepMass));
536 dimassWC_->Fill(DilepMass);
537 dimassWC_LOGX_->Fill(DilepMass);
541 if (mu1.isGlobalMuon() && mu2.isGlobalMuon()) {
543 outfile <<
"---------------------"
545 outfile <<
" Run : " << N_run <<
"\n";
546 outfile <<
" Event : " << N_event <<
"\n";
547 outfile <<
"LumiBlock : " << N_lumi <<
"\n";
550 outfile <<
"---------------------"
552 outfile <<
"DilepMass : " << DilepMass <<
"\n";
553 outfile <<
"Mu1 Pt : " << mu1.pt() <<
"\n";
554 outfile <<
"Mu1 Eta : " << mu1.eta() <<
"\n";
555 outfile <<
"Mu1 Phi : " << mu1.phi() <<
"\n";
556 outfile <<
"Mu2 Pt : " << mu2.pt() <<
"\n";
557 outfile <<
"Mu2 Eta : " << mu2.eta() <<
"\n";
558 outfile <<
"Mu2 Phi : " << mu2.phi() <<
"\n";
559 outfile <<
"---------------------"
571 if (N_iso_el > 0 && N_iso_mu > 0) {
575 if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
576 vertex_Z < vertex_Z_cut_) {
582 reco::MuonCollection::const_reference mu1 = muons->at(0);
583 reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
586 sqrt((mu1.energy() + el1.energy()) * (mu1.energy() + el1.energy()) -
587 (mu1.px() + el1.px()) * (mu1.px() + el1.px()) -
588 (mu1.py() + el1.py()) * (mu1.py() + el1.py()) -
589 (mu1.pz() + el1.pz()) * (mu1.pz() + el1.pz()));
593 if (mu1.charge() * el1.charge() < 0.) {
595 dimassRC_LOG10_->Fill(log10(DilepMass));
596 dimassRC_->Fill(DilepMass);
597 dimassRC_LOGX_->Fill(DilepMass);
599 if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
601 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
603 pT_muons_->Fill(muon->pt());
604 eta_muons_->Fill(muon->eta());
605 phi_muons_->Fill(muon->phi());
608 for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
610 pT_elecs_->Fill(elec->pt());
611 eta_elecs_->Fill(elec->eta());
612 phi_elecs_->Fill(elec->phi());
615 D_eta_lepts_->Fill(mu1.eta() - el1.eta());
616 D_phi_lepts_->Fill(mu1.phi() - el1.phi());
620 if (mu1.isGlobalMuon() && el1.isElectron()) {
622 outfile <<
"--------------------"
624 outfile <<
" Run : " << N_run <<
"\n";
625 outfile <<
" Event : " << N_event <<
"\n";
626 outfile <<
"LumiBlock : " << N_lumi <<
"\n";
629 outfile <<
"--------------------"
631 outfile <<
"DilepMass : " << DilepMass <<
"\n";
632 outfile <<
"Mu1 Pt : " << mu1.pt() <<
"\n";
633 outfile <<
"Mu1 Eta : " << mu1.eta() <<
"\n";
634 outfile <<
"Mu1 Phi : " << mu1.phi() <<
"\n";
635 outfile <<
"El1 Pt : " << el1.pt() <<
"\n";
636 outfile <<
"El1 Eta : " << el1.eta() <<
"\n";
637 outfile <<
"El1 Phi : " << el1.phi() <<
"\n";
638 outfile <<
"--------------------"
645 for (
int k = 0;
k < N_SignalPaths; ++
k) {
647 if (Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k]) ++N_sig[
k];
649 if (Fired_Control_Trigger[k]) ++N_trig[
k];
652 Eff[
k] = N_sig[
k] /
static_cast<float>(N_trig[
k]);
654 TriggerEff_->setBinContent(k + 1, Eff[k]);
655 TriggerEff_->setBinLabel(k + 1,
656 "#frac{[" + hltPaths_sig_[k] +
"]}{vs. [" +
657 hltPaths_trig_[k] +
"]}",
665 if (mu1.charge() * el1.charge() > 0.) {
667 dimassWC_LOG10_->Fill(log10(DilepMass));
668 dimassWC_->Fill(DilepMass);
669 dimassWC_LOGX_->Fill(DilepMass);
682 if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
683 vertex_Z < vertex_Z_cut_) {
689 reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
690 reco::GsfElectronCollection::const_reference el2 = elecs->at(1);
693 sqrt((el1.energy() + el2.energy()) * (el1.energy() + el2.energy()) -
694 (el1.px() + el2.px()) * (el1.px() + el2.px()) -
695 (el1.py() + el2.py()) * (el1.py() + el2.py()) -
696 (el1.pz() + el2.pz()) * (el1.pz() + el2.pz()));
700 if (el1.charge() * el2.charge() < 0.) {
702 dimassRC_LOG10_->Fill(log10(DilepMass));
703 dimassRC_->Fill(DilepMass);
704 dimassRC_LOGX_->Fill(DilepMass);
706 if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
708 for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
710 pT_elecs_->Fill(elec->pt());
711 eta_elecs_->Fill(elec->eta());
712 phi_elecs_->Fill(elec->phi());
715 D_eta_elecs_->Fill(el1.eta() - el2.eta());
716 D_phi_elecs_->Fill(el1.phi() - el2.phi());
720 if (el1.isElectron() && el2.isElectron()) {
722 outfile <<
"--------------------"
724 outfile <<
" Run : " << N_run <<
"\n";
725 outfile <<
" Event : " << N_event <<
"\n";
726 outfile <<
"LumiBlock : " << N_lumi <<
"\n";
729 outfile <<
"--------------------"
731 outfile <<
"DilepMass : " << DilepMass <<
"\n";
732 outfile <<
"El1 Pt : " << el1.pt() <<
"\n";
733 outfile <<
"El1 Eta : " << el1.eta() <<
"\n";
734 outfile <<
"El1 Phi : " << el1.phi() <<
"\n";
735 outfile <<
"El2 Pt : " << el2.pt() <<
"\n";
736 outfile <<
"El2 Eta : " << el2.eta() <<
"\n";
737 outfile <<
"El2 Phi : " << el2.phi() <<
"\n";
738 outfile <<
"--------------------"
745 for (
int k = 0;
k < N_SignalPaths; ++
k) {
747 if (Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k]) ++N_sig[
k];
749 if (Fired_Control_Trigger[k]) ++N_trig[
k];
752 Eff[
k] = N_sig[
k] /
static_cast<float>(N_trig[
k]);
754 TriggerEff_->setBinContent(k + 1, Eff[k]);
755 TriggerEff_->setBinLabel(k + 1,
756 "#frac{[" + hltPaths_sig_[k] +
"]}{vs. [" +
757 hltPaths_trig_[k] +
"]}",
765 if (el1.charge() * el2.charge() > 0.) {
767 dimassWC_LOG10_->Fill(log10(DilepMass));
768 dimassWC_->Fill(DilepMass);
769 dimassWC_LOGX_->Fill(DilepMass);
780 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
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 &)