CMS 3D CMS Logo

EgHLTMonElemWithCut.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_TRIGGER_EGHLTMONELEMWITHCUT
2 #define DQMOFFLINE_TRIGGER_EGHLTMONELEMWITHCUT
3 
4 //class: MonElemWithCut, short for MonitorElementWithCut (note not MonEleWith Cut as Ele might be confused for electron
5 //
6 //author: Sam Harper (Aug 2008)
7 //
8 //WARNING: interface is NOT final, please dont use this class for now without clearing it with me
9 // as I will change it and possibly break all your code
10 //
11 //aim: to improve the fire and forget nature of MonElemManger
12 // allows some arbitary selection to be placed on objects used to fill the monitoring element
13 // examples include it having to be associated with a specific trigger filter
14 
15 //implimentation: uses a MonElemManager to handle the Monitor Element and EgHLTDQMCut descide whether to fill it or not
16 // it was debated adding this capacity directly to MonElemManager
17 // this may happen in a future itteration of the code when things have stabilised
18 
22 namespace egHLT {
23  template <class T>
25  private:
26  MonElemWithCutBase(const MonElemWithCutBase& rhs) = default;
27  MonElemWithCutBase& operator=(const MonElemWithCutBase& rhs) { return *this; }
28 
29  public:
30  MonElemWithCutBase() = default;
31  virtual ~MonElemWithCutBase() = default;
32 
33  virtual void fill(const T& obj, const OffEvt& evt, float weight) = 0;
34  };
35 
36  template <class T, typename varTypeX, typename varTypeY = varTypeX>
37  class MonElemWithCut : public MonElemWithCutBase<T> {
38  private:
40  const EgHLTDQMCut<T>* cut_; //we also own this
41 
42  private:
44  MonElemWithCut& operator=(const MonElemWithCut& rhs) { return *this; }
45 
46  public:
48  const std::string& name,
49  const std::string& title,
50  int nrBins,
51  double xMin,
52  double xMax,
53  varTypeX (T::*varFunc)() const,
54  const EgHLTDQMCut<T>* cut = NULL)
55  : monElemMgr_(new MonElemManager<T, varTypeX>(iBooker, name, title, nrBins, xMin, xMax, varFunc)), cut_(cut) {}
56 
58  const std::string& name,
59  const std::string& title,
60  int nrBinsX,
61  double xMin,
62  double xMax,
63  int nrBinsY,
64  double yMin,
65  double yMax,
66  varTypeX (T::*varFuncX)() const,
67  varTypeY (T::*varFuncY)() const,
68  const EgHLTDQMCut<T>* cut = NULL)
69  : monElemMgr_(new MonElemManager2D<T, varTypeX, varTypeY>(
70  iBooker, name, title, nrBinsX, xMin, xMax, nrBinsY, yMin, yMax, varFuncX, varFuncY)),
71  cut_(cut) {}
72  ~MonElemWithCut() override;
73 
74  void fill(const T& obj, const OffEvt& evt, float weight) override;
75  };
76 
77  template <class T, typename varTypeX, typename varTypeY>
79  if (cut_)
80  delete cut_;
81  if (monElemMgr_)
82  delete monElemMgr_;
83  }
84 
85  template <class T, typename varTypeX, typename varTypeY>
87  if (cut_ == nullptr || cut_->pass(obj, evt))
88  monElemMgr_->fill(obj, weight);
89  }
90 
91 } // namespace egHLT
92 
93 #endif
egHLT::MonElemWithCut::MonElemWithCut
MonElemWithCut(const MonElemWithCut &rhs)
Definition: EgHLTMonElemWithCut.h:43
egHLT::MonElemWithCut::fill
void fill(const T &obj, const OffEvt &evt, float weight) override
Definition: EgHLTMonElemWithCut.h:86
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
egHLT::MonElemWithCutBase::operator=
MonElemWithCutBase & operator=(const MonElemWithCutBase &rhs)
Definition: EgHLTMonElemWithCut.h:27
egHLT::MonElemWithCut::MonElemWithCut
MonElemWithCut(DQMStore::IBooker &iBooker, const std::string &name, const std::string &title, int nrBinsX, double xMin, double xMax, int nrBinsY, double yMin, double yMax, varTypeX(T::*varFuncX)() const, varTypeY(T::*varFuncY)() const, const EgHLTDQMCut< T > *cut=NULL)
Definition: EgHLTMonElemWithCut.h:57
egHLT::OffEvt
Definition: EgHLTOffEvt.h:29
photonAnalyzer_cfi.yMin
yMin
Definition: photonAnalyzer_cfi.py:86
egHLT::MonElemWithCut::cut_
const EgHLTDQMCut< T > * cut_
Definition: EgHLTMonElemWithCut.h:40
photonAnalyzer_cfi.xMin
xMin
Definition: photonAnalyzer_cfi.py:82
egHLT::MonElemManager
Definition: EgHLTMonElemManager.h:101
egHLT::EgHLTDQMCut
Definition: EgHLTDQMCut.h:26
egHLT::MonElemManagerBase
Definition: EgHLTMonElemManager.h:33
multiplicitycorr_cfi.yMax
yMax
Definition: multiplicitycorr_cfi.py:6
egHLT::MonElemWithCut
Definition: EgHLTMonElemWithCut.h:37
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
egHLT::MonElemWithCutBase::MonElemWithCutBase
MonElemWithCutBase()=default
egHLT::MonElemWithCutBase
Definition: EgHLTMonElemWithCut.h:24
egHLT::MonElemManager2D
Definition: EgHLTMonElemManager.h:134
egHLT::MonElemWithCut::MonElemWithCut
MonElemWithCut(DQMStore::IBooker &iBooker, const std::string &name, const std::string &title, int nrBins, double xMin, double xMax, varTypeX(T::*varFunc)() const, const EgHLTDQMCut< T > *cut=NULL)
Definition: EgHLTMonElemWithCut.h:47
NULL
#define NULL
Definition: scimark2.h:8
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
egHLT::EgHLTDQMCut::pass
virtual bool pass(const T &obj, const OffEvt &evt) const =0
egHLT::MonElemWithCutBase::~MonElemWithCutBase
virtual ~MonElemWithCutBase()=default
T
long double T
Definition: Basic3DVectorLD.h:48
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
multiplicitycorr_cfi.xMax
xMax
Definition: multiplicitycorr_cfi.py:5
EgHLTDQMCut.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
EgHLTOffEvt.h
egHLT
Definition: EgHLTBinData.h:10
egHLT::MonElemWithCut::operator=
MonElemWithCut & operator=(const MonElemWithCut &rhs)
Definition: EgHLTMonElemWithCut.h:44
egHLT::MonElemWithCut::monElemMgr_
MonElemManagerBase< T > * monElemMgr_
Definition: EgHLTMonElemWithCut.h:39
egHLT::MonElemManagerBase::fill
virtual void fill(const T &obj, float weight)=0
EgHLTMonElemManager.h
egHLT::MonElemWithCut::~MonElemWithCut
~MonElemWithCut() override
Definition: EgHLTMonElemWithCut.h:78
weight
Definition: weight.py:1
egHLT::MonElemWithCutBase::fill
virtual void fill(const T &obj, const OffEvt &evt, float weight)=0