JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwMollerADC_Channel Class Reference

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

#include <QwMollerADC_Channel.h>

+ Inheritance diagram for QwMollerADC_Channel:
+ Collaboration diagram for QwMollerADC_Channel:

Public Member Functions

 QwMollerADC_Channel ()
 
 QwMollerADC_Channel (TString name, TString datatosave="raw")
 
 QwMollerADC_Channel (const QwMollerADC_Channel &value)
 
 QwMollerADC_Channel (const QwMollerADC_Channel &value, VQwDataElement::EDataToSave datatosave)
 
 ~QwMollerADC_Channel () override
 
void CopyFrom (const QwMollerADC_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.
 
QwMollerADC_Channeloperator= (const QwMollerADC_Channel &value)
 
void AssignScaledValue (const QwMollerADC_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 QwMollerADC_Channel &value)
 
QwMollerADC_Channeloperator+= (const QwMollerADC_Channel &value)
 
QwMollerADC_Channeloperator-= (const QwMollerADC_Channel &value)
 
QwMollerADC_Channeloperator*= (const QwMollerADC_Channel &value)
 
VQwHardwareChanneloperator+= (const VQwHardwareChannel &input) override
 
VQwHardwareChanneloperator-= (const VQwHardwareChannel &input) override
 
VQwHardwareChanneloperator*= (const VQwHardwareChannel &input) override
 
VQwHardwareChanneloperator/= (const VQwHardwareChannel &input) override
 
const QwMollerADC_Channel operator+ (const QwMollerADC_Channel &value) const
 
const QwMollerADC_Channel operator- (const QwMollerADC_Channel &value) const
 
const QwMollerADC_Channel operator* (const QwMollerADC_Channel &value) const
 
void Sum (const QwMollerADC_Channel &value1, const QwMollerADC_Channel &value2)
 
void Difference (const QwMollerADC_Channel &value1, const QwMollerADC_Channel &value2)
 
void Ratio (const QwMollerADC_Channel &numer, const QwMollerADC_Channel &denom)
 
void Product (const QwMollerADC_Channel &value1, const QwMollerADC_Channel &value2)
 
void DivideBy (const QwMollerADC_Channel &denom)
 
void AddChannelOffset (Double_t Offset)
 
void Scale (Double_t Offset) override
 
void AccumulateRunningSum (const QwMollerADC_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 QwMollerADC_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 SetMollerADCSaturationLimt (Double_t sat_volts=8.5)
 
Double_t GetMollerADCSaturationLimt ()
 
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
 
void CopyParameters (const VQwHardwareChannel *valueptr) 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 QwMollerADC_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)
 
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)
 
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)
 
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

