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  } else {
92  continue;
93  }
94 
95  // Look at all subfolders, go to the subfolder which includes the string "Eff"
96  std::vector<std::string> fullSubPathHLTFolders = dbe_->getSubdirs();
97  for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
98 
99  if (debug_) std::cout << fullSubPathHLTFolders[j] << std::endl;
100  dbe_->setCurrentFolder(fullSubPathHLTFolders[j]);
101 
102  // Look at all MonitorElements in this folder
103  hltMEs = dbe_->getContents(fullSubPathHLTFolders[j]);
104  LogDebug("JetMETHLTOfflineClient")<< "Number of MEs for this HLT path = " << hltMEs.size() << std::endl;
105 
106  for(unsigned int k=0;k<hltMEs.size();k++) {
107  if (debug_) std::cout << hltMEs[k]->getName() << std::endl;
108 
109  //-----
110  if ((hltMEs[k]->getName().find("ME_Numerator")!=std::string::npos) && hltMEs[k]->getName().find("ME_Numerator")==0){
111 
112  std::string name = hltMEs[k]->getName();
113  name.erase(0,12); // Removed "ME_Numerator"
114  if (debug_) std::cout <<"==name=="<< name << std::endl;
115 // if( name.find("EtaPhi") !=std::string::npos ) continue; // do not consider EtaPhi 2D plots
116 
117 // MonitorElement* eff ;
118 
119  for(unsigned int l=0;l<hltMEs.size();l++) {
120  if (hltMEs[l]->getName() == "ME_Denominator"+name){
121  // found denominator too
122  if(name.find("EtaPhi") !=std::string::npos)
123  {
124  MonitorElement* eff ;
125  TH2F* tNumerator = hltMEs[k]->getTH2F();
126  TH2F* tDenominator = hltMEs[l]->getTH2F();
127 
128  std::string title = "Eff_"+hltMEs[k]->getTitle();
129 
130  TH2F *teff = (TH2F*) tNumerator->Clone(title.c_str());
131  teff->Divide(tNumerator,tDenominator,1,1);
132  eff= dbe_->book2D("ME_Eff_"+name,teff);
133  delete teff;
134  }else{
135  MonitorElement* eff ;
136  TH1F* tNumerator = hltMEs[k]->getTH1F();
137  TH1F* tDenominator = hltMEs[l]->getTH1F();
138 
139  std::string title = "Eff_"+hltMEs[k]->getTitle();
140 
141  TH1F *teff = (TH1F*) tNumerator->Clone(title.c_str());
142  teff->Divide(tNumerator,tDenominator,1,1);
143  eff= dbe_->book1D("ME_Eff_"+name,teff);
144  delete teff;
145  }
146  } // Denominator
147  } // Loop-l
148  } // Numerator
149 
150 
151  } // Loop-k
152  } // fullSubPath
153  } // fullPath
154 }
155 
#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:1221
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
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:243
int j
Definition: DBlmapReader.cc:9
void setVerbose(unsigned level)
Definition: DQMStore.cc:201
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1299
int k[5][pyjets_maxn]
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:41
TH2F * getTH2F(void) const
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:647
virtual void endRun(const edm::Run &run, const edm::EventSetup &c)
JetMETHLTOfflineClient(const edm::ParameterSet &)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
Definition: Run.h:31