CMS 3D CMS Logo

JetMETHLTOfflineClient.cc
Go to the documentation of this file.
1 // Migrated to use DQMEDHarvester by: Jyothsna Rani Komaragiri, Oct 2014
2 
4 
9 
11 
13  debug_ = false;
14  verbose_ = false;
15 
16  processname_ = iConfig.getParameter<std::string>("processname");
17 
18  hltTag_ = iConfig.getParameter<std::string>("hltTag");
19  if (debug_)
20  std::cout << hltTag_ << std::endl;
21 
22  dirName_ = iConfig.getParameter<std::string>("DQMDirName");
23 }
24 
26 
28  ibooker.setCurrentFolder(dirName_);
29 
30  LogDebug("JetMETHLTOfflineClient") << "dqmEndJob" << std::endl;
31  if (debug_)
32  std::cout << "dqmEndJob" << std::endl;
33 
34  std::vector<MonitorElement*> hltMEs;
35 
36  // Look at all folders, go to the subfolder which includes the string "Eff"
37  std::vector<std::string> fullPathHLTFolders = igetter.getSubdirs();
38  for (auto& fullPathHLTFolder : fullPathHLTFolders) {
39  // Move on only if the folder name contains "Eff" Or "Trigger Summary"
40  if (debug_)
41  std::cout << fullPathHLTFolder << std::endl;
42  if ((fullPathHLTFolder.find("Eff") != std::string::npos)) {
43  ibooker.setCurrentFolder(fullPathHLTFolder);
44  } else {
45  continue;
46  }
47 
48  // Look at all subfolders, go to the subfolder which includes the string "Eff"
49  std::vector<std::string> fullSubPathHLTFolders = igetter.getSubdirs();
50  for (auto& fullSubPathHLTFolder : fullSubPathHLTFolders) {
51  if (debug_)
52  std::cout << fullSubPathHLTFolder << std::endl;
53  ibooker.setCurrentFolder(fullSubPathHLTFolder);
54 
55  // Look at all MonitorElements in this folder
56  hltMEs = igetter.getContents(fullSubPathHLTFolder);
57  LogDebug("JetMETHLTOfflineClient") << "Number of MEs for this HLT path = " << hltMEs.size() << std::endl;
58 
59  for (unsigned int k = 0; k < hltMEs.size(); k++) {
60  if (debug_)
61  std::cout << hltMEs[k]->getName() << std::endl;
62 
63  //-----
64  if ((hltMEs[k]->getName().find("ME_Numerator") != std::string::npos) &&
65  hltMEs[k]->getName().find("ME_Numerator") == 0) {
66  std::string name = hltMEs[k]->getName();
67  name.erase(0, 12); // Removed "ME_Numerator"
68  if (debug_)
69  std::cout << "==name==" << name << std::endl;
70  // if( name.find("EtaPhi") !=std::string::npos ) continue; // do not consider EtaPhi 2D plots
71 
72  for (unsigned int l = 0; l < hltMEs.size(); l++) {
73  if (hltMEs[l]->getName() == "ME_Denominator" + name) {
74  // found denominator too
75  if (name.find("EtaPhi") != std::string::npos) {
76  TH2F* tNumerator = hltMEs[k]->getTH2F();
77  TH2F* tDenominator = hltMEs[l]->getTH2F();
78 
79  std::string title = "Eff_" + hltMEs[k]->getTitle();
80 
81  auto* teff = (TH2F*)tNumerator->Clone(title.c_str());
82  teff->Divide(tNumerator, tDenominator, 1, 1);
83  ibooker.book2D("ME_Eff_" + name, teff);
84  delete teff;
85  } else {
86  TH1F* tNumerator = hltMEs[k]->getTH1F();
87  TH1F* tDenominator = hltMEs[l]->getTH1F();
88 
89  std::string title = "Eff_" + hltMEs[k]->getTitle();
90 
91  auto* teff = (TH1F*)tNumerator->Clone(title.c_str());
92  teff->Divide(tNumerator, tDenominator, 1, 1);
93  ibooker.book1D("ME_Eff_" + name, teff);
94  delete teff;
95  }
96  } // Denominator
97  } // Loop-l
98  } // Numerator
99 
100  } // Loop-k
101  } // fullSubPath
102  } // fullPath
103 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
~JetMETHLTOfflineClient() override
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:236
virtual TH1F * getTH1F() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
JetMETHLTOfflineClient(const edm::ParameterSet &)
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:593
#define LogDebug(id)
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:700