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 }
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
dqm::implementation::IGetter::getContents
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:593
JetMETHLTOfflineClient::~JetMETHLTOfflineClient
~JetMETHLTOfflineClient() override
JetMETHLTOfflineClient.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
dqm::implementation::IGetter::getSubdirs
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:678
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:478
JetMETHLTOfflineClient::verbose_
bool verbose_
Definition: JetMETHLTOfflineClient.h:54
JetMETHLTOfflineClient::JetMETHLTOfflineClient
JetMETHLTOfflineClient(const edm::ParameterSet &)
Definition: JetMETHLTOfflineClient.cc:12
Service.h
JetMETHLTOfflineClient::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: JetMETHLTOfflineClient.cc:27
getName
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:235
JetMETHLTOfflineClient::debug_
bool debug_
Definition: JetMETHLTOfflineClient.h:53
Run.h
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
JetMETHLTOfflineClient::dirName_
std::string dirName_
Definition: JetMETHLTOfflineClient.h:56
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IBooker::book2D
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:177
JetMETHLTOfflineClient::processname_
std::string processname_
Definition: JetMETHLTOfflineClient.h:58
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
JetMETHLTOfflineClient::hltTag_
std::string hltTag_
Definition: JetMETHLTOfflineClient.h:57
ParameterSet.h
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