CMS 3D CMS Logo

ESClient.h
Go to the documentation of this file.
1 #ifndef ESClient_H
2 #define ESClient_H
3 
4 #include <string>
5 
7 
8 namespace edm {
9  class ParameterSet;
10 }
11 
12 class ESClient {
13 public:
16 
17  ESClient(edm::ParameterSet const &);
18  virtual ~ESClient() {}
19 
20  virtual void endLumiAnalyze(DQMStore::IGetter &) {}
21  virtual void endJobAnalyze(DQMStore::IGetter &) {}
22 
23  void setup(DQMStore::IBooker &);
24 
25  template <typename T>
26  T *getHisto(MonitorElement *, bool = false, T * = 0) const;
27 
28 protected:
29  virtual void book(DQMStore::IBooker &) {}
30 
33  bool cloneME_;
34  bool verbose_;
35  bool debug_;
36 };
37 
38 template <typename T>
39 T *ESClient::getHisto(MonitorElement *_me, bool _clone /* = false*/, T *_current /* = 0*/) const {
40  if (!_me) {
41  if (_clone)
42  return _current;
43  else
44  return nullptr;
45  }
46 
47  TObject *obj(_me->getRootObject());
48 
49  if (!obj)
50  return nullptr;
51 
52  if (_clone) {
53  delete _current;
54  _current = dynamic_cast<T *>(obj->Clone(("ME " + _me->getName()).c_str()));
55  if (_current)
56  _current->SetDirectory(nullptr);
57  return _current;
58  } else
59  return dynamic_cast<T *>(obj);
60 }
61 
62 #endif // ESClient_H
virtual void endJobAnalyze(DQMStore::IGetter &)
Definition: ESClient.h:21
bool initialized_
Definition: ESClient.h:31
bool cloneME_
Definition: ESClient.h:33
ESClient(edm::ParameterSet const &)
Definition: ESClient.cc:5
dqm::legacy::DQMStore DQMStore
Definition: ESClient.h:14
virtual void endLumiAnalyze(DQMStore::IGetter &)
Definition: ESClient.h:20
T * getHisto(MonitorElement *, bool=false, T *=0) const
Definition: ESClient.h:39
virtual void book(DQMStore::IBooker &)
Definition: ESClient.h:29
std::string prefixME_
Definition: ESClient.h:32
bool debug_
Definition: ESClient.h:35
void setup(DQMStore::IBooker &)
Definition: ESClient.cc:12
bool verbose_
Definition: ESClient.h:34
virtual ~ESClient()
Definition: ESClient.h:18
const std::string & getName() const
get name of ME
HLT enums.
TObject * getRootObject() const override
long double T
dqm::legacy::MonitorElement MonitorElement
Definition: ESClient.h:15