QwMollerADC_Channeloperator/= (const QwMollerADC_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.
 
Long64_t fBlockSumSq_raw [5]
 
Int_t fBlock_min [5]
 
Int_t fBlock_max [5]
 
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 = 30
 
static const Int_t kMaxChannels = 8
 
ADC Calibration
static const Double_t kMollerADC_VoltsPerBit = (20./(1<<18))
 

Friends

std::ostream & operator<< (std::ostream &stream, const QwMollerADC_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 MollerADC 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 std::mt19937 fRandomnessGenerator
 Internal randomness generator.
 
static std::normal_distribution< double > fNormalDistribution
 Internal normal probability distribution.
 
static std::function< double()> fNormalRandomVariable = []() -> double { return MQwMockable::fNormalDistribution(MQwMockable::fRandomnessGenerator); }
 Internal normal random variable.
 

Detailed Description

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

Decodes and processes the data for a single Moller ADC channel and exposes block-level values, sums, and statistical moments. Supports single-event cuts, error propagation, blinding, and running statistics. Follows the dual-operator pattern to provide both type-specific operators and polymorphic operator overrides via VQwHardwareChannel.

Definition at line 44 of file QwMollerADC_Channel.h.

Constructor & Destructor Documentation

◆ QwMollerADC_Channel() [1/4]

QwMollerADC_Channel::QwMollerADC_Channel ( )
inline

Definition at line 72 of file QwMollerADC_Channel.h.

72 : MQwMockable() {
73 InitializeChannel("","");
74 SetMollerADCSaturationLimt(8.5);//set the default saturation limit
75 };
void InitializeChannel(TString name, TString datatosave) override
Initialize the fields in this object.
void SetMollerADCSaturationLimt(Double_t sat_volts=8.5)

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

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

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

◆ QwMollerADC_Channel() [2/4]

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

Definition at line 76 of file QwMollerADC_Channel.h.

76 : MQwMockable() {
77 InitializeChannel(name, datatosave);
78 SetMollerADCSaturationLimt(8.5);//set the default saturation limit
79 };

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

+ Here is the call graph for this function:

◆ QwMollerADC_Channel() [3/4]

QwMollerADC_Channel::QwMollerADC_Channel ( const QwMollerADC_Channel & value)
inline

Definition at line 80 of file QwMollerADC_Channel.h.

80 :
81 VQwHardwareChannel(value), MQwMockable(value),
85 {
86 *this = value;
87 };
UInt_t fNumberOfSamples_map
Number of samples in the expected to read through the module. This value is set in the QwBeamline map...
Double_t fSaturationABSLimit
absolute value of the MollerADC saturation volt

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

+ Here is the call graph for this function:

◆ QwMollerADC_Channel() [4/4]

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

Definition at line 88 of file QwMollerADC_Channel.h.

88 :
89 VQwHardwareChannel(value,datatosave), MQwMockable(value),
93 {
94 *this = value;
95 };

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

+ Here is the call graph for this function:

◆ ~QwMollerADC_Channel()

QwMollerADC_Channel::~QwMollerADC_Channel ( )
inlineoverride

Definition at line 96 of file QwMollerADC_Channel.h.

96{ };

Member Function Documentation

◆ AccumulateRunningSum() [1/2]

void QwMollerADC_Channel::AccumulateRunningSum ( const QwMollerADC_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 1524 of file QwMollerADC_Channel.cc.

1525{
1526 /*
1527 note:
1528 The AccumulateRunningSum is called on a dedicated subsystem array object and
1529 for the standard running avg computations we only need value.fErrorFlag==0
1530 events to be included in the running avg. So the "berror" conditions is only
1531 used for the stability check purposes.
1532
1533 The need for this check below came due to fact that when routine
1534 DeaccumulateRunningSum is called the errorflag is updated with
1535 the kBeamStabilityError flag (+ configuration flags for global errors) and
1536 need to make sure we remove this flag and any configuration flags before
1537 checking the (fErrorFlag != 0) condition
1538
1539 See how the stability check is implemented in the QwEventRing class
1540
1541 Rakitha
1542 */
1543
1544 if(count==0){
1545 count = value.fGoodEventCount;
1546 }
1547
1548 Int_t n1 = fGoodEventCount;
1549 Int_t n2 = count;
1550
1551 // If there are no good events, check the error flag
1552 if (n2 == 0 && (value.fErrorFlag == 0)) {
1553 n2 = 1;
1554 }
1555
1556 // If a single event is removed from the sum, check all but stability fail flags
1557 if (n2 == -1) {
1558 if ((value.fErrorFlag & ErrorMask) == 0) {
1559 n2 = -1;
1560 } else {
1561 n2 = 0;
1562 }
1563 }
1564
1565 if (ErrorMask == kPreserveError){
1566 //n = 1;
1567 if (n2 == 0) {
1568 n2 = 1;
1569 }
1570 if (count == -1) {
1571 n2 = -1;
1572 }
1573 }
1574
1575 // New total number of good events
1576 Int_t n = n1 + n2;
1577
1578 // Set up variables
1579 Double_t M11 = fHardwareBlockSum;
1580 Double_t M12 = value.fHardwareBlockSum;
1581 Double_t M22 = value.fHardwareBlockSumM2;
1582
1583 //if(this->GetElementName() == "bcm_an_ds3" && ErrorMask == kPreserveError){QwError << "count=" << fGoodEventCount << " n=" << n << QwLog::endl; }
1584 if (n2 == 0) {
1585 // no good events for addition
1586 return;
1587 } else if (n2 == -1) {
1588 // simple version for removal of single event from the sum
1590 if (n > 1) {
1591 fHardwareBlockSum -= (M12 - M11) / n;
1592 fHardwareBlockSumM2 -= (M12 - M11)
1593 * (M12 - fHardwareBlockSum); // note: using updated mean
1594 // and for individual blocks
1595 for (Int_t i = 0; i < 4; i++) {
1596 M11 = fBlock[i];
1597 M12 = value.fBlock[i];
1598 M22 = value.fBlockM2[i];
1599 fBlock[i] -= (M12 - M11) / n;
1600 fBlockM2[i] -= (M12 - M11) * (M12 - fBlock[i]); // note: using updated mean
1601 }
1602 } else if (n == 1) {
1603 fHardwareBlockSum -= (M12 - M11) / n;
1604 fHardwareBlockSumM2 -= (M12 - M11)
1605 * (M12 - fHardwareBlockSum); // note: using updated mean
1606 if (fabs(fHardwareBlockSumM2) < 10.*std::numeric_limits<double>::epsilon())
1607 fHardwareBlockSumM2 = 0; // rounding
1608 // and for individual blocks
1609 for (Int_t i = 0; i < 4; i++) {
1610 M11 = fBlock[i];
1611 M12 = value.fBlock[i];
1612 M22 = value.fBlockM2[i];
1613 fBlock[i] -= (M12 - M11) / n;
1614 fBlockM2[i] -= (M12 - M11) * (M12 - fBlock[i]); // note: using updated mean
1615 if (fabs(fBlockM2[i]) < 10.*std::numeric_limits<double>::epsilon())
1616 fBlockM2[i] = 0; // rounding
1617 }
1618 } else if (n == 0) {
1619 fHardwareBlockSum -= M12;
1620 fHardwareBlockSumM2 -= M22;
1621 if (fabs(fHardwareBlockSum) < 10.*std::numeric_limits<double>::epsilon())
1622 fHardwareBlockSum = 0; // rounding
1623 if (fabs(fHardwareBlockSumM2) < 10.*std::numeric_limits<double>::epsilon())
1624 fHardwareBlockSumM2 = 0; // rounding
1625 // and for individual blocks
1626 for (Int_t i = 0; i < 4; i++) {
1627 M11 = fBlock[i];
1628 M12 = value.fBlock[i];
1629 M22 = value.fBlockM2[i];
1630 fBlock[i] -= M12;
1631 fBlockM2[i] -= M22;
1632 if (fabs(fBlock[i]) < 10.*std::numeric_limits<double>::epsilon())
1633 fBlock[i] = 0; // rounding
1634 if (fabs(fBlockM2[i]) < 10.*std::numeric_limits<double>::epsilon())
1635 fBlockM2[i] = 0; // rounding
1636 }
1637 } else {
1638 QwWarning << "Running sum has deaccumulated to negative good events." << QwLog::endl;
1639 }
1640 } else if (n2 == 1) {
1641 // simple version for addition of single event
1643 fHardwareBlockSum += (M12 - M11) / n;
1644 fHardwareBlockSumM2 += (M12 - M11)
1645 * (M12 - fHardwareBlockSum); // note: using updated mean
1646 // and for individual blocks
1647 for (Int_t i = 0; i < 4; i++) {
1648 M11 = fBlock[i];
1649 M12 = value.fBlock[i];
1650 M22 = value.fBlockM2[i];
1651 fBlock[i] += (M12 - M11) / n;
1652 fBlockM2[i] += (M12 - M11) * (M12 - fBlock[i]); // note: using updated mean
1653 }
1654 } else if (n2 > 1) {
1655 // general version for addition of multi-event sets
1656 fGoodEventCount += n2;
1657 fHardwareBlockSum += n2 * (M12 - M11) / n;
1658 fHardwareBlockSumM2 += M22 + n1 * n2 * (M12 - M11) * (M12 - M11) / n;
1659 // and for individual blocks
1660 for (Int_t i = 0; i < 4; i++) {
1661 M11 = fBlock[i];
1662 M12 = value.fBlock[i];
1663 M22 = value.fBlockM2[i];
1664 fBlock[i] += n2 * (M12 - M11) / n;
1665 fBlockM2[i] += M22 + n1 * n2 * (M12 - M11) * (M12 - M11) / n;
1666 }
1667 }
1668
1669 // Nanny
1671 QwWarning << "Angry Nanny: NaN detected in " << GetElementName() << QwLog::endl;
1672}
#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 fHardwareBlockSum
Module-based sum of the four sub-blocks.
Double_t fBlockM2[4]
Second moment of the sub-block.
Double_t fBlock[4]
Array of the sub-block data.
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, QwMollerADC_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 QwMollerADC_Channel::AccumulateRunningSum ( const VQwHardwareChannel * value,
Int_t count = 0,
Int_t ErrorMask = 0xFFFFFFF )
inlineoverridevirtual

Reimplemented from VQwHardwareChannel.

Definition at line 191 of file QwMollerADC_Channel.h.

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

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

+ Here is the call graph for this function:

◆ AddChannelOffset()

void QwMollerADC_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 1445 of file QwMollerADC_Channel.cc.

1446{
1447 if (!IsNameEmpty()){
1448 fHardwareBlockSum += offset;
1449 for (Int_t i=0; i<fBlocksPerEvent; i++)
1450 fBlock[i] += offset;
1451 }
1452 return;
1453}
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 QwMollerADC_Channel::AddValueFrom ( const VQwHardwareChannel * valueptr)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1141 of file QwMollerADC_Channel.cc.

1142{
1143 const QwMollerADC_Channel* tmpptr;
1144 tmpptr = dynamic_cast<const QwMollerADC_Channel*>(valueptr);
1145 if (tmpptr!=NULL){
1146 *this += *tmpptr;
1147 } else {
1148 TString loc="Standard exception from QwMollerADC_Channel::AddValueFrom = "
1149 +valueptr->GetElementName()+" is an incompatible type.";
1150 throw std::invalid_argument(loc.Data());
1151 }
1152}

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

+ Here is the call graph for this function:

◆ ApplyHWChecks()

Int_t QwMollerADC_Channel::ApplyHWChecks ( )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 64 of file QwMollerADC_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 MollerADC invoked! " <<TMath::Abs(GetRawHardwareSum())*kMollerADC_VoltsPerBit/fNumberOfSamples<<" Limit "<<GetMollerADCSaturationLimt() << 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 GetRawSoftwareSum() const
Double_t fPrev_HardwareBlockSum
Previous Module-based sum of the four sub-blocks.
Int_t fSequenceNo_Counter
Internal counter to keep track of the sequence number.
Bool_t MatchSequenceNumber(size_t seqnum)
Double_t GetMollerADCSaturationLimt()
Int_t GetRawHardwareSum() const
Int_t fADC_Same_NumEvt
Keep track of how many events with same ADC value returned.
size_t GetNumberOfSamples() const
static const Bool_t bDEBUG
debugging display purposes
Int_t fSequenceNo_Prev
Keep the sequence number of the last event.
static const Double_t kMollerADC_VoltsPerBit
size_t GetSequenceNumber() const
UInt_t fNumberOfSamples
Number of samples read through the module.
Bool_t MatchNumberOfSamples(size_t numsamp)

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

+ Here is the call graph for this function:

◆ ApplySingleEventCuts() [1/2]

Bool_t QwMollerADC_Channel::ApplySingleEventCuts ( )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1830 of file QwMollerADC_Channel.cc.

1831{
1832 Bool_t status;
1833
1834 if (bEVENTCUTMODE>=2){//Global switch to ON/OFF event cuts set at the event cut file
1835
1836 if (fULimit < fLLimit){
1837 status=kTRUE;
1838 } else if (GetHardwareSum()<=fULimit && GetHardwareSum()>=fLLimit){
1839 if ((fErrorFlag)==0)
1840 status=kTRUE;
1841 else
1842 status=kFALSE;//If the device HW is failed
1843 }
1844 else{
1845 if (GetHardwareSum()> fULimit)
1847 else
1849 status=kFALSE;
1850 }
1851
1852 if (bEVENTCUTMODE==3){
1853 status=kTRUE; //Update the event cut fail flag but pass the event.
1854 }
1855
1856
1857 }
1858 else{
1859 status=kTRUE;
1860 //fErrorFlag=0;//we need to keep the device error codes
1861 }
1862
1863 return status;
1864}
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 QwMollerADC_Channel::ApplySingleEventCuts ( Double_t LL,
Double_t UL )

Definition at line 1814 of file QwMollerADC_Channel.cc.

1815{
1816 Bool_t status = kFALSE;
1817
1818 if (UL < LL){
1819 status=kTRUE;
1820 } else if (GetHardwareSum()<=UL && GetHardwareSum()>=LL){
1821 if ((fErrorFlag & kPreserveError)!=0)
1822 status=kTRUE;
1823 else
1824 status=kFALSE;//If the device HW is failed
1825 }
1826 std::cout<<(this->fErrorFlag & kPreserveError)<<std::endl;
1827 return status;
1828}

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

+ Here is the call graph for this function:

◆ ArcTan()

void QwMollerADC_Channel::ArcTan ( const QwMollerADC_Channel & value)

Definition at line 1408 of file QwMollerADC_Channel.cc.

1409{
1410 if (!IsNameEmpty()) {
1411 this->fHardwareBlockSum = 0.0;
1412 for (Int_t i=0; i<fBlocksPerEvent; i++) {
1413 this->fBlock[i] = atan(value.fBlock[i]);
1414 this->fHardwareBlockSum += this->fBlock[i];
1415 }
1417 }
1418
1419 return;
1420}

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

Referenced by QwEnergyCalculator::GetProjectedPosition(), and QwEnergyCalculator::ProcessEvent().

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

◆ AssignScaledValue()

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

Definition at line 1108 of file QwMollerADC_Channel.cc.

1110{
1111 if(this == &value) return;
1112
1113 if (!IsNameEmpty()) {
1114 for (Int_t i=0; i<fBlocksPerEvent; i++){
1115 this->fBlock[i] = value.fBlock[i] * scale;
1116 this->fBlockM2[i] = value.fBlockM2[i] * scale * scale;
1117
1118 }
1119 this->fHardwareBlockSum = value.fHardwareBlockSum * scale;
1120 this->fHardwareBlockSumM2 = value.fHardwareBlockSumM2 * scale * scale;
1121 this->fHardwareBlockSumError = value.fHardwareBlockSumError; // Keep this?
1122 this->fGoodEventCount = value.fGoodEventCount;
1123 this->fNumberOfSamples = value.fNumberOfSamples;
1124 this->fSequenceNumber = value.fSequenceNumber;
1125 this->fErrorFlag = value.fErrorFlag;
1126 }
1127}
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 QwMollerADC_Channel().

Referenced by QwIntegrationPMT::RandomizeMollerEvent().

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

◆ AssignValueFrom()

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

Implements VQwHardwareChannel.

Definition at line 1129 of file QwMollerADC_Channel.cc.

1130{
1131 const QwMollerADC_Channel* tmpptr;
1132 tmpptr = dynamic_cast<const QwMollerADC_Channel*>(valueptr);
1133 if (tmpptr!=NULL){
1134 *this = *tmpptr;
1135 } else {
1136 TString loc="Standard exception from QwMollerADC_Channel::AssignValueFrom = "
1137 +valueptr->GetElementName()+" is an incompatible type.";
1138 throw std::invalid_argument(loc.Data());
1139 }
1140}

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

Referenced by QwEnergyCalculator::GetProjectedPosition(), and QwEnergyCalculator::ProcessEvent().

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

◆ Blind() [1/2]

void QwMollerADC_Channel::Blind ( const QwBlinder * blinder)

Blind this channel as an asymmetry.

Blind this channel as an asymmetry

Parameters
blinderBlinder

Definition at line 1747 of file QwMollerADC_Channel.cc.

1748{
1749 if (!IsNameEmpty()) {
1750 if (blinder->IsBlinderOkay() && ((fErrorFlag)==0) ){
1751 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1752 blinder->BlindValue(fBlock[i]);
1753 blinder->BlindValue(fHardwareBlockSum);
1754 } else {
1756 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1759 }
1760 }
1761 return;
1762}
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 QwMollerADC_Channel::Blind ( const QwBlinder * blinder,
const QwMollerADC_Channel & yield )

Blind this channel as a difference.

Blind this channel as a difference with specified yield

Parameters
blinderBlinder
yieldCorresponding yield

Definition at line 1769 of file QwMollerADC_Channel.cc.

1770{
1771 if (!IsNameEmpty()) {
1772 if (blinder->IsBlinderOkay() && ((fErrorFlag) ==0) ){
1773 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1774 blinder->BlindValue(fBlock[i], yield.fBlock[i]);
1776 } else {
1777 blinder->ModifyThisErrorCode(fErrorFlag);//update the HW error code
1778 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1781 }
1782 }
1783 return;
1784}

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

+ Here is the call graph for this function:

◆ CalculateRunningAverage()

void QwMollerADC_Channel::CalculateRunningAverage ( )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1675 of file QwMollerADC_Channel.cc.

1676{
1677 if (fGoodEventCount <= 0)
1678 {
1679 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
1680 fBlockError[i] = 0.0;
1681 }
1683 }
1684 else
1685 {
1686 // We use a biased estimator by dividing by n. Use (n - 1) to get the
1687 // unbiased estimator for the standard deviation.
1688 //
1689 // Note we want to calculate the error here, not sigma:
1690 // sigma = sqrt(M2 / n);
1691 // error = sigma / sqrt (n) = sqrt(M2) / n;
1692 for (Int_t i = 0; i < fBlocksPerEvent; i++)
1693 fBlockError[i] = sqrt(fBlockM2[i]) / fGoodEventCount;
1695
1696 // Stability check 83951872
1698 // check to see the channel has stability cut activated in the event cut file
1699 if (GetValueWidth() > fStability){
1700 // if the width is greater than the stability required flag the event
1702 } else
1703 fErrorFlag = 0;
1704 }
1705 }
1706}
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 QwMollerADC_Channel::ClearEventData ( )
overridevirtual

Clear the event data in this element.

Reimplemented from VQwDataElement.

Definition at line 248 of file QwMollerADC_Channel.cc.

249{
250 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
251 fBlock_raw[i] = 0;
252 fBlockSumSq_raw[i] = 0;
253 fBlock_min[i] = 0;
254 fBlock_max[i] = 0;
255 fBlock[i] = 0.0;
256 fBlockM2[i] = 0.0;
257 fBlockError[i] = 0.0;
258 }
261 fHardwareBlockSum = 0.0;
264 fSequenceNumber = 0;
266 fGoodEventCount = 0;
267 fErrorFlag=0;
268 return;
269}
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.
Int_t fHardwareBlockSum_raw
Module-based sum of the four sub-blocks as read from the module.

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

