JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches

Concrete hardware channel for VQWK ADC modules (6x32-bit words) More...

#include <QwVQWK_Channel.h>

+ Inheritance diagram for QwVQWK_Channel:
+ Collaboration diagram for QwVQWK_Channel:

Public Member Functions

 QwVQWK_Channel ()
 
 QwVQWK_Channel (TString name, TString datatosave="raw")
 
 QwVQWK_Channel (const QwVQWK_Channel &value)
 
 QwVQWK_Channel (const QwVQWK_Channel &value, VQwDataElement::EDataToSave datatosave)
 
 ~QwVQWK_Channel () override
 
void CopyFrom (const QwVQWK_Channel &value)
 
VQwHardwareChannelClone (VQwDataElement::EDataToSave datatosave) const override
 
void InitializeChannel (TString name, TString datatosave) override
 Initialize the fields in this object.
 
void InitializeChannel (TString subsystem, TString instrumenttype, TString name, TString datatosave) override
 Initialize the fields in this object.
 
void LoadChannelParameters (QwParameterFile &paramfile) override
 
void SetDefaultSampleSize (size_t num_samples_map)
 
void ClearEventData () override
 Clear the event data in this element.
 
void RandomizeEventData (int helicity=0.0, double time=0.0) override
 Internally generate random event data.
 
void ForceMapfileSampleSize ()
 
void SmearByResolution (double resolution) override
 
void SetHardwareSum (Double_t hwsum, UInt_t sequencenumber=0)
 
void SetEventData (Double_t *block, UInt_t sequencenumber=0)
 
void SetRawEventData () override
 
void EncodeEventData (std::vector< UInt_t > &buffer) override
 Encode the event data into a CODA buffer.
 
Int_t ProcessEvBuffer (UInt_t *buffer, UInt_t num_words_left, UInt_t index=0) override
 Decode the event data from a CODA buffer.
 
void ProcessEvent () override
 Process the event data according to pedestal and calibration factor.
 
QwVQWK_Channeloperator= (const QwVQWK_Channel &value)
 
void AssignScaledValue (const QwVQWK_Channel &value, Double_t scale)
 
void AssignValueFrom (const VQwDataElement *valueptr) override
 
void AddValueFrom (const VQwHardwareChannel *valueptr) override
 
void SubtractValueFrom (const VQwHardwareChannel *valueptr) override
 
void MultiplyBy (const VQwHardwareChannel *valueptr) override
 
void DivideBy (const VQwHardwareChannel *valueptr) override
 
void ArcTan (const QwVQWK_Channel &value)
 
QwVQWK_Channeloperator+= (const QwVQWK_Channel &value)
 
QwVQWK_Channeloperator-= (const QwVQWK_Channel &value)
 
QwVQWK_Channeloperator*= (const QwVQWK_Channel &value)
 
VQwHardwareChanneloperator+= (const VQwHardwareChannel &input) override
 
VQwHardwareChanneloperator-= (const VQwHardwareChannel &input) override
 
VQwHardwareChanneloperator*= (const VQwHardwareChannel &input) override
 
VQwHardwareChanneloperator/= (const VQwHardwareChannel &input) override
 
const QwVQWK_Channel operator+ (const QwVQWK_Channel &value) const
 
const QwVQWK_Channel operator- (const QwVQWK_Channel &value) const
 
const QwVQWK_Channel operator* (const QwVQWK_Channel &value) const
 
void Sum (const QwVQWK_Channel &value1, const QwVQWK_Channel &value2)
 
void Difference (const QwVQWK_Channel &value1, const QwVQWK_Channel &value2)
 
void Ratio (const QwVQWK_Channel &numer, const QwVQWK_Channel &denom)
 
void Product (const QwVQWK_Channel &value1, const QwVQWK_Channel &value2)
 
void DivideBy (const QwVQWK_Channel &denom)
 
void AddChannelOffset (Double_t Offset)
 
void Scale (Double_t Offset) override
 
