CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DQMMessageLoggerClient Class Reference

#include <DQMMessageLoggerClient.h>

Inheritance diagram for DQMMessageLoggerClient:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DQMMessageLoggerClient (const edm::ParameterSet &)
 
 ~DQMMessageLoggerClient () override
 
- 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
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 
void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
- 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

void fillHistograms ()
 

Private Attributes

std::vector< Double_t > binContent
 
std::vector< std::string > binLabel
 
MonitorElementcategoriesErrorsFound
 
MonitorElementcategoriesWarningsFound
 
std::string directoryName
 
MonitorElementmodulesErrorsFound
 
MonitorElementmodulesWarningsFound
 
int nBinsErrors
 
int nBinsWarnings
 
edm::ParameterSet parameters
 
DQMStoretheDbe
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 14 of file DQMMessageLoggerClient.h.

Constructor & Destructor Documentation

DQMMessageLoggerClient::DQMMessageLoggerClient ( const edm::ParameterSet ps)

Definition at line 15 of file DQMMessageLoggerClient.cc.

References edm::ParameterSet::getParameter(), and ~DQMMessageLoggerClient().

15  {
16 
17  parameters = ps;
18  theDbe = nullptr;
19  modulesErrorsFound = nullptr;
20  modulesWarningsFound = nullptr;
21  categoriesWarningsFound = nullptr;
22  categoriesErrorsFound = nullptr;
23  directoryName = parameters.getParameter<string>("Directory");
24 
25 }
MonitorElement * modulesErrorsFound
MonitorElement * categoriesErrorsFound
MonitorElement * categoriesWarningsFound
MonitorElement * modulesWarningsFound
DQMMessageLoggerClient::~DQMMessageLoggerClient ( )
overridedefault

Referenced by DQMMessageLoggerClient().

Member Function Documentation

void DQMMessageLoggerClient::analyze ( const edm::Event e,
const edm::EventSetup context 
)
overrideprotected

Definition at line 48 of file DQMMessageLoggerClient.cc.

48  {
49 }
void DQMMessageLoggerClient::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 32 of file DQMMessageLoggerClient.cc.

References Utilities::operator.

32  {
33 
34  //LogTrace(metname)<<"[DQMMessageLoggerClient] Parameters initialization";
36 
37  if(theDbe!=nullptr){
38  theDbe->setCurrentFolder(directoryName);
39  }
40 
41 }
void DQMMessageLoggerClient::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup es 
)
overrideprotected

Definition at line 51 of file DQMMessageLoggerClient.cc.

51  {
52 }
void DQMMessageLoggerClient::beginRun ( const edm::Run r,
const edm::EventSetup es 
)
overrideprotected

Definition at line 43 of file DQMMessageLoggerClient.cc.

43  {
44 }
void DQMMessageLoggerClient::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 204 of file DQMMessageLoggerClient.cc.

204  {
205 
206  //LogTrace(metname)<<"[DQMMessageLoggerClient] EndJob";
207 }
void DQMMessageLoggerClient::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup context 
)
overrideprotected

Definition at line 54 of file DQMMessageLoggerClient.cc.

54  {
55 }
void DQMMessageLoggerClient::endRun ( const edm::Run r,
const edm::EventSetup es 
)
overrideprotected

Definition at line 199 of file DQMMessageLoggerClient.cc.

199  {
200  fillHistograms();
201 }
void DQMMessageLoggerClient::fillHistograms ( )
private

Definition at line 57 of file DQMMessageLoggerClient.cc.

References stringResolutionProvider_cfi::bin, MonitorElement::getNbinsX(), MonitorElement::getTH1(), mps_fire::i, and writelibraryfile_cfg::Nbins.

