CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetMETHLTOfflineClient.cc
Go to the documentation of this file.
1 // Migrated to use DQMEDHarvester by: Jyothsna Rani Komaragiri, Oct 2014
2 
4 
9 
12 
14 {
15  debug_ = false;
16  verbose_ = false;
17 
18  processname_ = iConfig.getParameter<std::string>("processname");
19 
20  hltTag_ = iConfig.getParameter<std::string>("hltTag");
21  if (debug_) std::cout << hltTag_ << std::endl;
22 
23  dirName_=iConfig.getParameter<std::string>("DQMDirName");
24 
25 }
26 
28 {
29 
30 }
31 
33 {
34  ibooker.setCurrentFolder(dirName_);
35 
36  LogDebug("JetMETHLTOfflineClient") << "dqmEndJob" << std::endl;
37  if (debug_) std::cout << "dqmEndJob" << std::endl;
38 
39  std::vector<MonitorElement*> hltMEs;
40 
41  // Look at all folders, go to the subfolder which includes the string "Eff"
42  std::vector<std::string> fullPathHLTFolders = igetter.getSubdirs();
43  for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
44 
45  // Move on only if the folder name contains "Eff" Or "Trigger Summary"
46  if (debug_) std::cout << fullPathHLTFolders[i] << std::endl;
47  if ((fullPathHLTFolders[i].find("Eff")!=std::string::npos)) {
48  ibooker.setCurrentFolder(fullPathHLTFolders[i]);
49  }
50  else {
51  continue;
52  }
53 
54  // Look at all subfolders, go to the subfolder which includes the string "Eff"
55  std::vector<std::string> fullSubPathHLTFolders = igetter.getSubdirs();
56  for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
57 
58  if (debug_) std::cout << fullSubPathHLTFolders[j] << std::endl;
59  ibooker.setCurrentFolder(fullSubPathHLTFolders[j]);
60 
61  // Look at all MonitorElements in this folder
62  hltMEs = igetter.getContents(fullSubPathHLTFolders[j]);
63  LogDebug("JetMETHLTOfflineClient")<< "Number of MEs for this HLT path = " << hltMEs.size() << std::endl;
64 
65  for(unsigned int k=0;k<hltMEs.size();k++) {
66  if (debug_) std::cout << hltMEs[k]->getName() << std::endl;
67 
68  //-----
69  if ((hltMEs[k]->getName().find("ME_Numerator")!=std::string::npos) && hltMEs[k]->getName().find("ME_Numerator")==0){
70 
71  std::string name = hltMEs[k]->getName();
72  name.erase(0,12); // Removed "ME_Numerator"
73  if (debug_) std::cout <<"==name=="<< name << std::endl;
74  // if( name.find("EtaPhi") !=std::string::npos ) continue; // do not consider EtaPhi 2D plots
75 
76  for(unsigned int l=0;l<hltMEs.size();l++) {
77  if (hltMEs[l]->getName() == "ME_Denominator"+name){
78  // found denominator too
79  if(name.find("EtaPhi") !=std::string::npos) {
80  TH2F* tNumerator = hltMEs[k]->getTH2F();
81  TH2F* tDenominator = hltMEs[l]->getTH2F();
82 
83  std::string title = "Eff_"+hltMEs[k]->getTitle();
84 
85  TH2F *teff = (TH2F*) tNumerator->Clone(title.c_str());
86  teff->Divide(tNumerator,tDenominator,1,1);
87  ibooker.book2D("ME_Eff_"+name,teff);
88  delete teff;
89  }
90  else{
91  TH1F* tNumerator = hltMEs[k]->getTH1F();
92  TH1F* tDenominator = hltMEs[l]->getTH1F();
93 
94  std::string title = "Eff_"+hltMEs[k]->getTitle();
95 
96  TH1F *teff = (TH1F*) tNumerator->Clone(title.c_str());
97  teff->Divide(tNumerator,tDenominator,1,1);
98  ibooker.book1D("ME_Eff_"+name,teff);
99  delete teff;
100  }
101  } // Denominator
102  } // Loop-l
103  } // Numerator
104 
105 
106  } // Loop-k
107  } // fullSubPath
108  } // fullPath
109 }
110 
#define LogDebug(id)
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:197
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
int j
Definition: DBlmapReader.cc:9
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:273
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
TH1F * getTH1F(void) const
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:305
tuple cout
Definition: gather_cfg.py:145
virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
JetMETHLTOfflineClient(const edm::ParameterSet &)