void AccumulateRunningSum (const QwVQWK_Channel &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
 
void AccumulateRunningSum (const VQwHardwareChannel *value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
 
void DeaccumulateRunningSum (const QwVQWK_Channel &value, Int_t ErrorMask=0xFFFFFFF)
 
void CalculateRunningAverage () override
 
Bool_t MatchSequenceNumber (size_t seqnum)
 
Bool_t MatchNumberOfSamples (size_t numsamp)
 
Bool_t ApplySingleEventCuts (Double_t LL, Double_t UL)
 
Bool_t ApplySingleEventCuts () override
 
void PrintErrorCounters () const override
 report number of events failed due to HW and event cut failure
 
void SetVQWKSaturationLimt (Double_t sat_volts=8.5)
 
Double_t GetVQWKSaturationLimt ()
 
Int_t ApplyHWChecks () override
 
void IncrementErrorCounters () override
 
void ConstructHistograms (TDirectory *folder, TString &prefix) override
 Construct the histograms for this data element.
 
void FillHistograms () override
 Fill the histograms for this data element.
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
 
void ConstructBranch (TTree *tree, TString &prefix) override
 
void FillTreeVector (QwRootTreeBranchVector &values) const override
 
Int_t GetRawValue (size_t element) const override
 
Double_t GetValue (size_t element) const override
 
Double_t GetValueM2 (size_t element) const override
 
Double_t GetValueError (size_t element) const override
 
Double_t GetAverageVolts () const
 
size_t GetSequenceNumber () const
 
size_t GetNumberOfSamples () const
 
void SetCalibrationToVolts ()
 
void PrintValue () const override
 Print single line of value and error of this data element.
 
void PrintInfo () const override
 Print multiple lines of information about this data element.
 
void Blind (const QwBlinder *blinder)
 Blind this channel as an asymmetry.
 
void Blind (const QwBlinder *blinder, const QwVQWK_Channel &yield)
 Blind this channel as a difference.
 
void ScaledAdd (Double_t scale, const VQwHardwareChannel *value) override
 
virtual void LoadMockDataParameters (QwParameterFile &paramfile)
 Load the mock data parameters from the current line in the param file.
 
Int_t GetRawValue () const
 
Double_t GetValue () const
 
Double_t GetValueM2 () const
 
Double_t GetValueError () const
 
Double_t GetValueWidth () const
 
Double_t GetValueWidth (size_t element) const
 
virtual void DeaccumulateRunningSum (const VQwHardwareChannel *value, Int_t ErrorMask=0xFFFFFFF)
 
virtual VQwHardwareChannelClone () const
 
- Public Member Functions inherited from VQwHardwareChannel
 VQwHardwareChannel ()
 
 VQwHardwareChannel (const VQwHardwareChannel &value)
 
 VQwHardwareChannel (const VQwHardwareChannel &value, VQwDataElement::EDataToSave datatosave)
 
 ~VQwHardwareChannel () override
 
void CopyFrom (const VQwHardwareChannel &value)
 
void ProcessOptions ()
 
size_t GetNumberOfDataWords ()
 Get the number of data words in this data element.
 
size_t GetNumberOfSubelements ()
 Get the number of subelements in this data element.
 
Int_t GetRawValue () const
 
Double_t GetValue () const
 
Double_t GetValueM2 () const
 
Double_t GetValueError () const
 
Double_t GetValueWidth () const
 
Double_t GetValueWidth (size_t element) const
 
void ClearEventData () override
 Clear the event data in this element.
 
void InitializeChannel (TString name)
 Initialize the fields in this object.
 
void SetEventCutMode (Int_t bcuts)
 
virtual Bool_t CheckForBurpFail (const VQwHardwareChannel *event)
 
void SetSingleEventCuts (Double_t min, Double_t max)
 Set the upper and lower limits (fULimit and fLLimit) for this channel.
 
void SetSingleEventCuts (UInt_t errorflag, Double_t min, Double_t max, Double_t stability=-1.0, Double_t BurpLevel=-1.0)
 Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel.
 
Double_t GetEventCutUpperLimit () const
 
Double_t GetEventCutLowerLimit () const
 
Double_t GetStabilityLimit () const
 
UInt_t UpdateErrorFlag () override
 Update the error flag based on the error flags of internally contained objects Return parameter is the "Eventcut Error Flag".
 
void UpdateErrorFlag (const VQwHardwareChannel &elem)
 
virtual UInt_t GetErrorCode () const
 
VQwHardwareChanneloperator= (const VQwHardwareChannel &value)
 Arithmetic assignment operator: Should only copy event-based data.
 
void AssignScaledValue (const VQwHardwareChannel &value, Double_t scale)
 
virtual void Ratio (const VQwHardwareChannel *numer, const VQwHardwareChannel *denom)
 
void SetPedestal (Double_t ped)
 
Double_t GetPedestal () const
 
void SetCalibrationFactor (Double_t factor)
 
Double_t GetCalibrationFactor () const
 
void AddEntriesToList (std::vector< QwDBInterface > &row_list)
 
virtual void AddErrEntriesToList (std::vector< QwErrDBInterface > &)
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &modulelist)
 
virtual void CopyParameters (const VQwHardwareChannel *)
 
void UpdateErrorFlag (const UInt_t &error)
 
- Public Member Functions inherited from VQwDataElement
 VQwDataElement ()
 Default constructor.
 
 VQwDataElement (const VQwDataElement &value)
 Copy constructor.
 
 ~VQwDataElement () override
 Virtual destructor.
 
void CopyFrom (const VQwDataElement &value)
 
Bool_t IsNameEmpty () const
 Is the name of this element empty?
 
void SetElementName (const TString &name)
 Set the name of this element.
 
virtual const TString & GetElementName () const
 Get the name of this element.
 
size_t GetNumberOfDataWords ()
 Get the number of data words in this data element.
 
UInt_t GetGoodEventCount () const
 
VQwDataElementoperator+= (const VQwDataElement &)
 Addition-assignment operator.
 
VQwDataElementoperator-= (const VQwDataElement &)
 Subtraction-assignment operator.
 
void Sum (const VQwDataElement &, const VQwDataElement &)
 Sum operator (base class fallback throws runtime error)
 
void Difference (const VQwDataElement &, const VQwDataElement &)
 Difference operator (base class fallback throws runtime error)
 
void Ratio (const VQwDataElement &, const VQwDataElement &)
 Ratio operator (base class fallback throws runtime error)
 
void SetSingleEventCuts (UInt_t, Double_t, Double_t, Double_t)
 set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel
 
Bool_t CheckForBurpFail (const VQwDataElement *)
 
virtual UInt_t GetEventcutErrorFlag ()
 return the error flag on this channel/device
 
virtual void SetNeedsExternalClock (Bool_t)
 
virtual Bool_t NeedsExternalClock ()
 
virtual std::string GetExternalClockName ()
 
virtual void SetExternalClockPtr (const VQwHardwareChannel *)
 
virtual void SetExternalClockName (const std::string)
 
virtual Double_t GetNormClockValue ()
 
TString GetSubsystemName () const
 Return the name of the inheriting subsystem name.
 
void SetSubsystemName (TString sysname)
 Set the name of the inheriting subsystem name.
 
TString GetModuleType () const
 Return the type of the beam instrument.
 
void SetModuleType (TString ModuleType)
 set the type of the beam instrument
 
- Public Member Functions inherited from MQwHistograms
void ShareHistograms (const MQwHistograms *source)
 Share histogram pointers between objects.
 
- Public Member Functions inherited from MQwMockable
 MQwMockable ()
 
virtual ~MQwMockable ()
 
void SetRandomEventDriftParameters (Double_t amplitude, Double_t phase, Double_t frequency)
 Set a single set of harmonic drift parameters.
 
void AddRandomEventDriftParameters (Double_t amplitude, Double_t phase, Double_t frequency)
 Add drift parameters to the internal set.
 
void SetRandomEventParameters (Double_t mean, Double_t sigma)
 Set the normal random event parameters.
 
void SetRandomEventAsymmetry (Double_t asymmetry)
 Set the helicity asymmetry.
 
Double_t GetRandomValue ()
 
void UseExternalRandomVariable ()
 Set the flag to use an externally provided random variable.
 
void SetExternalRandomVariable (Double_t random_variable)
 Set the externally provided random variable.
 
void SetMockDataAsDiff ()
 

Static Public Member Functions

static Int_t GetBufferOffset (Int_t moduleindex, Int_t channelindex)
 
static void PrintErrorCounterHead ()
 
static void PrintErrorCounterTail ()
 
static void SetBurpHoldoff (Int_t holdoff)
 

Static Public Attributes

static const Double_t kTimePerSample = (2.0/30.0) * Qw::us
 

Protected Member Functions

QwVQWK_Channeloperator/= (const QwVQWK_Channel &value)
 
- Protected Member Functions inherited from VQwHardwareChannel
void SetNumberOfDataWords (const UInt_t &numwords)
 Set the number of data words in this data element.
 
void SetNumberOfSubElements (const size_t elements)
 Set the number of data words in this data element.
 
void SetDataToSave (TString datatosave)
 Set the flag indicating if raw or derived values are in this data element.
 
void SetDataToSave (VQwDataElement::EDataToSave datatosave)
 Set the flag indicating if raw or derived values are in this data element.
 
void SetDataToSaveByPrefix (const TString &prefix)
 Set the flag indicating if raw or derived values are in this data element based on prefix.
 
void RangeCheck (size_t element) const
 Checks that the requested element is in range, to be used in accesses to subelements similar to std::vector::at().
 
- Protected Member Functions inherited from VQwDataElement
void SetNumberOfDataWords (const UInt_t &numwords)
 Set the number of data words in this data element.
 
VQwDataElementoperator= (const VQwDataElement &value)
 Arithmetic assignment operator: Should only copy event-based data.
 
void UpdateErrorFlag (const UInt_t &error)
 
- Protected Member Functions inherited from MQwHistograms
 MQwHistograms ()
 Default constructor.
 
 MQwHistograms (const MQwHistograms &source)
 Copy constructor.
 
virtual ~MQwHistograms ()
 Virtual destructor.
 
MQwHistogramsoperator= (const MQwHistograms &value)
 
void Fill_Pointer (TH1_ptr hist_ptr, Double_t value)
 
void AddHistogram (TH1 *h)
 Register a histogram.
 

Private Member Functions

Double_t GetBlockValue (size_t blocknum) const
 
Double_t GetBlockErrorValue (size_t blocknum) const
 
Double_t GetHardwareSum () const
 
Double_t GetHardwareSumM2 () const
 
Double_t GetHardwareSumWidth () const
 
Double_t GetHardwareSumError () const
 
Int_t GetRawBlockValue (size_t blocknum) const
 
Int_t GetRawHardwareSum () const
 
Int_t GetRawSoftwareSum () const
 

Private Attributes

Channel configuration data members
Short_t fBlocksPerEvent
 
Event data members—Raw values
Int_t fBlock_raw [4]
 Array of the sub-block data as read from the module.
 
Int_t fHardwareBlockSum_raw
 Module-based sum of the four sub-blocks as read from the module.
 
Int_t fSoftwareBlockSum_raw
 Sum of the data in the four sub-blocks raw.
 
Event data members—Potentially calibrated values
Double_t fBlock [4]
 Array of the sub-block data.
 
Double_t fHardwareBlockSum
 Module-based sum of the four sub-blocks.
 

Static Private Attributes

static const Bool_t kDEBUG = kFALSE
 
static const Int_t kWordsPerChannel = 6
 
static const Int_t kMaxChannels = 8
 
ADC Calibration
static const Double_t kVQWK_VoltsPerBit = (20./(1<<18))
 

Friends

std::ostream & operator<< (std::ostream &stream, const QwVQWK_Channel &channel)
 

Calculation of the statistical moments

static const Bool_t bDEBUG =kFALSE
 debugging display purposes
 
Double_t fBlockM2 [4]
 Second moment of the sub-block.
 
Double_t fBlockError [4]
 Uncertainty on the sub-block.
 
Double_t fHardwareBlockSumM2
 Second moment of the hardware sum.
 
Double_t fHardwareBlockSumError
 Uncertainty on the hardware sum.
 
UInt_t fSequenceNumber
 Event sequence number for this channel.
 
UInt_t fPreviousSequenceNumber
 Previous event sequence number for this channel.
 
UInt_t fNumberOfSamples
 Number of samples read through the module.
 
UInt_t fNumberOfSamples_map
 Number of samples in the expected to read through the module. This value is set in the QwBeamline map file.
 
Int_t fErrorCount_HWSat
 check to see ADC channel is saturated
 
Int_t fErrorCount_sample
 for sample size check
 
Int_t fErrorCount_SW_HW
 HW_sum==SW_sum check.
 
Int_t fErrorCount_Sequence
 sequence number check
 
Int_t fErrorCount_SameHW
 check to see ADC returning same HW value
 
Int_t fErrorCount_ZeroHW
 check to see ADC returning zero
 
Int_t fNumEvtsWithEventCutsRejected
 Counts the Event cut rejected events.
 
Int_t fADC_Same_NumEvt
 Keep track of how many events with same ADC value returned.
 
Int_t fSequenceNo_Prev
 Keep the sequence number of the last event.
 
Int_t fSequenceNo_Counter
 Internal counter to keep track of the sequence number.
 
Double_t fPrev_HardwareBlockSum
 Previous Module-based sum of the four sub-blocks.
 
Double_t fSaturationABSLimit
 absolute value of the VQWK saturation volt
 
Bool_t bHw_sum
 
Bool_t bHw_sum_raw
 
Bool_t bBlock
 
Bool_t bBlock_raw
 
Bool_t bNum_samples
 
Bool_t bDevice_Error_Code
 
Bool_t bSequence_number
 

Additional Inherited Members

- Public Types inherited from VQwDataElement
enum  EDataToSave { kRaw = 0 , kDerived , kMoments }
 
- Protected Attributes inherited from VQwHardwareChannel
UInt_t fNumberOfDataWords
 Number of raw data words in this data element.
 
UInt_t fNumberOfSubElements
 Number of subelements in this data element.
 
EDataToSave fDataToSave
 
size_t fTreeArrayIndex
 
size_t fTreeArrayNumEntries
 
Double_t fPedestal
 
Double_t fCalibrationFactor
 
Bool_t kFoundPedestal
 
Bool_t kFoundGain
 
Int_t bEVENTCUTMODE
 
Double_t fULimit
 
Double_t fLLimit
 
Double_t fStability
 
Double_t fBurpThreshold
 
Int_t fBurpCountdown
 
- Protected Attributes inherited from VQwDataElement
TString fElementName
 Name of this data element.
 
UInt_t fNumberOfDataWords
 Number of raw data words in this data element.
 
UInt_t fGoodEventCount
 Number of good events accumulated in this element.
 
TString fSubsystemName
 
TString fModuleType
 
UInt_t fErrorFlag
 This the standard error code generated for the channel that contains the global/local/stability flags and the Device error code (Unique error code for HW failures)
 
UInt_t fErrorConfigFlag
 contains the global/local/stability flags
 
- Protected Attributes inherited from MQwHistograms
std::vector< TH1_ptrfHistograms
 Histograms associated with this data element.
 
bool fUseExternalRandomVariable
 Flag to use an externally provided normal random variable.
 
double fExternalRandomVariable
 Externally provided normal random variable.
 
bool fCalcMockDataAsDiff
 
Double_t fMockAsymmetry
 Helicity asymmetry.
 
Double_t fMockGaussianMean
 Mean of normal distribution.
 
Double_t fMockGaussianSigma
 Sigma of normal distribution.
 
std::vector< Double_t > fMockDriftAmplitude
 Harmonic drift amplitude.
 
std::vector< Double_t > fMockDriftFrequency
 Harmonic drift frequency.
 
std::vector< Double_t > fMockDriftPhase
 Harmonic drift phase.
 
static Int_t fBurpHoldoff = 10
 
static boost::mt19937 fRandomnessGenerator
 Internal randomness generator.
 
static boost::normal_distribution< double > fNormalDistribution
 Internal normal probability distribution.
 
static boost::variate_generator< boost::mt19937, boost::normal_distribution< double > > fNormalRandomVariable
 Internal normal random variable.
 

Detailed Description

Concrete hardware channel for VQWK ADC modules (6x32-bit words)

Decodes and processes the data for a single VQWK channel, providing access to sub-blocks and hardware sums, statistical moments, single-event cuts, and running statistics. Implements the dual-operator pattern by offering efficient type-specific operators and delegating polymorphic operators from the VQwHardwareChannel interface using dynamic_cast.

Definition at line 48 of file QwVQWK_Channel.h.

Constructor & Destructor Documentation

◆ QwVQWK_Channel() [1/4]

QwVQWK_Channel::QwVQWK_Channel ( )
inline

Definition at line 76 of file QwVQWK_Channel.h.

76 : MQwMockable() {
77 InitializeChannel("","");
78 SetVQWKSaturationLimt(8.5);//set the default saturation limit
79 };
void InitializeChannel(TString name, TString datatosave) override
Initialize the fields in this object.
void SetVQWKSaturationLimt(Double_t sat_volts=8.5)

References InitializeChannel(), MQwMockable::MQwMockable(), and SetVQWKSaturationLimt().

Referenced by AccumulateRunningSum(), AccumulateRunningSum(), AddValueFrom(), ArcTan(), AssignScaledValue(), AssignValueFrom(), Blind(), Clone(), CopyFrom(), DeaccumulateRunningSum(), Difference(), DivideBy(), DivideBy(), MultiplyBy(), operator*(), operator*=(), operator*=(), operator+(), operator+=(), operator+=(), operator-(), operator-=(), operator-=(), operator/=(), operator/=(), operator<<, operator=(), Product(), QwVQWK_Channel(), QwVQWK_Channel(), Ratio(), ScaledAdd(), SubtractValueFrom(), and Sum().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QwVQWK_Channel() [2/4]

QwVQWK_Channel::QwVQWK_Channel ( TString name,
TString datatosave = "raw" )
inline

Definition at line 80 of file QwVQWK_Channel.h.

80 : MQwMockable() {
81 InitializeChannel(name, datatosave);
82 SetVQWKSaturationLimt(8.5);//set the default saturation limit
83 };

References InitializeChannel(), MQwMockable::MQwMockable(), and SetVQWKSaturationLimt().

+ Here is the call graph for this function:

◆ QwVQWK_Channel() [3/4]

QwVQWK_Channel::QwVQWK_Channel ( const QwVQWK_Channel & value)
inline

Definition at line 84 of file QwVQWK_Channel.h.

84 :
85 VQwHardwareChannel(value), MQwMockable(value),
89 {
90 *this = value;
91 };
Short_t fBlocksPerEvent
Double_t fSaturationABSLimit
absolute value of the VQWK saturation volt
UInt_t fNumberOfSamples_map
Number of samples in the expected to read through the module. This value is set in the QwBeamline map...

References fBlocksPerEvent, fNumberOfSamples_map, fSaturationABSLimit, MQwMockable::MQwMockable(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ QwVQWK_Channel() [4/4]

QwVQWK_Channel::QwVQWK_Channel ( const QwVQWK_Channel & value,
VQwDataElement::EDataToSave datatosave )
inline

Definition at line 92 of file QwVQWK_Channel.h.

92 :
93 VQwHardwareChannel(value,datatosave), MQwMockable(value),
97 {
98 *this = value;
99 };

References fBlocksPerEvent, fNumberOfSamples_map, fSaturationABSLimit, MQwMockable::MQwMockable(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ ~QwVQWK_Channel()

QwVQWK_Channel::~QwVQWK_Channel ( )
inlineoverride

Definition at line 100 of file QwVQWK_Channel.h.

100{ };

Member Function Documentation

◆ AccumulateRunningSum() [1/2]

void QwVQWK_Channel::AccumulateRunningSum ( const QwVQWK_Channel & value,
Int_t count = 0,
Int_t ErrorMask = 0xFFFFFFF )

Accumulate event values into the running sum with optional scaling.

Parameters
valueSource channel to accumulate from.
countEvent count scaling (0 means use value.fGoodEventCount).
ErrorMaskBit mask of error flags to exclude when accumulating.

Moments and uncertainty calculation on the running sums and averages The calculation of the first and second moments of the running sum is not completely straightforward due to numerical instabilities associated with small variances and large average values. The naive computation taking the difference of the square of the average and the average of the squares leads to the subtraction of two very large numbers to get a small number.

Alternative algorithms (including for higher order moments) are supplied in Pebay, Philippe (2008), "Formulas for Robust, One-Pass Parallel Computation of Covariances and Arbitrary-Order Statistical Moments", Technical Report SAND2008-6212, Sandia National Laboratories. http://infoserve.sandia.gov/sand_doc/2008/086212.pdf

In the following formulas the moments \( M^1 \) and \( M^2 \) are defined

\begin{eqnarray} M^1 & = & \frac{1}{n} \sum^n y \\ M^2 & = & \sum^n (y - \mu) \end{eqnarray}

Recurrence relations for the addition of a single event:

\begin{eqnarray} M^1_n & = & M^1_{n-1} + \frac{y - M^1_{n-1}}{n} \\ M^2_n & = & M^2_{n-1} + (y - M^1_{n-1})(y - M^1_n) \end{eqnarray}

For the addition of an already accumulated sum:

\begin{eqnarray} M^1 & = & M^1_1 + n_2 \frac{M^1_2 - M^1_1}{n} \\ M^2 & = & M^2_1 + M^2_2 + n_1 n_2 \frac{(M^1_2 - M^1_1)^2}{n} \end{eqnarray}

In these recursive formulas we start from \( M^1 = y \) and \( M^2 = 0 \).

To calculate the mean and standard deviation we use

\begin{eqnarray} \mu & = & M^1 \\ \sigma^2 & = & \frac{1}{n} M^2 \end{eqnarray}

The standard deviation is a biased estimator, but this is what ROOT uses. Better would be to divide by \( (n-1) \).

We use the formulas provided there for the calculation of the first and second moments (i.e. average and variance).

Definition at line 1569 of file QwVQWK_Channel.cc.

1570{
1571 /*
1572 note:
1573 The AccumulateRunningSum is called on a dedicated subsystem array object and
1574 for the standard running avg computations we only need value.fErrorFlag==0
1575 events to be included in the running avg. So the "berror" conditions is only
1576 used for the stability check purposes.
1577
1578 The need for this check below came due to fact that when routine
1579 DeaccumulateRunningSum is called the errorflag is updated with
1580 the kBeamStabilityError flag (+ configuration flags for global errors) and
1581 need to make sure we remove this flag and any configuration flags before
1582 checking the (fErrorFlag != 0) condition
1583
1584 See how the stability check is implemented in the QwEventRing class
1585
1586 Rakitha
1587 */
1588
1589 if(count==0){
1590 count = value.fGoodEventCount;
1591 }
1592
1593 Int_t n1 = fGoodEventCount;
1594 Int_t n2 = count;
1595
1596 // If there are no good events, check the error flag
1597 if (n2 == 0 && (value.fErrorFlag == 0)) {
1598 n2 = 1;
1599 }
1600
1601 // If a single event is removed from the sum, check all but stability fail flags
1602 if (n2 == -1) {
1603 if ((value.fErrorFlag & ErrorMask) == 0) {
1604 n2 = -1;
1605 } else {
1606 n2 = 0;
1607 }
1608 }
1609
1610 if (ErrorMask == kPreserveError){
1611 //n = 1;
1612 if (n2 == 0) {
1613 n2 = 1;
1614 }
1615 if (count == -1) {
1616 n2 = -1;
1617 }
1618 }
1619
1620 // New total number of good events
1621 Int_t n = n1 + n2;
1622
1623 // Set up variables
1624 Double_t M11 = fHardwareBlockSum;
1625 Double_t M12 = value.fHardwareBlockSum;
1626 Double_t M22 = value.fHardwareBlockSumM2;
1627
1628 //if(this->GetElementName() == "bcm_an_ds3" && ErrorMask == kPreserveError){QwError << "count=" << fGoodEventCount << " n=" << n << QwLog::endl; }
1629 if (n2 == 0) {
1630 // no good events for addition
1631 return;
1632 } else if (n2 == -1) {
1633 // simple version for removal of single event from the sum
1635 if (n > 1) {
1636 fHardwareBlockSum -= (M12 - M11) / n;
1637 fHardwareBlockSumM2 -= (M12 - M11)
1638 * (M12 - fHardwareBlockSum); // note: using updated mean
1639 // and for individual blocks
1640 for (Int_t i = 0; i < 4; i++) {
1641 M11 = fBlock[i];
1642 M12 = value.fBlock[i];
1643 M22 = value.fBlockM2[i];
1644 fBlock[i] -= (M12 - M11) / n;
1645 fBlockM2[i] -= (M12 - M11) * (M12 - fBlock[i]); // note: using updated mean
1646 }
1647 } else if (n == 1) {
1648 fHardwareBlockSum -= (M12 - M11) / n;
1649 fHardwareBlockSumM2 -= (M12 - M11)
1650 * (M12 - fHardwareBlockSum); // note: using updated mean
1651 if (fabs(fHardwareBlockSumM2) < 10.*std::numeric_limits<double>::epsilon())
1652 fHardwareBlockSumM2 = 0; // rounding
1653 // and for individual blocks
1654 for (Int_t i = 0; i < 4; i++) {
1655 M11 = fBlock[i];
1656 M12 = value.fBlock[i];
1657 M22 = value.fBlockM2[i];
1658 fBlock[i] -= (M12 - M11) / n;
1659 fBlockM2[i] -= (M12 - M11) * (M12 - fBlock[i]); // note: using updated mean
1660 if (fabs(fBlockM2[i]) < 10.*std::numeric_limits<double>::epsilon())
1661 fBlockM2[i] = 0; // rounding
1662 }
1663 } else if (n == 0) {
1664 fHardwareBlockSum -= M12;
1665 fHardwareBlockSumM2 -= M22;
1666 if (fabs(fHardwareBlockSum) < 10.*std::numeric_limits<double>::epsilon())
1667 fHardwareBlockSum = 0; // rounding
1668 if (fabs(fHardwareBlockSumM2) < 10.*std::numeric_limits<double>::epsilon())
1669 fHardwareBlockSumM2 = 0; // rounding
1670 // and for individual blocks
1671 for (Int_t i = 0; i < 4; i++) {
1672 M11 = fBlock[i];
1673 M12 = value.fBlock[i];
1674 M22 = value.fBlockM2[i];
1675 fBlock[i] -= M12;
1676 fBlockM2[i] -= M22;
1677 if (fabs(fBlock[i]) < 10.*std::numeric_limits<double>::epsilon())
1678 fBlock[i] = 0; // rounding
1679 if (fabs(fBlockM2[i]) < 10.*std::numeric_limits<double>::epsilon())
1680 fBlockM2[i] = 0; // rounding
1681 }
1682 } else {
1683 QwWarning << "Running sum has deaccumulated to negative good events." << QwLog::endl;
1684 }
1685 } else if (n2 == 1) {
1686 // simple version for addition of single event
1688 fHardwareBlockSum += (M12 - M11) / n;
1689 fHardwareBlockSumM2 += (M12 - M11)
1690 * (M12 - fHardwareBlockSum); // note: using updated mean
1691 // and for individual blocks
1692 for (Int_t i = 0; i < 4; i++) {
1693 M11 = fBlock[i];
1694 M12 = value.fBlock[i];
1695 M22 = value.fBlockM2[i];
1696 fBlock[i] += (M12 - M11) / n;
1697 fBlockM2[i] += (M12 - M11) * (M12 - fBlock[i]); // note: using updated mean
1698 }
1699 } else if (n2 > 1) {
1700 // general version for addition of multi-event sets
1701 fGoodEventCount += n2;
1702 fHardwareBlockSum += n2 * (M12 - M11) / n;
1703 fHardwareBlockSumM2 += M22 + n1 * n2 * (M12 - M11) * (M12 - M11) / n;
1704 // and for individual blocks
1705 for (Int_t i = 0; i < 4; i++) {
1706 M11 = fBlock[i];
1707 M12 = value.fBlock[i];
1708 M22 = value.fBlockM2[i];
1709 fBlock[i] += n2 * (M12 - M11) / n;
1710 fBlockM2[i] += M22 + n1 * n2 * (M12 - M11) * (M12 - M11) / n;
1711 }
1712 }
1713
1714 // Nanny
1716 QwWarning << "Angry Nanny: NaN detected in " << GetElementName() << QwLog::endl;
1717}
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
static const UInt_t kPreserveError
Definition QwTypes.h:186
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Double_t fBlock[4]
Array of the sub-block data.
Double_t fBlockM2[4]
Second moment of the sub-block.
Double_t fHardwareBlockSum
Module-based sum of the four sub-blocks.
Double_t fHardwareBlockSumM2
Second moment of the hardware sum.
UInt_t fGoodEventCount
Number of good events accumulated in this element.
virtual const TString & GetElementName() const
Get the name of this element.
UInt_t fErrorFlag
This the standard error code generated for the channel that contains the global/local/stability flags...

References QwLog::endl(), fBlock, fBlockM2, VQwDataElement::fErrorFlag, VQwDataElement::fGoodEventCount, fHardwareBlockSum, fHardwareBlockSumM2, VQwDataElement::GetElementName(), kPreserveError, QwVQWK_Channel(), and QwWarning.

Referenced by AccumulateRunningSum(), and DeaccumulateRunningSum().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AccumulateRunningSum() [2/2]

void QwVQWK_Channel::AccumulateRunningSum ( const VQwHardwareChannel * value,
Int_t count = 0,
Int_t ErrorMask = 0xFFFFFFF )
inlineoverridevirtual

Reimplemented from VQwHardwareChannel.

Definition at line 194 of file QwVQWK_Channel.h.

194 {
195 const QwVQWK_Channel *tmp_ptr = dynamic_cast<const QwVQWK_Channel*>(value);
196 if (tmp_ptr != NULL) {
197 AccumulateRunningSum(*tmp_ptr, count, ErrorMask);
198 } else {
199 throw std::invalid_argument("Standard exception from QwVQWK_Channel::AccumulateRunningSum: incompatible hardware channel type");
200 }
201 };
void AccumulateRunningSum(const QwVQWK_Channel &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)

References AccumulateRunningSum(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ AddChannelOffset()

void QwVQWK_Channel::AddChannelOffset ( Double_t offset)

This function will add a offset to the hw_sum and add the same offset for blocks.

Definition at line 1490 of file QwVQWK_Channel.cc.

1491{
1492 if (!IsNameEmpty()){
1493 fHardwareBlockSum += offset;
1494 for (Int_t i=0; i<fBlocksPerEvent; i++)
1495 fBlock[i] += offset;
1496 }
1497 return;
1498}
Bool_t IsNameEmpty() const
Is the name of this element empty?

References fBlock, fBlocksPerEvent, fHardwareBlockSum, and VQwDataElement::IsNameEmpty().

+ Here is the call graph for this function:

◆ AddValueFrom()

void QwVQWK_Channel::AddValueFrom ( const VQwHardwareChannel * valueptr)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1184 of file QwVQWK_Channel.cc.

1185{
1186 const QwVQWK_Channel* tmpptr;
1187 tmpptr = dynamic_cast<const QwVQWK_Channel*>(valueptr);
1188 if (tmpptr!=NULL){
1189 *this += *tmpptr;
1190 } else {
1191 TString loc="Standard exception from QwVQWK_Channel::AddValueFrom = "
1192 +valueptr->GetElementName()+" is an incompatible type.";
1193 throw std::invalid_argument(loc.Data());
1194 }
1195}

References VQwDataElement::GetElementName(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ ApplyHWChecks()

Int_t QwVQWK_Channel::ApplyHWChecks ( )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 64 of file QwVQWK_Channel.cc.

65{
66 Bool_t fEventIsGood=kTRUE;
67 Bool_t bStatus;
68 if (bEVENTCUTMODE>0){//Global switch to ON/OFF event cuts set at the event cut file
69
70 if (bDEBUG)
71 QwWarning<<" QwQWVK_Channel "<<GetElementName()<<" "<<GetNumberOfSamples()<<QwLog::endl;
72
73 // Sample size check
74 bStatus = MatchNumberOfSamples(fNumberOfSamples_map);//compare the default sample size with no.of samples read by the module
75 if (!bStatus) {
77 }
78
79 // Check SW and HW return the same sum
80 bStatus = (GetRawHardwareSum() == GetRawSoftwareSum());
81 //fEventIsGood = bStatus;
82 if (!bStatus) {
84 }
85
86
87
88 //check sequence number
90 if (fSequenceNo_Counter==0 || GetSequenceNumber()==0){//starting the data run
92 }
93
94 if (!MatchSequenceNumber(fSequenceNo_Prev)){//we have a sequence number error
95 fEventIsGood=kFALSE;
97 if (bDEBUG) QwWarning<<" QwQWVK_Channel "<<GetElementName()<<" Sequence number previous value = "<<fSequenceNo_Prev<<" Current value= "<< GetSequenceNumber()<<QwLog::endl;
98 }
99
101
102 //Checking for HW_sum is returning same value.
104 //std::cout<<" BCM hardware sum is different "<<std::endl;
107 }else
108 fADC_Same_NumEvt++;//hw_sum is same increment the counter
109
110 //check for the hw_sum is giving the same value
111 if (fADC_Same_NumEvt>0){//we have ADC stuck with same value
112 if (bDEBUG) QwWarning<<" BCM hardware sum is same for more than "<<fADC_Same_NumEvt<<" time consecutively "<<QwLog::endl;
114 }
115
116 //check for the hw_sum is zero
117 if (GetRawHardwareSum()==0){
119 }
120 if (!fEventIsGood)
121 fSequenceNo_Counter=0;//resetting the counter after ApplyHWChecks() a failure
122
124 if (bDEBUG)
125 QwWarning << this->GetElementName()<<" "<<GetRawHardwareSum() << "Saturating VQWK invoked! " <<TMath::Abs(GetRawHardwareSum())*kVQWK_VoltsPerBit/fNumberOfSamples<<" Limit "<<GetVQWKSaturationLimt() << QwLog::endl;
127 }
128
129 }
130 else {
131 fGoodEventCount = 1;
132 fErrorFlag = 0;
133 }
134
135 return fErrorFlag;
136}
static const UInt_t kErrorFlag_ZeroHW
Definition QwTypes.h:164
static const UInt_t kErrorFlag_SW_HW
Definition QwTypes.h:161
static const UInt_t kErrorFlag_sample
Definition QwTypes.h:160
static const UInt_t kErrorFlag_VQWK_Sat
Definition QwTypes.h:159
static const UInt_t kErrorFlag_SameHW
Definition QwTypes.h:163
static const UInt_t kErrorFlag_Sequence
Definition QwTypes.h:162
Int_t fADC_Same_NumEvt
Keep track of how many events with same ADC value returned.
Bool_t MatchNumberOfSamples(size_t numsamp)
Double_t GetVQWKSaturationLimt()
UInt_t fNumberOfSamples
Number of samples read through the module.
Int_t GetRawSoftwareSum() const
Int_t fSequenceNo_Prev
Keep the sequence number of the last event.
Bool_t MatchSequenceNumber(size_t seqnum)
static const Bool_t bDEBUG
debugging display purposes
size_t GetSequenceNumber() const
Double_t fPrev_HardwareBlockSum
Previous Module-based sum of the four sub-blocks.
static const Double_t kVQWK_VoltsPerBit
Int_t fSequenceNo_Counter
Internal counter to keep track of the sequence number.
Int_t GetRawHardwareSum() const
size_t GetNumberOfSamples() const

References bDEBUG, VQwHardwareChannel::bEVENTCUTMODE, QwLog::endl(), fADC_Same_NumEvt, VQwDataElement::fErrorFlag, VQwDataElement::fGoodEventCount, fNumberOfSamples, fNumberOfSamples_map, fPrev_HardwareBlockSum, fSequenceNo_Counter, fSequenceNo_Prev, VQwDataElement::GetElementName(), GetNumberOfSamples(), GetRawHardwareSum(), GetRawSoftwareSum(), GetSequenceNumber(), GetVQWKSaturationLimt(), kErrorFlag_SameHW, kErrorFlag_sample, kErrorFlag_Sequence, kErrorFlag_SW_HW, kErrorFlag_VQWK_Sat, kErrorFlag_ZeroHW, kVQWK_VoltsPerBit, MatchNumberOfSamples(), MatchSequenceNumber(), and QwWarning.

+ Here is the call graph for this function:

◆ ApplySingleEventCuts() [1/2]

Bool_t QwVQWK_Channel::ApplySingleEventCuts ( )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1875 of file QwVQWK_Channel.cc.

1876{
1877 Bool_t status;
1878
1879 if (bEVENTCUTMODE>=2){//Global switch to ON/OFF event cuts set at the event cut file
1880
1881 if (fULimit < fLLimit){
1882 status=kTRUE;
1883 } else if (GetHardwareSum()<=fULimit && GetHardwareSum()>=fLLimit){
1884 if ((fErrorFlag)==0)
1885 status=kTRUE;
1886 else
1887 status=kFALSE;//If the device HW is failed
1888 }
1889 else{
1890 if (GetHardwareSum()> fULimit)
1892 else
1894 status=kFALSE;
1895 }
1896
1897 if (bEVENTCUTMODE==3){
1898 status=kTRUE; //Update the event cut fail flag but pass the event.
1899 }
1900
1901
1902 }
1903 else{
1904 status=kTRUE;
1905 //fErrorFlag=0;//we need to keep the device error codes
1906 }
1907
1908 return status;
1909}
static const UInt_t kErrorFlag_EventCut_L
Definition QwTypes.h:165
static const UInt_t kErrorFlag_EventCut_U
Definition QwTypes.h:166
Double_t GetHardwareSum() const

References VQwHardwareChannel::bEVENTCUTMODE, VQwDataElement::fErrorFlag, VQwHardwareChannel::fLLimit, VQwHardwareChannel::fULimit, GetHardwareSum(), kErrorFlag_EventCut_L, and kErrorFlag_EventCut_U.

+ Here is the call graph for this function:

◆ ApplySingleEventCuts() [2/2]

Bool_t QwVQWK_Channel::ApplySingleEventCuts ( Double_t LL,
Double_t UL )

Definition at line 1859 of file QwVQWK_Channel.cc.

1860{
1861 Bool_t status = kFALSE;
1862
1863 if (UL < LL){
1864 status=kTRUE;
1865 } else if (GetHardwareSum()<=UL && GetHardwareSum()>=LL){
1866 if ((fErrorFlag & kPreserveError)!=0)
1867 status=kTRUE;
1868 else
1869 status=kFALSE;//If the device HW is failed
1870 }
1871 std::cout<<(this->fErrorFlag & kPreserveError)<<std::endl;
1872 return status;
1873}

References VQwDataElement::fErrorFlag, GetHardwareSum(), and kPreserveError.

+ Here is the call graph for this function:

◆ ArcTan()

void QwVQWK_Channel::ArcTan ( const QwVQWK_Channel & value)

Definition at line 1452 of file QwVQWK_Channel.cc.

1453{
1454 if (!IsNameEmpty()) {
1455 this->fHardwareBlockSum = 0.0;
1456 for (Int_t i=0; i<fBlocksPerEvent; i++) {
1457 this->fBlock[i] = atan(value.fBlock[i]);
1458 this->fHardwareBlockSum += this->fBlock[i];
1459 }
1461 }
1462
1463 return;
1464}

References fBlock, fBlocksPerEvent, fHardwareBlockSum, VQwDataElement::IsNameEmpty(), and QwVQWK_Channel().

+ Here is the call graph for this function:

◆ AssignScaledValue()

void QwVQWK_Channel::AssignScaledValue ( const QwVQWK_Channel & value,
Double_t scale )

Definition at line 1152 of file QwVQWK_Channel.cc.

1154{
1155 if(this == &value) return;
1156
1157 if (!IsNameEmpty()) {
1158 for (Int_t i=0; i<fBlocksPerEvent; i++){
1159 this->fBlock[i] = value.fBlock[i] * scale;
1160 this->fBlockM2[i] = value.fBlockM2[i] * scale * scale;
1161 }
1162 this->fHardwareBlockSum = value.fHardwareBlockSum * scale;
1163 this->fHardwareBlockSumM2 = value.fHardwareBlockSumM2 * scale * scale;
1164 this->fHardwareBlockSumError = value.fHardwareBlockSumError; // Keep this?
1165 this->fGoodEventCount = value.fGoodEventCount;
1166 this->fNumberOfSamples = value.fNumberOfSamples;
1167 this->fSequenceNumber = value.fSequenceNumber;
1168 this->fErrorFlag = value.fErrorFlag;
1169 }
1170}
UInt_t fSequenceNumber
Event sequence number for this channel.
Double_t fHardwareBlockSumError
Uncertainty on the hardware sum.

References fBlock, fBlockM2, fBlocksPerEvent, VQwDataElement::fErrorFlag, VQwDataElement::fGoodEventCount, fHardwareBlockSum, fHardwareBlockSumError, fHardwareBlockSumM2, fNumberOfSamples, fSequenceNumber, VQwDataElement::IsNameEmpty(), and QwVQWK_Channel().

+ Here is the call graph for this function:

◆ AssignValueFrom()

void QwVQWK_Channel::AssignValueFrom ( const VQwDataElement * valueptr)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1172 of file QwVQWK_Channel.cc.

1173{
1174 const QwVQWK_Channel* tmpptr;
1175 tmpptr = dynamic_cast<const QwVQWK_Channel*>(valueptr);
1176 if (tmpptr!=NULL){
1177 *this = *tmpptr;
1178 } else {
1179 TString loc="Standard exception from QwVQWK_Channel::AssignValueFrom = "
1180 +valueptr->GetElementName()+" is an incompatible type.";
1181 throw std::invalid_argument(loc.Data());
1182 }
1183}

References VQwDataElement::GetElementName(), QwVQWK_Channel(), and VQwDataElement::VQwDataElement().

+ Here is the call graph for this function:

◆ Blind() [1/2]

void QwVQWK_Channel::Blind ( const QwBlinder * blinder)

Blind this channel as an asymmetry.

Blind this channel as an asymmetry

Parameters
blinderBlinder

Definition at line 1792 of file QwVQWK_Channel.cc.

1793{
1794 if (!IsNameEmpty()) {
1795 if (blinder->IsBlinderOkay() && ((fErrorFlag)==0) ){
1796 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1797 blinder->BlindValue(fBlock[i]);
1798 blinder->BlindValue(fHardwareBlockSum);
1799 } else {
1801 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1804 }
1805 }
1806 return;
1807}
const Bool_t & IsBlinderOkay() const
Definition QwBlinder.h:206
void ModifyThisErrorCode(UInt_t &errorcode) const
Definition QwBlinder.h:119
void BlindValue(Double_t &value) const
Asymmetry blinding.
Definition QwBlinder.h:124
static constexpr const Double_t kValue_BlinderFail
Definition QwBlinder.h:79

References QwBlinder::BlindValue(), fBlock, fBlocksPerEvent, VQwDataElement::fErrorFlag, fHardwareBlockSum, QwBlinder::IsBlinderOkay(), VQwDataElement::IsNameEmpty(), QwBlinder::kValue_BlinderFail, and QwBlinder::ModifyThisErrorCode().

+ Here is the call graph for this function:

◆ Blind() [2/2]

void QwVQWK_Channel::Blind ( const QwBlinder * blinder,
const QwVQWK_Channel & yield )

Blind this channel as a difference.

Blind this channel as a difference with specified yield

Parameters
blinderBlinder
yieldCorresponding yield

Definition at line 1814 of file QwVQWK_Channel.cc.

1815{
1816 if (!IsNameEmpty()) {
1817 if (blinder->IsBlinderOkay() && ((fErrorFlag) ==0) ){
1818 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1819 blinder->BlindValue(fBlock[i], yield.fBlock[i]);
1821 } else {
1822 blinder->ModifyThisErrorCode(fErrorFlag);//update the HW error code
1823 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1826 }
1827 }
1828 return;
1829}

References QwBlinder::BlindValue(), fBlock, fBlocksPerEvent, VQwDataElement::fErrorFlag, fHardwareBlockSum, QwBlinder::IsBlinderOkay(), VQwDataElement::IsNameEmpty(), QwBlinder::kValue_BlinderFail, QwBlinder::ModifyThisErrorCode(), and QwVQWK_Channel().

+ Here is the call graph for this function:

◆ CalculateRunningAverage()

void QwVQWK_Channel::CalculateRunningAverage ( )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1720 of file QwVQWK_Channel.cc.

1721{
1722 if (fGoodEventCount <= 0)
1723 {
1724 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
1725 fBlockError[i] = 0.0;
1726 }
1728 }
1729 else
1730 {
1731 // We use a biased estimator by dividing by n. Use (n - 1) to get the
1732 // unbiased estimator for the standard deviation.
1733 //
1734 // Note we want to calculate the error here, not sigma:
1735 // sigma = sqrt(M2 / n);
1736 // error = sigma / sqrt (n) = sqrt(M2) / n;
1737 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1738 fBlockError[i] = sqrt(fBlockM2[i]) / fGoodEventCount;
1740
1741 // Stability check 83951872
1743 // check to see the channel has stability cut activated in the event cut file
1744 if (GetValueWidth() > fStability){
1745 // if the width is greater than the stability required flag the event
1747 } else
1748 fErrorFlag = 0;
1749 }
1750 }
1751}
static const UInt_t kBeamStabilityError
Definition QwTypes.h:180
static const UInt_t kStabilityCut
Definition QwTypes.h:184
Double_t fBlockError[4]
Uncertainty on the sub-block.
Double_t GetValueWidth() const
UInt_t fErrorConfigFlag
contains the global/local/stability flags

References fBlockError, fBlockM2, fBlocksPerEvent, VQwDataElement::fErrorConfigFlag, VQwDataElement::fErrorFlag, VQwDataElement::fGoodEventCount, fHardwareBlockSumError, fHardwareBlockSumM2, VQwHardwareChannel::fStability, GetValueWidth(), kBeamStabilityError, and kStabilityCut.

+ Here is the call graph for this function:

◆ ClearEventData()

void QwVQWK_Channel::ClearEventData ( )
overridevirtual

Clear the event data in this element.

Reimplemented from VQwDataElement.

Definition at line 249 of file QwVQWK_Channel.cc.

250{
251 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
252 fBlock_raw[i] = 0;
253 fBlock[i] = 0.0;
254 fBlockM2[i] = 0.0;
255 fBlockError[i] = 0.0;
256 }
259 fHardwareBlockSum = 0.0;
262 fSequenceNumber = 0;
264 fGoodEventCount = 0;
265 fErrorFlag=0;
266 return;
267}
Int_t fHardwareBlockSum_raw
Module-based sum of the four sub-blocks as read from the module.
Int_t fSoftwareBlockSum_raw
Sum of the data in the four sub-blocks raw.
Int_t fBlock_raw[4]
Array of the sub-block data as read from the module.

