JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwCombinedBCM< T > Class Template Reference

Template for a combined beam current monitor using weighted inputs. More...

#include <QwCombinedBCM.h>

+ Inheritance diagram for QwCombinedBCM< T >:
+ Collaboration diagram for QwCombinedBCM< T >:

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 &paramfile) override
 
Bool_t ApplyHWChecks ()
 
Bool_t ApplySingleEventCuts () override
 
UInt_t UpdateErrorFlag () override
 
VQwBCMoperator= (const VQwBCM &value) override
 
QwCombinedBCMoperator= (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.
 
VQwHardwareChannelGetCharge () override
 
const VQwHardwareChannelGetCharge () const override
 
- Public Member Functions inherited from QwBCM< T >
 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 &paramfile) 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
 
VQwBCMoperator+= (const VQwBCM &value) override
 Polymorphic add-assign from VQwBCM if types match.
 
VQwBCMoperator-= (const VQwBCM &value) override
 Polymorphic subtract-assign from VQwBCM.
 
QwBCMoperator= (const QwBCM &value)
 Copy-assign from another BCM (event-scoped data).
 
QwBCMoperator+= (const QwBCM &value)
 Add-assign from another BCM (sum raw channels).
 
QwBCMoperator-= (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< QwDBInterfaceGetDBEntry ()
 
std::vector< QwErrDBInterfaceGetErrDBEntry ()
 
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.
 
- Public Member Functions inherited from VQwBCM
 ~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".
 
- 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
 
virtual void AssignValueFrom (const VQwDataElement *)
 
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 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
 
- Public Member Functions inherited from MQwHistograms
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

- Public Types inherited from VQwDataElement
enum  EDataToSave { kRaw = 0 , kDerived , kMoments }
 
- Static Public Member Functions inherited from VQwBCM
static VQwBCMCreate (TString subsystemname, TString type, TString name, TString clock="")
 Factory method to create a concrete BCM instance for the requested module type.
 
static VQwBCMCreate (const VQwBCM &source)
 Copy constructor factory method to clone a BCM from an existing instance.
 
static VQwBCMCreateCombo (TString subsystemname, TString type, TString name)
 Factory method to create a concrete Combined BCM for the requested module type.
 
static VQwBCMCreateCombo (const VQwBCM &source)
 
- Protected Member Functions inherited from VQwBCM
 VQwBCM (VQwDataElement &beamcurrent)
 
 VQwBCM (VQwDataElement &beamcurrent, TString)
 
- 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.
 
- Protected Attributes inherited from QwBCM< T >
fBeamCurrent
 
- Protected Attributes inherited from VQwBCM
VQwDataElementfBeamCurrent_ref
 
- 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.
 

Detailed Description

template<typename T>
class QwCombinedBCM< T >

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.

Constructor & Destructor Documentation

◆ QwCombinedBCM() [1/5]

template<typename T>
QwCombinedBCM< T >::QwCombinedBCM ( )
inline

Definition at line 41 of file QwCombinedBCM.h.

41{ };

Referenced by GetCharge(), operator=(), operator=(), and QwCombinedBCM().

+ Here is the caller graph for this function:

◆ QwCombinedBCM() [2/5]

template<typename T>
QwCombinedBCM< T >::QwCombinedBCM ( TString name)
inline

Definition at line 42 of file QwCombinedBCM.h.

42 {
43 InitializeChannel(name, "derived");
44 };
Template for a combined beam current monitor using weighted inputs.
void InitializeChannel(TString name, TString datatosave) override

References InitializeChannel().

+ Here is the call graph for this function:

◆ QwCombinedBCM() [3/5]

template<typename T>
QwCombinedBCM< T >::QwCombinedBCM ( TString subsystem,
TString name )
inline

Definition at line 45 of file QwCombinedBCM.h.

45 {
46 InitializeChannel(subsystem, name, "derived");
47 };

References InitializeChannel().

+ Here is the call graph for this function:

◆ QwCombinedBCM() [4/5]

template<typename T>
QwCombinedBCM< T >::QwCombinedBCM ( TString subsystemname,
TString name,
TString type )
inline

Definition at line 48 of file QwCombinedBCM.h.

48 {
51 };
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.

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

+ Here is the call graph for this function:

◆ QwCombinedBCM() [5/5]

template<typename T>
QwCombinedBCM< T >::QwCombinedBCM ( const QwCombinedBCM< T > & source)
inline

Definition at line 52 of file QwCombinedBCM.h.

54 { }
friend class QwBCM
Definition VQwBCM.h:60

References QwBCM< T >::QwBCM(), and QwCombinedBCM().

+ Here is the call graph for this function:

◆ ~QwCombinedBCM()

template<typename T>
QwCombinedBCM< T >::~QwCombinedBCM ( )
inlineoverride

Definition at line 55 of file QwCombinedBCM.h.

55{ };

Member Function Documentation

◆ ApplyHWChecks()

template<typename T>
Bool_t QwCombinedBCM< T >::ApplyHWChecks ( )
inline

Definition at line 79 of file QwCombinedBCM.h.

79 {
80 return kTRUE;
81 };

◆ ApplySingleEventCuts()

template<typename T>
Bool_t QwCombinedBCM< T >::ApplySingleEventCuts ( )
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.

244{
245
246 //This is required to update single event cut failures in individual channels
247 // First update the error code based on the codes
248 // of the elements. This requires that the BCMs
249 // have had ApplySingleEventCuts run on them already.
250
251 for (size_t i=0;i<fElement.size();i++){
252 this->fBeamCurrent.UpdateErrorFlag(fElement.at(i)->fBeamCurrent.GetErrorCode());
253 }
254
255
256 // Everything is identical as for a regular BCM
258}
std::vector< QwBCM< T > * > fElement
T fBeamCurrent
Definition QwBCM.h:187
Bool_t ApplySingleEventCuts() override
Apply single-event cuts for this BCM and return pass/fail.
Definition QwBCM.cc:279

References QwBCM< T >::ApplySingleEventCuts(), QwBCM< T >::fBeamCurrent, and fElement.

+ Here is the call graph for this function:

◆ GetCharge() [1/2]

template<typename T>
const VQwHardwareChannel * QwCombinedBCM< T >::GetCharge ( ) const
inlineoverridevirtual

Reimplemented from VQwBCM.

Definition at line 108 of file QwCombinedBCM.h.

108 {
109 return const_cast<QwCombinedBCM*>(this)->GetCharge();
110 };
VQwHardwareChannel * GetCharge() override

References GetCharge(), and QwCombinedBCM().

+ Here is the call graph for this function:

◆ GetCharge() [2/2]

template<typename T>
VQwHardwareChannel * QwCombinedBCM< T >::GetCharge ( )
inlineoverridevirtual

Reimplemented from QwBCM< T >.

Definition at line 104 of file QwCombinedBCM.h.

104 {
105 return &(this->fBeamCurrent);
106 };

References QwBCM< T >::fBeamCurrent.

Referenced by GetCharge().

+ Here is the caller graph for this function:

◆ GetNumberOfElements()

template<typename T>
size_t QwCombinedBCM< T >::GetNumberOfElements ( )
inlineoverridevirtual

Reimplemented from VQwBCM.

Definition at line 74 of file QwCombinedBCM.h.

74{return fElement.size();};

References fElement.

◆ GetProjectedCharge()

template<typename T>
void QwCombinedBCM< T >::GetProjectedCharge ( VQwBCM * device)
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.

153{
154 (device->GetCharge())->AssignScaledValue(this->fBeamCurrent,1.0);
155 //device->PrintInfo();
157 //device->PrintInfo();
159}
void ApplyResolutionSmearing() override
Smear the channel by the configured resolution.
Definition QwBCM.cc:191
void FillRawEventData() override
Materialize the current event state as raw event data.
Definition QwBCM.cc:196

References VQwBCM::ApplyResolutionSmearing(), QwBCM< T >::fBeamCurrent, VQwBCM::FillRawEventData(), VQwBCM::GetCharge(), and VQwBCM::VQwBCM().

+ Here is the call graph for this function:

◆ GetSubElementName()

template<typename T>
TString QwCombinedBCM< T >::GetSubElementName ( Int_t index)
inlineoverridevirtual

Reimplemented from VQwBCM.

Definition at line 75 of file QwCombinedBCM.h.

75{return fElement.at(index)->GetElementName();};

References fElement.

◆ InitializeChannel() [1/3]

template<typename T>
void QwCombinedBCM< T >::InitializeChannel ( TString name,
TString datatosave )
overridevirtual

Initialize combined BCM with simple name and default settings.

Reimplemented from QwBCM< T >.

Definition at line 77 of file QwCombinedBCM.cc.

78{
79 SetPedestal(0.);
81 fLastTripTime = -99999.9;
82 this->SetElementName(name);
83 this->fBeamCurrent.InitializeChannel(name,"derived");
84}
void SetElementName(const TString &name)
Set the name of this element.
void SetPedestal(Double_t ped) override
Set the pedestal value for the beam current monitor.
Double_t fLastTripTime
void SetCalibrationFactor(Double_t calib) override
Set the calibration factor for the beam current monitor.

References QwBCM< T >::fBeamCurrent, fLastTripTime, SetCalibrationFactor(), VQwDataElement::SetElementName(), and SetPedestal().

Referenced by QwCombinedBCM(), QwCombinedBCM(), and QwCombinedBCM().

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

◆ InitializeChannel() [2/3]

template<typename T>
void QwCombinedBCM< T >::InitializeChannel ( TString subsystem,
TString name,
TString datatosave )
overridevirtual

Initialize combined BCM with subsystem scoping.

Reimplemented from QwBCM< T >.

Definition at line 88 of file QwCombinedBCM.cc.

89{
90 SetPedestal(0.);
92 fLastTripTime = -99999.9;
93 this->SetElementName(name);
94 this->fBeamCurrent.InitializeChannel(subsystem, "QwCombinedBCM", name,"derived");
95}

References QwBCM< T >::fBeamCurrent, fLastTripTime, SetCalibrationFactor(), VQwDataElement::SetElementName(), and SetPedestal().

+ Here is the call graph for this function:

◆ InitializeChannel() [3/3]

template<typename T>
void QwCombinedBCM< T >::InitializeChannel ( TString subsystem,
TString name,
TString type,
TString datatosave )

Definition at line 98 of file QwCombinedBCM.cc.

100{
101 SetPedestal(0.);
103 fLastTripTime = -99999.9;
104 this->SetElementName(name);
105 this->SetModuleType(type);
106 this->fBeamCurrent.InitializeChannel(subsystem, "QwCombinedBCM", name,"derived");
107}
void SetModuleType(TString ModuleType)
set the type of the beam instrument

References QwBCM< T >::fBeamCurrent, fLastTripTime, SetCalibrationFactor(), VQwDataElement::SetElementName(), VQwDataElement::SetModuleType(), and SetPedestal().

+ Here is the call graph for this function:

◆ LoadMockDataParameters()

template<typename T>
void QwCombinedBCM< T >::LoadMockDataParameters ( QwParameterFile & paramfile)
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.

209 {
210
211 Double_t res=0.0;
212
213 // Test for the word "beamtrip", and get the tripperiod and tripduration if it is found, otherwise, just pass
214 // the line to the fBeamCurrent object.
215 if (paramfile.GetLine().find("beamtrip")!=std::string::npos){
216 // "beamtrip" appears somewhere in the line. Assume it is the next token and move on...
217 paramfile.GetNextToken(); //Throw away this token. Now the next three should be the beamtrip parameters.
218
219 fTripPeriod = paramfile.GetTypedNextToken<Double_t>() * Qw::sec;
220 fTripLength = paramfile.GetTypedNextToken<Double_t>() * Qw::sec;
221 fTripRamp = paramfile.GetTypedNextToken<Double_t>() * Qw::sec;
222
224 } else if (paramfile.GetLine().find("resolution")!=std::string::npos){
225 paramfile.GetNextToken();
226 res = paramfile.GetTypedNextToken<Double_t>();
227 this->SetResolution(res);
228 } else {
229 //std::cout << "In QwCombinedBCM: ChannelName = " << this->GetElementName() << std::endl;
230 this->fBeamCurrent.LoadMockDataParameters(paramfile);
231 }
232}
Double_t fTripLength
Double_t fTripRamp
Double_t fProbabilityOfTrip
Double_t fTripPeriod
void SetResolution(Double_t resolution)
Definition QwBCM.h:79

References QwBCM< T >::fBeamCurrent, fProbabilityOfTrip, fTripLength, fTripPeriod, fTripRamp, QwParameterFile::GetLine(), QwParameterFile::GetNextToken(), QwParameterFile::GetTypedNextToken(), Qw::sec, and QwBCM< T >::SetResolution().

+ Here is the call graph for this function:

◆ operator=() [1/2]

template<typename T>
QwCombinedBCM< T > & QwCombinedBCM< T >::operator= ( const QwCombinedBCM< T > & value)

Assignment operator: copy the beam current value.

Definition at line 329 of file QwCombinedBCM.cc.

330{
331 if (this->GetElementName()!="")
333
334 return *this;
335}
virtual const TString & GetElementName() const
Get the name of this element.

References QwBCM< T >::fBeamCurrent, VQwDataElement::GetElementName(), and QwCombinedBCM().

+ Here is the call graph for this function:

◆ operator=() [2/2]

template<typename T>
VQwBCM & QwCombinedBCM< T >::operator= ( const VQwBCM & value)
overridevirtual

Polymorphic assignment operator.

Reimplemented from QwBCM< T >.

Definition at line 339 of file QwCombinedBCM.cc.

340{
341 if (this->GetElementName()!="")
342 dynamic_cast<QwCombinedBCM<T>* >(this)->fBeamCurrent=
343 dynamic_cast<const QwCombinedBCM<T>* >(&value)->fBeamCurrent;
344
345 return *this;
346}

References QwBCM< T >::fBeamCurrent, VQwDataElement::GetElementName(), QwCombinedBCM(), and VQwBCM::VQwBCM().

+ Here is the call graph for this function:

◆ ProcessEvBuffer()

template<typename T>
Int_t QwCombinedBCM< T >::ProcessEvBuffer ( UInt_t * buffer,
UInt_t word_position_in_buffer,
UInt_t subelement = 0 )
inlineoverridevirtual

Process the raw event buffer and decode into the channel.

Returns
The updated buffer word position.

Reimplemented from QwBCM< T >.

Definition at line 61 of file QwCombinedBCM.h.

61{ return 0; };

References QwBPMStripline< T >::subelement.

◆ ProcessEvent()

template<typename T>
void QwCombinedBCM< T >::ProcessEvent ( )
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.

117{
118 static T tmpADC;
119 tmpADC.InitializeChannel("tmp","derived");
120
121 this->ClearEventData();
122
123 for (size_t i = 0; i < fElement.size(); i++) {
124 tmpADC = fElement[i]->fBeamCurrent;
126 this->fBeamCurrent += tmpADC;
127 }
128 this->fBeamCurrent.Scale(1.0/fSumQweights);
129
131 if (ldebug) {
132 QwMessage << "*****************" << QwLog::endl;
133 QwMessage << "QwCombinedBCM: " << this->GetElementName() << QwLog::endl
134 << "weighted average of hardware sums = " << this->fBeamCurrent.GetValue() << QwLog::endl;
135 if (this->fBeamCurrent.GetNumberOfSubelements() > 1) {
136 for (size_t i = 0; i < 4; i++) {
137 QwMessage << "weighted average of block[" << i << "] = " << this->fBeamCurrent.GetValue(i) << QwLog::endl;
138 }
139 }
140 QwMessage << "*****************" << QwLog::endl;
141 }
142}
virtual void ClearEventData()
Clear the event data in this element.
std::vector< Double_t > fWeights
Double_t fSumQweights
void Scale(Double_t factor) override
Scale the underlying channel by a constant factor.
Definition QwBCM.cc:485

References QwBCM< T >::ClearEventData(), QwLog::endl(), QwBCM< T >::fBeamCurrent, fElement, fSumQweights, fWeights, VQwDataElement::GetElementName(), and QwMessage.

+ Here is the call graph for this function:

◆ RandomizeEventData()

template<typename T>
void QwCombinedBCM< T >::RandomizeEventData ( int helicity = 0,
double time = 0.0 )
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.

168{
169 this->fBeamCurrent.RandomizeEventData(helicity, time);
170 // do the beam cut routine from MockDataGenerator, but just scale fBeamCurrent instead of re-randomizing
171 // Three time intervals: fmod(time,period) > (period-tripramp): Do the ramp scaling
172 // (period-tripramp) > fmod(time,period) > (period-triplength- tripramp): scale by 0.0
173 // (period-triplength- tripramp) > fmod(time,period) : leave the variable alone
174
175
176 // Determine the probability of having a beam trip
177 if (fLastTripTime<=-99999.9) {
179 }
180// if ( ((time-fLastTripTime) > (fTripPeriod)) ){ // Make some comparison to a probablilty instead of the time
181// Probability of a trip happening in one event: # of trips per hour/3600 * eventtime_in_seconds (which is 0.001s)
183// std::cout << "random value=="<<tmp << "; fProbabilityOfTrip=="<<fProbabilityOfTrip<<std::endl;
184 if (tmp < fProbabilityOfTrip) {
186 std::cout << "random value=="<<tmp << "; fProbabilityOfTrip=="<<fProbabilityOfTrip<<"; time=="<<time<<std::endl;
187 }
188
191 this->fBeamCurrent.Scale(0.0);
192 //std::cout << "fBeamCurrent.Scale(0.0)" << std::endl;
193 } else if (time_since_trip < (fTripLength + fTripRamp)) {
195 //std::cout << "(fTripPeriod - fmod(time, fTripPeriod))=="<<(fTripPeriod - fmod(time, fTripPeriod))<<"; fTripLength=="<<fTripLength
196 // << "; ((fTripPeriod - fmod(time, fTripPeriod)) / fTripLength)=="<<((fTripPeriod - fmod(time, fTripPeriod)) / fTripLength)
197 // << std::endl;
198 this->fBeamCurrent.Scale(factor);
199 //std::cout << "fBeamCurrent.Scale(factor) = " << factor << std::endl;
200 }
201}
static boost::variate_generator< boost::mt19937, boost::random::uniform_real_distribution< double > > fRandomVariable
Internal normal random variable.

