JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwCombinerSubsystem.cc
Go to the documentation of this file.
1/*!
2 * \file QwCombinerSubsystem.cc
3 * \brief Implementation of combiner subsystem for parity analysis
4 * \author meeker
5 * \date 2011-08-11
6 */
7
10#include "QwCombiner.h"
12#include "QwParameterFile.h"
13
14
18
20 void operator()(void const *) const { }
21};
22
24 std::shared_ptr<VQwSubsystem> px(this, null_deleter());
25 return px;
26}
27
29{
31 QwCombinerSubsystem* input= dynamic_cast<QwCombinerSubsystem*>(value);
32 if (input!=NULL) {
33 for(size_t i = 0; i < input->fDependentVar.size(); i++) {
34 this->fOutputVar.at(i)->AssignValueFrom(input->fOutputVar.at(i));
35 }
36 }
37 return *this;
38}
39
41{
42 QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*>(value);
43 if (input!=NULL) {
44 for(size_t i = 0; i < input->fDependentVar.size(); i++) {
45 this->fOutputVar.at(i)->AddValueFrom(input->fOutputVar.at(i));
46 }
47 }
48 return *this;
49}
50
52{
53 QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*>(value);
54 if (input!=NULL) {
55 for(size_t i = 0; i<input->fDependentVar.size(); i++) {
56 this->fOutputVar.at(i)->SubtractValueFrom(input->fOutputVar.at(i));
57 }
58 }
59 return *this;
60}
61
63{
64 QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*>(value);
65 if (input!=NULL) {
66 for(size_t i = 0; i<input->fDependentVar.size(); i++) {
67 this->fOutputVar.at(i)->MultiplyBy(input->fOutputVar.at(i));
68 }
69 }
70 return *this;
71}
72
74{
75 QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*>(value);
76 if (input!=NULL) {
77 for(size_t i = 0; i<input->fDependentVar.size(); i++) {
78 this->fOutputVar.at(i)->DivideBy(input->fOutputVar.at(i));
79 }
80 }
81 return *this;
82}
83
84
86{
87 *this = value1;
88 *this /= value2;
89}
90
91
92void QwCombinerSubsystem::Scale(Double_t value)
93{
94 for(size_t i = 0; i < this->fDependentVar.size(); i++)
95 {
96 this->fOutputVar.at(i)->Scale(value);
97 }
98
99};
100
101void QwCombinerSubsystem::AccumulateRunningSum(VQwSubsystem* input, Int_t count, Int_t ErrorMask)
102{
103 QwCombinerSubsystem* value = dynamic_cast<QwCombinerSubsystem*> (input);
104 if (value!=NULL){
105 QwCombiner::AccumulateRunningSum(*value, count, ErrorMask);
106 }
107}
108
110{
111 QwCombinerSubsystem* value = dynamic_cast<QwCombinerSubsystem*> (input);
112 if (value!=NULL) {
113 for (size_t i = 0; i < value-> fDependentVar.size(); i++) {
114 fOutputVar.at(i)->DeaccumulateRunningSum(value->fOutputVar.at(i), ErrorMask);
115 }
116 }
117}
118
123
127
128
129void QwCombinerSubsystem::ConstructHistograms(TDirectory *folder, TString &prefix)
130{
131 for (size_t i = 0; i < fDependentVar.size(); i++){
132 fOutputVar.at(i)->ConstructHistograms(folder,prefix);
133 }
134};
135
137{
138 for (size_t i = 0; i < fDependentVar.size(); i++){
139 fOutputVar.at(i)->FillHistograms();
140 }
141};
142
144{
145 for (size_t i = 0; i < fDependentVar.size(); i++){
146 // fOutputVar.at(i)->DeleteHistograms();
147 }
148};
149
150void QwCombinerSubsystem::ConstructBranch(TTree *tree, TString & prefix)
151{
152 for (size_t i = 0; i < fDependentVar.size(); i++){
153 fOutputVar.at(i)->ConstructBranch(tree, prefix);
154 }
155};
156
157void QwCombinerSubsystem::ConstructBranch(TTree *tree, TString & prefix, QwParameterFile& trim_file)
158{
159 TString tmp;
160 std::unique_ptr<QwParameterFile> nextmodule;
161 trim_file.RewindToFileStart();
162 tmp="Combiner";
163 trim_file.RewindToFileStart();
164 if (trim_file.FileHasModuleHeader(tmp)){
165 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
166 for (size_t i = 0; i < fDependentVar.size(); i++){
167 fOutputVar.at(i)->ConstructBranch(tree, prefix, *nextmodule);
168 }
169 }
170};
171
172
174{
175 /// TODO: Write QwCombinerSubsystem::IncrementErrorCounters
176}
177
179 /// TODO: Write QwCombinerSubsystem::UpdateErrorFlag
180 //if (Compare(ev_error)){
181 //QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*> (ev_error);
182 //}
183};
184
185
186/// DERIVED FUNCTIONS ///
187
188
189/* All of the functions below are using generic
190 * returns for testing purposes.
191 */
192
193
194
196{
197 Int_t sample = 0;
198 return sample;
199}
200
201
203{
204 Int_t sample = 0;
205 return sample;
206}
207
208
210{
211 Int_t sample = 0;
212 return sample;
213
214}
215
216Int_t QwCombinerSubsystem::ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words)
217{
218 Int_t sample = 0;
219 return sample;
220}
221
222
223Int_t QwCombinerSubsystem::ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words)
224{
225 Int_t sample = 0;
226 return sample;
227}
228
229
231{
232 return true;
233}
234
238
240{
241 return 0;
242
243}
Parameter file parsing and management.
ULong64_t BankID_t
Definition QwTypes.h:21
UInt_t ROCID_t
Definition QwTypes.h:20
Subsystem array container for parity analysis with asymmetry calculations.
Virtual base class for parity analysis subsystems.
Combiner subsystem for parity analysis data handling.
Data combiner handler for channel operations.
Configuration file parser with flexible tokenization and search capabilities.
std::unique_ptr< QwParameterFile > ReadUntilNextModule(const bool add_current_line=false)
Bool_t FileHasModuleHeader(const std::string &secname)
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
virtual VQwSubsystem & operator=(VQwSubsystem *value)
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...
VQwSubsystem(const TString &name)
Constructor with name.
VQwSubsystem & operator=(VQwSubsystem *value) override
Overloaded Operators.
std::shared_ptr< VQwSubsystem > GetSharedPointerToStaticObject()
VQwSubsystem & operator*=(VQwSubsystem *value)
Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
void PrintValue() const override
Print values for all channels.
void FillHistograms() override
Fill the histograms for this subsystem.
void PrintErrorCounters() const override
void ConstructBranch(TTree *tree, TString &prefix) override
Construct the branch and tree vector.
VQwSubsystem & operator/=(VQwSubsystem *value)
VQwSubsystem & operator+=(VQwSubsystem *value) override
UInt_t GetEventcutErrorFlag() override
Return the error flag to the top level routines related to stability checks and ErrorFlag updates.
void Scale(Double_t value) override
void DeaccumulateRunningSum(VQwSubsystem *value, Int_t ErrorMask=0xFFFFFFF) override
remove one entry from the running sums for devices
Int_t LoadInputParameters(TString) override
Mandatory parameter file definition.
void IncrementErrorCounters() override
Increment the error counters.
QwCombinerSubsystem(const TString name)
Constructor with just name.
Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware v...
VQwSubsystem & operator-=(VQwSubsystem *value) override
Bool_t ApplySingleEventCuts() override
Apply the single event cuts.
Int_t LoadEventCuts(TString) override
Optional event cut file.
void CalculateRunningAverage() override
Calculate the average for all good events.
void Ratio(VQwSubsystem *value1, VQwSubsystem *value2) override
void AccumulateRunningSum()
void PrintValue() const
std::vector< const VQwHardwareChannel * > fDependentVar
void CalculateRunningAverage()
std::vector< VQwHardwareChannel * > fOutputVar
virtual UInt_t UpdateErrorFlag()
Uses the error flags of contained data elements to update Returns the error flag to the top level rou...
void operator()(void const *) const