References fBlock, fBlock_raw, fBlockError, fBlockM2, fBlocksPerEvent, VQwDataElement::fErrorFlag, VQwDataElement::fGoodEventCount, fHardwareBlockSum, fHardwareBlockSum_raw, fHardwareBlockSumError, fHardwareBlockSumM2, fNumberOfSamples, fSequenceNumber, and fSoftwareBlockSum_raw.

Referenced by InitializeChannel(), QwLinearDiodeArray::ProcessEvent(), and QwQPD::ProcessEvent().

+ Here is the caller graph for this function:

◆ Clone() [1/2]

virtual VQwHardwareChannel * VQwHardwareChannel::Clone ( ) const
inlinevirtual

Reimplemented from VQwHardwareChannel.

Definition at line 112 of file VQwHardwareChannel.h.

112 {
113 return Clone(this->fDataToSave);
114 };
virtual VQwHardwareChannel * Clone() const

◆ Clone() [2/2]

VQwHardwareChannel * QwVQWK_Channel::Clone ( VQwDataElement::EDataToSave datatosave) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 112 of file QwVQWK_Channel.h.

112 {
113 return new QwVQWK_Channel(*this,datatosave);
114 };

References QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ ConstructBranch()

void QwVQWK_Channel::ConstructBranch ( TTree * tree,
TString & prefix )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 826 of file QwVQWK_Channel.cc.

827{
828 // This channel is not used, so skip setting up the tree.
829 if (IsNameEmpty()) return;
830
831 TString basename = prefix + GetElementName();
832 tree->Branch(basename,&fHardwareBlockSum,basename+"/D");
833 if (kDEBUG){
834 std::cerr << "QwVQWK_Channel::ConstructBranchAndVector: fTreeArrayIndex==" << fTreeArrayIndex
835 << "; fTreeArrayNumEntries==" << fTreeArrayNumEntries
836 << std::endl;
837 }
838}
static const Bool_t kDEBUG

References fHardwareBlockSum, VQwHardwareChannel::fTreeArrayIndex, VQwHardwareChannel::fTreeArrayNumEntries, VQwDataElement::GetElementName(), VQwDataElement::IsNameEmpty(), and kDEBUG.

+ Here is the call graph for this function:

◆ ConstructBranchAndVector()

void QwVQWK_Channel::ConstructBranchAndVector ( TTree * tree,
TString & prefix,
QwRootTreeBranchVector & values )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 742 of file QwVQWK_Channel.cc.

