File indexing completed on 2023-03-17 10:54:37
0001 #ifndef ESClient_H
0002 #define ESClient_H
0003
0004 #include <string>
0005
0006 #include "DQMServices/Core/interface/DQMStore.h"
0007
0008 namespace edm {
0009 class ParameterSet;
0010 }
0011
0012 class ESClient {
0013 public:
0014 typedef dqm::legacy::DQMStore DQMStore;
0015 typedef dqm::legacy::MonitorElement MonitorElement;
0016
0017 ESClient(edm::ParameterSet const &);
0018 virtual ~ESClient() {}
0019
0020 virtual void endLumiAnalyze(DQMStore::IGetter &) {}
0021 virtual void endJobAnalyze(DQMStore::IGetter &) {}
0022
0023 void setup(DQMStore::IBooker &);
0024
0025 template <typename T>
0026 T *getHisto(MonitorElement *, bool = false, T * = 0) const;
0027
0028 protected:
0029 virtual void book(DQMStore::IBooker &) {}
0030
0031 bool initialized_;
0032 std::string prefixME_;
0033 bool cloneME_;
0034 bool verbose_;
0035 bool debug_;
0036 };
0037
0038 template <typename T>
0039 T *ESClient::getHisto(MonitorElement *_me, bool _clone , T *_current ) const {
0040 if (!_me) {
0041 if (_clone)
0042 return _current;
0043 else
0044 return nullptr;
0045 }
0046
0047 TObject *obj(_me->getRootObject());
0048
0049 if (!obj)
0050 return nullptr;
0051
0052 if (_clone) {
0053 delete _current;
0054 _current = dynamic_cast<T *>(obj->Clone(("ME " + _me->getName()).c_str()));
0055 if (_current)
0056 _current->SetDirectory(nullptr);
0057 return _current;
0058 } else
0059 return dynamic_cast<T *>(obj);
0060 }
0061
0062 #endif