References QwBCM< T >::fBeamCurrent, fLastTripTime, fProbabilityOfTrip, fRandomVariable, fTripLength, and fTripRamp.

◆ SetBCMForCombo()

template<typename T>
void QwCombinedBCM< T >::SetBCMForCombo ( VQwBCM * bcm,
Double_t weight,
Double_t sumqw )
overridevirtual

Add a constituent BCM to the combination with specified weight.

Parameters
bcmPointer to the BCM to include.
weightCharge weight for this BCM.
sumqwTotal sum of absolute weights.

Reimplemented from QwBCM< T >.

Definition at line 65 of file QwCombinedBCM.cc.

66{
67 // Convert back to QWBCM<T>* from generic VQwBCM*
68 fElement.push_back(dynamic_cast<QwBCM<T>* >(bcm));
69 fWeights.push_back(weight);
71}

References fElement, fSumQweights, fWeights, QwBCM< T >::QwBCM(), and VQwBCM::VQwBCM().

+ Here is the call graph for this function:

◆ SetCalibrationFactor()

template<typename T>
void QwCombinedBCM< T >::SetCalibrationFactor ( Double_t calibration)
inlineoverridevirtual

Set the calibration factor for the beam current monitor.

Parameters
calibrationMultiplicative calibration factor.

Reimplemented from QwBCM< T >.