743{
744 // This channel is not used, so skip setting up the tree.
745 if (IsNameEmpty()) return;
746
747 // Decide what to store based on prefix
748 SetDataToSaveByPrefix(prefix);
749
750 TString basename = prefix(0, (prefix.First("|") >= 0)? prefix.First("|"): prefix.Length()) + GetElementName();
751 fTreeArrayIndex = values.size();
752
758 bDevice_Error_Code = gQwHists.MatchVQWKElementFromList(GetSubsystemName().Data(), GetModuleType().Data(), "Device_Error_Code");
760
761 if (bHw_sum) {
762 values.push_back("hw_sum", 'I');
763 if (fDataToSave == kMoments) {
764 values.push_back("hw_sum_m2", 'D');
765 values.push_back("hw_sum_err", 'D');
766 }
767 }
768
769 if (bBlock) {
770 values.push_back("block0", 'D');
771 values.push_back("block1", 'D');
772 values.push_back("block2", 'D');
773 values.push_back("block3", 'D');
774 }
775
776 if (bNum_samples) {
777 values.push_back("num_samples", 'I');
778 }
779
780 if (bDevice_Error_Code) {
781 values.push_back("Device_Error_Code", 'i');
782 }
783
784 if (fDataToSave == kRaw) {
785 if (bHw_sum_raw) {
786 values.push_back("hw_sum_raw", 'I');
787 }
788 if (bBlock_raw) {
789 values.push_back("block0_raw", 'I');
790 values.push_back("block1_raw", 'I');
791 values.push_back("block2_raw", 'I');
792 values.push_back("block3_raw", 'I');
793 }
794 if (bSequence_number) {
795 values.push_back("sequence_number", 'i');
796 }
797 }
798
800
801 std::string leaf_list = values.LeafList();
802
803 if (gQwHists.MatchDeviceParamsFromList(basename.Data())
806
807 // This is for the RT mode
808 if (leaf_list == "hw_sum/D")
809 leaf_list = basename+"/D";
810
811 if (kDEBUG)
812 QwMessage << "base name " << basename << " List " << leaf_list << QwLog::endl;
813
814 tree->Branch(basename, &(values[fTreeArrayIndex]), leaf_list.c_str());
815 }
816
817 if (kDEBUG) {
818 std::cerr << "QwVQWK_Channel::ConstructBranchAndVector: fTreeArrayIndex==" << fTreeArrayIndex
819 << "; fTreeArrayNumEntries==" << fTreeArrayNumEntries
820 << "; values.size()==" << values.size()
821 << "; list==" << leaf_list
822 << std::endl;
823 }
824}
QwHistogramHelper gQwHists
Globally defined instance of the QwHistogramHelper class.
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
Bool_t MatchVQWKElementFromList(const std::string &subsystemname, const std::string &moduletype, const std::string &devicename)
Bool_t MatchDeviceParamsFromList(const std::string &devicename)
size_type size() const noexcept
Definition QwRootFile.h:81
std::string LeafList(size_type start_index=0) const
Definition QwRootFile.h:228
void push_back(const std::string &name, const char type='D')
Definition QwRootFile.h:195
Bool_t bDevice_Error_Code
TString GetSubsystemName() const
Return the name of the inheriting subsystem name.
TString GetModuleType() const
Return the type of the beam instrument.
void SetDataToSaveByPrefix(const TString &prefix)
Set the flag indicating if raw or derived values are in this data element based on prefix.

References bBlock, bBlock_raw, bDevice_Error_Code, bHw_sum, bHw_sum_raw, bNum_samples, bSequence_number, QwLog::endl(), VQwHardwareChannel::fDataToSave, VQwHardwareChannel::fTreeArrayIndex, VQwHardwareChannel::fTreeArrayNumEntries, VQwDataElement::GetElementName(), VQwDataElement::GetModuleType(), VQwDataElement::GetSubsystemName(), gQwHists, VQwDataElement::IsNameEmpty(), kDEBUG, VQwDataElement::kMoments, VQwDataElement::kRaw, QwRootTreeBranchVector::LeafList(), QwRootTreeBranchVector::push_back(), QwMessage, VQwHardwareChannel::SetDataToSaveByPrefix(), and QwRootTreeBranchVector::size().

+ Here is the call graph for this function:

◆ ConstructHistograms()

void QwVQWK_Channel::ConstructHistograms ( TDirectory * folder,
TString & prefix )
overridevirtual

Construct the histograms for this data element.

Implements VQwDataElement.

Definition at line 636 of file QwVQWK_Channel.cc.

637{
638 // If we have defined a subdirectory in the ROOT file, then change into it.
639 if (folder != NULL) folder->cd();
640
641 if (IsNameEmpty()){
642 // This channel is not used, so skip filling the histograms.
643 } else {
644 // Now create the histograms.
645 SetDataToSaveByPrefix(prefix);
646
647 TString basename = prefix + GetElementName();
648
649 if(fDataToSave==kRaw)
650 {
651 fHistograms.resize(8+2+1, NULL);
652 size_t index=0;
653 for (Int_t i=0; i<fBlocksPerEvent; i++){
654 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_block%d_raw",i));
655 fHistograms[index+1] = gQwHists.Construct1DHist(basename+Form("_block%d",i));
656 index += 2;
657 }
658 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_hw_raw"));
659 fHistograms[index+1] = gQwHists.Construct1DHist(basename+Form("_hw"));
660 index += 2;
661 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_sw-hw_raw"));
662 }
663 else if(fDataToSave==kDerived)
664 {
665 fHistograms.resize(4+1+1, NULL);
666 Int_t index=0;
667 for (Int_t i=0; i<fBlocksPerEvent; i++){
668 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_block%d",i));
669 index += 1;
670 }
671 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_hw"));
672 index += 1;
673 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_dev_err"));
674 index += 1;
675 }
676 else
677 {
678 // this is not recognized
679 }
680
681 }
682}
std::vector< TH1_ptr > fHistograms
Histograms associated with this data element.
TH1F * Construct1DHist(const TString &inputfile, const TString &name_title)

References fBlocksPerEvent, VQwHardwareChannel::fDataToSave, MQwHistograms::fHistograms, VQwDataElement::GetElementName(), gQwHists, VQwDataElement::IsNameEmpty(), VQwDataElement::kDerived, VQwDataElement::kRaw, and VQwHardwareChannel::SetDataToSaveByPrefix().

+ Here is the call graph for this function:

◆ CopyFrom()

void QwVQWK_Channel::CopyFrom ( const QwVQWK_Channel & value)
inline

Definition at line 102 of file QwVQWK_Channel.h.

102 {
107 *this = value;
108 };
void CopyFrom(const VQwHardwareChannel &value)

References VQwHardwareChannel::CopyFrom(), fBlocksPerEvent, fNumberOfSamples_map, fSaturationABSLimit, and QwVQWK_Channel().

+ Here is the call graph for this function:

◆ DeaccumulateRunningSum() [1/2]

void QwVQWK_Channel::DeaccumulateRunningSum ( const QwVQWK_Channel & value,
Int_t ErrorMask = 0xFFFFFFF )
inline

Definition at line 203 of file QwVQWK_Channel.h.

203 {
204 AccumulateRunningSum(value, -1, ErrorMask);
205 };

References AccumulateRunningSum(), and QwVQWK_Channel().

+ Here is the call graph for this function:

◆ DeaccumulateRunningSum() [2/2]

virtual void VQwHardwareChannel::DeaccumulateRunningSum ( const VQwHardwareChannel * value,
Int_t ErrorMask = 0xFFFFFFF )
inlinevirtual

Reimplemented from VQwHardwareChannel.

Definition at line 255 of file VQwHardwareChannel.h.

255 {
256 AccumulateRunningSum(value, -1, ErrorMask);
257 };

◆ Difference()

void QwVQWK_Channel::Difference ( const QwVQWK_Channel & value1,
const QwVQWK_Channel & value2 )

Definition at line 1372 of file QwVQWK_Channel.cc.

1373{
1374 *this = value1;
1375 *this -= value2;
1376}

References QwVQWK_Channel().

Referenced by QwQPD::ProcessEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DivideBy() [1/2]

void QwVQWK_Channel::DivideBy ( const QwVQWK_Channel & denom)

Definition at line 1513 of file QwVQWK_Channel.cc.

1514{
1515 *this /= denom;
1516}

References QwVQWK_Channel().

+ Here is the call graph for this function:

◆ DivideBy() [2/2]

void QwVQWK_Channel::DivideBy ( const VQwHardwareChannel * valueptr)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1220 of file QwVQWK_Channel.cc.

1221{
1222 const QwVQWK_Channel* tmpptr;
1223 tmpptr = dynamic_cast<const QwVQWK_Channel*>(valueptr);
1224 if (tmpptr!=NULL){
1225 *this /= *tmpptr;
1226 } else {
1227 TString loc="Standard exception from QwVQWK_Channel::DivideBy = "
1228 +valueptr->GetElementName()+" is an incompatible type.";
1229 throw std::invalid_argument(loc.Data());
1230 }
1231}

References VQwDataElement::GetElementName(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ EncodeEventData()

void QwVQWK_Channel::EncodeEventData ( std::vector< UInt_t > & buffer)
overridevirtual

Encode the event data into a CODA buffer.

Implements MQwMockable.

Definition at line 442 of file QwVQWK_Channel.cc.

443{
444 Long_t localbuf[6] = {0};
445
446 if (IsNameEmpty()) {
447 // This channel is not used, but is present in the data stream.
448 // Skip over this data.
449 } else {
450 // localbuf[4] = 0;
451 for (Int_t i = 0; i < 4; i++) {
452 localbuf[i] = fBlock_raw[i];
453 // localbuf[4] += localbuf[i]; // fHardwareBlockSum_raw
454 }
455 // The following causes many rounding errors and skips due to the check
456 // that fHardwareBlockSum_raw == fSoftwareBlockSum_raw in IsGoodEvent().
457 localbuf[4] = fHardwareBlockSum_raw;
458 localbuf[5] = (fNumberOfSamples << 16 & 0xFFFF0000)
459 | (fSequenceNumber << 8 & 0x0000FF00);
460
461 for (Int_t i = 0; i < 6; i++){
462 buffer.push_back(localbuf[i]);
463 }
464 }
465}

References fBlock_raw, fHardwareBlockSum_raw, fNumberOfSamples, fSequenceNumber, and VQwDataElement::IsNameEmpty().

+ Here is the call graph for this function:

◆ FillHistograms()

void QwVQWK_Channel::FillHistograms ( )
overridevirtual

Fill the histograms for this data element.

Implements VQwDataElement.

Definition at line 684 of file QwVQWK_Channel.cc.

685{
686 Int_t index=0;
687
688 if (IsNameEmpty())
689 {
690 // This channel is not used, so skip creating the histograms.
691 } else
692 {
693 if(fDataToSave==kRaw)
694 {
695 for (Int_t i=0; i<fBlocksPerEvent; i++)
696 {
697 if (fHistograms[index] != NULL && (fErrorFlag)==0)
698 fHistograms[index]->Fill(this->GetRawBlockValue(i));
699 if (fHistograms[index+1] != NULL && (fErrorFlag)==0)
700 fHistograms[index+1]->Fill(this->GetBlockValue(i));
701 index+=2;
702 }
703 if (fHistograms[index] != NULL && (fErrorFlag)==0)
704 fHistograms[index]->Fill(this->GetRawHardwareSum());
705 if (fHistograms[index+1] != NULL && (fErrorFlag)==0)
706 fHistograms[index+1]->Fill(this->GetHardwareSum());
707 index+=2;
708 if (fHistograms[index] != NULL && (fErrorFlag)==0)
709 fHistograms[index]->Fill(this->GetRawSoftwareSum()-this->GetRawHardwareSum());
710 }
711 else if(fDataToSave==kDerived)
712 {
713 for (Int_t i=0; i<fBlocksPerEvent; i++)
714 {
715 if (fHistograms[index] != NULL && (fErrorFlag)==0)
716 fHistograms[index]->Fill(this->GetBlockValue(i));
717 index+=1;
718 }
719 if (fHistograms[index] != NULL && (fErrorFlag)==0)
720 fHistograms[index]->Fill(this->GetHardwareSum());
721 index+=1;
722 if (fHistograms[index] != NULL){
724 fHistograms[index]->Fill(kErrorFlag_sample);
726 fHistograms[index]->Fill(kErrorFlag_SW_HW);
728 fHistograms[index]->Fill(kErrorFlag_Sequence);
730 fHistograms[index]->Fill(kErrorFlag_ZeroHW);
732 fHistograms[index]->Fill(kErrorFlag_VQWK_Sat);
734 fHistograms[index]->Fill(kErrorFlag_SameHW);
735 }
736
737 }
738
739 }
740}
Int_t GetRawBlockValue(size_t blocknum) const
Double_t GetBlockValue(size_t blocknum) const

References fBlocksPerEvent, VQwHardwareChannel::fDataToSave, VQwDataElement::fErrorFlag, MQwHistograms::fHistograms, GetBlockValue(), GetHardwareSum(), GetRawBlockValue(), GetRawHardwareSum(), GetRawSoftwareSum(), VQwDataElement::IsNameEmpty(), VQwDataElement::kDerived, kErrorFlag_SameHW, kErrorFlag_sample, kErrorFlag_Sequence, kErrorFlag_SW_HW, kErrorFlag_VQWK_Sat, kErrorFlag_ZeroHW, and VQwDataElement::kRaw.

+ Here is the call graph for this function:

◆ FillTreeVector()

void QwVQWK_Channel::FillTreeVector ( QwRootTreeBranchVector & values) const
overridevirtual

Implements VQwHardwareChannel.

Definition at line 841 of file QwVQWK_Channel.cc.

842{
843 if (IsNameEmpty()) {
844 // This channel is not used, so skip filling the tree vector.
845 } else if (fTreeArrayNumEntries <= 0) {
846 if (bDEBUG) std::cerr << "QwVQWK_Channel::FillTreeVector: fTreeArrayNumEntries=="
847 << fTreeArrayNumEntries << std::endl;
848 } else if (values.size() < fTreeArrayIndex+fTreeArrayNumEntries){
849 if (bDEBUG) std::cerr << "QwVQWK_Channel::FillTreeVector: values.size()=="
850 << values.size()
851 << "; fTreeArrayIndex+fTreeArrayNumEntries=="
853 << std::endl;
854 } else {
855
856 UInt_t index = fTreeArrayIndex;
857
858 // hw_sum
859 if (bHw_sum) {
860 //values.SetValue(fTreeArrayIndex, "hw_sum"_h32, this->GetHardwareSum());
861 values.SetValue(index++, this->GetHardwareSum());
862 if (fDataToSave == kMoments) {
863 values.SetValue(index++, this->GetHardwareSumM2());
864 values.SetValue(index++, this->GetHardwareSumError());
865 }
866 }
867
868 if (bBlock) {
869 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
870 // blocki
871 values.SetValue(index++, this->GetBlockValue(i));
872 }
873 }
874
875 // num_samples
876 if (bNum_samples)
877 values.SetValue(index++, (fDataToSave == kMoments)? this->fGoodEventCount: this->fNumberOfSamples);
878
879 // Device_Error_Code
881 values.SetValue(index++, this->fErrorFlag);
882
883 if (fDataToSave == kRaw)
884 {
885 // hw_sum_raw
886 if (bHw_sum_raw)
887 values.SetValue(index++, this->GetRawHardwareSum());
888
889 if (bBlock_raw) {
890 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
891 // blocki_raw
892 values.SetValue(index++, this->GetRawBlockValue(i));
893 }
894 }
895
896 // sequence_number
898 values.SetValue(index++, this->fSequenceNumber);
899 }
900 }
901}
void SetValue(size_type index, Double_t val)
Definition QwRootFile.h:108
Double_t GetHardwareSumM2() const
Double_t GetHardwareSumError() const

References bBlock, bBlock_raw, bDEBUG, bDevice_Error_Code, bHw_sum, bHw_sum_raw, bNum_samples, bSequence_number, fBlocksPerEvent, VQwHardwareChannel::fDataToSave, VQwDataElement::fErrorFlag, VQwDataElement::fGoodEventCount, fNumberOfSamples, fSequenceNumber, VQwHardwareChannel::fTreeArrayIndex, VQwHardwareChannel::fTreeArrayNumEntries, GetBlockValue(), GetHardwareSum(), GetHardwareSumError(), GetHardwareSumM2(), GetRawBlockValue(), GetRawHardwareSum(), VQwDataElement::IsNameEmpty(), VQwDataElement::kMoments, VQwDataElement::kRaw, QwRootTreeBranchVector::SetValue(), and QwRootTreeBranchVector::size().

+ Here is the call graph for this function:

◆ ForceMapfileSampleSize()

void QwVQWK_Channel::ForceMapfileSampleSize ( )
inline

Forces the event "number of samples" variable to be what was expected from the mapfile. NOTE: this should only be used in mock data generation!

Definition at line 137 of file QwVQWK_Channel.h.

References fNumberOfSamples, and fNumberOfSamples_map.

◆ GetAverageVolts()

Double_t QwVQWK_Channel::GetAverageVolts ( ) const

Definition at line 597 of file QwVQWK_Channel.cc.

598{
599 //Double_t avgVolts = (fBlock[0]+fBlock[1]+fBlock[2]+fBlock[3])*kVQWK_VoltsPerBit/fNumberOfSamples;
601 //std::cout<<"QwVQWK_Channel::GetAverageVolts() = "<<avgVolts<<std::endl;
602 return avgVolts;
603
604}

References fHardwareBlockSum, fNumberOfSamples, and kVQWK_VoltsPerBit.

◆ GetBlockErrorValue()

Double_t QwVQWK_Channel::GetBlockErrorValue ( size_t blocknum) const
inlineprivate

Definition at line 304 of file QwVQWK_Channel.h.

304{ return GetValueError(blocknum+1);};
Double_t GetValueError() const

References GetValueError().

Referenced by PrintValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBlockValue()

Double_t QwVQWK_Channel::GetBlockValue ( size_t blocknum) const
inlineprivate

Definition at line 303 of file QwVQWK_Channel.h.

303{ return GetValue(blocknum+1);};
Double_t GetValue() const

References GetValue().

Referenced by FillHistograms(), FillTreeVector(), and PrintValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBufferOffset()

Int_t QwVQWK_Channel::GetBufferOffset ( Int_t moduleindex,
Int_t channelindex )
static

Class: QwVQWK_Channel Base class containing decoding functions for the VQWK_Channel 6 32-bit datawords. The functions in this class will decode a single channel worth of VQWK_Channel data and provide the components through member functions.

Static member function to return the word offset within a data buffer given the module number index and the channel number index.

