CMS 3D CMS Logo

DQMHcalIsoTrackPostProcessor.cc
Go to the documentation of this file.
4 
9 
11 public:
14 
15  // void analyze(const edm::Event& event, const edm::EventSetup& eventSetup)
16  // override {};
18  DQMStore::IGetter &) override; // performed in the endJob
19 
20 private:
22 };
23 
25  subDir_ = pset.getUntrackedParameter<std::string>("subDir");
26 }
27 
29  if (igetter.dirExists(subDir_)) {
30  igetter.cd(subDir_);
31  } else {
32  edm::LogWarning("DQMHcalIsoTrackPostProcessor") << "cannot find directory: " << subDir_ << " , skipping";
33  return;
34  }
35 
36  MonitorElement *hSumEta[4], *hSumPhi[4], *hPurityEta[3], *hPurityPhi[3];
37  std::string types[4] = {"L2", "L2x", "L3", "Off"};
38  char name[100], title[200];
39  for (int i = 0; i < 4; ++i) {
40  sprintf(name, "/heta%s", types[i].c_str());
41  std::string hname1 = ibooker.pwd() + std::string(name);
42  int nbinEta = igetter.get(hname1)->getTH1F()->GetNbinsX();
43  double xminEta = igetter.get(hname1)->getTH1F()->GetBinLowEdge(1);
44  double xmaxEta =
45  igetter.get(hname1)->getTH1F()->GetBinLowEdge(nbinEta) + igetter.get(hname1)->getTH1F()->GetBinWidth(nbinEta);
46  sprintf(name, "/hphi%s", types[i].c_str());
47  std::string hname2 = ibooker.pwd() + std::string(name);
48  int nbinPhi = igetter.get(hname2)->getTH1F()->GetNbinsX();
49  double xminPhi = igetter.get(hname2)->getTH1F()->GetBinLowEdge(1);
50  double xmaxPhi =
51  igetter.get(hname2)->getTH1F()->GetBinLowEdge(nbinEta) + igetter.get(hname2)->getTH1F()->GetBinWidth(nbinEta);
52  sprintf(name, "hSum%sEta", types[i].c_str());
53  hSumEta[i] = ibooker.book1D(name, name, nbinEta, xminEta, xmaxEta);
54  sprintf(name, "hSum%sPhi", types[i].c_str());
55  hSumPhi[i] = ibooker.book1D(name, name, nbinPhi, xminPhi, xmaxPhi);
56  if (i < 3) {
57  sprintf(name, "hPurity%sEta", types[i].c_str());
58  sprintf(title, "Purity of %s sample vs #eta", types[i].c_str());
59  hPurityEta[i] = ibooker.book1D(name, title, nbinEta, xminEta, xmaxEta);
60  sprintf(name, "hPurity%sPhi", types[i].c_str());
61  sprintf(title, "Purity of %s sample vs #phi", types[i].c_str());
62  hPurityPhi[i] = ibooker.book1D(name, title, nbinPhi, xminPhi, xmaxPhi);
63  }
64  }
65 
66  for (int i = 0; i < 4; ++i) {
67  sprintf(name, "/heta%s", types[i].c_str());
68  std::string hname1 = ibooker.pwd() + std::string(name);
69  edm::LogVerbatim("DQMHcal") << "PostProcesor " << hname1 << " " << igetter.get(hname1);
70 
71  hSumEta[i]->getTH1F()->Add(igetter.get(hname1)->getTH1F(), 1);
72  sprintf(name, "/hphi%s", types[i].c_str());
73  std::string hname2 = ibooker.pwd() + std::string(name);
74  edm::LogVerbatim("DQMHcal") << "PostProcesor " << hname2 << " " << igetter.get(hname2);
75 
76  hSumPhi[i]->getTH1F()->Add(igetter.get(hname2)->getTH1F(), 1);
77  }
78 
79  for (int i = 0; i < 3; ++i) {
80  hPurityEta[i]->getTH1F()->Divide(hSumEta[i + 1]->getTH1F(), hSumEta[i]->getTH1F(), 1, 1);
81  hPurityPhi[i]->getTH1F()->Divide(hSumPhi[i + 1]->getTH1F(), hSumPhi[i]->getTH1F(), 1, 1);
82  }
83 }
84 
Log< level::Info, true > LogVerbatim
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual std::string pwd()
Definition: DQMStore.cc:16
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:737
DQMHcalIsoTrackPostProcessor(const edm::ParameterSet &pset)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
virtual TH1F * getTH1F() const
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:680
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98