CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MCEmbeddingValidationAnalyzer.h
Go to the documentation of this file.
1 #ifndef TauAnalysis_MCEmbeddingTools_MCEmbeddingValidationAnalyzer_h
2 #define TauAnalysis_MCEmbeddingTools_MCEmbeddingValidationAnalyzer_h
3 
26 
30 
46 
47 /*#include "EGamma/EGammaAnalysisTools/interface/EGammaMvaEleEstimator.h"*/
56 
57 #include <TString.h>
58 #include <TArrayD.h>
59 
60 #include <string>
61 #include <vector>
62 
63 namespace
64 {
65  void countDecayProducts(const reco::GenParticle* genParticle,
66  int& numElectrons, int& numElecNeutrinos, int& numMuons, int& numMuNeutrinos,
67  int& numChargedHadrons, int& numPi0s, int& numOtherNeutralHadrons, int& numPhotons)
68  {
69  //std::cout << " genParticle: pdgId = " << genParticle->pdgId() << std::endl;
70 
71  int absPdgId = TMath::Abs(genParticle->pdgId());
72  int status = genParticle->status();
73  int charge = genParticle->charge();
74 
75  if ( absPdgId == 111 ) ++numPi0s;
76  else if ( status == 1 ) {
77  if ( absPdgId == 11 ) ++numElectrons;
78  else if ( absPdgId == 12 ) ++numElecNeutrinos;
79  else if ( absPdgId == 13 ) ++numMuons;
80  else if ( absPdgId == 14 ) ++numMuNeutrinos;
81  else if ( absPdgId == 15 ) {
82  edm::LogError ("countDecayProducts")
83  << "Found tau lepton with status code 1 !!";
84  return;
85  }
86  else if ( absPdgId == 16 ) return; // no need to count tau neutrinos
87  else if ( absPdgId == 22 ) ++numPhotons;
88  else if ( charge != 0 ) ++numChargedHadrons;
89  else ++numOtherNeutralHadrons;
90  } else {
91  unsigned numDaughters = genParticle->numberOfDaughters();
92  for ( unsigned iDaughter = 0; iDaughter < numDaughters; ++iDaughter ) {
93  const reco::GenParticle* daughter = genParticle->daughterRef(iDaughter).get();
94 
95  countDecayProducts(daughter,
96  numElectrons, numElecNeutrinos, numMuons, numMuNeutrinos,
97  numChargedHadrons, numPi0s, numOtherNeutralHadrons, numPhotons);
98  }
99  }
100  }
101 
102  std::string getGenTauDecayMode(const reco::GenParticle* genParticle)
103  {
104 //--- determine generator level tau decay mode
105 //
106 // NOTE:
107 // (1) function implements logic defined in PhysicsTools/JetMCUtils/src/JetMCTag::genTauDecayMode
108 // for different type of argument
109 // (2) this implementation should be more robust to handle cases of tau --> tau + gamma radiation
110 //
111 
112  //std::cout << "<MCEmbeddingValidationAnalyzer::getGenTauDecayMode>:" << std::endl;
113 
114  int numElectrons = 0;
115  int numElecNeutrinos = 0;
116  int numMuons = 0;
117  int numMuNeutrinos = 0;
118  int numChargedHadrons = 0;
119  int numPi0s = 0;
120  int numOtherNeutralHadrons = 0;
121  int numPhotons = 0;
122 
123  countDecayProducts(genParticle,
124  numElectrons, numElecNeutrinos, numMuons, numMuNeutrinos,
125  numChargedHadrons, numPi0s, numOtherNeutralHadrons, numPhotons);
126 
127  if ( numElectrons == 1 && numElecNeutrinos == 1 ) return std::string("electron");
128  else if ( numMuons == 1 && numMuNeutrinos == 1 ) return std::string("muon");
129 
130  switch ( numChargedHadrons ) {
131  case 1 :
132  if ( numOtherNeutralHadrons != 0 ) return std::string("oneProngOther");
133  switch ( numPi0s ) {
134  case 0:
135  return std::string("oneProng0Pi0");
136  case 1:
137  return std::string("oneProng1Pi0");
138  case 2:
139  return std::string("oneProng2Pi0");
140  default:
141  return std::string("oneProngOther");
142  }
143  case 3 :
144  if ( numOtherNeutralHadrons != 0 ) return std::string("threeProngOther");
145  switch ( numPi0s ) {
146  case 0:
147  return std::string("threeProng0Pi0");
148  case 1:
149  return std::string("threeProng1Pi0");
150  default:
151  return std::string("threeProngOther");
152  }
153  default:
154  return std::string("rare");
155  }
156  }
157 
158  MonitorElement* bookHistogram2D(DQMStore& dqmStore, const std::string& name, const std::string& title, int numBinsX, float* binningX, int numBinsY, float yMin, float yMax)
159  {
160  assert(numBinsY >= 1);
161  TArrayF binningY(numBinsY + 1);
162  float dy = (yMax - yMin)/numBinsY;
163  for ( int iBinY = 0; iBinY <= numBinsY; ++iBinY ) {
164  binningY[iBinY] = yMin + iBinY*dy;
165  }
166  MonitorElement* histogram = dqmStore.book2D(name, title, numBinsX, binningX, numBinsY, binningY.GetArray());
167  return histogram;
168  }
169 
170  std::pair<double, double> compMEtProjU(const reco::Candidate::LorentzVector& zP4, double metPx, double metPy, int& errorFlag, bool subtract_qT)
171  {
172  if ( zP4.pt() == 0. ) {
173  edm::LogWarning ("compMEtProjU")
174  << " Failed to compute projection, because Z0 candidate has zero Pt --> returning dummy solution !!";
175  errorFlag = 1;
176  return std::pair<double, double>(0., 0.);
177  }
178 
179  double qX = zP4.px();
180  double qY = zP4.py();
181  double qT = TMath::Sqrt(qX*qX + qY*qY);
182 
183  double uX = -metPx;
184  double uY = -metPy;
185  if ( subtract_qT ) {
186  uX -= qX;
187  uY -= qY;
188  }
189 
190  double u1 = (uX*qX + uY*qY)/qT;
191  double u2 = (uX*qY - uY*qX)/qT;
192 
193  return std::pair<double, double>(u1, u2);
194  }
195 }
196 
198 {
199  public:
202 
203  void analyze(const edm::Event&, const edm::EventSetup&);
204  void beginJob();
205 
206  private:
208 
209  std::string dqmDirectory_full(const std::string& dqmSubDirectory)
210  {
211  TString dqmDirectory_full = dqmDirectory_.data();
212  if ( !dqmDirectory_full.EndsWith("/") ) dqmDirectory_full.Append("/");
213  dqmDirectory_full.Append(dqmSubDirectory);
214  return dqmDirectory_full.Data();
215  }
216 
228  double dRminSeparation_; // CV: minimum separation in dR between replaced muons and embedded tau leptons
244  typedef std::vector<edm::InputTag> vInputTag;
247 
249 
251 
253 
261 
267 
271 
277 
283 
306 
318 
321 
328 
334 
340 
369 
374 
383 
387 
389  {
391  const std::string& dqmDirectory)
392  : srcWeight_(srcWeight),
393  dqmDirectory_(dqmDirectory)
394  {
395  evtWeightKey_ = Form("%s_%s", srcWeight_.label().data(), srcWeight_.instance().data());
396  }
398  void bookHistograms(DQMStore& dqmStore)
399  {
400  dqmStore.setCurrentFolder(dqmDirectory_.data());
401  std::string histogramWeightName = Form("weight_%s_%s", srcWeight_.label().data(), srcWeight_.instance().data());
402  histogramWeight_ = dqmStore.book1D(histogramWeightName.data(), histogramWeightName.data(), 1001, -0.005, 10.005);
403  }
404  void fillHistograms(const edm::Event& evt, const std::map<std::string, double>& evtWeightMap_other)
405  {
407  evt.getByLabel(srcWeight_, weight);
408  double evtWeightOther = 1.;
409  for ( std::map<std::string, double>::const_iterator evtWeightEntry_other = evtWeightMap_other.begin();
410  evtWeightEntry_other != evtWeightMap_other.end(); ++evtWeightEntry_other ) {
411  if ( evtWeightEntry_other->first != evtWeightKey_ ) evtWeightOther *= evtWeightEntry_other->second;
412  }
413  histogramWeight_->Fill(*weight, evtWeightOther);
414  }
419  };
420 
421  std::vector<plotEntryTypeEvtWeight*> evtWeightPlotEntries_;
422 
424  {
425  plotEntryTypeMuonRadCorrUncertainty(int minJets, int maxJets,
426  const std::string& dqmDirectory)
427  : minJets_(minJets),
428  maxJets_(maxJets)
429  {
430  dqmDirectory_ = dqmDirectory;
431  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
432  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
433  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
434  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
435  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
436  }
438  void bookHistograms(DQMStore& dqmStore)
439  {
440  dqmStore.setCurrentFolder(dqmDirectory_.data());
441  histogramMuonPlusPt_unweighted_ = dqmStore.book1D("muonPlusPt_unweighted", "muonPlusPt_unweighted", 250, 0., 250.);
442  histogramMuonPlusPt_weighted_ = dqmStore.book1D("muonPlusPt_weighted", "muonPlusPt_weighted", 250, 0., 250.);
443  histogramMuonPlusPt_weightedUp_ = dqmStore.book1D("muonPlusPt_weightedUp", "muonPlusPt_weightedUp", 250, 0., 250.);
444  histogramMuonPlusPt_weightedDown_ = dqmStore.book1D("muonPlusPt_weightedDown", "muonPlusPt_weightedDown", 250, 0., 250.);
445  histogramMuonPlusEta_unweighted_ = dqmStore.book1D("muonPlusEta_unweighted", "muonPlusEta_unweighted", 198, -9.9, +9.9);
446  histogramMuonPlusEta_weighted_ = dqmStore.book1D("muonPlusEta_weighted", "muonPlusEta_weighted", 198, -9.9, +9.9);
447  histogramMuonPlusEta_weightedUp_ = dqmStore.book1D("muonPlusEta_weightedUp", "muonPlusEta_weightedUp", 198, -9.9, +9.9);
448  histogramMuonPlusEta_weightedDown_ = dqmStore.book1D("muonPlusEta_weightedDown", "muonPlusEta_weightedDown", 198, -9.9, +9.9);
449  histogramMuonMinusPt_unweighted_ = dqmStore.book1D("muonMinusPt_unweighted", "muonMinusPt_unweighted", 250, 0., 250.);
450  histogramMuonMinusPt_weighted_ = dqmStore.book1D("muonMinusPt_weighted", "muonMinusPt_weighted", 250, 0., 250.);
451  histogramMuonMinusPt_weightedUp_ = dqmStore.book1D("muonMinusPt_weightedUp", "muonMinusPt_weightedUp", 250, 0., 250.);
452  histogramMuonMinusPt_weightedDown_ = dqmStore.book1D("muonMinusPt_weightedDown", "muonMinusPt_weightedDown", 250, 0., 250.);
453  histogramMuonMinusEta_unweighted_ = dqmStore.book1D("muonMinusEta_unweighted", "muonMinusEta_unweighted", 198, -9.9, +9.9);
454  histogramMuonMinusEta_weighted_ = dqmStore.book1D("muonMinusEta_weighted", "muonMinusEta_weighted", 198, -9.9, +9.9);
455  histogramMuonMinusEta_weightedUp_ = dqmStore.book1D("muonMinusEta_weightedUp", "muonMinusEta_weightedUp", 198, -9.9, +9.9);
456  histogramMuonMinusEta_weightedDown_ = dqmStore.book1D("muonMinusEta_weightedDown", "muonMinusEta_weightedDown", 198, -9.9, +9.9);
457  histogramDiMuonMass_unweighted_ = dqmStore.book1D("diMuonMass_unweighted", "diMuonMass_unweighted", 250, 0., 250.);
458  histogramDiMuonMass_weighted_ = dqmStore.book1D("diMuonMass_weighted", "diMuonMass_weighted", 250, 0., 250.);
459  histogramDiMuonMass_weightedUp_ = dqmStore.book1D("diMuonMass_weightedUp", "diMuonMass_weightedUp", 250, 0., 250.);
460  histogramDiMuonMass_weightedDown_ = dqmStore.book1D("diMuonMass_weightedDown", "diMuonMass_weightedDown", 250, 0., 250.);
461  histogramMuonRadCorrWeight_ = dqmStore.book1D("muonRadCorrWeight", "muonRadCorrWeight", 1001, -0.005, 10.005);
462  histogramMuonRadCorrWeightUp_ = dqmStore.book1D("muonRadCorrWeightUp", "muonRadCorrWeightUp", 1001, -0.005, 10.005);
463  histogramMuonRadCorrWeightDown_ = dqmStore.book1D("muonRadCorrWeightDown", "muonRadCorrWeightDown", 1001, -0.005, 10.005);
464  }
465  void fillHistograms(int numJets,
466  const reco::Candidate::LorentzVector& muonPlusP4, const reco::Candidate::LorentzVector& muonMinusP4,
467  double evtWeight_others, double muonRadCorrWeight, double muonRadCorrWeightUp, double muonRadCorrWeightDown)
468  {
469  if ( (minJets_ == -1 || numJets >= minJets_) &&
470  (maxJets_ == -1 || numJets <= maxJets_) ) {
471  histogramMuonPlusPt_unweighted_->Fill(muonPlusP4.pt(), evtWeight_others);
472  histogramMuonPlusPt_weighted_->Fill(muonPlusP4.pt(), evtWeight_others*muonRadCorrWeight);
473  histogramMuonPlusPt_weightedUp_->Fill(muonPlusP4.pt(), evtWeight_others*muonRadCorrWeightUp);
474  histogramMuonPlusPt_weightedDown_->Fill(muonPlusP4.pt(), evtWeight_others*muonRadCorrWeightDown);
475  histogramMuonPlusEta_unweighted_->Fill(muonPlusP4.eta(), evtWeight_others);
476  histogramMuonPlusEta_weighted_->Fill(muonPlusP4.eta(), evtWeight_others*muonRadCorrWeight);
477  histogramMuonPlusEta_weightedUp_->Fill(muonPlusP4.eta(), evtWeight_others*muonRadCorrWeightUp);
478  histogramMuonPlusEta_weightedDown_->Fill(muonPlusP4.eta(), evtWeight_others*muonRadCorrWeightDown);
479  histogramMuonMinusPt_unweighted_->Fill(muonMinusP4.pt(), evtWeight_others);
480  histogramMuonMinusPt_weighted_->Fill(muonMinusP4.pt(), evtWeight_others*muonRadCorrWeight);
481  histogramMuonMinusPt_weightedUp_->Fill(muonMinusP4.pt(), evtWeight_others*muonRadCorrWeightUp);
482  histogramMuonMinusPt_weightedDown_->Fill(muonMinusP4.pt(), evtWeight_others*muonRadCorrWeightDown);
483  histogramMuonMinusEta_unweighted_->Fill(muonMinusP4.eta(), evtWeight_others);
484  histogramMuonMinusEta_weighted_->Fill(muonMinusP4.eta(), evtWeight_others*muonRadCorrWeight);
485  histogramMuonMinusEta_weightedUp_->Fill(muonMinusP4.eta(), evtWeight_others*muonRadCorrWeightUp);
486  histogramMuonMinusEta_weightedDown_->Fill(muonMinusP4.eta(), evtWeight_others*muonRadCorrWeightDown);
487  double diMuonMass = (muonPlusP4 + muonMinusP4).mass();
488  histogramDiMuonMass_unweighted_->Fill(diMuonMass, evtWeight_others);
489  histogramDiMuonMass_weighted_->Fill(diMuonMass, evtWeight_others*muonRadCorrWeight);
490  histogramDiMuonMass_weightedUp_->Fill(diMuonMass, evtWeight_others*muonRadCorrWeightUp);
491  histogramDiMuonMass_weightedDown_->Fill(diMuonMass, evtWeight_others*muonRadCorrWeightDown);
492  histogramMuonRadCorrWeight_->Fill(muonRadCorrWeight, evtWeight_others);
493  histogramMuonRadCorrWeightUp_->Fill(muonRadCorrWeightUp, evtWeight_others);
494  histogramMuonRadCorrWeightDown_->Fill(muonRadCorrWeightDown, evtWeight_others);
495  }
496  }
497  int minJets_;
498  int maxJets_;
523  };
524 
525  std::vector<plotEntryTypeMuonRadCorrUncertainty*> muonRadCorrUncertaintyPlotEntries_beforeRad_;
526  std::vector<plotEntryTypeMuonRadCorrUncertainty*> muonRadCorrUncertaintyPlotEntries_afterRad_;
527  std::vector<plotEntryTypeMuonRadCorrUncertainty*> muonRadCorrUncertaintyPlotEntries_afterRadAndCorr_;
530 
532  {
534  : genTauDecayMode_(genTauDecayMode)
535  {
536  dqmDirectory_ = dqmDirectory;
537  if ( genTauDecayMode != "" ) dqmDirectory_.append("_").append(genTauDecayMode);
538  }
540  void bookHistograms(DQMStore& dqmStore)
541  {
542  dqmStore.setCurrentFolder(dqmDirectory_.data());
543  const int qTnumBins = 34;
544  float qTbinning[qTnumBins + 1] = {
545  0., 2.5, 5., 7.5, 10., 12.5, 15., 17.5, 20., 22.5, 25., 27.5, 30., 35., 40., 45., 50.,
546  60., 70., 80., 90., 100., 110., 120., 130., 140., 150., 160., 170., 180., 200., 220., 240., 260., 300.
547  };
548  histogramL1ETM_ = dqmStore.book1D( "L1ETM", "L1ETM", 250, 0., 250.);
549  histogramL1ETM_vs_genCaloMEt_ = dqmStore.book2D( "L1ETM_vs_genCaloMEt", "L1ETM_vs_genCaloMEt", 250, 0., 250., 250, 0., 250.);
550  histogramL1ETM_vs_recCaloMEt_ = dqmStore.book2D( "L1ETM_vs_recCaloMEt", "L1ETM_vs_recCaloMEt", 250, 0., 250., 250, 0., 250.);
551  histogramL1ETMparlZdivQtVsQt_ = bookHistogram2D(dqmStore, "L1ETMparlZdivQtVsQt", "L1ETMparlZdivQtVsQt", qTnumBins, qTbinning, 400, -5., +5.);
552  histogramL1ETMparlZvsQt_ = bookHistogram2D(dqmStore, "L1ETMparlZvsQt", "L1ETMparlZvsQt", qTnumBins, qTbinning, 400, -500., +500.);
553  histogramL1ETMperpZvsQt_ = bookHistogram2D(dqmStore, "L1ETMperpZvsQt", "L1ETMperpZvsQt", qTnumBins, qTbinning, 60, -75., +75.);
554  histogramRecCaloMEtParlZdivQtVsQt_ = bookHistogram2D(dqmStore, "recCaloMEtParlZdivQtVsQt", "recCaloMEtParlZdivQtVsQt", qTnumBins, qTbinning, 400, -5., +5.);
555  histogramRecCaloMEtParlZvsQt_ = bookHistogram2D(dqmStore, "recCaloMEtParlZvsQt", "recCaloMEtParlZvsQt", qTnumBins, qTbinning, 400, -500., +500.);
556  histogramRecCaloMEtPerpZvsQt_ = bookHistogram2D(dqmStore, "recCaloMEtPerpZvsQt", "recCaloMEtPerpZvsQt", qTnumBins, qTbinning, 60, -75., +75.);
557  histogramL1ETMminusGenCaloMEtParlZdivQtVsQt_ = bookHistogram2D(dqmStore, "L1ETMminusGenCaloMEtParlZdivQtVsQt", "L1ETMminusGenCaloMEtParlZdivQtVsQt", qTnumBins, qTbinning, 400, -5., +5.);
558  histogramL1ETMminusGenCaloMEtParlZvsQt_ = bookHistogram2D(dqmStore, "L1ETMminusGenCaloMEtParlZvsQt", "L1ETMminusGenCaloMEtParlZvsQt", qTnumBins, qTbinning, 400, -500., +500.);
559  histogramL1ETMminusGenCaloMEtPerpZvsQt_ = bookHistogram2D(dqmStore, "L1ETMminusGenCaloMEtPerpZvsQt", "L1ETMminusGenCaloMEtPerpZvsQt", qTnumBins, qTbinning, 60, -75., +75.);
560  histogramL1ETMminusRecCaloMEtParlZdivQtVsQt_ = bookHistogram2D(dqmStore, "L1ETMminusRecCaloMEtParlZdivQtVsQt", "L1ETMminusRecCaloMEtParlZdivQtVsQt", qTnumBins, qTbinning, 400, -5., +5.);
561  histogramL1ETMminusRecCaloMEtParlZvsQt_ = bookHistogram2D(dqmStore, "L1ETMminusRecCaloMEtParlZvsQt", "L1ETMminusRecCaloMEtParlZvsQt", qTnumBins, qTbinning, 400, -500., +500.);
562  histogramL1ETMminusRecCaloMEtPerpZvsQt_ = bookHistogram2D(dqmStore, "L1ETMminusRecCaloMEtPerpZvsQt", "L1ETMminusRecCaloMEtPerpZvsQt", qTnumBins, qTbinning, 60, -75., +75.);
563  histogramQt_ = dqmStore.book1D( "qT", "qT", 600, 0., 300.);
564  }
565  void fillHistograms(const std::string& genTauDecayMode_ref,
566  const reco::Candidate::LorentzVector& l1MEtP4, const reco::Candidate::LorentzVector& genCaloMEtP4, const reco::Candidate::LorentzVector& recCaloMEtP4,
567  const reco::Candidate::LorentzVector& genDiTauP4, double evtWeight)
568  {
569  if ( genTauDecayMode_ == "" || genTauDecayMode_ref == genTauDecayMode_ ) {
570  histogramL1ETM_->Fill(l1MEtP4.pt(), evtWeight);
571  histogramL1ETM_vs_genCaloMEt_->Fill(genCaloMEtP4.pt(), l1MEtP4.pt(), evtWeight);
572  histogramL1ETM_vs_recCaloMEt_->Fill(recCaloMEtP4.pt(), l1MEtP4.pt(), evtWeight);
573  double qT = genDiTauP4.pt();
574  int errorFlag = 0;
575  std::pair<double, double> uT = compMEtProjU(genDiTauP4, l1MEtP4.px(), l1MEtP4.py(), errorFlag, false);
576  if ( !errorFlag ) {
577  double uParl = uT.first;
578  double uPerp = uT.second;
579  if ( qT > 0. ) histogramL1ETMparlZdivQtVsQt_->Fill(qT, uParl/qT, evtWeight);
580  histogramL1ETMparlZvsQt_->Fill(qT, uParl, evtWeight);
581  histogramL1ETMperpZvsQt_->Fill(qT, uPerp, evtWeight);
582  }
583  errorFlag = 0;
584  uT = compMEtProjU(genDiTauP4, recCaloMEtP4.px(), recCaloMEtP4.py(), errorFlag, false);
585  if ( !errorFlag ) {
586  double uParl = uT.first;
587  double uPerp = uT.second;
588  if ( qT > 0. ) histogramRecCaloMEtParlZdivQtVsQt_->Fill(qT, uParl/qT, evtWeight);
589  histogramRecCaloMEtParlZvsQt_->Fill(qT, uParl, evtWeight);
590  histogramRecCaloMEtPerpZvsQt_->Fill(qT, uPerp, evtWeight);
591  }
592  errorFlag = 0;
593  uT = compMEtProjU(genDiTauP4, l1MEtP4.px() - genCaloMEtP4.px(), l1MEtP4.py() - genCaloMEtP4.py(), errorFlag, false);
594  if ( !errorFlag ) {
595  double uParl = uT.first;
596  double uPerp = uT.second;
597  if ( qT > 0. ) histogramL1ETMminusGenCaloMEtParlZdivQtVsQt_->Fill(qT, uParl/qT, evtWeight);
598  histogramL1ETMminusGenCaloMEtParlZvsQt_->Fill(qT, uParl, evtWeight);
599  histogramL1ETMminusGenCaloMEtPerpZvsQt_->Fill(qT, uPerp, evtWeight);
600  }
601  errorFlag = 0;
602  uT = compMEtProjU(genDiTauP4, l1MEtP4.px() - recCaloMEtP4.px(), l1MEtP4.py() - recCaloMEtP4.py(), errorFlag, false);
603  if ( !errorFlag ) {
604  double uParl = uT.first;
605  double uPerp = uT.second;
606  if ( qT > 0. ) histogramL1ETMminusRecCaloMEtParlZdivQtVsQt_->Fill(qT, uParl/qT, evtWeight);
607  histogramL1ETMminusRecCaloMEtParlZvsQt_->Fill(qT, uParl, evtWeight);
608  histogramL1ETMminusRecCaloMEtPerpZvsQt_->Fill(qT, uPerp, evtWeight);
609  }
610  histogramQt_->Fill(qT, evtWeight);
611  }
612  }
631  };
632 
633  std::vector<plotEntryTypeL1ETM*> l1ETMplotEntries_;
634 
635  template <typename T>
637  {
638  leptonDistributionT(int minJets, int maxJets,
639  const edm::InputTag& srcGen, const std::string& cutGen, const edm::InputTag& srcRec, const std::string& cutRec, double dRmatch, const std::string& dqmDirectory)
640  : minJets_(minJets),
641  maxJets_(maxJets),
642  srcGen_(srcGen),
643  cutGen_(0),
644  srcRec_(srcRec),
645  cutRec_(0),
646  dRmatch_(dRmatch),
647  dqmDirectory_(dqmDirectory)
648  {
649  if ( cutGen != "" ) cutGen_ = new StringCutObjectSelector<reco::Candidate>(cutGen);
650  if ( cutRec != "" ) cutRec_ = new StringCutObjectSelector<T>(cutRec);
651  dqmDirectory_ = dqmDirectory;
652  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
653  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
654  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
655  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
656  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
657  }
659  {
660  delete cutGen_;
661  delete cutRec_;
662  }
663  void bookHistograms(DQMStore& dqmStore)
664  {
665  dqmStore.setCurrentFolder(dqmDirectory_.data());
666  histogramNumGenLeptons_ = dqmStore.book1D("numGenLeptons", "numGenLeptons", 10, -0.5, 9.5);
667  histogramGenLeptonPt_ = dqmStore.book1D("genLeptonPt", "genLeptonPt", 250, 0., 250.);
668  histogramGenLeptonEta_ = dqmStore.book1D("genLeptonEta", "genLeptonEta", 198, -9.9, +9.9);
669  histogramGenLeptonPhi_ = dqmStore.book1D("genLeptonPhi", "genLeptonPhi", 72, -TMath::Pi(), +TMath::Pi());
670  histogramNumRecLeptons_ = dqmStore.book1D("numRecLeptons", "numRecLeptons", 10, -0.5, 9.5);
671  histogramRecLeptonPt_ = dqmStore.book1D("recLeptonPt", "recLeptonPt", 250, 0., 250.);
672  histogramRecLeptonEta_ = dqmStore.book1D("recLeptonEta", "recLeptonEta", 198, -9.9, +9.9);
673  histogramRecLeptonPhi_ = dqmStore.book1D("recLeptonPhi", "recLeptonPhi", 72, -TMath::Pi(), +TMath::Pi());
674  histogramRecMinusGenLeptonPt_ = dqmStore.book1D("recMinusGenLeptonPt", "recMinusGenLeptonPt", 200, -100., +100.);
675  histogramRecMinusGenLeptonPt_div_genLeptonPt_ = dqmStore.book1D("recMinusGenLeptonPt_div_genLeptonPt", "recMinusGenLeptonPt_div_genLeptonPt", 200, 0., 2.);
676  histogramRecMinusGenLeptonEta_ = dqmStore.book1D("recMinusGenLeptonEta", "recMinusGenLeptonEta", 100, -0.5, +0.5);
677  histogramRecMinusGenLeptonPhi_ = dqmStore.book1D("recMinusGenLeptonPhi", "recMinusGenLeptonPhi", 100, -0.5, +0.5);
678  }
679  void fillHistograms(int numJets,
680  const edm::Event& evt, double evtWeight)
681  {
682  if ( (minJets_ == -1 || numJets >= minJets_) &&
683  (maxJets_ == -1 || numJets <= maxJets_) ) {
685  edm::Handle<CandidateView> genLeptons;
686  evt.getByLabel(srcGen_, genLeptons);
687  histogramNumGenLeptons_->Fill(genLeptons->size(), evtWeight);
688  typedef std::vector<T> recLeptonCollection;
690  evt.getByLabel(srcRec_, recLeptons);
691  histogramNumRecLeptons_->Fill(recLeptons->size(), evtWeight);
692  for ( CandidateView::const_iterator genLepton = genLeptons->begin();
693  genLepton != genLeptons->end(); ++genLepton ) {
694  if ( cutGen_ && !(*cutGen_)(*genLepton) ) continue;
695  for ( typename recLeptonCollection::const_iterator recLepton = recLeptons->begin();
696  recLepton != recLeptons->end(); ++recLepton ) {
697  if ( cutRec_ && !(*cutRec_)(*recLepton) ) continue;
698  double dR = deltaR(genLepton->p4(), recLepton->p4());
699  if ( dR < dRmatch_ ) {
700  histogramGenLeptonPt_->Fill(genLepton->pt(), evtWeight);
701  histogramGenLeptonEta_->Fill(genLepton->eta(), evtWeight);
702  histogramGenLeptonPhi_->Fill(genLepton->phi(), evtWeight);
703  histogramRecLeptonPt_->Fill(recLepton->pt(), evtWeight);
704  histogramRecLeptonEta_->Fill(recLepton->eta(), evtWeight);
705  histogramRecLeptonPhi_->Fill(recLepton->phi(), evtWeight);
706  histogramRecMinusGenLeptonPt_->Fill(recLepton->pt() - genLepton->pt(), evtWeight);
707  if ( genLepton->pt() > 0. ) histogramRecMinusGenLeptonPt_div_genLeptonPt_->Fill((recLepton->pt() - genLepton->pt())/genLepton->pt(), evtWeight);
708  histogramRecMinusGenLeptonEta_->Fill(recLepton->eta() - genLepton->eta(), evtWeight);
709  histogramRecMinusGenLeptonPhi_->Fill(recLepton->phi() - genLepton->phi(), evtWeight);
710  }
711  }
712  }
713  }
714  }
715  int minJets_;
716  int maxJets_;
721  double dRmatch_;
735  };
736 
738  {
739  electronDistributionExtra(int minJets, int maxJets,
740  const edm::InputTag& srcGen, const std::string& cutGen, const edm::InputTag& srcRec, const std::string& cutRec, double dRmatch, const std::string& dqmDirectory,
741  const edm::InputTag& srcTheRecVertex)
742  : minJets_(minJets),
743  maxJets_(maxJets),
744  srcGen_(srcGen),
745  cutGen_(0),
746  srcRec_(srcRec),
747  cutRec_(0),
748  dRmatch_(dRmatch),
749  srcTheRecVertex_(srcTheRecVertex)
750  {
751  if ( cutGen != "" ) cutGen_ = new StringCutObjectSelector<reco::Candidate>(cutGen);
752  if ( cutRec != "" ) cutRec_ = new StringCutObjectSelector<pat::Electron>(cutRec);
753  dqmDirectory_ = dqmDirectory;
754  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
755  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
756  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
757  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
758  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
759  /*if ( !fMVA_isInitialized_ ) {
760  std::vector<std::string> mvaWeightFiles;
761  mvaWeightFiles.push_back("EGamma/EGammaAnalysisTools/data/Electrons_BDTG_NonTrigV0_Cat1.weights.xml");
762  mvaWeightFiles.push_back("EGamma/EGammaAnalysisTools/data/Electrons_BDTG_NonTrigV0_Cat2.weights.xml");
763  mvaWeightFiles.push_back("EGamma/EGammaAnalysisTools/data/Electrons_BDTG_NonTrigV0_Cat3.weights.xml");
764  mvaWeightFiles.push_back("EGamma/EGammaAnalysisTools/data/Electrons_BDTG_NonTrigV0_Cat4.weights.xml");
765  mvaWeightFiles.push_back("EGamma/EGammaAnalysisTools/data/Electrons_BDTG_NonTrigV0_Cat5.weights.xml");
766  mvaWeightFiles.push_back("EGamma/EGammaAnalysisTools/data/Electrons_BDTG_NonTrigV0_Cat6.weights.xml");
767  std::vector<std::string> mvaWeightFiles_full;
768  for ( std::vector<std::string>::const_iterator mvaWeightFile = mvaWeightFiles.begin();
769  mvaWeightFile != mvaWeightFiles.end(); ++mvaWeightFile ) {
770  edm::FileInPath mvaWeightFile_full(*mvaWeightFile);
771  if ( mvaWeightFile_full.location() == edm::FileInPath::Unknown )
772  throw cms::Exception("MCEmbeddingValidationAnalyzer")
773  << " Failed to find File = " << (*mvaWeightFile) << " !!\n";
774  mvaWeightFiles_full.push_back(mvaWeightFile_full.fullPath());
775  }
776  fMVA_ = new EGammaMvaEleEstimator();
777  fMVA_->initialize("BDT",
778  EGammaMvaEleEstimator::kNonTrig,
779  true,
780  mvaWeightFiles_full);
781  fMVA_isInitialized_ = true;
782  }*/
783  }
785  {
786  delete cutGen_;
787  delete cutRec_;
788  /*if ( fMVA_isInitialized_ ) {
789  delete fMVA_;
790  fMVA_ = 0;
791  fMVA_isInitialized_ = false;
792  }*/
793  }
794  void bookHistograms(DQMStore& dqmStore)
795  {
796  dqmStore.setCurrentFolder(dqmDirectory_.data());
797  histogramMVAptLt20AbsEtaLt0_8_ = dqmStore.book1D("MVAptLt20AbsEtaLt0_8", "MVAptLt20AbsEtaLt0_8", 201, -1.005, +1.005);
798  histogramMVAptLt20AbsEta0_8to1_479_ = dqmStore.book1D("MVAptLt20AbsEta0_8to1_479", "MVAptLt20AbsEta0_8to1_479", 201, -1.005, +1.005);
799  histogramMVAptLt20AbsEtaGt1_479_ = dqmStore.book1D("MVAptLt20AbsEtaGt1_479", "MVAptLt20AbsEtaGt1_479", 201, -1.005, +1.005);
800  histogramMVAptGt20AbsEtaLt0_8_ = dqmStore.book1D("MVAptGt20AbsEtaLt0_8", "MVAptGt20AbsEtaLt0_8", 201, -1.005, +1.005);
801  histogramMVAptGt20AbsEta0_8to1_479_ = dqmStore.book1D("MVAptGt20AbsEta0_8to1_479", "MVAptGt20AbsEta0_8to1_479", 201, -1.005, +1.005);
802  histogramMVAptGt20AbsEtaGt1_479_ = dqmStore.book1D("MVAptGt20AbsEtaGt1_479", "MVAptGt20AbsEtaGt1_479", 201, -1.005, +1.005);
803  histogramFBrem_ = dqmStore.book1D("fBrem", "fBrem", 1100, -1., +10.);
804  histogramKFchi2_ = dqmStore.book1D("kfChi2", "kfChi2", 1001, -0.05, +100.05);
805  histogramNumKFhits_ = dqmStore.book1D("numKFhits", "numKFhits", 25, -0.5, +24.5);
806  histogramGSFchi2_ = dqmStore.book1D("gsfChi2", "gsfChi2", 1001, -0.05, +100.05);
807  histogramDEta_ = dqmStore.book1D("dEta", "dEta", 1000, -0.5, +0.5);
808  histogramDPhi_ = dqmStore.book1D("dPhi", "dPhi", 1000, -0.5, +0.5);
809  histogramDEtaCalo_ = dqmStore.book1D("dEtaCalo", "dEtaCalo", 1000, -0.5, +0.5);
810  histogramSee_ = dqmStore.book1D("See", "See", 500, 0., 0.5);
811  histogramSpp_ = dqmStore.book1D("Spp", "Spp", 500, 0., 0.5);
812  histogramEtaWidth_ = dqmStore.book1D("etaWidth", "etaWidth", 500, 0., 0.5);
813  histogramPhiWidth_ = dqmStore.book1D("phiWidth", "phiWidth", 500, 0., 0.5);
814  histogramOneMinusE1x5E5x5_ = dqmStore.book1D("oneMinusE1x5E5x5", "oneMinusE1x5E5x5", 201, -1.005, +1.005);
815  histogramR9_ = dqmStore.book1D("R9", "R9", 1000, 0., 10.);
816  histogramHoE_ = dqmStore.book1D("HoE", "HoE", 200, -1., +1.);
817  histogramEoP_ = dqmStore.book1D("EoP", "EoP", 1000, 0., 10.);
818  histogramIoEmIoP_ = dqmStore.book1D("IoEmIoP", "IoEmIoP", 1000, 0., 10.);
819  histogramEleEoPout_ = dqmStore.book1D("EleEoPout", "EleEoPout", 1000, 0., 10.);
820  histogramPreShowerOverRaw_ = dqmStore.book1D("PreShowerOverRaw", "PreShowerOverRaw", 1000, 0., 10.);
821  histogramD0_ = dqmStore.book1D("D0", "D0", 1000, 0., 0.1);
822  histogramIP3d_ = dqmStore.book1D("IP3d", "IP3d", 5000, 0., 0.5);
823  histogramEta_ = dqmStore.book1D("eta", "eta", 198, -9.9, +9.9);
824  histogramPt_ = dqmStore.book1D("pt", "pt", 250, 0., 250.);
825  histogramCharge_ = dqmStore.book1D("charge", "charge", 3, -1.5, +1.5);
826  histogramFlags_ = dqmStore.book1D("flags", "flags", 12, -0.5, +11.5);
827  }
828  void fillHistograms(int numJets,
829  const edm::Event& evt, const edm::EventSetup& es, double evtWeight)
830  {
831  if ( (minJets_ == -1 || numJets >= minJets_) &&
832  (maxJets_ == -1 || numJets <= maxJets_) ) {
834  edm::Handle<CandidateView> genLeptons;
835  evt.getByLabel(srcGen_, genLeptons);
836  typedef std::vector<pat::Electron> recLeptonCollection;
838  evt.getByLabel(srcRec_, recLeptons);
839  for ( CandidateView::const_iterator genLepton = genLeptons->begin();
840  genLepton != genLeptons->end(); ++genLepton ) {
841  if ( cutGen_ && !(*cutGen_)(*genLepton) ) continue;
842  for ( recLeptonCollection::const_iterator recLepton = recLeptons->begin();
843  recLepton != recLeptons->end(); ++recLepton ) {
844  if ( cutRec_ && !(*cutRec_)(*recLepton) ) continue;
845  double dR = deltaR(genLepton->p4(), recLepton->p4());
846  if ( dR < dRmatch_ ) {
848  evt.getByLabel(srcTheRecVertex_, theVertex);
849  if ( !(theVertex->size() >= 1) ) return;
850  edm::ESHandle<TransientTrackBuilder> trackBuilderHandle;
851  es.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilderHandle);
852  const TransientTrackBuilder* trackBuilder = trackBuilderHandle.product();
853  if ( !trackBuilder )
854  throw cms::Exception("MCEmbeddingValidationAnalyzer")
855  << " Failed to access TransientTrackBuilder !!\n";
856  EcalClusterLazyTools myEcalCluster(evt, es, edm::InputTag("reducedEcalRecHitsEB"), edm::InputTag("reducedEcalRecHitsEE"));
857  /*double mva = fMVA_->mvaValue(*recLepton, theVertex->front(), *trackBuilder, myEcalCluster);
858  if ( recLepton->pt() < 20. ) {
859  if ( TMath::Abs(recLepton->eta()) < 0.8 ) histogramMVAptLt20AbsEtaLt0_8_->Fill(mva, evtWeight);
860  else if ( TMath::Abs(recLepton->eta()) < 1.479 ) histogramMVAptLt20AbsEta0_8to1_479_->Fill(mva, evtWeight);
861  else histogramMVAptLt20AbsEtaGt1_479_->Fill(mva, evtWeight);
862  } else {
863  if ( TMath::Abs(recLepton->eta()) < 0.8 ) histogramMVAptGt20AbsEtaLt0_8_->Fill(mva, evtWeight);
864  else if ( TMath::Abs(recLepton->eta()) < 1.479 ) histogramMVAptGt20AbsEta0_8to1_479_->Fill(mva, evtWeight);
865  else histogramMVAptGt20AbsEtaGt1_479_->Fill(mva, evtWeight);
866  }
867  histogramFBrem_->Fill(fMVA_->fBrem(), evtWeight);
868  histogramKFchi2_->Fill(fMVA_->kfChi2(), evtWeight);
869  histogramNumKFhits_->Fill(fMVA_->numKFhits(), evtWeight);
870  histogramGSFchi2_->Fill(fMVA_->gsfChi2(), evtWeight);
871  histogramDEta_->Fill(fMVA_->dEta(), evtWeight);
872  histogramDPhi_->Fill(fMVA_->dPhi(), evtWeight);
873  histogramDEtaCalo_->Fill(fMVA_->dEtaCalo(), evtWeight);
874  histogramSee_->Fill(fMVA_->See(), evtWeight);
875  histogramSpp_->Fill(fMVA_->Spp(), evtWeight);
876  histogramEtaWidth_->Fill(fMVA_->etaWidth(), evtWeight);
877  histogramPhiWidth_->Fill(fMVA_->phiWidth(), evtWeight);
878  histogramOneMinusE1x5E5x5_->Fill(fMVA_->oneMinusE1x5E5x5(), evtWeight);
879  histogramR9_->Fill(fMVA_->R9(), evtWeight);
880  histogramHoE_->Fill(fMVA_->HoE(), evtWeight);
881  histogramEoP_->Fill(fMVA_->EoP(), evtWeight);
882  histogramIoEmIoP_->Fill(fMVA_->IoEmIoP(), evtWeight);
883  histogramEleEoPout_->Fill(fMVA_->eleEoPout(), evtWeight);
884  histogramPreShowerOverRaw_->Fill(fMVA_->preShowerOverRaw(), evtWeight);
885  histogramD0_->Fill(fMVA_->d0(), evtWeight);
886  //std::cout << "d0 = " << fMVA_->d0() << std::endl;
887  histogramIP3d_->Fill(fMVA_->ip3d(), evtWeight);
888  //std::cout << "ip3d = " << fMVA_->ip3d() << std::endl;
889  histogramEta_->Fill(fMVA_->eta(), evtWeight);
890  histogramPt_->Fill(fMVA_->pt(), evtWeight);*/
891  histogramCharge_->Fill(recLepton->charge(), evtWeight);
892  histogramFlags_->Fill(0, evtWeight);
893  if ( recLepton->isEB() ) histogramFlags_->Fill(1, evtWeight);
894  if ( recLepton->isEE() ) histogramFlags_->Fill(2, evtWeight);
895  if ( recLepton->isEBEEGap() ) histogramFlags_->Fill(3, evtWeight);
896  if ( recLepton->isEBEtaGap() ) histogramFlags_->Fill(4, evtWeight);
897  if ( recLepton->isEBPhiGap() ) histogramFlags_->Fill(5, evtWeight);
898  if ( recLepton->isEEDeeGap() ) histogramFlags_->Fill(6, evtWeight);
899  if ( recLepton->isEERingGap() ) histogramFlags_->Fill(7, evtWeight);
900  if ( recLepton->ecalDrivenSeed() ) histogramFlags_->Fill(8, evtWeight);
901  if ( recLepton->trackerDrivenSeed() ) histogramFlags_->Fill(9, evtWeight);
902  if ( recLepton->superCluster().isNonnull() || recLepton->superCluster().id() != recLepton->parentSuperCluster().id() ) histogramFlags_->Fill(10, evtWeight);
903  if ( recLepton->parentSuperCluster().isNonnull() ) histogramFlags_->Fill(11, evtWeight);
904  }
905  }
906  }
907  }
908  }
909  int minJets_;
910  int maxJets_;
915  double dRmatch_;
917  /*static EGammaMvaEleEstimator* fMVA_;
918  static bool fMVA_isInitialized_;*/
950  };
951 
953  {
954  tauDistributionExtra(int minJets, int maxJets,
955  const edm::InputTag& srcGen, const std::string& cutGen, const edm::InputTag& srcRec, const std::string& cutRec, double dRmatch, const std::string& dqmDirectory)
956  : minJets_(minJets),
957  maxJets_(maxJets),
958  srcGen_(srcGen),
959  cutGen_(0),
960  srcRec_(srcRec),
961  cutRec_(0),
962  dRmatch_(dRmatch)
963  {
964  if ( cutGen != "" ) cutGen_ = new StringCutObjectSelector<reco::Candidate>(cutGen);
965  if ( cutRec != "" ) cutRec_ = new StringCutObjectSelector<pat::Tau>(cutRec);
966  dqmDirectory_ = dqmDirectory;
967  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
968  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
969  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
970  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
971  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
972  }
974  {
975  delete cutGen_;
976  delete cutRec_;
977  }
978  void bookHistograms(DQMStore& dqmStore)
979  {
980  dqmStore.setCurrentFolder(dqmDirectory_.data());
981  histogramGenTauDecayMode_ = dqmStore.book1D("genTauDecayMode", "genTauDecayMode", 21, -1.5, +19.5);
982  histogramRecTauDecayMode_ = dqmStore.book1D("recTauDecayMode", "recTauDecayMode", 21, -1.5, +19.5);
983  }
984  void fillHistograms(int numJets,
985  const edm::Event& evt, double evtWeight)
986  {
987  if ( (minJets_ == -1 || numJets >= minJets_) &&
988  (maxJets_ == -1 || numJets <= maxJets_) ) {
990  edm::Handle<CandidateView> genLeptons;
991  evt.getByLabel(srcGen_, genLeptons);
992  typedef std::vector<pat::Tau> recLeptonCollection;
994  evt.getByLabel(srcRec_, recLeptons);
995  for ( CandidateView::const_iterator genLepton = genLeptons->begin();
996  genLepton != genLeptons->end(); ++genLepton ) {
997  if ( cutGen_ && !(*cutGen_)(*genLepton) ) continue;
998  const reco::CompositePtrCandidate* genLepton_composite = dynamic_cast<const reco::CompositePtrCandidate*>(&(*genLepton));
999  for ( recLeptonCollection::const_iterator recLepton = recLeptons->begin();
1000  recLepton != recLeptons->end(); ++recLepton ) {
1001  if ( cutRec_ && !(*cutRec_)(*recLepton) ) continue;
1002  double dR = deltaR(genLepton->p4(), recLepton->p4());
1003  if ( dR < dRmatch_ ) {
1004  std::string genTauDecayMode_string = JetMCTagUtils::genTauDecayMode(*genLepton_composite);
1005  //std::cout << "--> genTauDecayMode: = " << genTauDecayMode_string << std::endl;
1006  int genTauDecayMode = -1;
1007  if ( genTauDecayMode_string == "electron" ) genTauDecayMode = reco::PFTauDecayMode::tauDecaysElectron;
1008  else if ( genTauDecayMode_string == "muon" ) genTauDecayMode = reco::PFTauDecayMode::tauDecayMuon;
1009  else if ( genTauDecayMode_string == "oneProng0Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay1ChargedPion0PiZero;
1010  else if ( genTauDecayMode_string == "oneProng1Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay1ChargedPion1PiZero;
1011  else if ( genTauDecayMode_string == "oneProng2Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay1ChargedPion2PiZero;
1012  else if ( genTauDecayMode_string == "oneProngOther" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay1ChargedPion3PiZero;
1013  else if ( genTauDecayMode_string == "threeProng0Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay3ChargedPion0PiZero;
1014  else if ( genTauDecayMode_string == "threeProng1Pi0" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay3ChargedPion1PiZero;
1015  else if ( genTauDecayMode_string == "threeProngOther" ) genTauDecayMode = reco::PFTauDecayMode::tauDecay3ChargedPion2PiZero;
1016  else if ( genTauDecayMode_string == "rare" ) genTauDecayMode = reco::PFTauDecayMode::tauDecayOther;
1017  histogramGenTauDecayMode_->Fill(genTauDecayMode, evtWeight);
1018  int recTauDecayMode = recLepton->decayMode();
1019  histogramRecTauDecayMode_->Fill(recTauDecayMode, evtWeight);
1020  }
1021  }
1022  }
1023  //edm::Handle<reco::GenParticleCollection> genParticles;
1024  //evt.getByLabel("genParticles", genParticles);
1025  //for ( reco::GenParticleCollection::const_iterator genParticle = genParticles->begin();
1026  // genParticle != genParticles->end(); ++genParticle ) {
1027  // if ( TMath::Abs(genParticle->pdgId()) == 15 ) {
1028  // for ( recLeptonCollection::const_iterator recLepton = recLeptons->begin();
1029  // recLepton != recLeptons->end(); ++recLepton ) {
1030  // if ( cutRec_ && !(*cutRec_)(*recLepton) ) continue;
1031  // double dR = deltaR(genParticle->p4(), recLepton->p4());
1032  // if ( dR < dRmatch_ ) {
1033  // std::string genTauDecayMode_string = getGenTauDecayMode(&(*genParticle));
1034  // std::cout << "--> genTauDecayMode: = " << genTauDecayMode_string << std::endl;
1035  // }
1036  // }
1037  // }
1038  //}
1039  }
1040  }
1047  double dRmatch_;
1051  };
1052 
1053  template <typename T>
1054  void setupLeptonDistribution(int, int, const edm::ParameterSet&, const std::string&, std::vector<leptonDistributionT<T>*>&);
1055  void setupElectronDistributionExtra(int, int, const edm::ParameterSet&, const std::string&, std::vector<electronDistributionExtra*>&);
1056  void setupTauDistributionExtra(int, int, const edm::ParameterSet&, const std::string&, std::vector<tauDistributionExtra*>&);
1057 
1058  std::vector<leptonDistributionT<pat::Electron>*> electronDistributions_;
1059  std::vector<electronDistributionExtra*> electronDistributionsExtra_;
1060  std::vector<leptonDistributionT<pat::Muon>*> muonDistributions_;
1061  std::vector<leptonDistributionT<pat::Tau>*> tauDistributions_;
1062  std::vector<tauDistributionExtra*> tauDistributionsExtra_;
1063 
1064  template <typename T>
1066  {
1067  leptonEfficiencyT(int minJets, int maxJets,
1068  const edm::InputTag& srcGen, const std::string& cutGen, const edm::InputTag& srcRec, const std::string& cutRec, double dRmatch, const std::string& dqmDirectory)
1069  : minJets_(minJets),
1070  maxJets_(maxJets),
1071  srcGen_(srcGen),
1072  cutGen_(0),
1073  srcRec_(srcRec),
1074  cutRec_(0),
1075  dRmatch_(dRmatch)
1076  {
1077  if ( cutGen != "" ) cutGen_ = new StringCutObjectSelector<reco::Candidate>(cutGen);
1078  if ( cutRec != "" ) cutRec_ = new StringCutObjectSelector<T>(cutRec);
1079  dqmDirectory_ = dqmDirectory;
1080  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
1081  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
1082  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
1083  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
1084  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
1085  }
1087  {
1088  delete cutGen_;
1089  delete cutRec_;
1090  }
1091  void bookHistograms(DQMStore& dqmStore)
1092  {
1093  dqmStore.setCurrentFolder(dqmDirectory_.data());
1094  histogramNumGenLeptons_ = dqmStore.book1D("numGenLeptons", "numGenLeptons", 10, -0.5, 9.5);
1095  histogramNumRecLeptons_ = dqmStore.book1D("numRecLeptons", "numRecLeptons", 10, -0.5, 9.5);
1096  histogramNumeratorPt_ = dqmStore.book1D("numeratorPt", "numeratorPt", 250, 0., 250.);
1097  histogramDenominatorPt_ = dqmStore.book1D("denominatorPt", "denominatorPt", 250, 0., 250.);
1098  histogramNumeratorEta_ = dqmStore.book1D("numeratorEta", "numeratorEta", 198, -9.9, +9.9);
1099  histogramDenominatorEta_ = dqmStore.book1D("denominatorEta", "denominatorEta", 198, -9.9, +9.9);
1100  histogramNumeratorPhi_ = dqmStore.book1D("numeratorPhi", "numeratorPhi", 72, -TMath::Pi(), +TMath::Pi());
1101  histogramDenominatorPhi_ = dqmStore.book1D("denominatorPhi", "denominatorPhi", 72, -TMath::Pi(), +TMath::Pi());
1102  }
1103  void fillHistograms(int numJets,
1104  const edm::Event& evt, double evtWeight)
1105  {
1106  if ( (minJets_ == -1 || numJets >= minJets_) &&
1107  (maxJets_ == -1 || numJets <= maxJets_) ) {
1109  edm::Handle<CandidateView> genLeptons;
1110  evt.getByLabel(srcGen_, genLeptons);
1111  histogramNumGenLeptons_->Fill(genLeptons->size(), evtWeight);
1112  typedef std::vector<T> recLeptonCollection;
1114  evt.getByLabel(srcRec_, recLeptons);
1115  histogramNumRecLeptons_->Fill(recLeptons->size(), evtWeight);
1116  for ( CandidateView::const_iterator genLepton = genLeptons->begin();
1117  genLepton != genLeptons->end(); ++genLepton ) {
1118  if ( cutGen_ && !(*cutGen_)(*genLepton) ) continue;
1119  bool isMatched = false;
1120  for ( typename recLeptonCollection::const_iterator recLepton = recLeptons->begin();
1121  recLepton != recLeptons->end(); ++recLepton ) {
1122  if ( cutRec_ && !(*cutRec_)(*recLepton) ) continue;
1123  double dR = deltaR(genLepton->p4(), recLepton->p4());
1124  if ( dR < dRmatch_ ) isMatched = true;
1125  }
1126  histogramDenominatorPt_->Fill(genLepton->pt(), evtWeight);
1127  histogramDenominatorEta_->Fill(genLepton->eta(), evtWeight);
1128  histogramDenominatorPhi_->Fill(genLepton->phi(), evtWeight);
1129  if ( isMatched ) {
1130  histogramNumeratorPt_->Fill(genLepton->pt(), evtWeight);
1131  histogramNumeratorEta_->Fill(genLepton->eta(), evtWeight);
1132  histogramNumeratorPhi_->Fill(genLepton->phi(), evtWeight);
1133  }
1134  }
1135  }
1136  }
1143  double dRmatch_;
1153  };
1154 
1155  template <typename T>
1156  void setupLeptonEfficiency(int, int, const edm::ParameterSet&, const std::string&, std::vector<leptonEfficiencyT<T>*>&);
1157 
1158  std::vector<leptonEfficiencyT<reco::GsfElectron>*> gsfElectronEfficiencies_;
1159  std::vector<leptonEfficiencyT<pat::Electron>*> electronEfficiencies_;
1160  std::vector<leptonEfficiencyT<pat::Muon>*> muonEfficiencies_;
1161  std::vector<leptonEfficiencyT<pat::Tau>*> tauEfficiencies_;
1162 
1163  template <typename T1, typename T2>
1165  {
1166  leptonL1TriggerEfficiencyT1T2(int minJets, int maxJets,
1167  const edm::InputTag& srcRef, const std::string& cutRef, const edm::InputTag& srcL1, const std::string& cutL1, double dRmatch, const std::string& dqmDirectory)
1168  : minJets_(minJets),
1169  maxJets_(maxJets),
1170  srcRef_(srcRef),
1171  cutRef_(0),
1172  srcL1_(srcL1),
1173  cutL1_(0),
1174  dRmatch_(dRmatch)
1175  {
1176  if ( cutRef != "" ) cutRef_ = new StringCutObjectSelector<T1>(cutRef);
1177  if ( cutL1 != "" ) cutL1_ = new StringCutObjectSelector<T2>(cutL1);
1178  dqmDirectory_ = dqmDirectory;
1179  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
1180  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
1181  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
1182  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
1183  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
1184  }
1186  {
1187  delete cutRef_;
1188  delete cutL1_;
1189  }
1190  void bookHistograms(DQMStore& dqmStore)
1191  {
1192  dqmStore.setCurrentFolder(dqmDirectory_.data());
1193  histogramNumeratorPt_ = dqmStore.book1D("numeratorPt", "numeratorPt", 250, 0., 250.);
1194  histogramDenominatorPt_ = dqmStore.book1D("denominatorPt", "denominatorPt", 250, 0., 250.);
1195  histogramNumeratorEta_ = dqmStore.book1D("numeratorEta", "numeratorEta", 198, -9.9, +9.9);
1196  histogramDenominatorEta_ = dqmStore.book1D("denominatorEta", "denominatorEta", 198, -9.9, +9.9);
1197  histogramNumeratorPhi_ = dqmStore.book1D("numeratorPhi", "numeratorPhi", 72, -TMath::Pi(), +TMath::Pi());
1198  histogramDenominatorPhi_ = dqmStore.book1D("denominatorPhi", "denominatorPhi", 72, -TMath::Pi(), +TMath::Pi());
1199  }
1200  void fillHistograms(int numJets,
1201  const edm::Event& evt, double evtWeight)
1202  {
1203  if ( (minJets_ == -1 || numJets >= minJets_) &&
1204  (maxJets_ == -1 || numJets <= maxJets_) ) {
1205  typedef std::vector<T1> refLeptonCollection;
1207  evt.getByLabel(srcRef_, refLeptons);
1208  typedef std::vector<T2> l1LeptonCollection;
1210  evt.getByLabel(srcL1_, l1Leptons);
1211  for ( typename refLeptonCollection::const_iterator refLepton = refLeptons->begin();
1212  refLepton != refLeptons->end(); ++refLepton ) {
1213  if ( cutRef_ && !(*cutRef_)(*refLepton) ) continue;
1214  bool isMatched = false;
1215  for ( typename l1LeptonCollection::const_iterator l1Lepton = l1Leptons->begin();
1216  l1Lepton != l1Leptons->end(); ++l1Lepton ) {
1217  if ( cutL1_ && !(*cutL1_)(*l1Lepton) ) continue;
1218  double dR = deltaR(refLepton->p4(), l1Lepton->p4());
1219  if ( dR < dRmatch_ ) isMatched = true;
1220  }
1221  histogramDenominatorPt_->Fill(refLepton->pt(), evtWeight);
1222  histogramDenominatorEta_->Fill(refLepton->eta(), evtWeight);
1223  histogramDenominatorPhi_->Fill(refLepton->phi(), evtWeight);
1224  if ( isMatched ) {
1225  histogramNumeratorPt_->Fill(refLepton->pt(), evtWeight);
1226  histogramNumeratorEta_->Fill(refLepton->eta(), evtWeight);
1227  histogramNumeratorPhi_->Fill(refLepton->phi(), evtWeight);
1228  }
1229  }
1230  }
1231  }
1238  double dRmatch_;
1246  };
1247 
1248  template <typename T1, typename T2>
1250 
1251  std::vector<leptonL1TriggerEfficiencyT1T2<pat::Electron, l1extra::L1EmParticle>*> electronL1TriggerEfficiencies_;
1252  std::vector<leptonL1TriggerEfficiencyT1T2<pat::Muon, l1extra::L1MuonParticle>*> muonL1TriggerEfficiencies_;
1253 
1254  template <typename T>
1256  {
1257  l1ExtraObjectDistributionT(int minJets, int maxJets,
1258  const edm::InputTag& src, const std::string& cut, const std::string& dqmDirectory)
1259  : minJets_(minJets),
1260  maxJets_(maxJets),
1261  src_(src),
1262  cut_(0)
1263  {
1264  if ( cut != "" ) cut_ = new StringCutObjectSelector<T>(cut);
1265  dqmDirectory_ = dqmDirectory;
1266  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
1267  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
1268  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
1269  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
1270  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
1271  }
1273  {
1274  delete cut_;
1275  }
1276  void bookHistograms(DQMStore& dqmStore)
1277  {
1278  dqmStore.setCurrentFolder(dqmDirectory_.data());
1279  histogramNumL1ExtraObjects_ = dqmStore.book1D("numL1ExtraObjects", "numL1ExtraObjects", 10, -0.5, 9.5);
1280  histogramL1ExtraObjectPt_ = dqmStore.book1D("l1ExtraObjectPt", "l1ExtraObjectPt", 250, 0., 250.);
1281  histogramL1ExtraObjectEta_ = dqmStore.book1D("l1ExtraObjectEta", "l1ExtraObjectEta", 198, -9.9, +9.9);
1282  histogramL1ExtraObjectPhi_ = dqmStore.book1D("l1ExtraObjectPhi", "l1ExtraObjectPhi", 72, -TMath::Pi(), +TMath::Pi());
1283  }
1284  void fillHistograms(int numJets,
1285  const edm::Event& evt, double evtWeight)
1286  {
1287  if ( (minJets_ == -1 || numJets >= minJets_) &&
1288  (maxJets_ == -1 || numJets <= maxJets_) ) {
1289  typedef std::vector<T> l1ExtraObjectCollection;
1290  edm::Handle<l1ExtraObjectCollection> l1ExtraObjects;
1291  evt.getByLabel(src_, l1ExtraObjects);
1292  int numL1ExtraObjects = 0;
1293  for ( typename l1ExtraObjectCollection::const_iterator l1ExtraObject = l1ExtraObjects->begin();
1294  l1ExtraObject != l1ExtraObjects->end(); ++l1ExtraObject ) {
1295  if ( cut_ && !(*cut_)(*l1ExtraObject) ) continue;
1296  ++numL1ExtraObjects;
1297  histogramL1ExtraObjectPt_->Fill(l1ExtraObject->pt(), evtWeight);
1298  histogramL1ExtraObjectEta_->Fill(l1ExtraObject->eta(), evtWeight);
1299  histogramL1ExtraObjectPhi_->Fill(l1ExtraObject->phi(), evtWeight);
1300  }
1301  histogramNumL1ExtraObjects_->Fill(numL1ExtraObjects, evtWeight);
1302  }
1303  }
1313  };
1314 
1315  template <typename T>
1316  void setupL1ExtraObjectDistribution(int, int, const edm::ParameterSet&, const std::string&, std::vector<l1ExtraObjectDistributionT<T>*>&);
1317 
1318  std::vector<l1ExtraObjectDistributionT<l1extra::L1EmParticle>*> l1ElectronDistributions_;
1319  std::vector<l1ExtraObjectDistributionT<l1extra::L1MuonParticle>*> l1MuonDistributions_;
1320  std::vector<l1ExtraObjectDistributionT<l1extra::L1JetParticle>*> l1TauDistributions_;
1321  std::vector<l1ExtraObjectDistributionT<l1extra::L1JetParticle>*> l1CentralJetDistributions_;
1322  std::vector<l1ExtraObjectDistributionT<l1extra::L1JetParticle>*> l1ForwardJetDistributions_;
1323 
1325  {
1326  metDistributionType(int minJets, int maxJets,
1327  const edm::InputTag& srcGen, const edm::InputTag& srcRec, const edm::InputTag& srcGenZs, const std::string& dqmDirectory)
1328  : minJets_(minJets),
1329  maxJets_(maxJets),
1330  srcGen_(srcGen),
1331  srcRec_(srcRec),
1332  srcGenZs_(srcGenZs)
1333  {
1334  dqmDirectory_ = dqmDirectory;
1335  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
1336  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
1337  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
1338  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
1339  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
1340  }
1342  void bookHistograms(DQMStore& dqmStore)
1343  {
1344  dqmStore.setCurrentFolder(dqmDirectory_.data());
1345  histogramGenMEtPt_ = dqmStore.book1D("genMEtPt", "genMEtPt", 250, 0., 250.);
1346  histogramGenMEtPhi_ = dqmStore.book1D("genMEtPhi", "genMEtPhi", 72, -TMath::Pi(), +TMath::Pi());
1347  histogramRecMEtPt_ = dqmStore.book1D("recMEtPt", "recMEtPt", 250, 0., 250.);
1348  histogramRecMEtPhi_ = dqmStore.book1D("recMEtPhi", "recMEtPhi", 72, -TMath::Pi(), +TMath::Pi());
1349  histogramRecMinusGenMEtParlZ_ = dqmStore.book1D("recMinusGenMEtParlZ", "recMinusGenMEtParlZ", 200, -100., +100.);
1350  histogramRecMinusGenMEtPerpZ_ = dqmStore.book1D("recMinusGenMEtPerpZ", "recMinusGenMEtPerpZ", 100, 0., 100.);
1351  }
1352  void fillHistograms(int numJets,
1353  const edm::Event& evt, double evtWeight)
1354  {
1355  if ( (minJets_ == -1 || numJets >= minJets_) &&
1356  (maxJets_ == -1 || numJets <= maxJets_) ) {
1357  typedef edm::View<reco::MET> METView;
1358  edm::Handle<METView> genMETs;
1359  evt.getByLabel(srcGen_, genMETs);
1360  const reco::Candidate::LorentzVector& genMEtP4 = genMETs->front().p4();
1361  edm::Handle<METView> recMETs;
1362  evt.getByLabel(srcRec_, recMETs);
1363  const reco::Candidate::LorentzVector& recMEtP4 = recMETs->front().p4();
1364  //std::cout << "<MCEmbeddingValidationAnalyzer>:" << std::endl;
1365  //std::cout << " recMEt(" << srcRec_.label() << "): Pt = " << recMEtP4.pt() << ", phi = " << recMEtP4.phi()
1366  // << " (Px = " << recMEtP4.px() << ", Py = " << recMEtP4.py() << ")" << std::endl;
1369  evt.getByLabel(srcGenZs_, genZs);
1370  if ( !(genZs->size() >= 1) ) return;
1371  const reco::Candidate::LorentzVector& genZp4 = genZs->front().p4();
1372  histogramGenMEtPt_->Fill(genMEtP4.pt(), evtWeight);
1373  histogramGenMEtPhi_->Fill(genMEtP4.phi(), evtWeight);
1374  histogramRecMEtPt_->Fill(recMEtP4.pt(), evtWeight);
1375  histogramRecMEtPhi_->Fill(recMEtP4.phi(), evtWeight);
1376  if ( genZp4.pt() > 0. ) {
1377  double qX = genZp4.px();
1378  double qY = genZp4.py();
1379  double qT = TMath::Sqrt(qX*qX + qY*qY);
1380  double dX = recMEtP4.px() - genMEtP4.px();
1381  double dY = recMEtP4.py() - genMEtP4.py();
1382  double dParl = (dX*qX + dY*qY)/qT;
1383  double dPerp = (dX*qY - dY*qX)/qT;
1384  histogramRecMinusGenMEtParlZ_->Fill(dParl, evtWeight);
1385  histogramRecMinusGenMEtPerpZ_->Fill(TMath::Abs(dPerp), evtWeight);
1386  }
1387  }
1388  }
1401  };
1402 
1403  void setupMEtDistribution(int, int, const edm::ParameterSet&, const std::string&, std::vector<metDistributionType*>&);
1404 
1405  std::vector<metDistributionType*> metDistributions_;
1406 
1408  {
1409  metL1TriggerEfficiencyType(int minJets, int maxJets,
1410  const edm::InputTag& srcRef, const edm::InputTag& srcL1, double cutL1Et, double cutL1Pt, const std::string& dqmDirectory)
1411  : minJets_(minJets),
1412  maxJets_(maxJets),
1413  srcRef_(srcRef),
1414  srcL1_(srcL1),
1415  cutL1Et_(cutL1Et),
1416  cutL1Pt_(cutL1Pt)
1417  {
1418  dqmDirectory_ = dqmDirectory;
1419  if ( minJets_ < 0 && maxJets_ < 0 ) dqmDirectory_.append("");
1420  else if ( maxJets_ < 0 ) dqmDirectory_.append(Form("_numJetsGe%i", minJets_));
1421  else if ( minJets_ < 0 ) dqmDirectory_.append(Form("_numJetsLe%i", maxJets_));
1422  else if ( maxJets_ == minJets_ ) dqmDirectory_.append(Form("_numJetsEq%i", minJets_));
1423  else dqmDirectory_.append(Form("_numJets%ito%i", minJets_, maxJets_));
1424  }
1426  void bookHistograms(DQMStore& dqmStore)
1427  {
1428  dqmStore.setCurrentFolder(dqmDirectory_.data());
1429  histogramNumeratorPt_ = dqmStore.book1D("numeratorPt", "numeratorPt", 250, 0., 250.);
1430  histogramDenominatorPt_ = dqmStore.book1D("denominatorPt", "denominatorPt", 250, 0., 250.);
1431  histogramNumeratorPhi_ = dqmStore.book1D("numeratorPhi", "numeratorPhi", 72, -TMath::Pi(), +TMath::Pi());
1432  histogramDenominatorPhi_ = dqmStore.book1D("denominatorPhi", "denominatorPhi", 72, -TMath::Pi(), +TMath::Pi());
1433  }
1434  void fillHistograms(int numJets,
1435  const edm::Event& evt, double evtWeight)
1436  {
1437  if ( (minJets_ == -1 || numJets >= minJets_) &&
1438  (maxJets_ == -1 || numJets <= maxJets_) ) {
1439  typedef edm::View<reco::MET> METView;
1440  edm::Handle<METView> refMETs;
1441  evt.getByLabel(srcRef_, refMETs);
1442  const reco::Candidate::LorentzVector& refMEtP4 = refMETs->front().p4();
1444  evt.getByLabel(srcL1_, l1METs);
1445  for ( l1extra::L1EtMissParticleCollection::const_iterator l1MEt = l1METs->begin();
1446  l1MEt != l1METs->end(); ++l1MEt ) {
1447  if ( !(l1MEt->bx() == 0) ) continue;
1448  double l1MEt_et = l1METs->front().etMiss();
1449  double l1MEt_pt = l1METs->front().pt();
1450  histogramDenominatorPt_->Fill(refMEtP4.pt(), evtWeight);
1451  histogramDenominatorPhi_->Fill(refMEtP4.phi(), evtWeight);
1452  if ( l1MEt_et > cutL1Et_ && l1MEt_pt > cutL1Pt_ ) {
1453  histogramNumeratorPt_->Fill(refMEtP4.pt(), evtWeight);
1454  histogramNumeratorPhi_->Fill(refMEtP4.phi(), evtWeight);
1455  }
1456  }
1457  }
1458  }
1463  double cutL1Et_;
1464  double cutL1Pt_;
1470  };
1471 
1472  void setupMEtL1TriggerEfficiency(int, int, const edm::ParameterSet&, const std::string&, std::vector<metL1TriggerEfficiencyType*>&);
1473 
1474  std::vector<metL1TriggerEfficiencyType*> metL1TriggerEfficiencies_;
1475 
1476  template <typename T>
1477  void cleanCollection(std::vector<T*> collection)
1478  {
1479  for ( typename std::vector<T*>::iterator object = collection.begin();
1480  object != collection.end(); ++object ) {
1481  delete (*object);
1482  }
1483  }
1484 
1485  template <typename T>
1486  void bookHistograms(std::vector<T*> collection, DQMStore& dqmStore)
1487  {
1488  for ( typename std::vector<T*>::iterator object = collection.begin();
1489  object != collection.end(); ++object ) {
1490  (*object)->bookHistograms(dqmStore);
1491  }
1492  }
1493 
1494  template <typename T>
1495  void fillHistograms(std::vector<T*> collection, int numJets, const edm::Event& evt, double evtWeight)
1496  {
1497  for ( typename std::vector<T*>::iterator object = collection.begin();
1498  object != collection.end(); ++object ) {
1499  (*object)->fillHistograms(numJets, evt, evtWeight);
1500  }
1501  }
1502  template <typename T>
1503  void fillHistograms(std::vector<T*> collection, int numJets, const edm::Event& evt, const edm::EventSetup& es, double evtWeight)
1504  {
1505  for ( typename std::vector<T*>::iterator object = collection.begin();
1506  object != collection.end(); ++object ) {
1507  (*object)->fillHistograms(numJets, evt, es, evtWeight);
1508  }
1509  }
1510 
1512 };
1513 
1514 #endif
void fillHistograms(std::vector< T * > collection, int numJets, const edm::Event &evt, const edm::EventSetup &es, double evtWeight)
const double Pi
void fillHistograms(int numJets, const edm::Event &evt, double evtWeight)
std::string genTauDecayMode(const reco::CompositePtrCandidate &c)
Definition: JetMCTag.cc:81
std::vector< metL1TriggerEfficiencyType * > metL1TriggerEfficiencies_
void fillHistograms(std::vector< T * > collection, int numJets, const edm::Event &evt, double evtWeight)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
void setupL1ExtraObjectDistribution(int, int, const edm::ParameterSet &, const std::string &, std::vector< l1ExtraObjectDistributionT< T > * > &)
std::vector< plotEntryTypeMuonRadCorrUncertainty * > muonRadCorrUncertaintyPlotEntries_afterRad_
tauDistributionExtra(int minJets, int maxJets, const edm::InputTag &srcGen, const std::string &cutGen, const edm::InputTag &srcRec, const std::string &cutRec, double dRmatch, const std::string &dqmDirectory)
std::vector< leptonEfficiencyT< pat::Electron > * > electronEfficiencies_
void analyze(const edm::Event &, const edm::EventSetup &)
daughters::value_type daughterRef(size_type i) const
reference to daughter at given position
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
virtual int pdgId() const GCC11_FINAL
PDG identifier.
metDistributionType(int minJets, int maxJets, const edm::InputTag &srcGen, const edm::InputTag &srcRec, const edm::InputTag &srcGenZs, const std::string &dqmDirectory)
std::vector< leptonL1TriggerEfficiencyT1T2< pat::Electron, l1extra::L1EmParticle > * > electronL1TriggerEfficiencies_
MCEmbeddingValidationAnalyzer(const edm::ParameterSet &)
void fillHistograms(int numJets, const edm::Event &evt, double evtWeight)
leptonL1TriggerEfficiencyT1T2(int minJets, int maxJets, const edm::InputTag &srcRef, const std::string &cutRef, const edm::InputTag &srcL1, const std::string &cutL1, double dRmatch, const std::string &dqmDirectory)
void fillHistograms(int numJets, const edm::Event &evt, double evtWeight)
StringCutObjectSelector< reco::Candidate > * cutGen_
l1ExtraObjectDistributionT(int minJets, int maxJets, const edm::InputTag &src, const std::string &cut, const std::string &dqmDirectory)
void setupMEtL1TriggerEfficiency(int, int, const edm::ParameterSet &, const std::string &, std::vector< metL1TriggerEfficiencyType * > &)
std::vector< plotEntryTypeL1ETM * > l1ETMplotEntries_
std::vector< tauDistributionExtra * > tauDistributionsExtra_
double charge(const std::vector< uint8_t > &Ampls)
void fillHistograms(int numJets, const edm::Event &evt, double evtWeight)
std::vector< plotEntryTypeMuonRadCorrUncertainty * > muonRadCorrUncertaintyPlotEntries_afterRadAndCorr_
void Fill(long long x)
std::vector< leptonDistributionT< pat::Electron > * > electronDistributions_
void fillHistograms(int numJets, const edm::Event &evt, const edm::EventSetup &es, double evtWeight)
plotEntryTypeL1ETM(const std::string &genTauDecayMode, const std::string &dqmDirectory)
edm::View< reco::Candidate > CandidateView
tuple numMuons
Definition: patZpeak.py:40
std::vector< edm::InputTag > vInputTag
void fillHistograms(int numJets, const edm::Event &evt, double evtWeight)
void fillHistograms(int numJets, const edm::Event &evt, double evtWeight)
void bookHistograms(std::vector< T * > collection, DQMStore &dqmStore)
void setupLeptonL1TriggerEfficiency(int, int, const edm::ParameterSet &, const std::string &, std::vector< leptonL1TriggerEfficiencyT1T2< T1, T2 > * > &)
virtual int status() const GCC11_FINAL
status word
std::vector< leptonEfficiencyT< reco::GsfElectron > * > gsfElectronEfficiencies_
virtual size_t numberOfDaughters() const
number of daughters
void fillHistograms(const edm::Event &evt, const std::map< std::string, double > &evtWeightMap_other)
edm::View< reco::MET > METView
leptonDistributionT(int minJets, int maxJets, const edm::InputTag &srcGen, const std::string &cutGen, const edm::InputTag &srcRec, const std::string &cutRec, double dRmatch, const std::string &dqmDirectory)
bool isMatched(TrackingRecHit const &hit)
void fillHistograms(const std::string &genTauDecayMode_ref, const reco::Candidate::LorentzVector &l1MEtP4, const reco::Candidate::LorentzVector &genCaloMEtP4, const reco::Candidate::LorentzVector &recCaloMEtP4, const reco::Candidate::LorentzVector &genDiTauP4, double evtWeight)
StringCutObjectSelector< reco::Candidate > * cutGen_
std::vector< leptonEfficiencyT< pat::Muon > * > muonEfficiencies_
std::string dqmDirectory_full(const std::string &dqmSubDirectory)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< plotEntryTypeEvtWeight * > evtWeightPlotEntries_
std::pair< double, double > compMEtProjU(const reco::Candidate::LorentzVector &zP4, double metPx, double metPy, int &errorFlag)
std::vector< l1ExtraObjectDistributionT< l1extra::L1JetParticle > * > l1CentralJetDistributions_
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
metL1TriggerEfficiencyType(int minJets, int maxJets, const edm::InputTag &srcRef, const edm::InputTag &srcL1, double cutL1Et, double cutL1Pt, const std::string &dqmDirectory)
electronDistributionExtra(int minJets, int maxJets, const edm::InputTag &srcGen, const std::string &cutGen, const edm::InputTag &srcRec, const std::string &cutRec, double dRmatch, const std::string &dqmDirectory, const edm::InputTag &srcTheRecVertex)
StringCutObjectSelector< reco::Candidate > * cutGen_
std::vector< plotEntryTypeMuonRadCorrUncertainty * > muonRadCorrUncertaintyPlotEntries_beforeRad_
std::vector< l1ExtraObjectDistributionT< l1extra::L1JetParticle > * > l1TauDistributions_
virtual int charge() const GCC11_FINAL
electric charge
std::vector< metDistributionType * > metDistributions_
leptonEfficiencyT(int minJets, int maxJets, const edm::InputTag &srcGen, const std::string &cutGen, const edm::InputTag &srcRec, const std::string &cutRec, double dRmatch, const std::string &dqmDirectory)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void setupLeptonDistribution(int, int, const edm::ParameterSet &, const std::string &, std::vector< leptonDistributionT< T > * > &)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
list object
Definition: dbtoconf.py:77
std::string const & label() const
Definition: InputTag.h:42
void fillHistograms(int numJets, const reco::Candidate::LorentzVector &muonPlusP4, const reco::Candidate::LorentzVector &muonMinusP4, double evtWeight_others, double muonRadCorrWeight, double muonRadCorrWeightUp, double muonRadCorrWeightDown)
void cleanCollection(std::vector< T * > collection)
plotEntryTypeEvtWeight(const edm::InputTag &srcWeight, const std::string &dqmDirectory)
void setupMEtDistribution(int, int, const edm::ParameterSet &, const std::string &, std::vector< metDistributionType * > &)
std::vector< leptonL1TriggerEfficiencyT1T2< pat::Muon, l1extra::L1MuonParticle > * > muonL1TriggerEfficiencies_
void setupTauDistributionExtra(int, int, const edm::ParameterSet &, const std::string &, std::vector< tauDistributionExtra * > &)
void fillHistograms(int numJets, const edm::Event &evt, double evtWeight)
void setupElectronDistributionExtra(int, int, const edm::ParameterSet &, const std::string &, std::vector< electronDistributionExtra * > &)
T get() const
get a component
Definition: Candidate.h:219
std::vector< l1ExtraObjectDistributionT< l1extra::L1EmParticle > * > l1ElectronDistributions_
std::vector< l1ExtraObjectDistributionT< l1extra::L1MuonParticle > * > l1MuonDistributions_
std::vector< leptonDistributionT< pat::Muon > * > muonDistributions_
int weight
Definition: histoStyle.py:50
tuple status
Definition: ntuplemaker.py:245
std::vector< electronDistributionExtra * > electronDistributionsExtra_
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
std::vector< leptonEfficiencyT< pat::Tau > * > tauEfficiencies_
plotEntryTypeMuonRadCorrUncertainty(int minJets, int maxJets, const std::string &dqmDirectory)
std::string const & instance() const
Definition: InputTag.h:43
std::vector< l1ExtraObjectDistributionT< l1extra::L1JetParticle > * > l1ForwardJetDistributions_
void setupLeptonEfficiency(int, int, const edm::ParameterSet &, const std::string &, std::vector< leptonEfficiencyT< T > * > &)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
std::vector< leptonDistributionT< pat::Tau > * > tauDistributions_