Parameters
moduleindexModule index within this buffer; counts from zero
channelindexChannel index within this module; counts from zero
Returns
The number of words offset to the beginning of this channel's data from the beginning of the VQWK buffer.

Definition at line 43 of file QwVQWK_Channel.cc.

43 {
44 Int_t offset = -1;
45 if (moduleindex<0 ){
46 QwError << "QwVQWK_Channel::GetBufferOffset: Invalid module index,"
47 << moduleindex
48 << ". Must be zero or greater."
49 << QwLog::endl;
50 } else if (channelindex<0 || channelindex>kMaxChannels){
51 QwError << "QwVQWK_Channel::GetBufferOffset: Invalid channel index,"
52 << channelindex
53 << ". Must be in range [0," << kMaxChannels << "]."
54 << QwLog::endl;
55 } else {
56 offset = ( (moduleindex * kMaxChannels) + channelindex )
58 }
59 return offset;
60 }
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
static const Int_t kWordsPerChannel
static const Int_t kMaxChannels

References QwLog::endl(), kMaxChannels, kWordsPerChannel, and QwError.

Referenced by QwBeamDetectorID::QwBeamDetectorID(), and QwModChannelID::QwModChannelID().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetHardwareSum()

Double_t QwVQWK_Channel::GetHardwareSum ( ) const
inlineprivate

Definition at line 306 of file QwVQWK_Channel.h.

306{ return GetValue(0);};

References GetValue().

Referenced by ApplySingleEventCuts(), ApplySingleEventCuts(), FillHistograms(), FillTreeVector(), operator<<, and PrintValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetHardwareSumError()

Double_t QwVQWK_Channel::GetHardwareSumError ( ) const
inlineprivate

Definition at line 309 of file QwVQWK_Channel.h.

309{ return GetValueError(0); };

References GetValueError().

Referenced by FillTreeVector(), and PrintValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetHardwareSumM2()

Double_t QwVQWK_Channel::GetHardwareSumM2 ( ) const
inlineprivate

Definition at line 307 of file QwVQWK_Channel.h.

307{ return GetValueM2(0); };
Double_t GetValueM2() const

References GetValueM2().

Referenced by FillTreeVector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetHardwareSumWidth()

Double_t QwVQWK_Channel::GetHardwareSumWidth ( ) const
inlineprivate

Definition at line 308 of file QwVQWK_Channel.h.

308{ return GetValueWidth(0); };

References GetValueWidth().

Referenced by PrintValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetNumberOfSamples()

size_t QwVQWK_Channel::GetNumberOfSamples ( ) const
inline

Definition at line 276 of file QwVQWK_Channel.h.

276{return (fNumberOfSamples);};

References fNumberOfSamples.

Referenced by ApplyHWChecks().

+ Here is the caller graph for this function:

◆ GetRawBlockValue()

Int_t QwVQWK_Channel::GetRawBlockValue ( size_t blocknum) const
inlineprivate

Definition at line 312 of file QwVQWK_Channel.h.

312{return GetRawValue(blocknum+1);};
Int_t GetRawValue() const

References GetRawValue().

Referenced by FillHistograms(), and FillTreeVector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetRawHardwareSum()

Int_t QwVQWK_Channel::GetRawHardwareSum ( ) const
inlineprivate

Definition at line 313 of file QwVQWK_Channel.h.

313{ return GetRawValue(0);};

References GetRawValue().

Referenced by ApplyHWChecks(), FillHistograms(), and FillTreeVector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetRawSoftwareSum()

Int_t QwVQWK_Channel::GetRawSoftwareSum ( ) const
inlineprivate

Definition at line 314 of file QwVQWK_Channel.h.

314{return fSoftwareBlockSum_raw;};

References fSoftwareBlockSum_raw.

Referenced by ApplyHWChecks(), and FillHistograms().

+ Here is the caller graph for this function:

◆ GetRawValue() [1/2]

Int_t VQwHardwareChannel::GetRawValue ( ) const
inline

Definition at line 125 of file VQwHardwareChannel.h.

125{return this->GetRawValue(0);};

Referenced by GetRawBlockValue(), and GetRawHardwareSum().

+ Here is the caller graph for this function:

◆ GetRawValue() [2/2]

Int_t QwVQWK_Channel::GetRawValue ( size_t element) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 251 of file QwVQWK_Channel.h.

251 {
252 RangeCheck(element);
253 if (element==0) return fHardwareBlockSum_raw;
254 return fBlock_raw[element-1];
255 }
void RangeCheck(size_t element) const
Checks that the requested element is in range, to be used in accesses to subelements similar to std::...

References fBlock_raw, fHardwareBlockSum_raw, and VQwHardwareChannel::RangeCheck().

+ Here is the call graph for this function:

◆ GetSequenceNumber()

size_t QwVQWK_Channel::GetSequenceNumber ( ) const
inline

Definition at line 275 of file QwVQWK_Channel.h.

275{return (fSequenceNumber);};

References fSequenceNumber.

Referenced by ApplyHWChecks().

+ Here is the caller graph for this function:

◆ GetValue() [1/2]

Double_t VQwHardwareChannel::GetValue ( ) const
inline

Definition at line 126 of file VQwHardwareChannel.h.

126{return this->GetValue(0);};

Referenced by GetBlockValue(), and GetHardwareSum().

+ Here is the caller graph for this function:

◆ GetValue() [2/2]

Double_t QwVQWK_Channel::GetValue ( size_t element) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 256 of file QwVQWK_Channel.h.

256 {
257 RangeCheck(element);
258 if (element==0) return fHardwareBlockSum;
259 return fBlock[element-1];
260 }

References fBlock, fHardwareBlockSum, and VQwHardwareChannel::RangeCheck().

Referenced by QwQPD::ProcessEvent(), and QwBlinder::Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetValueError() [1/2]

Double_t VQwHardwareChannel::GetValueError ( ) const
inline

Definition at line 128 of file VQwHardwareChannel.h.

128{return this->GetValueError(0);};

Referenced by GetBlockErrorValue(), and GetHardwareSumError().

+ Here is the caller graph for this function:

◆ GetValueError() [2/2]

Double_t QwVQWK_Channel::GetValueError ( size_t element) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 266 of file QwVQWK_Channel.h.

266 {
267 RangeCheck(element);
268 if (element==0) return fHardwareBlockSumError;
269 return fBlockError[element-1];
270 }

References fBlockError, fHardwareBlockSumError, and VQwHardwareChannel::RangeCheck().

+ Here is the call graph for this function:

◆ GetValueM2() [1/2]

Double_t VQwHardwareChannel::GetValueM2 ( ) const
inline

Definition at line 127 of file VQwHardwareChannel.h.

127{return this->GetValueM2(0);};

Referenced by GetHardwareSumM2().

+ Here is the caller graph for this function:

◆ GetValueM2() [2/2]

Double_t QwVQWK_Channel::GetValueM2 ( size_t element) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 261 of file QwVQWK_Channel.h.

261 {
262 RangeCheck(element);
263 if (element==0) return fHardwareBlockSumM2;
264 return fBlockM2[element-1];
265 }

References fBlockM2, fHardwareBlockSumM2, and VQwHardwareChannel::RangeCheck().

+ Here is the call graph for this function:

◆ GetValueWidth() [1/2]

Double_t VQwHardwareChannel::GetValueWidth ( ) const
inline

Definition at line 129 of file VQwHardwareChannel.h.

129{return this->GetValueWidth(0);};

Referenced by CalculateRunningAverage(), and GetHardwareSumWidth().

+ Here is the caller graph for this function:

◆ GetValueWidth() [2/2]

Double_t VQwHardwareChannel::GetValueWidth ( size_t element) const
inline

Definition at line 134 of file VQwHardwareChannel.h.

134 {
135 RangeCheck(element);
136 Double_t width;
137 if (fGoodEventCount>0){
138 width = (GetValueError(element)*std::sqrt(Double_t(fGoodEventCount)));
139 } else {
140 width = 0.0;
141 }
142 return width;
143 };

◆ GetVQWKSaturationLimt()

Double_t QwVQWK_Channel::GetVQWKSaturationLimt ( )
inline

Definition at line 227 of file QwVQWK_Channel.h.

227 {//Get the absolute staturation limit in volts.
228 return fSaturationABSLimit;
229 }

References fSaturationABSLimit.

Referenced by ApplyHWChecks().

+ Here is the caller graph for this function:

◆ IncrementErrorCounters()

void QwVQWK_Channel::IncrementErrorCounters ( )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 140 of file QwVQWK_Channel.cc.

140 {
142 fErrorCount_sample++; //increment the hw error counter
144 fErrorCount_SW_HW++; //increment the hw error counter
146 fErrorCount_Sequence++; //increment the hw error counter
148 fErrorCount_SameHW++; //increment the hw error counter
150 fErrorCount_ZeroHW++; //increment the hw error counter
152 fErrorCount_HWSat++; //increment the hw saturation error counter
155 fNumEvtsWithEventCutsRejected++; //increment the event cut error counter
156 }
157}
Int_t fErrorCount_ZeroHW
check to see ADC returning zero
Int_t fErrorCount_sample
for sample size check
Int_t fErrorCount_Sequence
sequence number check
Int_t fErrorCount_SameHW
check to see ADC returning same HW value
Int_t fErrorCount_HWSat
check to see ADC channel is saturated
Int_t fErrorCount_SW_HW
HW_sum==SW_sum check.
Int_t fNumEvtsWithEventCutsRejected
Counts the Event cut rejected events.

References fErrorCount_HWSat, fErrorCount_SameHW, fErrorCount_sample, fErrorCount_Sequence, fErrorCount_SW_HW, fErrorCount_ZeroHW, VQwDataElement::fErrorFlag, fNumEvtsWithEventCutsRejected, kErrorFlag_EventCut_L, kErrorFlag_EventCut_U, kErrorFlag_SameHW, kErrorFlag_sample, kErrorFlag_Sequence, kErrorFlag_SW_HW, kErrorFlag_VQWK_Sat, and kErrorFlag_ZeroHW.

◆ InitializeChannel() [1/2]

void QwVQWK_Channel::InitializeChannel ( TString name,
TString datatosave )
overridevirtual

Initialize the fields in this object.

Implements VQwHardwareChannel.

Definition at line 161 of file QwVQWK_Channel.cc.

162{
163 SetElementName(name);
164 SetDataToSave(datatosave);
167
168 kFoundPedestal = 0;
169 kFoundGain = 0;
170
171 fPedestal = 0.0;
172 fCalibrationFactor = 1.0;
173
174 fBlocksPerEvent = 4;
175
176 fTreeArrayIndex = 0;
178
180
184
185 // Use internal random variable by default
187
188 // Mock drifts
189 fMockDriftAmplitude.clear();
190 fMockDriftFrequency.clear();
191 fMockDriftPhase.clear();
192
193 // Mock asymmetries
194 fMockAsymmetry = 0.0;
195 fMockGaussianMean = 0.0;
196 fMockGaussianSigma = 0.0;
197
198 // Event cuts
199 fULimit=-1;
200 fLLimit=1;
202
203 fErrorFlag=0; //Initialize the error flag
204 fErrorConfigFlag=0; //Initialize the error config. flag
205
206 //init error counters//
213
218
219 fGoodEventCount = 0;
220
221 bEVENTCUTMODE = 0;
222
223 //std::cout<< "name = "<<name<<" error count same _HW = "<<fErrorCount_SameHW <<std::endl;
224 return;
225}
std::vector< Double_t > fMockDriftAmplitude
Harmonic drift amplitude.
std::vector< Double_t > fMockDriftFrequency
Harmonic drift frequency.
Double_t fMockAsymmetry
Helicity asymmetry.
bool fUseExternalRandomVariable
Flag to use an externally provided normal random variable.
Double_t fMockGaussianSigma
Sigma of normal distribution.
Double_t fMockGaussianMean
Mean of normal distribution.
std::vector< Double_t > fMockDriftPhase
Harmonic drift phase.
void ClearEventData() override
Clear the event data in this element.
UInt_t fPreviousSequenceNumber
Previous event sequence number for this channel.
void SetElementName(const TString &name)
Set the name of this element.
void SetDataToSave(TString datatosave)
Set the flag indicating if raw or derived values are in this data element.
void SetNumberOfSubElements(const size_t elements)
Set the number of data words in this data element.
void SetNumberOfDataWords(const UInt_t &numwords)
Set the number of data words in this data element.

References VQwHardwareChannel::bEVENTCUTMODE, ClearEventData(), fADC_Same_NumEvt, fBlocksPerEvent, VQwHardwareChannel::fCalibrationFactor, VQwDataElement::fErrorConfigFlag, fErrorCount_HWSat, fErrorCount_SameHW, fErrorCount_sample, fErrorCount_Sequence, fErrorCount_SW_HW, fErrorCount_ZeroHW, VQwDataElement::fErrorFlag, VQwDataElement::fGoodEventCount, VQwHardwareChannel::fLLimit, MQwMockable::fMockAsymmetry, MQwMockable::fMockDriftAmplitude, MQwMockable::fMockDriftFrequency, MQwMockable::fMockDriftPhase, MQwMockable::fMockGaussianMean, MQwMockable::fMockGaussianSigma, fNumberOfSamples, fNumberOfSamples_map, fNumEvtsWithEventCutsRejected, VQwHardwareChannel::fPedestal, fPrev_HardwareBlockSum, fPreviousSequenceNumber, fSequenceNo_Counter, fSequenceNo_Prev, VQwHardwareChannel::fTreeArrayIndex, VQwHardwareChannel::fTreeArrayNumEntries, VQwHardwareChannel::fULimit, MQwMockable::fUseExternalRandomVariable, VQwHardwareChannel::kFoundGain, VQwHardwareChannel::kFoundPedestal, VQwHardwareChannel::SetDataToSave(), VQwDataElement::SetElementName(), VQwHardwareChannel::SetNumberOfDataWords(), and VQwHardwareChannel::SetNumberOfSubElements().

Referenced by InitializeChannel(), QwLinearDiodeArray::ProcessEvent(), QwQPD::ProcessEvent(), QwVQWK_Channel(), and QwVQWK_Channel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitializeChannel() [2/2]

void QwVQWK_Channel::InitializeChannel ( TString subsystem,
TString instrumenttype,
TString name,
TString datatosave )
overridevirtual

Initialize the fields in this object.

Implements VQwHardwareChannel.

Definition at line 229 of file QwVQWK_Channel.cc.

229 {
230 InitializeChannel(name,datatosave);
231 SetSubsystemName(subsystem);
232 SetModuleType(instrumenttype);
233 //PrintInfo();
234}
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.
void SetModuleType(TString ModuleType)
set the type of the beam instrument

References InitializeChannel(), VQwDataElement::SetModuleType(), and VQwDataElement::SetSubsystemName().

+ Here is the call graph for this function:

◆ LoadChannelParameters()

void QwVQWK_Channel::LoadChannelParameters ( QwParameterFile & paramfile)
overridevirtual

Reimplemented from VQwDataElement.

Definition at line 236 of file QwVQWK_Channel.cc.

236 {
237 UInt_t value = 0;
238 if (paramfile.ReturnValue("sample_size",value)){
240 } else {
241 QwWarning << "VQWK Channel "
242 << GetElementName()
243 << " cannot set the default sample size."
244 << QwLog::endl;
245 }
246};
Bool_t ReturnValue(const std::string keyname, T &retvalue)
void SetDefaultSampleSize(size_t num_samples_map)

References QwLog::endl(), VQwDataElement::GetElementName(), QwWarning, QwParameterFile::ReturnValue(), and SetDefaultSampleSize().

+ Here is the call graph for this function:

◆ LoadMockDataParameters()

void MQwMockable::LoadMockDataParameters ( QwParameterFile & paramfile)
virtual

Load the mock data parameters from the current line in the param file.

Reimplemented from VQwDataElement.

Definition at line 60 of file MQwMockable.cc.

24 {
25 Bool_t ldebug=kFALSE;
26 Double_t asym=0.0, mean=0.0, sigma=0.0;
27 Double_t amplitude=0.0, phase=0.0, frequency=0.0;
28
29 //Check to see if this line contains "drift"
30 if (paramfile.GetLine().find("drift")!=std::string::npos){
31 // "drift" appears somewhere in the line. Assume it is the next token and move on...
32 paramfile.GetNextToken(); //Throw away this token. Now the next three should be the drift parameters.
33 //read 3 parameters
34 amplitude = paramfile.GetTypedNextToken<Double_t>();
35 phase = paramfile.GetTypedNextToken<Double_t>();
36 frequency = paramfile.GetTypedNextToken<Double_t>(); // The frequency we read in should be in Hz.
37 this->AddRandomEventDriftParameters(amplitude, phase, frequency*Qw::Hz);
38 // std::cout << "In MQwMockable::LoadMockDataParameters: amp = " << amplitude << "\t phase = " << phase << "\t freq = " << frequency << std::endl;
39 }
40 else {
41 asym = paramfile.GetTypedNextToken<Double_t>();
42 mean = paramfile.GetTypedNextToken<Double_t>();
43 sigma = paramfile.GetTypedNextToken<Double_t>();
44 if (ldebug==1) {
45 std::cout << "#################### \n";
46 std::cout << "asym, mean, sigma \n" << std::endl;
47 std::cout << asym << " / "
48 << mean << " / "
49 << sigma << " / "
50 << std::endl;
51 }
52 this->SetRandomEventParameters(mean, sigma);
53 this->SetRandomEventAsymmetry(asym);
54 }
55}
static const double Hz
Frequency units: base unit is kHz.
Definition QwUnits.h:88
void AddRandomEventDriftParameters(Double_t amplitude, Double_t phase, Double_t frequency)
Add drift parameters to the internal set.
void SetRandomEventAsymmetry(Double_t asymmetry)
Set the helicity asymmetry.
void SetRandomEventParameters(Double_t mean, Double_t sigma)
Set the normal random event parameters.
T GetTypedNextToken()
Get next token into specific type.
std::string GetLine()
std::string GetNextToken(const std::string &separatorchars)
Get next token as a string.

◆ MatchNumberOfSamples()

