CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
WMuNuValidator.cc
Go to the documentation of this file.
1 // //
3 // WMuNuValidator //
4 // //
6 // //
7 // Basic plots before & after cuts (without Candidate formalism) //
8 // Intended for a prompt validation of samples. //
9 // //
10 // Use in combination with WMuNuValidatorMacro (in bin/WMuNuValidatorMacro.cpp) //
11 // //
13 
14 
18 #include "TH1D.h"
19 #include <map>
20 
21 class WMuNuValidator : public edm::EDFilter {
22 public:
24  virtual bool filter(edm::Event&, const edm::EventSetup&);
25  virtual void beginJob();
26  virtual void endJob();
27  void init_histograms();
28  void fill_histogram(const char*, const double&);
29 private:
36 
37  const std::string muonTrig_;
38  double ptCut_;
39  double etaCut_;
42  double isoCut03_;
43  double mtMin_;
44  double mtMax_;
45  double metMin_;
46  double metMax_;
47  double acopCut_;
48 
49  double dxyCut_;
53 
54  double ptThrForZ1_;
55  double ptThrForZ2_;
56 
57  double eJetMin_;
58  int nJetMax_;
59 
60  unsigned int nall;
61  unsigned int nrec;
62  unsigned int niso;
63  unsigned int nhlt;
64  unsigned int nmet;
65  unsigned int nsel;
66 
67  std::map<std::string,TH1D*> h1_;
68 };
69 
73 
76 
79 
82 
85 
87 
90 
92 
93 using namespace edm;
94 using namespace std;
95 using namespace reco;
96 
98  // Fast selection (no histograms or book-keeping)
99  fastOption_(cfg.getUntrackedParameter<bool> ("FastOption", false)),
100 
101  // Input collections
102  trigTag_(cfg.getUntrackedParameter<edm::InputTag> ("TrigTag", edm::InputTag("TriggerResults::HLT"))),
103  muonTag_(cfg.getUntrackedParameter<edm::InputTag> ("MuonTag", edm::InputTag("muons"))),
104  metTag_(cfg.getUntrackedParameter<edm::InputTag> ("METTag", edm::InputTag("met"))),
105  metIncludesMuons_(cfg.getUntrackedParameter<bool> ("METIncludesMuons", false)),
106  jetTag_(cfg.getUntrackedParameter<edm::InputTag> ("JetTag", edm::InputTag("sisCone5CaloJets"))),
107 
108  // Main cuts
109  muonTrig_(cfg.getUntrackedParameter<std::string> ("MuonTrig", "HLT_Mu9")),
110  ptCut_(cfg.getUntrackedParameter<double>("PtCut", 25.)),
111  etaCut_(cfg.getUntrackedParameter<double>("EtaCut", 2.1)),
112  isRelativeIso_(cfg.getUntrackedParameter<bool>("IsRelativeIso", true)),
113  isCombinedIso_(cfg.getUntrackedParameter<bool>("IsCombinedIso", false)),
114  isoCut03_(cfg.getUntrackedParameter<double>("IsoCut03", 0.1)),
115  mtMin_(cfg.getUntrackedParameter<double>("MtMin", 50.)),
116  mtMax_(cfg.getUntrackedParameter<double>("MtMax", 200.)),
117  metMin_(cfg.getUntrackedParameter<double>("MetMin", -999999.)),
118  metMax_(cfg.getUntrackedParameter<double>("MetMax", 999999.)),
119  acopCut_(cfg.getUntrackedParameter<double>("AcopCut", 2.)),
120 
121  // Muon quality cuts
122  dxyCut_(cfg.getUntrackedParameter<double>("DxyCut", 0.2)),
123  normalizedChi2Cut_(cfg.getUntrackedParameter<double>("NormalizedChi2Cut", 10.)),
124  trackerHitsCut_(cfg.getUntrackedParameter<int>("TrackerHitsCut", 11)),
125  isAlsoTrackerMuon_(cfg.getUntrackedParameter<bool>("IsAlsoTrackerMuon", true)),
126 
127  // Z rejection
128  ptThrForZ1_(cfg.getUntrackedParameter<double>("PtThrForZ1", 20.)),
129  ptThrForZ2_(cfg.getUntrackedParameter<double>("PtThrForZ2", 10.)),
130 
131  // Top rejection
132  eJetMin_(cfg.getUntrackedParameter<double>("EJetMin", 999999.)),
133  nJetMax_(cfg.getUntrackedParameter<int>("NJetMax", 999999))
134 {
135 }
136 
138  nall = 0;
139  nsel = 0;
140 
141  if (!fastOption_) {
142  nrec = 0;
143  niso = 0;
144  nhlt = 0;
145  nmet = 0;
146  init_histograms();
147  }
148 }
149 
152  TFileDirectory subDir0 = fs->mkdir("BeforeCuts");
153  TFileDirectory subDir1 = fs->mkdir("LastCut");
154  TFileDirectory* subDir[2]; subDir[0] = &subDir0; subDir[1] = &subDir1;
155 
156  char chname[256] = "";
157  char chtitle[256] = "";
158  std::string chsuffix[2] = { "_BEFORECUTS", "_LASTCUT" };
159 
160  for (int i=0; i<2; ++i) {
161  snprintf(chname, 255, "PT%s", chsuffix[i].data());
162  snprintf(chtitle, 255, "Muon transverse momentum [GeV]");
163  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,100,0.,100.);
164 
165  snprintf(chname, 255, "ETA%s", chsuffix[i].data());
166  snprintf(chtitle, 255, "Muon pseudo-rapidity");
167  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,50,-2.5,2.5);
168 
169  snprintf(chname, 255, "DXY%s", chsuffix[i].data());
170  snprintf(chtitle, 255, "Muon transverse distance to beam spot [cm]");
171  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,100,-0.5,0.5);
172 
173  snprintf(chname, 255, "CHI2%s", chsuffix[i].data());
174  snprintf(chtitle, 255, "Normalized Chi2, inner track fit");
175  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,100,0.,100.);
176 
177  snprintf(chname, 255, "NHITS%s", chsuffix[i].data());
178  snprintf(chtitle, 255, "Number of hits, inner track");
179  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,40,-0.5,39.5);
180 
181  snprintf(chname, 255, "ValidMuonHits%s", chsuffix[i].data());
182  snprintf(chtitle, 255, "number Of Valid Muon Hits");
183  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,40,-0.5,39.5);
184 
185  snprintf(chname, 255, "TKMU%s", chsuffix[i].data());
186  snprintf(chtitle, 255, "Tracker-muon flag (for global muons)");
187  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,2,-0.5,1.5);
188 
189  snprintf(chname, 255, "ISO%s", chsuffix[i].data());
190  if (isRelativeIso_) {
191  if (isCombinedIso_) {
192  snprintf(chtitle, 255, "Relative (combined) isolation variable");
193  } else {
194  snprintf(chtitle, 255, "Relative (tracker) isolation variable");
195  }
196  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle, 100, 0., 1.);
197  } else {
198  if (isCombinedIso_) {
199  snprintf(chtitle, 255, "Absolute (combined) isolation variable [GeV]");
200  } else {
201  snprintf(chtitle, 255, "Absolute (tracker) isolation variable [GeV]");
202  }
203  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle, 100, 0., 20.);
204  }
205 
206  snprintf(chname, 255, "TRIG%s", chsuffix[i].data());
207  snprintf(chtitle, 255, "Trigger response (bit %s)", muonTrig_.data());
208  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,2,-0.5,1.5);
209 
210  snprintf(chname, 255, "MT%s", chsuffix[i].data());
211  snprintf(chtitle, 255, "Transverse mass (%s) [GeV]", metTag_.label().data());
212  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,150,0.,300.);
213 
214  snprintf(chname, 255, "MET%s", chsuffix[i].data());
215  snprintf(chtitle, 255, "Missing transverse energy (%s) [GeV]", metTag_.label().data());
216  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,100,0.,200.);
217 
218  snprintf(chname, 255, "ACOP%s", chsuffix[i].data());
219  snprintf(chtitle, 255, "MU-MET (%s) acoplanarity", metTag_.label().data());
220  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,50,0.,M_PI);
221 
222  snprintf(chname, 255, "NZ1%s", chsuffix[i].data());
223  snprintf(chtitle, 255, "Z rejection: number of muons above %.2f GeV", ptThrForZ1_);
224  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle, 10, -0.5, 9.5);
225 
226  snprintf(chname, 255, "NZ2%s", chsuffix[i].data());
227  snprintf(chtitle, 255, "Z rejection: number of muons above %.2f GeV", ptThrForZ2_);
228  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle, 10, -0.5, 9.5);
229 
230  snprintf(chname, 255, "NJETS%s", chsuffix[i].data());
231  snprintf(chtitle, 255, "Number of jets (%s) above %.2f GeV", jetTag_.label().data(), eJetMin_);
232  h1_[chname] = subDir[i]->make<TH1D>(chname,chtitle,10,-0.5,9.5);
233 
234  }
235 }
236 
237 void WMuNuValidator::fill_histogram(const char* name, const double& var) {
238  if (fastOption_) return;
239  h1_[name]->Fill(var);
240 }
241 
243  double all = nall;
244  double esel = nsel/all;
245  LogVerbatim("") << "\n>>>>>> W SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
246  LogVerbatim("") << "Total numer of events analyzed: " << nall << " [events]";
247  LogVerbatim("") << "Total numer of events selected: " << nsel << " [events]";
248  LogVerbatim("") << "Overall efficiency: " << "(" << setprecision(4) << esel*100. <<" +/- "<< setprecision(2) << sqrt(esel*(1-esel)/all)*100. << ")%";
249 
250  if (!fastOption_) {
251  double erec = nrec/all;
252  double eiso = niso/all;
253  double ehlt = nhlt/all;
254  double emet = nmet/all;
255 
256  double num = nrec;
257  double eff = erec;
258  double err = sqrt(eff*(1-eff)/all);
259  LogVerbatim("") << "Passing Pt/Eta/Quality cuts: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%";
260 
261  num = niso;
262  eff = eiso;
263  err = sqrt(eff*(1-eff)/all);
264  double effstep = 0.;
265  double errstep = 0.;
266  if (nrec>0) effstep = eiso/erec;
267  if (nrec>0) errstep = sqrt(effstep*(1-effstep)/nrec);
268  LogVerbatim("") << "Passing isolation cuts: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
269 
270  num = nhlt;
271  eff = ehlt;
272  err = sqrt(eff*(1-eff)/all);
273  effstep = 0.;
274  errstep = 0.;
275  if (niso>0) effstep = ehlt/eiso;
276  if (niso>0) errstep = sqrt(effstep*(1-effstep)/niso);
277  LogVerbatim("") << "Passing HLT criteria: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
278 
279  num = nmet;
280  eff = emet;
281  err = sqrt(eff*(1-eff)/all);
282  effstep = 0.;
283  errstep = 0.;
284  if (nhlt>0) effstep = emet/ehlt;
285  if (nhlt>0) errstep = sqrt(effstep*(1-effstep)/nhlt);
286  LogVerbatim("") << "Passing MET/acoplanarity cuts: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
287 
288  num = nsel;
289  eff = esel;
290  err = sqrt(eff*(1-eff)/all);
291  effstep = 0.;
292  errstep = 0.;
293  if (nmet>0) effstep = esel/emet;
294  if (nmet>0) errstep = sqrt(effstep*(1-effstep)/nmet);
295  LogVerbatim("") << "Passing Z/top rejection cuts: " << num << " [events], (" << setprecision(4) << eff*100. <<" +/- "<< setprecision(2) << err*100. << ")%, to previous step: (" << setprecision(4) << effstep*100. << " +/- "<< setprecision(2) << errstep*100. <<")%";
296  }
297 
298  LogVerbatim("") << ">>>>>> W SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
299 }
300 
302 
303  // Reset global event selection flags
304  bool rec_sel = false;
305  bool iso_sel = false;
306  bool hlt_sel = false;
307  bool met_sel = false;
308  bool all_sel = false;
309 
310  // Muon collection
311  Handle<View<Muon> > muonCollection;
312  if (!ev.getByLabel(muonTag_, muonCollection)) {
313  LogError("") << ">>> Muon collection does not exist !!!";
314  return false;
315  }
316  unsigned int muonCollectionSize = muonCollection->size();
317 
318  // Beam spot
319  Handle<reco::BeamSpot> beamSpotHandle;
320  if (!ev.getByLabel(InputTag("offlineBeamSpot"), beamSpotHandle)) {
321  LogTrace("") << ">>> No beam spot found !!!";
322  return false;
323  }
324 
325  // MET
326  double met_px = 0.;
327  double met_py = 0.;
328  Handle<View<MET> > metCollection;
329  if (!ev.getByLabel(metTag_, metCollection)) {
330  LogError("") << ">>> MET collection does not exist !!!";
331  return false;
332  }
333  const MET& met = metCollection->at(0);
334  met_px = met.px();
335  met_py = met.py();
336  if (!metIncludesMuons_) {
337  for (unsigned int i=0; i<muonCollectionSize; i++) {
338  const Muon& mu = muonCollection->at(i);
339  if (!mu.isGlobalMuon()) continue;
340  met_px -= mu.px();
341  met_py -= mu.py();
342  }
343  }
344  double met_et = sqrt(met_px*met_px+met_py*met_py);
345  LogTrace("") << ">>> MET, MET_px, MET_py: " << met_et << ", " << met_px << ", " << met_py << " [GeV]";
346  fill_histogram("MET_BEFORECUTS",met_et);
347 
348  // Trigger
350  if (!ev.getByLabel(trigTag_, triggerResults)) {
351  LogError("") << ">>> TRIGGER collection does not exist !!!";
352  return false;
353  }
354  const edm::TriggerNames & triggerNames = ev.triggerNames(*triggerResults);
355  /*
356  for (unsigned int i=0; i<triggerResults->size(); i++) {
357  if (triggerResults->accept(i)) {
358  LogTrace("") << "Accept by: " << i << ", Trigger: " << triggerNames.triggerName(i);
359  }
360  }
361  */
362  bool trigger_fired = false;
363  int itrig1 = triggerNames.triggerIndex(muonTrig_);
364  if (triggerResults->accept(itrig1)) trigger_fired = true;
365  LogTrace("") << ">>> Trigger bit: " << trigger_fired << " (" << muonTrig_ << ")";
366  fill_histogram("TRIG_BEFORECUTS",trigger_fired);
367 
368  // Loop to reject/control Z->mumu is done separately
369  unsigned int nmuonsForZ1 = 0;
370  unsigned int nmuonsForZ2 = 0;
371  for (unsigned int i=0; i<muonCollectionSize; i++) {
372  const Muon& mu = muonCollection->at(i);
373  if (!mu.isGlobalMuon()) continue;
374  double pt = mu.pt();
375  if (pt>ptThrForZ1_) nmuonsForZ1++;
376  if (pt>ptThrForZ2_) nmuonsForZ2++;
377  }
378  LogTrace("") << "> Z rejection: muons above " << ptThrForZ1_ << " [GeV]: " << nmuonsForZ1;
379  LogTrace("") << "> Z rejection: muons above " << ptThrForZ2_ << " [GeV]: " << nmuonsForZ2;
380  fill_histogram("NZ1_BEFORECUTS",nmuonsForZ1);
381  fill_histogram("NZ2_BEFORECUTS",nmuonsForZ2);
382 
383  // Jet collection
384  Handle<View<Jet> > jetCollection;
385  if (!ev.getByLabel(jetTag_, jetCollection)) {
386  LogError("") << ">>> JET collection does not exist !!!";
387  return false;
388  }
389  unsigned int jetCollectionSize = jetCollection->size();
390  int njets = 0;
391  for (unsigned int i=0; i<jetCollectionSize; i++) {
392  const Jet& jet = jetCollection->at(i);
393  if (jet.et()>eJetMin_) njets++;
394  }
395  LogTrace("") << ">>> Total number of jets: " << jetCollectionSize;
396  LogTrace("") << ">>> Number of jets above " << eJetMin_ << " [GeV]: " << njets;
397  fill_histogram("NJETS_BEFORECUTS",njets);
398 
399  // Start counting, reject already events if possible (under FastOption flag)
400  nall++;
401  if (fastOption_ && !trigger_fired) return false;
402  if (fastOption_ && nmuonsForZ1>=1 && nmuonsForZ2>=2) return false;
403  if (fastOption_ && njets>nJetMax_) return false;
404 
405  // Histograms per event shouldbe done only once, so keep track of them
406  bool hlt_hist_done = false;
407  bool met_hist_done = false;
408  bool nz1_hist_done = false;
409  bool nz2_hist_done = false;
410  bool njets_hist_done = false;
411 
412  // Central W->mu nu selection criteria
413  const int NFLAGS = 13;
414  bool muon_sel[NFLAGS];
415  for (unsigned int i=0; i<muonCollectionSize; i++) {
416  for (int j=0; j<NFLAGS; ++j) {
417  muon_sel[j] = false;
418  }
419 
420  const Muon& mu = muonCollection->at(i);
421  if (!mu.isGlobalMuon()) continue;
422  if (mu.globalTrack().isNull()) continue;
423  if (mu.innerTrack().isNull()) continue;
424 
425  LogTrace("") << "> Wsel: processing muon number " << i << "...";
426  reco::TrackRef gm = mu.globalTrack();
427  //reco::TrackRef tk = mu.innerTrack();
428 
429  // Pt,eta cuts
430  double pt = mu.pt();
431  double eta = mu.eta();
432  LogTrace("") << "\t... pt, eta: " << pt << " [GeV], " << eta;;
433  if (pt>ptCut_) muon_sel[0] = true;
434  else if (fastOption_) continue;
435  if (fabs(eta)<etaCut_) muon_sel[1] = true;
436  else if (fastOption_) continue;
437 
438  // d0, chi2, nhits quality cuts
439  double dxy = gm->dxy(beamSpotHandle->position());
440  double normalizedChi2 = gm->normalizedChi2();
441  double validmuonhits=gm->hitPattern().numberOfValidMuonHits();
442  //double standalonehits=mu.outerTrack()->numberOfValidHits();
443  double trackerHits = gm->hitPattern().numberOfValidTrackerHits();
444  LogTrace("") << "\t... dxy, normalizedChi2, trackerHits, isTrackerMuon?: " << dxy << " [cm], " << normalizedChi2 << ", " << trackerHits << ", " << mu.isTrackerMuon();
445  if (fabs(dxy)<dxyCut_) muon_sel[2] = true;
446  else if (fastOption_) continue;
447  if (muon::isGoodMuon(mu,muon::GlobalMuonPromptTight)) muon_sel[3] = true;
448  else if (fastOption_) continue;
449  if (trackerHits>=trackerHitsCut_) muon_sel[4] = true;
450  else if (fastOption_) continue;
451  if (mu.isTrackerMuon()) muon_sel[5] = true;
452  else if (fastOption_) continue;
453 
454  fill_histogram("PT_BEFORECUTS",pt);
455  fill_histogram("ETA_BEFORECUTS",eta);
456  fill_histogram("DXY_BEFORECUTS",dxy);
457  fill_histogram("CHI2_BEFORECUTS",normalizedChi2);
458  fill_histogram("NHITS_BEFORECUTS",trackerHits);
459  fill_histogram("ValidMuonHits_BEFORECUTS",validmuonhits);
460  fill_histogram("TKMU_BEFORECUTS",mu.isTrackerMuon());
461 
462  // Isolation cuts
463  double isovar = mu.isolationR03().sumPt;
464  if (isCombinedIso_) {
465  isovar += mu.isolationR03().emEt;
466  isovar += mu.isolationR03().hadEt;
467  }
468  if (isRelativeIso_) isovar /= pt;
469  if (isovar<isoCut03_) muon_sel[6] = true;
470  else if (fastOption_) continue;
471  LogTrace("") << "\t... isolation value" << isovar <<", isolated? " << muon_sel[6];
472  fill_histogram("ISO_BEFORECUTS",isovar);
473 
474  // HLT (not mtched to muon for the time being)
475  if (trigger_fired) muon_sel[7] = true;
476  else if (fastOption_) continue;
477 
478  // MET/MT cuts
479  double w_et = met_et+ mu.pt();
480  double w_px = met_px+ mu.px();
481  double w_py = met_py+mu.py();
482  double massT = w_et*w_et - w_px*w_px - w_py*w_py;
483  massT = (massT>0) ? sqrt(massT) : 0;
484 
485  LogTrace("") << "\t... W mass, W_et, W_px, W_py: " << massT << ", " << w_et << ", " << w_px << ", " << w_py << " [GeV]";
486  if (massT>mtMin_ && massT<mtMax_) muon_sel[8] = true;
487  else if (fastOption_) continue;
488  fill_histogram("MT_BEFORECUTS",massT);
489  if (met_et>metMin_ && met_et<metMax_) muon_sel[9] = true;
490  else if (fastOption_) continue;
491 
492  // Acoplanarity cuts
493  Geom::Phi<double> deltaphi(mu.phi()-atan2(met_py,met_px));
494  double acop = deltaphi.value();
495  if (acop<0) acop = - acop;
496  acop = M_PI - acop;
497  LogTrace("") << "\t... acoplanarity: " << acop;
498  if (acop<acopCut_) muon_sel[10] = true;
499  else if (fastOption_) continue;
500  fill_histogram("ACOP_BEFORECUTS",acop);
501 
502  // Remaining flags (from global event information)
503  if (nmuonsForZ1<1 || nmuonsForZ2<2) muon_sel[11] = true;
504  else if (fastOption_) continue;
505  if (njets<=nJetMax_) muon_sel[12] = true;
506  else if (fastOption_) continue;
507 
508  if (fastOption_) {
509  all_sel = true;
510  break;
511  } else {
512  // Collect necessary flags "per muon"
513  int flags_passed = 0;
514  bool rec_sel_this = true;
515  bool iso_sel_this = true;
516  bool hlt_sel_this = true;
517  bool met_sel_this = true;
518  bool all_sel_this = true;
519  for (int j=0; j<NFLAGS; ++j) {
520  if (muon_sel[j]) flags_passed += 1;
521  if (j<6 && !muon_sel[j]) rec_sel_this = false;
522  if (j<7 && !muon_sel[j]) iso_sel_this = false;
523  if (j<8 && !muon_sel[j]) hlt_sel_this = false;
524  if (j<11 && !muon_sel[j]) met_sel_this = false;
525  if (!muon_sel[j]) all_sel_this = false;
526  }
527 
528  // "rec" => pt,eta and quality cuts are satisfied
529  if (rec_sel_this) rec_sel = true;
530  // "iso" => "rec" AND "muon is isolated"
531  if (iso_sel_this) iso_sel = true;
532  // "hlt" => "iso" AND "event is triggered"
533  if (hlt_sel_this) hlt_sel = true;
534  // "met" => "hlt" AND "MET/MT and acoplanarity cuts"
535  if (met_sel_this) met_sel = true;
536  // "all" => "met" AND "Z/top rejection cuts"
537  if (all_sel_this) all_sel = true;
538 
539  // Do N-1 histograms now (and only once for global event quantities)
540  if (flags_passed >= (NFLAGS-1)) {
541  if (!muon_sel[0] || flags_passed==NFLAGS)
542  fill_histogram("PT_LASTCUT",pt);
543  if (!muon_sel[1] || flags_passed==NFLAGS)
544  fill_histogram("ETA_LASTCUT",eta);
545  if (!muon_sel[2] || flags_passed==NFLAGS)
546  fill_histogram("DXY_LASTCUT",dxy);
547  if (!muon_sel[3] || flags_passed==NFLAGS)
548  fill_histogram("CHI2_LASTCUT",normalizedChi2);
549  fill_histogram("ValidMuonHits_LASTCUT",validmuonhits);
550  if (!muon_sel[4] || flags_passed==NFLAGS)
551  fill_histogram("NHITS_LASTCUT",trackerHits);
552  if (!muon_sel[5] || flags_passed==NFLAGS)
553  fill_histogram("TKMU_LASTCUT",mu.isTrackerMuon());
554  if (!muon_sel[6] || flags_passed==NFLAGS)
555  fill_histogram("ISO_LASTCUT",isovar);
556  if (!muon_sel[7] || flags_passed==NFLAGS)
557  if (!hlt_hist_done) fill_histogram("TRIG_LASTCUT",trigger_fired);
558  hlt_hist_done = true;
559  if (!muon_sel[8] || flags_passed==NFLAGS)
560  fill_histogram("MT_LASTCUT",massT);
561  if (!muon_sel[9] || flags_passed==NFLAGS)
562  if (!met_hist_done) fill_histogram("MET_LASTCUT",met_et);
563  met_hist_done = true;
564  if (!muon_sel[10] || flags_passed==NFLAGS)
565  fill_histogram("ACOP_LASTCUT",acop);
566  if (!muon_sel[11] || flags_passed==NFLAGS)
567  if (!nz1_hist_done) fill_histogram("NZ1_LASTCUT",nmuonsForZ1);
568  nz1_hist_done = true;
569  if (!muon_sel[11] || flags_passed==NFLAGS)
570  if (!nz2_hist_done) fill_histogram("NZ2_LASTCUT",nmuonsForZ2);
571  nz2_hist_done = true;
572  if (!muon_sel[12] || flags_passed==NFLAGS)
573  if (!njets_hist_done) fill_histogram("NJETS_LASTCUT",njets);
574  njets_hist_done = true;
575  }
576  }
577 
578  }
579 
580  // Collect final flags
581  if (!fastOption_) {
582  if (rec_sel) nrec++;
583  if (iso_sel) niso++;
584  if (hlt_sel) nhlt++;
585  if (met_sel) nmet++;
586  }
587 
588  if (all_sel) {
589  nsel++;
590  LogTrace("") << ">>>> Event ACCEPTED";
591  } else {
592  LogTrace("") << ">>>> Event REJECTED";
593  }
594 
595  return all_sel;
596 
597 }
598 
600 
unsigned int nsel
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
int i
Definition: DBlmapReader.cc:9
edm::InputTag trigTag_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:199
std::map< std::string, TH1D * > h1_
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
virtual void endJob()
virtual double et() const
transverse energy
virtual TrackRef innerTrack() const
Definition: Muon.h:49
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool isTrackerMuon() const
Definition: Muon.h:212
Base class for all types of Jets.
Definition: Jet.h:21
bool isGlobalMuon() const
Definition: Muon.h:211
T eta() const
unsigned int niso
virtual double eta() const
momentum pseudorapidity
unsigned int nrec
bool isNull() const
Checks for null.
Definition: Ref.h:247
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
virtual void beginJob()
Definition: MET.h:32
T sqrt(T t)
Definition: SSEVec.h:46
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
edm::InputTag metTag_
int j
Definition: DBlmapReader.cc:9
WMuNuValidator(const edm::ParameterSet &)
double normalizedChi2Cut_
const int mu
Definition: Constants.h:23
unsigned int nhlt
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
#define LogTrace(id)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
T value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:38
#define M_PI
Definition: BFit3D.cc:3
virtual double px() const
x coordinate of momentum vector
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
virtual double pt() const
transverse momentum
long long int num
Definition: procUtils.cc:71
edm::InputTag jetTag_
unsigned int nmet
std::string const & label() const
Definition: InputTag.h:25
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
edm::InputTag muonTag_
T * make() const
make new ROOT object
void fill_histogram(const char *, const double &)
const std::string muonTrig_
virtual double phi() const
momentum azimuthal angle
Definition: Phi.h:20
virtual double py() const
y coordinate of momentum vector
unsigned int nall
const MuonIsolation & isolationR03() const
Definition: Muon.h:159
virtual bool filter(edm::Event &, const edm::EventSetup &)
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:55