JAPAn
Just Another Parity Analyzer
|
Template for a combined beam current monitor using weighted inputs. More...
#include <QwCombinedBCM.h>
Public Member Functions | |
QwCombinedBCM () | |
QwCombinedBCM (TString name) | |
QwCombinedBCM (TString subsystem, TString name) | |
QwCombinedBCM (TString subsystemname, TString name, TString type) | |
QwCombinedBCM (const QwCombinedBCM &source) | |
~QwCombinedBCM () override | |
void | SetBCMForCombo (VQwBCM *bcm, Double_t weight, Double_t sumqw) override |
Int_t | ProcessEvBuffer (UInt_t *buffer, UInt_t word_position_in_buffer, UInt_t subelement=0) override |
Process the raw event buffer and decode into the channel. | |
void | InitializeChannel (TString name, TString datatosave) override |
void | InitializeChannel (TString subsystem, TString name, TString datatosave) override |
void | InitializeChannel (TString subsystem, TString name, TString type, TString datatosave) |
void | ProcessEvent () override |
void | GetProjectedCharge (VQwBCM *device) override |
void | RandomizeEventData (int helicity=0, double time=0.0) override |
size_t | GetNumberOfElements () override |
TString | GetSubElementName (Int_t index) override |
void | LoadMockDataParameters (QwParameterFile ¶mfile) override |
Bool_t | ApplyHWChecks () |
Bool_t | ApplySingleEventCuts () override |
UInt_t | UpdateErrorFlag () override |
VQwBCM & | operator= (const VQwBCM &value) override |
QwCombinedBCM & | operator= (const QwCombinedBCM &value) |
void | SetPedestal (Double_t ped) override |
Set the pedestal value for the beam current monitor. | |
void | SetCalibrationFactor (Double_t calib) override |
Set the calibration factor for the beam current monitor. | |
VQwHardwareChannel * | GetCharge () override |
const VQwHardwareChannel * | GetCharge () const override |
![]() | |
QwBCM () | |
QwBCM (TString name) | |
QwBCM (TString subsystemname, TString name) | |
QwBCM (TString subsystemname, TString name, TString type, TString clock="") | |
QwBCM (const QwBCM &source) | |
~QwBCM () override | |
void | InitializeChannel (TString subsystem, TString name, TString type, TString datatosave) |
Initialize the BCM with subsystem, module type, and name. | |
void | ClearEventData () override |
Clear event-scoped data in the underlying channel. | |
void | LoadChannelParameters (QwParameterFile ¶mfile) override |
void | SetRandomEventDriftParameters (Double_t amplitude, Double_t phase, Double_t frequency) |
Configure deterministic drift parameters applied per event. | |
void | AddRandomEventDriftParameters (Double_t amplitude, Double_t phase, Double_t frequency) override |
Add additional drift parameters to the drift model. | |
void | SetRandomEventParameters (Double_t mean, Double_t sigma) override |
Configure Gaussian mock data parameters. | |
void | SetRandomEventAsymmetry (Double_t asymmetry) override |
Set an asymmetry parameter applied to helicity states. | |
void | SetResolution (Double_t resolution) |
void | ApplyResolutionSmearing () override |
Smear the channel by the configured resolution. | |
void | FillRawEventData () override |
Materialize the current event state as raw event data. | |
void | EncodeEventData (std::vector< UInt_t > &buffer) override |
Encode current event data into an output buffer. | |
void | UseExternalRandomVariable () |
Use an external random variable source for mock data. | |
void | SetExternalRandomVariable (Double_t random_variable) |
Set the external random variable to drive mock data. | |
Bool_t | ApplyHWChecks () |
Apply hardware checks and return whether the event is valid. | |
void | IncrementErrorCounters () override |
Increment error counters (number of failed events). | |
void | PrintErrorCounters () const override |
Print error counters (const overload). | |
UInt_t | GetEventcutErrorFlag () override |
return the error flag on this channel/device | |
void | UpdateErrorFlag (const VQwBCM *ev_error) override |
Merge error flags from a reference BCM into this instance. | |
UInt_t | GetErrorCode () const |
Int_t | SetSingleEventCuts (Double_t mean=0, Double_t sigma=0) |
Set basic single-event cut limits. | |
void | SetSingleEventCuts (UInt_t errorflag, Double_t min=0, Double_t max=0, Double_t stability=0, Double_t burplevel=0) override |
Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel. | |
void | SetDefaultSampleSize (Int_t sample_size) override |
Set the default sample size used by the channel. | |
void | SetEventCutMode (Int_t bcuts) override |
void | PrintValue () const override |
Print a compact value summary for this BCM. | |
void | PrintInfo () const override |
Print detailed information for this BCM. | |
std::string | GetExternalClockName () override |
Bool_t | NeedsExternalClock () override |
void | SetExternalClockPtr (const VQwHardwareChannel *clock) override |
void | SetExternalClockName (const std::string name) override |
Double_t | GetNormClockValue () override |
VQwBCM & | operator+= (const VQwBCM &value) override |
Polymorphic add-assign from VQwBCM if types match. | |
VQwBCM & | operator-= (const VQwBCM &value) override |
Polymorphic subtract-assign from VQwBCM. | |
QwBCM & | operator= (const QwBCM &value) |
Copy-assign from another BCM (event-scoped data). | |
QwBCM & | operator+= (const QwBCM &value) |
Add-assign from another BCM (sum raw channels). | |
QwBCM & | operator-= (const QwBCM &value) |
Subtract-assign from another BCM (difference raw channels). | |
void | Ratio (const VQwBCM &numer, const VQwBCM &denom) override |
Polymorphic ratio formation for BCM. | |
void | Ratio (const QwBCM &numer, const QwBCM &denom) |
Type-specific ratio formation for BCM. | |
void | Scale (Double_t factor) override |
Scale the underlying channel by a constant factor. | |
void | AccumulateRunningSum (const VQwBCM &, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override |
Accumulate running sums from another BCM into this one. | |
void | DeaccumulateRunningSum (VQwBCM &value, Int_t ErrorMask=0xFFFFFFF) override |
Remove a single entry from the running sums using a source value. | |
void | CalculateRunningAverage () override |
Update running averages for the underlying channel. | |
Bool_t | CheckForBurpFail (const VQwDataElement *ev_error) override |
Check for burp failures by delegating to the underlying channel. | |
void | ConstructHistograms (TDirectory *folder, TString &prefix) override |
Define histograms for this BCM (delegated to underlying channel). | |
void | FillHistograms () override |
Fill histograms for this BCM if enabled. | |
void | ConstructBranchAndVector (TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override |
Construct ROOT branches and value vector entries. | |
void | ConstructBranch (TTree *tree, TString &prefix) override |
Construct ROOT branches for this BCM (if enabled). | |
void | ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &modulelist) override |
Construct ROOT branches for this BCM using a trim file filter. | |
void | FillTreeVector (QwRootTreeBranchVector &values) const override |
Fill tree vector entries for this BCM. | |
std::vector< QwDBInterface > | GetDBEntry () |
std::vector< QwErrDBInterface > | GetErrDBEntry () |
Double_t | GetValue () override |
Get the current value of the beam current. | |
Double_t | GetValueError () override |
Get the statistical error on the beam current. | |
Double_t | GetValueWidth () override |
Get the width of the beam current distribution. | |
![]() | |
~VQwBCM () override | |
UInt_t | UpdateErrorFlag () override |
Update the error flag based on the error flags of internally contained objects Return parameter is the "Eventcut Error Flag". | |
![]() | |
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 |
virtual void | AssignValueFrom (const VQwDataElement *) |
VQwDataElement & | operator+= (const VQwDataElement &) |
Addition-assignment operator. | |
VQwDataElement & | operator-= (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 void | SetNeedsExternalClock (Bool_t) |
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 | |
![]() | |
void | ShareHistograms (const MQwHistograms *source) |
Share histogram pointers between objects. | |
Private Attributes | |
std::vector< QwBCM< T > * > | fElement |
std::vector< Double_t > | fWeights |
Double_t | fSumQweights |
Double_t | fLastTripTime |
Double_t | fTripPeriod |
Double_t | fTripLength |
Double_t | fTripRamp |
Double_t | fProbabilityOfTrip |
Parity mock data generation | |
static boost::mt19937 | fRandomnessGenerator |
Internal randomness generator. | |
static boost::random::uniform_real_distribution< double > | fDistribution |
Internal normal probability distribution. | |
static boost::variate_generator< boost::mt19937, boost::random::uniform_real_distribution< double > > | fRandomVariable |
Internal normal random variable. | |
static void | SetTripSeed (uint seedval) |
Additional Inherited Members | |
![]() | |
enum | EDataToSave { kRaw = 0 , kDerived , kMoments } |
![]() | |
static VQwBCM * | Create (TString subsystemname, TString type, TString name, TString clock="") |
Factory method to create a concrete BCM instance for the requested module type. | |
static VQwBCM * | Create (const VQwBCM &source) |
Copy constructor factory method to clone a BCM from an existing instance. | |
static VQwBCM * | CreateCombo (TString subsystemname, TString type, TString name) |
Factory method to create a concrete Combined BCM for the requested module type. | |
static VQwBCM * | CreateCombo (const VQwBCM &source) |
![]() | |
VQwBCM (VQwDataElement &beamcurrent) | |
VQwBCM (VQwDataElement &beamcurrent, TString) | |
![]() | |
void | SetNumberOfDataWords (const UInt_t &numwords) |
Set the number of data words in this data element. | |
VQwDataElement & | operator= (const VQwDataElement &value) |
Arithmetic assignment operator: Should only copy event-based data. | |
void | UpdateErrorFlag (const UInt_t &error) |
![]() | |
MQwHistograms () | |
Default constructor. | |
MQwHistograms (const MQwHistograms &source) | |
Copy constructor. | |
virtual | ~MQwHistograms () |
Virtual destructor. | |
MQwHistograms & | operator= (const MQwHistograms &value) |
void | Fill_Pointer (TH1_ptr hist_ptr, Double_t value) |
void | AddHistogram (TH1 *h) |
Register a histogram. | |
![]() | |
T | fBeamCurrent |
![]() | |
VQwDataElement & | fBeamCurrent_ref |
![]() | |
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 | |
![]() | |
std::vector< TH1_ptr > | fHistograms |
Histograms associated with this data element. | |
Template for a combined beam current monitor using weighted inputs.
Aggregates multiple BCMs into a single effective current channel by applying user-provided weights. Provides event processing hooks and error propagation consistent with VQwBCM.
Definition at line 38 of file QwCombinedBCM.h.
|
inline |
Definition at line 41 of file QwCombinedBCM.h.
Referenced by GetCharge(), operator=(), operator=(), and QwCombinedBCM().
|
inline |
Definition at line 42 of file QwCombinedBCM.h.
References InitializeChannel().
|
inline |
Definition at line 45 of file QwCombinedBCM.h.
References InitializeChannel().
|
inline |
Definition at line 48 of file QwCombinedBCM.h.
References InitializeChannel(), and VQwDataElement::SetSubsystemName().
|
inline |
Definition at line 52 of file QwCombinedBCM.h.
References QwBCM< T >::QwBCM(), and QwCombinedBCM().
|
inlineoverride |
Definition at line 55 of file QwCombinedBCM.h.
|
inline |
Definition at line 79 of file QwCombinedBCM.h.
|
overridevirtual |
Apply single-event cuts: first propagate error codes from constituent BCMs, then apply cuts using the inherited BCM logic.
Reimplemented from QwBCM< T >.
Definition at line 243 of file QwCombinedBCM.cc.
References QwBCM< T >::ApplySingleEventCuts(), QwBCM< T >::fBeamCurrent, and fElement.
|
inlineoverridevirtual |
Reimplemented from VQwBCM.
Definition at line 108 of file QwCombinedBCM.h.
References GetCharge(), and QwCombinedBCM().
|
inlineoverridevirtual |
Reimplemented from QwBCM< T >.
Definition at line 104 of file QwCombinedBCM.h.
References QwBCM< T >::fBeamCurrent.
Referenced by GetCharge().
|
inlineoverridevirtual |
|
overridevirtual |
Project the combined current to a device channel, applying resolution smearing and filling raw event data.
Reimplemented from VQwBCM.
Definition at line 152 of file QwCombinedBCM.cc.
References VQwBCM::ApplyResolutionSmearing(), QwBCM< T >::fBeamCurrent, VQwBCM::FillRawEventData(), VQwBCM::GetCharge(), and VQwBCM::VQwBCM().
|
inlineoverridevirtual |
|
overridevirtual |
Initialize combined BCM with simple name and default settings.
Reimplemented from QwBCM< T >.
Definition at line 77 of file QwCombinedBCM.cc.
References QwBCM< T >::fBeamCurrent, fLastTripTime, SetCalibrationFactor(), VQwDataElement::SetElementName(), and SetPedestal().
Referenced by QwCombinedBCM(), QwCombinedBCM(), and QwCombinedBCM().
|
overridevirtual |
Initialize combined BCM with subsystem scoping.
Reimplemented from QwBCM< T >.
Definition at line 88 of file QwCombinedBCM.cc.
References QwBCM< T >::fBeamCurrent, fLastTripTime, SetCalibrationFactor(), VQwDataElement::SetElementName(), and SetPedestal().
void QwCombinedBCM< T >::InitializeChannel | ( | TString | subsystem, |
TString | name, | ||
TString | type, | ||
TString | datatosave ) |
Definition at line 98 of file QwCombinedBCM.cc.
References QwBCM< T >::fBeamCurrent, fLastTripTime, SetCalibrationFactor(), VQwDataElement::SetElementName(), VQwDataElement::SetModuleType(), and SetPedestal().
|
overridevirtual |
Load mock data parameters including beam trip settings and resolution. Recognizes 'beamtrip' and 'resolution' keywords.
Reimplemented from QwBCM< T >.
Definition at line 209 of file QwCombinedBCM.cc.
References QwBCM< T >::fBeamCurrent, fProbabilityOfTrip, fTripLength, fTripPeriod, fTripRamp, QwParameterFile::GetLine(), QwParameterFile::GetNextToken(), QwParameterFile::GetTypedNextToken(), Qw::sec, and QwBCM< T >::SetResolution().
QwCombinedBCM< T > & QwCombinedBCM< T >::operator= | ( | const QwCombinedBCM< T > & | value | ) |
Assignment operator: copy the beam current value.
Definition at line 329 of file QwCombinedBCM.cc.
References QwBCM< T >::fBeamCurrent, VQwDataElement::GetElementName(), and QwCombinedBCM().
|
overridevirtual |
Polymorphic assignment operator.
Reimplemented from QwBCM< T >.
Definition at line 339 of file QwCombinedBCM.cc.
References QwBCM< T >::fBeamCurrent, VQwDataElement::GetElementName(), QwCombinedBCM(), and VQwBCM::VQwBCM().
|
inlineoverridevirtual |
Process the raw event buffer and decode into the channel.
Reimplemented from QwBCM< T >.
Definition at line 61 of file QwCombinedBCM.h.
References QwBPMStripline< T >::subelement.
|
overridevirtual |
Compute weighted average of constituent BCM currents and normalize by total weight sum.
Reimplemented from QwBCM< T >.
Definition at line 116 of file QwCombinedBCM.cc.
References QwBCM< T >::ClearEventData(), QwLog::endl(), QwBCM< T >::fBeamCurrent, fElement, fSumQweights, fWeights, VQwDataElement::GetElementName(), and QwMessage.
|
overridevirtual |
Generate random event data and optionally simulate beam trips with configurable trip period, length, and ramp duration.
Reimplemented from QwBCM< T >.
Definition at line 167 of file QwCombinedBCM.cc.
References QwBCM< T >::fBeamCurrent, fLastTripTime, fProbabilityOfTrip, fRandomVariable, fTripLength, and fTripRamp.
|
overridevirtual |
Add a constituent BCM to the combination with specified weight.
bcm | Pointer to the BCM to include. |
weight | Charge weight for this BCM. |
sumqw | Total sum of absolute weights. |
Reimplemented from QwBCM< T >.
Definition at line 65 of file QwCombinedBCM.cc.
References fElement, fSumQweights, fWeights, QwBCM< T >::QwBCM(), and VQwBCM::VQwBCM().
|
inlineoverridevirtual |
Set the calibration factor for the beam current monitor.
calibration | Multiplicative calibration factor. |
Reimplemented from QwBCM< T >.
Definition at line 100 of file QwCombinedBCM.h.
References QwBCM< T >::SetCalibrationFactor().
Referenced by InitializeChannel(), InitializeChannel(), and InitializeChannel().
|
inlineoverridevirtual |
Set the pedestal value for the beam current monitor.
pedestal | Pedestal offset to apply to the raw signal. |
Reimplemented from QwBCM< T >.
Definition at line 97 of file QwCombinedBCM.h.
References QwBCM< T >::SetPedestal().
Referenced by InitializeChannel(), InitializeChannel(), and InitializeChannel().
|
static |
Set random number generator seed for beam trip simulation.
Definition at line 47 of file QwCombinedBCM.cc.
References fRandomVariable.
Referenced by main().
|
overridevirtual |
Update error flags by propagating error codes from constituent BCMs.
Reimplemented from VQwDataElement.
Definition at line 264 of file QwCombinedBCM.cc.
References QwBCM< T >::fBeamCurrent, and fElement.
|
staticprotected |
Internal normal probability distribution.
Definition at line 131 of file QwCombinedBCM.h.
|
private |
Definition at line 115 of file QwCombinedBCM.h.
Referenced by ApplySingleEventCuts(), GetNumberOfElements(), GetSubElementName(), ProcessEvent(), SetBCMForCombo(), and UpdateErrorFlag().
|
private |
Definition at line 119 of file QwCombinedBCM.h.
Referenced by InitializeChannel(), InitializeChannel(), InitializeChannel(), and RandomizeEventData().
|
private |
Definition at line 123 of file QwCombinedBCM.h.
Referenced by LoadMockDataParameters(), and RandomizeEventData().
|
staticprotected |
Internal randomness generator.
Definition at line 129 of file QwCombinedBCM.h.
|
staticprotected |
Internal normal random variable.
Definition at line 134 of file QwCombinedBCM.h.
Referenced by RandomizeEventData(), and SetTripSeed().
|
private |
Definition at line 117 of file QwCombinedBCM.h.
Referenced by ProcessEvent(), and SetBCMForCombo().
|
private |
Definition at line 121 of file QwCombinedBCM.h.
Referenced by LoadMockDataParameters(), and RandomizeEventData().
|
private |
Definition at line 120 of file QwCombinedBCM.h.
Referenced by LoadMockDataParameters().
|
private |
Definition at line 122 of file QwCombinedBCM.h.
Referenced by LoadMockDataParameters(), and RandomizeEventData().
|
private |
Definition at line 116 of file QwCombinedBCM.h.
Referenced by ProcessEvent(), and SetBCMForCombo().