Referenced by QwEnergyCalculator::GetProjectedPosition(), InitializeChannel(), and QwEnergyCalculator::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 * QwMollerADC_Channel::Clone ( VQwDataElement::EDataToSave datatosave) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 109 of file QwMollerADC_Channel.h.

109 {
110 return new QwMollerADC_Channel(*this,datatosave);
111 };

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

+ Here is the call graph for this function:

◆ ConstructBranch()

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

Implements VQwHardwareChannel.

Definition at line 777 of file QwMollerADC_Channel.cc.

778{
779 // This channel is not used, so skip setting up the tree.
780 if (IsNameEmpty()) return;
781
782 TString basename = prefix + GetElementName();
783 tree->Branch(basename,&fHardwareBlockSum,basename+"/D");
784 if (kDEBUG){
785 std::cerr << "QwMollerADC_Channel::ConstructBranchAndVector: fTreeArrayIndex==" << fTreeArrayIndex
786 << "; fTreeArrayNumEntries==" << fTreeArrayNumEntries
787 << std::endl;
788 }
789}
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 QwMollerADC_Channel::ConstructBranchAndVector ( TTree * tree,
TString & prefix,
QwRootTreeBranchVector & values )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 682 of file QwMollerADC_Channel.cc.

683{
684 // This channel is not used, so skip setting up the tree.
685 if (IsNameEmpty()) return;
686
687 // Decide what to store based on prefix
688 SetDataToSaveByPrefix(prefix);
689
690 TString basename = prefix(0, (prefix.First("|") >= 0)? prefix.First("|"): prefix.Length()) + GetElementName();
691 fTreeArrayIndex = values.size();
692
693 TString list = "";
694
700 bDevice_Error_Code = gQwHists.MatchVQWKElementFromList(GetSubsystemName().Data(), GetModuleType().Data(), "Device_Error_Code");
702
703 if (bHw_sum) {
704 values.push_back("hw_sum", 'D');
705 if (fDataToSave == kMoments) {
706 values.push_back("hw_sum_m2", 'D');
707 values.push_back("hw_sum_err", 'D');
708 }
709 }
710
711 if (bBlock) {
712 values.push_back("block0", 'D');
713 values.push_back("block1", 'D');
714 values.push_back("block2", 'D');
715 values.push_back("block3", 'D');
716 }
717
718 if (bNum_samples) {
719 values.push_back("num_samples", 'i');
720 }
721
722 if (bDevice_Error_Code) {
723 values.push_back("Device_Error_Code", 'i');
724 }
725
726 if (fDataToSave == kRaw) {
727 if (bHw_sum_raw) {
728 values.push_back("hw_sum_raw", 'I');
729 }
730 if (bBlock_raw) {
731 values.push_back("block0_raw", 'I');
732 values.push_back("block1_raw", 'I');
733 values.push_back("block2_raw", 'I');
734 values.push_back("block3_raw", 'I');
735 }
736
737 for (int i = 0; i < 4; i++) {
738 if (bBlock_raw) {
739 values.push_back(Form("SumSq_%d", i), 'L');
740 values.push_back(Form("RawMin_%d", i), 'I');
741 values.push_back(Form("RawMax_%d", i), 'I');
742 }
743 }
744
745 if (bSequence_number) {
746 values.push_back("sequence_number", 'i');
747 }
748 }
749
750 std::string leaf_list = values.LeafList(fTreeArrayIndex);
751
753
754 if (gQwHists.MatchDeviceParamsFromList(basename.Data())
757
758 // This is for the RT mode
759 if (leaf_list == "hw_sum/D")
760 leaf_list = basename+"/D";
761
762 if (kDEBUG)
763 QwMessage << "base name " << basename << " List " << leaf_list << QwLog::endl;
764
765 tree->Branch(basename, &(values[fTreeArrayIndex]), leaf_list.c_str());
766 }
767
768 if (kDEBUG) {
769 std::cerr << "QwMollerADC_Channel::ConstructBranchAndVector: fTreeArrayIndex==" << fTreeArrayIndex
770 << "; fTreeArrayNumEntries==" << fTreeArrayNumEntries
771 << "; values.size()==" << values.size()
772 << "; list==" << leaf_list
773 << std::endl;
774 }
775}
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:83
std::string LeafList(size_type start_index=0) const
Definition QwRootFile.h:230
void push_back(const std::string &name, const char type='D')
Definition QwRootFile.h:197
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 QwMollerADC_Channel::ConstructHistograms ( TDirectory * folder,
TString & prefix )
overridevirtual

Construct the histograms for this data element.

Implements VQwDataElement.

Definition at line 576 of file QwMollerADC_Channel.cc.

577{
578 // If we have defined a subdirectory in the ROOT file, then change into it.
579 if (folder != NULL) folder->cd();
580
581 if (IsNameEmpty()){
582 // This channel is not used, so skip filling the histograms.
583 } else {
584 // Now create the histograms.
585 SetDataToSaveByPrefix(prefix);
586
587 TString basename = prefix + GetElementName();
588
589 if(fDataToSave==kRaw)
590 {
591 fHistograms.resize(8+2+1, NULL);
592 size_t index=0;
593 for (Int_t i=0; i<fBlocksPerEvent; i++){
594 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_block%d_raw",i));
595 fHistograms[index+1] = gQwHists.Construct1DHist(basename+Form("_block%d",i));
596 index += 2;
597 }
598 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_hw_raw"));
599 fHistograms[index+1] = gQwHists.Construct1DHist(basename+Form("_hw"));
600 index += 2;
601 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_sw-hw_raw"));
602 }
603 else if(fDataToSave==kDerived)
604 {
605 fHistograms.resize(4+1+1, NULL);
606 Int_t index=0;
607 for (Int_t i=0; i<fBlocksPerEvent; i++){
608 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_block%d",i));
609 index += 1;
610 }
611 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_hw"));
612 index += 1;
613 fHistograms[index] = gQwHists.Construct1DHist(basename+Form("_dev_err"));
614 index += 1;
615 }
616 else
617 {
618 // this is not recognized
619 }
620
621 }
622}
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 QwMollerADC_Channel::CopyFrom ( const QwMollerADC_Channel & value)
inline

Definition at line 98 of file QwMollerADC_Channel.h.

98 {
103 *this = value;
104 };
void CopyFrom(const VQwHardwareChannel &value)

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

+ Here is the call graph for this function:

◆ CopyParameters()

void QwMollerADC_Channel::CopyParameters ( const VQwHardwareChannel * valueptr)
overridevirtual

Reimplemented from VQwHardwareChannel.

Definition at line 1940 of file QwMollerADC_Channel.cc.

1940 {
1941 const QwMollerADC_Channel* tmpptr;
1942 tmpptr = dynamic_cast<const QwMollerADC_Channel*>(valueptr);
1943 if (tmpptr!=NULL){
1947 } else {
1948 TString loc="Standard exception from QwMollerADC_Channel::CopyParameters"
1949 +valueptr->GetElementName()+" "
1950 +this->GetElementName()+" are not of the same type";
1951 throw(std::invalid_argument(loc.Data()));
1952 }
1953};
Double_t fMockGaussianSigma
Sigma of normal distribution.

References MQwMockable::fMockGaussianSigma, fNumberOfSamples, fNumberOfSamples_map, VQwDataElement::GetElementName(), QwMollerADC_Channel(), and VQwHardwareChannel::VQwHardwareChannel().

+ Here is the call graph for this function:

◆ DeaccumulateRunningSum() [1/2]

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

Definition at line 200 of file QwMollerADC_Channel.h.

200 {
201 AccumulateRunningSum(value, -1, ErrorMask);
202 };

References AccumulateRunningSum(), and QwMollerADC_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 248 of file VQwHardwareChannel.h.

248 {
249 AccumulateRunningSum(value, -1, ErrorMask);
250 };

◆ Difference()

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

Definition at line 1329 of file QwMollerADC_Channel.cc.

1330{
1331 *this = value1;
1332 *this -= value2;
1333}

References QwMollerADC_Channel().

+ Here is the call graph for this function:

◆ DivideBy() [1/2]

void QwMollerADC_Channel::DivideBy ( const QwMollerADC_Channel & denom)

Definition at line 1468 of file QwMollerADC_Channel.cc.

1469{
1470 *this /= denom;
1471}

References QwMollerADC_Channel().

+ Here is the call graph for this function:

◆ DivideBy() [2/2]

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

Implements VQwHardwareChannel.

Definition at line 1177 of file QwMollerADC_Channel.cc.

1178{
1179 const QwMollerADC_Channel* tmpptr;
1180 tmpptr = dynamic_cast<const QwMollerADC_Channel*>(valueptr);
1181 if (tmpptr!=NULL){
1182 *this /= *tmpptr;
1183 } else {
1184 TString loc="Standard exception from QwMollerADC_Channel::DivideBy = "
1185 +valueptr->GetElementName()+" is an incompatible type.";
1186 throw std::invalid_argument(loc.Data());
1187 }
1188}

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

+ Here is the call graph for this function:

◆ EncodeEventData()

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

