7 #include "TLorentzVector.h" 19 triggerResults_ = consumes<TriggerResults>(
21 hltPaths_ = ps.
getParameter<vector<string> >(
"hltPaths");
22 hltPaths_sig_ = ps.
getParameter<vector<string> >(
"hltPaths_sig");
23 hltPaths_trig_ = ps.
getParameter<vector<string> >(
"hltPaths_trig");
25 vertex_ = consumes<reco::VertexCollection>(
31 muons_ = consumes<reco::MuonCollection>(
37 elecs_ = consumes<reco::GsfElectronCollection>(
44 MassWindow_up_ = ps.
getParameter<
double>(
"MassWindow_up");
45 MassWindow_down_ = ps.
getParameter<
double>(
"MassWindow_down");
47 for (
int i = 0;
i < 100; ++
i) {
81 MuIso_CombRelIso03_ = 0;
84 ElecIso_CombRelIso_ = 0;
106 Events_ = iBooker.
book1D(
"00_Events",
"Isolated dilepton events", 5, 0., 5.);
108 Events_->setBinLabel(3,
"#mu e", 1);
109 Events_->setBinLabel(4,
"e e", 1);
112 iBooker.
book1D(
"01_Trigs",
"Fired muon/electron triggers", 15, 0., 15.);
114 iBooker.
book1D(
"02_TriggerEff",
"HL Trigger Efficiencies", 10, 0., 10.);
116 "HL Trigger Efficiencies #epsilon_{signal} = #frac{[signal] && " 117 "[control]}{[control]}");
118 Ntracks_ = iBooker.
book1D(
"Ntracks",
"Number of tracks", 50, 0., 50.);
120 Nmuons_ = iBooker.
book1D(
"03_Nmuons",
"Number of muons", 20, 0., 10.);
122 iBooker.
book1D(
"04_Nmuons_iso",
"Number of isolated muons", 20, 0., 10.);
123 Nmuons_charge_ = iBooker.
book1D(
"Nmuons_charge",
124 "Number of muons * moun charge", 19, -10., 10.);
125 VxVy_muons_ = iBooker.
book2D(
"VxVy_muons",
"Vertex x-y-positon (global)", 40,
126 -1., 1., 40, -1., 1.);
128 iBooker.
book1D(
"Vz_muons",
"Vertex z-positon (global)", 40, -20., 20.);
129 pT_muons_ = iBooker.
book1D(
"pT_muons",
"P_T of muons", 40, 0., 200.);
130 eta_muons_ = iBooker.
book1D(
"eta_muons",
"Eta of muons", 50, -5., 5.);
131 phi_muons_ = iBooker.
book1D(
"phi_muons",
"Phi of muons", 40, -4., 4.);
133 Nelecs_ = iBooker.
book1D(
"05_Nelecs",
"Number of electrons", 20, 0., 10.);
134 Nelecs_iso_ = iBooker.
book1D(
"06_Nelecs_iso",
"Number of isolated electrons",
136 Nelecs_charge_ = iBooker.
book1D(
"Nelecs_charge",
137 "Number of elecs * elec charge", 19, -10., 10.);
139 iBooker.
book1D(
"HoverE_elecs",
"Hadronic over Ecal energy", 50, 0., 1.);
140 pT_elecs_ = iBooker.
book1D(
"pT_elecs",
"P_T of electrons", 40, 0., 200.);
141 eta_elecs_ = iBooker.
book1D(
"eta_elecs",
"Eta of electrons", 50, -5., 5.);
142 phi_elecs_ = iBooker.
book1D(
"phi_elecs",
"Phi of electrons", 40, -4., 4.);
144 MuIso_emEt03_ = iBooker.
book1D(
"MuIso_emEt03",
"Muon emEt03", 20, 0., 20.);
145 MuIso_hadEt03_ = iBooker.
book1D(
"MuIso_hadEt03",
"Muon hadEt03", 20, 0., 20.);
146 MuIso_hoEt03_ = iBooker.
book1D(
"MuIso_hoEt03",
"Muon hoEt03", 20, 0., 20.);
147 MuIso_nJets03_ = iBooker.
book1D(
"MuIso_nJets03",
"Muon nJets03", 10, 0., 10.);
149 iBooker.
book1D(
"MuIso_nTracks03",
"Muon nTracks03", 20, 0., 20.);
150 MuIso_sumPt03_ = iBooker.
book1D(
"MuIso_sumPt03",
"Muon sumPt03", 20, 0., 40.);
151 MuIso_CombRelIso03_ =
152 iBooker.
book1D(
"07_MuIso_CombRelIso03",
"Muon CombRelIso03", 20, 0., 1.);
154 ElecIso_cal_ = iBooker.
book1D(
"ElecIso_cal",
"Electron Iso_cal", 21, -1., 20.);
155 ElecIso_trk_ = iBooker.
book1D(
"ElecIso_trk",
"Electron Iso_trk", 21, -2., 40.);
156 ElecIso_CombRelIso_ =
157 iBooker.
book1D(
"08_ElecIso_CombRelIso",
"Electron CombRelIso", 20, 0., 1.);
159 const int nbins = 200;
164 float bins[nbins + 1];
167 double log = logmin + (logmax - logmin) *
i / nbins;
171 dimassRC_ = iBooker.
book1D(
"09_dimassRC",
"Dilepton mass RC", 50, 0., 200.);
172 dimassWC_ = iBooker.
book1D(
"11_dimassWC",
"Dilepton mass WC", 50, 0., 200.);
174 iBooker.
book1D(
"10_dimassRC_LOGX",
"Dilepton mass RC LOG", nbins, &bins[0]);
176 iBooker.
book1D(
"12_dimassWC_LOGX",
"Dilepton mass WC LOG", nbins, &bins[0]);
178 iBooker.
book1D(
"dimassRC_LOG10",
"Dilepton mass RC LOG", 50, 0., 2.5);
180 iBooker.
book1D(
"dimassWC_LOG10",
"Dilepton mass WC LOG", 50, 0., 2.5);
183 iBooker.
book1D(
"13_D_eta_muons",
"#Delta eta_muons", 20, -5., 5.);
185 iBooker.
book1D(
"14_D_phi_muons",
"#Delta phi_muons", 20, -5., 5.);
186 D_eta_elecs_ = iBooker.
book1D(
"D_eta_elecs",
"#Delta eta_elecs", 20, -5., 5.);
187 D_phi_elecs_ = iBooker.
book1D(
"D_phi_elecs",
"#Delta phi_elecs", 20, -5., 5.);
188 D_eta_lepts_ = iBooker.
book1D(
"D_eta_lepts",
"#Delta eta_lepts", 20, -5., 5.);
189 D_phi_lepts_ = iBooker.
book1D(
"D_phi_lepts",
"#Delta phi_lepts", 20, -5., 5.);
198 const int N_TriggerPaths = hltPaths_.size();
199 const int N_SignalPaths = hltPaths_sig_.size();
200 const int N_ControlPaths = hltPaths_trig_.size();
202 bool Fired_Signal_Trigger[100] = {
false};
203 bool Fired_Control_Trigger[100] = {
false};
209 double DilepMass = 0.;
211 double vertex_X = 100.;
212 double vertex_Y = 100.;
213 double vertex_Z = 100.;
225 int numberTracks = primaryVertex.
tracksSize();
227 bool fake = primaryVertex.
isFake();
229 Ntracks_->Fill(numberTracks);
231 if (!fake && numberTracks > 3) {
232 vertex_X = primaryVertex.
x();
233 vertex_Y = primaryVertex.
y();
234 vertex_Z = primaryVertex.
z();
246 int N_Triggers = trigResults->
size();
250 for (
int i_Trig = 0; i_Trig < N_Triggers; ++i_Trig) {
254 for (
int i = 0;
i < N_TriggerPaths;
i++) {
257 Trigs_->setBinLabel(
i + 1, hltPaths_[
i], 1);
263 for (
int j = 0; j < N_SignalPaths; ++j) {
264 if (trigName.
triggerName(i_Trig) == hltPaths_sig_[j])
265 Fired_Signal_Trigger[j] =
true;
268 for (
int k = 0;
k < N_ControlPaths; ++
k) {
270 Fired_Control_Trigger[
k] =
true;
283 reco::MuonCollection::const_iterator
muon;
286 Nmuons_->Fill(muons->size());
288 N_leptons = N_leptons + muons->size();
290 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
291 float N_muons = muons->size();
292 float Q_muon = muon->charge();
294 Nmuons_charge_->Fill(N_muons * Q_muon);
296 double track_X = 100.;
297 double track_Y = 100.;
298 double track_Z = 100.;
300 if (muon->isGlobalMuon()) {
303 track_X = track->vx();
304 track_Y = track->vy();
305 track_Z = track->vz();
307 VxVy_muons_->Fill(track_X, track_Y);
308 Vz_muons_->Fill(track_Z);
313 if (track_X > vertex_X_cut_)
continue;
314 if (track_Y > vertex_Y_cut_)
continue;
315 if (track_Z > vertex_Z_cut_)
continue;
316 if (muon->pt() < muon_pT_cut_)
continue;
317 if (
abs(muon->eta()) > muon_eta_cut_)
continue;
321 double muonCombRelIso = 1.;
323 if (muon->pt() != 0.)
328 MuIso_CombRelIso03_->Fill(muonCombRelIso);
330 MuIso_emEt03_->Fill(muIso03.
emEt);
331 MuIso_hadEt03_->Fill(muIso03.
hadEt);
332 MuIso_hoEt03_->Fill(muIso03.
hoEt);
333 MuIso_nJets03_->Fill(muIso03.
nJets);
334 MuIso_nTracks03_->Fill(muIso03.
nTracks);
335 MuIso_sumPt03_->Fill(muIso03.
sumPt);
337 if (muonCombRelIso < muon_iso_cut_) ++N_iso_mu;
340 Nmuons_iso_->Fill(N_iso_mu);
350 reco::GsfElectronCollection::const_iterator elec;
353 Nelecs_->Fill(elecs->size());
355 N_leptons = N_leptons + elecs->size();
357 for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
358 float N_elecs = elecs->size();
359 float Q_elec = elec->charge();
360 float HoverE = elec->hcalOverEcal();
362 HoverE_elecs_->Fill(HoverE);
364 Nelecs_charge_->Fill(N_elecs * Q_elec);
366 double track_X = 100.;
367 double track_Y = 100.;
368 double track_Z = 100.;
372 track_X = track->vx();
373 track_Y = track->vy();
374 track_Z = track->vz();
378 if (track_X > vertex_X_cut_)
continue;
379 if (track_Y > vertex_Y_cut_)
continue;
380 if (track_Z > vertex_Z_cut_)
continue;
381 if (elec->pt() < elec_pT_cut_)
continue;
382 if (
abs(elec->eta()) > elec_eta_cut_)
continue;
383 if (HoverE > elec_emf_cut_)
continue;
386 elec->dr03IsolationVariables();
388 double elecCombRelIso = 1.;
390 if (elec->et() != 0.)
395 ElecIso_CombRelIso_->Fill(elecCombRelIso);
398 ElecIso_trk_->Fill(elecIso.
tkSumPt);
400 if (elecCombRelIso < elec_iso_cut_) ++N_iso_el;
403 Nelecs_iso_->Fill(N_iso_el);
413 if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
414 vertex_Z < vertex_Z_cut_) {
419 reco::MuonCollection::const_reference mu1 = muons->at(0);
420 reco::MuonCollection::const_reference mu2 = muons->at(1);
423 sqrt((mu1.energy() + mu2.energy()) * (mu1.energy() + mu2.energy()) -
424 (mu1.px() + mu2.px()) * (mu1.px() + mu2.px()) -
425 (mu1.py() + mu2.py()) * (mu1.py() + mu2.py()) -
426 (mu1.pz() + mu2.pz()) * (mu1.pz() + mu2.pz()));
430 if (mu1.charge() * mu2.charge() < 0.) {
431 dimassRC_LOG10_->Fill(log10(DilepMass));
432 dimassRC_->Fill(DilepMass);
433 dimassRC_LOGX_->Fill(DilepMass);
435 if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
436 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
437 pT_muons_->Fill(muon->pt());
438 eta_muons_->Fill(muon->eta());
439 phi_muons_->Fill(muon->phi());
442 D_eta_muons_->Fill(mu1.eta() - mu2.eta());
443 D_phi_muons_->Fill(mu1.phi() - mu2.phi());
447 for (
int k = 0;
k < N_SignalPaths; ++
k) {
448 if (Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k]) ++N_sig[
k];
450 if (Fired_Control_Trigger[k]) ++N_trig[
k];
453 Eff[
k] = N_sig[
k] /
static_cast<float>(N_trig[
k]);
455 TriggerEff_->setBinContent(k + 1, Eff[k]);
456 TriggerEff_->setBinLabel(k + 1,
457 "#frac{[" + hltPaths_sig_[k] +
"]}{vs. [" +
458 hltPaths_trig_[k] +
"]}",
466 if (mu1.charge() * mu2.charge() > 0.) {
467 dimassWC_LOG10_->Fill(log10(DilepMass));
468 dimassWC_->Fill(DilepMass);
469 dimassWC_LOGX_->Fill(DilepMass);
478 if (N_iso_el > 0 && N_iso_mu > 0) {
481 if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
482 vertex_Z < vertex_Z_cut_) {
487 reco::MuonCollection::const_reference mu1 = muons->at(0);
488 reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
491 sqrt((mu1.energy() + el1.energy()) * (mu1.energy() + el1.energy()) -
492 (mu1.px() + el1.px()) * (mu1.px() + el1.px()) -
493 (mu1.py() + el1.py()) * (mu1.py() + el1.py()) -
494 (mu1.pz() + el1.pz()) * (mu1.pz() + el1.pz()));
498 if (mu1.charge() * el1.charge() < 0.) {
499 dimassRC_LOG10_->Fill(log10(DilepMass));
500 dimassRC_->Fill(DilepMass);
501 dimassRC_LOGX_->Fill(DilepMass);
503 if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
504 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
505 pT_muons_->Fill(muon->pt());
506 eta_muons_->Fill(muon->eta());
507 phi_muons_->Fill(muon->phi());
510 for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
511 pT_elecs_->Fill(elec->pt());
512 eta_elecs_->Fill(elec->eta());
513 phi_elecs_->Fill(elec->phi());
516 D_eta_lepts_->Fill(mu1.eta() - el1.eta());
517 D_phi_lepts_->Fill(mu1.phi() - el1.phi());
521 for (
int k = 0;
k < N_SignalPaths; ++
k) {
522 if (Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k]) ++N_sig[
k];
524 if (Fired_Control_Trigger[k]) ++N_trig[
k];
527 Eff[
k] = N_sig[
k] /
static_cast<float>(N_trig[
k]);
529 TriggerEff_->setBinContent(k + 1, Eff[k]);
530 TriggerEff_->setBinLabel(k + 1,
531 "#frac{[" + hltPaths_sig_[k] +
"]}{vs. [" +
532 hltPaths_trig_[k] +
"]}",
540 if (mu1.charge() * el1.charge() > 0.) {
541 dimassWC_LOG10_->Fill(log10(DilepMass));
542 dimassWC_->Fill(DilepMass);
543 dimassWC_LOGX_->Fill(DilepMass);
555 if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
556 vertex_Z < vertex_Z_cut_) {
561 reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
562 reco::GsfElectronCollection::const_reference el2 = elecs->at(1);
565 sqrt((el1.energy() + el2.energy()) * (el1.energy() + el2.energy()) -
566 (el1.px() + el2.px()) * (el1.px() + el2.px()) -
567 (el1.py() + el2.py()) * (el1.py() + el2.py()) -
568 (el1.pz() + el2.pz()) * (el1.pz() + el2.pz()));
572 if (el1.charge() * el2.charge() < 0.) {
573 dimassRC_LOG10_->Fill(log10(DilepMass));
574 dimassRC_->Fill(DilepMass);
575 dimassRC_LOGX_->Fill(DilepMass);
577 if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
578 for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
579 pT_elecs_->Fill(elec->pt());
580 eta_elecs_->Fill(elec->eta());
581 phi_elecs_->Fill(elec->phi());
584 D_eta_elecs_->Fill(el1.eta() - el2.eta());
585 D_phi_elecs_->Fill(el1.phi() - el2.phi());
589 for (
int k = 0;
k < N_SignalPaths; ++
k) {
590 if (Fired_Signal_Trigger[
k] && Fired_Control_Trigger[
k]) ++N_sig[
k];
592 if (Fired_Control_Trigger[k]) ++N_trig[
k];
595 Eff[
k] = N_sig[
k] /
static_cast<float>(N_trig[
k]);
597 TriggerEff_->setBinContent(k + 1, Eff[k]);
598 TriggerEff_->setBinLabel(k + 1,
599 "#frac{[" + hltPaths_sig_[k] +
"]}{vs. [" +
600 hltPaths_trig_[k] +
"]}",
608 if (el1.charge() * el2.charge() > 0.) {
609 dimassWC_LOG10_->Fill(log10(DilepMass));
610 dimassWC_->Fill(DilepMass);
611 dimassWC_LOGX_->Fill(DilepMass);
T getParameter(std::string const &) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
T getUntrackedParameter(std::string const &, T const &) const
float sumPt
sum-pt of tracks
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double y() const
y coordinate
bool accept() const
Has at least one path accepted the event?
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
float hcalDepth1TowerSumEt
TopDiLeptonDQM(const edm::ParameterSet &)
unsigned int size() const
Get number of paths stored.
int nJets
number of jets in the cone
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
double z() const
z coordinate
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
void setTitle(const std::string &title)
set (ie. change) histogram/profile title
int nTracks
number of tracks in the cone (excluding veto region)
double x() const
x coordinate
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
std::string const & triggerName(unsigned int index) const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Power< A, B >::type pow(const A &a, const B &b)
size_t tracksSize() const
number of tracks