CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Protected Member Functions | Private Member Functions | Private Attributes
ElectronDqmAnalyzerBase Class Reference

#include <ElectronDqmAnalyzerBase.h>

Inheritance diagram for ElectronDqmAnalyzerBase:
edm::EDAnalyzer edm::EDConsumerBase ElectronAnalyzer ElectronGeneralAnalyzer ElectronMcFakePostValidator ElectronMcFakeValidator ElectronMcSignalPostValidator ElectronMcSignalValidator ElectronOfflineClient ElectronTagProbeAnalyzer ElectronWebGetter

Protected Member Functions

virtual void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob ()
 
virtual void book ()
 
MonitorElementbookH1 (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")
 
MonitorElementbookH1andDivide (const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="", const std::string &setEfficiencyFlag="")
 
MonitorElementbookH1andDivide (const std::string &name, const std::string &num, const std::string &denom, const std::string &titleX, const std::string &titleY, const std::string &title="", const std::string &setEfficiencyFlag="")
 
MonitorElementbookH1withSumw2 (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")
 
MonitorElementbookH2 (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")
 
MonitorElementbookH2andDivide (const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
 
MonitorElementbookH2andDivide (const std::string &name, const std::string &num, const std::string &denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
 
MonitorElementbookH2withSumw2 (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")
 
MonitorElementbookP1 (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")
 
MonitorElementcloneH1 (const std::string &name, MonitorElement *original, const std::string &title="")
 
MonitorElementcloneH1 (const std::string &name, const std::string &original, const std::string &title="")
 
 ElectronDqmAnalyzerBase (const edm::ParameterSet &conf)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
virtual void finalize ()
 
bool finalStepDone ()
 
MonitorElementget (const std::string &name)
 
MonitorElementprofileX (MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
 
MonitorElementprofileX (const std::string &me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
 
MonitorElementprofileY (MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
 
MonitorElementprofileY (const std::string &me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
 
void remove (const std::string &name)
 
void remove_other_dirs ()
 
void setBookIndex (short)
 
void setBookPrefix (const std::string &)
 
int verbosity ()
 
virtual ~ElectronDqmAnalyzerBase ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

const std::string * find (const std::string &name)
 
std::string newName (const std::string &name)
 

Private Attributes

short bookIndex_
 
std::string bookPrefix_
 
bool finalDone_
 
std::string finalStep_
 
std::vector< std::string > histoNames_
 
bool histoNamesReady
 
std::string inputFile_
 
std::string inputInternalPath_
 
std::string outputFile_
 
std::string outputInternalPath_
 
DQMStorestore_
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 14 of file ElectronDqmAnalyzerBase.h.

Constructor & Destructor Documentation

ElectronDqmAnalyzerBase::ElectronDqmAnalyzerBase ( const edm::ParameterSet conf)
explicitprotected

Definition at line 19 of file ElectronDqmAnalyzerBase.cc.

References finalStep_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), inputFile_, inputInternalPath_, outputFile_, outputInternalPath_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

20  : bookPrefix_("ele"), bookIndex_(0), histoNamesReady(false), finalDone_(false)
21  {
22  verbosity_ = conf.getUntrackedParameter<int>("Verbosity") ;
23  finalStep_ = conf.getParameter<std::string>("FinalStep") ;
24  inputFile_ = conf.getParameter<std::string>("InputFile") ;
25  outputFile_ = conf.getParameter<std::string>("OutputFile") ;
26  inputInternalPath_ = conf.getParameter<std::string>("InputFolderName") ;
27  outputInternalPath_ = conf.getParameter<std::string>("OutputFolderName") ;
28  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ElectronDqmAnalyzerBase::~ElectronDqmAnalyzerBase ( )
protectedvirtual

Definition at line 30 of file ElectronDqmAnalyzerBase.cc.

31  {}

Member Function Documentation

virtual void ElectronDqmAnalyzerBase::analyze ( const edm::Event e,
const edm::EventSetup c 
)
inlineprotectedvirtual
void ElectronDqmAnalyzerBase::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 99 of file ElectronDqmAnalyzerBase.cc.

References book(), inputFile_, DQMStore::open(), cppFunctionSkipper::operator, outputInternalPath_, DQMStore::setCurrentFolder(), DQMStore::setVerbose(), store_, and verbosity_.

100  {
102  if (!store_)
103  { edm::LogError("ElectronDqmAnalyzerBase::prepareStore")<<"No DQMStore found !" ; }
105  if (inputFile_!="")
106  { store_->open(inputFile_) ; }
108  book() ;
109  }
void setVerbose(unsigned level)
Definition: DQMStore.cc:641
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2910
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:677
virtual void ElectronDqmAnalyzerBase::book ( )
inlineprotectedvirtual
MonitorElement * ElectronDqmAnalyzerBase::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" 
)
protected

Definition at line 230 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getTH1F().

Referenced by ElectronMcSignalValidator::book(), ElectronGeneralAnalyzer::book(), ElectronAnalyzer::book(), ElectronTagProbeAnalyzer::book(), and ElectronMcFakeValidator::book().

234  {
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) ; }
239  return me ;
240  }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:964
TH1F * getTH1F(void) const
std::string newName(const std::string &name)
MonitorElement * ElectronDqmAnalyzerBase::bookH1andDivide ( const std::string &  name,
MonitorElement num,
MonitorElement denom,
const std::string &  titleX,
const std::string &  titleY,
const std::string &  title = "",
const std::string &  setEfficiencyFlag = "" 
)
protected

Definition at line 300 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getTH1(), MonitorElement::getTH1F(), nullptr, MonitorElement::setEfficiencyFlag(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ElectronOfflineClient::finalize(), ElectronMcSignalPostValidator::finalize(), and ElectronMcFakePostValidator::finalize().

303  {
304  if ((!num)||(!denom)) return nullptr ;
305  std::string name2 = newName(name) ;
306  TH1F * h_temp = (TH1F *)num->getTH1F()->Clone(name2.c_str()) ;
307  h_temp->Reset() ;
308  h_temp->Divide(num->getTH1(),denom->getTH1(),1,1,"b") ;
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() ; }
313  MonitorElement * me = store_->book1D(name2,h_temp) ;
314  if (setEfficiencyFlag == "true") { me->setEfficiencyFlag(); }
315  delete h_temp ;
316  return me ;
317  }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:964
#define nullptr
TH1 * getTH1(void) const
TH1F * getTH1F(void) const
void setEfficiencyFlag(void)
std::string newName(const std::string &name)
MonitorElement * ElectronDqmAnalyzerBase::bookH1andDivide ( const std::string &  name,
const std::string &  num,
const std::string &  denom,
const std::string &  titleX,
const std::string &  titleY,
const std::string &  title = "",
const std::string &  setEfficiencyFlag = "" 
)
protected

Definition at line 202 of file ElectronDqmAnalyzerBase.cc.

205  { return bookH1andDivide(name,get(num),get(denom),titleX,titleY,title,setEfficiencyFlag) ; }
MonitorElement * bookH1andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="", const std::string &setEfficiencyFlag="")
MonitorElement * ElectronDqmAnalyzerBase::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" 
)
protected

Definition at line 243 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getTH1F().

Referenced by ElectronMcSignalValidator::book(), ElectronTagProbeAnalyzer::book(), ElectronAnalyzer::book(), ElectronMcFakeValidator::book(), ElectronMcSignalPostValidator::finalize(), and ElectronMcFakePostValidator::finalize().

247  {
248  MonitorElement * me = store_->book1D(newName(name),title,nchX,lowX,highX) ;
249  me->getTH1F()->Sumw2() ;
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) ; }
253  return me ;
254  }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:964
TH1F * getTH1F(void) const
std::string newName(const std::string &name)
MonitorElement * ElectronDqmAnalyzerBase::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" 
)
protected

Definition at line 257 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getTH2F().

Referenced by ElectronMcSignalValidator::book(), ElectronGeneralAnalyzer::book(), ElectronAnalyzer::book(), ElectronTagProbeAnalyzer::book(), and ElectronMcFakeValidator::book().

262  {
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) ; }
267  return me ;
268  }
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:1092
std::string newName(const std::string &name)
MonitorElement * ElectronDqmAnalyzerBase::bookH2andDivide ( const std::string &  name,
MonitorElement num,
MonitorElement denom,
const std::string &  titleX,
const std::string &  titleY,
const std::string &  title = "" 
)
protected

Definition at line 320 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getTH1(), MonitorElement::getTH2F(), nullptr, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ElectronMcSignalPostValidator::finalize().

323  {
324  if ((!num)||(!denom)) return nullptr ;
325  std::string name2 = newName(name) ;
326  TH2F * h_temp = (TH2F *)num->getTH2F()->Clone(name2.c_str()) ;
327  h_temp->Reset() ;
328  h_temp->Divide(num->getTH1(),denom->getTH1(),1,1,"b") ;
329  h_temp->GetXaxis()->SetTitle(titleX.c_str()) ;
330  h_temp->GetYaxis()->SetTitle(titleY.c_str()) ;
331  if (title!="") { h_temp->SetTitle(title.c_str()) ; }
332  if (verbosity_>0) { h_temp->Print() ; }
333  MonitorElement * me = store_->book2D(name2,h_temp) ;
334  delete h_temp ;
335  return me ;
336  }
#define nullptr
TH1 * getTH1(void) const
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:1092
std::string newName(const std::string &name)
MonitorElement * ElectronDqmAnalyzerBase::bookH2andDivide ( const std::string &  name,
const std::string &  num,
const std::string &  denom,
const std::string &  titleX,
const std::string &  titleY,
const std::string &  title = "" 
)
protected

Definition at line 208 of file ElectronDqmAnalyzerBase.cc.

211  { return bookH2andDivide(name,get(num),get(denom),titleX,titleY,title) ; }
MonitorElement * bookH2andDivide(const std::string &name, MonitorElement *num, MonitorElement *denom, const std::string &titleX, const std::string &titleY, const std::string &title="")
MonitorElement * ElectronDqmAnalyzerBase::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" 
)
protected

