CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TopDiLeptonDQM.cc
Go to the documentation of this file.
1 /*
2  * $Date: 2012/01/11 13:53:29 $
3  * $Revision: 1.14 $
4  * \author M. Marienfeld - DESY Hamburg
5  */
6 
7 #include "TLorentzVector.h"
12 
13 using namespace std;
14 using namespace edm;
15 
17 
18  initialize();
19 
20  moduleName_ = ps.getUntrackedParameter<string>("moduleName");
21  fileOutput_ = ps.getParameter<bool>("fileOutput");
22  outputFile_ = ps.getUntrackedParameter<string>("outputFile");
23  triggerResults_ = consumes<TriggerResults>(
24  ps.getParameter<edm::InputTag>("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");
28 
29  vertex_ = consumes<reco::VertexCollection>(
30  ps.getParameter<edm::InputTag>("vertexCollection"));
31  vertex_X_cut_ = ps.getParameter<double>("vertex_X_cut");
32  vertex_Y_cut_ = ps.getParameter<double>("vertex_Y_cut");
33  vertex_Z_cut_ = ps.getParameter<double>("vertex_Z_cut");
34 
35  muons_ = consumes<reco::MuonCollection>(
36  ps.getParameter<edm::InputTag>("muonCollection"));
37  muon_pT_cut_ = ps.getParameter<double>("muon_pT_cut");
38  muon_eta_cut_ = ps.getParameter<double>("muon_eta_cut");
39  muon_iso_cut_ = ps.getParameter<double>("muon_iso_cut");
40 
41  elecs_ = consumes<reco::GsfElectronCollection>(
42  ps.getParameter<edm::InputTag>("elecCollection"));
43  elec_pT_cut_ = ps.getParameter<double>("elec_pT_cut");
44  elec_eta_cut_ = ps.getParameter<double>("elec_eta_cut");
45  elec_iso_cut_ = ps.getParameter<double>("elec_iso_cut");
46  elec_emf_cut_ = ps.getParameter<double>("elec_emf_cut");
47 
48  MassWindow_up_ = ps.getParameter<double>("MassWindow_up");
49  MassWindow_down_ = ps.getParameter<double>("MassWindow_down");
50 
51  for (int i = 0; i < 100; ++i) {
52  N_sig[i] = 0;
53  N_trig[i] = 0;
54  Eff[i] = 0.;
55  }
56 
57  N_mumu = 0;
58  N_muel = 0;
59  N_elel = 0;
60 
61  if (fileOutput_) {
62  const char* fileName = outputFile_.c_str();
63  outfile.open(fileName);
64  }
65 
67 
68  Events_ = 0;
69  Trigs_ = 0;
70  TriggerEff_ = 0;
71  Ntracks_ = 0;
72  Nmuons_ = 0;
73  Nmuons_iso_ = 0;
74  Nmuons_charge_ = 0;
75  VxVy_muons_ = 0;
76  Vz_muons_ = 0;
77  pT_muons_ = 0;
78  eta_muons_ = 0;
79  phi_muons_ = 0;
80  Nelecs_ = 0;
81  Nelecs_iso_ = 0;
82  Nelecs_charge_ = 0;
83  HoverE_elecs_ = 0;
84  pT_elecs_ = 0;
85  eta_elecs_ = 0;
86  phi_elecs_ = 0;
87  MuIso_emEt03_ = 0;
88  MuIso_hadEt03_ = 0;
89  MuIso_hoEt03_ = 0;
90  MuIso_nJets03_ = 0;
91  MuIso_nTracks03_ = 0;
92  MuIso_sumPt03_ = 0;
93  MuIso_CombRelIso03_ = 0;
94  ElecIso_cal_ = 0;
95  ElecIso_trk_ = 0;
96  ElecIso_CombRelIso_ = 0;
97  dimassRC_ = 0;
98  dimassWC_ = 0;
99  dimassRC_LOGX_ = 0;
100  dimassWC_LOGX_ = 0;
101  dimassRC_LOG10_ = 0;
102  dimassWC_LOG10_ = 0;
103  D_eta_muons_ = 0;
104  D_phi_muons_ = 0;
105  D_eta_elecs_ = 0;
106  D_phi_elecs_ = 0;
107  D_eta_lepts_ = 0;
108  D_phi_lepts_ = 0;
109 }
110 
112 
114 
116 
117  dbe_->setCurrentFolder(moduleName_);
118 
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);
123 
124  Trigs_ =
125  dbe_->book1D("01_Trigs", "Fired muon/electron triggers", 15, 0., 15.);
126  TriggerEff_ =
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.);
132 
133  Nmuons_ = dbe_->book1D("03_Nmuons", "Number of muons", 20, 0., 10.);
134  Nmuons_iso_ =
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.);
140  Vz_muons_ =
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.);
145 
146  Nelecs_ = dbe_->book1D("05_Nelecs", "Number of electrons", 20, 0., 10.);
147  Nelecs_iso_ = dbe_->book1D("06_Nelecs_iso", "Number of isolated electrons",
148  20, 0., 10.);
149  Nelecs_charge_ = dbe_->book1D("Nelecs_charge",
150  "Number of elecs * elec charge", 19, -10., 10.);
151  HoverE_elecs_ =
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.);
156 
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.);
161  MuIso_nTracks03_ =
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.);
166 
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.);
171 
172  const int nbins = 200;
173 
174  double logmin = 0.;
175  double logmax = 3.; // 10^(3.)=1000
176 
177  float bins[nbins + 1];
178 
179  for (int i = 0; i <= nbins; i++) {
180 
181  double log = logmin + (logmax - logmin) * i / nbins;
182  bins[i] = std::pow(10.0, log);
183  }
184 
185  dimassRC_ = dbe_->book1D("09_dimassRC", "Dilepton mass RC", 50, 0., 200.);
186  dimassWC_ = dbe_->book1D("11_dimassWC", "Dilepton mass WC", 50, 0., 200.);
187  dimassRC_LOGX_ =
188  dbe_->book1D("10_dimassRC_LOGX", "Dilepton mass RC LOG", nbins, &bins[0]);
189  dimassWC_LOGX_ =
190  dbe_->book1D("12_dimassWC_LOGX", "Dilepton mass WC LOG", nbins, &bins[0]);
191  dimassRC_LOG10_ =
192  dbe_->book1D("dimassRC_LOG10", "Dilepton mass RC LOG", 50, 0., 2.5);
193  dimassWC_LOG10_ =
194  dbe_->book1D("dimassWC_LOG10", "Dilepton mass WC LOG", 50, 0., 2.5);
195 
196  D_eta_muons_ =
197  dbe_->book1D("13_D_eta_muons", "#Delta eta_muons", 20, -5., 5.);
198  D_phi_muons_ =
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.);
204 }
205 
207  const edm::EventSetup& context) {}
208 
210  const edm::EventSetup& context) {
211 
212  // ------------------------
213  // Global Event Variables
214  // ------------------------
215 
216  const int N_TriggerPaths = hltPaths_.size();
217  const int N_SignalPaths = hltPaths_sig_.size();
218  const int N_ControlPaths = hltPaths_trig_.size();
219 
220  bool Fired_Signal_Trigger[100] = {false};
221  bool Fired_Control_Trigger[100] = {false};
222 
223  edm::RunNumber_t N_run = (evt.id()).run();
224  edm::EventNumber_t N_event = (evt.id()).event();
225  int N_lumi = evt.luminosityBlock();
226 
227  int N_leptons = 0;
228  int N_iso_mu = 0;
229  int N_iso_el = 0;
230  // int N_iso_lep = 0; // UNUSED
231 
232  double DilepMass = 0.;
233 
234  double vertex_X = 100.;
235  double vertex_Y = 100.;
236  double vertex_Z = 100.;
237 
238  // ------------------------
239  // Analyze Primary Vertex
240  // ------------------------
241 
243  evt.getByToken(vertex_, vertexs);
244 
245  if (!vertexs.failedToGet()) {
246 
247  reco::Vertex primaryVertex = vertexs->front();
248 
249  int numberTracks = primaryVertex.tracksSize();
250  // double ndof = primaryVertex.ndof();
251  bool fake = primaryVertex.isFake();
252 
253  Ntracks_->Fill(numberTracks);
254 
255  if (!fake && numberTracks > 3) {
256 
257  vertex_X = primaryVertex.x();
258  vertex_Y = primaryVertex.y();
259  vertex_Z = primaryVertex.z();
260  }
261  }
262 
263  // -------------------------
264  // Analyze Trigger Results
265  // -------------------------
266 
267  edm::Handle<TriggerResults> trigResults;
268  evt.getByToken(triggerResults_, trigResults);
269 
270  if (!trigResults.failedToGet()) {
271 
272  int N_Triggers = trigResults->size();
273 
274  const edm::TriggerNames& trigName = evt.triggerNames(*trigResults);
275 
276  for (int i_Trig = 0; i_Trig < N_Triggers; ++i_Trig) {
277 
278  if (trigResults.product()->accept(i_Trig)) {
279 
280  // Check for all trigger paths
281 
282  for (int i = 0; i < N_TriggerPaths; i++) {
283 
284  if (trigName.triggerName(i_Trig) == hltPaths_[i]) {
285 
286  Trigs_->Fill(i);
287  Trigs_->setBinLabel(i + 1, hltPaths_[i], 1);
288  }
289  }
290 
291  // Check for signal & control trigger paths
292 
293  for (int j = 0; j < N_SignalPaths; ++j) {
294 
295  if (trigName.triggerName(i_Trig) == hltPaths_sig_[j])
296  Fired_Signal_Trigger[j] = true;
297  }
298 
299  for (int k = 0; k < N_ControlPaths; ++k) {
300 
301  if (trigName.triggerName(i_Trig) == hltPaths_trig_[k])
302  Fired_Control_Trigger[k] = true;
303  }
304  }
305  }
306  }
307 
308  // ------------------------
309  // Analyze Muon Isolation
310  // ------------------------
311 
313  evt.getByToken(muons_, muons);
314 
315  reco::MuonCollection::const_iterator muon;
316 
317  if (!muons.failedToGet()) {
318 
319  Nmuons_->Fill(muons->size());
320 
321  N_leptons = N_leptons + muons->size();
322 
323  for (muon = muons->begin(); muon != muons->end(); ++muon) {
324 
325  float N_muons = muons->size();
326  float Q_muon = muon->charge();
327 
328  Nmuons_charge_->Fill(N_muons * Q_muon);
329 
330  double track_X = 100.;
331  double track_Y = 100.;
332  double track_Z = 100.;
333 
334  if (muon->isGlobalMuon()) {
335 
336  reco::TrackRef track = muon->globalTrack();
337 
338  track_X = track->vx();
339  track_Y = track->vy();
340  track_Z = track->vz();
341 
342  VxVy_muons_->Fill(track_X, track_Y);
343  Vz_muons_->Fill(track_Z);
344  }
345 
346  // Vertex and kinematic cuts
347 
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;
353 
354  reco::MuonIsolation muIso03 = muon->isolationR03();
355 
356  double muonCombRelIso = 1.;
357 
358  if (muon->pt() != 0.)
359  muonCombRelIso =
360  (muIso03.emEt + muIso03.hadEt + muIso03.hoEt + muIso03.sumPt) /
361  muon->pt();
362 
363  MuIso_CombRelIso03_->Fill(muonCombRelIso);
364 
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);
371 
372  if (muonCombRelIso < muon_iso_cut_) ++N_iso_mu;
373  }
374 
375  Nmuons_iso_->Fill(N_iso_mu);
376  }
377 
378  // ----------------------------
379  // Analyze Electron Isolation
380  // ----------------------------
381 
383  evt.getByToken(elecs_, elecs);
384 
385  reco::GsfElectronCollection::const_iterator elec;
386 
387  if (!elecs.failedToGet()) {
388 
389  Nelecs_->Fill(elecs->size());
390 
391  N_leptons = N_leptons + elecs->size();
392 
393  for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
394 
395  float N_elecs = elecs->size();
396  float Q_elec = elec->charge();
397  float HoverE = elec->hcalOverEcal();
398 
399  HoverE_elecs_->Fill(HoverE);
400 
401  Nelecs_charge_->Fill(N_elecs * Q_elec);
402 
403  double track_X = 100.;
404  double track_Y = 100.;
405  double track_Z = 100.;
406 
407  reco::GsfTrackRef track = elec->gsfTrack();
408 
409  track_X = track->vx();
410  track_Y = track->vy();
411  track_Z = track->vz();
412 
413  // Vertex and kinematic cuts
414 
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;
421 
423  elec->dr03IsolationVariables();
424 
425  double elecCombRelIso = 1.;
426 
427  if (elec->et() != 0.)
428  elecCombRelIso = (elecIso.ecalRecHitSumEt +
429  elecIso.hcalDepth1TowerSumEt + elecIso.tkSumPt) /
430  elec->et();
431 
432  ElecIso_CombRelIso_->Fill(elecCombRelIso);
433 
434  ElecIso_cal_->Fill(elecIso.ecalRecHitSumEt);
435  ElecIso_trk_->Fill(elecIso.tkSumPt);
436 
437  if (elecCombRelIso < elec_iso_cut_) ++N_iso_el;
438  }
439 
440  Nelecs_iso_->Fill(N_iso_el);
441  }
442 
443  // --------------------
444  // TWO Isolated MUONS
445  // --------------------
446 
447  if (N_iso_mu > 1) {
448 
449  // Vertex cut
450 
451  if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
452  vertex_Z < vertex_Z_cut_) {
453 
454  ++N_mumu;
455 
456  Events_->Fill(1.);
457 
458  reco::MuonCollection::const_reference mu1 = muons->at(0);
459  reco::MuonCollection::const_reference mu2 = muons->at(1);
460 
461  DilepMass =
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()));
466 
467  // Opposite muon charges -> Right Charge (RC)
468 
469  if (mu1.charge() * mu2.charge() < 0.) {
470 
471  dimassRC_LOG10_->Fill(log10(DilepMass));
472  dimassRC_->Fill(DilepMass);
473  dimassRC_LOGX_->Fill(DilepMass);
474 
475  if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
476 
477  for (muon = muons->begin(); muon != muons->end(); ++muon) {
478 
479  pT_muons_->Fill(muon->pt());
480  eta_muons_->Fill(muon->eta());
481  phi_muons_->Fill(muon->phi());
482  }
483 
484  D_eta_muons_->Fill(mu1.eta() - mu2.eta());
485  D_phi_muons_->Fill(mu1.phi() - mu2.phi());
486 
487  if (fileOutput_) {
488 
489  if (mu1.isGlobalMuon() && mu2.isGlobalMuon()) {
490 
491  outfile << "--------------------"
492  << "\n";
493  outfile << " Run : " << N_run << "\n";
494  outfile << " Event : " << N_event << "\n";
495  outfile << "LumiBlock : " << N_lumi << "\n";
496  outfile << " Type : mu mu"
497  << "\n";
498  outfile << "--------------------"
499  << "\n";
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 << "--------------------"
508  << "\n";
509  }
510  }
511 
512  // Determinating trigger efficiencies
513 
514  for (int k = 0; k < N_SignalPaths; ++k) {
515 
516  if (Fired_Signal_Trigger[k] && Fired_Control_Trigger[k]) ++N_sig[k];
517 
518  if (Fired_Control_Trigger[k]) ++N_trig[k];
519 
520  if (N_trig[k] != 0)
521  Eff[k] = N_sig[k] / static_cast<float>(N_trig[k]);
522 
523  TriggerEff_->setBinContent(k + 1, Eff[k]);
524  TriggerEff_->setBinLabel(k + 1,
525  "#frac{[" + hltPaths_sig_[k] + "]}{vs. [" +
526  hltPaths_trig_[k] + "]}",
527  1);
528  }
529  }
530  }
531 
532  // Same muon charges -> Wrong Charge (WC)
533 
534  if (mu1.charge() * mu2.charge() > 0.) {
535 
536  dimassWC_LOG10_->Fill(log10(DilepMass));
537  dimassWC_->Fill(DilepMass);
538  dimassWC_LOGX_->Fill(DilepMass);
539 
540  if (fileOutput_) {
541 
542  if (mu1.isGlobalMuon() && mu2.isGlobalMuon()) {
543 
544  outfile << "---------------------"
545  << "\n";
546  outfile << " Run : " << N_run << "\n";
547  outfile << " Event : " << N_event << "\n";
548  outfile << "LumiBlock : " << N_lumi << "\n";
549  outfile << " Type : WC mu mu"
550  << "\n";
551  outfile << "---------------------"
552  << "\n";
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 << "---------------------"
561  << "\n";
562  }
563  }
564  }
565  }
566  }
567 
568  // -----------------------------
569  // TWO Isolated LEPTONS (mu/e)
570  // -----------------------------
571 
572  if (N_iso_el > 0 && N_iso_mu > 0) {
573 
574  // Vertex cut
575 
576  if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
577  vertex_Z < vertex_Z_cut_) {
578 
579  ++N_muel;
580 
581  Events_->Fill(2.);
582 
583  reco::MuonCollection::const_reference mu1 = muons->at(0);
584  reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
585 
586  DilepMass =
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()));
591 
592  // Opposite lepton charges -> Right Charge (RC)
593 
594  if (mu1.charge() * el1.charge() < 0.) {
595 
596  dimassRC_LOG10_->Fill(log10(DilepMass));
597  dimassRC_->Fill(DilepMass);
598  dimassRC_LOGX_->Fill(DilepMass);
599 
600  if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
601 
602  for (muon = muons->begin(); muon != muons->end(); ++muon) {
603 
604  pT_muons_->Fill(muon->pt());
605  eta_muons_->Fill(muon->eta());
606  phi_muons_->Fill(muon->phi());
607  }
608 
609  for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
610 
611  pT_elecs_->Fill(elec->pt());
612  eta_elecs_->Fill(elec->eta());
613  phi_elecs_->Fill(elec->phi());
614  }
615 
616  D_eta_lepts_->Fill(mu1.eta() - el1.eta());
617  D_phi_lepts_->Fill(mu1.phi() - el1.phi());
618 
619  if (fileOutput_) {
620 
621  if (mu1.isGlobalMuon() && el1.isElectron()) {
622 
623  outfile << "--------------------"
624  << "\n";
625  outfile << " Run : " << N_run << "\n";
626  outfile << " Event : " << N_event << "\n";
627  outfile << "LumiBlock : " << N_lumi << "\n";
628  outfile << " Type : mu el"
629  << "\n";
630  outfile << "--------------------"
631  << "\n";
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 << "--------------------"
640  << "\n";
641  }
642  }
643 
644  // Determinating trigger efficiencies
645 
646  for (int k = 0; k < N_SignalPaths; ++k) {
647 
648  if (Fired_Signal_Trigger[k] && Fired_Control_Trigger[k]) ++N_sig[k];
649 
650  if (Fired_Control_Trigger[k]) ++N_trig[k];
651 
652  if (N_trig[k] != 0)
653  Eff[k] = N_sig[k] / static_cast<float>(N_trig[k]);
654 
655  TriggerEff_->setBinContent(k + 1, Eff[k]);
656  TriggerEff_->setBinLabel(k + 1,
657  "#frac{[" + hltPaths_sig_[k] + "]}{vs. [" +
658  hltPaths_trig_[k] + "]}",
659  1);
660  }
661  }
662  }
663 
664  // Same muon charges -> Wrong Charge (WC)
665 
666  if (mu1.charge() * el1.charge() > 0.) {
667 
668  dimassWC_LOG10_->Fill(log10(DilepMass));
669  dimassWC_->Fill(DilepMass);
670  dimassWC_LOGX_->Fill(DilepMass);
671  }
672  }
673  }
674 
675  // ------------------------
676  // TWO Isolated ELECTRONS
677  // ------------------------
678 
679  if (N_iso_el > 1) {
680 
681  // Vertex cut
682 
683  if (vertex_X < vertex_X_cut_ && vertex_Y < vertex_Y_cut_ &&
684  vertex_Z < vertex_Z_cut_) {
685 
686  ++N_elel;
687 
688  Events_->Fill(3.);
689 
690  reco::GsfElectronCollection::const_reference el1 = elecs->at(0);
691  reco::GsfElectronCollection::const_reference el2 = elecs->at(1);
692 
693  DilepMass =
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()));
698 
699  // Opposite lepton charges -> Right Charge (RC)
700 
701  if (el1.charge() * el2.charge() < 0.) {
702 
703  dimassRC_LOG10_->Fill(log10(DilepMass));
704  dimassRC_->Fill(DilepMass);
705  dimassRC_LOGX_->Fill(DilepMass);
706 
707  if (DilepMass > MassWindow_down_ && DilepMass < MassWindow_up_) {
708 
709  for (elec = elecs->begin(); elec != elecs->end(); ++elec) {
710 
711  pT_elecs_->Fill(elec->pt());
712  eta_elecs_->Fill(elec->eta());
713  phi_elecs_->Fill(elec->phi());
714  }
715 
716  D_eta_elecs_->Fill(el1.eta() - el2.eta());
717  D_phi_elecs_->Fill(el1.phi() - el2.phi());
718 
719  if (fileOutput_) {
720 
721  if (el1.isElectron() && el2.isElectron()) {
722 
723  outfile << "--------------------"
724  << "\n";
725  outfile << " Run : " << N_run << "\n";
726  outfile << " Event : " << N_event << "\n";
727  outfile << "LumiBlock : " << N_lumi << "\n";
728  outfile << " Type : el el"
729  << "\n";
730  outfile << "--------------------"
731  << "\n";
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 << "--------------------"
740  << "\n";
741  }
742  }
743 
744  // Determinating trigger efficiencies
745 
746  for (int k = 0; k < N_SignalPaths; ++k) {
747 
748  if (Fired_Signal_Trigger[k] && Fired_Control_Trigger[k]) ++N_sig[k];
749 
750  if (Fired_Control_Trigger[k]) ++N_trig[k];
751 
752  if (N_trig[k] != 0)
753  Eff[k] = N_sig[k] / static_cast<float>(N_trig[k]);
754 
755  TriggerEff_->setBinContent(k + 1, Eff[k]);
756  TriggerEff_->setBinLabel(k + 1,
757  "#frac{[" + hltPaths_sig_[k] + "]}{vs. [" +
758  hltPaths_trig_[k] + "]}",
759  1);
760  }
761  }
762  }
763 
764  // Same muon charges -> Wrong Charge (WC)
765 
766  if (el1.charge() * el2.charge() > 0.) {
767 
768  dimassWC_LOG10_->Fill(log10(DilepMass));
769  dimassWC_->Fill(DilepMass);
770  dimassWC_LOGX_->Fill(DilepMass);
771  }
772  }
773  }
774 }
775 
776 void TopDiLeptonDQM::endRun(const edm::Run& r, const edm::EventSetup& context) {
777 }
778 
780 
781  if (fileOutput_) outfile.close();
782 }
783 
784 // Local Variables:
785 // show-trailing-whitespace: t
786 // truncate-lines: t
787 // End:
virtual void endJob()
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
T getParameter(std::string const &) const
static AlgebraicMatrix initialize()
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void endRun(const edm::Run &, const edm::EventSetup &)
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:199
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
double y() const
y coordinate
Definition: Vertex.h:110
unsigned long long EventNumber_t
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
TopDiLeptonDQM(const edm::ParameterSet &)
T sqrt(T t)
Definition: SSEVec.h:48
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
int nJets
number of jets in the cone
Definition: MuonIsolation.h:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
double z() const
y coordinate
Definition: Vertex.h:112
float hoEt
ho sum-Et
Definition: MuonIsolation.h:10
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
DQMStore * dbe_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int nTracks
number of tracks in the cone (excluding veto region)
Definition: MuonIsolation.h:11
bool failedToGet() const
Definition: HandleBase.h:80
double x() const
x coordinate
Definition: Vertex.h:108
bool isFake() const
Definition: Vertex.h:64
T const * product() const
Definition: Handle.h:81
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
virtual void beginJob()
edm::EventID id() const
Definition: EventBase.h:56
tuple muons
Definition: patZpeak.py:38
unsigned int RunNumber_t
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
size_t tracksSize() const
number of tracks
Definition: Vertex.cc:34
Definition: Run.h:41
void beginRun(const edm::Run &, const edm::EventSetup &)