Encode the event data into a CODA buffer.

Implements MQwMockable.

Definition at line 413 of file QwMollerADC_Channel.cc.

414{
415 Long_t localbuf[kWordsPerChannel] = {0};
416
417 if (IsNameEmpty()) {
418 // This channel is not used, but is present in the data stream.
419 // Skip over this data.
420 } else {
421 // localbuf[4] = 0;
422 for (Int_t i = 0; i < 4; i++) {
423 localbuf[i*5] = fBlock_raw[i];
424 localbuf[i*5+1] = fBlockSumSq_raw[i] & 0xffffffff;
425 localbuf[i*5+2] = fBlockSumSq_raw[i] >> 32;
426 localbuf[i*5+3] = fBlock_min[i];
427 localbuf[i*5+4] = fBlock_max[i];
428
429 // localbuf[4] += localbuf[i]; // fHardwareBlockSum_raw
430 }
431 // The following causes many rounding errors and skips due to the check
432 // that fHardwareBlockSum_raw == fSoftwareBlockSum_raw in IsGoodEvent().
433 localbuf[20] = fHardwareBlockSum_raw;
434 localbuf[21] = fBlockSumSq_raw[4] & 0xffffffff;
435 localbuf[22] = fBlockSumSq_raw[4] >> 32;
436 localbuf[23] = fBlock_min[4];
437 localbuf[24] = fBlock_max[4];
438 localbuf[25] = (fNumberOfSamples << 16 & 0xFFFF0000)
439 | (fSequenceNumber << 8 & 0x0000FF00);
440
441 for (Int_t i = 0; i < kWordsPerChannel; i++){
442 buffer.push_back(localbuf[i]);
443 }
444 }
445}
static const Int_t kWordsPerChannel

References fBlock_max, fBlock_min, fBlock_raw, fBlockSumSq_raw, fHardwareBlockSum_raw, fNumberOfSamples, fSequenceNumber, VQwDataElement::IsNameEmpty(), and kWordsPerChannel.

+ Here is the call graph for this function:

◆ FillHistograms()

void QwMollerADC_Channel::FillHistograms ( )
overridevirtual

Fill the histograms for this data element.

Implements VQwDataElement.

Definition at line 624 of file QwMollerADC_Channel.cc.

625{
626 Int_t index=0;
627
628 if (IsNameEmpty())
629 {
630 // This channel is not used, so skip creating the histograms.
631 } else
632 {
633 if(fDataToSave==kRaw)
634 {
635 for (Int_t i=0; i<fBlocksPerEvent; i++)
636 {
637 if (fHistograms[index] != NULL && (fErrorFlag)==0)
638 fHistograms[index]->Fill(this->GetRawBlockValue(i));
639 if (fHistograms[index+1] != NULL && (fErrorFlag)==0)
640 fHistograms[index+1]->Fill(this->GetBlockValue(i));
641 index+=2;
642 }
643 if (fHistograms[index] != NULL && (fErrorFlag)==0)
644 fHistograms[index]->Fill(this->GetRawHardwareSum());
645 if (fHistograms[index+1] != NULL && (fErrorFlag)==0)
646 fHistograms[index+1]->Fill(this->GetHardwareSum());
647 index+=2;
648 if (fHistograms[index] != NULL && (fErrorFlag)==0)
649 fHistograms[index]->Fill(this->GetRawSoftwareSum()-this->GetRawHardwareSum());
650 }
651 else if(fDataToSave==kDerived)
652 {
653 for (Int_t i=0; i<fBlocksPerEvent; i++)
654 {
655 if (fHistograms[index] != NULL && (fErrorFlag)==0)
656 fHistograms[index]->Fill(this->GetBlockValue(i));
657 index+=1;
658 }
659 if (fHistograms[index] != NULL && (fErrorFlag)==0)
660 fHistograms[index]->Fill(this->GetHardwareSum());
661 index+=1;
662 if (fHistograms[index] != NULL){
664 fHistograms[index]->Fill(kErrorFlag_sample);
666 fHistograms[index]->Fill(kErrorFlag_SW_HW);
668 fHistograms[index]->Fill(kErrorFlag_Sequence);
670 fHistograms[index]->Fill(kErrorFlag_ZeroHW);
672 fHistograms[index]->Fill(kErrorFlag_VQWK_Sat);
674 fHistograms[index]->Fill(kErrorFlag_SameHW);
675 }
676
677 }
678
679 }
680}
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 QwMollerADC_Channel::FillTreeVector ( QwRootTreeBranchVector & values) const
overridevirtual

Implements VQwHardwareChannel.

Definition at line 792 of file QwMollerADC_Channel.cc.

793{
794 if (IsNameEmpty()) {
795 // This channel is not used, so skip filling the tree vector.
796 } else if (fTreeArrayNumEntries <= 0) {
797 if (bDEBUG) std::cerr << "QwMollerADC_Channel::FillTreeVector: fTreeArrayNumEntries=="
798 << fTreeArrayNumEntries << std::endl;
799 } else if (values.size() < fTreeArrayIndex+fTreeArrayNumEntries){
800 if (bDEBUG) std::cerr << "QwMollerADC_Channel::FillTreeVector: values.size()=="
801 << values.size()
802 << "; fTreeArrayIndex+fTreeArrayNumEntries=="
804 << std::endl;
805 } else {
806
807 UInt_t index = fTreeArrayIndex;
808
809 // hw_sum
810 if (bHw_sum) {
811 values.SetValue(index++, this->GetHardwareSum());
812 if (fDataToSave == kMoments) {
813 values.SetValue(index++, this->GetHardwareSumM2());
814 values.SetValue(index++, this->GetHardwareSumError());
815 }
816 }
817
818 if (bBlock) {
819 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
820 // blocki
821 values.SetValue(index++, this->GetBlockValue(i));
822 }
823 }
824
825 // num_samples
826 if (bNum_samples)
827 values.SetValue(index++, (fDataToSave == kMoments)? this->fGoodEventCount: this->fNumberOfSamples);
828 // Device_Error_Code
830 values.SetValue(index++, this->fErrorFlag);
831
832 if (fDataToSave == kRaw)
833 {
834 // hw_sum_raw
835 if (bHw_sum_raw)
836 values.SetValue(index++, this->GetRawHardwareSum());
837
838 if (bBlock_raw) {
839 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
840 // blocki_raw
841 values.SetValue(index++, this->GetRawBlockValue(i));
842 }
843 }
844
845 if (bBlock_raw) {
846 for (int i = 0; i < 4; i++) {
847 values.SetValue(index++, fBlockSumSq_raw[i]);
848 values.SetValue(index++, fBlock_min[i]);
849 values.SetValue(index++, fBlock_max[i]);
850 }
851 }
852 // sequence_number
854 values.SetValue(index++, this->fSequenceNumber);
855 }
856 }
857}
Double_t GetHardwareSumM2() const
Double_t GetHardwareSumError() const
void SetValue(size_type index, Double_t val)
Definition QwRootFile.h:110

References bBlock, bBlock_raw, bDEBUG, bDevice_Error_Code, bHw_sum, bHw_sum_raw, bNum_samples, bSequence_number, fBlock_max, fBlock_min, fBlocksPerEvent, fBlockSumSq_raw, 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 QwMollerADC_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 134 of file QwMollerADC_Channel.h.

References fNumberOfSamples, and fNumberOfSamples_map.

◆ GetAverageVolts()

Double_t QwMollerADC_Channel::GetAverageVolts ( ) const

Definition at line 537 of file QwMollerADC_Channel.cc.

538{
539 //Double_t avgVolts = (fBlock[0]+fBlock[1]+fBlock[2]+fBlock[3])*kMollerADC_VoltsPerBit/fNumberOfSamples;
541 //std::cout<<"QwMollerADC_Channel::GetAverageVolts() = "<<avgVolts<<std::endl;
542 return avgVolts;
543
544}

References fHardwareBlockSum, fNumberOfSamples, and kMollerADC_VoltsPerBit.

◆ GetBlockErrorValue()

Double_t QwMollerADC_Channel::GetBlockErrorValue ( size_t blocknum) const
inlineprivate

Definition at line 305 of file QwMollerADC_Channel.h.

