QwAnalysis
QwRegressionSubsystem.h
Go to the documentation of this file.
1 /*
2  * QwRegressionSubsystem.h
3  *
4  * Created on: Aug 11, 2011
5  * Author: meeker
6  */
7 
8 
9 #ifndef __QWREGRESSIONSUBSYSTEM__
10 #define __QWREGRESSIONSUBSYSTEM__
11 
12 // Boost headers
13 #include <boost/shared_ptr.hpp>
14 
15 // headers
16 #include "QwOptions.h"
17 #include "VQwSubsystemParity.h"
18 #include "QwSubsystemArrayParity.h"
19 #include "QwRegression.h"
20 
21 class QwParameterFile;
22 
23 /**
24  * \class QwRegressionSubsystem
25  *
26  * \brief
27  *
28  */
29 
31  public MQwSubsystemCloneable<QwRegressionSubsystem>,
32  public QwRegression
33 {
34 
35  public:
36  // Constructors
37  /// \brief Constructor with just name.
38  /// (use gQwOptions to initialize the QwRegression baseclass)
39  QwRegressionSubsystem(TString name)
41  /// \brief Constructor with only options
42  QwRegressionSubsystem(QwOptions &options, TString name)
43  : VQwSubsystem(name), VQwSubsystemParity(name), QwRegression(options) { }
44  /// \brief Constructor with single event
45  QwRegressionSubsystem(QwOptions &options, QwSubsystemArrayParity& event, TString name)
46  : VQwSubsystem(name), VQwSubsystemParity(name), QwRegression(options, event)
47  { QwMessage << "Constructing QwRegressionSubsystem" << QwLog::endl; }
48 
49  // Copy Constructor
51  : VQwSubsystem(source), VQwSubsystemParity(source), QwRegression(source) { }
52 
53  // Destructor
55 
56  boost::shared_ptr<VQwSubsystem> GetSharedPointerToStaticObject();
57 
59 
60  /// \brief Update the running sums
63  /// \brief Calculate the average for all good events
65  /// \brief Print values for all channels
66  void PrintValue() const;
67 
70  }
71 
72 
73  /// \brief Overloaded Operators
79  void Sum(VQwSubsystem *value1, VQwSubsystem *value2);
80  void Difference(VQwSubsystem *value1, VQwSubsystem *value2);
81  void Ratio(VQwSubsystem* value1, VQwSubsystem* value2);
82  void Scale(Double_t value);
83 
84  void ConstructBranchAndVector(TTree *tree, TString& prefix, std::vector <Double_t> &values){
85  QwRegression::ConstructBranchAndVector(tree,prefix,values);
86  }
87  void FillTreeVector(std::vector<Double_t> &values) const{
89  }
90 
91  void ConstructHistograms(TDirectory *folder, TString &prefix);
92  void FillHistograms();
93  void DeleteHistograms();
94  void ConstructBranch(TTree *tree, TString & prefix);
95  void ConstructBranch(TTree *tree, TString & prefix, QwParameterFile& trim_file);
96 
97 
98 
99 
100  //update the error flag in the subsystem level from the top level routines related to stability checks. This will uniquely update the errorflag at each channel based on the error flag in the corresponding channel in the ev_error subsystem
101  void UpdateErrorFlag(const VQwSubsystem *ev_error);
102 
103 
104  /// \brief Derived functions
105  // not sure if there should be empty definition, no definition or defined
106  Int_t LoadChannelMap(TString);
107  Int_t LoadInputParameters(TString);
108  Int_t LoadEventCuts(TString);
110  PairIterator element;
111  for (element = fDependentVar.begin();
112  element != fDependentVar.end(); ++element) {
113  if (element->second != NULL)
114  element->second->ClearEventData();
115  }
116  };
117  Int_t ProcessConfigurationBuffer(UInt_t, UInt_t, UInt_t*, UInt_t);
118  Int_t ProcessEvBuffer(UInt_t, UInt_t, UInt_t*, UInt_t);
119  void ProcessEvent(){};
120 
121  Bool_t ApplySingleEventCuts();
122  void IncrementErrorCounters();
123  void PrintErrorCounters() const;
124  UInt_t GetEventcutErrorFlag();
125 
126 
127  private:
128 
129  /**
130  * Default Constructor
131  *
132  * Error: tries to call default constructors of base class,
133  * QwRegression() is private
134  */
135  // QwRegressionSubsystem() {};
136 
137 
138 }; // class QwRegressionSubsystem
139 
140 
141 #endif // __QWREGRESSIONSUBSYSTEM__
142 
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void PrintValue() const
Print values for all channels.
VQwSubsystem & operator+=(VQwSubsystem *value)
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct the branch and tree vector.
Int_t ProcessEvBuffer(UInt_t, UInt_t, UInt_t *, UInt_t)
TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware v...
Int_t ProcessConfigurationBuffer(UInt_t, UInt_t, UInt_t *, UInt_t)
Int_t LoadInputParameters(TString)
Mandatory parameter file definition.
VQwSubsystem & operator-=(VQwSubsystem *value)
An options class.
Definition: QwOptions.h:133
virtual UInt_t UpdateErrorFlag()
Uses the error flags of contained data elements to update Returns the error flag to the top level rou...
std::vector< std::pair< VQwHardwareChannel *, VQwHardwareChannel * > > fDependentVar
Definition: QwRegression.h:121
void Difference(VQwSubsystem *value1, VQwSubsystem *value2)
void FillTreeVector(std::vector< Double_t > &values) const
Fill the tree vector.
void FillHistograms()
Fill the histograms for this subsystem.
Virtual base class for the parity subsystems.
QwOptions gQwOptions
Definition: QwOptions.cc:27
void CalculateRunningAverage()
Calculate the average for all good events.
void LinearRegression(EQwRegType type)
Linear regression.
void PrintErrorCounters() const
Report the number of events failed due to HW and event cut failures.
VQwSubsystem & operator*=(VQwSubsystem *value)
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209
void Ratio(VQwSubsystem *value1, VQwSubsystem *value2)
void IncrementErrorCounters()
Increment the error counters.
VQwSubsystem & operator=(VQwSubsystem *value)
Overloaded Operators.
Virtual base class for the parity subsystems.
void DeaccumulateRunningSum(VQwSubsystem *value)
remove one entry from the running sums for devices
Bool_t ApplySingleEventCuts()
Apply the single event cuts.
QwRegressionSubsystem(TString name)
Constructor with just name. (use gQwOptions to initialize the QwRegression baseclass) ...
VQwSubsystem & operator/=(VQwSubsystem *value)
void Scale(Double_t value)
boost::shared_ptr< VQwSubsystem > GetSharedPointerToStaticObject()
void AccumulateRunningSum(VQwSubsystem *input)
Update the running sums.
void ConstructBranchAndVector(TTree *tree, std::vector< Double_t > &values)
Construct the tree and vector for this subsystem.
Definition: QwRegression.h:74
UInt_t GetEventcutErrorFlag()
Return the error flag to the top level routines related to stability checks and ErrorFlag updates...
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59
QwRegressionSubsystem(QwOptions &options, TString name)
Constructor with only options.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
void FillTreeVector(std::vector< Double_t > &values) const
Fill the vector for this subsystem.
Int_t LoadEventCuts(TString)
Load the event cuts file.
Int_t LoadChannelMap(TString)
Derived functions.
An options class which parses command line, config file and environment.
void ProcessOptions(QwOptions &options)
Process the configuration options.
void Sum(VQwSubsystem *value1, VQwSubsystem *value2)
QwRegressionSubsystem(QwOptions &options, QwSubsystemArrayParity &event, TString name)
Constructor with single event.
void ConstructBranch(TTree *tree, TString &prefix)
Construct the branch and tree vector.
void ProcessOptions(QwOptions &options)
Process the command line options.
QwRegressionSubsystem(const QwRegressionSubsystem &source)
std::vector< std::pair< VQwHardwareChannel *, VQwHardwareChannel * > >::iterator PairIterator
Definition: QwRegression.h:28