File indexing completed on 2023-10-25 09:44:34
0001 #ifndef DQMOFFLINE_TRIGGER_EGHLTMONELEMWITHCUT
0002 #define DQMOFFLINE_TRIGGER_EGHLTMONELEMWITHCUT
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "DQMOffline/Trigger/interface/EgHLTMonElemManager.h"
0020 #include "DQMOffline/Trigger/interface/EgHLTDQMCut.h"
0021 #include "DQMOffline/Trigger/interface/EgHLTOffEvt.h"
0022 namespace egHLT {
0023 template <class T>
0024 class MonElemWithCutBase {
0025 private:
0026 MonElemWithCutBase(const MonElemWithCutBase& rhs) = default;
0027 MonElemWithCutBase& operator=(const MonElemWithCutBase& rhs) { return *this; }
0028
0029 public:
0030 MonElemWithCutBase() = default;
0031 virtual ~MonElemWithCutBase() = default;
0032
0033 virtual void fill(const T& obj, const OffEvt& evt, float weight) = 0;
0034 };
0035
0036 template <class T, typename varTypeX, typename varTypeY = varTypeX>
0037 class MonElemWithCut : public MonElemWithCutBase<T> {
0038 private:
0039 MonElemManagerBase<T>* monElemMgr_;
0040 const EgHLTDQMCut<T>* cut_;
0041
0042 private:
0043 MonElemWithCut(const MonElemWithCut& rhs) {}
0044 MonElemWithCut& operator=(const MonElemWithCut& rhs) { return *this; }
0045
0046 public:
0047 MonElemWithCut(DQMStore::IBooker& iBooker,
0048 const std::string& name,
0049 const std::string& title,
0050 int nrBins,
0051 double xMin,
0052 double xMax,
0053 varTypeX (T::*varFunc)() const,
0054 const EgHLTDQMCut<T>* cut = NULL)
0055 : monElemMgr_(new MonElemManager<T, varTypeX>(iBooker, name, title, nrBins, xMin, xMax, varFunc)), cut_(cut) {}
0056
0057 MonElemWithCut(DQMStore::IBooker& iBooker,
0058 const std::string& name,
0059 const std::string& title,
0060 int nrBinsX,
0061 double xMin,
0062 double xMax,
0063 int nrBinsY,
0064 double yMin,
0065 double yMax,
0066 varTypeX (T::*varFuncX)() const,
0067 varTypeY (T::*varFuncY)() const,
0068 const EgHLTDQMCut<T>* cut = NULL)
0069 : monElemMgr_(new MonElemManager2D<T, varTypeX, varTypeY>(
0070 iBooker, name, title, nrBinsX, xMin, xMax, nrBinsY, yMin, yMax, varFuncX, varFuncY)),
0071 cut_(cut) {}
0072 ~MonElemWithCut() override;
0073
0074 void fill(const T& obj, const OffEvt& evt, float weight) override;
0075 };
0076
0077 template <class T, typename varTypeX, typename varTypeY>
0078 MonElemWithCut<T, varTypeX, varTypeY>::~MonElemWithCut() {
0079 if (cut_)
0080 delete cut_;
0081 if (monElemMgr_)
0082 delete monElemMgr_;
0083 }
0084
0085 template <class T, typename varTypeX, typename varTypeY>
0086 void MonElemWithCut<T, varTypeX, varTypeY>::fill(const T& obj, const OffEvt& evt, float weight) {
0087 if (cut_ == nullptr || cut_->pass(obj, evt))
0088 monElemMgr_->fill(obj, weight);
0089 }
0090
0091 }
0092
0093 #endif