CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
WMuNuValidator Class Reference
Inheritance diagram for WMuNuValidator:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
void fill_histogram (const char *, const double &)
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 
void init_histograms ()
 
 WMuNuValidator (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

double acopCut_
 
double dxyCut_
 
double eJetMin_
 
double etaCut_
 
bool fastOption_
 
std::map< std::string, TH1D * > h1_
 
bool isAlsoTrackerMuon_
 
bool isCombinedIso_
 
double isoCut03_
 
bool isRelativeIso_
 
edm::InputTag jetTag_
 
bool metIncludesMuons_
 
double metMax_
 
double metMin_
 
edm::InputTag metTag_
 
double mtMax_
 
double mtMin_
 
edm::InputTag muonTag_
 
const std::string muonTrig_
 
unsigned int nall
 
unsigned int nhlt
 
unsigned int niso
 
int nJetMax_
 
unsigned int nmet
 
double normalizedChi2Cut_
 
unsigned int nrec
 
unsigned int nsel
 
double ptCut_
 
double ptThrForZ1_
 
double ptThrForZ2_
 
int trackerHitsCut_
 
edm::InputTag trigTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 21 of file WMuNuValidator.cc.

Constructor & Destructor Documentation

WMuNuValidator::WMuNuValidator ( const edm::ParameterSet cfg)

Definition at line 97 of file WMuNuValidator.cc.

97  :
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 }
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag trigTag_
edm::InputTag metTag_
double normalizedChi2Cut_
edm::InputTag jetTag_
edm::InputTag muonTag_
const std::string muonTrig_

Member Function Documentation

void WMuNuValidator::beginJob ( void  )
virtual

Reimplemented from edm::EDFilter.

Definition at line 137 of file WMuNuValidator.cc.

References fastOption_, init_histograms(), nall, nhlt, niso, nmet, nrec, and nsel.

137  {
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 }
unsigned int nsel
unsigned int niso
unsigned int nrec
unsigned int nhlt
unsigned int nmet
unsigned int nall
void WMuNuValidator::endJob ( void  )
virtual

Reimplemented from edm::EDFilter.

Definition at line 242 of file WMuNuValidator.cc.

References cond::ecalcond::all, fastOption_, nall, nhlt, niso, nmet, nrec, nsel, and mathSSE::sqrt().

242  {
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 }
unsigned int nsel
unsigned int niso
unsigned int nrec
T sqrt(T t)
Definition: SSEVec.h:48
unsigned int nhlt
long long int num
Definition: procUtils.cc:71
unsigned int nmet
unsigned int nall
void WMuNuValidator::fill_histogram ( const char *  name,
const double &  var 
)

Definition at line 237 of file WMuNuValidator.cc.

References fastOption_, h1_, and mergeVDriftHistosByStation::name.

Referenced by filter().

237  {
238  if (fastOption_) return;
239  h1_[name]->Fill(var);
240 }
std::map< std::string, TH1D * > h1_
bool WMuNuValidator::filter ( edm::Event ev,
const edm::EventSetup  
)
virtual

Implements edm::EDFilter.

Definition at line 301 of file WMuNuValidator.cc.

References acopCut_, dxyCut_, eJetMin_, reco::MuonIsolation::emEt, reco::LeafCandidate::et(), reco::LeafCandidate::eta(), eta(), etaCut_, fastOption_, fill_histogram(), edm::Event::getByLabel(), muon::GlobalMuonPromptTight, reco::Muon::globalTrack(), reco::MuonIsolation::hadEt, i, reco::Muon::innerTrack(), isCombinedIso_, reco::Muon::isGlobalMuon(), muon::isGoodMuon(), edm::Ref< C, T, F >::isNull(), isoCut03_, reco::Muon::isolationR03(), isRelativeIso_, reco::Muon::isTrackerMuon(), j, metsig::jet, jetTag_, LogTrace, M_PI, CaloMET_cfi::met, metIncludesMuons_, metMax_, metMin_, metTag_, mtMax_, mtMin_, RPCpg::mu, muonTag_, muonTrig_, nall, nhlt, niso, nJetMax_, nmet, nrec, nsel, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), ptCut_, ptThrForZ1_, ptThrForZ2_, reco::LeafCandidate::px(), reco::LeafCandidate::py(), mathSSE::sqrt(), reco::MuonIsolation::sumPt, trackerHitsCut_, edm::TriggerNames::triggerIndex(), edm::Event::triggerNames(), patRefSel_triggerSelection_cff::triggerResults, trigTag_, and Geom::Phi< T >::value().

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

301  {
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 }
unsigned int nsel
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
virtual double et() const GCC11_FINAL
transverse energy
edm::InputTag trigTag_
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:207
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool isTrackerMuon() const
Definition: Muon.h:220
Base class for all types of Jets.
Definition: Jet.h:21
bool isGlobalMuon() const
Definition: Muon.h:219
T eta() const
unsigned int niso
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
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
Definition: MET.h:32
T sqrt(T t)
Definition: SSEVec.h:48
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
edm::InputTag metTag_
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
int j
Definition: DBlmapReader.cc:9
const int mu
Definition: Constants.h:23
unsigned int nhlt
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
#define LogTrace(id)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
T value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:38
#define M_PI
Definition: BFit3D.cc:3
edm::InputTag jetTag_
unsigned int nmet
edm::InputTag muonTag_
void fill_histogram(const char *, const double &)
virtual float pt() const GCC11_FINAL
transverse momentum
const std::string muonTrig_
Definition: Phi.h:20
unsigned int nall
const MuonIsolation & isolationR03() const
Definition: Muon.h:159
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:55
void WMuNuValidator::init_histograms ( )