Bool_t QwVQWK_Channel::MatchNumberOfSamples ( size_t numsamp)

Definition at line 1841 of file QwVQWK_Channel.cc.

1842{
1843 Bool_t status = kTRUE;
1844 if (!IsNameEmpty()){
1845 status = (fNumberOfSamples==numsamp);
1846 if (! status){
1847 if (bDEBUG)
1848 std::cerr << "QwVQWK_Channel::MatchNumberOfSamples: Channel "
1849 << GetElementName()
1850 << " had fNumberOfSamples==" << fNumberOfSamples
1851 << " and was supposed to have " << numsamp
1852 << std::endl;
1853 // PrintChannel();
1854 }
1855 }
1856 return status;
1857}

References bDEBUG, fNumberOfSamples, VQwDataElement::GetElementName(), and VQwDataElement::IsNameEmpty().

Referenced by ApplyHWChecks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MatchSequenceNumber()

Bool_t QwVQWK_Channel::MatchSequenceNumber ( size_t seqnum)

Definition at line 1831 of file QwVQWK_Channel.cc.

1832{
1833
1834 Bool_t status = kTRUE;
1835 if (!IsNameEmpty()){
1836 status = (fSequenceNumber==seqnum);
1837 }
1838 return status;
1839}

References fSequenceNumber, and VQwDataElement::IsNameEmpty().

Referenced by ApplyHWChecks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MultiplyBy()

void QwVQWK_Channel::MultiplyBy ( const VQwHardwareChannel * valueptr)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1208 of file QwVQWK_Channel.cc.

1209{
1210 const QwVQWK_Channel* tmpptr;
1211 tmpptr = dynamic_cast<const QwVQWK_Channel*>(valueptr);
1212 if (tmpptr!=NULL){
1213 *this *= *tmpptr;
1214 } else {
1215 TString loc="Standard exception from QwVQWK_Channel::MultiplyBy = "
1216 +valueptr->GetElementName()+" is an incompatible type.";
1217 throw std::invalid_argument(loc.Data());
1218 }
1219}

References VQwDataElement::GetElementName(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ operator*()

const QwVQWK_Channel QwVQWK_Channel::operator* ( const QwVQWK_Channel & value) const

Definition at line 1284 of file QwVQWK_Channel.cc.

1285{
1286 QwVQWK_Channel result = *this;
1287 result *= value;
1288 return result;
1289}

References QwVQWK_Channel().

+ Here is the call graph for this function:

◆ operator*=() [1/2]

QwVQWK_Channel & QwVQWK_Channel::operator*= ( const QwVQWK_Channel & value)

Definition at line 1291 of file QwVQWK_Channel.cc.

1292{
1293 if (!IsNameEmpty()){
1294 for (Int_t i=0; i<fBlocksPerEvent; i++){
1295 this->fBlock[i] *= value.fBlock[i];
1296 this->fBlockM2[i] = 0.0;
1297 }
1298 this->fHardwareBlockSum *= value.fHardwareBlockSum;
1299 this->fHardwareBlockSumM2 = 0.0;
1300 this->fNumberOfSamples *= value.fNumberOfSamples;
1301 this->fSequenceNumber = 0;
1302 this->fErrorFlag |= (value.fErrorFlag);
1303 }
1304
1305 return *this;
1306}

References fBlock, fBlockM2, fBlocksPerEvent, VQwDataElement::fErrorFlag, fHardwareBlockSum, fHardwareBlockSumM2, fNumberOfSamples, fSequenceNumber, VQwDataElement::IsNameEmpty(), and QwVQWK_Channel().

+ Here is the call graph for this function:

◆ operator*=() [2/2]

VQwHardwareChannel & QwVQWK_Channel::operator*= ( const VQwHardwareChannel & input)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1336 of file QwVQWK_Channel.cc.

1337{
1338 const QwVQWK_Channel* tmpptr;
1339 tmpptr = dynamic_cast<const QwVQWK_Channel*>(&source);
1340 if (tmpptr!=NULL){
1341 *this *= *tmpptr;
1342 } else {
1343 TString loc="Standard exception from QwVQWK_Channel::operator*= "
1344 +source.GetElementName()+" "
1345 +this->GetElementName()+" are not of the same type";
1346 throw(std::invalid_argument(loc.Data()));
1347 }
1348 return *this;
1349}

References VQwDataElement::GetElementName(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ operator+()

const QwVQWK_Channel QwVQWK_Channel::operator+ ( const QwVQWK_Channel & value) const

Definition at line 1234 of file QwVQWK_Channel.cc.

1235{
1236 QwVQWK_Channel result = *this;
1237 result += value;
1238 return result;
1239}

References QwVQWK_Channel().

+ Here is the call graph for this function:

◆ operator+=() [1/2]

QwVQWK_Channel & QwVQWK_Channel::operator+= ( const QwVQWK_Channel & value)

Definition at line 1241 of file QwVQWK_Channel.cc.

1242{
1243
1244 if (!IsNameEmpty()) {
1245 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
1246 this->fBlock[i] += value.fBlock[i];
1247 this->fBlockM2[i] = 0.0;
1248 }
1249 this->fHardwareBlockSum += value.fHardwareBlockSum;
1250 this->fHardwareBlockSumM2 = 0.0;
1251 this->fNumberOfSamples += value.fNumberOfSamples;
1252 this->fSequenceNumber = 0;
1253 this->fErrorFlag |= (value.fErrorFlag);
1254
1255 }
1256
1257 return *this;
1258}

References fBlock, fBlockM2, fBlocksPerEvent, VQwDataElement::fErrorFlag, fHardwareBlockSum, fHardwareBlockSumM2, fNumberOfSamples, fSequenceNumber, VQwDataElement::IsNameEmpty(), and QwVQWK_Channel().

+ Here is the call graph for this function:

◆ operator+=() [2/2]

VQwHardwareChannel & QwVQWK_Channel::operator+= ( const VQwHardwareChannel & input)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1308 of file QwVQWK_Channel.cc.

1309{
1310 const QwVQWK_Channel* tmpptr;
1311 tmpptr = dynamic_cast<const QwVQWK_Channel*>(&source);
1312 if (tmpptr!=NULL){
1313 *this += *tmpptr;
1314 } else {
1315 TString loc="Standard exception from QwVQWK_Channel::operator+= "
1316 +source.GetElementName()+" "
1317 +this->GetElementName()+" are not of the same type";
1318 throw(std::invalid_argument(loc.Data()));
1319 }
1320 return *this;
1321}

References VQwDataElement::GetElementName(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ operator-()

const QwVQWK_Channel QwVQWK_Channel::operator- ( const QwVQWK_Channel & value) const

Definition at line 1260 of file QwVQWK_Channel.cc.

1261{
1262 QwVQWK_Channel result = *this;
1263 result -= value;
1264 return result;
1265}

References QwVQWK_Channel().

+ Here is the call graph for this function:

◆ operator-=() [1/2]

QwVQWK_Channel & QwVQWK_Channel::operator-= ( const QwVQWK_Channel & value)

Definition at line 1267 of file QwVQWK_Channel.cc.

1268{
1269 if (!IsNameEmpty()){
1270 for (Int_t i=0; i<fBlocksPerEvent; i++){
1271 this->fBlock[i] -= value.fBlock[i];
1272 this->fBlockM2[i] = 0.0;
1273 }
1274 this->fHardwareBlockSum -= value.fHardwareBlockSum;
1275 this->fHardwareBlockSumM2 = 0.0;
1276 this->fNumberOfSamples += value.fNumberOfSamples;
1277 this->fSequenceNumber = 0;
1278 this->fErrorFlag |= (value.fErrorFlag);
1279 }
1280
1281 return *this;
1282}

References fBlock, fBlockM2, fBlocksPerEvent, VQwDataElement::fErrorFlag, fHardwareBlockSum, fHardwareBlockSumM2, fNumberOfSamples, fSequenceNumber, VQwDataElement::IsNameEmpty(), and QwVQWK_Channel().

+ Here is the call graph for this function:

◆ operator-=() [2/2]

VQwHardwareChannel & QwVQWK_Channel::operator-= ( const VQwHardwareChannel & input)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1322 of file QwVQWK_Channel.cc.

1323{
1324 const QwVQWK_Channel* tmpptr;
1325 tmpptr = dynamic_cast<const QwVQWK_Channel*>(&source);
1326 if (tmpptr!=NULL){
1327 *this -= *tmpptr;
1328 } else {
1329 TString loc="Standard exception from QwVQWK_Channel::operator-= "
1330 +source.GetElementName()+" "
1331 +this->GetElementName()+" are not of the same type";
1332 throw(std::invalid_argument(loc.Data()));
1333 }
1334 return *this;
1335}

References VQwDataElement::GetElementName(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ operator/=() [1/2]

QwVQWK_Channel & QwVQWK_Channel::operator/= ( const QwVQWK_Channel & value)
protected

Definition at line 1392 of file QwVQWK_Channel.cc.

1393{
1394 // In this function, leave the "raw" variables untouched.
1395 //
1396 Double_t ratio;
1397 Double_t variance;
1398 if (!IsNameEmpty()) {
1399 // The variances are calculated using the following formula:
1400 // Var[ratio] = ratio^2 (Var[numer] / numer^2 + Var[denom] / denom^2)
1401 //
1402 // This requires that both the numerator and denominator are non-zero!
1403 //
1404 for (Int_t i = 0; i < 4; i++) {
1405 if (this->fBlock[i] != 0.0 && denom.fBlock[i] != 0.0){
1406 ratio = (this->fBlock[i]) / (denom.fBlock[i]);
1407 variance = ratio * ratio *
1408 (this->fBlockM2[i] / this->fBlock[i] / this->fBlock[i]
1409 + denom.fBlockM2[i] / denom.fBlock[i] / denom.fBlock[i]);
1410 fBlock[i] = ratio;
1411 fBlockM2[i] = variance;
1412 } else if (this->fBlock[i] == 0.0) {
1413 this->fBlock[i] = 0.0;
1414 this->fBlockM2[i] = 0.0;
1415 } else {
1416 QwVerbose << "Attempting to divide by zero block in "
1418 fBlock[i] = 0.0;
1419 fBlockM2[i] = 0.0;
1420 }
1421 }
1422 if (this->fHardwareBlockSum != 0.0 && denom.fHardwareBlockSum != 0.0){
1423 ratio = (this->fHardwareBlockSum) / (denom.fHardwareBlockSum);
1424 variance = ratio * ratio *
1426 + denom.fHardwareBlockSumM2 / denom.fHardwareBlockSum / denom.fHardwareBlockSum);
1427 fHardwareBlockSum = ratio;
1428 fHardwareBlockSumM2 = variance;
1429 } else if (this->fHardwareBlockSum == 0.0) {
1430 fHardwareBlockSum = 0.0;
1431 fHardwareBlockSumM2 = 0.0;
1432 } else {
1433 QwVerbose << "Attempting to divide by zero sum in "
1435 fHardwareBlockSumM2 = 0.0;
1436 }
1437 // Remaining variables
1438 // Don't change fNumberOfSamples, fSequenceNumber, fGoodEventCount,
1439 // 'OR' the HW error codes in the fErrorFlag values together.
1440 fErrorFlag |= (denom.fErrorFlag);//mix only the hardware error codes
1441 }
1442
1443 // Nanny
1445 QwWarning << "Angry Nanny: NaN detected in " << GetElementName() << QwLog::endl;
1446
1447 return *this;
1448}
#define QwVerbose
Predefined log drain for verbose messages.
Definition QwLog.h:54

References QwLog::endl(), fBlock, fBlockM2, VQwDataElement::fErrorFlag, fHardwareBlockSum, fHardwareBlockSumM2, VQwDataElement::GetElementName(), VQwDataElement::IsNameEmpty(), QwVerbose, QwVQWK_Channel(), and QwWarning.

+ Here is the call graph for this function:

◆ operator/=() [2/2]

VQwHardwareChannel & QwVQWK_Channel::operator/= ( const VQwHardwareChannel & input)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1350 of file QwVQWK_Channel.cc.

1351{
1352 const QwVQWK_Channel* tmpptr;
1353 tmpptr = dynamic_cast<const QwVQWK_Channel*>(&source);
1354 if (tmpptr!=NULL){
1355 *this /= *tmpptr;
1356 } else {
1357 TString loc="Standard exception from QwVQWK_Channel::operator/= "
1358 +source.GetElementName()+" "
1359 +this->GetElementName()+" are not of the same type";
1360 throw(std::invalid_argument(loc.Data()));
1361 }
1362 return *this;
1363}

References VQwDataElement::GetElementName(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ operator=()

QwVQWK_Channel & QwVQWK_Channel::operator= ( const QwVQWK_Channel & value)

Definition at line 1125 of file QwVQWK_Channel.cc.

1126{
1127 if(this ==&value) return *this;
1128
1129 if (!IsNameEmpty()) {
1131 for (Int_t i=0; i<fBlocksPerEvent; i++){
1132 this->fBlock[i] = value.fBlock[i];
1133 this->fBlockM2[i] = value.fBlockM2[i];
1134 }
1138 this->fNumberOfSamples = value.fNumberOfSamples;
1139 this->fSequenceNumber = value.fSequenceNumber;
1140
1141 if (this->fDataToSave == kRaw){
1142 for (Int_t i=0; i<fBlocksPerEvent; i++){
1143 this->fBlock_raw[i] = value.fBlock_raw[i];
1144 }
1147 }
1148 }
1149 return *this;
1150}
VQwHardwareChannel & operator=(const VQwHardwareChannel &value)
Arithmetic assignment operator: Should only copy event-based data.

References fBlock, fBlock_raw, fBlockM2, fBlocksPerEvent, VQwHardwareChannel::fDataToSave, fHardwareBlockSum, fHardwareBlockSum_raw, fHardwareBlockSumError, fHardwareBlockSumM2, fNumberOfSamples, fSequenceNumber, fSoftwareBlockSum_raw, VQwDataElement::IsNameEmpty(), VQwDataElement::kRaw, VQwHardwareChannel::operator=(), and QwVQWK_Channel().

+ Here is the call graph for this function:

◆ PrintErrorCounterHead()

void QwVQWK_Channel::PrintErrorCounterHead ( )
static

Definition at line 1911 of file QwVQWK_Channel.cc.

1912{
1913 TString message;
1914 message = Form("%30s","Device name");
1915 message += Form("%9s", "HW Sat");
1916 message += Form("%9s", "Sample");
1917 message += Form("%9s", "SW_HW");
1918 message += Form("%9s", "Sequence");
1919 message += Form("%9s", "SameHW");
1920 message += Form("%9s", "ZeroHW");
1921 message += Form("%9s", "EventCut");
1922 QwMessage << "---------------------------------------------------------------------------------------------" << QwLog::endl;
1923 QwMessage << message << QwLog::endl;
1924 QwMessage << "---------------------------------------------------------------------------------------------" << QwLog::endl;
1925 return;
1926}

References QwLog::endl(), and QwMessage.

Referenced by QwBeamLine::PrintErrorCounters(), and QwBeamMod::PrintErrorCounters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrintErrorCounters()

void QwVQWK_Channel::PrintErrorCounters ( ) const
overridevirtual

report number of events failed due to HW and event cut failure

Reimplemented from VQwDataElement.

Definition at line 1934 of file QwVQWK_Channel.cc.

1935{
1936 TString message;
1938 message = Form("%30s", GetElementName().Data());
1939 message += Form("%9d", fErrorCount_HWSat);
1940 message += Form("%9d", fErrorCount_sample);
1941 message += Form("%9d", fErrorCount_SW_HW);
1942 message += Form("%9d", fErrorCount_Sequence);
1943 message += Form("%9d", fErrorCount_SameHW);
1944 message += Form("%9d", fErrorCount_ZeroHW);
1945 message += Form("%9d", fNumEvtsWithEventCutsRejected);
1946
1947 if((fDataToSave == kRaw) && (!kFoundPedestal||!kFoundGain)){
1948 message += " >>>>> No Pedestal or Gain in map file";
1949 }
1950
1951 QwMessage << message << QwLog::endl;
1952 }
1953 return;
1954}

References QwLog::endl(), VQwHardwareChannel::fDataToSave, fErrorCount_HWSat, fErrorCount_SameHW, fErrorCount_sample, fErrorCount_Sequence, fErrorCount_SW_HW, fErrorCount_ZeroHW, fNumEvtsWithEventCutsRejected, VQwDataElement::GetElementName(), VQwHardwareChannel::kFoundGain, VQwHardwareChannel::kFoundPedestal, VQwDataElement::kRaw, and QwMessage.

+ Here is the call graph for this function:

◆ PrintErrorCounterTail()

void QwVQWK_Channel::PrintErrorCounterTail ( )
static

Definition at line 1928 of file QwVQWK_Channel.cc.

1929{
1930 QwMessage << "---------------------------------------------------------------------------------------------" << QwLog::endl;
1931 return;
1932}

References QwLog::endl(), and QwMessage.

Referenced by QwBeamLine::PrintErrorCounters(), and QwBeamMod::PrintErrorCounters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrintInfo()

void QwVQWK_Channel::PrintInfo ( ) const
overridevirtual

Print multiple lines of information about this data element.

Reimplemented from VQwDataElement.

Definition at line 606 of file QwVQWK_Channel.cc.

607{
608 std::cout<<"***************************************"<<"\n";
609 std::cout<<"Subsystem "<<GetSubsystemName()<<"\n"<<"\n";
610 std::cout<<"Beam Instrument Type: "<<GetModuleType()<<"\n"<<"\n";
611 std::cout<<"QwVQWK channel: "<<GetElementName()<<"\n"<<"\n";
612 std::cout<<"fPedestal= "<< fPedestal<<"\n";
613 std::cout<<"fCalibrationFactor= "<<fCalibrationFactor<<"\n";
614 std::cout<<"fBlocksPerEvent= "<<fBlocksPerEvent<<"\n"<<"\n";
615 std::cout<<"fSequenceNumber= "<<fSequenceNumber<<"\n";
616 std::cout<<"fNumberOfSamples= "<<fNumberOfSamples<<"\n";
617 std::cout<<"fBlock_raw ";
618
619 for (Int_t i = 0; i < fBlocksPerEvent; i++)
620 std::cout << " : " << fBlock_raw[i];
621 std::cout<<"\n";
622 std::cout<<"fHardwareBlockSum_raw= "<<fHardwareBlockSum_raw<<"\n";
623 std::cout<<"fSoftwareBlockSum_raw= "<<fSoftwareBlockSum_raw<<"\n";
624 std::cout<<"fBlock ";
625 for (Int_t i = 0; i < fBlocksPerEvent; i++)
626 std::cout << " : " <<std::setprecision(8) << fBlock[i];
627 std::cout << std::endl;
628
629 std::cout << "fHardwareBlockSum = "<<std::setprecision(8) <<fHardwareBlockSum << std::endl;
630 std::cout << "fHardwareBlockSumM2 = "<<fHardwareBlockSumM2 << std::endl;
631 std::cout << "fHardwareBlockSumError = "<<fHardwareBlockSumError << std::endl;
632
633 return;
634}

References fBlock, fBlock_raw, fBlocksPerEvent, VQwHardwareChannel::fCalibrationFactor, fHardwareBlockSum, fHardwareBlockSum_raw, fHardwareBlockSumError, fHardwareBlockSumM2, fNumberOfSamples, VQwHardwareChannel::fPedestal, fSequenceNumber, fSoftwareBlockSum_raw, VQwDataElement::GetElementName(), VQwDataElement::GetModuleType(), and VQwDataElement::GetSubsystemName().

+ Here is the call graph for this function:

◆ PrintValue()

void QwVQWK_Channel::PrintValue ( ) const
overridevirtual

Print single line of value and error of this data element.

Reimplemented from VQwDataElement.

Definition at line 1754 of file QwVQWK_Channel.cc.

1755{
1756 QwMessage << std::setprecision(8)
1757 << std::setw(18) << std::left << GetSubsystemName() << " "
1758 << std::setw(18) << std::left << GetModuleType() << " "
1759 << std::setw(18) << std::left << GetElementName() << " "
1760 << std::setw(12) << std::left << GetHardwareSum() << " +/- "
1761 << std::setw(12) << std::left << GetHardwareSumError() << " sig "
1762 << std::setw(12) << std::left << GetHardwareSumWidth() << " "
1763 << std::setw(10) << std::left << GetGoodEventCount() << " "
1764 << std::setw(12) << std::left << GetBlockValue(0) << " +/- "
1765 << std::setw(12) << std::left << GetBlockErrorValue(0) << " "
1766 << std::setw(12) << std::left << GetBlockValue(1) << " +/- "
1767 << std::setw(12) << std::left << GetBlockErrorValue(1) << " "
1768 << std::setw(12) << std::left << GetBlockValue(2) << " +/- "
1769 << std::setw(12) << std::left << GetBlockErrorValue(2) << " "
1770 << std::setw(12) << std::left << GetBlockValue(3) << " +/- "
1771 << std::setw(12) << std::left << GetBlockErrorValue(3) << " "
1772 << std::setw(12) << std::left << fGoodEventCount << " "
1773 << QwLog::endl;
1774 /*
1775 //for Debudding
1776 << std::setw(12) << std::left << fErrorFlag << " err "
1777 << std::setw(12) << std::left << fErrorConfigFlag << " c-err "
1778
1779 */
1780}
Double_t GetHardwareSumWidth() const
Double_t GetBlockErrorValue(size_t blocknum) const
UInt_t GetGoodEventCount() const

References QwLog::endl(), VQwDataElement::fGoodEventCount, GetBlockErrorValue(), GetBlockValue(), VQwDataElement::GetElementName(), VQwDataElement::GetGoodEventCount(), GetHardwareSum(), GetHardwareSumError(), GetHardwareSumWidth(), VQwDataElement::GetModuleType(), VQwDataElement::GetSubsystemName(), and QwMessage.

+ Here is the call graph for this function:

◆ ProcessEvBuffer()

Int_t QwVQWK_Channel::ProcessEvBuffer ( UInt_t * buffer,
UInt_t num_words_left,
UInt_t index = 0 )
overridevirtual

Decode the event data from a CODA buffer.

Process raw event buffer data for a VQWK ADC channel.

Parameters
bufferPointer to raw data buffer from DAQ system.
num_words_leftNumber of words remaining in the buffer.
indexChannel index within the ADC module (0-7).
Returns
Number of words consumed from the buffer.

This is a critical data processing function that decodes the 6-word VQWK ADC data format used throughout the Qweak/MOLLER analysis framework:

VQWK Data Format (6 words per channel):

  • Words 0-3: Individual block sums for 4 integration periods
  • Word 4: Hardware-calculated sum of all 4 blocks
  • Word 5: Combined sequence number (bits 8-15) and sample count (bits 16-31)

Data Processing Steps:

  1. Validates sufficient buffer space (6 words minimum)
  2. Copies raw data to local buffer with sign conversion (UInt_t -> Int_t)
  3. Extracts individual block sums and hardware sum
  4. Decodes sequence number for event ordering verification
  5. Extracts sample count for integration time normalization
  6. Calculates software block sum for hardware validation

Channel State Handling:

  • Empty channel names are skipped but consume buffer space
  • Insufficient buffer words trigger error messages
  • Raw data is stored for subsequent ProcessEvent() calibration

Error Detection:

  • Hardware vs software sum comparison (done in ProcessEvent())
  • Sequence number continuity checking
  • Sample count validation for proper integration

Buffer Management:

  • Always consumes exactly kWordsPerChannel (6) words when successful
  • Returns 0 on buffer underrun to indicate processing failure
  • Thread-safe local buffer prevents data corruption
Note
This function only processes raw data extraction. Calibration, pedestal subtraction, and physics calculations are performed in ProcessEvent().
Warning
Buffer underrun conditions will print error messages but may not halt processing, potentially causing downstream data corruption.

Implements VQwDataElement.

Definition at line 513 of file QwVQWK_Channel.cc.

514{
515 UInt_t words_read = 0;
516 UInt_t localbuf[kWordsPerChannel] = {0};
517 // The conversion from UInt_t to Double_t discards the sign, so we need an intermediate
518 // static_cast from UInt_t to Int_t.
519 Int_t localbuf_signed[kWordsPerChannel] = {0};
520
521 if (IsNameEmpty()){
522 // This channel is not used, but is present in the data stream.
523 // Skip over this data.
524 words_read = fNumberOfDataWords;
525 } else if (num_words_left >= fNumberOfDataWords)
526 {
527 for (Int_t i=0; i<kWordsPerChannel; i++){
528 localbuf[i] = buffer[i];
529 localbuf_signed[i] = static_cast<Int_t>(localbuf[i]);
530 }
531
533 for (Int_t i=0; i<fBlocksPerEvent; i++){
534 fBlock_raw[i] = localbuf_signed[i];
536 }
537 fHardwareBlockSum_raw = localbuf_signed[4];
538
539 /* Permanent change in the structure of the 6th word of the ADC readout.
540 * The upper 16 bits are the number of samples, and the upper 8 of the
541 * lower 16 are the sequence number. This matches the structure of
542 * the ADC readout in block read mode, and now also in register read mode.
543 * P.King, 2007sep04.
544 */
545 fSequenceNumber = (localbuf[5]>>8) & 0xFF;
546 fNumberOfSamples = (localbuf[5]>>16) & 0xFFFF;
547
548 words_read = fNumberOfDataWords;
549
550 } else
551 {
552 std::cerr << "QwVQWK_Channel::ProcessEvBuffer: Not enough words!"
553 << std::endl;
554 }
555 return words_read;
556}
UInt_t fNumberOfDataWords
Number of raw data words in this data element.

References fBlock_raw, fBlocksPerEvent, fHardwareBlockSum_raw, VQwHardwareChannel::fNumberOfDataWords, fNumberOfSamples, fSequenceNumber, fSoftwareBlockSum_raw, VQwDataElement::IsNameEmpty(), and kWordsPerChannel.

+ Here is the call graph for this function:

◆ ProcessEvent()

void QwVQWK_Channel::ProcessEvent ( )
overridevirtual

Process the event data according to pedestal and calibration factor.

Implements VQwHardwareChannel.

Definition at line 560 of file QwVQWK_Channel.cc.

561{
562 if (fNumberOfSamples == 0 && fHardwareBlockSum_raw == 0) {
563 // There isn't valid data for this channel. Just flag it and
564 // move on.
565 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
566 fBlock[i] = 0.0;
567 fBlockM2[i] = 0.0;
568 }
569 fHardwareBlockSum = 0.0;
572 } else if (fNumberOfSamples == 0) {
573 // This is probably a more serious problem.
574 QwWarning << "QwVQWK_Channel::ProcessEvent: Channel "
575 << this->GetElementName().Data()
576 << " has fNumberOfSamples==0 but has valid data in the hardware sum. "
577 << "Flag this as an error."
578 << QwLog::endl;
579 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
580 fBlock[i] = 0.0;
581 fBlockM2[i] = 0.0;
582 }
583 fHardwareBlockSum = 0.0;
586 } else {
587 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
589 fBlockM2[i] = 0.0; // second moment is zero for single events
590 }
592 fHardwareBlockSumM2 = 0.0; // second moment is zero for single events
593 }
594 return;
595}

