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 ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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::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 200 of file DQMMessageLoggerClient.cc.

200  {
201 
202  //LogTrace(metname)<<"[DQMMessageLoggerClient] EndJob";
203 }
void DQMMessageLoggerClient::endRun ( const edm::Run r,
const edm::EventSetup es 
)
overrideprotected

Definition at line 195 of file DQMMessageLoggerClient.cc.

195  {
196  fillHistograms();
197 }
void DQMMessageLoggerClient::fillHistograms ( )
private

Definition at line 53 of file DQMMessageLoggerClient.cc.

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

53  {
54 
55 
56  // directoryName should be the same as for DQMMessageLogger
57  //theDbe->setCurrentFolder(directoryName);
58  /*
59  cout << theDbe->pwd() << endl;
60  vector<string> vec = theDbe->getSubdirs();
61  for(int i=0; i<vec.size(); i++){
62  cout << vec[i] << endl;
63  }
64  */
65  theDbe->goUp();
66 
67 
68 
69  vector<string> entries;
70  entries.push_back(directoryName + "/Warnings/modules_warnings");
71  entries.push_back(directoryName + "/Errors/modules_errors");
72  entries.push_back(directoryName + "/Warnings/categories_warnings");
73  entries.push_back(directoryName + "/Errors/categories_errors");
74 
75 
76  int mel = 0;
77 
78  for(auto ent = entries.begin();
79  ent != entries.end(); ++ent) {
80  mel++;
81  //RESET VECTORS
82  binContent.clear();
83  binLabel.clear();
84 
85 
86  // RETURN ME
87 
88 
89  MonitorElement *me = theDbe->get(*ent);
90  // GET TH1F
91  if(theDbe->get(*ent)){
92  if (TH1 *rootHisto = me->getTH1()) {
93  int nonzeros = 0;
94  int Nbins = me->getNbinsX();
95 
96 
97  // LOOP OVER TH1F
98  for(int bin = 1; bin <= Nbins ; ++bin) {
99  if( rootHisto->GetBinContent(bin)>0){
100  nonzeros++;
101  binContent.push_back(rootHisto->GetBinContent(bin));
102  binLabel.emplace_back(rootHisto->GetXaxis()->GetBinLabel(bin));
103  }
104 
105  }
106 
107  switch(mel){
108  case 1:
109  theDbe->setCurrentFolder(directoryName + "/Warnings");
110  modulesWarningsFound = theDbe->get(directoryName + "/Warnings/modulesWarningsFound");
112  if(nonzeros>0){
113  modulesWarningsFound = theDbe->book1D("modulesWarningsFound", "Warnings per module", binContent.size(), 0, binContent.size());
114  }else{
115  modulesWarningsFound = theDbe->book1D("modulesWarningsFound", "Warnings per module", 1, 0, 1);
116  modulesWarningsFound->setBinLabel(1,"Module name");
117  }
118  for (int i=0; i<nonzeros; ++i){
119  if(modulesWarningsFound!=nullptr){
120  //gPad->SetBottomMargin(2);
121  //cout << binContent[i] <<" "<<binLabel[i] << endl;
124  }
125  }
126  if(nonzeros>4) modulesWarningsFound->getTH1()->GetXaxis()->LabelsOption("v");
127  break;
128  case 2:
129  theDbe->setCurrentFolder(directoryName + "/Errors");
130  modulesErrorsFound = theDbe->get(directoryName + "/Errors/modulesErrorsFound");
131  if (modulesErrorsFound) theDbe->removeElement(modulesErrorsFound->getName());
132  if(nonzeros>0){
133  modulesErrorsFound = theDbe->book1D("modulesErrorsFound", "Errors per module",binContent.size(), 0, binContent.size() );
134  }else{
135  modulesErrorsFound = theDbe->book1D("modulesErrorsFound", "Errors per module",1, 0, 1 );
136  modulesErrorsFound->setBinLabel(1,"Module name");
137  }
138  for (int i=0; i<nonzeros; ++i){
139  if(modulesErrorsFound!=nullptr){
140  //gPad->SetBottomMargin(2);
143  }
144  }
145  if(nonzeros>4) modulesErrorsFound->getTH1()->GetXaxis()->LabelsOption("v");
146  break;
147  case 3:
148  theDbe->setCurrentFolder(directoryName + "/Warnings");
149  categoriesWarningsFound = theDbe->get(directoryName + "/Warnings/categoriesWarningsFound");
151  if(nonzeros>0){
152  categoriesWarningsFound = theDbe->book1D("categoriesWarningsFound", "Warnings per category", binContent.size(),0,binContent.size());
153  } else{
154  categoriesWarningsFound = theDbe->book1D("categoriesWarningsFound", "Warnings per category", 1,0,1);
155  categoriesWarningsFound->setBinLabel(1,"Category name");
156  }
157  for (int i=0; i<nonzeros; ++i){
158  if(categoriesWarningsFound!=nullptr){
159  //gPad->SetBottomMargin(2);
160  //cout << binContent[i] <<" " <<binLabel[i] << endl;
163  }
164  }
165  if(nonzeros>4) categoriesWarningsFound->getTH1()->GetXaxis()->LabelsOption("v");
166  break;
167  case 4:
168  theDbe->setCurrentFolder(directoryName + "/Errors");
169  categoriesErrorsFound = theDbe->get(directoryName + "/Errors/categoriesErrorsFound");
171  if(nonzeros>0){
172  categoriesErrorsFound = theDbe->book1D("categoriesErrorsFound", "Errors per category", binContent.size(),0,binContent.size());
173  }else{
174  categoriesErrorsFound = theDbe->book1D("categoriesErrorsFound", "Errors per category", 1,0,1);
175  categoriesErrorsFound->setBinLabel(1,"Category name");
176  }
177  for (int i=0; i<nonzeros; ++i){
178  if(categoriesErrorsFound!=nullptr){
179  //gPad->SetBottomMargin(2);
182  }
183  }
184  if(nonzeros>4) categoriesErrorsFound->getTH1()->GetXaxis()->LabelsOption("v");
185  break;
186  }
187 
188  }
189  }
190  }
191 }
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 48 of file DQMMessageLoggerClient.h.

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

Definition at line 47 of file DQMMessageLoggerClient.h.

MonitorElement* DQMMessageLoggerClient::categoriesErrorsFound
private

Definition at line 55 of file DQMMessageLoggerClient.h.

MonitorElement* DQMMessageLoggerClient::categoriesWarningsFound
private

Definition at line 56 of file DQMMessageLoggerClient.h.

std::string DQMMessageLoggerClient::directoryName
private

Definition at line 45 of file DQMMessageLoggerClient.h.

MonitorElement* DQMMessageLoggerClient::modulesErrorsFound
private

Definition at line 53 of file DQMMessageLoggerClient.h.

MonitorElement* DQMMessageLoggerClient::modulesWarningsFound
private

Definition at line 54 of file DQMMessageLoggerClient.h.

int DQMMessageLoggerClient::nBinsErrors
private

Definition at line 50 of file DQMMessageLoggerClient.h.

int DQMMessageLoggerClient::nBinsWarnings
private

Definition at line 51 of file DQMMessageLoggerClient.h.

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

Definition at line 43 of file DQMMessageLoggerClient.h.