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