JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwOmnivore.h
Go to the documentation of this file.
1/*!
2 * \file QwOmnivore.h
3 * \brief An omnivorous subsystem template class
4 */
5
6#pragma once
7
9
10/**
11 * \class QwOmnivore
12 * \ingroup QwAnalysis
13 * \brief An omnivorous subsystem.
14 */
15template<class VQwSubsystem_t>
16class QwOmnivore: public VQwSubsystem_t {
17
18 private:
19 /// Private default constructor (not implemented, will throw linker error on use)
21
22 public:
23 /// Constructor with name
24 QwOmnivore(const TString& name): VQwSubsystem(name),VQwSubsystem_t(name) { };
25 /// Copy constructor
26 QwOmnivore(const QwOmnivore& source)
27 : VQwSubsystem(source),VQwSubsystem_t(source)
28 { }
29 /// Virtual destructor
30 ~QwOmnivore() override { };
31
32 /// Map file definition
33 Int_t LoadChannelMap(TString mapfile) override { return 0; };
34 /// Parameter file definition
35 Int_t LoadInputParameters(TString mapfile) override { return 0; };
36 /// Geometry definition for tracking subsystems
37 Int_t LoadGeometryDefinition(TString mapfile) override { return 0; };
38
39 /// Load the event cuts file
40 Int_t LoadEventCuts(TString filename) override { return 0; };
41 /// Apply the single event cuts
42 Bool_t ApplySingleEventCuts() override { return kTRUE; };
43
44 Bool_t CheckForBurpFail(const VQwSubsystem *subsys) override{return kFALSE;};
45
46 /// Report the number of events failed due to HW and event cut failures
47 void PrintErrorCounters() const override { };
48 /// Return the error flag to the main routine
49 UInt_t GetEventcutErrorFlag() override { return 0; };
50
51 /// Increment error counters
52 void IncrementErrorCounters() override { };
53 /// Update error flag
54 void UpdateErrorFlag(const VQwSubsystem*) override { };
55
56 /// Get the hit list
57 //void GetHitList(QwHitContainer& grandHitContainer) { };
58 /// Get the detector geometry information
59 //Int_t GetDetectorInfo(std::vector< std::vector< QwDetectorInfo > > & detect_info) { return 0; };
60
61
62 /// Clear event data
63 void ClearEventData() override { };
64
65 /// Process the configuration events
66 Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) override {
67 /// Om nom nom nom
68 // TODO (wdc) configuration events seem to have num_words = 0xffffffff
69 //UInt_t cheeseburger;
70 //for (UInt_t word = 0; word < num_words; word++)
71 // cheeseburger += buffer[word]; // (addition to prevent compiler from optimizing local away)
72 return 0; // my plate is empty
73 };
74
75 /// Process the event buffer
76 Int_t ProcessEvBuffer(const UInt_t event_type, const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) override {
77 /// TODO: Subsystems should be changing their ProcessEvBuffer routines to take the event_type as the first
78 /// argument. But in the meantime, default to just calling the non-event-type-aware ProcessEvBuffer routine.
79 return this->ProcessEvBuffer(roc_id, bank_id, buffer, num_words);
80 };
81 /// TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version.
82 Int_t ProcessEvBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t* buffer, UInt_t num_words) override {
83 /// Om nom nom nom
84 UInt_t cheeseburger;
85 for (UInt_t word = 0; word < num_words; word++)
86 cheeseburger += buffer[word]; // (addition to prevent compiler from optimizing local away)
87 return 0; // my plate is empty
88 };
89
90 /// Process the event
91 void ProcessEvent() override { };
92
93 /// Assignment/addition/subtraction operators
94 VQwSubsystem& operator= (VQwSubsystem *value) override { return *this; };
95 VQwSubsystem& operator+= (VQwSubsystem *value) override { return *this; };
96 VQwSubsystem& operator-= (VQwSubsystem *value) override { return *this; };
97 /// Sum/difference/ratio/scale operations
98 void Sum(VQwSubsystem *value1, VQwSubsystem *value2) override { };
99 void Difference(VQwSubsystem *value1, VQwSubsystem *value2) override { };
100 void Ratio(VQwSubsystem *numer, VQwSubsystem *denom) override { };
101 void Scale(Double_t factor) override { };
102
103 /// Construct the histograms for this subsystem in a folder with a prefix
104 void ConstructHistograms(TDirectory *folder, TString &prefix) override { };
105 /// Fill the histograms for this subsystem
106 void FillHistograms() override { };
107
108 /// Construct the branch and tree vector
109 void ConstructBranchAndVector(TTree *tree, TString & prefix, QwRootTreeBranchVector &values) override { };
110 /// Fill the tree vector
111 void FillTreeVector(QwRootTreeBranchVector &values) const override { };
112#ifdef HAS_RNTUPLE_SUPPORT
113 /// Construct the RNTuple fields and vector
114 void ConstructNTupleAndVector(std::unique_ptr<ROOT::RNTupleModel>& model, TString& prefix, std::vector<Double_t>& values, std::vector<std::shared_ptr<Double_t>>& fieldPtrs) override { };
115 /// Fill the RNTuple vector
116 void FillNTupleVector(std::vector<Double_t>& values) const override { };
117#endif // HAS_RNTUPLE_SUPPORT
118 /// Construct branch
119 void ConstructBranch(TTree*, TString&) override { };
120 /// Construct branch
121 void ConstructBranch(TTree*, TString&, QwParameterFile&) override { };
122
123 /// \brief Update the running sums for devices
124 void AccumulateRunningSum(VQwSubsystem* value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override { };
125 void DeaccumulateRunningSum(VQwSubsystem* value, Int_t ErrorMask=0xFFFFFFF) override { };
126 /// \brief Calculate the average for all good events
127 void CalculateRunningAverage() override { };
128};
ULong64_t BankID_t
Definition QwTypes.h:21
UInt_t ROCID_t
Definition QwTypes.h:20
Virtual base class for parity analysis subsystems.
Int_t LoadChannelMap(TString mapfile) override
Map file definition.
Definition QwOmnivore.h:33
void FillHistograms() override
Fill the histograms for this subsystem.
Definition QwOmnivore.h:106
void ProcessEvent() override
Process the event.
Definition QwOmnivore.h:91
VQwSubsystem & operator-=(VQwSubsystem *value) override
Definition QwOmnivore.h:96
Bool_t ApplySingleEventCuts() override
Apply the single event cuts.
Definition QwOmnivore.h:42
void Difference(VQwSubsystem *value1, VQwSubsystem *value2) override
Definition QwOmnivore.h:99
void Sum(VQwSubsystem *value1, VQwSubsystem *value2) override
Sum/difference/ratio/scale operations.
Definition QwOmnivore.h:98
QwOmnivore(const TString &name)
Constructor with name.
Definition QwOmnivore.h:24
UInt_t GetEventcutErrorFlag() override
Return the error flag to the main routine.
Definition QwOmnivore.h:49
void DeaccumulateRunningSum(VQwSubsystem *value, Int_t ErrorMask=0xFFFFFFF) override
Definition QwOmnivore.h:125
void Scale(Double_t factor) override
Definition QwOmnivore.h:101
Bool_t CheckForBurpFail(const VQwSubsystem *subsys) override
Definition QwOmnivore.h:44
Int_t LoadEventCuts(TString filename) override
Load the event cuts file.
Definition QwOmnivore.h:40
Int_t ProcessConfigurationBuffer(const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
Process the configuration events.
Definition QwOmnivore.h:66
Int_t LoadGeometryDefinition(TString mapfile) override
Geometry definition for tracking subsystems.
Definition QwOmnivore.h:37
void ClearEventData() override
Get the hit list.
Definition QwOmnivore.h:63
void UpdateErrorFlag(const VQwSubsystem *) override
Update error flag.
Definition QwOmnivore.h:54
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...
Definition QwOmnivore.h:82
void CalculateRunningAverage() override
Calculate the average for all good events.
Definition QwOmnivore.h:127
QwOmnivore(const QwOmnivore &source)
Copy constructor.
Definition QwOmnivore.h:26
void ConstructBranch(TTree *, TString &, QwParameterFile &) override
Construct branch.
Definition QwOmnivore.h:121
QwOmnivore()
Private default constructor (not implemented, will throw linker error on use)
Int_t ProcessEvBuffer(const UInt_t event_type, const ROCID_t roc_id, const BankID_t bank_id, UInt_t *buffer, UInt_t num_words) override
Process the event buffer.
Definition QwOmnivore.h:76
VQwSubsystem & operator=(VQwSubsystem *value) override
Assignment/addition/subtraction operators.
Definition QwOmnivore.h:94
void IncrementErrorCounters() override
Increment error counters.
Definition QwOmnivore.h:52
VQwSubsystem & operator+=(VQwSubsystem *value) override
Definition QwOmnivore.h:95
void PrintErrorCounters() const override
Report the number of events failed due to HW and event cut failures.
Definition QwOmnivore.h:47
void ConstructHistograms(TDirectory *folder, TString &prefix) override
Construct the histograms for this subsystem in a folder with a prefix.
Definition QwOmnivore.h:104
void FillTreeVector(QwRootTreeBranchVector &values) const override
Fill the tree vector.
Definition QwOmnivore.h:111
~QwOmnivore() override
Virtual destructor.
Definition QwOmnivore.h:30
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom) override
Definition QwOmnivore.h:100
void AccumulateRunningSum(VQwSubsystem *value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
Update the running sums for devices.
Definition QwOmnivore.h:124
Int_t LoadInputParameters(TString mapfile) override
Parameter file definition.
Definition QwOmnivore.h:35
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
Construct the branch and tree vector.
Definition QwOmnivore.h:109
Configuration file parser with flexible tokenization and search capabilities.
A helper class to manage a vector of branch entries for ROOT trees.
Definition QwRootFile.h:53
Base class for subsystems implementing container-delegation pattern.