CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgHLTMonElemWithCut.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_TRIGGER_EGHLTMONELEMWITHCUT
2 #define DQMOFFLINE_TRIGGER_EGHLTMONELEMWITHCUT
3 
4 
5 //class: MonElemWithCut, short for MonitorElementWithCut (note not MonEleWith Cut as Ele might be confused for electron
6 //
7 //author: Sam Harper (Aug 2008)
8 //
9 //WARNING: interface is NOT final, please dont use this class for now without clearing it with me
10 // as I will change it and possibly break all your code
11 //
12 //aim: to improve the fire and forget nature of MonElemManger
13 // allows some arbitary selection to be placed on objects used to fill the monitoring element
14 // examples include it having to be associated with a specific trigger filter
15 
16 //implimentation: uses a MonElemManager to handle the Monitor Element and EgHLTDQMCut descide whether to fill it or not
17 // it was debated adding this capacity directly to MonElemManager
18 // this may happen in a future itteration of the code when things have stabilised
19 
20 
21 
25 namespace egHLT {
26  template<class T> class MonElemWithCutBase {
27 
28  private:
30  MonElemWithCutBase& operator=(const MonElemWithCutBase& rhs){return *this;}
31  public:
33  virtual ~MonElemWithCutBase(){}
34 
35  virtual void fill(const T& obj,const OffEvt& evt ,float weight)=0;
36 
37  };
38 
39 
40  template<class T,typename varTypeX,typename varTypeY=varTypeX> class MonElemWithCut : public MonElemWithCutBase<T> {
41 
42  private:
44  const EgHLTDQMCut<T>* cut_; //we also own this
45 
46  private:
48  MonElemWithCut& operator=(const MonElemWithCut& rhs){return *this;}
49  public:
50 
51  MonElemWithCut(const std::string& name,const std::string& title,int nrBins,double xMin,double xMax,
52  varTypeX (T::*varFunc)()const,const EgHLTDQMCut<T>* cut=NULL):
53  monElemMgr_(new MonElemManager<T,varTypeX>(name,title,nrBins,xMin,xMax,varFunc)),
54  cut_(cut){}
55 
56  MonElemWithCut(const std::string& name,const std::string& title,int nrBinsX,double xMin,double xMax,int nrBinsY,double yMin,double yMax,
57  varTypeX (T::*varFuncX)()const,varTypeY (T::*varFuncY)()const,const EgHLTDQMCut<T>* cut=NULL):
58  monElemMgr_(new MonElemManager2D<T,varTypeX,varTypeY>(name,title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax,varFuncX,varFuncY)),
59  cut_(cut){}
61 
62  void fill(const T& obj,const OffEvt& evt,float weight);
63 
64  };
65 
66  template<class T,typename varTypeX,typename varTypeY>
68  {
69  if(cut_) delete cut_;
70  if(monElemMgr_) delete monElemMgr_;
71  }
72 
73  template<class T,typename varTypeX,typename varTypeY>
75  {
76  if(cut_==NULL || cut_->pass(obj,evt)) monElemMgr_->fill(obj,weight);
77  }
78 
79 }
80 
81 #endif
MonElemWithCutBase(const MonElemWithCutBase &rhs)
void fill(const T &obj, const OffEvt &evt, float weight)
MonElemWithCut & operator=(const MonElemWithCut &rhs)
const EgHLTDQMCut< T > * cut_
MonElemManagerBase< T > * monElemMgr_
MonElemWithCut(const std::string &name, const std::string &title, int nrBins, double xMin, double xMax, varTypeX(T::*varFunc)() const, const EgHLTDQMCut< T > *cut=NULL)
#define NULL
Definition: scimark2.h:8
virtual void fill(const T &obj, const OffEvt &evt, float weight)=0
MonElemWithCutBase & operator=(const MonElemWithCutBase &rhs)
MonElemWithCut(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)
MonElemWithCut(const MonElemWithCut &rhs)
int weight
Definition: histoStyle.py:50
long double T