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
15
16
20
21struct null_deleter {
22 void operator()(void const *) const { }
23};
24
26 std::shared_ptr<VQwSubsystem> px(this, null_deleter());
27 return px;
28}
29
31{
32 QwCombinerSubsystem* input= dynamic_cast<QwCombinerSubsystem*>(value);
33 if (input!=NULL) {
34 for(size_t i = 0; i < input->fDependentVar.size(); i++) {
35 this->fOutputVar.at(i)->AssignValueFrom(input->fOutputVar.at(i));
36 }
37 }
38 return *this;
39}
40
42{
43 QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*>(value);
44 if (input!=NULL) {
45 for(size_t i = 0; i < input->fDependentVar.size(); i++) {
46 this->fOutputVar.at(i)->AddValueFrom(input->fOutputVar.at(i));
47 }
48 }
49 return *this;
50}
51
53{
54 QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*>(value);
55 if (input!=NULL) {
56 for(size_t i = 0; i<input->fDependentVar.size(); i++) {
57 this->fOutputVar.at(i)->SubtractValueFrom(input->fOutputVar.at(i));
58 }
59 }
60 return *this;
61}
62
64{
65 QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*>(value);
66 if (input!=NULL) {
67 for(size_t i = 0; i<input->fDependentVar.size(); i++) {
68 this->fOutputVar.at(i)->MultiplyBy(input->fOutputVar.at(i));
69 }
70 }
71 return *this;
72}
73
75{
76 QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*>(value);
77 if (input!=NULL) {
78 for(size_t i = 0; i<input->fDependentVar.size(); i++) {
79 this->fOutputVar.at(i)->DivideBy(input->fOutputVar.at(i));
80 }
81 }
82 return *this;
83}
84
85
87{
88 *this = value1;
89 *this /= value2;
90}
91
92
93void QwCombinerSubsystem::Scale(Double_t value)
94{
95 for(size_t i = 0; i < this->fDependentVar.size(); i++)
96 {
97 this->fOutputVar.at(i)->Scale(value);
98 }
99
100};
101
102void QwCombinerSubsystem::AccumulateRunningSum(VQwSubsystem* input, Int_t count, Int_t ErrorMask)
103{
104 QwCombinerSubsystem* value = dynamic_cast<QwCombinerSubsystem*> (input);
105 if (value!=NULL){
106 QwCombiner::AccumulateRunningSum(*value, count, ErrorMask);
107 }
108}
109
111{
112 QwCombinerSubsystem* value = dynamic_cast<QwCombinerSubsystem*> (input);
113 if (value!=NULL) {
114 for (size_t i = 0; i < value-> fDependentVar.size(); i++) {
115 fOutputVar.at(i)->DeaccumulateRunningSum(value->fOutputVar.at(i), ErrorMask);
116 }
117 }
118}
119
124
128
129
130void QwCombinerSubsystem::ConstructHistograms(TDirectory *folder, TString &prefix)
131{
132 for (size_t i = 0; i < fDependentVar.size(); i++){
133 fOutputVar.at(i)->ConstructHistograms(folder,prefix);
134 }
135};
136
138{
139 for (size_t i = 0; i < fDependentVar.size(); i++){
140 fOutputVar.at(i)->FillHistograms();
141 }
142};
143
145{
146 for (size_t i = 0; i < fDependentVar.size(); i++){
147 // fOutputVar.at(i)->DeleteHistograms();
148 }
149};
150
151void QwCombinerSubsystem::ConstructBranch(TTree *tree, TString & prefix)
152{
153 for (size_t i = 0; i < fDependentVar.size(); i++){
154 fOutputVar.at(i)->ConstructBranch(tree, prefix);
155 }
156};
157
158void QwCombinerSubsystem::ConstructBranch(TTree *tree, TString & prefix, QwParameterFile& trim_file)
159{
160 TString tmp;
161 std::unique_ptr<QwParameterFile> nextmodule;
162 trim_file.RewindToFileStart();
163 tmp="Combiner";
164 trim_file.RewindToFileStart();
165 if (trim_file.FileHasModuleHeader(tmp)){
166 nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
167 for (size_t i = 0; i < fDependentVar.size(); i++){
168 fOutputVar.at(i)->ConstructBranch(tree, prefix, *nextmodule);
169 }
170 }
171};
172
173
175{
176 /// TODO: Write QwCombinerSubsystem::IncrementErrorCounters
177}
178
180 /// TODO: Write QwCombinerSubsystem::UpdateErrorFlag
181 //if (Compare(ev_error)){
182 //QwCombinerSubsystem* input = dynamic_cast<QwCombinerSubsystem*> (ev_error);
183 //}
184};
185
186
187/// DERIVED FUNCTIONS ///
188
189
190/* All of the functions below are using generic
191 * returns for testing purposes.
192 */
193
194
195
197{
198 Int_t sample = 0;
199 return sample;
200}
201
202
204{
205 Int_t sample = 0;
206 return sample;
207}
208
209
211{
212 Int_t sample = 0;
213 return sample;
214
215}
216
217Int_t QwCombinerSubsystem::ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words)
218{
219 Int_t sample = 0;
220 return sample;
221}
222
223
224Int_t QwCombinerSubsystem::ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words)
225{
226 Int_t sample = 0;
227 return sample;
228}
229
230
232{
233 return true;
234}
235
239
241{
242 return 0;
243
244}
245
246
247
248
Parameter file parsing and management.
#define REGISTER_SUBSYSTEM_FACTORY(A)
Definition QwFactory.h:270
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.
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