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