305{ 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 QwMollerADC_Channel::GetBlockValue ( size_t blocknum) const
inlineprivate

Definition at line 304 of file QwMollerADC_Channel.h.

304{ 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 QwMollerADC_Channel::GetBufferOffset ( Int_t moduleindex,
Int_t channelindex )
static

Class: QwMollerADC_Channel Base class containing decoding functions for the MollerADC_Channel 6 32-bit datawords. The functions in this class will decode a single channel worth of MollerADC_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 MollerADC buffer.

Definition at line 43 of file QwMollerADC_Channel.cc.

43 {
44 Int_t offset = -1;
45 if (moduleindex<0 ){
46 QwError << "QwMollerADC_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 << "QwMollerADC_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 kMaxChannels

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

Referenced by VQwDetectorArray::LoadChannelMap(), and QwBeamDetectorID::QwBeamDetectorID().

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

◆ GetHardwareSum()

Double_t QwMollerADC_Channel::GetHardwareSum ( ) const
inlineprivate

Definition at line 307 of file QwMollerADC_Channel.h.

307{ 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 QwMollerADC_Channel::GetHardwareSumError ( ) const
inlineprivate

Definition at line 310 of file QwMollerADC_Channel.h.

310{ 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 QwMollerADC_Channel::GetHardwareSumM2 ( ) const
inlineprivate

Definition at line 308 of file QwMollerADC_Channel.h.

308{ 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 QwMollerADC_Channel::GetHardwareSumWidth ( ) const
inlineprivate

Definition at line 309 of file QwMollerADC_Channel.h.

309{ return GetValueWidth(0); };

References GetValueWidth().

Referenced by PrintValue().

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

◆ GetMollerADCSaturationLimt()

Double_t QwMollerADC_Channel::GetMollerADCSaturationLimt ( )
inline

Definition at line 228 of file QwMollerADC_Channel.h.

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

References fSaturationABSLimit.

Referenced by ApplyHWChecks().

+ Here is the caller graph for this function:

◆ GetNumberOfSamples()

size_t QwMollerADC_Channel::GetNumberOfSamples ( ) const
inline

Definition at line 277 of file QwMollerADC_Channel.h.

277{return (fNumberOfSamples);};

References fNumberOfSamples.

Referenced by ApplyHWChecks().

+ Here is the caller graph for this function:

◆ GetRawBlockValue()

Int_t QwMollerADC_Channel::GetRawBlockValue ( size_t blocknum) const
inlineprivate

Definition at line 313 of file QwMollerADC_Channel.h.

313{return GetRawValue(blocknum+1);};

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 QwMollerADC_Channel::GetRawHardwareSum ( ) const
inlineprivate

Definition at line 314 of file QwMollerADC_Channel.h.

314{ 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 QwMollerADC_Channel::GetRawSoftwareSum ( ) const
inlineprivate

Definition at line 315 of file QwMollerADC_Channel.h.

315{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 QwMollerADC_Channel::GetRawValue ( size_t element) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 252 of file QwMollerADC_Channel.h.

252 {
253 RangeCheck(element);
254 if (element==0) return fHardwareBlockSum_raw;
255 return fBlock_raw[element-1];
256 }
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 QwMollerADC_Channel::GetSequenceNumber ( ) const
inline

Definition at line 276 of file QwMollerADC_Channel.h.

276{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 QwMollerADC_Channel::GetValue ( size_t element) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 257 of file QwMollerADC_Channel.h.

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

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

+ Here is the call 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 QwMollerADC_Channel::GetValueError ( size_t element) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 267 of file QwMollerADC_Channel.h.

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

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 QwMollerADC_Channel::GetValueM2 ( size_t element) const
inlineoverridevirtual

Implements VQwHardwareChannel.

Definition at line 262 of file QwMollerADC_Channel.h.

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

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 };

◆ IncrementErrorCounters()

void QwMollerADC_Channel::IncrementErrorCounters ( )
overridevirtual

Implements VQwHardwareChannel.

Definition at line 140 of file QwMollerADC_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_SW_HW
HW_sum==SW_sum check.
Int_t fErrorCount_sample
for sample size check
Int_t fErrorCount_ZeroHW
check to see ADC returning zero
Int_t fNumEvtsWithEventCutsRejected
Counts the Event cut rejected events.
Int_t fErrorCount_HWSat
check to see ADC channel is saturated
Int_t fErrorCount_SameHW
check to see ADC returning same HW value
Int_t fErrorCount_Sequence
sequence number check

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 QwMollerADC_Channel::InitializeChannel ( TString name,
TString datatosave )
overridevirtual

Initialize the fields in this object.

Implements VQwHardwareChannel.

Definition at line 161 of file QwMollerADC_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 return;
224}
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 fMockGaussianMean
Mean of normal distribution.
std::vector< Double_t > fMockDriftPhase
Harmonic drift phase.
UInt_t fPreviousSequenceNumber
Previous event sequence number for this channel.
void ClearEventData() override
Clear the event data in this element.
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 QwEnergyCalculator::GetProjectedPosition(), InitializeChannel(), QwEnergyCalculator::ProcessEvent(), QwMollerADC_Channel(), and QwMollerADC_Channel().

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

◆ InitializeChannel() [2/2]

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

Initialize the fields in this object.

Implements VQwHardwareChannel.

Definition at line 228 of file QwMollerADC_Channel.cc.

228 {
229 InitializeChannel(name,datatosave);
230 SetSubsystemName(subsystem);
231 SetModuleType(instrumenttype);
232 //PrintInfo();
233}
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 QwMollerADC_Channel::LoadChannelParameters ( QwParameterFile & paramfile)
overridevirtual

Reimplemented from VQwDataElement.

Definition at line 235 of file QwMollerADC_Channel.cc.

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

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.

19 {
20 Bool_t ldebug=kFALSE;
21 Double_t asym=0.0, mean=0.0, sigma=0.0;
22 Double_t amplitude=0.0, phase=0.0, frequency=0.0;
23
24 //Check to see if this line contains "drift"
25 if (paramfile.GetLine().find("drift")!=std::string::npos){
26 // "drift" appears somewhere in the line. Assume it is the next token and move on...
27 paramfile.GetNextToken(); //Throw away this token. Now the next three should be the drift parameters.
28 //read 3 parameters
29 amplitude = paramfile.GetTypedNextToken<Double_t>();
30 phase = paramfile.GetTypedNextToken<Double_t>();
31 frequency = paramfile.GetTypedNextToken<Double_t>(); // The frequency we read in should be in Hz.
32 this->AddRandomEventDriftParameters(amplitude, phase, frequency*Qw::Hz);
33 // std::cout << "In MQwMockable::LoadMockDataParameters: amp = " << amplitude << "\t phase = " << phase << "\t freq = " << frequency << std::endl;
34 }
35 else {
36 asym = paramfile.GetTypedNextToken<Double_t>();
37 mean = paramfile.GetTypedNextToken<Double_t>();
38 sigma = paramfile.GetTypedNextToken<Double_t>();
39 if (ldebug==1) {
40 std::cout << "#################### \n";
41 std::cout << "asym, mean, sigma \n" << std::endl;
42 std::cout << asym << " / "
43 << mean << " / "
44 << sigma << " / "
45 << std::endl;
46 }
47 this->SetRandomEventParameters(mean, sigma);
48 this->SetRandomEventAsymmetry(asym);
49 }
50}
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 QwMollerADC_Channel::MatchNumberOfSamples ( size_t numsamp)

Definition at line 1796 of file QwMollerADC_Channel.cc.

1797{
1798 Bool_t status = kTRUE;
1799 if (!IsNameEmpty()){
1800 status = (fNumberOfSamples==numsamp);
1801 if (! status){
1802 if (bDEBUG)
1803 std::cerr << "QwMollerADC_Channel::MatchNumberOfSamples: Channel "
1804 << GetElementName()
1805 << " had fNumberOfSamples==" << fNumberOfSamples
1806 << " and was supposed to have " << numsamp
1807 << std::endl;
1808 // PrintChannel();
1809 }
1810 }
1811 return status;
1812}

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 QwMollerADC_Channel::MatchSequenceNumber ( size_t seqnum)

Definition at line 1786 of file QwMollerADC_Channel.cc.

1787{
1788
1789 Bool_t status = kTRUE;
1790 if (!IsNameEmpty()){
1791 status = (fSequenceNumber==seqnum);
1792 }
1793 return status;
1794}

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 QwMollerADC_Channel::MultiplyBy ( const VQwHardwareChannel * valueptr)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1165 of file QwMollerADC_Channel.cc.

1166{
1167 const QwMollerADC_Channel* tmpptr;
1168 tmpptr = dynamic_cast<const QwMollerADC_Channel*>(valueptr);
1169 if (tmpptr!=NULL){
1170 *this *= *tmpptr;
1171 } else {
1172 TString loc="Standard exception from QwMollerADC_Channel::MultiplyBy = "
1173 +valueptr->GetElementName()+" is an incompatible type.";
1174 throw std::invalid_argument(loc.Data());
1175 }
1176}

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

+ Here is the call graph for this function:

◆ operator*()

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

Definition at line 1241 of file QwMollerADC_Channel.cc.

1242{
1243 QwMollerADC_Channel result = *this;
1244 result *= value;
1245 return result;
1246}

References QwMollerADC_Channel().

+ Here is the call graph for this function:

◆ operator*=() [1/2]

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

Definition at line 1248 of file QwMollerADC_Channel.cc.

1249{
1250 if (!IsNameEmpty()){
1251 for (Int_t i=0; i<fBlocksPerEvent; i++){
1252 this->fBlock[i] *= value.fBlock[i];
1253 this->fBlockM2[i] = 0.0;
1254 }
1255 this->fHardwareBlockSum *= value.fHardwareBlockSum;
1256 this->fHardwareBlockSumM2 = 0.0;
1257 this->fNumberOfSamples *= value.fNumberOfSamples;
1258 this->fSequenceNumber = 0;
1259 this->fErrorFlag |= (value.fErrorFlag);
1260 }
1261
1262 return *this;
1263}

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

+ Here is the call graph for this function:

◆ operator*=() [2/2]

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

Implements VQwHardwareChannel.

Definition at line 1293 of file QwMollerADC_Channel.cc.

1294{
1295 const QwMollerADC_Channel* tmpptr;
1296 tmpptr = dynamic_cast<const QwMollerADC_Channel*>(&source);
1297 if (tmpptr!=NULL){
1298 *this *= *tmpptr;
1299 } else {
1300 TString loc="Standard exception from QwMollerADC_Channel::operator*= "
1301 +source.GetElementName()+" "
1302 +this->GetElementName()+" are not of the same type";
1303 throw(std::invalid_argument(loc.Data()));
1304 }
1305 return *this;
1306}

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

+ Here is the call graph for this function:

◆ operator+()

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

Definition at line 1191 of file QwMollerADC_Channel.cc.

1192{
1193 QwMollerADC_Channel result = *this;
1194 result += value;
1195 return result;
1196}

References QwMollerADC_Channel().

+ Here is the call graph for this function:

◆ operator+=() [1/2]

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

Definition at line 1198 of file QwMollerADC_Channel.cc.

1199{
1200
1201 if (!IsNameEmpty()) {
1202 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
1203 this->fBlock[i] += value.fBlock[i];
1204 this->fBlockM2[i] = 0.0;
1205 }
1206 this->fHardwareBlockSum += value.fHardwareBlockSum;
1207 this->fHardwareBlockSumM2 = 0.0;
1208 this->fNumberOfSamples += value.fNumberOfSamples;
1209 this->fSequenceNumber = 0;
1210 this->fErrorFlag |= (value.fErrorFlag);
1211
1212 }
1213
1214 return *this;
1215}

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

+ Here is the call graph for this function:

◆ operator+=() [2/2]

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

Implements VQwHardwareChannel.

Definition at line 1265 of file QwMollerADC_Channel.cc.

1266{
1267 const QwMollerADC_Channel* tmpptr;
1268 tmpptr = dynamic_cast<const QwMollerADC_Channel*>(&source);
1269 if (tmpptr!=NULL){
1270 *this += *tmpptr;
1271 } else {
1272 TString loc="Standard exception from QwMollerADC_Channel::operator+= "
1273 +source.GetElementName()+" "
1274 +this->GetElementName()+" are not of the same type";
1275 throw(std::invalid_argument(loc.Data()));
1276 }
1277 return *this;
1278}

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

+ Here is the call graph for this function:

◆ operator-()

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

Definition at line 1217 of file QwMollerADC_Channel.cc.

1218{
1219 QwMollerADC_Channel result = *this;
1220 result -= value;
1221 return result;
1222}

References QwMollerADC_Channel().

+ Here is the call graph for this function:

◆ operator-=() [1/2]

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

Definition at line 1224 of file QwMollerADC_Channel.cc.

1225{
1226 if (!IsNameEmpty()){
1227 for (Int_t i=0; i<fBlocksPerEvent; i++){
1228 this->fBlock[i] -= value.fBlock[i];
1229 this->fBlockM2[i] = 0.0;
1230 }
1231 this->fHardwareBlockSum -= value.fHardwareBlockSum;
1232 this->fHardwareBlockSumM2 = 0.0;
1233 this->fNumberOfSamples += value.fNumberOfSamples;
1234 this->fSequenceNumber = 0;
1235 this->fErrorFlag |= (value.fErrorFlag);
1236 }
1237
1238 return *this;
1239}

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

+ Here is the call graph for this function:

◆ operator-=() [2/2]

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

Implements VQwHardwareChannel.

Definition at line 1279 of file QwMollerADC_Channel.cc.

1280{
1281 const QwMollerADC_Channel* tmpptr;
1282 tmpptr = dynamic_cast<const QwMollerADC_Channel*>(&source);
1283 if (tmpptr!=NULL){
1284 *this -= *tmpptr;
1285 } else {
1286 TString loc="Standard exception from QwMollerADC_Channel::operator-= "
1287 +source.GetElementName()+" "
1288 +this->GetElementName()+" are not of the same type";
1289 throw(std::invalid_argument(loc.Data()));
1290 }
1291 return *this;
1292}

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

+ Here is the call graph for this function:

◆ operator/=() [1/2]

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

Definition at line 1348 of file QwMollerADC_Channel.cc.

1349{
1350 // In this function, leave the "raw" variables untouched.
1351 //
1352 Double_t ratio;
1353 Double_t variance;
1354 if (!IsNameEmpty()) {
1355 // The variances are calculated using the following formula:
1356 // Var[ratio] = ratio^2 (Var[numer] / numer^2 + Var[denom] / denom^2)
1357 //
1358 // This requires that both the numerator and denominator are non-zero!
1359 //
1360 for (Int_t i = 0; i < 4; i++) {
1361 if (this->fBlock[i] != 0.0 && denom.fBlock[i] != 0.0){
1362 ratio = (this->fBlock[i]) / (denom.fBlock[i]);
1363 variance = ratio * ratio *
1364 (this->fBlockM2[i] / this->fBlock[i] / this->fBlock[i]
1365 + denom.fBlockM2[i] / denom.fBlock[i] / denom.fBlock[i]);
1366 fBlock[i] = ratio;
1367 fBlockM2[i] = variance;
1368 } else if (this->fBlock[i] == 0.0) {
1369 this->fBlock[i] = 0.0;
1370 this->fBlockM2[i] = 0.0;
1371 } else {
1372 QwVerbose << "Attempting to divide by zero block in "
1374 fBlock[i] = 0.0;
1375 fBlockM2[i] = 0.0;
1376 }
1377 }
1378 if (this->fHardwareBlockSum != 0.0 && denom.fHardwareBlockSum != 0.0){
1379 ratio = (this->fHardwareBlockSum) / (denom.fHardwareBlockSum);
1380 variance = ratio * ratio *
1382 + denom.fHardwareBlockSumM2 / denom.fHardwareBlockSum / denom.fHardwareBlockSum);
1383 fHardwareBlockSum = ratio;
1384 fHardwareBlockSumM2 = variance;
1385 } else if (this->fHardwareBlockSum == 0.0) {
1386 fHardwareBlockSum = 0.0;
1387 fHardwareBlockSumM2 = 0.0;
1388 } else {
1389 QwVerbose << "Attempting to divide by zero sum in "
1391 fHardwareBlockSumM2 = 0.0;
1392 }
1393 // Remaining variables
1394 // Don't change fNumberOfSamples, fSequenceNumber, fGoodEventCount,
1395 // 'OR' the HW error codes in the fErrorFlag values together.
1396 fErrorFlag |= (denom.fErrorFlag);//mix only the hardware error codes
1397 }
1398
1399 // Nanny
1401 QwWarning << "Angry Nanny: NaN detected in " << GetElementName() << QwLog::endl;
1402
1403 return *this;
1404}
#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(), QwMollerADC_Channel(), QwVerbose, and QwWarning.

+ Here is the call graph for this function:

◆ operator/=() [2/2]

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

Implements VQwHardwareChannel.

Definition at line 1307 of file QwMollerADC_Channel.cc.

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

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

+ Here is the call graph for this function:

◆ operator=()

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

Definition at line 1078 of file QwMollerADC_Channel.cc.

1079{
1080 if(this ==&value) return *this;
1081
1082 if (!IsNameEmpty()) {
1084 for (Int_t i=0; i<fBlocksPerEvent; i++){
1085 this->fBlock[i] = value.fBlock[i];
1086 this->fBlockM2[i] = value.fBlockM2[i];
1087 }
1091 this->fNumberOfSamples = value.fNumberOfSamples;
1092 this->fSequenceNumber = value.fSequenceNumber;
1093
1094 if (this->fDataToSave == kRaw){
1095 for (Int_t i=0; i<fBlocksPerEvent; i++){
1096 this->fBlock_raw[i] = value.fBlock_raw[i];
1097 this->fBlockSumSq_raw[i] = value.fBlockSumSq_raw[i];
1098 this->fBlock_min[i] = value.fBlock_min[i];
1099 this->fBlock_max[i] = value.fBlock_max[i];
1100 }
1103 }
1104 }
1105 return *this;
1106}
VQwHardwareChannel & operator=(const VQwHardwareChannel &value)
Arithmetic assignment operator: Should only copy event-based data.

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

+ Here is the call graph for this function:

◆ PrintErrorCounterHead()

void QwMollerADC_Channel::PrintErrorCounterHead ( )
static

Definition at line 1866 of file QwMollerADC_Channel.cc.

1867{
1868 TString message;
1869 message = Form("%30s","Device name");
1870 message += Form("%9s", "HW Sat");
1871 message += Form("%9s", "Sample");
1872 message += Form("%9s", "SW_HW");
1873 message += Form("%9s", "Sequence");
1874 message += Form("%9s", "SameHW");
1875 message += Form("%9s", "ZeroHW");
1876 message += Form("%9s", "EventCut");
1877 QwMessage << "---------------------------------------------------------------------------------------------" << QwLog::endl;
1878 QwMessage << message << QwLog::endl;
1879 QwMessage << "---------------------------------------------------------------------------------------------" << QwLog::endl;
1880 return;
1881}

References QwLog::endl(), and QwMessage.

Referenced by VQwDetectorArray::PrintErrorCounters().

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

◆ PrintErrorCounters()

void QwMollerADC_Channel::PrintErrorCounters ( ) const
overridevirtual

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

Reimplemented from VQwDataElement.

Definition at line 1889 of file QwMollerADC_Channel.cc.

1890{
1891 TString message;
1893 message = Form("%30s", GetElementName().Data());
1894 message += Form("%9d", fErrorCount_HWSat);
1895 message += Form("%9d", fErrorCount_sample);
1896 message += Form("%9d", fErrorCount_SW_HW);
1897 message += Form("%9d", fErrorCount_Sequence);
1898 message += Form("%9d", fErrorCount_SameHW);
1899 message += Form("%9d", fErrorCount_ZeroHW);
1900 message += Form("%9d", fNumEvtsWithEventCutsRejected);
1901
1902 if((fDataToSave == kRaw) && (!kFoundPedestal||!kFoundGain)){
1903 message += " >>>>> No Pedestal or Gain in map file";
1904 }
1905
1906 QwMessage << message << QwLog::endl;
1907 }
1908 return;
1909}

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 QwMollerADC_Channel::PrintErrorCounterTail ( )
static

Definition at line 1883 of file QwMollerADC_Channel.cc.

1884{
1885 QwMessage << "---------------------------------------------------------------------------------------------" << QwLog::endl;
1886 return;
1887}

References QwLog::endl(), and QwMessage.

Referenced by VQwDetectorArray::PrintErrorCounters().

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

◆ PrintInfo()

void QwMollerADC_Channel::PrintInfo ( ) const
overridevirtual

Print multiple lines of information about this data element.

Reimplemented from VQwDataElement.

Definition at line 546 of file QwMollerADC_Channel.cc.

547{
548 std::cout<<"***************************************"<<"\n";
549 std::cout<<"Subsystem "<<GetSubsystemName()<<"\n"<<"\n";
550 std::cout<<"Beam Instrument Type: "<<GetModuleType()<<"\n"<<"\n";
551 std::cout<<"QwMollerADC channel: "<<GetElementName()<<"\n"<<"\n";
552 std::cout<<"fPedestal= "<< fPedestal<<"\n";
553 std::cout<<"fCalibrationFactor= "<<fCalibrationFactor<<"\n";
554 std::cout<<"fBlocksPerEvent= "<<fBlocksPerEvent<<"\n"<<"\n";
555 std::cout<<"fSequenceNumber= "<<fSequenceNumber<<"\n";
556 std::cout<<"fNumberOfSamples= "<<fNumberOfSamples<<"\n";
557 std::cout<<"fBlock_raw ";
558
559 for (Int_t i = 0; i < fBlocksPerEvent; i++)
560 std::cout << " : " << fBlock_raw[i];
561 std::cout<<"\n";
562 std::cout<<"fHardwareBlockSum_raw= "<<fHardwareBlockSum_raw<<"\n";
563 std::cout<<"fSoftwareBlockSum_raw= "<<fSoftwareBlockSum_raw<<"\n";
564 std::cout<<"fBlock ";
565 for (Int_t i = 0; i < fBlocksPerEvent; i++)
566 std::cout << " : " <<std::setprecision(8) << fBlock[i];
567 std::cout << std::endl;
568
569 std::cout << "fHardwareBlockSum = "<<std::setprecision(8) <<fHardwareBlockSum << std::endl;
570 std::cout << "fHardwareBlockSumM2 = "<<fHardwareBlockSumM2 << std::endl;
571 std::cout << "fHardwareBlockSumError = "<<fHardwareBlockSumError << std::endl;
572
573 return;
574}

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 QwMollerADC_Channel::PrintValue ( ) const
overridevirtual

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

Reimplemented from VQwDataElement.

Definition at line 1709 of file QwMollerADC_Channel.cc.

1710{
1711 QwMessage << std::setprecision(8)
1712 << std::setw(18) << std::left << GetSubsystemName() << " "
1713 << std::setw(18) << std::left << GetModuleType() << " "
1714 << std::setw(18) << std::left << GetElementName() << " "
1715 << std::setw(12) << std::left << GetHardwareSum() << " +/- "
1716 << std::setw(12) << std::left << GetHardwareSumError() << " sig "
1717 << std::setw(12) << std::left << GetHardwareSumWidth() << " "
1718 << std::setw(10) << std::left << GetGoodEventCount() << " "
1719 << std::setw(12) << std::left << GetBlockValue(0) << " +/- "
1720 << std::setw(12) << std::left << GetBlockErrorValue(0) << " "
1721 << std::setw(12) << std::left << GetBlockValue(1) << " +/- "
1722 << std::setw(12) << std::left << GetBlockErrorValue(1) << " "
1723 << std::setw(12) << std::left << GetBlockValue(2) << " +/- "
1724 << std::setw(12) << std::left << GetBlockErrorValue(2) << " "
1725 << std::setw(12) << std::left << GetBlockValue(3) << " +/- "
1726 << std::setw(12) << std::left << GetBlockErrorValue(3) << " "
1727 << std::setw(12) << std::left << fGoodEventCount << " "
1728 << QwLog::endl;
1729 /*
1730 //for Debudding
1731 << std::setw(12) << std::left << fErrorFlag << " err "
1732 << std::setw(12) << std::left << fErrorConfigFlag << " c-err "
1733
1734 */
1735}
Double_t GetBlockErrorValue(size_t blocknum) const
Double_t GetHardwareSumWidth() 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 QwMollerADC_Channel::ProcessEvBuffer ( UInt_t * buffer,
UInt_t num_words_left,
UInt_t index = 0 )
overridevirtual

Decode the event data from a CODA buffer.

Implements VQwDataElement.

Definition at line 449 of file QwMollerADC_Channel.cc.

450{
451 UInt_t words_read = 0;
452 UInt_t localbuf[kWordsPerChannel] = {0};
453 // The conversion from UInt_t to Double_t discards the sign, so we need an intermediate
454 // static_cast from UInt_t to Int_t.
455 Int_t localbuf_signed[kWordsPerChannel] = {0};
456
457 if (IsNameEmpty()){
458 // This channel is not used, but is present in the data stream.
459 // Skip over this data.
460 words_read = fNumberOfDataWords;
461 } else if (num_words_left >= fNumberOfDataWords)
462 {
463 for (Int_t i=0; i<kWordsPerChannel; i++){
464 localbuf[i] = buffer[i];
465 localbuf_signed[i] = static_cast<Int_t>(localbuf[i]);
466 }
467
469 for (Int_t i=0; i<fBlocksPerEvent; i++){
470 fBlock_raw[i] = localbuf_signed[i*5];
471 fBlockSumSq_raw[i] = localbuf_signed[i*5+1];
472 fBlockSumSq_raw[i] += Long64_t (localbuf_signed[i*5+2]) << 32;
473 fBlock_min[i] = localbuf_signed[i*5+3];
474 fBlock_max[i] = localbuf_signed[i*5+4];
476 }
477 fHardwareBlockSum_raw = localbuf_signed[20];
478
479 /* Permanent change in the structure of the 6th word of the ADC readout.
480 * The upper 16 bits are the number of samples, and the upper 8 of the
481 * lower 16 are the sequence number. This matches the structure of
482 * the ADC readout in block read mode, and now also in register read mode.
483 * P.King, 2007sep04.
484 */
485 fSequenceNumber = (localbuf[25]>>8) & 0xFF;
486 fNumberOfSamples = (localbuf[25]>>16) & 0xFFFF;
487
488 words_read = fNumberOfDataWords;
489
490 } else
491 {
492 std::cerr << "QwMollerADC_Channel::ProcessEvBuffer: Not enough words!"
493 << std::endl;
494 }
495 return words_read;
496}
UInt_t fNumberOfDataWords
Number of raw data words in this data element.

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

+ Here is the call graph for this function:

◆ ProcessEvent()

void QwMollerADC_Channel::ProcessEvent ( )
overridevirtual

Process the event data according to pedestal and calibration factor.

Implements VQwHardwareChannel.

Definition at line 500 of file QwMollerADC_Channel.cc.

501{
502 if (fNumberOfSamples == 0 && fHardwareBlockSum_raw == 0) {
503 // There isn't valid data for this channel. Just flag it and
504 // move on.
505 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
506 fBlock[i] = 0.0;
507 fBlockM2[i] = 0.0;
508 }
509 fHardwareBlockSum = 0.0;
512 } else if (fNumberOfSamples == 0) {
513 // This is probably a more serious problem.
514 QwWarning << "QwMollerADC_Channel::ProcessEvent: Channel "
515 << this->GetElementName().Data()
516 << " has fNumberOfSamples==0 but has valid data in the hardware sum. "
517 << "Flag this as an error."
518 << QwLog::endl;
519 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
520 fBlock[i] = 0.0;
521 fBlockM2[i] = 0.0;
522 }
523 fHardwareBlockSum = 0.0;
526 } else {
527 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
529 fBlockM2[i] = 0.0; // second moment is zero for single events
530 }
532 fHardwareBlockSumM2 = 0.0; // second moment is zero for single events
533 }
534 return;
535}

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 QwMollerADC_Channel::Product ( const QwMollerADC_Channel & value1,
const QwMollerADC_Channel & value2 )

Definition at line 1423 of file QwMollerADC_Channel.cc.

1424{
1425 if (!IsNameEmpty()){
1426 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
1427 this->fBlock[i] = (value1.fBlock[i]) * (value2.fBlock[i]);
1428 // For a single event the second moment is still zero
1429 this->fBlockM2[i] = 0.0;
1430 }
1431
1432 // For a single event the second moment is still zero
1433 this->fHardwareBlockSumM2 = 0.0;
1435 this->fNumberOfSamples = value1.fNumberOfSamples;
1436 this->fSequenceNumber = 0;
1437 this->fErrorFlag = (value1.fErrorFlag|value2.fErrorFlag);
1438 }
1439 return;
1440}

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

+ Here is the call graph for this function:

◆ RandomizeEventData()

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

Internally generate random event data.

Implements MQwMockable.

Definition at line 271 of file QwMollerADC_Channel.cc.

272{
273 // updated to calculate the drift for each block individually
274 Double_t drift = 0.0;
275 for (Int_t i = 0; i < fBlocksPerEvent; i++){
276 drift = 0.0;
277 if (i >= 1){
279 }
280 for (UInt_t i = 0; i < fMockDriftFrequency.size(); i++) {
281 drift += fMockDriftAmplitude[i] * sin(2.0 * Qw::pi * fMockDriftFrequency[i] * time + fMockDriftPhase[i]);
282 //std::cout << "Drift: " << drift << std::endl;
283 }
284 }
285
286 // Calculate signal
287 fHardwareBlockSum = 0.0;
288 fHardwareBlockSumM2 = 0.0; // second moment is zero for single events
289 fBlock_max[4] = kMinInt;
290 fBlock_min[4] = kMaxInt;
291
292 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
293 double tmpvar = GetRandomValue();
294
295 fBlock[i] = fMockGaussianMean + drift;
296
298 fBlock[i] += helicity*fMockAsymmetry;
299 } else {
300 fBlock[i] *= 1.0 + helicity*fMockAsymmetry;
301 }
302 fBlock[i] += fMockGaussianSigma*tmpvar*sqrt(fBlocksPerEvent);
303 fBlockM2[i] = 0.0; // second moment is zero for single events
305
306 }
308 fSequenceNumber = 0;
310 // SetEventData(block);
311 // delete block;
312 return;
313}
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, fBlock_max, fBlock_min, 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 QwMollerADC_Channel::Ratio ( const QwMollerADC_Channel & numer,
const QwMollerADC_Channel & denom )

