test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgHLTMonElemContainer.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_TRIGGER_EGHLTMONELEMCONTAINER
2 #define DQMOFFLINE_TRIGGER_EGHLTMONELEMCONTAINER
3 
4 //class: MonElemContainer, short for Monitor Element Container
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 // holds a collection on monitor elements for which there is a global cut
13 // for example: they all have to pass a paricular trigger
14 
15 //implimentation: a cut to pass and then a list of monitor elements to fill
16 // two seperate vectors of MonitorElements and MonElemsWithCuts
17 
22 
23 #include <string>
24 #include <vector>
25 namespace egHLT {
26  template<class T> class MonElemContainer : public MonElemWithCutBase<T> {
27 
28  private:
31 
32  //so I want the ability to have both normal monitor elements and monitor elements with indivdual cuts
33  //so untill the two classes are merged, I just have two vectors
34  std::vector<MonElemWithCutBase<T>*> cutMonElems_; //we own these
35  std::vector<MonElemManagerBase<T>*> monElems_; //we own these
36  EgHLTDQMCut<T>* cut_; //we also own this
37 
38 
39 
40  private:
42  MonElemContainer& operator=(const MonElemContainer& rhs){return *this;}
43  public:
44 
45  MonElemContainer(std::string baseName="",std::string baseTitle="",
47  baseName_(baseName),
48  baseTitle_(baseTitle),
49  cut_(cut){}
50 
52 
53  //yes this is little more than a struct with some unnecessary function wrapers
54  std::vector<MonElemWithCutBase<T>*>& cutMonElems(){return cutMonElems_;}
55  const std::vector<MonElemWithCutBase<T>*>& cutMonElems()const{return cutMonElems_;}
56  std::vector<MonElemManagerBase<T>*>& monElems(){return monElems_;}
57  const std::vector<MonElemManagerBase<T>*>& monElems()const{return monElems_;}
58 
59 
60  const std::string& name()const{return baseName_;}
61  const std::string& title()const{return baseTitle_;}
62 
63  void fill(const T& obj,const OffEvt& evt,float weight);
64 
65  };
66 
68  {
69  for(size_t i=0;i<monElems_.size();i++) delete monElems_[i];
70  for(size_t i=0;i<cutMonElems_.size();i++) delete cutMonElems_[i];
71  if(cut_!=NULL) delete cut_;
72  }
73 
74 
75  template<class T> void MonElemContainer<T>::fill(const T& obj,const OffEvt& evt,float weight)
76  {
77  if(cut_==NULL || cut_->pass(obj,evt)){
78  for(size_t i=0;i<monElems_.size();i++) monElems_[i]->fill(obj,weight);
79  for(size_t i=0;i<cutMonElems_.size();i++) cutMonElems_[i]->fill(obj,evt,weight);
80  }
81  }
82 }
83 #endif
int i
Definition: DBlmapReader.cc:9
string fill
Definition: lumiContext.py:319
MonElemContainer(const MonElemContainer &rhs)
const std::string & name() const
void fill(const T &obj, const OffEvt &evt, float weight)
#define NULL
Definition: scimark2.h:8
MonElemContainer(std::string baseName="", std::string baseTitle="", EgHLTDQMCut< T > *cut=NULL)
std::vector< MonElemManagerBase< T > * > monElems_
const std::string & title() const
const std::vector< MonElemWithCutBase< T > * > & cutMonElems() const
std::vector< MonElemManagerBase< T > * > & monElems()
int weight
Definition: histoStyle.py:50
std::vector< MonElemWithCutBase< T > * > cutMonElems_
long double T
const std::vector< MonElemManagerBase< T > * > & monElems() const
std::vector< MonElemWithCutBase< T > * > & cutMonElems()
MonElemContainer & operator=(const MonElemContainer &rhs)