Definition at line 271 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getTH2F().

Referenced by ElectronMcSignalValidator::book().

276  {
277  MonitorElement * me = store_->book2D(newName(name),title,nchX,lowX,highX,nchY,lowY,highY) ;
278  me->getTH2F()->Sumw2() ;
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) ; }
282  return me ;
283  }
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:1092
std::string newName(const std::string &name)
MonitorElement * ElectronDqmAnalyzerBase::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" 
)
protected

Definition at line 286 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getTProfile().

Referenced by ElectronMcSignalValidator::book(), ElectronGeneralAnalyzer::book(), ElectronAnalyzer::book(), and ElectronMcFakeValidator::book().

291  {
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) ; }
296  return me ;
297  }
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1278
TProfile * getTProfile(void) const
std::string newName(const std::string &name)
MonitorElement * ElectronDqmAnalyzerBase::cloneH1 ( const std::string &  name,
MonitorElement original,
const std::string &  title = "" 
)
protected

Definition at line 339 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getTH1F(), nullptr, and AlCaHLTBitMon_QueryRunRegistry::string.

341  {
342  if (!original) return nullptr ;
343  std::string name2 = newName(name) ;
344  TH1F * h_temp = (TH1F *)original->getTH1F()->Clone(name2.c_str()) ;
345  h_temp->Reset() ;
346  if (title!="") { h_temp->SetTitle(title.c_str()) ; }
347  MonitorElement * me = store_->book1D(name2,h_temp) ;
348  delete h_temp ;
349  return me ;
350  }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:964
#define nullptr
TH1F * getTH1F(void) const
std::string newName(const std::string &name)
MonitorElement * ElectronDqmAnalyzerBase::cloneH1 ( const std::string &  name,
const std::string &  original,
const std::string &  title = "" 
)
protected

