CMS 3D CMS Logo

DQMHcalIsoTrackPostProcessor.cc
Go to the documentation of this file.
6 
9 
10 #include <cmath>
11 #include <cstring>
12 #include <fstream>
13 #include <iomanip>
14 #include <iostream>
15 
16 #define DebugLog
17 
19 public:
22 
23  // void analyze(const edm::Event& event, const edm::EventSetup& eventSetup)
24  // override {};
26  DQMStore::IGetter &) override; // performed in the endJob
27 
28 private:
30 };
31 
33  subDir_ = pset.getUntrackedParameter<std::string>("subDir");
34 }
35 
37  if (igetter.dirExists(subDir_)) {
38  igetter.cd(subDir_);
39  } else {
40  edm::LogWarning("DQMHcalIsoTrackPostProcessor") << "cannot find directory: " << subDir_ << " , skipping";
41  return;
42  }
43 
44  MonitorElement *hSumEta[4], *hSumPhi[4], *hPurityEta[3], *hPurityPhi[3];
45  std::string types[4] = {"L2", "L2x", "L3", "Off"};
46  char name[100], title[200];
47  for (int i = 0; i < 4; ++i) {
48  sprintf(name, "/heta%s", types[i].c_str());
49  std::string hname1 = ibooker.pwd() + std::string(name);
50  int nbinEta = igetter.get(hname1)->getTH1F()->GetNbinsX();
51  double xminEta = igetter.get(hname1)->getTH1F()->GetBinLowEdge(1);
52  double xmaxEta =
53  igetter.get(hname1)->getTH1F()->GetBinLowEdge(nbinEta) + igetter.get(hname1)->getTH1F()->GetBinWidth(nbinEta);
54  sprintf(name, "/hphi%s", types[i].c_str());
55  std::string hname2 = ibooker.pwd() + std::string(name);
56  int nbinPhi = igetter.get(hname2)->getTH1F()->GetNbinsX();
57  double xminPhi = igetter.get(hname2)->getTH1F()->GetBinLowEdge(1);
58  double xmaxPhi =
59  igetter.get(hname2)->getTH1F()->GetBinLowEdge(nbinEta) + igetter.get(hname2)->getTH1F()->GetBinWidth(nbinEta);
60  sprintf(name, "hSum%sEta", types[i].c_str());
61  hSumEta[i] = ibooker.book1D(name, name, nbinEta, xminEta, xmaxEta);
62  sprintf(name, "hSum%sPhi", types[i].c_str());
63  hSumPhi[i] = ibooker.book1D(name, name, nbinPhi, xminPhi, xmaxPhi);
64  if (i < 3) {
65  sprintf(name, "hPurity%sEta", types[i].c_str());
66  sprintf(title, "Purity of %s sample vs #eta", types[i].c_str());
67  hPurityEta[i] = ibooker.book1D(name, title, nbinEta, xminEta, xmaxEta);
68  sprintf(name, "hPurity%sPhi", types[i].c_str());
69  sprintf(title, "Purity of %s sample vs #phi", types[i].c_str());
70  hPurityPhi[i] = ibooker.book1D(name, title, nbinPhi, xminPhi, xmaxPhi);
71  }
72  }
73 
74  for (int i = 0; i < 4; ++i) {
75  sprintf(name, "/heta%s", types[i].c_str());
76  std::string hname1 = ibooker.pwd() + std::string(name);
77 #ifdef DebugLog
78  std::cout << "PostProcesor " << hname1 << " " << igetter.get(hname1) << std::endl;
79 #endif
80  hSumEta[i]->getTH1F()->Add(igetter.get(hname1)->getTH1F(), 1);
81  sprintf(name, "/hphi%s", types[i].c_str());
82  std::string hname2 = ibooker.pwd() + std::string(name);
83 #ifdef DebugLog
84  std::cout << "PostProcesor " << hname2 << " " << igetter.get(hname2) << std::endl;
85 #endif
86  hSumPhi[i]->getTH1F()->Add(igetter.get(hname2)->getTH1F(), 1);
87  }
88 
89  for (int i = 0; i < 3; ++i) {
90  hPurityEta[i]->getTH1F()->Divide(hSumEta[i + 1]->getTH1F(), hSumEta[i]->getTH1F(), 1, 1);
91  hPurityPhi[i]->getTH1F()->Divide(hSumPhi[i + 1]->getTH1F(), hSumPhi[i]->getTH1F(), 1, 1);
92  }
93 }
94 
DQMEDHarvester.h
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DQMHcalIsoTrackPostProcessor::DQMHcalIsoTrackPostProcessor
DQMHcalIsoTrackPostProcessor(const edm::ParameterSet &pset)
Definition: DQMHcalIsoTrackPostProcessor.cc:32
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
EDAnalyzer.h
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:479
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
dqm::implementation::NavigatorBase::pwd
virtual std::string pwd()
Definition: DQMStore.cc:16
DQMEDAnalyzer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
DQMHcalIsoTrackPostProcessor
Definition: DQMHcalIsoTrackPostProcessor.cc:18
types
types
Definition: AlignPCLThresholds_PayloadInspector.cc:30
DQMEDHarvester
Definition: DQMEDHarvester.py:1
DQMHcalIsoTrackPostProcessor::subDir_
std::string subDir_
Definition: DQMHcalIsoTrackPostProcessor.cc:29
Frameworkfwd.h
dqm::implementation::IGetter
Definition: DQMStore.h:484
DQMHcalIsoTrackPostProcessor::~DQMHcalIsoTrackPostProcessor
~DQMHcalIsoTrackPostProcessor() override
Definition: DQMHcalIsoTrackPostProcessor.cc:21
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
DQMHcalIsoTrackPostProcessor::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: DQMHcalIsoTrackPostProcessor.cc:36
dqm::implementation::IGetter::dirExists
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:708
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98