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