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