Definition at line 1335 of file QwMollerADC_Channel.cc.

1336{
1337 if (!IsNameEmpty()) {
1338 *this = numer;
1339 *this /= denom;
1340
1342 fSequenceNumber = 0;
1344 fErrorFlag = (numer.fErrorFlag|denom.fErrorFlag);
1345 }
1346}

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

+ Here is the call graph for this function:

◆ Scale()

void QwMollerADC_Channel::Scale ( Double_t Offset)
overridevirtual

Implements VQwHardwareChannel.

Definition at line 1455 of file QwMollerADC_Channel.cc.

1456{
1457 if (!IsNameEmpty()){
1458 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
1459 fBlock[i] *= scale;
1460 fBlockM2[i] *= scale * scale;
1461 }
1462 fHardwareBlockSum *= scale;
1463 fHardwareBlockSumM2 *= scale * scale;
1464 }
1465}

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

Referenced by QwEnergyCalculator::GetProjectedPosition(), and QwEnergyCalculator::ProcessEvent().

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

◆ ScaledAdd()

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

Implements VQwHardwareChannel.

Definition at line 1911 of file QwMollerADC_Channel.cc.

1912{
1913 const QwMollerADC_Channel* input = dynamic_cast<const QwMollerADC_Channel*>(value);
1914
1915 // follows same steps as += but w/ scaling factor
1916 if(input!=NULL && !IsNameEmpty()){
1917 // QwWarning << "Adding " << input->GetElementName()
1918 // << " to " << GetElementName()
1919 // << " with scale factor " << scale
1920 // << QwLog::endl;
1921 // PrintValue();
1922 // input->PrintValue();
1923 for(Int_t i = 0; i < fBlocksPerEvent; i++){
1924 this -> fBlock[i] += scale * input->fBlock[i];
1925 this -> fBlockM2[i] = 0.0;
1926 }
1927 this -> fHardwareBlockSum += scale * input->fHardwareBlockSum;
1928 this -> fHardwareBlockSumM2 = 0.0;
1929 this -> fNumberOfSamples += input->fNumberOfSamples;
1930 this -> fSequenceNumber = 0;
1931 this -> fErrorFlag |= (input->fErrorFlag);
1932 } else if (input == NULL && value != NULL) {
1933 TString loc="Standard exception from QwMollerADC_Channel::ScaledAdd "
1934 +value->GetElementName()+" "
1935 +this->GetElementName()+" are not of the same type";
1936 throw(std::invalid_argument(loc.Data()));
1937 }
1938}

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

