CMS 3D CMS Logo

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 <utility>
25 #include <vector>
26 namespace egHLT {
27  template <class T>
29  private:
32 
33  //so I want the ability to have both normal monitor elements and monitor elements with indivdual cuts
34  //so untill the two classes are merged, I just have two vectors
35  std::vector<MonElemWithCutBase<T>*> cutMonElems_; //we own these
36  std::vector<MonElemManagerBase<T>*> monElems_; //we own these
37  EgHLTDQMCut<T>* cut_; //we also own this
38 
39  private:
41  MonElemContainer& operator=(const MonElemContainer& rhs) { return *this; }
42 
43  public:
44  MonElemContainer(std::string baseName = "", std::string baseTitle = "", EgHLTDQMCut<T>* cut = nullptr)
45  : baseName_(std::move(baseName)), baseTitle_(std::move(baseTitle)), cut_(cut) {}
46 
47  ~MonElemContainer() override;
48 
49  //yes this is little more than a struct with some unnecessary function wrapers
50  std::vector<MonElemWithCutBase<T>*>& cutMonElems() { return cutMonElems_; }
51  const std::vector<MonElemWithCutBase<T>*>& cutMonElems() const { return cutMonElems_; }
52  std::vector<MonElemManagerBase<T>*>& monElems() { return monElems_; }
53  const std::vector<MonElemManagerBase<T>*>& monElems() const { return monElems_; }
54 
55  const std::string& name() const { return baseName_; }
56  const std::string& title() const { return baseTitle_; }
57 
58  void fill(const T& obj, const OffEvt& evt, float weight) override;
59  };
60 
61  template <class T>
63  for (size_t i = 0; i < monElems_.size(); i++)
64  delete monElems_[i];
65  for (size_t i = 0; i < cutMonElems_.size(); i++)
66  delete cutMonElems_[i];
67  if (cut_ != nullptr)
68  delete cut_;
69  }
70 
71  template <class T>
72  void MonElemContainer<T>::fill(const T& obj, const OffEvt& evt, float weight) {
73  if (cut_ == nullptr || cut_->pass(obj, evt)) {
74  for (size_t i = 0; i < monElems_.size(); i++)
75  monElems_[i]->fill(obj, weight);
76  for (size_t i = 0; i < cutMonElems_.size(); i++)
77  cutMonElems_[i]->fill(obj, evt, weight);
78  }
79  }
80 } // namespace egHLT
81 #endif
EgHLTMonElemWithCut.h
mps_fire.i
i
Definition: mps_fire.py:428
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
egHLT::OffEvt
Definition: EgHLTOffEvt.h:29
egHLT::MonElemContainer::cutMonElems
std::vector< MonElemWithCutBase< T > * > & cutMonElems()
Definition: EgHLTMonElemContainer.h:50
egHLT::MonElemContainer::baseName_
std::string baseName_
Definition: EgHLTMonElemContainer.h:30
egHLT::MonElemContainer::name
const std::string & name() const
Definition: EgHLTMonElemContainer.h:55
egHLT::MonElemContainer::monElems_
std::vector< MonElemManagerBase< T > * > monElems_
Definition: EgHLTMonElemContainer.h:36
egHLT::MonElemContainer::operator=
MonElemContainer & operator=(const MonElemContainer &rhs)
Definition: EgHLTMonElemContainer.h:41
egHLT::EgHLTDQMCut
Definition: EgHLTDQMCut.h:27
egHLT::MonElemContainer::MonElemContainer
MonElemContainer(const MonElemContainer &rhs)
Definition: EgHLTMonElemContainer.h:40
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
egHLT::MonElemContainer::cutMonElems
const std::vector< MonElemWithCutBase< T > * > & cutMonElems() const
Definition: EgHLTMonElemContainer.h:51
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
egHLT::MonElemContainer::monElems
std::vector< MonElemManagerBase< T > * > & monElems()
Definition: EgHLTMonElemContainer.h:52
egHLT::MonElemContainer::monElems
const std::vector< MonElemManagerBase< T > * > & monElems() const
Definition: EgHLTMonElemContainer.h:53
egHLT::MonElemWithCutBase
Definition: EgHLTMonElemWithCut.h:24
egHLT::MonElemContainer::title
const std::string & title() const
Definition: EgHLTMonElemContainer.h:56
egHLT::MonElemContainer
Definition: EgHLTMonElemContainer.h:28
egHLT::MonElemContainer::fill
void fill(const T &obj, const OffEvt &evt, float weight) override
Definition: EgHLTMonElemContainer.h:72
egHLT::MonElemContainer::MonElemContainer
MonElemContainer(std::string baseName="", std::string baseTitle="", EgHLTDQMCut< T > *cut=nullptr)
Definition: EgHLTMonElemContainer.h:44
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
egHLT::MonElemContainer::cut_
EgHLTDQMCut< T > * cut_
Definition: EgHLTMonElemContainer.h:37
T
long double T
Definition: Basic3DVectorLD.h:48
EgHLTDQMCut.h
egHLT::MonElemContainer::baseTitle_
std::string baseTitle_
Definition: EgHLTMonElemContainer.h:31
egHLT::MonElemContainer::~MonElemContainer
~MonElemContainer() override
Definition: EgHLTMonElemContainer.h:62
EgHLTOffEvt.h
egHLT
Definition: EgHLTBinData.h:10
egHLT::MonElemContainer::cutMonElems_
std::vector< MonElemWithCutBase< T > * > cutMonElems_
Definition: EgHLTMonElemContainer.h:35
EgHLTMonElemManager.h
weight
Definition: weight.py:1