QwAnalysis
QwSubsystemArrayParity.h
Go to the documentation of this file.
1 /**********************************************************\
2 * File: QwSubsystemArrayParity.h *
3 * *
4 * Author: P. M. King *
5 * Time-stamp: <2009-02-04 10:30> *
6 \**********************************************************/
7 
8 #ifndef __QWSUBSYSTEMARRAYPARITY__
9 #define __QWSUBSYSTEMARRAYPARITY__
10 
11 #include <vector>
12 #include <TTree.h>
13 
14 #include "QwSubsystemArray.h"
15 #include "VQwSubsystemParity.h"
16 
17 // Forward declarations
18 class QwBlinder;
19 class QwParityDB;
20 class QwPromptSummary;
21 
22 /**
23  * \class QwSubsystemArrayParity
24  * \ingroup QwAnalysis
25  *
26  * \brief Virtual base class for the parity subsystems
27  *
28  * Virtual base class for the classes containing the
29  * event-based information from each parity subsystem.
30  * This will define the interfaces used in communicating
31  * with the CODA routines.
32  *
33  */
35 
36  private:
37 
38  /// Private default constructor
39  QwSubsystemArrayParity(); // not implement, will thrown linker error on use
40 
41  public:
42 
43  /// Constructor with options
45  /// Copy constructor by reference
47  /// Default destructor
48  virtual ~QwSubsystemArrayParity();
49 
50  /// \brief Get the subsystem with the specified name
51  VQwSubsystemParity* GetSubsystemByName(const TString& name);
52  /// \brief Construct a branch and vector for this subsystem with a prefix
53  void ConstructBranchAndVector(TTree *tree, TString& prefix, std::vector <Double_t> &values);
54  /// \brief Fill the vector for this subsystem
55  void FillTreeVector(std::vector<Double_t>& values) const;
56  /// \brief Fill the histograms for this subsystem
57  void FillHistograms();
58 
59  /// \brief Fill the database with MPS-based variables
60  /// Note that most subsystems don't need to do this.
61  void FillDB_MPS(QwParityDB *db, TString type);
62  /// \brief Fill the database
63  void FillDB(QwParityDB *db, TString type);
64  void FillErrDB(QwParityDB *db, TString type);
66 
67  /// \brief Assignment operator
69  /// \brief Addition-assignment operator
71  /// \brief Subtraction-assignment operator
73  /// \brief Sum of two subsystem arrays
74  void Sum(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2);
75  /// \brief Difference of two subsystem arrays
76  void Difference(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2);
77  /// \brief Ratio of two subsystem arrays
78  void Ratio(const QwSubsystemArrayParity &numer, const QwSubsystemArrayParity &denom);
79  /// \brief Scale this subsystem array
80  void Scale(Double_t factor);
81 
82 
83  /// \brief Update the running sums for devices accumulated for the global error non-zero events/patterns
85  /// \brief Update the running sums for devices check only the error flags at the channel level. Only used for stability checks
87  /// \brief Remove the entry value from the running sums for devices
89 
90  /// \brief Calculate the average for all good events
92 
93  /// \brief Blind the asymmetry of this subsystem
94  void Blind(const QwBlinder* blinder);
95  /// \brief Unblind the asymmetry of this subsystem
96  void UnBlind(const QwBlinder* blinder)
97  { /* Not yet implemented */ };
98  /// \brief Blind the difference of this subsystem
99  void Blind(const QwBlinder* blinder, const QwSubsystemArrayParity& yield);
100  /// \brief Unblind the difference of this subsystem
101  void UnBlind(const QwBlinder* blinder, const QwSubsystemArrayParity& yield)
102  { /* Not yet implemented */ };
103 
104 
105  /// \brief Apply the single event cuts
106  Bool_t ApplySingleEventCuts();
107  /// \brief Update the data elements' error counters based on their
108  /// internal error flags.
109  void IncrementErrorCounters();
110 
111  /// \brief Report the number of events failed due to HW and event cut failures
112  void PrintErrorCounters() const;
113  /// \brief Return the error flag to the main routine
114  UInt_t GetEventcutErrorFlag() const{
115  return fErrorFlag;
116  };
117 
118  /// \brief Update the error flag internally from all the subsystems
119  void UpdateErrorFlag();
120 
121  /// \brief update the error flag for each channel in the subsystem array with the corresponding value in the ev_error subsystem array
122  void UpdateErrorFlag(const QwSubsystemArrayParity& ev_error);
123 
124 
125  /// \brief Print value of all channels
126  void PrintValue() const;
127 
128  void WritePromptSummary(QwPromptSummary *ps, TString type);
129 
130  virtual Bool_t CheckForEndOfBurst() const;
131 
132  protected:
133 
134  /// Test whether this subsystem array can contain a particular subsystem
135  static Bool_t CanContain(VQwSubsystem* subsys) {
136  return (dynamic_cast<VQwSubsystemParity*>(subsys) != 0);
137  };
138 
139  UInt_t fErrorFlag;
141 
142 }; // class QwSubsystemArrayParity
143 
144 #endif // __QWSUBSYSTEMARRAYPARITY__
void FillHistograms()
Fill the histograms for this subsystem.
void PrintValue() const
Print value of all channels.
virtual ~QwSubsystemArrayParity()
Default destructor.
virtual Bool_t CheckForEndOfBurst() const
Bool_t ApplySingleEventCuts()
Apply the single event cuts.
void DeaccumulateRunningSum(const QwSubsystemArrayParity &value)
Remove the entry value from the running sums for devices.
void WritePromptSummary(QwPromptSummary *ps, TString type)
void Blind(const QwBlinder *blinder)
Blind the asymmetry of this subsystem.
QwSubsystemArrayParity()
Private default constructor.
An options class.
Definition: QwOptions.h:133
void Sum(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
Sum of two subsystem arrays.
QwSubsystemArrayParity & operator=(const QwSubsystemArrayParity &value)
Assignment operator.
Class for blinding data, adapted from G0 blinder class.
Definition: QwBlinder.h:64
void AccumulateRunningSum(const QwSubsystemArrayParity &value)
Update the running sums for devices accumulated for the global error non-zero events/patterns.
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct a branch and vector for this subsystem with a prefix.
Virtual base class for the parity subsystems.
void CalculateRunningAverage()
Calculate the average for all good events.
void FillDB_MPS(QwParityDB *db, TString type)
Fill the database with MPS-based variables Note that most subsystems don&#39;t need to do this...
void Difference(const QwSubsystemArrayParity &value1, const QwSubsystemArrayParity &value2)
Difference of two subsystem arrays.
QwSubsystemArrayParity & operator-=(const QwSubsystemArrayParity &value)
Subtraction-assignment operator.
Virtual base class for the parity subsystems.
void FillErrDB(QwParityDB *db, TString type)
void Scale(Double_t factor)
Scale this subsystem array.
void PrintErrorCounters() const
Report the number of events failed due to HW and event cut failures.
QwSubsystemArrayParity(QwOptions &options)
Constructor with options.
const QwSubsystemArrayParity * dummy_source
void FillDB(QwParityDB *db, TString type)
Fill the database.
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
UInt_t GetEventcutErrorFlag() const
Return the error flag to the main routine.
QwSubsystemArrayParity & operator+=(const QwSubsystemArrayParity &value)
Addition-assignment operator.
void UnBlind(const QwBlinder *blinder)
Unblind the asymmetry of this subsystem.
static Bool_t CanContain(VQwSubsystem *subsys)
Test whether this subsystem array can contain a particular subsystem.
VQwSubsystemParity * GetSubsystemByName(const TString &name)
Get the subsystem with the specified name.
void IncrementErrorCounters()
Update the data elements&#39; error counters based on their internal error flags.
void UnBlind(const QwBlinder *blinder, const QwSubsystemArrayParity &yield)
Unblind the difference of this subsystem.
void UpdateErrorFlag()
Update the error flag internally from all the subsystems.
void AccumulateAllRunningSum(const QwSubsystemArrayParity &value)
Update the running sums for devices check only the error flags at the channel level. Only used for stability checks.
void FillTreeVector(std::vector< Double_t > &values) const
Fill the vector for this subsystem.
void Ratio(const QwSubsystemArrayParity &numer, const QwSubsystemArrayParity &denom)
Ratio of two subsystem arrays.