+ Here is the call graph for this function:

◆ SetCalibrationToVolts()

void QwMollerADC_Channel::SetCalibrationToVolts ( )
inline

Definition at line 279 of file QwMollerADC_Channel.h.

References kMollerADC_VoltsPerBit, and VQwHardwareChannel::SetCalibrationFactor().

+ Here is the call graph for this function:

◆ SetDefaultSampleSize()

void QwMollerADC_Channel::SetDefaultSampleSize ( size_t num_samples_map)
inline

Definition at line 122 of file QwMollerADC_Channel.h.

122 {
123 // This will be checked against the no.of samples read by the module
124 fNumberOfSamples_map = num_samples_map;
125 };

References fNumberOfSamples_map.

Referenced by LoadChannelParameters().

+ Here is the caller graph for this function:

◆ SetEventData()

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

Definition at line 350 of file QwMollerADC_Channel.cc.

351{
352 fHardwareBlockSum = 0.0;
353 fHardwareBlockSumM2 = 0.0; // second moment is zero for single events
354 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
355 fBlock[i] = block[i];
356 fBlockM2[i] = 0.0; // second moment is zero for single events
357 fHardwareBlockSum += block[i];
358 }
360
361 fSequenceNumber = sequencenumber;
363
364// Double_t thispedestal = 0.0;
365// thispedestal = fPedestal * fNumberOfSamples;
366
368 return;
369}
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 QwMollerADC_Channel::SetHardwareSum ( Double_t hwsum,
UInt_t sequencenumber = 0 )

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

