test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EwkTauDQM.cc
Go to the documentation of this file.
2 
4 
7 
9 
11  const std::string& dqmSubDirectory) {
12  //--- concatenate names of dqmRootDirectory and dqmSubDirectory;
13  // add "/" separator inbetween if necessary
15  if (dirName != "" &&
16  dirName.find_last_of(dqmSeparator) != (dirName.length() - 1))
17  dirName.append(dqmSeparator);
18  dirName.append(dqmSubDirectory);
19  return dirName;
20 }
21 
23  : dqmDirectory_(cfg.getParameter<std::string>("dqmDirectory")) {
24  maxNumWarnings_ = cfg.exists("maxNumWarnings")
25  ? cfg.getParameter<int>("maxNumWarnings")
26  : 1;
27 
28  edm::ParameterSet cfgChannels =
29  cfg.getParameter<edm::ParameterSet>("channels");
30 
31  edm::ParameterSet cfgElecTauChannel =
32  cfgChannels.getParameter<edm::ParameterSet>("elecTauChannel");
33  std::string dqmSubDirectoryElecTauChannel =
34  cfgElecTauChannel.getParameter<std::string>("dqmSubDirectory");
35  cfgElecTauChannel.addParameter<std::string>(
36  "dqmDirectory",
37  dqmDirectoryName(dqmDirectory_, dqmSubDirectoryElecTauChannel));
38  cfgElecTauChannel.addParameter<int>("maxNumWarnings", maxNumWarnings_);
39  elecTauHistManager_ = new EwkElecTauHistManager(cfgElecTauChannel);
40 
41  edm::ParameterSet cfgMuTauChannel =
42  cfgChannels.getParameter<edm::ParameterSet>("muTauChannel");
43  std::string dqmSubDirectoryMuTauChannel =
44  cfgMuTauChannel.getParameter<std::string>("dqmSubDirectory");
45  cfgMuTauChannel.addParameter<std::string>(
46  "dqmDirectory",
47  dqmDirectoryName(dqmDirectory_, dqmSubDirectoryMuTauChannel));
48  cfgMuTauChannel.addParameter<int>("maxNumWarnings", maxNumWarnings_);
49  muTauHistManager_ = new EwkMuTauHistManager(cfgMuTauChannel);
50 }
51 
53  delete elecTauHistManager_;
54  delete muTauHistManager_;
55 }
56 
58  edm::Run const &,
59  edm::EventSetup const &) {
62 }
63 
64 void EwkTauDQM::analyze(const edm::Event& evt, const edm::EventSetup& es) {
67 }
68 
69 void EwkTauDQM::endRun(const edm::Run &, const edm::EventSetup &) {
72 }
73 
74 //-------------------------------------------------------------------------------
75 // code specific to Z --> e + tau-jet channel
76 //-------------------------------------------------------------------------------
77 
79 
82 
100 
101 #include "TMath.h"
102 
103 #include <iostream>
104 #include <iomanip>
105 
107  : dqmDirectory_(cfg.getParameter<std::string>("dqmDirectory")),
108  numEventsAnalyzed_(0),
109  numEventsSelected_(0),
110  cfgError_(0),
111  numWarningsTriggerResults_(0),
112  numWarningsHLTpath_(0),
113  numWarningsVertex_(0),
114  numWarningsBeamSpot_(0),
115  numWarningsElectron_(0),
116  numWarningsTauJet_(0),
117  numWarningsTauDiscrByLeadTrackFinding_(0),
118  numWarningsTauDiscrByLeadTrackPtCut_(0),
119  numWarningsTauDiscrByTrackIso_(0),
120  numWarningsTauDiscrByEcalIso_(0),
121  numWarningsTauDiscrAgainstElectrons_(0),
122  numWarningsTauDiscrAgainstMuons_(0),
123  numWarningsCaloMEt_(0),
124  numWarningsPFMEt_(0) {
126  cfg.getParameter<edm::InputTag>("triggerResultsSource");
127  vertexSource_ = cfg.getParameter<edm::InputTag>("vertexSource");
128  beamSpotSource_ = cfg.getParameter<edm::InputTag>("beamSpotSource");
129  electronSource_ = cfg.getParameter<edm::InputTag>("electronSource");
130  tauJetSource_ = cfg.getParameter<edm::InputTag>("tauJetSource");
131  caloMEtSource_ = cfg.getParameter<edm::InputTag>("caloMEtSource");
132  pfMEtSource_ = cfg.getParameter<edm::InputTag>("pfMEtSource");
133 
135  cfg.getParameter<edm::InputTag>("tauDiscrByLeadTrackFinding");
137  cfg.getParameter<edm::InputTag>("tauDiscrByLeadTrackPtCut");
138  tauDiscrByTrackIso_ = cfg.getParameter<edm::InputTag>("tauDiscrByTrackIso");
139  tauDiscrByEcalIso_ = cfg.getParameter<edm::InputTag>("tauDiscrByEcalIso");
141  cfg.getParameter<edm::InputTag>("tauDiscrAgainstElectrons");
143  cfg.getParameter<edm::InputTag>("tauDiscrAgainstMuons");
144 
145  hltPaths_ = cfg.getParameter<vstring>("hltPaths");
146 
147  electronEtaCut_ = cfg.getParameter<double>("electronEtaCut");
148  electronPtCut_ = cfg.getParameter<double>("electronPtCut");
149  electronTrackIsoCut_ = cfg.getParameter<double>("electronTrackIsoCut");
150  electronEcalIsoCut_ = cfg.getParameter<double>("electronEcalIsoCut");
151  std::string electronIsoMode_string =
152  cfg.getParameter<std::string>("electronIsoMode");
153  electronIsoMode_ = getIsoMode(electronIsoMode_string, cfgError_);
154 
155  tauJetEtaCut_ = cfg.getParameter<double>("tauJetEtaCut");
156  tauJetPtCut_ = cfg.getParameter<double>("tauJetPtCut");
157 
158  visMassCut_ = cfg.getParameter<double>("visMassCut");
159 
160  maxNumWarnings_ = cfg.exists("maxNumWarnings")
161  ? cfg.getParameter<int>("maxNumWarnings")
162  : 1;
163 }
164 
167  hElectronPt_ = iBooker.book1D("ElectronPt", "P_{T}^{e}", 20, 0., 100.);
168  hElectronEta_ = iBooker.book1D("ElectronEta", "#eta_{e}", 20, -4.0, +4.0);
169  hElectronPhi_ = iBooker.book1D("ElectronPhi", "#phi_{e}", 20, -TMath::Pi(),
170  +TMath::Pi());
171  hElectronTrackIsoPt_ = iBooker.book1D(
172  "ElectronTrackIsoPt", "Electron Track Iso.", 20, -0.01, 0.5);
173  hElectronEcalIsoPt_ = iBooker.book1D("ElectronEcalIsoPt",
174  "Electron Ecal Iso.", 20, -0.01, 0.5);
175  hTauJetPt_ = iBooker.book1D("TauJetPt", "P_{T}^{#tau-Jet}", 20, 0., 100.);
176  hTauJetEta_ =
177  iBooker.book1D("TauJetEta", "#eta_{#tau-Jet}", 20, -4.0, +4.0);
178  hVisMass_ =
179  iBooker.book1D("VisMass", "e + #tau-Jet visible Mass", 20, 20., 120.);
180  hMtElecPFMEt_ = iBooker.book1D(
181  "MtElecPFMEt", "e + E_{T}^{miss} (PF) transverse Mass", 20, 20., 120.);
183  iBooker.book1D("ElecTauAcoplanarity", "#Delta #phi_{e #tau-Jet}", 20,
184  -TMath::Pi(), +TMath::Pi());
186  iBooker.book1D("ElecTauCharge", "Q_{e * #tau-Jet}", 5, -2.5, +2.5);
187  hVertexZ_ =
188  iBooker.book1D("VertexZ", "Event Vertex z-Position", 20, -25., +25.);
189  hCaloMEtPt_ =
190  iBooker.book1D("CaloMEtPt", "E_{T}^{miss} (Calo)", 20, 0., 100.);
191  hPFMEtPt_ = iBooker.book1D("PFMEtPt", "E_{T}^{miss} (PF)", 20, 0., 100.);
193  iBooker.book1D("CutFlowSummary", "Cut-flow Summary", 11, 0.5, 11.5);
199  hCutFlowSummary_->setBinLabel(kPassedTauLeadTrack, "#tau lead. Track");
201  "#tau lead. Track P_{T}");
203  "#tau anti-e Discr.");
205  "#tau anti-#mu Discr.");
206  hCutFlowSummary_->setBinLabel(kPassedTauTrackIso, "#tau Track Iso.");
207  hCutFlowSummary_->setBinLabel(kPassedTauEcalIso, "#tau Ecal Iso.");
208 }
209 
211  const edm::EventSetup& es) {
212  if (cfgError_) return;
213 
214  //-----------------------------------------------------------------------------
215  // access event-level information
216  //-----------------------------------------------------------------------------
217 
218  bool readError = false;
219 
220  //--- get decision of high-level trigger for the event
222  readEventData(evt, triggerResultsSource_, hltDecision,
224  "Failed to access Trigger results");
225  if (readError) return;
226 
227  const edm::TriggerNames& triggerNames = evt.triggerNames(*hltDecision);
228 
229  bool isTriggered = false;
230  for (vstring::const_iterator hltPath = hltPaths_.begin();
231  hltPath != hltPaths_.end(); ++hltPath) {
232  unsigned int index = triggerNames.triggerIndex(*hltPath);
233  if (index < triggerNames.size()) {
234  if (hltDecision->accept(index)) isTriggered = true;
235  } else {
237  edm::LogWarning("EwkElecTauHistManager")
238  << " Undefined HLT path = " << (*hltPath) << " !!";
240  continue;
241  }
242  }
243 
244  //--- get reconstructed primary event vertex of the event
245  // (take as "the" primary event vertex the first entry in the collection
246  // of vertex objects, corresponding to the vertex associated to the highest
247  // Pt sum of tracks)
249  readEventData(evt, vertexSource_, vertexCollection, numWarningsVertex_,
250  maxNumWarnings_, readError,
251  "Failed to access Vertex collection");
252  if (readError) return;
253 
254  const reco::Vertex* theEventVertex =
255  (vertexCollection->size() > 0) ? &(vertexCollection->at(0)) : 0;
256 
257  //--- get beam-spot (expected vertex position) for the event
260  maxNumWarnings_, readError, "Failed to access Beam-spot");
261  if (readError) return;
262 
263  //--- get collections of reconstructed electrons from the event
266  maxNumWarnings_, readError,
267  "Failed to access Electron collection");
268  if (readError) return;
269 
270  const reco::GsfElectron* theElectron =
272 
273  double theElectronTrackIsoPt = 1.e+3;
274  double theElectronEcalIsoPt = 1.e+3;
275  double theElectronHcalIsoPt = 1.e+3;
276  if (theElectron) {
277  theElectronTrackIsoPt = theElectron->dr03TkSumPt();
278  theElectronEcalIsoPt = theElectron->dr03EcalRecHitSumEt();
279  theElectronHcalIsoPt = theElectron->dr03HcalTowerSumEt();
280 
281  if (electronIsoMode_ == kRelativeIso && theElectron->pt() > 0.) {
282  theElectronTrackIsoPt /= theElectron->pt();
283  theElectronEcalIsoPt /= theElectron->pt();
284  theElectronHcalIsoPt /= theElectron->pt();
285  }
286  }
287 
288  //--- get collections of reconstructed tau-jets from the event
291  maxNumWarnings_, readError,
292  "Failed to access Tau-jet collection");
293  if (readError) return;
294 
295  //--- get collections of tau-jet discriminators for those tau-jets
296  edm::Handle<reco::PFTauDiscriminator> tauDiscrByLeadTrackFinding;
297  readEventData(evt, tauDiscrByLeadTrackFinding_, tauDiscrByLeadTrackFinding,
299  readError,
300  "Failed to access collection of pf. Tau discriminators by "
301  "leading Track finding");
302  edm::Handle<reco::PFTauDiscriminator> tauDiscrByLeadTrackPtCut;
303  readEventData(evt, tauDiscrByLeadTrackPtCut_, tauDiscrByLeadTrackPtCut,
305  readError,
306  "Failed to access collection of pf. Tau discriminators by "
307  "leading Track Pt cut");
308  edm::Handle<reco::PFTauDiscriminator> tauDiscrByTrackIso;
309  readEventData(evt, tauDiscrByTrackIso_, tauDiscrByTrackIso,
311  "Failed to access collection of pf. Tau discriminators by "
312  "Track isolation");
313  edm::Handle<reco::PFTauDiscriminator> tauDiscrByEcalIso;
314  readEventData(evt, tauDiscrByTrackIso_, tauDiscrByEcalIso,
316  "Failed to access collection of pf. Tau discriminators by ECAL "
317  "isolation");
318  edm::Handle<reco::PFTauDiscriminator> tauDiscrAgainstElectrons;
319  readEventData(evt, tauDiscrAgainstElectrons_, tauDiscrAgainstElectrons,
321  readError,
322  "Failed to access collection of pf. Tau discriminators against "
323  "Electrons");
324  edm::Handle<reco::PFTauDiscriminator> tauDiscrAgainstMuons;
326  evt, tauDiscrAgainstMuons_, tauDiscrAgainstMuons,
328  "Failed to access collection of pf. Tau discriminators against Muons");
329  if (readError) return;
330 
331  int theTauJetIndex = -1;
332  const reco::PFTau* theTauJet =
333  getTheTauJet(*tauJets, tauJetEtaCut_, tauJetPtCut_, theTauJetIndex);
334 
335  double theTauDiscrByLeadTrackFinding = -1.;
336  double theTauDiscrByLeadTrackPtCut = -1.;
337  double theTauDiscrByTrackIso = -1.;
338  double theTauDiscrByEcalIso = -1.;
339  double theTauDiscrAgainstElectrons = -1.;
340  double theTauDiscrAgainstMuons = -1.;
341  if (theTauJetIndex != -1) {
342  reco::PFTauRef theTauJetRef(tauJets, theTauJetIndex);
343  theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
344  theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
345  theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
346  theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
347  theTauDiscrAgainstElectrons = (*tauDiscrAgainstElectrons)[theTauJetRef];
348  theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
349  }
350 
351  //--- get missing transverse momentum
352  // measured by calorimeters/reconstructed by particle-flow algorithm
353  edm::Handle<reco::CaloMETCollection> caloMEtCollection;
354  readEventData(evt, caloMEtSource_, caloMEtCollection, numWarningsCaloMEt_,
355  maxNumWarnings_, readError,
356  "Failed to access calo. MET collection");
357  if (readError) return;
358 
359  const reco::CaloMET& caloMEt = caloMEtCollection->at(0);
360 
361  edm::Handle<reco::PFMETCollection> pfMEtCollection;
362  readEventData(evt, pfMEtSource_, pfMEtCollection, numWarningsPFMEt_,
363  maxNumWarnings_, readError,
364  "Failed to access pf. MET collection");
365  if (readError) return;
366 
367  const reco::PFMET& pfMEt = pfMEtCollection->at(0);
368 
369  if (!(theElectron && theTauJet && theTauJetIndex != -1)) return;
370 
371  //-----------------------------------------------------------------------------
372  // compute EWK tau analysis specific quantities
373  //-----------------------------------------------------------------------------
374 
375  double dPhiElecTau = calcDeltaPhi(theElectron->phi(), theTauJet->phi());
376 
377  double mElecTau = (theElectron->p4() + theTauJet->p4()).M();
378 
379  // double mtElecCaloMEt = calcMt(theElectron->px(), theElectron->py(),
380  // caloMEt.px(), caloMEt.py());
381  double mtElecPFMEt =
382  calcMt(theElectron->px(), theElectron->py(), pfMEt.px(), pfMEt.py());
383 
384  // double pZetaCaloMEt = calcPzeta(theElectron->p4(), theTauJet->p4(),
385  // caloMEt.px(), caloMEt.py());
386  // double pZetaPFMEt = calcPzeta(theElectron->p4(), theTauJet->p4(),
387  // pfMEt.px(), pfMEt.py());
388 
389  //-----------------------------------------------------------------------------
390  // apply selection criteria; fill histograms
391  //-----------------------------------------------------------------------------
392 
393  //--- fill electron multiplicity histogram
394  unsigned numIdElectrons = 0;
395  for (reco::GsfElectronCollection::const_iterator electron =
396  electrons->begin();
397  electron != electrons->end(); ++electron) {
398  if (passesElectronId(*electron)) {
399  ++numIdElectrons;
400  }
401  }
402 
403  // hNumIdElectrons_->Fill(numIdElectrons);
404 
406 
407  bool isSelected = false;
408  bool fullSelect = false;
409  int cutFlowStatus = -1;
410 
411  if (mElecTau > visMassCut_) {
412  cutFlowStatus = kPassedPreselection;
413  }
414  if (cutFlowStatus == kPassedPreselection &&
415  (isTriggered || hltPaths_.size() == 0)) {
416  cutFlowStatus = kPassedTrigger;
417  }
418  if (cutFlowStatus == kPassedTrigger && passesElectronId(*theElectron)) {
419  cutFlowStatus = kPassedElectronId;
420  hElectronTrackIsoPt_->Fill(theElectronTrackIsoPt);
421  }
422  if (cutFlowStatus == kPassedElectronId &&
423  theElectronTrackIsoPt < electronTrackIsoCut_) {
424  cutFlowStatus = kPassedElectronTrackIso;
425  hElectronEcalIsoPt_->Fill(theElectronEcalIsoPt);
426  }
427  if (cutFlowStatus == kPassedElectronTrackIso &&
428  theElectronEcalIsoPt < electronEcalIsoCut_) {
429  cutFlowStatus = kPassedElectronEcalIso;
430  }
431  if (cutFlowStatus == kPassedElectronEcalIso &&
432  theTauDiscrByLeadTrackFinding > 0.5) {
433  cutFlowStatus = kPassedTauLeadTrack;
434  // if ( theTauJet->leadTrack().isAvailable() )
435  // hTauLeadTrackPt_->Fill(theTauJet->leadTrack()->pt());
436  }
437  if (cutFlowStatus == kPassedTauLeadTrack &&
438  theTauDiscrByLeadTrackPtCut > 0.5) {
439  cutFlowStatus = kPassedTauLeadTrackPt;
440  // hTauTrackIsoPt_->Fill(theTauJet->isolationPFChargedHadrCandsPtSum());
441  }
442  if (cutFlowStatus == kPassedTauLeadTrackPt &&
443  theTauDiscrAgainstElectrons > 0.5) {
444  cutFlowStatus = kPassedTauDiscrAgainstElectrons;
445  // hTauDiscrAgainstMuons_->Fill(theTauDiscrAgainstMuons);
446  }
447  if (cutFlowStatus == kPassedTauDiscrAgainstElectrons &&
448  theTauDiscrAgainstMuons > 0.5) {
449  cutFlowStatus = kPassedTauDiscrAgainstMuons;
450  isSelected = true;
451  }
452  if (cutFlowStatus == kPassedTauDiscrAgainstMuons &&
453  theTauDiscrByTrackIso > 0.5) {
454  cutFlowStatus = kPassedTauTrackIso;
455  // hTauEcalIsoPt_->Fill(theTauJet->isolationPFGammaCandsEtSum());
456  }
457  if (cutFlowStatus == kPassedTauTrackIso && theTauDiscrByEcalIso > 0.5) {
458  cutFlowStatus = kPassedTauEcalIso;
459  fullSelect = true;
460  // hTauDiscrAgainstElectrons_->Fill(theTauDiscrAgainstElectrons);
461  }
462 
463  for (int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
464  hCutFlowSummary_->Fill(iCut);
465  }
466 
467  if (isSelected) {
468  hElectronPt_->Fill(theElectron->pt());
469  hElectronEta_->Fill(theElectron->eta());
470  hElectronPhi_->Fill(theElectron->phi());
471 
472  hTauJetPt_->Fill(theTauJet->pt());
473  hTauJetEta_->Fill(theTauJet->eta());
474  // hTauJetPhi_->Fill(theTauJet->phi());
475 
476  // hTauJetCharge_->Fill(theTauJet->charge());
477  // if ( theTauJet->signalTracks().isAvailable() )
478  // hTauJetNumSignalTracks_->Fill(theTauJet->signalTracks().size());
479  // if ( theTauJet->isolationTracks().isAvailable() )
480  // hTauJetNumIsoTracks_->Fill(theTauJet->isolationTracks().size());
481 
482  if (fullSelect) {
483  hVisMass_->Fill(mElecTau);
484  }
485  // hMtElecCaloMEt_->Fill(mtElecCaloMEt);
486  hMtElecPFMEt_->Fill(mtElecPFMEt);
487  // hPzetaCaloMEt_->Fill(pZetaCaloMEt);
488  // hPzetaPFMEt_->Fill(pZetaPFMEt);
489  hElecTauAcoplanarity_->Fill(dPhiElecTau);
490  hElecTauCharge_->Fill(theElectron->charge() * theTauJet->charge());
491 
492  if (theEventVertex) {
493  // hVertexChi2_->Fill(theEventVertex->normalizedChi2());
494  hVertexZ_->Fill(theEventVertex->z());
495  // hVertexD0_->Fill(getVertexD0(*theEventVertex, *beamSpot));
496  }
497 
498  hCaloMEtPt_->Fill(caloMEt.pt());
499  // hCaloMEtPhi_->Fill(caloMEt.phi());
500 
501  hPFMEtPt_->Fill(pfMEt.pt());
502  // hPFMEtPhi_->Fill(pfMEt.phi());
503  }
504 
505  if (isSelected) ++numEventsSelected_;
506 }
507 
509  edm::LogInfo("EwkElecTauHistManager")
510  << "Filter-Statistics Summary:" << std::endl
511  << " Events analyzed = " << numEventsAnalyzed_ << std::endl
512  << " Events selected = " << numEventsSelected_;
513  if (numEventsAnalyzed_ > 0) {
514  double eff = numEventsSelected_ / (double)numEventsAnalyzed_;
515  edm::LogInfo("") << "Overall efficiency = " << std::setprecision(4)
516  << eff * 100. << " +/- " << std::setprecision(4)
517  << TMath::Sqrt(eff * (1 - eff) / numEventsAnalyzed_) * 100.
518  << ")%";
519  }
520 }
521 
522 //-------------------------------------------------------------------------------
523 // code specific to Z --> mu + tau-jet channel
524 //-------------------------------------------------------------------------------
525 
527 
530 
548 
549 #include "TMath.h"
550 
551 #include <iostream>
552 #include <iomanip>
553 
555  : dqmDirectory_(cfg.getParameter<std::string>("dqmDirectory")),
556  numEventsAnalyzed_(0),
557  numEventsSelected_(0),
558  cfgError_(0),
559  numWarningsTriggerResults_(0),
560  numWarningsHLTpath_(0),
561  numWarningsVertex_(0),
562  numWarningsBeamSpot_(0),
563  numWarningsMuon_(0),
564  numWarningsTauJet_(0),
565  numWarningsTauDiscrByLeadTrackFinding_(0),
566  numWarningsTauDiscrByLeadTrackPtCut_(0),
567  numWarningsTauDiscrByTrackIso_(0),
568  numWarningsTauDiscrByEcalIso_(0),
569  numWarningsTauDiscrAgainstMuons_(0),
570  numWarningsCaloMEt_(0),
571  numWarningsPFMEt_(0) {
573  cfg.getParameter<edm::InputTag>("triggerResultsSource");
574  vertexSource_ = cfg.getParameter<edm::InputTag>("vertexSource");
575  beamSpotSource_ = cfg.getParameter<edm::InputTag>("beamSpotSource");
576  muonSource_ = cfg.getParameter<edm::InputTag>("muonSource");
577  tauJetSource_ = cfg.getParameter<edm::InputTag>("tauJetSource");
578  caloMEtSource_ = cfg.getParameter<edm::InputTag>("caloMEtSource");
579  pfMEtSource_ = cfg.getParameter<edm::InputTag>("pfMEtSource");
580 
582  cfg.getParameter<edm::InputTag>("tauDiscrByLeadTrackFinding");
584  cfg.getParameter<edm::InputTag>("tauDiscrByLeadTrackPtCut");
585  tauDiscrByTrackIso_ = cfg.getParameter<edm::InputTag>("tauDiscrByTrackIso");
586  tauDiscrByEcalIso_ = cfg.getParameter<edm::InputTag>("tauDiscrByEcalIso");
588  cfg.getParameter<edm::InputTag>("tauDiscrAgainstMuons");
589 
590  hltPaths_ = cfg.getParameter<vstring>("hltPaths");
591 
592  muonEtaCut_ = cfg.getParameter<double>("muonEtaCut");
593  muonPtCut_ = cfg.getParameter<double>("muonPtCut");
594  muonTrackIsoCut_ = cfg.getParameter<double>("muonTrackIsoCut");
595  muonEcalIsoCut_ = cfg.getParameter<double>("muonEcalIsoCut");
596  muonCombIsoCut_ = cfg.getParameter<double>("muonCombIsoCut");
597  std::string muonIsoMode_string = cfg.getParameter<std::string>("muonIsoMode");
598  muonIsoMode_ = getIsoMode(muonIsoMode_string, cfgError_);
599 
600  tauJetEtaCut_ = cfg.getParameter<double>("tauJetEtaCut");
601  tauJetPtCut_ = cfg.getParameter<double>("tauJetPtCut");
602 
603  visMassCut_ = cfg.getParameter<double>("visMassCut");
604  deltaRCut_ = cfg.getParameter<double>("deltaRCut");
605 
606  maxNumWarnings_ = cfg.exists("maxNumWarnings")
607  ? cfg.getParameter<int>("maxNumWarnings")
608  : 1;
609 }
610 
613 
614  hMuonPt_ = iBooker.book1D("MuonPt", "P_{T}^{#mu}", 20, 0., 100.);
615  hMuonEta_ = iBooker.book1D("MuonEta", "#eta_{#mu}", 20, -4.0, +4.0);
616  hMuonPhi_ = iBooker.book1D("MuonPhi", "#phi_{#mu}", 20, -TMath::Pi(),
617  +TMath::Pi());
619  iBooker.book1D("MuonTrackIsoPt", "Muon Track Iso.", 20, -0.01, 10.);
621  iBooker.book1D("MuonEcalIsoPt", "Muon Ecal Iso.", 20, -0.01, 10.);
623  iBooker.book1D("MuonCombIsoPt", "Muon Comb Iso.", 20, -0.01, 1.);
624 
625  hTauJetPt_ = iBooker.book1D("TauJetPt", "P_{T}^{#tau-Jet}", 20, 0., 100.);
626  hTauJetEta_ =
627  iBooker.book1D("TauJetEta", "#eta_{#tau-Jet}", 20, -4.0, +4.0);
628  hTauJetPhi_ = iBooker.book1D("TauJetPhi", "#phi_{#tau-Jet}", 20,
629  -TMath::Pi(), +TMath::Pi());
630  hTauLeadTrackPt_ = iBooker.book1D("TauLeadTrackPt",
631  "P_{T}^{#tau-Jetldg trk}", 20, 0., 50.);
633  iBooker.book1D("TauTrackIsoPt", "Tau Track Iso.", 20, -0.01, 40.);
635  iBooker.book1D("TauEcalIsoPt", "Tau Ecal Iso.", 10, -0.01, 10.);
636  hTauDiscrAgainstMuons_ = iBooker.book1D(
637  "TauDiscrAgainstMuons", "Tau Discr. against Muons", 2, -0.5, +1.5);
639  "TauJetNumSignalTracks", "Num. Tau signal Cone Tracks", 20, -0.5, +19.5);
640  hTauJetNumIsoTracks_ = iBooker.book1D(
641  "TauJetNumIsoTracks", "Num. Tau isolation Cone Tracks", 20, -0.5, +19.5);
642 
643  hVisMass_ =
644  iBooker.book1D("VisMass", "#mu + #tau-Jet visible Mass", 20, 0., 120.);
645  hVisMassFinal_ = iBooker.book1D(
646  "VisMassFinal", "#mu + #tau-Jet visible final Mass", 20, 0., 120.);
647  hMtMuPFMEt_ = iBooker.book1D(
648  "MtMuPFMEt", "#mu + E_{T}^{miss} (PF) transverse Mass", 20, 0., 120.);
650  iBooker.book1D("MuTauAcoplanarity", "#Delta #phi_{#mu #tau-Jet}", 20,
651  -TMath::Pi(), +TMath::Pi());
652  hMuTauDeltaR_ =
653  iBooker.book1D("MuTauDeltaR", "#Delta R_{#mu #tau-Jet}", 20, 0, 5);
654  hVertexZ_ =
655  iBooker.book1D("VertexZ", "Event Vertex z-Position", 20, -25., +25.);
656  hCaloMEtPt_ =
657  iBooker.book1D("CaloMEtPt", "E_{T}^{miss} (Calo)", 20, 0., 100.);
658  hPFMEtPt_ = iBooker.book1D("PFMEtPt", "E_{T}^{miss} (PF)", 20, 0., 100.);
660  iBooker.book1D("CutFlowSummary", "Cut-flow Summary", 11, 0.5, 11.5);
666  hCutFlowSummary_->setBinLabel(kPassedTauLeadTrack, "#tau lead. Track");
668  "#tau lead. Track P_{T}");
669  hCutFlowSummary_->setBinLabel(kPassedTauTrackIso, "#tau Track Iso.");
670  hCutFlowSummary_->setBinLabel(kPassedTauEcalIso, "#tau Ecal Iso.");
672  "#tau anti-#mu Discr.");
673  hCutFlowSummary_->setBinLabel(kPassedDeltaR, "#DeltaR(#mu,#tau) ");
674 }
675 
677  const edm::EventSetup& es) {
678  if (cfgError_) return;
679 
680  //-----------------------------------------------------------------------------
681  // access event-level information
682  //-----------------------------------------------------------------------------
683 
684  bool readError = false;
685 
686  //--- get decision of high-level trigger for the event
688  readEventData(evt, triggerResultsSource_, hltDecision,
690  "Failed to access Trigger results");
691  if (readError) return;
692 
693  const edm::TriggerNames& triggerNames = evt.triggerNames(*hltDecision);
694 
695  bool isTriggered = false;
696  for (vstring::const_iterator hltPath = hltPaths_.begin();
697  hltPath != hltPaths_.end(); ++hltPath) {
698  unsigned int index = triggerNames.triggerIndex(*hltPath);
699  if (index < triggerNames.size()) {
700  if (hltDecision->accept(index)) isTriggered = true;
701  } else {
703  edm::LogWarning("EwkMuTauHistManager")
704  << " Undefined HLT path = " << (*hltPath) << " !!";
706  continue;
707  }
708  }
709 
710  //--- get reconstructed primary event vertex of the event
711  // (take as "the" primary event vertex the first entry in the collection
712  // of vertex objects, corresponding to the vertex associated to the highest
713  // Pt sum of tracks)
715  readEventData(evt, vertexSource_, vertexCollection, numWarningsVertex_,
716  maxNumWarnings_, readError,
717  "Failed to access Vertex collection");
718  if (readError) return;
719 
720  const reco::Vertex* theEventVertex =
721  (vertexCollection->size() > 0) ? &(vertexCollection->at(0)) : 0;
722 
723  //--- get beam-spot (expected vertex position) for the event
726  maxNumWarnings_, readError, "Failed to access Beam-spot");
727  if (readError) return;
728 
729  //--- get collections of reconstructed muons from the event
732  readError, "Failed to access Muon collection");
733  if (readError) return;
734 
735  const reco::Muon* theMuon = getTheMuon(*muons, muonEtaCut_, muonPtCut_);
736 
737  double theMuonTrackIsoPt = 1.e+3;
738  double theMuonEcalIsoPt = 1.e+3;
739  double theMuonCombIsoPt = 1.e+3;
740 
741  if (theMuon) {
742  theMuonTrackIsoPt = theMuon->isolationR05().sumPt;
743  // mu.isolationR05().emEt + mu.isolationR05().hadEt +
744  // mu.isolationR05().sumPt
745  theMuonEcalIsoPt = theMuon->isolationR05().emEt;
746 
747  if (muonIsoMode_ == kRelativeIso && theMuon->pt() > 0.) {
748  theMuonTrackIsoPt /= theMuon->pt();
749  theMuonEcalIsoPt /= theMuon->pt();
750  theMuonCombIsoPt =
751  (theMuon->isolationR05().sumPt + theMuon->isolationR05().emEt) /
752  theMuon->pt();
753  // std::cout<<"Rel Iso ="<<theMuonCombIsoPt<<std::endl;
754  }
755  }
756 
757  //--- get collections of reconstructed tau-jets from the event
760  maxNumWarnings_, readError,
761  "Failed to access Tau-jet collection");
762  if (readError) return;
763 
764  //--- get collections of tau-jet discriminators for those tau-jets
765  edm::Handle<reco::PFTauDiscriminator> tauDiscrByLeadTrackFinding;
766  readEventData(evt, tauDiscrByLeadTrackFinding_, tauDiscrByLeadTrackFinding,
768  readError,
769  "Failed to access collection of pf. Tau discriminators by "
770  "leading Track finding");
771  edm::Handle<reco::PFTauDiscriminator> tauDiscrByLeadTrackPtCut;
772  readEventData(evt, tauDiscrByLeadTrackPtCut_, tauDiscrByLeadTrackPtCut,
774  readError,
775  "Failed to access collection of pf. Tau discriminators by "
776  "leading Track Pt cut");
777  edm::Handle<reco::PFTauDiscriminator> tauDiscrByTrackIso;
778  readEventData(evt, tauDiscrByTrackIso_, tauDiscrByTrackIso,
780  "Failed to access collection of pf. Tau discriminators by "
781  "Track isolation");
782  edm::Handle<reco::PFTauDiscriminator> tauDiscrByEcalIso;
783  readEventData(evt, tauDiscrByTrackIso_, tauDiscrByEcalIso,
785  "Failed to access collection of pf. Tau discriminators by ECAL "
786  "isolation");
787  edm::Handle<reco::PFTauDiscriminator> tauDiscrAgainstMuons;
789  evt, tauDiscrAgainstMuons_, tauDiscrAgainstMuons,
791  "Failed to access collection of pf. Tau discriminators against Muons");
792  if (readError) return;
793 
794  int theTauJetIndex = -1;
795  const reco::PFTau* theTauJet =
796  getTheTauJet(*tauJets, tauJetEtaCut_, tauJetPtCut_, theTauJetIndex);
797 
798  double theTauDiscrByLeadTrackFinding = -1.;
799  double theTauDiscrByLeadTrackPtCut = -1.;
800  double theTauDiscrByTrackIso = -1.;
801  double theTauDiscrByEcalIso = -1.;
802  double theTauDiscrAgainstMuons = -1.;
803  if (theTauJetIndex != -1) {
804  reco::PFTauRef theTauJetRef(tauJets, theTauJetIndex);
805  theTauDiscrByLeadTrackFinding = (*tauDiscrByLeadTrackFinding)[theTauJetRef];
806  theTauDiscrByLeadTrackPtCut = (*tauDiscrByLeadTrackPtCut)[theTauJetRef];
807  theTauDiscrByTrackIso = (*tauDiscrByTrackIso)[theTauJetRef];
808  theTauDiscrByEcalIso = (*tauDiscrByEcalIso)[theTauJetRef];
809  theTauDiscrAgainstMuons = (*tauDiscrAgainstMuons)[theTauJetRef];
810  }
811 
812  //--- get missing transverse momentum
813  // measured by calorimeters/reconstructed by particle-flow algorithm
814  edm::Handle<reco::CaloMETCollection> caloMEtCollection;
815  readEventData(evt, caloMEtSource_, caloMEtCollection, numWarningsCaloMEt_,
816  maxNumWarnings_, readError,
817  "Failed to access calo. MET collection");
818  if (readError) return;
819 
820  const reco::CaloMET& caloMEt = caloMEtCollection->at(0);
821 
822  edm::Handle<reco::PFMETCollection> pfMEtCollection;
823  readEventData(evt, pfMEtSource_, pfMEtCollection, numWarningsPFMEt_,
824  maxNumWarnings_, readError,
825  "Failed to access pf. MET collection");
826  if (readError) return;
827 
828  const reco::PFMET& pfMEt = pfMEtCollection->at(0);
829 
830  if (!(theMuon && theTauJet && theTauJetIndex != -1)) return;
831 
832  //-----------------------------------------------------------------------------
833  // compute EWK tau analysis specific quantities
834  //-----------------------------------------------------------------------------
835 
836  double dPhiMuTau = calcDeltaPhi(theMuon->phi(), theTauJet->phi());
837  // double dRMuTau = calcDeltaR(theMuon->p4(), theTauJet->p4());
838  double dRMuTau =
839  fabs(ROOT::Math::VectorUtil::DeltaR(theMuon->p4(), theTauJet->p4()));
840  double mMuTau = (theMuon->p4() + theTauJet->p4()).M();
841 
842  // double mtMuCaloMEt = calcMt(theMuon->px(), theMuon->px(), caloMEt.px(),
843  // caloMEt.py());
844  double mtMuPFMEt =
845  calcMt(theMuon->px(), theMuon->px(), pfMEt.px(), pfMEt.py());
846 
847  // double pZetaCaloMEt = calcPzeta(theMuon->p4(), theTauJet->p4(),
848  // caloMEt.px(), caloMEt.py());
849  // double pZetaPFMEt = calcPzeta(theMuon->p4(), theTauJet->p4(), pfMEt.px(),
850  // pfMEt.py());
851 
852  //-----------------------------------------------------------------------------
853  // apply selection criteria; fill histograms
854  //-----------------------------------------------------------------------------
855 
856  //--- fill muon multiplicity histogram
857  unsigned numGlobalMuons = 0;
858  for (reco::MuonCollection::const_iterator muon = muons->begin();
859  muon != muons->end(); ++muon) {
860  if (muon->isGlobalMuon()) {
861  ++numGlobalMuons;
862  }
863  }
864 
865  // hNumGlobalMuons_->Fill(numGlobalMuons);
866 
868 
869  bool isSelected = false;
870  int cutFlowStatus = -1;
871 
872  // if ( muonIsoMode_ == kAbsoluteIso){
873  if (mMuTau > visMassCut_) {
874  cutFlowStatus = kPassedPreselection;
875  }
876  if (cutFlowStatus == kPassedPreselection &&
877  (isTriggered || hltPaths_.size() == 0)) {
878  cutFlowStatus = kPassedTrigger;
879  }
880  if (cutFlowStatus == kPassedTrigger &&
881  (theMuon->isGlobalMuon() || theMuon->isTrackerMuon())) {
882  cutFlowStatus = kPassedMuonId;
883  }
884 
885  if (cutFlowStatus == kPassedMuonId && (theTauDiscrByLeadTrackFinding > 0.5) &&
886  (theTauJet->eta() < tauJetEtaCut_) && (theTauJet->pt() > tauJetPtCut_)) {
887  cutFlowStatus = kPassedTauLeadTrack;
888  }
889  if (cutFlowStatus == kPassedTauLeadTrack &&
890  theTauDiscrByLeadTrackPtCut > 0.5) {
891  cutFlowStatus = kPassedTauLeadTrackPt;
892  // hTauTrackIsoPt_->Fill(theTauJet->isolationPFChargedHadrCandsPtSum());
893  }
894  if (cutFlowStatus == kPassedTauLeadTrackPt && theTauDiscrAgainstMuons > 0.5) {
895  cutFlowStatus = kPassedTauDiscrAgainstMuons;
896  // hTauEcalIsoPt_->Fill(theTauJet->isolationPFGammaCandsEtSum());
897  }
898  if (cutFlowStatus == kPassedTauDiscrAgainstMuons && dRMuTau > deltaRCut_) {
899  cutFlowStatus = kPassedDeltaR;
900  // hTauDiscrAgainstMuons_->Fill(theTauDiscrAgainstMuons);
901 
902  hMuonPt_->Fill(theMuon->pt());
903  hMuonEta_->Fill(theMuon->eta());
904  hMuonPhi_->Fill(theMuon->phi());
905 
906  hTauJetPt_->Fill(theTauJet->pt());
907  hTauJetEta_->Fill(theTauJet->eta());
908  hTauJetPhi_->Fill(theTauJet->phi());
909 
910  // hTauJetCharge_->Fill(theTauJet->charge());
911  if (theTauJet->signalTracks().isAvailable())
913  if (theTauJet->isolationTracks().isAvailable())
915 
916  hVisMass_->Fill(mMuTau);
917  // hMtMuCaloMEt_->Fill(mtMuCaloMEt);
918  hMtMuPFMEt_->Fill(mtMuPFMEt);
919  // hPzetaCaloMEt_->Fill(pZetaCaloMEt);
920  // hPzetaPFMEt_->Fill(pZetaPFMEt);
921  hMuTauAcoplanarity_->Fill(dPhiMuTau);
922  hMuTauDeltaR_->Fill(dRMuTau);
923  // hMuTauCharge_->Fill(theMuon->charge() + theTauJet->charge());
924 
925  if (theEventVertex) {
926  // hVertexChi2_->Fill(theEventVertex->normalizedChi2());
927  hVertexZ_->Fill(theEventVertex->z());
928  // hVertexD0_->Fill(getVertexD0(*theEventVertex, *beamSpot));
929  }
930 
931  hCaloMEtPt_->Fill(caloMEt.pt());
932  // hCaloMEtPhi_->Fill(caloMEt.phi());
933 
934  hPFMEtPt_->Fill(pfMEt.pt());
935  // hPFMEtPhi_->Fill(pfMEt.phi());
936  hMuonTrackIsoPt_->Fill(theMuonTrackIsoPt);
937  hMuonEcalIsoPt_->Fill(theMuonEcalIsoPt);
938  hMuonCombIsoPt_->Fill(theMuonCombIsoPt);
939  // hMuonCombIsoPt_->Fill((theMuonTrackIsoPt+theMuonEcalIsoPt)/theMuon->pt());
940 
941  // std::cout<<"Rel Iso Hist =
942  // "<<(theMuonTrackIsoPt+theMuonEcalIsoPt)/theMuon->pt()<<std::endl;
945  hTauDiscrAgainstMuons_->Fill(theTauDiscrAgainstMuons);
946  if (theTauJet->leadTrack().isAvailable())
947  hTauLeadTrackPt_->Fill(theTauJet->leadTrack()->pt());
948  }
949 
950  if ((cutFlowStatus == kPassedDeltaR) &&
951  (((theMuonTrackIsoPt < muonTrackIsoCut_) &&
952  (muonIsoMode_ == kAbsoluteIso)) ||
953  ((1 > 0) && (muonIsoMode_ == kRelativeIso)))) {
954  cutFlowStatus = kPassedMuonTrackIso;
955  // isSelected = true;
956  }
957  if (cutFlowStatus == kPassedMuonTrackIso &&
958  (((theMuonEcalIsoPt < muonEcalIsoCut_) &&
959  (muonIsoMode_ == kAbsoluteIso)) ||
960  ((theMuonCombIsoPt < muonCombIsoCut_) &&
961  (muonIsoMode_ == kRelativeIso)))) {
962  cutFlowStatus = kPassedMuonEcalIso;
963  // isSelected = true;
964  }
965 
966  if (cutFlowStatus == kPassedMuonEcalIso && theTauDiscrByTrackIso > 0.5) {
967  cutFlowStatus = kPassedTauTrackIso;
968  }
969 
970  if (cutFlowStatus == kPassedTauTrackIso && theTauDiscrByEcalIso > 0.5) {
971  cutFlowStatus = kPassedTauEcalIso;
972  isSelected = true;
973  }
974 
975  for (int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
976  hCutFlowSummary_->Fill(iCut);
977  }
978 
979  for (int iCut = 1; iCut <= cutFlowStatus; ++iCut) {
980  hCutFlowSummary_->Fill(iCut);
981  }
982 
983  // }
984 
985  if (isSelected) {
986  hVisMassFinal_->Fill(mMuTau);
988  }
989 }
990 
992  edm::LogInfo("EwkMuTauHistManager")
993  << "Filter-Statistics Summary:" << std::endl
994  << " Events analyzed = " << numEventsAnalyzed_ << std::endl
995  << " Events selected = " << numEventsSelected_;
996  if (numEventsAnalyzed_ > 0) {
997  double eff = numEventsSelected_ / (double)numEventsAnalyzed_;
998  edm::LogInfo("") << "Overall efficiency = " << std::setprecision(4)
999  << eff * 100. << " +/- " << std::setprecision(4)
1000  << TMath::Sqrt(eff * (1 - eff) / numEventsAnalyzed_) * 100.
1001  << ")%";
1002  }
1003 }
1004 
1005 //-------------------------------------------------------------------------------
1006 // common auxiliary functions used by different channels
1007 //-------------------------------------------------------------------------------
1008 
1010 
1011 #include <TMath.h>
1012 
1013 int getIsoMode(const std::string& isoMode_string, int& error) {
1014  int isoMode_int;
1015  if (isoMode_string == "absoluteIso") {
1016  isoMode_int = kAbsoluteIso;
1017  } else if (isoMode_string == "relativeIso") {
1018  isoMode_int = kRelativeIso;
1019  } else {
1020  edm::LogError("getIsoMode")
1021  << " Failed to decode isoMode string = " << isoMode_string << " !!";
1022  isoMode_int = kUndefinedIso;
1023  error = 1;
1024  }
1025  return isoMode_int;
1026 }
1027 
1028 double calcDeltaPhi(double phi1, double phi2) {
1029  double deltaPhi = phi1 - phi2;
1030 
1031  if (deltaPhi < 0.) deltaPhi = -deltaPhi;
1032 
1033  if (deltaPhi > TMath::Pi()) deltaPhi = 2 * TMath::Pi() - deltaPhi;
1034 
1035  return deltaPhi;
1036 }
1037 
1038 double calcMt(double px1, double py1, double px2, double py2) {
1039  double pt1 = TMath::Sqrt(px1 * px1 + py1 * py1);
1040  double pt2 = TMath::Sqrt(px2 * px2 + py2 * py2);
1041 
1042  double p1Dotp2 = px1 * px2 + py1 * py2;
1043  double cosAlpha = p1Dotp2 / (pt1 * pt2);
1044 
1045  return TMath::Sqrt(2 * pt1 * pt2 * (1 - cosAlpha));
1046 }
1047 
1049  const reco::Candidate::LorentzVector& p2, double pxMEt,
1050  double pyMEt) {
1051  double cosPhi1 = cos(p1.phi());
1052  double sinPhi1 = sin(p1.phi());
1053  double cosPhi2 = cos(p2.phi());
1054  double sinPhi2 = sin(p2.phi());
1055  double zetaX = cosPhi1 + cosPhi2;
1056  double zetaY = sinPhi1 + sinPhi2;
1057  double zetaR = TMath::Sqrt(zetaX * zetaX + zetaY * zetaY);
1058  if (zetaR > 0.) {
1059  zetaX /= zetaR;
1060  zetaY /= zetaR;
1061  }
1062 
1063  double pxVis = p1.px() + p2.px();
1064  double pyVis = p1.py() + p2.py();
1065  double pZetaVis = pxVis * zetaX + pyVis * zetaY;
1066 
1067  double px = pxVis + pxMEt;
1068  double py = pyVis + pyMEt;
1069  double pZeta = px * zetaX + py * zetaY;
1070 
1071  return pZeta - 1.5 * pZetaVis;
1072 }
1073 
1075  if ((TMath::Abs(electron.eta()) < 1.479 ||
1076  TMath::Abs(electron.eta()) > 1.566) && // cut ECAL barrel/endcap crack
1077  electron.deltaPhiSuperClusterTrackAtVtx() < 0.8 &&
1078  electron.deltaEtaSuperClusterTrackAtVtx() < 0.01 &&
1079  electron.sigmaIetaIeta() < 0.03) {
1080  return true;
1081  } else {
1082  return false;
1083  }
1084 }
1085 
1087  if (passesElectronPreId(electron) &&
1088  ((TMath::Abs(electron.eta()) > 1.566 && // electron reconstructed in ECAL
1089  // endcap
1090  electron.sigmaEtaEta() < 0.03 && electron.hcalOverEcal() < 0.05 &&
1091  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.009 &&
1092  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.7) ||
1093  (TMath::Abs(electron.eta()) < 1.479 && // electron reconstructed in ECAL
1094  // barrel
1095  electron.sigmaEtaEta() < 0.01 && electron.hcalOverEcal() < 0.12 &&
1096  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.007 &&
1097  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.8))) {
1098  return true;
1099  } else {
1100  return false;
1101  }
1102 }
1103 
1105  const reco::GsfElectronCollection& electrons, double electronEtaCut,
1106  double electronPtCut) {
1107  const reco::GsfElectron* theElectron = 0;
1108 
1109  for (reco::GsfElectronCollection::const_iterator electron = electrons.begin();
1110  electron != electrons.end(); ++electron) {
1111  if (TMath::Abs(electron->eta()) < electronEtaCut &&
1112  electron->pt() > electronPtCut && passesElectronPreId(*electron)) {
1113  if (theElectron == 0 || electron->pt() > theElectron->pt())
1114  theElectron = &(*electron);
1115  }
1116  }
1117 
1118  return theElectron;
1119 }
1120 
1122  double muonEtaCut, double muonPtCut) {
1123  const reco::Muon* theMuon = 0;
1124 
1125  for (reco::MuonCollection::const_iterator muon = muons.begin();
1126  muon != muons.end(); ++muon) {
1127  if (TMath::Abs(muon->eta()) < muonEtaCut && muon->pt() > muonPtCut) {
1128  if (theMuon == 0 || muon->pt() > theMuon->pt()) theMuon = &(*muon);
1129  }
1130  }
1131 
1132  return theMuon;
1133 }
1134 
1136  double tauJetEtaCut, double tauJetPtCut,
1137  int& theTauJetIndex) {
1138  const reco::PFTau* theTauJet = 0;
1139  theTauJetIndex = -1;
1140 
1141  int numTauJets = tauJets.size();
1142  for (int iTauJet = 0; iTauJet < numTauJets; ++iTauJet) {
1143  const reco::PFTau& tauJet = tauJets.at(iTauJet);
1144 
1145  if (fabs(tauJet.eta()) < tauJetEtaCut && tauJet.pt() > tauJetPtCut) {
1146  if (theTauJet == 0 || tauJet.pt() > theTauJet->pt()) {
1147  theTauJet = &tauJet;
1148  theTauJetIndex = iTauJet;
1149  }
1150  }
1151  }
1152 
1153  return theTauJet;
1154 }
1155 
1156 double getVertexD0(const reco::Vertex& vertex, const reco::BeamSpot& beamSpot) {
1157  double dX = vertex.x() - beamSpot.x0();
1158  double dY = vertex.y() - beamSpot.y0();
1159  return TMath::Sqrt(dX * dX + dY * dY);
1160 }
MonitorElement * hCutFlowSummary_
Definition: EwkTauDQM.h:304
edm::InputTag tauDiscrByEcalIso_
Definition: EwkTauDQM.h:240
long numWarningsTauDiscrByEcalIso_
Definition: EwkTauDQM.h:186
bool isAvailable() const
Definition: Ref.h:576
const double Pi
edm::InputTag beamSpotSource_
Definition: EwkTauDQM.h:231
T getParameter(std::string const &) const
double calcDeltaPhi(double phi1, double phi2)
Definition: EwkTauDQM.cc:1028
double muonCombIsoCut_
Definition: EwkTauDQM.h:251
virtual reco::TrackRef leadTrack() const
Definition: BaseTau.cc:26
MonitorElement * hPFMEtPt_
Definition: EwkTauDQM.h:151
void bookHistograms(DQMStore::IBooker &)
Definition: EwkTauDQM.cc:165
double calcMt(double px1, double py1, double px2, double py2)
Definition: EwkTauDQM.cc:1038
edm::InputTag tauDiscrByLeadTrackFinding_
Definition: EwkTauDQM.h:237
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:234
float isolationPFGammaCandsEtSum() const
Definition: PFTau.cc:220
MonitorElement * hTauJetPhi_
Definition: EwkTauDQM.h:275
edm::InputTag pfMEtSource_
Definition: EwkTauDQM.h:235
edm::InputTag beamSpotSource_
Definition: EwkTauDQM.h:83
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
tuple cfg
Definition: looper.py:293
EwkMuTauHistManager(const edm::ParameterSet &)
Definition: EwkTauDQM.cc:554
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
float isolationPFChargedHadrCandsPtSum() const
Definition: PFTau.cc:217
edm::InputTag tauDiscrByLeadTrackPtCut_
Definition: EwkTauDQM.h:90
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:224
MonitorElement * hElecTauAcoplanarity_
Definition: EwkTauDQM.h:141
edm::InputTag electronSource_
Definition: EwkTauDQM.h:84
int getIsoMode(const std::string &isoMode_string, int &error)
Definition: EwkTauDQM.cc:1013
edm::InputTag tauDiscrByTrackIso_
Definition: EwkTauDQM.h:239
long numWarningsTauDiscrAgainstMuons_
Definition: EwkTauDQM.h:337
MonitorElement * hVisMass_
Definition: EwkTauDQM.h:136
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: EwkTauDQM.cc:64
edm::InputTag tauDiscrByLeadTrackFinding_
Definition: EwkTauDQM.h:89
long numWarningsTauDiscrByEcalIso_
Definition: EwkTauDQM.h:336
double getVertexD0(const reco::Vertex &vertex, const reco::BeamSpot &beamSpot)
Definition: EwkTauDQM.cc:1156
virtual const reco::TrackRefVector & isolationTracks() const
Definition: BaseTau.cc:30
bool isTrackerMuon() const
Definition: Muon.h:226
long numWarningsTauDiscrByTrackIso_
Definition: EwkTauDQM.h:335
double y() const
y coordinate
Definition: Vertex.h:113
MonitorElement * hMuonPhi_
Definition: EwkTauDQM.h:268
std::vector< std::string > vstring
Definition: EwkTauDQM.h:244
MonitorElement * hElectronEcalIsoPt_
Definition: EwkTauDQM.h:121
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
MonitorElement * hTauEcalIsoPt_
Definition: EwkTauDQM.h:278
std::string dqmDirectory_
Definition: EwkTauDQM.h:38
long numWarningsTauDiscrByLeadTrackFinding_
Definition: EwkTauDQM.h:183
bool exists(std::string const &parameterName) const
checks if a parameter exists
double electronEcalIsoCut_
Definition: EwkTauDQM.h:103
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)
unsigned numEventsSelected_
Definition: EwkTauDQM.h:171
bool isGlobalMuon() const
Definition: Muon.h:225
virtual double phi() const final
momentum azimuthal angle
MonitorElement * hPFMEtPt_
Definition: EwkTauDQM.h:301
unsigned numEventsSelected_
Definition: EwkTauDQM.h:321
std::string dqmDirectory_
Definition: EwkTauDQM.h:262
Strings::size_type size() const
Definition: TriggerNames.cc:39
edm::InputTag tauDiscrByLeadTrackPtCut_
Definition: EwkTauDQM.h:238
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: EwkTauDQM.cc:57
std::string dqmDirectoryName(const std::string &dqmRootDirectory, const std::string &dqmSubDirectory)
Definition: EwkTauDQM.cc:10
const MuonIsolation & isolationR05() const
Definition: Muon.h:163
MonitorElement * hCutFlowSummary_
Definition: EwkTauDQM.h:154
long numWarningsTauDiscrByLeadTrackPtCut_
Definition: EwkTauDQM.h:184
edm::InputTag caloMEtSource_
Definition: EwkTauDQM.h:86
double electronTrackIsoCut_
Definition: EwkTauDQM.h:102
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
tuple vertexCollection
edm::InputTag tauDiscrAgainstMuons_
Definition: EwkTauDQM.h:94
MonitorElement * hVertexZ_
Definition: EwkTauDQM.h:145
void fillHistograms(const edm::Event &, const edm::EventSetup &)
Definition: EwkTauDQM.cc:676
MonitorElement * hTauDiscrAgainstMuons_
Definition: EwkTauDQM.h:279
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
MonitorElement * hMuonEcalIsoPt_
Definition: EwkTauDQM.h:270
void fillHistograms(const edm::Event &, const edm::EventSetup &)
Definition: EwkTauDQM.cc:210
long numWarningsTauDiscrByTrackIso_
Definition: EwkTauDQM.h:185
void Fill(long long x)
MonitorElement * hElecTauCharge_
Definition: EwkTauDQM.h:142
double muonTrackIsoCut_
Definition: EwkTauDQM.h:249
edm::InputTag vertexSource_
Definition: EwkTauDQM.h:230
const reco::GsfElectron * getTheElectron(const reco::GsfElectronCollection &electrons, double electronEtaCut, double electronPtCut)
Definition: EwkTauDQM.cc:1104
MonitorElement * hElectronTrackIsoPt_
Definition: EwkTauDQM.h:120
MonitorElement * hTauJetNumSignalTracks_
Definition: EwkTauDQM.h:281
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:247
edm::InputTag tauJetSource_
Definition: EwkTauDQM.h:233
MonitorElement * hMuonEta_
Definition: EwkTauDQM.h:267
float sigmaIetaIeta() const
Definition: GsfElectron.h:416
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
bool passesElectronId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1086
MonitorElement * hVisMassFinal_
Definition: EwkTauDQM.h:286
MonitorElement * hTauLeadTrackPt_
Definition: EwkTauDQM.h:276
EwkElecTauHistManager * elecTauHistManager_
Definition: EwkTauDQM.h:41
MonitorElement * hElectronEta_
Definition: EwkTauDQM.h:118
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:250
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int maxNumWarnings_
Definition: EwkTauDQM.h:39
virtual int charge() const final
electric charge
Definition: LeafCandidate.h:91
edm::InputTag caloMEtSource_
Definition: EwkTauDQM.h:234
T Abs(T a)
Definition: MathUtil.h:49
long numWarningsTriggerResults_
Definition: EwkTauDQM.h:327
std::string dqmDirectory_
Definition: EwkTauDQM.h:113
float hcalOverEcal() const
Definition: GsfElectron.h:424
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
long numWarningsTauDiscrAgainstMuons_
Definition: EwkTauDQM.h:188
float dr03TkSumPt() const
Definition: GsfElectron.h:491
MonitorElement * hMtMuPFMEt_
Definition: EwkTauDQM.h:288
MonitorElement * hCaloMEtPt_
Definition: EwkTauDQM.h:148
double z() const
z coordinate
Definition: Vertex.h:115
MonitorElement * hTauJetPt_
Definition: EwkTauDQM.h:273
const reco::Muon * getTheMuon(const reco::MuonCollection &muons, double muonEtaCut, double muonPtCut)
Definition: EwkTauDQM.cc:1121
virtual double py() const final
y coordinate of momentum vector
edm::InputTag tauDiscrByEcalIso_
Definition: EwkTauDQM.h:92
MonitorElement * hVertexZ_
Definition: EwkTauDQM.h:295
const reco::PFTau * getTheTauJet(const reco::PFTauCollection &tauJets, double tauJetEtaCut, double tauJetPtCut, int &theTauJetIndex)
Definition: EwkTauDQM.cc:1135
virtual const reco::TrackRefVector & signalTracks() const
Definition: BaseTau.cc:28
MonitorElement * hTauJetPt_
Definition: EwkTauDQM.h:124
double p2[4]
Definition: TauolaWrapper.h:90
void finalizeHistograms()
Definition: EwkTauDQM.cc:991
MonitorElement * hTauTrackIsoPt_
Definition: EwkTauDQM.h:277
MonitorElement * hElectronPhi_
Definition: EwkTauDQM.h:119
double calcPzeta(const reco::Candidate::LorentzVector &p1, const reco::Candidate::LorentzVector &p2, double pxMEt, double pyMEt)
Definition: EwkTauDQM.cc:1048
edm::InputTag tauDiscrAgainstElectrons_
Definition: EwkTauDQM.h:93
MonitorElement * hCaloMEtPt_
Definition: EwkTauDQM.h:298
long numWarningsTauDiscrByLeadTrackFinding_
Definition: EwkTauDQM.h:333
MonitorElement * hMuonPt_
Definition: EwkTauDQM.h:266
~EwkTauDQM()
Definition: EwkTauDQM.cc:52
edm::InputTag tauDiscrByTrackIso_
Definition: EwkTauDQM.h:91
double x() const
x coordinate
Definition: Vertex.h:111
MonitorElement * hMuTauDeltaR_
Definition: EwkTauDQM.h:285
long numWarningsTriggerResults_
Definition: EwkTauDQM.h:177
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
edm::InputTag muonSource_
Definition: EwkTauDQM.h:232
EwkElecTauHistManager(const edm::ParameterSet &)
Definition: EwkTauDQM.cc:106
MonitorElement * hMuTauAcoplanarity_
Definition: EwkTauDQM.h:291
MonitorElement * hTauJetNumIsoTracks_
Definition: EwkTauDQM.h:282
MonitorElement * hMuonCombIsoPt_
Definition: EwkTauDQM.h:271
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
edm::InputTag vertexSource_
Definition: EwkTauDQM.h:82
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:492
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1074
edm::InputTag pfMEtSource_
Definition: EwkTauDQM.h:87
EwkMuTauHistManager * muTauHistManager_
Definition: EwkTauDQM.h:42
std::vector< std::string > vstring
Definition: EwkTauDQM.h:97
bool isAvailable() const
Definition: RefVector.h:259
double p1[4]
Definition: TauolaWrapper.h:89
tuple muons
Definition: patZpeak.py:38
void readEventData(const edm::Event &evt, const edm::InputTag &src, edm::Handle< T > &handle, long &numWarnings, int maxNumWarnings, bool &error, const char *errorMessage)
Definition: EwkTauDQM.h:372
void bookHistograms(DQMStore::IBooker &)
Definition: EwkTauDQM.cc:611
MonitorElement * hTauJetEta_
Definition: EwkTauDQM.h:274
edm::InputTag tauJetSource_
Definition: EwkTauDQM.h:85
edm::InputTag triggerResultsSource_
Definition: EwkTauDQM.h:81
unsigned numEventsAnalyzed_
Definition: EwkTauDQM.h:320
double y0() const
y coordinate
Definition: BeamSpot.h:66
size_type size() const
Size of the RefVector.
Definition: RefVector.h:107
void endRun(const edm::Run &, const edm::EventSetup &) override
Definition: EwkTauDQM.cc:69
edm::InputTag triggerResultsSource_
Definition: EwkTauDQM.h:229
float dr03HcalTowerSumEt() const
Definition: GsfElectron.h:495
virtual double px() const final
x coordinate of momentum vector
MonitorElement * hTauJetEta_
Definition: EwkTauDQM.h:125
edm::InputTag tauDiscrAgainstMuons_
Definition: EwkTauDQM.h:241
const std::string dqmRootDirectory
const std::string dqmSeparator
Definition: EwkTauDQM.cc:8
MonitorElement * hVisMass_
Definition: EwkTauDQM.h:284
virtual double eta() const final
momentum pseudorapidity
MonitorElement * hMuonTrackIsoPt_
Definition: EwkTauDQM.h:269
unsigned numEventsAnalyzed_
Definition: EwkTauDQM.h:170
long numWarningsTauDiscrAgainstElectrons_
Definition: EwkTauDQM.h:187
EwkTauDQM(const edm::ParameterSet &)
Definition: EwkTauDQM.cc:22
MonitorElement * hElectronPt_
Definition: EwkTauDQM.h:117
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
MonitorElement * hMtElecPFMEt_
Definition: EwkTauDQM.h:138
Definition: Run.h:42
float sigmaEtaEta() const
Definition: GsfElectron.h:415
double muonEcalIsoCut_
Definition: EwkTauDQM.h:250
virtual double pt() const final
transverse momentum
long numWarningsTauDiscrByLeadTrackPtCut_
Definition: EwkTauDQM.h:334
double x0() const
x coordinate
Definition: BeamSpot.h:64