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" ; }
173 std::vector<std::string> subDirs ;
174 std::vector<std::string>::iterator subDir ;
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))
205 {
return bookH1andDivide(name,
get(num),
get(denom),titleX,titleY,title) ; }
211 {
return bookH2andDivide(name,
get(num),
get(denom),titleX,titleY,title) ; }
216 {
return cloneH1(clone,
get(original),title) ; }
220 Double_t minimum, Double_t maximum )
221 {
return profileX(
get(me2d),title,titleX,titleY,minimum,maximum) ; }
226 Double_t minimum, Double_t maximum )
227 {
return profileY(
get(me2d),title,titleX,titleY,minimum,maximum) ; }
231 int nchX,
double lowX,
double highX,
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) ; }
244 int nchX,
double lowX,
double highX,
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) ; }
258 int nchX,
double lowX,
double highX,
259 int nchY,
double lowY,
double highY,
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) ; }
272 int nchX,
double lowX,
double highX,
273 int nchY,
double lowY,
double highY,
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) ; }
287 int nchX,
double lowX,
double highX,
288 double lowY,
double highY,
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) ; }
304 if ((!num)||(!denom))
return 0 ;
306 TH1F * h_temp = (TH1F *)num->
getTH1F()->Clone(name2.c_str()) ;
309 h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
310 h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
311 if (title!=
"") { h_temp->SetTitle(title.c_str()) ; }
312 if (verbosity_>0) { h_temp->Print() ; }
323 if ((!num)||(!denom))
return 0 ;
325 TH2F * h_temp = (TH2F *)num->
getTH2F()->Clone(name2.c_str()) ;
328 h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
329 h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
330 if (title!=
"") { h_temp->SetTitle(title.c_str()) ; }
331 if (verbosity_>0) { h_temp->Print() ; }
341 if (!original)
return 0 ;
343 TH1F * h_temp = (TH1F *)original->
getTH1F()->Clone(name2.c_str()) ;
345 if (title!=
"") { h_temp->SetTitle(title.c_str()) ; }
354 Double_t minimum, Double_t maximum )
357 TProfile * p1_temp = me2d->
getTH2F()->ProfileX() ;
358 if (title!=
"") { p1_temp->SetTitle(title.c_str()) ; }
359 if (titleX!=
"") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
360 if (titleY!=
"") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
361 if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
362 if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
371 Double_t minimum, Double_t maximum )
374 TProfile * p1_temp = me2d->
getTH2F()->ProfileY() ;
375 if (title!=
"") { p1_temp->SetTitle(title.c_str()) ; }
376 if (titleX!=
"") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
377 if (titleY!=
"") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
378 if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
379 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)
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
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
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
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
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)
volatile std::atomic< bool > shutdown_flag false
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