Definition at line 334 of file QwMollerADC_Channel.cc.

335{
336 Double_t* block = new Double_t[fBlocksPerEvent];
337 for (Int_t i = 0; i < fBlocksPerEvent; i++){
338 block[i] = hwsum / fBlocksPerEvent;
339 }
340 SetEventData(block);
341 delete[] block;
342 return;
343}
void SetEventData(Double_t *block, UInt_t sequencenumber=0)

References fBlocksPerEvent, and SetEventData().

+ Here is the call graph for this function:

◆ SetMollerADCSaturationLimt()

void QwMollerADC_Channel::SetMollerADCSaturationLimt ( Double_t sat_volts = 8.5)
inline

Definition at line 224 of file QwMollerADC_Channel.h.

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

References fSaturationABSLimit.

Referenced by QwMollerADC_Channel(), and QwMollerADC_Channel().

+ Here is the caller graph for this function:

◆ SetRawEventData()

void QwMollerADC_Channel::SetRawEventData ( )
overridevirtual

Implements MQwMockable.

References QwMollerADC_Channel(), VQwDataElement::VQwDataElement(), and VQwHardwareChannel::VQwHardwareChannel().

Referenced by SetEventData().

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

◆ SmearByResolution()

void QwMollerADC_Channel::SmearByResolution ( double resolution)
overridevirtual

Implements MQwMockable.

Definition at line 315 of file QwMollerADC_Channel.cc.

315 {
316
317 fHardwareBlockSum = 0.0;
318 fHardwareBlockSumM2 = 0.0; // second moment is zero for single events
319 for (Int_t i = 0; i < fBlocksPerEvent; i++) {
320
321 fBlock[i] += resolution*sqrt(fBlocksPerEvent) * GetRandomValue();
322
323 fBlockM2[i] = 0.0; // second moment is zero for single events
325 }
326 // std::cout << std::endl;
328
330 // SetRawEventData();
331 return;
332}

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

+ Here is the call graph for this function:

◆ SubtractValueFrom()

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

Implements VQwHardwareChannel.

Definition at line 1153 of file QwMollerADC_Channel.cc.

1154{
1155 const QwMollerADC_Channel* tmpptr;
1156 tmpptr = dynamic_cast<const QwMollerADC_Channel*>(valueptr);
1157 if (tmpptr!=NULL){
1158 *this -= *tmpptr;
1159 } else {
1160 TString loc="Standard exception from QwMollerADC_Channel::SubtractValueFrom = "
1161 +valueptr->GetElementName()+" is an incompatible type.";
1162 throw std::invalid_argument(loc.Data());
1163 }
1164}

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

+ Here is the call graph for this function:

◆ Sum()

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

Definition at line 1323 of file QwMollerADC_Channel.cc.

1324{
1325 *this = value1;
1326 *this += value2;
1327}

References QwMollerADC_Channel().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

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

Definition at line 1737 of file QwMollerADC_Channel.cc.

1738{
1739 stream << channel.GetHardwareSum();
1740 return stream;
1741}

References GetHardwareSum(), and QwMollerADC_Channel().

Field Documentation

◆ bBlock

Bool_t QwMollerADC_Channel::bBlock
private

Definition at line 403 of file QwMollerADC_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bBlock_raw

Bool_t QwMollerADC_Channel::bBlock_raw
private

Definition at line 404 of file QwMollerADC_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bDEBUG

const Bool_t QwMollerADC_Channel::bDEBUG =kFALSE
staticprivate

debugging display purposes

For MollerADC data element trimming uses

Definition at line 398 of file QwMollerADC_Channel.h.

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

◆ bDevice_Error_Code

Bool_t QwMollerADC_Channel::bDevice_Error_Code
private

Definition at line 406 of file QwMollerADC_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bHw_sum

Bool_t QwMollerADC_Channel::bHw_sum
private

Definition at line 401 of file QwMollerADC_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bHw_sum_raw

Bool_t QwMollerADC_Channel::bHw_sum_raw
private

Definition at line 402 of file QwMollerADC_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bNum_samples

Bool_t QwMollerADC_Channel::bNum_samples
private

Definition at line 405 of file QwMollerADC_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ bSequence_number

Bool_t QwMollerADC_Channel::bSequence_number
private

Definition at line 407 of file QwMollerADC_Channel.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

◆ fADC_Same_NumEvt

Int_t QwMollerADC_Channel::fADC_Same_NumEvt
private

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

Definition at line 388 of file QwMollerADC_Channel.h.

Referenced by ApplyHWChecks(), and InitializeChannel().

◆ fBlock

◆ fBlock_max

Int_t QwMollerADC_Channel::fBlock_max[5]
private

◆ fBlock_min

Int_t QwMollerADC_Channel::fBlock_min[5]
private

◆ fBlock_raw

Int_t QwMollerADC_Channel::fBlock_raw[4]
private

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

Definition at line 340 of file QwMollerADC_Channel.h.

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

◆ fBlockError

Double_t QwMollerADC_Channel::fBlockError[4]
private

Uncertainty on the sub-block.

Definition at line 360 of file QwMollerADC_Channel.h.

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

◆ fBlockM2

◆ fBlocksPerEvent

◆ fBlockSumSq_raw

Long64_t QwMollerADC_Channel::fBlockSumSq_raw[5]
private

◆ fErrorCount_HWSat

Int_t QwMollerADC_Channel::fErrorCount_HWSat
private

check to see ADC channel is saturated

Definition at line 374 of file QwMollerADC_Channel.h.

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

◆ fErrorCount_SameHW

Int_t QwMollerADC_Channel::fErrorCount_SameHW
private

check to see ADC returning same HW value

Definition at line 378 of file QwMollerADC_Channel.h.

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

◆ fErrorCount_sample

Int_t QwMollerADC_Channel::fErrorCount_sample
private

for sample size check

Definition at line 375 of file QwMollerADC_Channel.h.

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

◆ fErrorCount_Sequence

Int_t QwMollerADC_Channel::fErrorCount_Sequence
private

sequence number check

Definition at line 377 of file QwMollerADC_Channel.h.

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

◆ fErrorCount_SW_HW

Int_t QwMollerADC_Channel::fErrorCount_SW_HW
private

HW_sum==SW_sum check.

Definition at line 376 of file QwMollerADC_Channel.h.

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

◆ fErrorCount_ZeroHW

Int_t QwMollerADC_Channel::fErrorCount_ZeroHW
private

check to see ADC returning zero

Definition at line 379 of file QwMollerADC_Channel.h.

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

◆ fHardwareBlockSum

◆ fHardwareBlockSum_raw

Int_t QwMollerADC_Channel::fHardwareBlockSum_raw
private

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

Definition at line 341 of file QwMollerADC_Channel.h.

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

◆ fHardwareBlockSumError

Double_t QwMollerADC_Channel::fHardwareBlockSumError
private

Uncertainty on the hardware sum.

Definition at line 363 of file QwMollerADC_Channel.h.

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

◆ fHardwareBlockSumM2

◆ fNumberOfSamples

◆ fNumberOfSamples_map

UInt_t QwMollerADC_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 370 of file QwMollerADC_Channel.h.

Referenced by ApplyHWChecks(), CopyFrom(), CopyParameters(), ForceMapfileSampleSize(), InitializeChannel(), QwMollerADC_Channel(), QwMollerADC_Channel(), RandomizeEventData(), SetDefaultSampleSize(), SetEventData(), and SmearByResolution().

◆ fNumEvtsWithEventCutsRejected

Int_t QwMollerADC_Channel::fNumEvtsWithEventCutsRejected
private

Counts the Event cut rejected events.

Definition at line 381 of file QwMollerADC_Channel.h.

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

◆ fPrev_HardwareBlockSum

Double_t QwMollerADC_Channel::fPrev_HardwareBlockSum
private

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

Definition at line 391 of file QwMollerADC_Channel.h.

Referenced by ApplyHWChecks(), and InitializeChannel().

◆ fPreviousSequenceNumber

UInt_t QwMollerADC_Channel::fPreviousSequenceNumber
private

Previous event sequence number for this channel.

Definition at line 368 of file QwMollerADC_Channel.h.

Referenced by InitializeChannel().

◆ fSaturationABSLimit

Double_t QwMollerADC_Channel::fSaturationABSLimit
private

absolute value of the MollerADC saturation volt

Definition at line 395 of file QwMollerADC_Channel.h.

Referenced by CopyFrom(), GetMollerADCSaturationLimt(), QwMollerADC_Channel(), QwMollerADC_Channel(), and SetMollerADCSaturationLimt().

◆ fSequenceNo_Counter

Int_t QwMollerADC_Channel::fSequenceNo_Counter
private

Internal counter to keep track of the sequence number.

Definition at line 390 of file QwMollerADC_Channel.h.

Referenced by ApplyHWChecks(), and InitializeChannel().

◆ fSequenceNo_Prev

Int_t QwMollerADC_Channel::fSequenceNo_Prev
private

Keep the sequence number of the last event.

Definition at line 389 of file QwMollerADC_Channel.h.

Referenced by ApplyHWChecks(), and InitializeChannel().

◆ fSequenceNumber

◆ fSoftwareBlockSum_raw

Int_t QwMollerADC_Channel::fSoftwareBlockSum_raw
private

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

Definition at line 342 of file QwMollerADC_Channel.h.

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

◆ kDEBUG

const Bool_t QwMollerADC_Channel::kDEBUG = kFALSE
staticprivate

Definition at line 318 of file QwMollerADC_Channel.h.

Referenced by ConstructBranch(), and ConstructBranchAndVector().

◆ kMaxChannels

const Int_t QwMollerADC_Channel::kMaxChannels = 8
staticprivate

Definition at line 320 of file QwMollerADC_Channel.h.

Referenced by GetBufferOffset().

◆ kMollerADC_VoltsPerBit

const Double_t QwMollerADC_Channel::kMollerADC_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 324 of file QwMollerADC_Channel.h.

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

◆ kTimePerSample

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

◆ kWordsPerChannel

const Int_t QwMollerADC_Channel::kWordsPerChannel = 30
staticprivate

Definition at line 319 of file QwMollerADC_Channel.h.

Referenced by EncodeEventData(), GetBufferOffset(), and ProcessEvBuffer().


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