Definition at line 214 of file ElectronDqmAnalyzerBase.cc.

216  { return cloneH1(clone,get(original),title) ; }
list original
Definition: definitions.py:57
MonitorElement * cloneH1(const std::string &name, MonitorElement *original, const std::string &title="")
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
void ElectronDqmAnalyzerBase::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 134 of file ElectronDqmAnalyzerBase.cc.

References finalDone_, finalize(), finalStep_, outputFile_, outputInternalPath_, DQMStore::save(), DQMStore::setCurrentFolder(), store_, and funct::true.

135  {
136  if (finalStep_=="AtJobEnd")
137  {
138  if (finalDone_)
139  { edm::LogWarning("ElectronDqmAnalyzerBase::endJob")<<"finalize() already called" ; }
141  finalize() ;
142  finalDone_ = true ;
143  }
144  if (outputFile_!="")
145  { store_->save(outputFile_) ; }
146  }
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)
Definition: DQMStore.cc:2555
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:677
void ElectronDqmAnalyzerBase::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file ElectronDqmAnalyzerBase.cc.

References finalDone_, finalize(), finalStep_, outputInternalPath_, DQMStore::setCurrentFolder(), store_, and funct::true.

123  {
124  if (finalStep_=="AtLumiEnd")
125  {
126  if (finalDone_)
127  { edm::LogWarning("ElectronDqmAnalyzerBase::endLuminosityBlock")<<"finalize() already called" ; }
129  finalize() ;
130  finalDone_ = true ;
131  }
132  }
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:677
void ElectronDqmAnalyzerBase::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 111 of file ElectronDqmAnalyzerBase.cc.

References finalDone_, finalize(), finalStep_, outputInternalPath_, DQMStore::setCurrentFolder(), store_, and funct::true.

112  {
113  if (finalStep_=="AtRunEnd")
114  {
115  if (finalDone_)
116  { edm::LogWarning("ElectronDqmAnalyzerBase::endRun")<<"finalize() already called" ; }
118  finalize() ;
119  finalDone_ = true ;
120  }
121  }
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:677
virtual void ElectronDqmAnalyzerBase::finalize ( void  )
inlineprotectedvirtual
bool ElectronDqmAnalyzerBase::finalStepDone ( )
inlineprotected

Definition at line 34 of file ElectronDqmAnalyzerBase.h.

References finalDone_.

const std::string * ElectronDqmAnalyzerBase::find ( const std::string &  name)
private

Definition at line 51 of file ElectronDqmAnalyzerBase.cc.

References DQMStore::getMEs(), histoNames_, histoNamesReady, outputInternalPath_, cmsHarvester::sep, store_, and funct::true.

Referenced by get(), and remove().

52  {
53  typedef std::vector<std::string> HistoNames ;
54  typedef HistoNames::iterator HistoNamesItr ;
55  if (!histoNamesReady)
57  HistoNamesItr histoName ;
58  std::vector<HistoNamesItr> res ;
59  for ( histoName = histoNames_.begin() ; histoName != histoNames_.end() ; ++histoName )
60  {
61  std::size_t nsize = name.size(), lsize = histoName->size() ;
62 // if ( (histoName->find(bookPrefix_)==0) &&
63 // (lsize>=nsize) &&
64 // (histoName->find(name)==(lsize-nsize)) )
65 // { res.push_back(histoName) ; }
66  if ( (lsize>=nsize) &&
67  (histoName->find(name)==(lsize-nsize)) )
68  { res.push_back(histoName) ; }
69  }
70  if (res.size()==0)
71  {
72  std::ostringstream oss ;
73  oss<<"Histogram "<<name<<" not found in "<<outputInternalPath_ ;
74  char sep = ':' ;
75  for ( histoName = histoNames_.begin() ; histoName != histoNames_.end() ; ++histoName )
76  { oss<<sep<<' '<<*histoName ; sep = ',' ; }
77  oss<<'.' ;
78  edm::LogWarning("ElectronDqmAnalyzerBase::find")<<oss.str() ;
79  return 0 ;
80  }
81  else if (res.size()>1)
82  {
83  std::ostringstream oss ;
84  oss<<"Ambiguous histograms for "<<name<<" in "<<outputInternalPath_ ;
85  char sep = ':' ;
86  std::vector<HistoNamesItr>::iterator resItr ;
87  for ( resItr = res.begin() ; resItr != res.end() ; ++resItr )
88  { oss<<sep<<' '<<(**resItr) ; sep = ',' ; }
89  oss<<'.' ;
90  edm::LogWarning("ElectronDqmAnalyzerBase::find")<<oss.str() ;
91  return 0 ;
92  }
93  else
94  {
95  return &*res[0] ;
96  }
97  }
std::vector< std::string > histoNames_
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
Definition: DQMStore.cc:1692
MonitorElement * ElectronDqmAnalyzerBase::get ( const std::string &  name)
protected

Definition at line 148 of file ElectronDqmAnalyzerBase.cc.

References find(), newFWLiteAna::fullName, DQMStore::get(), inputInternalPath_, nullptr, store_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), rrapi.RRApi::columns(), rrapi.RRApi::count(), rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

149  {
150  const std::string * fullName = find(name) ;
151  if (fullName)
152  { return store_->get(inputInternalPath_+"/"+*fullName) ; }
153  else
154  { return nullptr ; }
155  }
#define nullptr
const std::string * find(const std::string &name)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1718
string fullName
std::string ElectronDqmAnalyzerBase::newName ( const std::string &  name)
private

Definition at line 39 of file ElectronDqmAnalyzerBase.cc.

References bookIndex_, bookPrefix_, and mergeVDriftHistosByStation::name.

40  {
41  if (bookPrefix_.empty())
42  { return name ; }
43  std::ostringstream oss ;
44  oss<<bookPrefix_ ;
45  if (bookIndex_>=0)
46  { oss<<bookIndex_++ ; }
47  oss<<"_"<<name ;
48  return oss.str() ;
49  }
MonitorElement * ElectronDqmAnalyzerBase::profileX ( MonitorElement me2d,
const std::string &  title = "",
const std::string &  titleX = "",
const std::string &  titleY = "",
Double_t  minimum = -1111,
Double_t  maximum = -1111 
)
protected

Definition at line 353 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getName(), MonitorElement::getTH2F(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ElectronMcFakePostValidator::finalize(), and ElectronMcSignalPostValidator::finalize().

356  {
357  if(!me2d) { return nullptr;}
358  std::string name2 = me2d->getName()+"_pfx" ;
359  TProfile * p1_temp = me2d->getTH2F()->ProfileX() ;
360  if (title!="") { p1_temp->SetTitle(title.c_str()) ; }
361  if (titleX!="") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
362  if (titleY!="") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
363  if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
364  if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
365  MonitorElement * me = store_->bookProfile(name2,p1_temp) ;
366  delete p1_temp ;
367  return me ;
368  }
const std::string & getName(void) const
get name of ME
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1278
TH2F * getTH2F(void) const
MonitorElement * ElectronDqmAnalyzerBase::profileX ( const std::string &  me2d,
const std::string &  title = "",
const std::string &  titleX = "",
const std::string &  titleY = "",
Double_t  minimum = -1111,
Double_t  maximum = -1111 
)
protected

Definition at line 219 of file ElectronDqmAnalyzerBase.cc.

221  { return profileX(get(me2d),title,titleX,titleY,minimum,maximum) ; }
MonitorElement * profileX(MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
MonitorElement * ElectronDqmAnalyzerBase::profileY ( MonitorElement me2d,
const std::string &  title = "",
const std::string &  titleX = "",
const std::string &  titleY = "",
Double_t  minimum = -1111,
Double_t  maximum = -1111 
)
protected

Definition at line 371 of file ElectronDqmAnalyzerBase.cc.

References MonitorElement::getName(), MonitorElement::getTH2F(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ElectronMcSignalPostValidator::finalize().

374  {
375  if(!me2d) { return nullptr;}
376  std::string name2 = me2d->getName()+"_pfy" ;
377  TProfile * p1_temp = me2d->getTH2F()->ProfileY() ;
378  if (title!="") { p1_temp->SetTitle(title.c_str()) ; }
379  if (titleX!="") { p1_temp->GetXaxis()->SetTitle(titleX.c_str()) ; }
380  if (titleY!="") { p1_temp->GetYaxis()->SetTitle(titleY.c_str()) ; }
381  if (minimum!=-1111) { p1_temp->SetMinimum(minimum) ; }
382  if (maximum!=-1111) { p1_temp->SetMaximum(maximum) ; }
383  MonitorElement * me = store_->bookProfile(name2,p1_temp) ;
384  delete p1_temp ;
385  return me ;
386  }
const std::string & getName(void) const
get name of ME
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1278
TH2F * getTH2F(void) const
MonitorElement * ElectronDqmAnalyzerBase::profileY ( const std::string &  me2d,
const std::string &  title = "",
const std::string &  titleX = "",
const std::string &  titleY = "",
Double_t  minimum = -1111,
Double_t  maximum = -1111 
)
protected

Definition at line 224 of file ElectronDqmAnalyzerBase.cc.

227  { return profileY(get(me2d),title,titleX,titleY,minimum,maximum) ; }
MonitorElement * profileY(MonitorElement *me2d, const std::string &title="", const std::string &titleX="", const std::string &titleY="", Double_t minimum=-1111, Double_t maximum=-1111)
void ElectronDqmAnalyzerBase::remove ( const std::string &  name)
protected

Definition at line 157 of file ElectronDqmAnalyzerBase.cc.

References find(), newFWLiteAna::fullName, inputInternalPath_, DQMStore::removeElement(), DQMStore::setCurrentFolder(), store_, and AlCaHLTBitMon_QueryRunRegistry::string.

158  {
159  const std::string * fullName = find(name) ;
160  if (fullName)
161  {
163  store_->removeElement(*fullName) ;
164  }
165  }
const std::string * find(const std::string &name)
void removeElement(const std::string &name)
Definition: DQMStore.cc:3159
string fullName
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:677
void ElectronDqmAnalyzerBase::remove_other_dirs ( )
protected

Definition at line 167 of file ElectronDqmAnalyzerBase.cc.

References DQMStore::cd(), DQMStore::getSubdirs(), DQMStore::pwd(), DQMStore::rmdir(), store_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ElectronWebGetter::finalize().

168  {
169  std::string currentPath = store_->pwd() ;
170  store_->cd() ;
171 
172  std::string currentFolder ;
173  std::vector<std::string> subDirs ;
174  std::vector<std::string>::iterator subDir ;
175  std::string delimiter = "/" ;
176 
177  std::string::size_type lastPos = currentPath.find_first_not_of(delimiter,0) ;
178  std::string::size_type pos = currentPath.find_first_of(delimiter,lastPos) ;
179  while (std::string::npos != pos || std::string::npos != lastPos)
180  {
181  if (currentFolder.empty())
182  { currentFolder = currentPath.substr(lastPos, pos - lastPos) ; }
183  else
184  {
185  currentFolder += "/" ;
186  currentFolder += currentPath.substr(lastPos, pos - lastPos) ;
187  }
188  lastPos = currentPath.find_first_not_of(delimiter, pos);
189  pos = currentPath.find_first_of(delimiter, lastPos);
190 
191  subDirs = store_->getSubdirs() ;
192  for ( subDir = subDirs.begin() ; subDir != subDirs.end() ; subDir++ )
193  {
194  if (currentFolder!=(*subDir))
195  { store_->rmdir(*subDir) ; }
196  }
197  store_->cd(currentFolder) ;
198  }
199  }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1669
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:3117
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:654
uint16_t size_type
const std::string & pwd(void) const
Definition: DQMStore.cc:649
void ElectronDqmAnalyzerBase::setBookIndex ( short  index)
protected
void ElectronDqmAnalyzerBase::setBookPrefix ( const std::string &  prefix)
protected
int ElectronDqmAnalyzerBase::verbosity ( )
inlineprotected

Definition at line 35 of file ElectronDqmAnalyzerBase.h.

References verbosity_.

Member Data Documentation

short ElectronDqmAnalyzerBase::bookIndex_
private

Definition at line 128 of file ElectronDqmAnalyzerBase.h.

Referenced by newName(), and setBookIndex().

std::string ElectronDqmAnalyzerBase::bookPrefix_
private

Definition at line 127 of file ElectronDqmAnalyzerBase.h.

Referenced by newName(), and setBookPrefix().

bool ElectronDqmAnalyzerBase::finalDone_
private

Definition at line 137 of file ElectronDqmAnalyzerBase.h.

Referenced by endJob(), endLuminosityBlock(), endRun(), and finalStepDone().

std::string ElectronDqmAnalyzerBase::finalStep_
private
std::vector<std::string> ElectronDqmAnalyzerBase::histoNames_
private

Definition at line 130 of file ElectronDqmAnalyzerBase.h.

Referenced by find().

bool ElectronDqmAnalyzerBase::histoNamesReady
private

Definition at line 129 of file ElectronDqmAnalyzerBase.h.

Referenced by find().

std::string ElectronDqmAnalyzerBase::inputFile_
private

Definition at line 132 of file ElectronDqmAnalyzerBase.h.

Referenced by beginJob(), and ElectronDqmAnalyzerBase().

std::string ElectronDqmAnalyzerBase::inputInternalPath_
private

Definition at line 134 of file ElectronDqmAnalyzerBase.h.

Referenced by ElectronDqmAnalyzerBase(), get(), and remove().

std::string ElectronDqmAnalyzerBase::outputFile_
private

Definition at line 133 of file ElectronDqmAnalyzerBase.h.

Referenced by ElectronDqmAnalyzerBase(), and endJob().

std::string ElectronDqmAnalyzerBase::outputInternalPath_
private
DQMStore* ElectronDqmAnalyzerBase::store_
private
int ElectronDqmAnalyzerBase::verbosity_
private

Definition at line 126 of file ElectronDqmAnalyzerBase.h.

Referenced by beginJob(), ElectronDqmAnalyzerBase(), and verbosity().