Definition at line 100 of file QwCombinedBCM.h.

100 {
102 }
void SetCalibrationFactor(Double_t calib) override
Set the calibration factor for the beam current monitor.
Definition QwBCM.cc:43

References QwBCM< T >::SetCalibrationFactor().

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

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

◆ SetPedestal()

template<typename T>
void QwCombinedBCM< T >::SetPedestal ( Double_t pedestal)
inlineoverridevirtual

Set the pedestal value for the beam current monitor.

Parameters
pedestalPedestal offset to apply to the raw signal.

Reimplemented from QwBCM< T >.

Definition at line 97 of file QwCombinedBCM.h.

97 {
99 }
void SetPedestal(Double_t ped) override
Set the pedestal value for the beam current monitor.
Definition QwBCM.cc:33

References QwBCM< T >::SetPedestal().

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

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

◆ SetTripSeed()

template<typename T>
void QwCombinedBCM< T >::SetTripSeed ( uint seedval)
static

Set random number generator seed for beam trip simulation.

Definition at line 47 of file QwCombinedBCM.cc.

48{
49 fRandomVariable.engine().seed(seedval);
50}

References fRandomVariable.

Referenced by main().

+ Here is the caller graph for this function:

◆ UpdateErrorFlag()

template<typename T>
UInt_t QwCombinedBCM< T >::UpdateErrorFlag ( )
overridevirtual

