Go to the documentation of this file.00001 #ifndef DQMOFFLINE_TRIGGER_EGHLTMONELEMCONTAINER
00002 #define DQMOFFLINE_TRIGGER_EGHLTMONELEMCONTAINER
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "DQMOffline/Trigger/interface/EgHLTMonElemManager.h"
00019 #include "DQMOffline/Trigger/interface/EgHLTMonElemWithCut.h"
00020 #include "DQMOffline/Trigger/interface/EgHLTDQMCut.h"
00021 #include "DQMOffline/Trigger/interface/EgHLTOffEvt.h"
00022
00023 #include <string>
00024 #include <vector>
00025 namespace egHLT {
00026 template<class T> class MonElemContainer : public MonElemWithCutBase<T> {
00027
00028 private:
00029 std::string baseName_;
00030 std::string baseTitle_;
00031
00032
00033
00034 std::vector<MonElemWithCutBase<T>*> cutMonElems_;
00035 std::vector<MonElemManagerBase<T>*> monElems_;
00036 EgHLTDQMCut<T>* cut_;
00037
00038
00039
00040 private:
00041 MonElemContainer(const MonElemContainer& rhs){}
00042 MonElemContainer& operator=(const MonElemContainer& rhs){return *this;}
00043 public:
00044
00045 MonElemContainer(std::string baseName="",std::string baseTitle="",
00046 EgHLTDQMCut<T>* cut=NULL):
00047 baseName_(baseName),
00048 baseTitle_(baseTitle),
00049 cut_(cut){}
00050
00051 ~MonElemContainer();
00052
00053
00054 std::vector<MonElemWithCutBase<T>*>& cutMonElems(){return cutMonElems_;}
00055 const std::vector<MonElemWithCutBase<T>*>& cutMonElems()const{return cutMonElems_;}
00056 std::vector<MonElemManagerBase<T>*>& monElems(){return monElems_;}
00057 const std::vector<MonElemManagerBase<T>*>& monElems()const{return monElems_;}
00058
00059
00060 const std::string& name()const{return baseName_;}
00061 const std::string& title()const{return baseTitle_;}
00062
00063 void fill(const T& obj,const OffEvt& evt,float weight);
00064
00065 };
00066
00067 template<class T> MonElemContainer<T>::~MonElemContainer()
00068 {
00069 for(size_t i=0;i<monElems_.size();i++) delete monElems_[i];
00070 for(size_t i=0;i<cutMonElems_.size();i++) delete cutMonElems_[i];
00071 if(cut_!=NULL) delete cut_;
00072 }
00073
00074
00075 template<class T> void MonElemContainer<T>::fill(const T& obj,const OffEvt& evt,float weight)
00076 {
00077 if(cut_==NULL || cut_->pass(obj,evt)){
00078 for(size_t i=0;i<monElems_.size();i++) monElems_[i]->fill(obj,weight);
00079 for(size_t i=0;i<cutMonElems_.size();i++) cutMonElems_[i]->fill(obj,evt,weight);
00080 }
00081 }
00082 }
00083 #endif