Definition at line 150 of file WMuNuValidator.cc.

References data, eJetMin_, h1_, i, isCombinedIso_, isRelativeIso_, jetTag_, edm::InputTag::label(), M_PI, TFileDirectory::make(), metTag_, TFileDirectory::mkdir(), muonTrig_, ptThrForZ1_, ptThrForZ2_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by beginJob().

150  {
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 }
int i
Definition: DBlmapReader.cc:9
std::map< std::string, TH1D * > h1_
edm::InputTag metTag_
#define M_PI
Definition: BFit3D.cc:3
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
edm::InputTag jetTag_
std::string const & label() const
Definition: InputTag.h:42
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
T * make() const
make new ROOT object
const std::string muonTrig_

Member Data Documentation

double WMuNuValidator::acopCut_
private

Definition at line 47 of file WMuNuValidator.cc.

Referenced by filter().

double WMuNuValidator::dxyCut_
private

Definition at line 49 of file WMuNuValidator.cc.

Referenced by filter().

double WMuNuValidator::eJetMin_
private

Definition at line 57 of file WMuNuValidator.cc.

Referenced by filter(), and init_histograms().

double WMuNuValidator::etaCut_
private

Definition at line 39 of file WMuNuValidator.cc.

Referenced by filter().

bool WMuNuValidator::fastOption_
private

Definition at line 30 of file WMuNuValidator.cc.

Referenced by beginJob(), endJob(), fill_histogram(), and filter().

std::map<std::string,TH1D*> WMuNuValidator::h1_
private

Definition at line 67 of file WMuNuValidator.cc.

Referenced by fill_histogram(), and init_histograms().

bool WMuNuValidator::isAlsoTrackerMuon_
private

Definition at line 52 of file WMuNuValidator.cc.

bool WMuNuValidator::isCombinedIso_
private

Definition at line 41 of file WMuNuValidator.cc.

Referenced by filter(), and init_histograms().

double WMuNuValidator::isoCut03_
private

Definition at line 42 of file WMuNuValidator.cc.

Referenced by filter().

bool WMuNuValidator::isRelativeIso_
private

Definition at line 40 of file WMuNuValidator.cc.

Referenced by filter(), and init_histograms().

edm::InputTag WMuNuValidator::jetTag_
private

Definition at line 35 of file WMuNuValidator.cc.

Referenced by filter(), and init_histograms().

bool WMuNuValidator::metIncludesMuons_
private

Definition at line 34 of file WMuNuValidator.cc.

Referenced by filter().

double WMuNuValidator::metMax_
private

Definition at line 46 of file WMuNuValidator.cc.

Referenced by filter().

double WMuNuValidator::metMin_
private

Definition at line 45 of file WMuNuValidator.cc.

Referenced by filter().

edm::InputTag WMuNuValidator::metTag_
private

Definition at line 33 of file WMuNuValidator.cc.

Referenced by filter(), and init_histograms().

double WMuNuValidator::mtMax_
private

Definition at line 44 of file WMuNuValidator.cc.

Referenced by filter().

double WMuNuValidator::mtMin_
private

Definition at line 43 of file WMuNuValidator.cc.

Referenced by filter().

edm::InputTag WMuNuValidator::muonTag_
private

Definition at line 32 of file WMuNuValidator.cc.

Referenced by filter().

const std::string WMuNuValidator::muonTrig_
private

Definition at line 37 of file WMuNuValidator.cc.

Referenced by filter(), and init_histograms().

unsigned int WMuNuValidator::nall
private

Definition at line 60 of file WMuNuValidator.cc.

Referenced by beginJob(), endJob(), and filter().

unsigned int WMuNuValidator::nhlt
private

Definition at line 63 of file WMuNuValidator.cc.

Referenced by beginJob(), endJob(), and filter().

unsigned int WMuNuValidator::niso
private

Definition at line 62 of file WMuNuValidator.cc.

Referenced by beginJob(), endJob(), and filter().

int WMuNuValidator::nJetMax_
private

Definition at line 58 of file WMuNuValidator.cc.

Referenced by filter().

unsigned int WMuNuValidator::nmet
private

Definition at line 64 of file WMuNuValidator.cc.

Referenced by beginJob(), endJob(), and filter().

double WMuNuValidator::normalizedChi2Cut_
private

Definition at line 50 of file WMuNuValidator.cc.

unsigned int WMuNuValidator::nrec
private

Definition at line 61 of file WMuNuValidator.cc.

Referenced by beginJob(), endJob(), and filter().

unsigned int WMuNuValidator::nsel
private

Definition at line 65 of file WMuNuValidator.cc.

Referenced by beginJob(), endJob(), and filter().

double WMuNuValidator::ptCut_
private

Definition at line 38 of file WMuNuValidator.cc.

Referenced by filter().

double WMuNuValidator::ptThrForZ1_
private

Definition at line 54 of file WMuNuValidator.cc.

Referenced by filter(), and init_histograms().

double WMuNuValidator::ptThrForZ2_
private

Definition at line 55 of file WMuNuValidator.cc.

Referenced by filter(), and init_histograms().

int WMuNuValidator::trackerHitsCut_
private

Definition at line 51 of file WMuNuValidator.cc.

Referenced by filter().

edm::InputTag WMuNuValidator::trigTag_
private

Definition at line 31 of file WMuNuValidator.cc.

Referenced by filter().