CMS 3D CMS Logo

ResolutionCreator.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <string>
4 
5 // user include files
8 
11 
13 //needed for TFileService
16 //needed for MessageLogger
18 
20 
26 
27 #include "TDirectory.h"
28 #include "TH1F.h"
29 #include "TF1.h"
30 #include "TTree.h"
31 
32 #include <Math/VectorUtil.h>
33 
34 //
35 // class declaration
36 //
37 
39 public:
40  explicit ResolutionCreator(const edm::ParameterSet &);
41  ~ResolutionCreator() override;
42 
43 private:
44  void beginJob() override;
45  void analyze(const edm::Event &, const edm::EventSetup &) override;
46  void endJob() override;
47 
48  // ----------member data ---------------------------
56  std::vector<double> etabinVals_, pTbinVals_;
57  double minDR_;
60  bool useDeltaR_;
61  double maxDist_;
63  int nrFilled;
64 
65  //Histograms are booked in the beginJob() method
66  TF1 *fResPtEtaBin[10][20][20];
67  TF1 *fResEtaBin[10][20];
68  TH1F *hResPtEtaBin[10][20][20];
69  TH1F *hResEtaBin[10][20];
70  TTree *tResVar;
71 };
72 
73 //
74 // constructors and destructor
75 //
77  // input parameters
78  genEvtToken_ = consumes<TtGenEvent>(edm::InputTag("genEvt"));
79  objectType_ = iConfig.getParameter<std::string>("object");
80  labelName_ = iConfig.getParameter<std::string>("label");
81  if (objectType_ == "electron")
82  electronsToken_ = consumes<std::vector<pat::Electron> >(edm::InputTag(labelName_));
83  else if (objectType_ == "muon")
84  muonsToken_ = consumes<std::vector<pat::Muon> >(edm::InputTag(labelName_));
85  else if (objectType_ == "lJets" || objectType_ == "bJets")
86  jetsToken_ = consumes<std::vector<pat::Jet> >(edm::InputTag(labelName_));
87  else if (objectType_ == "met")
88  metsToken_ = consumes<std::vector<pat::MET> >(edm::InputTag(labelName_));
89  else if (objectType_ == "tau")
90  tausToken_ = consumes<std::vector<pat::Tau> >(edm::InputTag(labelName_));
91  if (objectType_ != "met") {
92  etabinVals_ = iConfig.getParameter<std::vector<double> >("etabinValues");
93  }
94  pTbinVals_ = iConfig.getParameter<std::vector<double> >("pTbinValues");
95  minDR_ = iConfig.getParameter<double>("minMatchingDR");
96 
97  nrFilled = 0;
98 }
99 
101 
102 //
103 // member functions
104 //
105 
106 // ------------ method called to for each event ------------
108  // Get the gen and cal object fourvector
109  std::vector<reco::Particle *> p4gen, p4rec;
110 
112  iEvent.getByToken(genEvtToken_, genEvt);
113 
114  if (genEvt->particles().size() < 10)
115  return;
116 
117  if (objectType_ == "electron") {
119  electrons; //to calculate the ResolutionCreator for the electrons, i used the TopElectron instead of the AOD information
120  iEvent.getByToken(electronsToken_, electrons);
121  for (size_t e = 0; e < electrons->size(); e++) {
122  for (size_t p = 0; p < genEvt->particles().size(); p++) {
123  if ((std::abs(genEvt->particles()[p].pdgId()) == 11) &&
124  (ROOT::Math::VectorUtil::DeltaR(genEvt->particles()[p].p4(), (*electrons)[e].p4()) < minDR_)) {
125  //p4gen.push_back(new reco::Particle(genEvt->particles()[p]));
126  //p4rec.push_back(new reco::Particle((pat::Electron)((*electrons)[e])));
127  }
128  }
129  }
130  } else if (objectType_ == "muon") {
132  iEvent.getByToken(muonsToken_, muons);
133  for (size_t m = 0; m < muons->size(); m++) {
134  for (size_t p = 0; p < genEvt->particles().size(); p++) {
135  if ((std::abs(genEvt->particles()[p].pdgId()) == 13) &&
136  (ROOT::Math::VectorUtil::DeltaR(genEvt->particles()[p].p4(), (*muons)[m].p4()) < minDR_)) {
137  //p4gen.push_back(new reco::Particle(genEvt->particles()[p]));
138  //p4rec.push_back(new reco::Particle((pat::Muon)((*muons)[m])));
139  }
140  }
141  }
142  } else if (objectType_ == "lJets") {
144  iEvent.getByToken(jetsToken_, jets);
145  if (jets->size() >= 4) {
146  for (unsigned int j = 0; j < 4; j++) {
147  for (size_t p = 0; p < genEvt->particles().size(); p++) {
148  if ((std::abs(genEvt->particles()[p].pdgId()) < 5) &&
149  (ROOT::Math::VectorUtil::DeltaR(genEvt->particles()[p].p4(), (*jets)[j].p4()) < minDR_)) {
150  //p4gen.push_back(new reco::Particle(genEvt->particles()[p]));
151  //p4rec.push_back(new reco::Particle((pat::Jet)(*jets)[j]));
152  }
153  }
154  }
155  }
156  } else if (objectType_ == "bJets") {
158  iEvent.getByToken(jetsToken_, jets);
159  if (jets->size() >= 4) {
160  for (unsigned int j = 0; j < 4; j++) {
161  for (size_t p = 0; p < genEvt->particles().size(); p++) {
162  if ((std::abs(genEvt->particles()[p].pdgId()) == 5) &&
163  (ROOT::Math::VectorUtil::DeltaR(genEvt->particles()[p].p4(), (*jets)[j].p4()) < minDR_)) {
164  //p4gen.push_back(new reco::Particle(genEvt->particles()[p]));
165  //p4rec.push_back(new reco::Particle((pat::Jet)(*jets)[j]));
166  }
167  }
168  }
169  }
170  } else if (objectType_ == "met") {
172  iEvent.getByToken(metsToken_, mets);
173  if (!mets->empty()) {
174  if (genEvt->isSemiLeptonic() && genEvt->singleNeutrino() != nullptr &&
175  ROOT::Math::VectorUtil::DeltaR(genEvt->singleNeutrino()->p4(), (*mets)[0].p4()) < minDR_) {
176  //p4gen.push_back(new reco::Particle(0,genEvt->singleNeutrino()->p4(),math::XYZPoint()));
177  //p4rec.push_back(new reco::Particle((pat::MET)((*mets)[0])));
178  }
179  }
180  } else if (objectType_ == "tau") {
182  iEvent.getByToken(tausToken_, taus);
183  for (std::vector<pat::Tau>::const_iterator tau = taus->begin(); tau != taus->end(); ++tau) {
184  // find the tau (if any) that matches a MC tau from W
185  reco::GenParticle genLepton = *(tau->genLepton());
186  if (std::abs(genLepton.pdgId()) == 15 && genLepton.status() == 2 && genLepton.numberOfMothers() > 0 &&
187  std::abs(genLepton.mother(0)->pdgId()) == 15 && genLepton.mother(0)->numberOfMothers() > 0 &&
188  std::abs(genLepton.mother(0)->mother(0)->pdgId()) == 24 &&
189  ROOT::Math::VectorUtil::DeltaR(genLepton.p4(), tau->p4()) < minDR_) {
190  }
191  //p4gen.push_back(new reco::Particle(genLepton));
192  //p4rec.push_back(new reco::Particle(*tau));
193  }
194  }
195  // Fill the object's value
196  for (unsigned m = 0; m < p4gen.size(); m++) {
197  double Egen = p4gen[m]->energy();
198  double Thetagen = p4gen[m]->theta();
199  double Phigen = p4gen[m]->phi();
200  double Etgen = p4gen[m]->et();
201  double Etagen = p4gen[m]->eta();
202  double Ecal = p4rec[m]->energy();
203  double Thetacal = p4rec[m]->theta();
204  double Phical = p4rec[m]->phi();
205  double Etcal = p4rec[m]->et();
206  double Etacal = p4rec[m]->eta();
207  double phidiff = Phical - Phigen;
208  if (phidiff > 3.14159)
209  phidiff = 2. * 3.14159 - phidiff;
210  if (phidiff < -3.14159)
211  phidiff = -phidiff - 2. * 3.14159;
212 
213  // find eta and et bin
214  int etabin = 0;
215  if (etanrbins > 1) {
216  for (unsigned int b = 0; b < etabinVals_.size() - 1; b++) {
217  if (fabs(Etacal) > etabinVals_[b])
218  etabin = b;
219  }
220  }
221 
222  int ptbin = 0;
223  for (unsigned int b = 0; b < pTbinVals_.size() - 1; b++) {
224  if (p4rec[m]->pt() > pTbinVals_[b])
225  ptbin = b;
226  }
227 
228  // calculate the resolution on "a", "b", "c" & "d" according to the definition (CMS-NOTE-2006-023):
229  // p = a*|p_meas|*u_1 + b*u_2 + c*u_3
230  // E(fit) = E_meas * d
231  //
232  // with u_1 = p/|p_meas|
233  // u_3 = (u_z x u_1)/|u_z x u_1|
234  // u_2 = (u_1 x u_3)/|u_1 x u_3|
235  //
236  // The initial parameters values are chosen like (a, b, c, d) = (1., 0., 0., 1.)
237 
238  // 1/ calculate the unitary vectors of the basis u_1, u_2, u_3
239  ROOT::Math::SVector<double, 3> pcalvec(p4rec[m]->px(), p4rec[m]->py(), p4rec[m]->pz());
240  ROOT::Math::SVector<double, 3> pgenvec(p4gen[m]->px(), p4gen[m]->py(), p4gen[m]->pz());
241 
242  ROOT::Math::SVector<double, 3> u_z(0, 0, 1);
243  ROOT::Math::SVector<double, 3> u_1 = ROOT::Math::Unit(pcalvec);
244  ROOT::Math::SVector<double, 3> u_3 = ROOT::Math::Cross(u_z, u_1) / ROOT::Math::Mag(ROOT::Math::Cross(u_z, u_1));
245  ROOT::Math::SVector<double, 3> u_2 = ROOT::Math::Cross(u_1, u_3) / ROOT::Math::Mag(ROOT::Math::Cross(u_1, u_3));
246  double acal = 1.;
247  double bcal = 0.;
248  double ccal = 0.;
249  double dcal = 1.;
250  double agen = ROOT::Math::Dot(pgenvec, u_1) / ROOT::Math::Mag(pcalvec);
251  double bgen = ROOT::Math::Dot(pgenvec, u_2);
252  double cgen = ROOT::Math::Dot(pgenvec, u_3);
253  double dgen = Egen / Ecal;
254 
255  //fill histograms
256  ++nrFilled;
257  hResPtEtaBin[0][etabin][ptbin]->Fill(acal - agen);
258  hResPtEtaBin[1][etabin][ptbin]->Fill(bcal - bgen);
259  hResPtEtaBin[2][etabin][ptbin]->Fill(ccal - cgen);
260  hResPtEtaBin[3][etabin][ptbin]->Fill(dcal - dgen);
261  hResPtEtaBin[4][etabin][ptbin]->Fill(Thetacal - Thetagen);
262  hResPtEtaBin[5][etabin][ptbin]->Fill(phidiff);
263  hResPtEtaBin[6][etabin][ptbin]->Fill(Etcal - Etgen);
264  hResPtEtaBin[7][etabin][ptbin]->Fill(Etacal - Etagen);
265 
266  delete p4gen[m];
267  delete p4rec[m];
268  }
269 }
270 
271 // ------------ method called once each job just before starting event loop ------------
274  if (!fs)
275  throw edm::Exception(edm::errors::Configuration, "TFileService missing from configuration!");
276 
277  // input constants
278  TString resObsName[8] = {"_ares", "_bres", "_cres", "_dres", "_thres", "_phres", "_etres", "_etares"};
279  int resObsNrBins = 120;
280  if ((objectType_ == "muon") || (objectType_ == "electron"))
281  resObsNrBins = 80;
282  std::vector<double> resObsMin, resObsMax;
283  if (objectType_ == "electron") {
284  resObsMin.push_back(-0.15);
285  resObsMin.push_back(-0.2);
286  resObsMin.push_back(-0.1);
287  resObsMin.push_back(-0.15);
288  resObsMin.push_back(-0.0012);
289  resObsMin.push_back(-0.009);
290  resObsMin.push_back(-16);
291  resObsMin.push_back(-0.0012);
292  resObsMax.push_back(0.15);
293  resObsMax.push_back(0.2);
294  resObsMax.push_back(0.1);
295  resObsMax.push_back(0.15);
296  resObsMax.push_back(0.0012);
297  resObsMax.push_back(0.009);
298  resObsMax.push_back(16);
299  resObsMax.push_back(0.0012);
300  } else if (objectType_ == "muon") {
301  resObsMin.push_back(-0.15);
302  resObsMin.push_back(-0.1);
303  resObsMin.push_back(-0.05);
304  resObsMin.push_back(-0.15);
305  resObsMin.push_back(-0.004);
306  resObsMin.push_back(-0.003);
307  resObsMin.push_back(-8);
308  resObsMin.push_back(-0.004);
309  resObsMax.push_back(0.15);
310  resObsMax.push_back(0.1);
311  resObsMax.push_back(0.05);
312  resObsMax.push_back(0.15);
313  resObsMax.push_back(0.004);
314  resObsMax.push_back(0.003);
315  resObsMax.push_back(8);
316  resObsMax.push_back(0.004);
317  } else if (objectType_ == "tau") {
318  resObsMin.push_back(-1.);
319  resObsMin.push_back(-10.);
320  resObsMin.push_back(-10);
321  resObsMin.push_back(-1.);
322  resObsMin.push_back(-0.1);
323  resObsMin.push_back(-0.1);
324  resObsMin.push_back(-80);
325  resObsMin.push_back(-0.1);
326  resObsMax.push_back(1.);
327  resObsMax.push_back(10.);
328  resObsMax.push_back(10);
329  resObsMax.push_back(1.);
330  resObsMax.push_back(0.1);
331  resObsMax.push_back(0.1);
332  resObsMax.push_back(50);
333  resObsMax.push_back(0.1);
334  } else if (objectType_ == "lJets" || objectType_ == "bJets") {
335  resObsMin.push_back(-1.);
336  resObsMin.push_back(-10.);
337  resObsMin.push_back(-10.);
338  resObsMin.push_back(-1.);
339  resObsMin.push_back(-0.4);
340  resObsMin.push_back(-0.6);
341  resObsMin.push_back(-80);
342  resObsMin.push_back(-0.6);
343  resObsMax.push_back(1.);
344  resObsMax.push_back(10.);
345  resObsMax.push_back(10.);
346  resObsMax.push_back(1.);
347  resObsMax.push_back(0.4);
348  resObsMax.push_back(0.6);
349  resObsMax.push_back(80);
350  resObsMax.push_back(0.6);
351  } else {
352  resObsMin.push_back(-2.);
353  resObsMin.push_back(-150.);
354  resObsMin.push_back(-150.);
355  resObsMin.push_back(-2.);
356  resObsMin.push_back(-6);
357  resObsMin.push_back(-6);
358  resObsMin.push_back(-180);
359  resObsMin.push_back(-6);
360  resObsMax.push_back(3.);
361  resObsMax.push_back(150.);
362  resObsMax.push_back(150.);
363  resObsMax.push_back(3.);
364  resObsMax.push_back(6);
365  resObsMax.push_back(6);
366  resObsMax.push_back(180);
367  resObsMax.push_back(6);
368  }
369 
370  const char *resObsVsPtFit[8] = {"[0]+[1]*exp(-[2]*x)",
371  "[0]+[1]*exp(-[2]*x)",
372  "[0]+[1]*exp(-[2]*x)",
373  "[0]+[1]*exp(-[2]*x)",
374  "[0]+[1]*exp(-[2]*x)",
375  "[0]+[1]*exp(-[2]*x)",
376  "pol1",
377  "[0]+[1]*exp(-[2]*x)"};
378 
379  ptnrbins = pTbinVals_.size() - 1;
380  double *ptbins = new double[pTbinVals_.size()];
381  for (unsigned int b = 0; b < pTbinVals_.size(); b++)
382  ptbins[b] = pTbinVals_[b];
383  double *etabins;
384  if (objectType_ != "met") {
385  etanrbins = etabinVals_.size() - 1;
386  etabins = new double[etabinVals_.size()];
387  for (unsigned int b = 0; b < etabinVals_.size(); b++)
388  etabins[b] = etabinVals_[b];
389  } else {
390  etanrbins = 1;
391  etabins = new double[2];
392  etabins[0] = 0;
393  etabins[1] = 5.;
394  }
395 
396  //define the histograms booked
397  for (Int_t ro = 0; ro < 8; ro++) {
398  for (Int_t etab = 0; etab < etanrbins; etab++) {
399  for (Int_t ptb = 0; ptb < ptnrbins; ptb++) {
400  TString obsName = objectType_;
401  obsName += resObsName[ro];
402  obsName += "_etabin";
403  obsName += etab;
404  obsName += "_ptbin";
405  obsName += ptb;
406  hResPtEtaBin[ro][etab][ptb] = fs->make<TH1F>(obsName, obsName, resObsNrBins, resObsMin[ro], resObsMax[ro]);
407  fResPtEtaBin[ro][etab][ptb] = fs->make<TF1>("F_" + obsName, "gaus");
408  }
409  TString obsName2 = objectType_;
410  obsName2 += resObsName[ro];
411  obsName2 += "_etabin";
412  obsName2 += etab;
413  hResEtaBin[ro][etab] = fs->make<TH1F>(obsName2, obsName2, ptnrbins, ptbins);
414  fResEtaBin[ro][etab] =
415  fs->make<TF1>("F_" + obsName2, resObsVsPtFit[ro], pTbinVals_[0], pTbinVals_[pTbinVals_.size() - 1]);
416  }
417  }
418  tResVar = fs->make<TTree>("tResVar", "Resolution tree");
419 
420  delete[] etabins;
421  delete[] ptbins;
422 }
423 
424 // ------------ method called once each job just after ending the event loop ------------
426  TString resObsName2[8] = {"a", "b", "c", "d", "theta", "phi", "et", "eta"};
427  Int_t ro = 0;
428  Double_t pt = 0.;
429  Double_t eta = 0.;
430  Double_t value, error;
431 
432  tResVar->Branch("Pt", &pt, "Pt/D");
433  tResVar->Branch("Eta", &eta, "Eta/D");
434  tResVar->Branch("ro", &ro, "ro/I");
435  tResVar->Branch("value", &value, "value/D");
436  tResVar->Branch("error", &error, "error/D");
437 
438  for (ro = 0; ro < 8; ro++) {
439  for (int etab = 0; etab < etanrbins; etab++) {
440  //CD set eta at the center of the bin
441  eta = etanrbins > 1 ? (etabinVals_[etab] + etabinVals_[etab + 1]) / 2. : 2.5;
442  for (int ptb = 0; ptb < ptnrbins; ptb++) {
443  //CD set pt at the center of the bin
444  pt = (pTbinVals_[ptb] + pTbinVals_[ptb + 1]) / 2.;
445  double maxcontent = 0.;
446  int maxbin = 0;
447  for (int nb = 1; nb < hResPtEtaBin[ro][etab][ptb]->GetNbinsX(); nb++) {
448  if (hResPtEtaBin[ro][etab][ptb]->GetBinContent(nb) > maxcontent) {
449  maxcontent = hResPtEtaBin[ro][etab][ptb]->GetBinContent(nb);
450  maxbin = nb;
451  }
452  }
453  int range = (int)(hResPtEtaBin[ro][etab][ptb]->GetNbinsX() / 6); //in order that ~1/3 of X-axis range is fitted
454  fResPtEtaBin[ro][etab][ptb]->SetRange(hResPtEtaBin[ro][etab][ptb]->GetBinCenter(maxbin - range),
455  hResPtEtaBin[ro][etab][ptb]->GetBinCenter(maxbin + range));
456  fResPtEtaBin[ro][etab][ptb]->SetParameters(hResPtEtaBin[ro][etab][ptb]->GetMaximum(),
457  hResPtEtaBin[ro][etab][ptb]->GetMean(),
458  hResPtEtaBin[ro][etab][ptb]->GetRMS());
459  hResPtEtaBin[ro][etab][ptb]->Fit(fResPtEtaBin[ro][etab][ptb]->GetName(), "RQ");
460  hResEtaBin[ro][etab]->SetBinContent(ptb + 1, fResPtEtaBin[ro][etab][ptb]->GetParameter(2));
461  hResEtaBin[ro][etab]->SetBinError(ptb + 1, fResPtEtaBin[ro][etab][ptb]->GetParError(2));
462  //CD: Fill the tree
463  value = fResPtEtaBin[ro][etab][ptb]->GetParameter(2); //parameter value
464  error = fResPtEtaBin[ro][etab][ptb]->GetParError(2); //parameter error
465  tResVar->Fill();
466  }
467  //CD: add a fake entry in pt=0 for the NN training
468  // for that, use a linear extrapolation.
469  pt = 0.;
470  value = ((pTbinVals_[0] + pTbinVals_[1]) / 2.) *
471  (fResPtEtaBin[ro][etab][0]->GetParameter(2) - fResPtEtaBin[ro][etab][1]->GetParameter(2)) /
472  ((pTbinVals_[2] - pTbinVals_[0]) / 2.) +
473  fResPtEtaBin[ro][etab][0]->GetParameter(2);
474  error = fResPtEtaBin[ro][etab][0]->GetParError(2) + fResPtEtaBin[ro][etab][1]->GetParError(2);
475  tResVar->Fill();
476  // standard fit
477  hResEtaBin[ro][etab]->Fit(fResEtaBin[ro][etab]->GetName(), "RQ");
478  }
479  }
480  if (objectType_ == "lJets" && nrFilled == 0)
481  edm::LogProblem("SummaryError") << "No plots filled for light jets \n";
482  if (objectType_ == "bJets" && nrFilled == 0)
483  edm::LogProblem("SummaryError") << "No plots filled for bjets \n";
484  if (objectType_ == "muon" && nrFilled == 0)
485  edm::LogProblem("SummaryError") << "No plots filled for muons \n";
486  if (objectType_ == "electron" && nrFilled == 0)
487  edm::LogProblem("SummaryError") << "No plots filled for electrons \n";
488  if (objectType_ == "tau" && nrFilled == 0)
489  edm::LogProblem("SummaryError") << "No plots filled for taus \n";
490  if (objectType_ == "met" && nrFilled == 0)
491  edm::LogProblem("SummaryError") << "No plots filled for met \n";
492 
493  edm::LogVerbatim("MainResults") << " \n\n";
494  edm::LogVerbatim("MainResults") << " ----------------------------------------------";
495  edm::LogVerbatim("MainResults") << " ----------------------------------------------";
496  edm::LogVerbatim("MainResults") << " Resolutions on " << objectType_ << " with nrfilled: " << nrFilled;
497  edm::LogVerbatim("MainResults") << " ----------------------------------------------";
498  edm::LogVerbatim("MainResults") << " ----------------------------------------------";
499  if (nrFilled != 0 && objectType_ != "met") {
500  for (ro = 0; ro < 8; ro++) {
501  edm::LogVerbatim("MainResults") << "-------------------- ";
502  edm::LogVerbatim("MainResults") << "\n Resolutions on " << resObsName2[ro] << "\n";
503  edm::LogVerbatim("MainResults") << "-------------------- ";
504  for (int etab = 0; etab < etanrbins; etab++) {
505  if (nrFilled != 0 && ro != 6) {
506  if (etab == 0) {
507  edm::LogVerbatim("MainResults")
508  << "if(fabs(eta)<" << etabinVals_[etab + 1] << ") res = " << fResEtaBin[ro][etab]->GetParameter(0)
509  << "+" << fResEtaBin[ro][etab]->GetParameter(1) << "*exp(-(" << fResEtaBin[ro][etab]->GetParameter(2)
510  << "*pt));";
511  } else {
512  edm::LogVerbatim("MainResults")
513  << "else if(fabs(eta)<" << etabinVals_[etab + 1] << ") res = " << fResEtaBin[ro][etab]->GetParameter(0)
514  << "+" << fResEtaBin[ro][etab]->GetParameter(1) << "*exp(-(" << fResEtaBin[ro][etab]->GetParameter(2)
515  << "*pt));";
516  }
517  } else if (nrFilled != 0 && ro == 6) {
518  if (etab == 0) {
519  edm::LogVerbatim("MainResults")
520  << "if(fabs(eta)<" << etabinVals_[etab + 1] << ") res = " << fResEtaBin[ro][etab]->GetParameter(0)
521  << "+" << fResEtaBin[ro][etab]->GetParameter(1) << "*pt;";
522  } else {
523  edm::LogVerbatim("MainResults")
524  << "else if(fabs(eta)<" << etabinVals_[etab + 1] << ") res = " << fResEtaBin[ro][etab]->GetParameter(0)
525  << "+" << fResEtaBin[ro][etab]->GetParameter(1) << "*pt;";
526  }
527  }
528  }
529  }
530  } else if (nrFilled != 0 && objectType_ == "met") {
531  for (ro = 0; ro < 8; ro++) {
532  edm::LogVerbatim("MainResults") << "-------------------- ";
533  edm::LogVerbatim("MainResults") << "\n Resolutions on " << resObsName2[ro] << "\n";
534  edm::LogVerbatim("MainResults") << "-------------------- ";
535  if (nrFilled != 0 && ro != 6) {
536  edm::LogVerbatim("MainResults") << "res = " << fResEtaBin[ro][0]->GetParameter(0) << "+"
537  << fResEtaBin[ro][0]->GetParameter(1) << "*exp(-("
538  << fResEtaBin[ro][0]->GetParameter(2) << "*pt));";
539  } else if (nrFilled != 0 && ro == 6) {
540  edm::LogVerbatim("MainResults") << "res = " << fResEtaBin[ro][0]->GetParameter(0) << "+"
541  << fResEtaBin[ro][0]->GetParameter(1) << "*pt;";
542  }
543  }
544  }
545 }
546 
547 //define this as a plug-in
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
ResolutionCreator::pTbinVals_
std::vector< double > pTbinVals_
Definition: ResolutionCreator.cc:56
ResolutionCreator::beginJob
void beginJob() override
Definition: ResolutionCreator.cc:272
MessageLogger.h
metsig::tau
Definition: SignAlgoResolutions.h:49
reco::LeafCandidate::status
int status() const final
status word
Definition: LeafCandidate.h:180
ResolutionCreator::genEvtToken_
edm::EDGetTokenT< TtGenEvent > genEvtToken_
Definition: ResolutionCreator.cc:49
reco::GenParticle
Definition: GenParticle.h:21
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
edm::EDGetTokenT< TtGenEvent >
Tau3MuMonitor_cff.taus
taus
Definition: Tau3MuMonitor_cff.py:7
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
reco::CompositeRefCandidateT::mother
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode)
Muon.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
ResolutionCreator::matchingAlgo_
int matchingAlgo_
Definition: ResolutionCreator.cc:58
reco::CompositeRefCandidateT::numberOfMothers
size_t numberOfMothers() const override
number of mothers
ResolutionCreator::ptnrbins
int ptnrbins
Definition: ResolutionCreator.cc:62
bgen
double bgen
Definition: HydjetWrapper.h:44
EDAnalyzer.h
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
singleTopDQM_cfi.mets
mets
Definition: singleTopDQM_cfi.py:43
reco::Candidate::mother
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
tools.TF1
TF1
Definition: tools.py:23
edm::Handle
Definition: AssociativeIterator.h:50
relativeConstraints.error
error
Definition: relativeConstraints.py:53
ResolutionCreator::fResEtaBin
TF1 * fResEtaBin[10][20]
Definition: ResolutionCreator.cc:67
Tau.h
ResolutionCreator
Definition: ResolutionCreator.cc:38
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
ResolutionCreator::etanrbins
int etanrbins
Definition: ResolutionCreator.cc:62
ResolutionCreator::labelName_
std::string labelName_
Definition: ResolutionCreator.cc:50
ResolutionCreator::endJob
void endJob() override
Definition: ResolutionCreator.cc:425
MakerMacros.h
reco::Candidate::numberOfMothers
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
ResolutionCreator::tausToken_
edm::EDGetTokenT< std::vector< pat::Tau > > tausToken_
Definition: ResolutionCreator.cc:55
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
ResolutionCreator::objectType_
std::string objectType_
Definition: ResolutionCreator.cc:50
PVValHelper::eta
Definition: PVValidationHelpers.h:69
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::LogProblem
Log< level::Error, true > LogProblem
Definition: MessageLogger.h:131
ResolutionCreator::jetsToken_
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
Definition: ResolutionCreator.cc:53
b
double b
Definition: hdecay.h:118
ResolutionCreator::etabinVals_
std::vector< double > etabinVals_
Definition: ResolutionCreator.cc:56
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TFileService.h
ResolutionCreator::hResPtEtaBin
TH1F * hResPtEtaBin[10][20][20]
Definition: ResolutionCreator.cc:68
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ResolutionCreator::hResEtaBin
TH1F * hResEtaBin[10][20]
Definition: ResolutionCreator.cc:69
ResolutionCreator::~ResolutionCreator
~ResolutionCreator() override
Definition: ResolutionCreator.cc:100
TtGenEvent.h
reco::LeafCandidate::pdgId
int pdgId() const final
PDG identifier.
Definition: LeafCandidate.h:176
edm::Service< TFileService >
createfilelist.int
int
Definition: createfilelist.py:10
hitfit::phidiff
double phidiff(double phi)
Normalized difference in azimuthal angles to a range between .
Definition: fourvec.cc:220
iEvent
int iEvent
Definition: GenABIO.cc:224
ResolutionCreator::nrFilled
int nrFilled
Definition: ResolutionCreator.cc:63
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
value
Definition: value.py:1
ResolutionCreator::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: ResolutionCreator.cc:107
edm::EventSetup
Definition: EventSetup.h:57
ResolutionCreator::useMaxDist_
bool useMaxDist_
Definition: ResolutionCreator.cc:59
ResolutionCreator::ResolutionCreator
ResolutionCreator(const edm::ParameterSet &)
Definition: ResolutionCreator.cc:76
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
ResolutionCreator::fResPtEtaBin
TF1 * fResPtEtaBin[10][20][20]
Definition: ResolutionCreator.cc:66
MET.h
Jet.h
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
ResolutionCreator::tResVar
TTree * tResVar
Definition: ResolutionCreator.cc:70
LepHTMonitor_cff.ptbins
ptbins
Definition: LepHTMonitor_cff.py:39
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
ResolutionCreator::metsToken_
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
Definition: ResolutionCreator.cc:54
ResolutionCreator::electronsToken_
edm::EDGetTokenT< std::vector< pat::Electron > > electronsToken_
Definition: ResolutionCreator.cc:51
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
Frameworkfwd.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:246
ResolutionCreator::muonsToken_
edm::EDGetTokenT< std::vector< pat::Muon > > muonsToken_
Definition: ResolutionCreator.cc:52
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
Electron.h
ResolutionCreator::maxDist_
double maxDist_
Definition: ResolutionCreator.cc:61
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ResolutionCreator::useDeltaR_
bool useDeltaR_
Definition: ResolutionCreator.cc:60
ParameterSet.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
edm::errors::Configuration
Definition: EDMException.h:36
ResolutionCreator::minDR_
double minDR_
Definition: ResolutionCreator.cc:57
defaults_cfi.etabins
etabins
Definition: defaults_cfi.py:7
edm::InputTag
Definition: InputTag.h:15
TtGenEvtProducer_cfi.genEvt
genEvt
Definition: TtGenEvtProducer_cfi.py:7
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37