Update error flags by propagating error codes from constituent BCMs.

Reimplemented from VQwDataElement.

Definition at line 264 of file QwCombinedBCM.cc.

264 {
265 for (size_t i=0;i<fElement.size();i++){
266 this->fBeamCurrent.UpdateErrorFlag(fElement.at(i)->fBeamCurrent.GetErrorCode());
267 }
268 return this->fBeamCurrent.GetEventcutErrorFlag();
269}

References QwBCM< T >::fBeamCurrent, and fElement.

Field Documentation

◆ fDistribution

template<typename T>
boost::random::uniform_real_distribution<double> QwCombinedBCM< T >::fDistribution
staticprotected

Internal normal probability distribution.

Definition at line 131 of file QwCombinedBCM.h.

◆ fElement

template<typename T>
std::vector<QwBCM<T>*> QwCombinedBCM< T >::fElement
private

◆ fLastTripTime

template<typename T>
Double_t QwCombinedBCM< T >::fLastTripTime
private

◆ fProbabilityOfTrip

template<typename T>
Double_t QwCombinedBCM< T >::fProbabilityOfTrip
private

Definition at line 123 of file QwCombinedBCM.h.

Referenced by LoadMockDataParameters(), and RandomizeEventData().

◆ fRandomnessGenerator

template<typename T>
boost::mt19937 QwCombinedBCM< T >::fRandomnessGenerator
staticprotected

