QwAnalysis
QwRegressionSubsystem.cc
Go to the documentation of this file.
1 /*
2  * QwRegressionSubsystem.cc
3  *
4  * Created on: Aug 11, 2011
5  * Author: meeker
6  */
7 
9 #include "VQwSubsystemParity.h"
10 #include "QwRegression.h"
11 #include "QwSubsystemArrayParity.h"
12 #include "QwParameterFile.h"
13 
15 
16 
18 {
19 }
20 
21 struct null_deleter {
22  void operator()(void const *) const { }
23 };
24 
26  boost::shared_ptr<VQwSubsystem> px(this, null_deleter());
27  return px;
28 }
29 
31 {
32  QwRegressionSubsystem* input= dynamic_cast<QwRegressionSubsystem*>(value);
33  if (input!=NULL) {
34  for(size_t i = 0; i < input->fDependentVar.size(); i++) {
35  this->fDependentVar.at(i).second->AssignValueFrom(input->fDependentVar.at(i).second);
36  }
37  }
38  return *this;
39 }
40 
42 {
43  QwRegressionSubsystem* input = dynamic_cast<QwRegressionSubsystem*>(value);
44  if (input!=NULL) {
45  for(size_t i = 0; i < input->fDependentVar.size(); i++) {
46  this->fDependentVar.at(i).second->AddValueFrom(input->fDependentVar.at(i).second);
47  }
48  }
49  return *this;
50 }
51 
53 {
54  QwRegressionSubsystem* input = dynamic_cast<QwRegressionSubsystem*>(value);
55  if (input!=NULL) {
56  for(size_t i = 0; i<input->fDependentVar.size(); i++) {
57  this->fDependentVar.at(i).second->SubtractValueFrom(input->fDependentVar.at(i).second);
58  }
59  }
60  return *this;
61 }
62 
64 {
65  QwRegressionSubsystem* input = dynamic_cast<QwRegressionSubsystem*>(value);
66  if (input!=NULL) {
67  for(size_t i = 0; i<input->fDependentVar.size(); i++) {
68  this->fDependentVar.at(i).second->MultiplyBy(input->fDependentVar.at(i).second);
69  }
70  }
71  return *this;
72 }
73 
75 {
76  QwRegressionSubsystem* input = dynamic_cast<QwRegressionSubsystem*>(value);
77  if (input!=NULL) {
78  for(size_t i = 0; i<input->fDependentVar.size(); i++) {
79  this->fDependentVar.at(i).second->DivideBy(input->fDependentVar.at(i).second);
80  }
81  }
82  return *this;
83 }
84 
85 
87 {
88  *this = value1;
89  *this += value2;
90 }
91 
92 
94 {
95  *this = value1;
96  *this -= value2;
97 }
98 
99 
101 {
102  *this = value1;
103  *this /= value2;
104 }
105 
106 
107 void QwRegressionSubsystem::Scale(Double_t value)
108 {
109  for(size_t i = 0; i < this->fDependentVar.size(); i++)
110  {
111  this->fDependentVar.at(i).second->Scale(value);
112  }
113 
114 };
115 
117 {
118  QwRegressionSubsystem* value = dynamic_cast<QwRegressionSubsystem*> (input);
119  if (value!=NULL){
121  }
122 }
123 
125 {
126  QwRegressionSubsystem* value = dynamic_cast<QwRegressionSubsystem*> (input);
127  if (value!=NULL) {
128  for (size_t i = 0; i < value-> fDependentVar.size(); i++) {
129  fDependentVar.at(i).second->DeaccumulateRunningSum(value->fDependentVar.at(i).second);
130  }
131  }
132 }
133 
135 {
137 }
138 
141 }
142 
143 
144 void QwRegressionSubsystem::ConstructHistograms(TDirectory *folder, TString &prefix)
145 {
146  for (size_t i = 0; i < fDependentVar.size(); i++){
147  fDependentVar.at(i).second->ConstructHistograms(folder,prefix);
148  }
149 };
150 
152 {
153  for (size_t i = 0; i < fDependentVar.size(); i++){
154  fDependentVar.at(i).second->FillHistograms();
155  }
156 };
157 
159 {
160  for (size_t i = 0; i < fDependentVar.size(); i++){
161  // fDependentVar.at(i).second->DeleteHistograms();
162  }
163 };
164 
165 void QwRegressionSubsystem::ConstructBranch(TTree *tree, TString & prefix)
166 {
167  for (size_t i = 0; i < fDependentVar.size(); i++){
168  fDependentVar.at(i).second->ConstructBranch(tree, prefix);
169  }
170 };
171 
172 void QwRegressionSubsystem::ConstructBranch(TTree *tree, TString & prefix, QwParameterFile& trim_file)
173 {
174  TString tmp;
175  QwParameterFile* nextmodule;
176  trim_file.RewindToFileStart();
177  tmp="Regression";
178  trim_file.RewindToFileStart();
179  if (trim_file.FileHasModuleHeader(tmp)){
180  nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
181  for (size_t i = 0; i < fDependentVar.size(); i++){
182  fDependentVar.at(i).second->ConstructBranch(tree, prefix, *nextmodule);
183  }
184  }
185 };
186 
187 
189 {
190  /// TODO: Write QwRegressionSubsystem::IncrementErrorCounters
191 }
192 
194  /// TODO: Write QwRegressionSubsystem::UpdateErrorFlag
195  //if (Compare(ev_error)){
196  //QwRegressionSubsystem* input = dynamic_cast<QwRegressionSubsystem*> (ev_error);
197  //}
198 };
199 
200 
201 /// DERIVED FUNCTIONS ///
202 
203 
204 /* All of the functions below are using generic
205  * returns for testing purposes.
206  */
207 
208 
209 
211 {
212  Int_t sample = 0;
213  return sample;
214 }
215 
216 
218 {
219  Int_t sample = 0;
220  return sample;
221 }
222 
223 
225 {
226  Int_t sample = 0;
227  return sample;
228 
229 }
230 
231 Int_t QwRegressionSubsystem::ProcessConfigurationBuffer(UInt_t, UInt_t, UInt_t*, UInt_t)
232 {
233  Int_t sample = 0;
234  return sample;
235 }
236 
237 
238 Int_t QwRegressionSubsystem::ProcessEvBuffer(UInt_t, UInt_t, UInt_t*, UInt_t)
239 {
240  Int_t sample = 0;
241  return sample;
242 }
243 
244 
246 {
247  return true;
248 }
249 
251 {
252 }
253 
255 {
256  return 0;
257 
258 }
259 
260 
261 
262 
void PrintValue() const
Print values for all channels.
VQwSubsystem & operator+=(VQwSubsystem *value)
Int_t ProcessEvBuffer(UInt_t, UInt_t, UInt_t *, UInt_t)
TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware v...
Int_t ProcessConfigurationBuffer(UInt_t, UInt_t, UInt_t *, UInt_t)
Int_t LoadInputParameters(TString)
Mandatory parameter file definition.
VQwSubsystem & operator-=(VQwSubsystem *value)
virtual UInt_t UpdateErrorFlag()
Uses the error flags of contained data elements to update Returns the error flag to the top level rou...
void AccumulateRunningSum(QwRegression value)
std::vector< std::pair< VQwHardwareChannel *, VQwHardwareChannel * > > fDependentVar
Definition: QwRegression.h:121
void Difference(VQwSubsystem *value1, VQwSubsystem *value2)
void FillHistograms()
Fill the histograms for this subsystem.
void CalculateRunningAverage()
Calculate the average for all good events.
void PrintErrorCounters() const
Report the number of events failed due to HW and event cut failures.
VQwSubsystem & operator*=(VQwSubsystem *value)
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209
void Ratio(VQwSubsystem *value1, VQwSubsystem *value2)
void IncrementErrorCounters()
Increment the error counters.
void CalculateRunningAverage()
VQwSubsystem & operator=(VQwSubsystem *value)
Overloaded Operators.
Bool_t FileHasModuleHeader(const std::string &secname)
void DeaccumulateRunningSum(VQwSubsystem *value)
remove one entry from the running sums for devices
Bool_t ApplySingleEventCuts()
Apply the single event cuts.
VQwSubsystem & operator/=(VQwSubsystem *value)
void Scale(Double_t value)
boost::shared_ptr< VQwSubsystem > GetSharedPointerToStaticObject()
void PrintValue() const
void AccumulateRunningSum(VQwSubsystem *input)
Update the running sums.
UInt_t GetEventcutErrorFlag()
Return the error flag to the top level routines related to stability checks and ErrorFlag updates...
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
Int_t LoadEventCuts(TString)
Load the event cuts file.
Int_t LoadChannelMap(TString)
Derived functions.
void operator()(void const *) const
void Sum(VQwSubsystem *value1, VQwSubsystem *value2)
void ConstructBranch(TTree *tree, TString &prefix)
Construct the branch and tree vector.
QwParameterFile * ReadUntilNextModule(const bool add_current_line=false)
#define RegisterSubsystemFactory(A)
Definition: QwFactory.h:230