20 : bookPrefix_(
"ele"), bookIndex_(0), histoNamesReady(
false), finalDone_(
false)
43 std::ostringstream oss ;
53 typedef std::vector<std::string> HistoNames ;
54 typedef HistoNames::iterator HistoNamesItr ;
57 HistoNamesItr histoName ;
58 std::vector<HistoNamesItr> res ;
61 std::size_t nsize = name.size(), lsize = histoName->size() ;
66 if ( (lsize>=nsize) &&
67 (histoName->find(name)==(lsize-nsize)) )
68 { res.push_back(histoName) ; }
72 std::ostringstream oss ;
76 { oss<<sep<<
' '<<*histoName ; sep =
',' ; }
81 else if (res.size()>1)
83 std::ostringstream oss ;
86 std::vector<HistoNamesItr>::iterator resItr ;
87 for ( resItr = res.begin() ; resItr != res.end() ; ++resItr )
88 { oss<<sep<<
' '<<(**resItr) ; sep =
',' ; }
103 {
edm::LogError(
"ElectronDqmAnalyzerBase::prepareStore")<<
"No DQMStore found !" ; }
116 {
edm::LogWarning(
"ElectronDqmAnalyzerBase::endRun")<<
"finalize() already called" ; }
127 {
edm::LogWarning(
"ElectronDqmAnalyzerBase::endLuminosityBlock")<<
"finalize() already called" ; }
139 {
edm::LogWarning(
"ElectronDqmAnalyzerBase::endJob")<<
"finalize() already called" ; }
169 std::string currentPath =
store_->
pwd() ;
172 std::string currentFolder ;
173 std::vector<std::string> subDirs ;
174 std::vector<std::string>::iterator subDir ;
175 std::string delimiter =
"/" ;
179 while (std::string::npos != pos || std::string::npos != lastPos)
181 if (currentFolder.empty())
182 { currentFolder = currentPath.substr(lastPos, pos - lastPos) ; }
185 currentFolder +=
"/" ;
186 currentFolder += currentPath.substr(lastPos, pos - lastPos) ;
188 lastPos = currentPath.find_first_not_of(delimiter, pos);
189 pos = currentPath.find_first_of(delimiter, lastPos);
192 for ( subDir = subDirs.begin() ; subDir != subDirs.end() ; subDir++ )
194 if (currentFolder!=(*subDir))
202 (
const std::string &
name,
const std::string &
num,
const std::string & denom,
203 const std::string & titleX,
const std::string & titleY,
204 const std::string &
title )
205 {
return bookH1andDivide(name,
get(num),
get(denom),titleX,titleY,title) ; }
208 (
const std::string & name,
const std::string & num,
const std::string & denom,
209 const std::string & titleX,
const std::string & titleY,
210 const std::string & title )
211 {
return bookH2andDivide(name,
get(num),
get(denom),titleX,titleY,title) ; }
214 (
const std::string &
clone,
const std::string & original,
215 const std::string & title )
216 {
return cloneH1(clone,
get(original),title) ; }
219 (
const std::string & me2d,
const std::string & title,
const std::string & titleX,
const std::string & titleY,
220 Double_t minimum, Double_t maximum )
221 {
return profileX(
get(me2d),title,titleX,titleY,minimum,maximum) ; }
224 (
const std::string & me2d,
225 const std::string & title,
const std::string & titleX,
const std::string & titleY,
226 Double_t minimum, Double_t maximum )
227 {
return profileY(
get(me2d),title,titleX,titleY,minimum,maximum) ; }
230 (
const std::string & name,
const std::string & title,
231 int nchX,
double lowX,
double highX,
232 const std::string & titleX,
const std::string & titleY,
235 MonitorElement * me = store_->book1D(newName(name),title,nchX,lowX,highX) ;
236 if (titleX!=
"") { me->
getTH1F()->GetXaxis()->SetTitle(titleX.c_str()) ; }
237 if (titleY!=
"") { me->
getTH1F()->GetYaxis()->SetTitle(titleY.c_str()) ; }
238 if (TString(option)!=
"") { me->
getTH1F()->SetOption(option) ; }
243 (
const std::string & name,
const std::string & title,
244 int nchX,
double lowX,
double highX,
245 const std::string & titleX,
const std::string & titleY,
248 MonitorElement * me = store_->book1D(newName(name),title,nchX,lowX,highX) ;
250 if (titleX!=
"") { me->
getTH1F()->GetXaxis()->SetTitle(titleX.c_str()) ; }
251 if (titleY!=
"") { me->
getTH1F()->GetYaxis()->SetTitle(titleY.c_str()) ; }
252 if (TString(option)!=
"") { me->
getTH1F()->SetOption(option) ; }
257 (
const std::string & name,
const std::string & title,
258 int nchX,
double lowX,
double highX,
259 int nchY,
double lowY,
double highY,
260 const std::string & titleX,
const std::string & titleY,
263 MonitorElement * me = store_->book2D(newName(name),title,nchX,lowX,highX,nchY,lowY,highY) ;
264 if (titleX!=
"") { me->
getTH2F()->GetXaxis()->SetTitle(titleX.c_str()) ; }
265 if (titleY!=
"") { me->
getTH2F()->GetYaxis()->SetTitle(titleY.c_str()) ; }
266 if (TString(option)!=
"") { me->
getTH2F()->SetOption(option) ; }
271 (
const std::string & name,
const std::string & title,
272 int nchX,
double lowX,
double highX,
273 int nchY,
double lowY,
double highY,
274 const std::string & titleX,
const std::string & titleY,
277 MonitorElement * me = store_->book2D(newName(name),title,nchX,lowX,highX,nchY,lowY,highY) ;
279 if (titleX!=
"") { me->
getTH2F()->GetXaxis()->SetTitle(titleX.c_str()) ; }
280 if (titleY!=
"") { me->
getTH2F()->GetYaxis()->SetTitle(titleY.c_str()) ; }
281 if (TString(option)!=
"") { me->
getTH2F()->SetOption(option) ; }
286 (
const std::string & name,
const std::string & title,
287 int nchX,
double lowX,
double highX,
288 double lowY,
double highY,
289 const std::string & titleX,
const std::string & titleY,
292 MonitorElement * me = store_->bookProfile(newName(name),title,nchX,lowX,highX,lowY,highY,
" ") ;
293 if (titleX!=
"") { me->
getTProfile()->GetXaxis()->SetTitle(titleX.c_str()) ; }
294 if (titleY!=
"") { me->
getTProfile()->GetYaxis()->SetTitle(titleY.c_str()) ; }
295 if (TString(option)!=
"") { me->
getTProfile()->SetOption(option) ; }
301 const std::string & titleX,
const std::string & titleY,
302 const std::string & title )
304 std::string name2 = newName(name) ;
305 TH1F * h_temp = (TH1F *)num->
getTH1F()->Clone(name2.c_str()) ;
308 h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
309 h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
310 if (title!=
"") { h_temp->SetTitle(title.c_str()) ; }
311 if (verbosity_>0) { h_temp->Print() ; }
319 const std::string & titleX,
const std::string & titleY,
320 const std::string & title )
322 std::string name2 = newName(name) ;
323 TH2F * h_temp = (TH2F *)num->
getTH2F()->Clone(name2.c_str()) ;
326 h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
327 h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
328 if (title!=
"") { h_temp->SetTitle(title.c_str()) ; }
329 if (verbosity_>0) { h_temp->Print() ; }
337 const std::string & title )
339 std::string name2 = newName(name) ;
340 TH1F * h_temp = (TH1F *)original->
getTH1F()->Clone(name2.c_str()) ;
342 if (title!=
"") { h_temp->SetTitle(title.c_str()) ; }
350 const std::string & title,
const std::string & titleX,
const std::string & titleY,
351 Double_t minimum, Double_t maximum )
353 std::string name2 = me2d->
getName()+
"_pfx" ;
354 TProfile * p1_temp = me2d->
getTH2F()->ProfileX() ;
355 if (title!=
"") { p1_temp->SetTitle(title.c_str()) ; }
356 if (titleX!=
"") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
357 if (titleY!=
"") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
358 if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
359 if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
367 const std::string & title,
const std::string & titleX,
const std::string & titleY,
368 Double_t minimum, Double_t maximum )
370 std::string name2 = me2d->
getName()+
"_pfy" ;
371 TProfile * p1_temp = me2d->
getTH2F()->ProfileY() ;
372 if (title!=
"") { p1_temp->SetTitle(title.c_str()) ; }
373 if (titleX!=
"") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
374 if (titleY!=
"") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
375 if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
376 if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
MonitorElement * bookP1(const std::string &name, const std::string &title, int nchX, double lowX, double highX, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="E1 P")
MonitorElement * bookH1(const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
std::vector< std::string > getSubdirs(void) const
void remove(const std::string &name)
void rmdir(const std::string &fullpath)
virtual void endRun(edm::Run const &, edm::EventSetup const &)
void cd(void)
go to top directory (ie. root)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
MonitorElement * profileY(MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
MonitorElement * bookH1withSumw2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
const std::string * find(const std::string &name)
MonitorElement * cloneH1(const std::string &name, MonitorElement *original, const std::string &title="")
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
void removeElement(const std::string &name)
MonitorElement * profileX(MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
void setBookPrefix(const std::string &)
void setVerbose(unsigned level)
ElectronDqmAnalyzerBase(const edm::ParameterSet &conf)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
std::string outputInternalPath_
MonitorElement * bookH2andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
std::vector< std::string > histoNames_
TH1F * getTH1F(void) const
MonitorElement * bookH2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
TProfile * getTProfile(void) const
MonitorElement * bookH1andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
TH2F * getTH2F(void) const
MonitorElement * bookH2withSumw2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
std::string inputInternalPath_
virtual ~ElectronDqmAnalyzerBase()
MonitorElement * get(const std::string &name)
void setCurrentFolder(const std::string &fullpath)
std::string newName(const std::string &name)
const std::string & pwd(void) const