57  {
58 
59 
60  // directoryName should be the same as for DQMMessageLogger
61  //theDbe->setCurrentFolder(directoryName);
62  /*
63  cout << theDbe->pwd() << endl;
64  vector<string> vec = theDbe->getSubdirs();
65  for(int i=0; i<vec.size(); i++){
66  cout << vec[i] << endl;
67  }
68  */
69  theDbe->goUp();
70 
71 
72 
73  vector<string> entries;
74  entries.push_back(directoryName + "/Warnings/modules_warnings");
75  entries.push_back(directoryName + "/Errors/modules_errors");
76  entries.push_back(directoryName + "/Warnings/categories_warnings");
77  entries.push_back(directoryName + "/Errors/categories_errors");
78 
79 
80  int mel = 0;
81 
82  for(auto ent = entries.begin();
83  ent != entries.end(); ++ent) {
84  mel++;
85  //RESET VECTORS
86  binContent.clear();
87  binLabel.clear();
88 
89 
90  // RETURN ME
91 
92 
93  MonitorElement *me = theDbe->get(*ent);
94  // GET TH1F
95  if(theDbe->get(*ent)){
96  if (TH1 *rootHisto = me->getTH1()) {
97  int nonzeros = 0;
98  int Nbins = me->getNbinsX();
99 
100 
101  // LOOP OVER TH1F
102  for(int bin = 1; bin <= Nbins ; ++bin) {
103  if( rootHisto->GetBinContent(bin)>0){
104  nonzeros++;
105  binContent.push_back(rootHisto->GetBinContent(bin));
106  binLabel.emplace_back(rootHisto->GetXaxis()->GetBinLabel(bin));
107  }
108 
109  }
110 
111  switch(mel){
112  case 1:
113  theDbe->setCurrentFolder(directoryName + "/Warnings");
114  modulesWarningsFound = theDbe->get(directoryName + "/Warnings/modulesWarningsFound");
116  if(nonzeros>0){
117  modulesWarningsFound = theDbe->book1D("modulesWarningsFound", "Warnings per module", binContent.size(), 0, binContent.size());
118  }else{
119  modulesWarningsFound = theDbe->book1D("modulesWarningsFound", "Warnings per module", 1, 0, 1);
120  modulesWarningsFound->setBinLabel(1,"Module name");
121  }
122  for (int i=0; i<nonzeros; ++i){
123  if(modulesWarningsFound!=nullptr){
124  //gPad->SetBottomMargin(2);
125  //cout << binContent[i] <<" "<<binLabel[i] << endl;
128  }
129  }
130  if(nonzeros>4) modulesWarningsFound->getTH1()->GetXaxis()->LabelsOption("v");
131  break;
132  case 2:
133  theDbe->setCurrentFolder(directoryName + "/Errors");
134  modulesErrorsFound = theDbe->get(directoryName + "/Errors/modulesErrorsFound");
135  if (modulesErrorsFound) theDbe->removeElement(modulesErrorsFound->getName());
136  if(nonzeros>0){
137  modulesErrorsFound = theDbe->book1D("modulesErrorsFound", "Errors per module",binContent.size(), 0, binContent.size() );
138  }else{
139  modulesErrorsFound = theDbe->book1D("modulesErrorsFound", "Errors per module",1, 0, 1 );
140  modulesErrorsFound->setBinLabel(1,"Module name");
141  }
142  for (int i=0; i<nonzeros; ++i){
143  if(modulesErrorsFound!=nullptr){
144  //gPad->SetBottomMargin(2);
147  }
148  }
149  if(nonzeros>4) modulesErrorsFound->getTH1()->GetXaxis()->LabelsOption("v");
150  break;
151  case 3:
152  theDbe->setCurrentFolder(directoryName + "/Warnings");
153  categoriesWarningsFound = theDbe->get(directoryName + "/Warnings/categoriesWarningsFound");
155  if(nonzeros>0){
156  categoriesWarningsFound = theDbe->book1D("categoriesWarningsFound", "Warnings per category", binContent.size(),0,binContent.size());
157  } else{
158  categoriesWarningsFound = theDbe->book1D("categoriesWarningsFound", "Warnings per category", 1,0,1);
159  categoriesWarningsFound->setBinLabel(1,"Category name");
160  }
161  for (int i=0; i<nonzeros; ++i){
162  if(categoriesWarningsFound!=nullptr){
163  //gPad->SetBottomMargin(2);
164  //cout << binContent[i] <<" " <<binLabel[i] << endl;
167  }
168  }
169  if(nonzeros>4) categoriesWarningsFound->getTH1()->GetXaxis()->LabelsOption("v");
170  break;
171  case 4:
172  theDbe->setCurrentFolder(directoryName + "/Errors");
173  categoriesErrorsFound = theDbe->get(directoryName + "/Errors/categoriesErrorsFound");
175  if(nonzeros>0){
176  categoriesErrorsFound = theDbe->book1D("categoriesErrorsFound", "Errors per category", binContent.size(),0,binContent.size());
177  }else{
178  categoriesErrorsFound = theDbe->book1D("categoriesErrorsFound", "Errors per category", 1,0,1);
179  categoriesErrorsFound->setBinLabel(1,"Category name");
180  }
181  for (int i=0; i<nonzeros; ++i){
182  if(categoriesErrorsFound!=nullptr){
183  //gPad->SetBottomMargin(2);
186  }
187  }
188  if(nonzeros>4) categoriesErrorsFound->getTH1()->GetXaxis()->LabelsOption("v");
189  break;
190  }
191 
192  }
193  }
194  }
195 }
void setBinContent(int binx, double content)
set content of bin (1-D)
TH1 * getTH1() const
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * modulesErrorsFound
const std::string & getName() const
get name of ME
std::vector< std::string > binLabel
MonitorElement * categoriesErrorsFound
MonitorElement * categoriesWarningsFound
bin
set the eta bin as selection string.
MonitorElement * modulesWarningsFound
std::vector< Double_t > binContent
int getNbinsX() const
get # of bins in X-axis

Member Data Documentation

std::vector<Double_t> DQMMessageLoggerClient::binContent
private

Definition at line 50 of file DQMMessageLoggerClient.h.

std::vector<std::string> DQMMessageLoggerClient::binLabel
private

Definition at line 49 of file DQMMessageLoggerClient.h.

MonitorElement* DQMMessageLoggerClient::categoriesErrorsFound
private

Definition at line 57 of file DQMMessageLoggerClient.h.

MonitorElement* DQMMessageLoggerClient::categoriesWarningsFound
private

Definition at line 58 of file DQMMessageLoggerClient.h.

std::string DQMMessageLoggerClient::directoryName
private

Definition at line 47 of file DQMMessageLoggerClient.h.

MonitorElement* DQMMessageLoggerClient::modulesErrorsFound
private

Definition at line 55 of file DQMMessageLoggerClient.h.

MonitorElement* DQMMessageLoggerClient::modulesWarningsFound
private

Definition at line 56 of file DQMMessageLoggerClient.h.

int DQMMessageLoggerClient::nBinsErrors
private

Definition at line 52 of file DQMMessageLoggerClient.h.

int DQMMessageLoggerClient::nBinsWarnings
private

Definition at line 53 of file DQMMessageLoggerClient.h.

edm::ParameterSet DQMMessageLoggerClient::parameters
private
DQMStore* DQMMessageLoggerClient::theDbe
private

Definition at line 45 of file DQMMessageLoggerClient.h.