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.
2 
7 
10 
12 {
14  if (!dbe_) {
15  edm::LogError("JetMETHLTOfflineClient") << "unable to get DQMStore service, upshot is no client histograms will be made";
16  }
17  if(iConfig.getUntrackedParameter<bool>("DQMStore", false)) {
18  if(dbe_) dbe_->setVerbose(0);
19  }
20 
21  debug_ = false;
22  verbose_ = false;
23 
24  processname_ = iConfig.getParameter<std::string>("processname");
25 
26  hltTag_ = iConfig.getParameter<std::string>("hltTag");
27  if (debug_) std::cout << hltTag_ << std::endl;
28 
29  dirName_=iConfig.getParameter<std::string>("DQMDirName");
31 
32 }
33 
34 
36 {
37 
38 }
39 
41 {
42 
43 
44 }
45 
47 {
48 
49 }
50 
52 {
53 
54 }
55 
56 
58 {
59  runClient_();
60 }
61 
62 //dummy analysis function
64 {
65 
66 }
67 
69 {
70  runClient_();
71 }
72 
74 {
75  if(!dbe_) return; //we dont have the DQMStore so we cant do anything
77 
78  LogDebug("JetMETHLTOfflineClient") << "runClient" << std::endl;
79  if (debug_) std::cout << "runClient" << std::endl;
80 
81  std::vector<MonitorElement*> hltMEs;
82 
83  // Look at all folders, go to the subfolder which includes the string "Eff"
84  std::vector<std::string> fullPathHLTFolders = dbe_->getSubdirs();
85  for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
86 
87  // Move on only if the folder name contains "Eff" Or "Trigger Summary"
88  if (debug_) std::cout << fullPathHLTFolders[i] << std::endl;
89  if ((fullPathHLTFolders[i].find("Eff")!=std::string::npos)) {
90  dbe_->setCurrentFolder(fullPathHLTFolders[i]);
91  }
92  else {
93  continue;
94  }
95 
96  // Look at all subfolders, go to the subfolder which includes the string "Eff"
97  std::vector<std::string> fullSubPathHLTFolders = dbe_->getSubdirs();
98  for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
99 
100  if (debug_) std::cout << fullSubPathHLTFolders[j] << std::endl;
101  dbe_->setCurrentFolder(fullSubPathHLTFolders[j]);
102 
103  //std::cout << "PhatDEBUG: " << fullSubPathHLTFolders[j] << std::endl;
104 
105  // Look at all MonitorElements in this folder
106  hltMEs = dbe_->getContents(fullSubPathHLTFolders[j]);
107  LogDebug("JetMETHLTOfflineClient")<< "Number of MEs for this HLT path = " << hltMEs.size() << std::endl;
108 
109  for(unsigned int k=0;k<hltMEs.size();k++) {
110  if (debug_) std::cout << hltMEs[k]->getName() << std::endl;
111 
112  //-----
113  if ((hltMEs[k]->getName().find("ME_Numerator")!=std::string::npos) && hltMEs[k]->getName().find("ME_Numerator")==0){
114 
115  std::string name = hltMEs[k]->getName();
116  name.erase(0,12); // Removed "ME_Numerator"
117  if (debug_) std::cout <<"==name=="<< name << std::endl;
118 // if( name.find("EtaPhi") !=std::string::npos ) continue; // do not consider EtaPhi 2D plots
119 
120 // MonitorElement* eff ;
121 
122  //std::cout << "PhatDEBUG: name = " << name << std::endl;
123 
124  for(unsigned int l=0;l<hltMEs.size();l++) {
125  if (hltMEs[l]->getName() == "ME_Denominator"+name){
126  // found denominator too
127  if(name.find("EtaPhi") !=std::string::npos) {
128  TH2F* tNumerator = hltMEs[k]->getTH2F();
129  TH2F* tDenominator = hltMEs[l]->getTH2F();
130 
131  std::string title = "Eff_"+hltMEs[k]->getTitle();
132 
133  TH2F *teff = (TH2F*) tNumerator->Clone(title.c_str());
134  teff->Divide(tNumerator,tDenominator,1,1);
135  dbe_->book2D("ME_Eff_"+name,teff);
136  delete teff;
137  //std::cout << "PhatDEBUG: EtaPhiEff" <<std::endl;
138  }
139  else{
140  TH1F* tNumerator = hltMEs[k]->getTH1F();
141  TH1F* tDenominator = hltMEs[l]->getTH1F();
142 
143  std::string title = "Eff_"+hltMEs[k]->getTitle();
144 
145  TH1F *teff = (TH1F*) tNumerator->Clone(title.c_str());
146  teff->Divide(tNumerator,tDenominator,1,1);
147  dbe_->book1D("ME_Eff_"+name,teff);
148  delete teff;
149  //std::cout << "PhatDEBUG: MMMM" <<std::endl;
150  }
151  } // Denominator
152  } // Loop-l
153  } // Numerator
154 
155 
156  } // Loop-k
157  } // fullSubPath
158  } // fullPath
159 }
160 
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1669
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:964
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
virtual void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:230
int j
Definition: DBlmapReader.cc:9
void setVerbose(unsigned level)
Definition: DQMStore.cc:641
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1747
int k[5][pyjets_maxn]
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:121
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1092
virtual void endRun(const edm::Run &run, const edm::EventSetup &c)
JetMETHLTOfflineClient(const edm::ParameterSet &)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:677
Definition: Run.h:41