QwAnalysis
QwHaloMonitor.cc
Go to the documentation of this file.
1 /**********************************************************\
2 * File: QwHaloMonitor.cc *
3 * *
4 * Author:B. Waidyawansa *
5 * Time-stamp:24-june-2010 *
6 \**********************************************************/
7 
8 #include "QwHaloMonitor.h"
9 
10 // System headers
11 #include <stdexcept>
12 
13 // Qweak headers
14 #include "QwDBInterface.h"
15 
16 void QwHaloMonitor::InitializeChannel(TString subsystem, TString name){
17  fHalo_Counter.InitializeChannel(name);
18  SetElementName(name);
19 }
20 
22  fHalo_Counter.InitializeChannel(name);
23  SetElementName(name);
24 }
25 
27 {
28  fHalo_Counter.ClearEventData();
29 }
30 
32 {
33  // no processing required for the halos as they are just counters(?).
34  fHalo_Counter.ProcessEvent();
35 }
36 
37 Int_t QwHaloMonitor::ProcessEvBuffer(UInt_t* buffer, UInt_t num_words_left,UInt_t index)
38 {
39  return fHalo_Counter.ProcessEvBuffer(buffer,num_words_left);
40 }
41 
42 
44 {
45  Bool_t eventokay=kTRUE;
46  return eventokay;
47 }
48 
49 
51 {
52  return fHalo_Counter.ApplySingleEventCuts();
53 }
54 
55 
57 {
58  fHalo_Counter.PrintErrorCounters();
59 }
60 
61 
63 {
64  if (GetElementName()!=""){
65  this->fHalo_Counter=value.fHalo_Counter;
66  }
67  return *this;
68 }
69 
71 {
72  if (GetElementName()!=""){
73  this->fHalo_Counter+=value.fHalo_Counter;
74  }
75  return *this;
76 }
77 
79 {
80  if (GetElementName()!=""){
81  this->fHalo_Counter-=value.fHalo_Counter;
82  }
83  return *this;
84 }
85 
86 
88  *this = value1;
89  *this += value2;
90 }
91 
93  *this = value1;
94  *this -= value2;
95 }
96 
98 {
99  if (GetElementName()!=""){
100  this->fHalo_Counter.Ratio(numer.fHalo_Counter,denom.fHalo_Counter);
101  }
102  return;
103 }
104 
105 void QwHaloMonitor::Scale(Double_t factor)
106 {
107  fHalo_Counter.Scale(factor);
108 }
109 
111  fHalo_Counter.AccumulateRunningSum(value.fHalo_Counter);
112 }
113 
115  //fHalo_Counter.DeccumulateRunningSum(value.fHalo_Counter);
116 }
117 
119  fHalo_Counter.CalculateRunningAverage();
120 }
121 
122 
124 {
125  fHalo_Counter.PrintValue();
126 }
127 
129 {
130  std::cout << "QwVQWK_Channel Info " << std::endl;
131  fHalo_Counter.PrintInfo();
132 }
133 
134 void QwHaloMonitor::ConstructHistograms(TDirectory *folder, TString &prefix)
135 {
136  if (GetElementName()==""){
137  // This channel is not used, so skip filling the histograms.
138  }
139  else{
140  fHalo_Counter.ConstructHistograms(folder, prefix);
141  }
142 }
143 
145 {
146  if (GetElementName()==""){
147  // This channel is not used, so skip filling the histograms.
148  }
149  else{
150  fHalo_Counter.FillHistograms();
151  }
152 }
153 
154 void QwHaloMonitor::ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector<Double_t> &values)
155 {
156  if (GetElementName()==""){
157  // This channel is not used, so skip filling the histograms.
158  }
159  else{
160  fHalo_Counter.ConstructBranchAndVector(tree, prefix,values);
161  // this functions doesn't do anything yet
162  }
163 }
164 
165 void QwHaloMonitor::ConstructBranch(TTree *tree, TString &prefix)
166 {
167  if (GetElementName()==""){
168  // This channel is not used, so skip filling the histograms.
169  }
170  else{
171  fHalo_Counter.ConstructBranch(tree, prefix);
172  // this functions doesn't do anything yet
173  }
174 }
175 
176 
177 
178 void QwHaloMonitor::ConstructBranch(TTree *tree, TString &prefix, QwParameterFile& modulelist)
179 {
180  TString devicename;
181 
182  devicename=GetElementName();
183  devicename.ToLower();
184  if (GetElementName()==""){
185  // This channel is not used, so skip filling the histograms.
186  } else {
187 
188  //QwMessage <<" QwHaloMonitor "<<devicename<<QwLog::endl;
189  if (modulelist.HasValue(devicename)){
190  fHalo_Counter.ConstructBranch(tree, prefix);
191  QwMessage <<" Tree leaf added to "<<devicename<<QwLog::endl;
192  }
193  // this functions doesn't do anything yet
194  }
195 }
196 
197 
198 
199 
200 void QwHaloMonitor::FillTreeVector(std::vector<Double_t> &values) const
201 {
202  if (GetElementName()==""){
203  // This channel is not used, so skip filling the histograms.
204  }
205  else{
206  fHalo_Counter.FillTreeVector(values);
207  // this functions doesn't do anything yet
208  }
209 }
210 
211 
212 std::vector<QwDBInterface> QwHaloMonitor::GetDBEntry()
213 {
214  std::vector <QwDBInterface> row_list;
215  row_list.clear();
216  fHalo_Counter.AddEntriesToList(row_list);
217  return row_list;
218 }
219 
220 
221 std::vector<QwErrDBInterface> QwHaloMonitor::GetErrDBEntry()
222 {
223  std::vector <QwErrDBInterface> row_list;
224  row_list.clear();
225  fHalo_Counter.AddErrEntriesToList(row_list);
226  return row_list;
227 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void FillTreeVector(std::vector< Double_t > &values) const
void InitializeChannel(TString name)
void AccumulateRunningSum(const QwHaloMonitor &value)
QwHaloMonitor & operator+=(const QwHaloMonitor &value)
void CalculateRunningAverage()
std::vector< QwDBInterface > GetDBEntry()
void ConstructBranch(TTree *tree, TString &prefix)
Bool_t ApplyHWChecks()
void DeaccumulateRunningSum(QwHaloMonitor &value)
void ConstructHistograms(TDirectory *folder, TString &prefix)
Construct the histograms for this data element.
Bool_t HasValue(TString &vname)
void PrintValue() const
Print single line of value and error of this data element.
void Ratio(QwHaloMonitor &numer, QwHaloMonitor &denom)
void ClearEventData()
Clear the event data in this element.
void ProcessEvent()
void SetElementName(const TString &name)
Set the name of this element.
QwHaloMonitor & operator=(const QwHaloMonitor &value)
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
void PrintErrorCounters()
Bool_t ApplySingleEventCuts()
virtual const TString & GetElementName() const
Get the name of this element.
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
void PrintInfo() const
Print multiple lines of information about this data element.
void Scale(Double_t Offset)
void Difference(QwHaloMonitor &value1, QwHaloMonitor &value2)
void Sum(QwHaloMonitor &value1, QwHaloMonitor &value2)
Int_t ProcessEvBuffer(UInt_t *buffer, UInt_t num_words_left, UInt_t index=0)
Process the CODA event buffer for this element.
QwHaloMonitor & operator-=(const QwHaloMonitor &value)
QwSIS3801D24_Channel fHalo_Counter
void FillHistograms()
Fill the histograms for this data element.
std::vector< QwErrDBInterface > GetErrDBEntry()