References QwLog::endl(), fBlock, fBlock_raw, fBlockM2, fBlocksPerEvent, VQwHardwareChannel::fCalibrationFactor, VQwDataElement::fErrorFlag, fHardwareBlockSum, fHardwareBlockSum_raw, fHardwareBlockSumM2, fNumberOfSamples, VQwHardwareChannel::fPedestal, VQwDataElement::GetElementName(), kErrorFlag_sample, and QwWarning.

+ Here is the call graph for this function:

◆ Product()

void QwVQWK_Channel::Product ( const QwVQWK_Channel & value1,
const QwVQWK_Channel & value2 )

Definition at line 1467 of file QwVQWK_Channel.cc.

1468{
1469 if (!IsNameEmpty()){
1470 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
1471 this->fBlock[i] = (value1.fBlock[i]) * (value2.fBlock[i]);
1472 // For a single event the second moment is still zero
1473 this->fBlockM2[i] = 0.0;
1474 }
1475
1476 // For a single event the second moment is still zero
1477 this->fHardwareBlockSumM2 = 0.0;
1478
1480 this->fNumberOfSamples = value1.fNumberOfSamples;
1481 this->fSequenceNumber = 0;
1482 this->fErrorFlag = (value1.fErrorFlag|value2.fErrorFlag);
1483 }
1484 return;
1485}

References fBlock, fBlockM2, fBlocksPerEvent, VQwDataElement::fErrorFlag, fHardwareBlockSum, fHardwareBlockSumM2, fNumberOfSamples, fSequenceNumber, VQwDataElement::IsNameEmpty(), and QwVQWK_Channel().

Referenced by QwLinearDiodeArray::ProcessEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RandomizeEventData()

void QwVQWK_Channel::RandomizeEventData ( int helicity = 0.0,
double time = 0.0 )
overridevirtual

Internally generate random event data.

Implements MQwMockable.

Definition at line 269 of file QwVQWK_Channel.cc.

270{
271 //std::cout << "In channel: " << GetElementName() << std::endl;
272 // The blocks are assumed to be independent measurements
273 // Double_t* block = new Double_t[fBlocksPerEvent];
274 // Double_t sqrt_fBlocksPerEvent = 0.0;
275 // sqrt_fBlocksPerEvent = sqrt(fBlocksPerEvent);
276
277 // Calculate drift (if time is not specified, it stays constant at zero)
278 //Double_t drift = 0.0;
279 //for (UInt_t i = 0; i < fMockDriftFrequency.size(); i++) {
280 // drift += fMockDriftAmplitude[i] * sin(2.0 * Qw::pi * fMockDriftFrequency[i] * time + fMockDriftPhase[i]);
281 //}
282
283 // updated to calculate the drift for each block individually
284 Double_t drift = 0.0;
285 for (Int_t i = 0; i < fBlocksPerEvent; i++){
286 drift = 0.0;
287 if (i >= 1){
289 }
290 for (UInt_t i = 0; i < fMockDriftFrequency.size(); i++) {
291 drift += fMockDriftAmplitude[i] * sin(2.0 * Qw::pi * fMockDriftFrequency[i] * time + fMockDriftPhase[i]);
292 //std::cout << "Drift: " << drift << std::endl;
293 }
294 }
295
296 // Calculate signal
297 fHardwareBlockSum = 0.0;
298 fHardwareBlockSumM2 = 0.0; // second moment is zero for single events
299
300 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
301 double tmpvar = GetRandomValue();
302 //std::cout << "tmpvar: " << tmpvar << std::endl;
303 //std::cout << "->fMockSigma: " << fMockGaussianSigma << std::endl;
304
305 fBlock[i] = fMockGaussianMean + drift;
306 //std::cout << "(Start of loop) " << this->GetElementName() << "-> "<< "fBlock[" << i << "]: " << fBlock[i] << ", Drift: " << drift <<", Mean: " << fMockGaussianMean<< std::endl;
308 fBlock[i] += helicity*fMockAsymmetry;
309 } else {
310 fBlock[i] *= 1.0 + helicity*fMockAsymmetry;
311 }
312 fBlock[i] += fMockGaussianSigma*tmpvar*sqrt(fBlocksPerEvent);
313 //std::cout << "(End of loop) " << this->GetElementName() << "-> "<< "fBlock[" << i << "]: " << fBlock[i] << ", Drift: " << drift <<", Mean: " << fMockGaussianMean<< std::endl;
314
315
316/*
317 fBlock[i] = //GetRandomValue();
318 fMockGaussianMean * (1 + helicity * fMockAsymmetry)
319 + fMockGaussianSigma*sqrt(fBlocksPerEvent) * tmpvar
320 + drift; */
321
322 fBlockM2[i] = 0.0; // second moment is zero for single events
324
325/* std::cout << "In RandomizeEventData: " << tmpvar << " " << fMockGaussianMean << " "<< (1 + helicity * fMockAsymmetry) << " "
326 << fMockGaussianSigma << " " << fMockGaussianSigma*tmpvar << " "
327 << drift << " " << block[i] << std::endl; */
328 }
330 fSequenceNumber = 0;
332 // SetEventData(block);
333 // delete block;
334 return;
335}
static const double pi
Angles: base unit is radian.
Definition QwUnits.h:107
Double_t GetRandomValue()
bool fCalcMockDataAsDiff
static const Double_t kTimePerSample

References fBlock, fBlockM2, fBlocksPerEvent, MQwMockable::fCalcMockDataAsDiff, fHardwareBlockSum, fHardwareBlockSumM2, MQwMockable::fMockAsymmetry, MQwMockable::fMockDriftAmplitude, MQwMockable::fMockDriftFrequency, MQwMockable::fMockDriftPhase, MQwMockable::fMockGaussianMean, MQwMockable::fMockGaussianSigma, fNumberOfSamples, fNumberOfSamples_map, fSequenceNumber, MQwMockable::GetRandomValue(), kTimePerSample, and Qw::pi.

+ Here is the call graph for this function:

◆ Ratio()

void QwVQWK_Channel::Ratio ( const QwVQWK_Channel & numer,
const QwVQWK_Channel & denom )

Definition at line 1378 of file QwVQWK_Channel.cc.

1379{
1380 if (!IsNameEmpty()) {
1381 *this = numer;
1382 *this /= denom;
1383
1384 // Remaining variables
1386 fSequenceNumber = 0;
1388 fErrorFlag = (numer.fErrorFlag|denom.fErrorFlag);
1389 }
1390}

References VQwDataElement::fErrorFlag, VQwDataElement::fGoodEventCount, fNumberOfSamples, fSequenceNumber, VQwDataElement::IsNameEmpty(), and QwVQWK_Channel().

Referenced by QwLinearDiodeArray::ProcessEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Scale()

void QwVQWK_Channel::Scale ( Double_t Offset)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1500 of file QwVQWK_Channel.cc.

1501{
1502 if (!IsNameEmpty()){
1503 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
1504 fBlock[i] *= scale;
1505 fBlockM2[i] *= scale * scale;
1506 }
1507 fHardwareBlockSum *= scale;
1508 fHardwareBlockSumM2 *= scale * scale;
1509 }
1510}

References fBlock, fBlockM2, fBlocksPerEvent, fHardwareBlockSum, fHardwareBlockSumM2, and VQwDataElement::IsNameEmpty().

Referenced by QwLinearDiodeArray::ProcessEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScaledAdd()

void QwVQWK_Channel::ScaledAdd ( Double_t scale,
const VQwHardwareChannel * value )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1956 of file QwVQWK_Channel.cc.

1957{
1958 const QwVQWK_Channel* input = dynamic_cast<const QwVQWK_Channel*>(value);
1959
1960 // follows same steps as += but w/ scaling factor
1961 if(input!=NULL && !IsNameEmpty()){
1962 // QwWarning << "Adding " << input->GetElementName()
1963 // << " to " << GetElementName()
1964 // << " with scale factor " << scale
1965 // << QwLog::endl;
1966 // PrintValue();
1967 // input->PrintValue();
1968 for(Int_t i = 0; i < fBlocksPerEvent; i++){
1969 this -> fBlock[i] += scale * input->fBlock[i];
1970 this -> fBlockM2[i] = 0.0;
1971 }
1972 this -> fHardwareBlockSum += scale * input->fHardwareBlockSum;
1973 this -> fHardwareBlockSumM2 = 0.0;
1974 this -> fNumberOfSamples += input->fNumberOfSamples;
1975 this -> fSequenceNumber = 0;
1976 this -> fErrorFlag |= (input->fErrorFlag);
1977 } else if (input == NULL && value != NULL) {
1978 TString loc="Standard exception from QwVQWK_Channel::ScaledAdd "
1979 +value->GetElementName()+" "
1980 +this->GetElementName()+" are not of the same type";
1981 throw(std::invalid_argument(loc.Data()));
1982 }
1983}