Internal randomness generator.

Definition at line 129 of file QwCombinedBCM.h.

◆ fRandomVariable

template<typename T>
boost::variate_generator< boost::mt19937, boost::random::uniform_real_distribution< double > > QwCombinedBCM< T >::fRandomVariable
staticprotected

Internal normal random variable.

Definition at line 134 of file QwCombinedBCM.h.

Referenced by RandomizeEventData(), and SetTripSeed().

◆ fSumQweights

template<typename T>
Double_t QwCombinedBCM< T >::fSumQweights
private

Definition at line 117 of file QwCombinedBCM.h.

Referenced by ProcessEvent(), and SetBCMForCombo().

◆ fTripLength

template<typename T>
Double_t QwCombinedBCM< T >::fTripLength
private

Definition at line 121 of file QwCombinedBCM.h.

Referenced by LoadMockDataParameters(), and RandomizeEventData().

◆ fTripPeriod

template<typename T>
Double_t QwCombinedBCM< T >::fTripPeriod
private

Definition at line 120 of file QwCombinedBCM.h.

Referenced by LoadMockDataParameters().

◆ fTripRamp

template<typename T>
Double_t QwCombinedBCM< T >::fTripRamp
private

Definition at line 122 of file QwCombinedBCM.h.

Referenced by LoadMockDataParameters(), and RandomizeEventData().

◆ fWeights

template<typename T>
std::vector<Double_t> QwCombinedBCM< T >::fWeights
private

Definition at line 116 of file QwCombinedBCM.h.

Referenced by ProcessEvent(), and SetBCMForCombo().


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