QwAnalysis
QwIntegratedRasterChannel.h
Go to the documentation of this file.
1 /**********************************************************\
2 * File: QwIntegratedRasterChannel.h *
3 * *
4 * Author: *
5 * Time-stamp: *
6 \**********************************************************/
7 
8 #ifndef __QwIntegratedRasterChannel__
9 #define __QwIntegratedRasterChannel__
10 
11 // System headers
12 #include <vector>
13 
14 // ROOT headers
15 #include <TTree.h>
16 
17 // Qweak headers
18 #include "QwParameterFile.h"
19 #include "VQwDataElement.h"
20 #include "VQwHardwareChannel.h"
21 
22 // Forward declarations
23 class QwDBInterface;
24 
25 /*****************************************************************
26 * Class:
27 ******************************************************************/
28 ///
29 /// \ingroup QwAnalysis_BL
30 template<typename T>
32 /////
33  public:
36  InitializeChannel(name,"raw");
37  };
38  QwIntegratedRasterChannel(TString subsystemname, TString name){
39  SetSubsystemName(subsystemname);
40  InitializeChannel(subsystemname, name,"raw");
41  };
43 
44  Int_t ProcessEvBuffer(UInt_t* buffer, UInt_t word_position_in_buffer, UInt_t subelement=0);
45 
46  void InitializeChannel(TString name, TString datatosave);
47  // new routine added to update necessary information for tree trimming
48  void InitializeChannel(TString subsystem, TString name, TString datatosave);
49  void ClearEventData();
50 
51 
52  void SetRandomEventDriftParameters(Double_t amplitude, Double_t phase, Double_t frequency);
53  void AddRandomEventDriftParameters(Double_t amplitude, Double_t phase, Double_t frequency);
54  void SetRandomEventParameters(Double_t mean, Double_t sigma);
55  void SetRandomEventAsymmetry(Double_t asymmetry);
56  void RandomizeEventData(int helicity = 0, double time = 0);
57  void SetHardwareSum(Double_t hwsum, UInt_t sequencenumber = 0);
58  void SetEventData(Double_t* block, UInt_t sequencenumber);
59  void EncodeEventData(std::vector<UInt_t> &buffer);
60 
62  void SetExternalRandomVariable(Double_t random_variable);
63 
64  void ProcessEvent();
65  Bool_t ApplyHWChecks();//Check for harware errors in the devices
66  Bool_t ApplySingleEventCuts();//Check for good events by stting limits on the devices readings
67  void IncrementErrorCounters(){fTriumf_ADC.IncrementErrorCounters();};
68  void PrintErrorCounters() const;// report number of events failed due to HW and event cut faliure
69  UInt_t GetEventcutErrorFlag(){//return the error flag
70  return fTriumf_ADC.GetEventcutErrorFlag();
71  }
72  UInt_t UpdateErrorFlag() {return GetEventcutErrorFlag();};
74  return fTriumf_ADC.UpdateErrorFlag(ev_error->fTriumf_ADC);
75  }
76 
77  Int_t SetSingleEventCuts(Double_t mean = 0, Double_t sigma = 0);//two limts and sample size
78  /*! \brief Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel */
79  void SetSingleEventCuts(UInt_t errorflag, Double_t min = 0, Double_t max = 0, Double_t stability = 0);
80 
81  void SetDefaultSampleSize(Int_t sample_size);
82  void SetEventCutMode(Int_t bcuts){
83  bEVENTCUTMODE=bcuts;
84  fTriumf_ADC.SetEventCutMode(bcuts);
85  }
86 
87  void PrintValue() const;
88  void PrintInfo() const;
89 
90 
97  void Scale(Double_t factor);
98 
101 
102  void SetPedestal(Double_t ped);
103  void SetCalibrationFactor(Double_t calib);
104 
105  void ConstructHistograms(TDirectory *folder, TString &prefix);
106  void FillHistograms();
107 
108  void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector<Double_t> &values);
109  void ConstructBranch(TTree *tree, TString &prefix);
110  void ConstructBranch(TTree *tree, TString &prefix, QwParameterFile& modulelist);
111  void FillTreeVector(std::vector<Double_t> &values) const;
112 
113  std::vector<QwDBInterface> GetDBEntry();
114  std::vector<QwErrDBInterface> GetErrDBEntry();
115 
116  const VQwDataElement* GetElement() const {
117  return const_cast<QwIntegratedRasterChannel*>(this)->GetElement();
118  };
119 
120 
121 /////
122  protected:
123 
124 /////
125  private:
126 
127  Double_t fPedestal;
128  Double_t fCalibration;
129  Double_t fULimit, fLLimit;
130  Bool_t fGoodEvent;//used to validate sequence number in the IsGoodEvent()
131 
132 
133 
134 
136 
137  Int_t fDeviceErrorCode;//keep the device HW status using a unique code from the QwVQWK_Channel::fDeviceErrorCode
138 
139  const static Bool_t bDEBUG=kFALSE;//debugging display purposes
140  Bool_t bEVENTCUTMODE;//If this set to kFALSE then Event cuts do not depend on HW ckecks. This is set externally through the qweak_beamline_eventcuts.map
141 
142 
143 };
144 
145 #endif
QwIntegratedRasterChannel & operator=(const QwIntegratedRasterChannel &value)
void EncodeEventData(std::vector< UInt_t > &buffer)
void FillHistograms()
Fill the histograms for this data element.
void AddRandomEventDriftParameters(Double_t amplitude, Double_t phase, Double_t frequency)
QwIntegratedRasterChannel & operator-=(const QwIntegratedRasterChannel &value)
void SetCalibrationFactor(Double_t calib)
QwIntegratedRasterChannel & operator+=(const QwIntegratedRasterChannel &value)
void SetDefaultSampleSize(Int_t sample_size)
QwIntegratedRasterChannel(TString subsystemname, TString name)
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
void AccumulateRunningSum(const QwIntegratedRasterChannel &value)
void SetRandomEventDriftParameters(Double_t amplitude, Double_t phase, Double_t frequency)
Int_t ProcessEvBuffer(UInt_t *buffer, UInt_t word_position_in_buffer, UInt_t subelement=0)
Process the CODA event buffer for this element.
std::vector< QwErrDBInterface > GetErrDBEntry()
UInt_t GetEventcutErrorFlag()
return the error flag on this channel/device
void FillTreeVector(std::vector< Double_t > &values) const
void SetRandomEventParameters(Double_t mean, Double_t sigma)
void Difference(QwIntegratedRasterChannel &value1, QwIntegratedRasterChannel &value2)
UInt_t UpdateErrorFlag()
Update the error flag based on the error flags of internally contained objects Return paramter is the...
Definition of the pure virtual base class of all data elements.
The pure virtual base class of all data elements.
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.
void ConstructBranch(TTree *tree, TString &prefix)
static const double T
Magnetic field: base unit is T.
Definition: QwUnits.h:111
const VQwDataElement * GetElement() const
void RandomizeEventData(int helicity=0, double time=0)
static const double min
Definition: QwUnits.h:76
void ConstructHistograms(TDirectory *folder, TString &prefix)
Construct the histograms for this data element.
Int_t SetSingleEventCuts(Double_t mean=0, Double_t sigma=0)
void SetExternalRandomVariable(Double_t random_variable)
void Sum(QwIntegratedRasterChannel &value1, QwIntegratedRasterChannel &value2)
void SetHardwareSum(Double_t hwsum, UInt_t sequencenumber=0)
void SetEventData(Double_t *block, UInt_t sequencenumber)
void SetRandomEventAsymmetry(Double_t asymmetry)
void UpdateErrorFlag(const QwIntegratedRasterChannel *ev_error)
std::vector< QwDBInterface > GetDBEntry()
void PrintValue() const
Print single line of value and error of this data element.
void PrintErrorCounters() const
report number of events failed due to HW and event cut failure
void Ratio(QwIntegratedRasterChannel &numer, QwIntegratedRasterChannel &denom)
void InitializeChannel(TString name, TString datatosave)
void ClearEventData()
Clear the event data in this element.
void PrintInfo() const
Print multiple lines of information about this data element.