References fBlock, fBlockM2, fBlocksPerEvent, VQwDataElement::fErrorFlag, fHardwareBlockSum, fHardwareBlockSumM2, fNumberOfSamples, fSequenceNumber, VQwDataElement::GetElementName(), VQwDataElement::IsNameEmpty(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ SetCalibrationToVolts()

void QwVQWK_Channel::SetCalibrationToVolts ( )
inline

Definition at line 278 of file QwVQWK_Channel.h.

References kVQWK_VoltsPerBit, and VQwHardwareChannel::SetCalibrationFactor().

+ Here is the call graph for this function:

◆ SetDefaultSampleSize()

void QwVQWK_Channel::SetDefaultSampleSize ( size_t num_samples_map)
inline

Definition at line 125 of file QwVQWK_Channel.h.

125 {
126 // This will be checked against the no.of samples read by the module
127 fNumberOfSamples_map = num_samples_map;
128 };

References fNumberOfSamples_map.

Referenced by LoadChannelParameters().

+ Here is the caller graph for this function:

◆ SetEventData()

void QwVQWK_Channel::SetEventData ( Double_t * block,
UInt_t sequencenumber = 0 )

Definition at line 373 of file QwVQWK_Channel.cc.

374{
375 fHardwareBlockSum = 0.0;
376 fHardwareBlockSumM2 = 0.0; // second moment is zero for single events
377 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
378 fBlock[i] = block[i];
379 fBlockM2[i] = 0.0; // second moment is zero for single events
380 fHardwareBlockSum += block[i];
381 }
383
384 fSequenceNumber = sequencenumber;
386
387// Double_t thispedestal = 0.0;
388// thispedestal = fPedestal * fNumberOfSamples;
389
391 return;
392}
void SetRawEventData() override

References fBlock, fBlockM2, fBlocksPerEvent, fHardwareBlockSum, fHardwareBlockSumM2, fNumberOfSamples, fNumberOfSamples_map, fSequenceNumber, and SetRawEventData().

Referenced by SetHardwareSum().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetHardwareSum()

void QwVQWK_Channel::SetHardwareSum ( Double_t hwsum,
UInt_t sequencenumber = 0 )

TODO: SetHardwareSum should be removed, and SetEventData should be made protected.

Definition at line 357 of file QwVQWK_Channel.cc.

358{
359 Double_t* block = new Double_t[fBlocksPerEvent];
360 for (Int_t i = 0; i < fBlocksPerEvent; i++){
361 block[i] = hwsum / fBlocksPerEvent;
362 }
363 SetEventData(block);
364 delete[] block;
365 return;
366}
void SetEventData(Double_t *block, UInt_t sequencenumber=0)

References fBlocksPerEvent, and SetEventData().

+ Here is the call graph for this function:

◆ SetRawEventData()

void QwVQWK_Channel::SetRawEventData ( )
overridevirtual

Implements MQwMockable.

Definition at line 394 of file QwVQWK_Channel.cc.

394 {
397// Double_t hwsum_test = 0.0;
398// std::cout << "*******In QwVQWK_Channel::SetRawEventData for channel:\t" << this->GetElementName() << std::endl;
399 for (Int_t i = 0; i < fBlocksPerEvent; i++)
400 {
401 // The raw data is decoded ino calibrated values with the following (in ProcessEvent()):
402 // fBlock[i] = fCalibrationFactor * ( (1.0 * fBlock_raw[i] * fBlocksPerEvent / fNumberOfSamples) - fPedestal );
403 // We should invert that function here:
404/* if (fBlock[i]<-10.0 || fBlock[i]>+10.0)
405 QwError << "In QwVQWK_Channel::SetRawEventData for channel:\t" << this->GetElementName() << ", Block " << i << " is out of range (-10 V,+10V):" << fBlock[i] << QwLog::endl;
406*/
409 //hwsum_test +=fBlock[i] /(fBlocksPerEvent * 1.0);
410
411
412 // fBlock[i] = fCalibrationFactor * ((1.0 * fBlock_raw[i] * fBlocksPerEvent / fNumberOfSamples) - fPedestal);
413 // fHardwareBlockSum += fBlock[i];
414
415 /* std::cout << "\t fBlock[i] = " << std::setprecision(6) << fBlock[i] << "\n"
416 << "\t fCalibrationFactor = " << fCalibrationFactor << "\n"
417 << "\t fPedestal = " << fPedestal << "\n"
418 << "\t fNumberOfSamples = " << fNumberOfSamples << "\n"
419 << "\t fBlocksPerEvent = " << fBlocksPerEvent << "\n"
420 << "\t fBlock[i] / fCalibrationFactor + fPedestal = " << fBlock[i] / fCalibrationFactor + fPedestal << "\n"
421 << "\t That * fNumberOfSamples / (fBlocksPerEvent * 1) = " << (fBlock[i] / fCalibrationFactor + fPedestal) * fNumberOfSamples / (fBlocksPerEvent * 1.0) << "\n"
422 << "\t fBlock_raw[i] = " << fBlock_raw[i] << "\n"
423 << "\t fHardwareBlockSum_raw = " << fHardwareBlockSum_raw << "\n"
424 << std::endl;
425 */
426 }
427
428/* std::cout << "fBlock[0] = " << std::setprecision(16) << fBlock[0] << std::endl
429 << "fBlockraw[0] after calib: " << fCalibrationFactor * ((1.0 * fBlock_raw[0] * fBlocksPerEvent / fNumberOfSamples) - fPedestal) << std::endl;
430
431 std::cout << "fHardwareBlockSum = " << std::setprecision(8) << fHardwareBlockSum << std::endl;
432 std::cout << "hwsum_test = " << std::setprecision(8) << hwsum_test << std::endl;
433 std::cout << "fHardwareBlockSum_raw = " << std::setprecision(8) << fHardwareBlockSum_raw << std::endl;
434 std::cout << "fHardwareBlockSum_Raw after calibration = " << fCalibrationFactor * ((1.0 * fHardwareBlockSum_raw / fNumberOfSamples) - fPedestal) << std::endl;
435*/
436
438
439 return;
440}

References fBlock, fBlock_raw, fBlocksPerEvent, VQwHardwareChannel::fCalibrationFactor, fHardwareBlockSum_raw, fNumberOfSamples, fNumberOfSamples_map, VQwHardwareChannel::fPedestal, and fSoftwareBlockSum_raw.

Referenced by SetEventData().

+ Here is the caller graph for this function:

◆ SetVQWKSaturationLimt()

void QwVQWK_Channel::SetVQWKSaturationLimt ( Double_t sat_volts = 8.5)
inline

Definition at line 223 of file QwVQWK_Channel.h.

223 {//Set the absolute staturation limit in volts.
224 fSaturationABSLimit=sat_volts;
225 }

References fSaturationABSLimit.

Referenced by QwVQWK_Channel(), and QwVQWK_Channel().

+ Here is the caller graph for this function:

◆ SmearByResolution()

void QwVQWK_Channel::SmearByResolution ( double resolution)
overridevirtual

Implements MQwMockable.

Definition at line 337 of file QwVQWK_Channel.cc.

337 {
338
339 fHardwareBlockSum = 0.0;
340 fHardwareBlockSumM2 = 0.0; // second moment is zero for single events
341 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
342 // std::cout << i << " " << fBlock[i] << "->";
343 //std::cout << "resolution = " << resolution << "\t for channel \t" << GetElementName() << std::endl;
344 fBlock[i] += resolution*sqrt(fBlocksPerEvent) * GetRandomValue();
345 // std::cout << fBlock[i] << ": ";
346 fBlockM2[i] = 0.0; // second moment is zero for single events
348 }
349 // std::cout << std::endl;
351
353 // SetRawEventData();
354 return;
355}

References fBlock, fBlockM2, fBlocksPerEvent, fHardwareBlockSum, fHardwareBlockSumM2, fNumberOfSamples, fNumberOfSamples_map, and MQwMockable::GetRandomValue().

+ Here is the call graph for this function:

◆ SubtractValueFrom()

void QwVQWK_Channel::SubtractValueFrom ( const VQwHardwareChannel * valueptr)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1196 of file QwVQWK_Channel.cc.

1197{
1198 const QwVQWK_Channel* tmpptr;
1199 tmpptr = dynamic_cast<const QwVQWK_Channel*>(valueptr);
1200 if (tmpptr!=NULL){
1201 *this -= *tmpptr;
1202 } else {
1203 TString loc="Standard exception from QwVQWK_Channel::SubtractValueFrom = "
1204 +valueptr->GetElementName()+" is an incompatible type.";
1205 throw std::invalid_argument(loc.Data());
1206 }
1207}

References VQwDataElement::GetElementName(), QwVQWK_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ Sum()

void QwVQWK_Channel::Sum ( const QwVQWK_Channel & value1,
const QwVQWK_Channel & value2 )

Definition at line 1366 of file QwVQWK_Channel.cc.

1367{
1368 *this = value1;
1369 *this += value2;
1370}

References QwVQWK_Channel().

Referenced by QwQPD::ProcessEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
const QwVQWK_Channel & channel )
friend

Definition at line 1782 of file QwVQWK_Channel.cc.

1783{
1784 stream << channel.GetHardwareSum();
1785 return stream;
1786}

References GetHardwareSum(), and QwVQWK_Channel().

Field Documentation

◆ bBlock

Bool_t QwVQWK_Channel::bBlock
private

Definition at line 397 of file QwVQWK_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bBlock_raw

Bool_t QwVQWK_Channel::bBlock_raw
private

Definition at line 398 of file QwVQWK_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bDEBUG

const Bool_t QwVQWK_Channel::bDEBUG =kFALSE
staticprivate

debugging display purposes

For VQWK data element trimming uses

Definition at line 392 of file QwVQWK_Channel.h.

Referenced by ApplyHWChecks(), FillTreeVector(), and MatchNumberOfSamples().

◆ bDevice_Error_Code

Bool_t QwVQWK_Channel::bDevice_Error_Code
private

Definition at line 400 of file QwVQWK_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bHw_sum

Bool_t QwVQWK_Channel::bHw_sum
private

Definition at line 395 of file QwVQWK_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bHw_sum_raw

Bool_t QwVQWK_Channel::bHw_sum_raw
private

Definition at line 396 of file QwVQWK_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bNum_samples

Bool_t QwVQWK_Channel::bNum_samples
private

Definition at line 399 of file QwVQWK_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bSequence_number

Bool_t QwVQWK_Channel::bSequence_number
private

Definition at line 401 of file QwVQWK_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ fADC_Same_NumEvt

Int_t QwVQWK_Channel::fADC_Same_NumEvt
private

Keep track of how many events with same ADC value returned.

Definition at line 382 of file QwVQWK_Channel.h.

Referenced by ApplyHWChecks(), and InitializeChannel().

◆ fBlock

◆ fBlock_raw

Int_t QwVQWK_Channel::fBlock_raw[4]
private

Array of the sub-block data as read from the module.

Definition at line 339 of file QwVQWK_Channel.h.

Referenced by ClearEventData(), EncodeEventData(), GetRawValue(), operator=(), PrintInfo(), ProcessEvBuffer(), ProcessEvent(), and SetRawEventData().

◆ fBlockError

Double_t QwVQWK_Channel::fBlockError[4]
private

Uncertainty on the sub-block.

Definition at line 354 of file QwVQWK_Channel.h.

Referenced by CalculateRunningAverage(), ClearEventData(), and GetValueError().

◆ fBlockM2

◆ fBlocksPerEvent

◆ fErrorCount_HWSat

Int_t QwVQWK_Channel::fErrorCount_HWSat
private

check to see ADC channel is saturated

Definition at line 368 of file QwVQWK_Channel.h.

Referenced by IncrementErrorCounters(), InitializeChannel(), and PrintErrorCounters().

◆ fErrorCount_SameHW

Int_t QwVQWK_Channel::fErrorCount_SameHW
private

check to see ADC returning same HW value

Definition at line 372 of file QwVQWK_Channel.h.

Referenced by IncrementErrorCounters(), InitializeChannel(), and PrintErrorCounters().

◆ fErrorCount_sample

Int_t QwVQWK_Channel::fErrorCount_sample
private

for sample size check

Definition at line 369 of file QwVQWK_Channel.h.

Referenced by IncrementErrorCounters(), InitializeChannel(), and PrintErrorCounters().

◆ fErrorCount_Sequence

Int_t QwVQWK_Channel::fErrorCount_Sequence
private

sequence number check

Definition at line 371 of file QwVQWK_Channel.h.

Referenced by IncrementErrorCounters(), InitializeChannel(), and PrintErrorCounters().

◆ fErrorCount_SW_HW

Int_t QwVQWK_Channel::fErrorCount_SW_HW
private

HW_sum==SW_sum check.

Definition at line 370 of file QwVQWK_Channel.h.

Referenced by IncrementErrorCounters(), InitializeChannel(), and PrintErrorCounters().

◆ fErrorCount_ZeroHW

Int_t QwVQWK_Channel::fErrorCount_ZeroHW
private

check to see ADC returning zero

Definition at line 373 of file QwVQWK_Channel.h.

Referenced by IncrementErrorCounters(), InitializeChannel(), and PrintErrorCounters().

◆ fHardwareBlockSum

◆ fHardwareBlockSum_raw

Int_t QwVQWK_Channel::fHardwareBlockSum_raw
private

Module-based sum of the four sub-blocks as read from the module.

Definition at line 340 of file QwVQWK_Channel.h.

Referenced by ClearEventData(), EncodeEventData(), GetRawValue(), operator=(), PrintInfo(), ProcessEvBuffer(), ProcessEvent(), and SetRawEventData().

◆ fHardwareBlockSumError

Double_t QwVQWK_Channel::fHardwareBlockSumError
private

Uncertainty on the hardware sum.

Definition at line 357 of file QwVQWK_Channel.h.

Referenced by AssignScaledValue(), CalculateRunningAverage(), ClearEventData(), GetValueError(), operator=(), and PrintInfo().

◆ fHardwareBlockSumM2

◆ fNumberOfSamples

◆ fNumberOfSamples_map

UInt_t QwVQWK_Channel::fNumberOfSamples_map
private

Number of samples in the expected to read through the module. This value is set in the QwBeamline map file.

Definition at line 364 of file QwVQWK_Channel.h.

Referenced by ApplyHWChecks(), CopyFrom(), ForceMapfileSampleSize(), InitializeChannel(), QwVQWK_Channel(), QwVQWK_Channel(), RandomizeEventData(), SetDefaultSampleSize(), SetEventData(), SetRawEventData(), and SmearByResolution().

◆ fNumEvtsWithEventCutsRejected

Int_t QwVQWK_Channel::fNumEvtsWithEventCutsRejected
private

Counts the Event cut rejected events.

Definition at line 375 of file QwVQWK_Channel.h.

Referenced by IncrementErrorCounters(), InitializeChannel(), and PrintErrorCounters().

◆ fPrev_HardwareBlockSum

Double_t QwVQWK_Channel::fPrev_HardwareBlockSum
private

Previous Module-based sum of the four sub-blocks.

Definition at line 385 of file QwVQWK_Channel.h.

Referenced by ApplyHWChecks(), and InitializeChannel().

◆ fPreviousSequenceNumber

UInt_t QwVQWK_Channel::fPreviousSequenceNumber
private

Previous event sequence number for this channel.

Definition at line 362 of file QwVQWK_Channel.h.

Referenced by InitializeChannel().

◆ fSaturationABSLimit

Double_t QwVQWK_Channel::fSaturationABSLimit
private

absolute value of the VQWK saturation volt

Definition at line 389 of file QwVQWK_Channel.h.

Referenced by CopyFrom(), GetVQWKSaturationLimt(), QwVQWK_Channel(), QwVQWK_Channel(), and SetVQWKSaturationLimt().

◆ fSequenceNo_Counter

Int_t QwVQWK_Channel::fSequenceNo_Counter
private

Internal counter to keep track of the sequence number.

Definition at line 384 of file QwVQWK_Channel.h.

Referenced by ApplyHWChecks(), and InitializeChannel().

◆ fSequenceNo_Prev

Int_t QwVQWK_Channel::fSequenceNo_Prev
private

Keep the sequence number of the last event.

Definition at line 383 of file QwVQWK_Channel.h.

Referenced by ApplyHWChecks(), and InitializeChannel().

◆ fSequenceNumber

◆ fSoftwareBlockSum_raw

Int_t QwVQWK_Channel::fSoftwareBlockSum_raw
private

Sum of the data in the four sub-blocks raw.

Definition at line 341 of file QwVQWK_Channel.h.

Referenced by ClearEventData(), GetRawSoftwareSum(), operator=(), PrintInfo(), ProcessEvBuffer(), and SetRawEventData().

◆ kDEBUG

const Bool_t QwVQWK_Channel::kDEBUG = kFALSE
staticprivate

Definition at line 317 of file QwVQWK_Channel.h.

Referenced by ConstructBranch(), and ConstructBranchAndVector().

◆ kMaxChannels

const Int_t QwVQWK_Channel::kMaxChannels = 8
staticprivate

Definition at line 319 of file QwVQWK_Channel.h.

Referenced by GetBufferOffset().

◆ kTimePerSample

const Double_t QwVQWK_Channel::kTimePerSample = (2.0/30.0) * Qw::us
static

Definition at line 62 of file QwVQWK_Channel.h.

Referenced by RandomizeEventData().

◆ kVQWK_VoltsPerBit

const Double_t QwVQWK_Channel::kVQWK_VoltsPerBit = (20./(1<<18))
staticprivate

Conversion factor to translate the average bit count in an ADC channel into average voltage. The base factor is roughly 76 uV per count, and zero counts corresponds to zero voltage. Store as the exact value for 20 V range, 18 bit ADC.

Definition at line 323 of file QwVQWK_Channel.h.

Referenced by ApplyHWChecks(), GetAverageVolts(), and SetCalibrationToVolts().

◆ kWordsPerChannel

const Int_t QwVQWK_Channel::kWordsPerChannel = 6
staticprivate

Definition at line 318 of file QwVQWK_Channel.h.

Referenced by GetBufferOffset(), and ProcessEvBuffer().


The documentation for this class was generated from the following files: