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

Template for combined beam position monitor using multiple BPMs. More...

#include <QwCombinedBPM.h>

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

Public Types

enum  EBeamPositionMonitorAxis
 
- Public Types inherited from VQwBPM
enum  EBeamPositionMonitorAxis { kXAxis =0 , kYAxis , kNumAxes }
 
- Public Types inherited from VQwDataElement
enum  EDataToSave { kRaw = 0 , kDerived , kMoments }
 

Public Member Functions

size_t GetNumberOfElements () override
 
TString GetSubElementName (Int_t index) override
 
 QwCombinedBPM ()
 
 QwCombinedBPM (TString name)
 
 QwCombinedBPM (TString subsystem, TString name)
 
 QwCombinedBPM (TString subsystem, TString name, TString type)
 
 QwCombinedBPM (const QwCombinedBPM &source)
 
 ~QwCombinedBPM () override
 
void InitializeChannel (TString name)
 
void InitializeChannel (TString subsystem, TString name)
 
void InitializeChannel (TString subsystem, TString name, TString type)
 
void LoadChannelParameters (QwParameterFile &paramfile) override
 
void ClearEventData () override
 
Int_t ProcessEvBuffer (UInt_t *buffer, UInt_t word_position_in_buffer, UInt_t indexnumber) override
 Process the CODA event buffer for this element.
 
void ProcessEvent () override
 
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.
 
const VQwHardwareChannelGetPosition (EBeamPositionMonitorAxis axis) const override
 
const VQwHardwareChannelGetSlope (EBeamPositionMonitorAxis axis) const
 
const VQwHardwareChannelGetEffectiveCharge () const override
 
Bool_t ApplyHWChecks ()
 
Bool_t ApplySingleEventCuts () override
 
void SetEventCutMode (Int_t bcuts) override
 Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel.
 
void IncrementErrorCounters () override
 
void PrintErrorCounters () const override
 
UInt_t GetEventcutErrorFlag () 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".
 
void UpdateErrorFlag (const VQwBPM *ev_error) override
 
Bool_t CheckForBurpFail (const VQwDataElement *ev_error)
 
void SetBPMForCombo (const VQwBPM *bpm, Double_t charge_weight, Double_t x_weight, Double_t y_weight, Double_t sumqw) override
 
void Ratio (QwCombinedBPM &numer, QwCombinedBPM &denom)
 
void Ratio (VQwBPM &numer, VQwBPM &denom) override
 
void Scale (Double_t factor) override
 
VQwBPMoperator= (const VQwBPM &value) override
 
VQwBPMoperator+= (const VQwBPM &value) override
 
VQwBPMoperator-= (const VQwBPM &value) override
 
virtual QwCombinedBPMoperator= (const QwCombinedBPM &value)
 
virtual QwCombinedBPMoperator+= (const QwCombinedBPM &value)
 
virtual QwCombinedBPMoperator-= (const QwCombinedBPM &value)
 
void AccumulateRunningSum (const VQwBPM &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
 
void AccumulateRunningSum (const QwCombinedBPM &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
 
void DeaccumulateRunningSum (VQwBPM &value, Int_t ErrorMask=0xFFFFFFF) override
 
void DeaccumulateRunningSum (QwCombinedBPM &value, Int_t ErrorMask=0xFFFFFFF)
 
void CalculateRunningAverage () 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 ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &modulelist) override
 
void FillTreeVector (QwRootTreeBranchVector &values) const override
 
void RandomizeEventData (int helicity=0, double time=0.0) override
 
void SetRandomEventParameters (Double_t meanX, Double_t sigmaX, Double_t meanY, Double_t sigmaY, Double_t meanXslope, Double_t sigmaXslope, Double_t meanYslope, Double_t sigmaYslope) override
 
void GetProjectedPosition (VQwBPM *device) override
 
void LoadMockDataParameters (QwParameterFile &paramfile) override
 
VQwHardwareChannelGetAngleX ()
 
const VQwHardwareChannelGetAngleX () const override
 
VQwHardwareChannelGetAngleY ()
 
const VQwHardwareChannelGetAngleY () const override
 
- Public Member Functions inherited from VQwBPM
 VQwBPM ()
 
 VQwBPM (TString &)
 
 VQwBPM (const VQwBPM &source)
 
 ~VQwBPM () override
 
void InitializeChannel (TString name)
 Initialize common BPM state and set the element name.
 
virtual void FillRawEventData ()
 
void GetSurveyOffsets (Double_t Xoffset, Double_t Yoffset, Double_t Zoffset)
 Store geometry/survey offsets for absolute position calibration.
 
void GetElectronicFactors (Double_t BSENfactor, Double_t AlphaX, Double_t AlphaY)
 Apply per-detector electronic calibration and relative gains.
 
void SetRotation (Double_t)
 Set detector rotation angle and update cached trigonometric values.
 
void SetRotationOff ()
 
void SetSingleEventCuts (TString, Double_t, Double_t)
 
void SetSingleEventCuts (TString, UInt_t, Double_t, Double_t, Double_t, Double_t)
 
void SetGains (TString pos, Double_t value)
 
void SetRootSaveStatus (TString &prefix)
 
virtual const VQwHardwareChannelGetPosition (EBeamPositionMonitorAxis axis) const
 
Double_t GetPositionInZ () const
 
virtual void GetAbsolutePosition ()
 
void PrintErrorCounters () const override
 report number of events failed due to HW and event cut failure
 
virtual void SetDefaultSampleSize (Int_t)
 
virtual void SetResolution (Double_t resolutionX, Double_t resolutionY)
 
virtual void SetRandomEventParameters (Double_t, Double_t, Double_t, Double_t)
 
virtual void SetRandomEventAsymmetry (Double_t)
 
virtual void ApplyResolutionSmearing ()
 
virtual void ApplyResolutionSmearing (EBeamPositionMonitorAxis)
 
virtual void EncodeEventData (std::vector< UInt_t > &)
 
virtual void SetSubElementPedestal (Int_t, Double_t)
 
virtual void SetSubElementCalibrationFactor (Int_t, Double_t)
 
void PrintInfo () const override
 Print multiple lines of information about this data element.
 
- 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)
 
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.
 

Protected Member Functions

VQwHardwareChannelGetSubelementByName (TString ch_name) override
 
void CalculateFixedParameter (std::vector< Double_t > fWeights, Int_t pos)
 
Double_t SumOver (std::vector< Double_t > weight, std::vector< T > val)
 
void LeastSquareFit (VQwBPM::EBeamPositionMonitorAxis axis, std::vector< Double_t > fWeights)
 
- Protected Member Functions inherited from VQwBPM
virtual VQwHardwareChannelGetPosition (EBeamPositionMonitorAxis axis)
 
VQwHardwareChannelGetSubelementByIndex (size_t index)
 
- 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

std::array< T, 2 > fSlope
 
std::array< T, 2 > fIntercept
 
std::array< T, 2 > fMinimumChiSquare
 
std::array< T, 2 > fAbsPos
 
fEffectiveCharge
 
- Protected Attributes inherited from VQwBPM
std::vector< TString > fSubelementNames
 
Double_t fPositionCenter [3]
 
Double_t fQwStriplineCalibration
 
Double_t fQwStriplineCorrection
 
Double_t fRelativeGains [2]
 
Double_t fGains [2]
 
Bool_t bRotated
 
Double_t fRotationAngle
 
Double_t fCosRotation
 
Double_t fSinRotation
 
Double_t fResolution [2]
 
Bool_t fGoodEvent
 
Bool_t bFullSave
 
- 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.
 

Private Member Functions

void MakeBPMComboList ()
 

Private Attributes

Bool_t fixedParamCalculated
 
Double_t erra [2]
 
Double_t errb [2]
 
Double_t covab [2]
 
Double_t A [2]
 
Double_t B [2]
 
Double_t D [2]
 
Double_t m [2]
 
Double_t chi_square [2]
 
Double_t fSumQweights
 
std::vector< const VQwBPM * > fElement
 
std::vector< Double_t > fQWeights
 
std::vector< Double_t > fXWeights
 
std::vector< Double_t > fYWeights
 
std::vector< T > fBPMComboElementList
 

Friends

class QwEnergyCalculator
 

Additional Inherited Members

- Static Public Member Functions inherited from VQwBPM
static VQwBPMCreateStripline (TString subsystemname, TString type, TString name)
 A fast way of creating a BPM stripline of specified type.
 
static VQwBPMCreateStripline (const VQwBPM &source)
 
static VQwBPMCreateCombo (TString subsystemname, TString type, TString name)
 A fast way of creating a BPM stripline of specified type.
 
static VQwBPMCreateCombo (const VQwBPM &source)
 
- Static Protected Attributes inherited from VQwBPM
static const TString kAxisLabel [2] ={"X","Y"}
 
static const TString axis [3]
 
static const Bool_t bDEBUG =kFALSE
 

Detailed Description

template<typename T>
class QwCombinedBPM< T >

Template for combined beam position monitor using multiple BPMs.

Maintains a weighted combination of individual BPMs to estimate position and angle at a virtual location, supporting fits and effective charge computation.

Definition at line 40 of file QwCombinedBPM.h.

Member Enumeration Documentation

◆ EBeamPositionMonitorAxis

template<typename T>
enum VQwBPM::EBeamPositionMonitorAxis

Axis enumerator for the BPMs; Z will never be an instrumented axis.

Definition at line 72 of file VQwBPM.h.

@ kXAxis
Definition VQwBPM.h:72
@ kYAxis
Definition VQwBPM.h:72
@ kNumAxes
Definition VQwBPM.h:72

Constructor & Destructor Documentation

◆ QwCombinedBPM() [1/5]

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

Definition at line 51 of file QwCombinedBPM.h.

51 {
52 };

Referenced by AccumulateRunningSum(), AccumulateRunningSum(), CheckForBurpFail(), DeaccumulateRunningSum(), DeaccumulateRunningSum(), GetAngleX(), GetAngleY(), operator+=(), operator+=(), operator-=(), operator-=(), operator=(), operator=(), QwCombinedBPM(), Ratio(), Ratio(), and UpdateErrorFlag().

+ Here is the caller graph for this function:

◆ QwCombinedBPM() [2/5]

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

Definition at line 53 of file QwCombinedBPM.h.

53 :VQwBPM(name){
55 };
Template for combined beam position monitor using multiple BPMs.
void InitializeChannel(TString name)
VQwBPM()
Definition VQwBPM.h:76

References InitializeChannel(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ QwCombinedBPM() [3/5]

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

Definition at line 56 of file QwCombinedBPM.h.

References InitializeChannel(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ QwCombinedBPM() [4/5]

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

Definition at line 60 of file QwCombinedBPM.h.

References InitializeChannel(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ QwCombinedBPM() [5/5]

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

Definition at line 63 of file QwCombinedBPM.h.

64 : VQwBPM(source),
66 {
71 }
void QwCopyArray(const T &a, T &b)
Definition QwUtil.h:15
std::array< T, 2 > fSlope
std::array< T, 2 > fIntercept
std::array< T, 2 > fAbsPos
std::array< T, 2 > fMinimumChiSquare

References fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, QwCombinedBPM(), QwCopyArray(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ ~QwCombinedBPM()

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

Definition at line 72 of file QwCombinedBPM.h.

72{ };

Member Function Documentation

◆ AccumulateRunningSum() [1/2]

template<typename T>
void QwCombinedBPM< T >::AccumulateRunningSum ( const QwCombinedBPM< T > & value,
Int_t count = 0,
Int_t ErrorMask = 0xFFFFFFF )

Definition at line 1017 of file QwCombinedBPM.cc.

1018{
1019 for (Short_t axis = kXAxis; axis < kNumAxes; axis++){
1020 fSlope[axis].AccumulateRunningSum(value.fSlope[axis], count, ErrorMask);
1021 fIntercept[axis].AccumulateRunningSum(value.fIntercept[axis], count, ErrorMask);
1022 fAbsPos[axis].AccumulateRunningSum(value.fAbsPos[axis], count, ErrorMask);
1024 }
1025 fEffectiveCharge.AccumulateRunningSum(value.fEffectiveCharge, count, ErrorMask);
1026}
static const TString axis[3]
Definition VQwBPM.h:333

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwCombinedBPM().

+ Here is the call graph for this function:

◆ AccumulateRunningSum() [2/2]

template<typename T>
void QwCombinedBPM< T >::AccumulateRunningSum ( const VQwBPM & value,
Int_t count = 0,
Int_t ErrorMask = 0xFFFFFFF )
overridevirtual

Reimplemented from VQwBPM.

Definition at line 1011 of file QwCombinedBPM.cc.

1012{
1013 AccumulateRunningSum(*dynamic_cast<const QwCombinedBPM<T>* >(&value), count, ErrorMask);
1014}
void AccumulateRunningSum(const VQwBPM &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override

References AccumulateRunningSum(), QwCombinedBPM(), and VQwBPM::VQwBPM().

Referenced by AccumulateRunningSum().

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

◆ ApplyHWChecks()

template<typename T>
Bool_t QwCombinedBPM< T >::ApplyHWChecks ( )

Combined BPM does not add hardware checks beyond constituents.

Returns
Always true; underlying BPMs manage their own HW checks.

Definition at line 175 of file QwCombinedBPM.cc.

176{
178
179 return eventokay;
180}

◆ ApplySingleEventCuts()

template<typename T>
Bool_t QwCombinedBPM< T >::ApplySingleEventCuts ( )
overridevirtual

Apply single-event cuts to slope/intercept outputs per axis, using error masks from constituent BPM positions to gate derived quantities.

Returns
true if all derived outputs pass their cuts.

TODO: The returned base class should be changed so these casts aren't needed, but "GetErrorCode" is not meaningful for every VQwDataElement. Maybe the return should be a VQwHardwareChannel?

Implements VQwBPM.

Definition at line 239 of file QwCombinedBPM.cc.

240{
242 Int_t axis=0;
244 UInt_t pos_error[2];
245 charge_error = 0;
246 pos_error[kXAxis]=0;
247 pos_error[kYAxis]=0;
248
249 for(size_t i=0;i<fElement.size();i++){
250 /// TODO: The returned base class should be changed so
251 /// these casts aren't needed, but "GetErrorCode"
252 /// is not meaningful for every VQwDataElement.
253 /// Maybe the return should be a VQwHardwareChannel?
254
255 //To update the event cut failures in individual BPM devices
256 charge_error |= fElement[i]->GetEffectiveCharge()->GetErrorCode();
257 pos_error[kXAxis] |= fElement[i]->GetPosition(kXAxis)->GetErrorCode();
258 pos_error[kYAxis] |= fElement[i]->GetPosition(kYAxis)->GetErrorCode();
259 }
260
261 //Event cuts for X & Y slopes
263 fSlope[axis].UpdateErrorFlag(pos_error[axis]);
264 if (fSlope[axis].ApplySingleEventCuts()){ //for X slope
265 status&=kTRUE;
266 }
267 else{
268 status&=kFALSE;
269 if (bDEBUG) std::cout<<" X Slope event cut failed ";
270 }
271 }
272
273 //Event cuts for X & Y intercepts
275 fIntercept[axis].UpdateErrorFlag(pos_error[axis]);
276 if (fIntercept[axis].ApplySingleEventCuts()){ //for X slope
277 status&=kTRUE;
278 }
279 else{
280 status&=kFALSE;
281 if (bDEBUG) std::cout<<" X Intercept event cut failed ";
282 }
283 }
284
285
286 //Event cuts for X & Y minimum chi square
288 fMinimumChiSquare[axis].UpdateErrorFlag(pos_error[axis]);
289 if (fMinimumChiSquare[axis].ApplySingleEventCuts()){ //for X slope
290 status&=kTRUE;
291 }
292 else{
293 status&=kFALSE;
294 if (bDEBUG) std::cout<<" X Intercept event cut failed ";
295 }
296 }
297
298
299 //Event cuts for X & Y positions
301 fAbsPos[axis].UpdateErrorFlag(pos_error[axis]);
303 status&=kTRUE;
304 }
305 else{
306 status&=kFALSE;
307 if (bDEBUG) std::cout<<" Abs X event cut failed ";
308 }
309 }
310
311 //Event cuts for four wire sum (EffectiveCharge)
312 fEffectiveCharge.UpdateErrorFlag(charge_error);
313 if (fEffectiveCharge.ApplySingleEventCuts()){
314 status&=kTRUE;
315 }
316 else{
317 status&=kFALSE;
318 if (bDEBUG) std::cout<<"EffectiveCharge event cut failed ";
319 }
320
321 return status;
322}
Bool_t ApplySingleEventCuts() override
std::vector< const VQwBPM * > fElement
static const Bool_t bDEBUG
Definition VQwBPM.h:350

References ApplySingleEventCuts(), VQwBPM::axis, VQwBPM::bDEBUG, fAbsPos, fEffectiveCharge, fElement, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, VQwBPM::kXAxis, and VQwBPM::kYAxis.

Referenced by ApplySingleEventCuts().

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

◆ CalculateFixedParameter()

template<typename T>
void QwCombinedBPM< T >::CalculateFixedParameter ( std::vector< Double_t > fWeights,
Int_t pos )
protected

Definition at line 626 of file QwCombinedBPM.cc.

627 {
628
630 static Double_t zpos = 0.0;
631
632 for(size_t i=0;i<fElement.size();i++){
633 zpos = fElement[i]->GetPositionInZ();
634 A[pos] += zpos*fWeights[i]; //zw
635 B[pos] += fWeights[i]; //w
636 D[pos] += zpos*zpos*fWeights[i]; //z^2w
637 }
638
639 m[pos] = D[pos]*B[pos]-A[pos]*A[pos];
640 erra[pos] = B[pos]/m[pos];
641 errb[pos] = D[pos]/m[pos];
642 covab[pos] = -A[pos]/m[pos];
643
644 // Divvy
645 if (m[pos] == 0)
646 QwWarning << "Angry Divvy: Division by zero in " << this->GetElementName() << QwLog::endl;
647
648 if(ldebug){
649 std::cout<<" A = "<<A[pos]<<", B = "<<B[pos]<<", D = "<<D[pos]<<", m = "<<m[pos]<<std::endl;
650 std::cout<<"For least square fit, errors are "<<erra[pos]
651 <<"\ncovariance = "<<covab[pos]<<"\n\n";
652 }
653
654 return;
655 }
virtual const TString & GetElementName() const
Get the name of this element.
Double_t D[2]
Double_t erra[2]
Double_t A[2]
Double_t m[2]
Double_t errb[2]
Double_t covab[2]
Double_t B[2]

References A, B, covab, D, QwLog::endl(), erra, errb, fElement, VQwDataElement::GetElementName(), m, and QwWarning.

Referenced by ProcessEvent().

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

◆ CalculateRunningAverage()

template<typename T>
void QwCombinedBPM< T >::CalculateRunningAverage ( )
overridevirtual

Implements VQwBPM.

Definition at line 997 of file QwCombinedBPM.cc.

998{
999 fEffectiveCharge.CalculateRunningAverage();
1000
1001 for (Short_t axis = kXAxis; axis < kNumAxes; axis++) {
1002 fSlope[axis].CalculateRunningAverage();
1003 fIntercept[axis].CalculateRunningAverage();
1004 fAbsPos[axis].CalculateRunningAverage();
1005 fMinimumChiSquare[axis].CalculateRunningAverage();
1006 }
1007}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ CheckForBurpFail()

template<typename T>
Bool_t QwCombinedBPM< T >::CheckForBurpFail ( const VQwDataElement * ev_error)
virtual

Reimplemented from VQwBPM.

Definition at line 367 of file QwCombinedBPM.cc.

367 {
369 try {
370 if (typeid(*ev_error) == typeid(*this)) {
371 if (this->GetElementName() != "") {
372 const QwCombinedBPM<T>* value_bpm = dynamic_cast<const QwCombinedBPM<T>*>(ev_error);
373 // Delegate to subelements
374 for (int i = 0; i < 2; ++i) {
375 burpstatus |= fAbsPos[i].CheckForBurpFail(&(value_bpm->fAbsPos[i]));
376 burpstatus |= fSlope[i].CheckForBurpFail(&(value_bpm->fSlope[i]));
377 burpstatus |= fIntercept[i].CheckForBurpFail(&(value_bpm->fIntercept[i]));
378 burpstatus |= fMinimumChiSquare[i].CheckForBurpFail(&(value_bpm->fMinimumChiSquare[i]));
379 }
380 burpstatus |= fEffectiveCharge.CheckForBurpFail(&(value_bpm->fEffectiveCharge));
381 }
382 } else {
383 TString loc = "Standard exception from QwCombinedBPM::CheckForBurpFail :" +
384 ev_error->GetElementName() + " " + this->GetElementName() + " are not of the same type";
385 throw std::invalid_argument(loc.Data());
386 }
387 } catch (std::exception& e) {
388 std::cerr << e.what() << std::endl;
389 }
390 return burpstatus;
391}

References fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), QwCombinedBPM(), and VQwDataElement::VQwDataElement().

+ Here is the call graph for this function:

◆ ClearEventData()

template<typename T>
void QwCombinedBPM< T >::ClearEventData ( )
overridevirtual

Clear event-time state for effective charge and per-axis outputs.

Reimplemented from VQwDataElement.

Definition at line 117 of file QwCombinedBPM.cc.

118{
119 fEffectiveCharge.ClearEventData();
120
122 fAbsPos[axis].ClearEventData();
123 fSlope[axis].ClearEventData();
124 fIntercept[axis].ClearEventData();
125 }
126
127 return;
128}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fSlope, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

Referenced by ProcessEvent().

+ Here is the caller graph for this function:

◆ ConstructBranch() [1/2]

template<typename T>
void QwCombinedBPM< T >::ConstructBranch ( TTree * tree,
TString & prefix )
overridevirtual

Implements VQwBPM.

Definition at line 1124 of file QwCombinedBPM.cc.

1125{
1126 if (this->GetElementName()==""){
1127 // This channel is not used, so skip constructing trees.
1128 } else
1129 {
1131 if(prefix.Contains("asym_"))
1132 thisprefix.ReplaceAll("asym_","diff_");
1133
1134
1135 fEffectiveCharge.ConstructBranch(tree,prefix);
1136
1138 fSlope[axis].ConstructBranch(tree,thisprefix);
1139 fIntercept[axis].ConstructBranch(tree,thisprefix);
1140 fAbsPos[axis].ConstructBranch(tree,thisprefix);
1141 fMinimumChiSquare[axis].ConstructBranch(tree,thisprefix);
1142 }
1143
1144 }
1145 return;
1146}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, and VQwBPM::kXAxis.

+ Here is the call graph for this function:

◆ ConstructBranch() [2/2]

template<typename T>
void QwCombinedBPM< T >::ConstructBranch ( TTree * tree,
TString & prefix,
QwParameterFile & modulelist )
overridevirtual

Implements VQwBPM.

Definition at line 1149 of file QwCombinedBPM.cc.

1150{
1152 devicename=this->GetElementName();
1153 devicename.ToLower();
1154
1155 if (this->GetElementName()==""){
1156 // This channel is not used, so skip constructing trees.
1157 } else
1158 {
1159 if (modulelist.HasValue(devicename)){
1161 if(prefix.Contains("asym_"))
1162 thisprefix.ReplaceAll("asym_","diff_");
1163
1164
1165 fEffectiveCharge.ConstructBranch(tree,prefix);
1166
1168 fSlope[axis].ConstructBranch(tree,thisprefix);
1169 fIntercept[axis].ConstructBranch(tree,thisprefix);
1170 fAbsPos[axis].ConstructBranch(tree,thisprefix);
1171 fMinimumChiSquare[axis].ConstructBranch(tree,thisprefix);
1172 }
1173 QwMessage <<" Tree leave added to "<<devicename<<QwLog::endl;
1174 }
1175
1176 }
1177 return;
1178}

References VQwBPM::axis, QwLog::endl(), fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), QwParameterFile::HasValue(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwMessage.

+ Here is the call graph for this function:

◆ ConstructBranchAndVector()

template<typename T>
void QwCombinedBPM< T >::ConstructBranchAndVector ( TTree * tree,
TString & prefix,
QwRootTreeBranchVector & values )
overridevirtual

Implements VQwBPM.

Definition at line 1097 of file QwCombinedBPM.cc.

1098{
1099 if (this->GetElementName()==""){
1100 // This channel is not used, so skip constructing trees.
1101 } else
1102 {
1103
1105 if(prefix.Contains("asym_"))
1106 thisprefix.ReplaceAll("asym_","diff_");
1107
1109
1110 fEffectiveCharge.ConstructBranchAndVector(tree,prefix,values);
1112 fSlope[axis].ConstructBranchAndVector(tree,thisprefix,values);
1113 fIntercept[axis].ConstructBranchAndVector(tree,thisprefix,values);
1114 fAbsPos[axis].ConstructBranchAndVector(tree,thisprefix,values);
1115 fMinimumChiSquare[axis].ConstructBranchAndVector(tree,thisprefix,values);
1116 }
1117
1118 }
1119
1120 return;
1121}
void SetRootSaveStatus(TString &prefix)
Definition VQwBPM.cc:220

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and VQwBPM::SetRootSaveStatus().

+ Here is the call graph for this function:

◆ ConstructHistograms()

template<typename T>
void QwCombinedBPM< T >::ConstructHistograms ( TDirectory * folder,
TString & prefix )
overridevirtual

Construct the histograms for this data element.

Implements VQwBPM.

Definition at line 1053 of file QwCombinedBPM.cc.

1054{
1055
1056 if (this->GetElementName()==""){
1057 // This channel is not used, so skip filling the histograms.
1058 }
1059 else{
1060 //we calculate the asym_ for the fEffectiveCharge because its an asymmetry and not a difference.
1061 fEffectiveCharge.ConstructHistograms(folder, prefix);
1063 if(prefix.Contains("asym_"))
1064 thisprefix.ReplaceAll("asym_","diff_");
1066
1068 fSlope[axis].ConstructHistograms(folder, thisprefix);
1069 fIntercept[axis].ConstructHistograms(folder, thisprefix);
1070 fAbsPos[axis].ConstructHistograms(folder, thisprefix);
1071 fMinimumChiSquare[axis].ConstructHistograms(folder, thisprefix);
1072 }
1073
1074 }
1075 return;
1076}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and VQwBPM::SetRootSaveStatus().

+ Here is the call graph for this function:

◆ DeaccumulateRunningSum() [1/2]

template<typename T>
void QwCombinedBPM< T >::DeaccumulateRunningSum ( QwCombinedBPM< T > & value,
Int_t ErrorMask = 0xFFFFFFF )

Definition at line 1035 of file QwCombinedBPM.cc.

1036{
1037
1038 for (Short_t axis = kXAxis; axis < kNumAxes; axis++){
1039 fSlope[axis].DeaccumulateRunningSum(value.fSlope[axis], ErrorMask);
1040 fIntercept[axis].DeaccumulateRunningSum(value.fIntercept[axis], ErrorMask);
1041 fAbsPos[axis].DeaccumulateRunningSum(value.fAbsPos[axis], ErrorMask);
1042 fMinimumChiSquare[axis].DeaccumulateRunningSum(value.fMinimumChiSquare[axis], ErrorMask);
1043 }
1044 fEffectiveCharge.DeaccumulateRunningSum(value.fEffectiveCharge, ErrorMask);
1045
1046}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwCombinedBPM().

+ Here is the call graph for this function:

◆ DeaccumulateRunningSum() [2/2]

template<typename T>
void QwCombinedBPM< T >::DeaccumulateRunningSum ( VQwBPM & value,
Int_t ErrorMask = 0xFFFFFFF )
overridevirtual

Implements VQwBPM.

Definition at line 1029 of file QwCombinedBPM.cc.

1030{
1032}
void DeaccumulateRunningSum(VQwBPM &value, Int_t ErrorMask=0xFFFFFFF) override

References DeaccumulateRunningSum(), QwCombinedBPM(), and VQwBPM::VQwBPM().

Referenced by DeaccumulateRunningSum().

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

◆ FillHistograms()

template<typename T>
void QwCombinedBPM< T >::FillHistograms ( )
overridevirtual

Fill the histograms for this data element.

Implements VQwBPM.

Definition at line 1079 of file QwCombinedBPM.cc.

1080{
1081 if (this->GetElementName()==""){
1082 // This channel is not used, so skip filling the histograms.
1083 }
1084 else{
1085 fEffectiveCharge.FillHistograms();
1087 fSlope[axis].FillHistograms();
1088 fIntercept[axis].FillHistograms();
1089 fAbsPos[axis].FillHistograms();
1090 fMinimumChiSquare[axis].FillHistograms();
1091 }
1092 }
1093 return;
1094}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, and VQwBPM::kXAxis.

+ Here is the call graph for this function:

◆ FillTreeVector()

template<typename T>
void QwCombinedBPM< T >::FillTreeVector ( QwRootTreeBranchVector & values) const
overridevirtual

Implements VQwBPM.

Definition at line 1182 of file QwCombinedBPM.cc.

1183{
1184 if (this->GetElementName()==""){
1185 // This channel is not used, so skip filling the tree.
1186 }
1187 else{
1188 fEffectiveCharge.FillTreeVector(values);
1189
1191 fSlope[axis].FillTreeVector(values);
1192 fIntercept[axis].FillTreeVector(values);
1193 fAbsPos[axis].FillTreeVector(values);
1194 fMinimumChiSquare[axis].FillTreeVector(values);
1195 }
1196 }
1197 return;
1198}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, and VQwBPM::kXAxis.

+ Here is the call graph for this function:

◆ GetAngleX() [1/2]

template<typename T>
VQwHardwareChannel * QwCombinedBPM< T >::GetAngleX ( )
inline

Definition at line 172 of file QwCombinedBPM.h.

172 { //At present this returns the slope not the angle
173 return &fSlope[0];
174 };

References fSlope.

Referenced by GetAngleX().

+ Here is the caller graph for this function:

◆ GetAngleX() [2/2]

template<typename T>
const VQwHardwareChannel * QwCombinedBPM< T >::GetAngleX ( ) const
inlineoverridevirtual

Reimplemented from VQwBPM.

Definition at line 176 of file QwCombinedBPM.h.

176 { //At present this returns the slope not the angle
177 return const_cast<QwCombinedBPM*>(this)->GetAngleX();
178 };
VQwHardwareChannel * GetAngleX()

References GetAngleX(), and QwCombinedBPM().

+ Here is the call graph for this function:

◆ GetAngleY() [1/2]

template<typename T>
VQwHardwareChannel * QwCombinedBPM< T >::GetAngleY ( )
inline

Definition at line 180 of file QwCombinedBPM.h.

180 {//At present this returns the slope not the angle
181 return &fSlope[1];
182 };

References fSlope.

Referenced by GetAngleY().

+ Here is the caller graph for this function:

◆ GetAngleY() [2/2]

template<typename T>
const VQwHardwareChannel * QwCombinedBPM< T >::GetAngleY ( ) const
inlineoverridevirtual

Reimplemented from VQwBPM.

Definition at line 184 of file QwCombinedBPM.h.

184 { //At present this returns the slope not the angle
185 return const_cast<QwCombinedBPM*>(this)->GetAngleY();
186 };
VQwHardwareChannel * GetAngleY()

References GetAngleY(), and QwCombinedBPM().

+ Here is the call graph for this function:

◆ GetEffectiveCharge()

template<typename T>
const VQwHardwareChannel * QwCombinedBPM< T >::GetEffectiveCharge ( ) const
inlineoverridevirtual

Implements VQwBPM.

Definition at line 109 of file QwCombinedBPM.h.

109 {
110 return &fEffectiveCharge;
111 }

References fEffectiveCharge.

Referenced by ProcessEvent().

+ Here is the caller graph for this function:

◆ GetEventcutErrorFlag()

template<typename T>
UInt_t QwCombinedBPM< T >::GetEventcutErrorFlag ( )
overridevirtual

Aggregate event-cut error flags across per-axis outputs and effective charge.

Reimplemented from VQwDataElement.

Definition at line 216 of file QwCombinedBPM.cc.

217{
218 UInt_t error=0;
220 error|=fAbsPos[axis].GetEventcutErrorFlag();
221 error|=fSlope[axis].GetEventcutErrorFlag();
222 error|=fIntercept[axis].GetEventcutErrorFlag();
223 error|=fMinimumChiSquare[axis].GetEventcutErrorFlag();
224 }
225
226 error|=fEffectiveCharge.GetEventcutErrorFlag();
227 return error;
228}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ GetNumberOfElements()

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

Reimplemented from VQwBPM.

Definition at line 47 of file QwCombinedBPM.h.

47{return fElement.size();};

References fElement.

◆ GetPosition()

template<typename T>
const VQwHardwareChannel * QwCombinedBPM< T >::GetPosition ( EBeamPositionMonitorAxis axis) const
inlineoverride

Definition at line 92 of file QwCombinedBPM.h.

92 {
93 if (axis<0 || axis>2){
94 TString loc="QwLinearDiodeArray::GetPosition for "
95 +this->GetElementName()+" failed for axis value "+Form("%d",axis);
96 throw std::out_of_range(loc.Data());
97 }
98 return &fAbsPos[axis];
99 }

References VQwBPM::axis, fAbsPos, and VQwDataElement::GetElementName().

Referenced by LeastSquareFit().

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

◆ GetProjectedPosition()

template<typename T>
void QwCombinedBPM< T >::GetProjectedPosition ( VQwBPM * device)
overridevirtual

Reimplemented from VQwBPM.

Definition at line 800 of file QwCombinedBPM.cc.

801 {
802 // For now, go ahead and do the projection for any BPM, not just for ones which are used by this
803 // CombinedBPM object.
804
806
808 //std::cout << "iaxis= " << iaxis << std::endl;
809 //std::cout << "kNumAxes= " << kNumAxes << std::endl;
810 if (iaxis==kXAxis) {
811 axis=kXAxis;
812 //std::cout << "kXAxis= " << kXAxis << std::endl;
813 //std::cout << "axis= " << axis << std::endl;
814 }
815 else if (iaxis==kYAxis) {
816 axis=kYAxis;
817 //std::cout << "kYAxis= " << kYAxis << std::endl;
818 //std::cout << "axis= " << axis << std::endl;
819 }
820 else continue;
821 (device->GetPosition(axis))->ClearEventData();
822 (device->GetPosition(axis))->AssignScaledValue(fSlope[axis],device->GetPositionInZ());
823 (device->GetPosition(axis))->operator+=(fIntercept[axis]);
824 }
825 // Maybe we should apply resolution smearing to the stripline BPMs?
826 // device->PrintInfo();
828 //device->PrintInfo();
830 //std::cout << "Device " << device->GetElementName() << " X = " << std::setprecision(15) << device->GetPosition(kXAxis)->GetValue()
831 //<< "\t Y = " << std::setprecision(15) << device->GetPosition(kYAxis)->GetValue() << std::endl;
832}
EBeamPositionMonitorAxis
Definition VQwBPM.h:72
const VQwHardwareChannel * GetPosition(EBeamPositionMonitorAxis axis) const override
virtual void ApplyResolutionSmearing()
Definition VQwBPM.h:273
virtual void FillRawEventData()
Definition VQwBPM.h:98
Double_t GetPositionInZ() const
Definition VQwBPM.h:171

References VQwBPM::ApplyResolutionSmearing(), VQwBPM::axis, VQwBPM::FillRawEventData(), fIntercept, fSlope, VQwBPM::GetPosition(), VQwBPM::GetPositionInZ(), VQwBPM::kNumAxes, VQwBPM::kXAxis, VQwBPM::kYAxis, and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ GetSlope()

template<typename T>
const VQwHardwareChannel * QwCombinedBPM< T >::GetSlope ( EBeamPositionMonitorAxis axis) const
inline

Definition at line 101 of file QwCombinedBPM.h.

101 {
102 if (axis<0 || axis>2){
103 TString loc="QwLinearDiodeArray::GetPosition for "
104 +this->GetElementName()+" failed for axis value "+Form("%d",axis);
105 throw std::out_of_range(loc.Data());
106 }
107 return &fSlope[axis];
108 }

References VQwBPM::axis, fSlope, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ GetSubelementByName()

template<typename T>
VQwHardwareChannel * QwCombinedBPM< T >::GetSubelementByName ( TString ch_name)
overrideprotectedvirtual

Implements VQwBPM.

Definition at line 394 of file QwCombinedBPM.cc.

395{
397 ch_name.ToLower();
398 if (ch_name=="xslope"){
399 tmpptr = &fSlope[kXAxis];
400 }else if (ch_name=="yslope"){
401 tmpptr = &fSlope[kYAxis];
402 }else if (ch_name=="xintercept"){
404 }else if (ch_name=="yintercept"){
406 }else if (ch_name=="xminchisquare"){
408 }else if (ch_name=="yminchisquare"){
410 }else if (ch_name=="absx" || ch_name=="x" ){
412 }else if (ch_name=="absy" || ch_name=="y"){
414 }else if (ch_name=="effectivecharge" || ch_name=="charge"){
416 } else {
417 TString loc="QwCombinedBPM::GetSubelementByName for"
418 + this->GetElementName() + " was passed "
419 + ch_name + ", which is an unrecognized subelement name.";
420 throw std::invalid_argument(loc.Data());
421 }
422 return tmpptr;
423}

References fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kXAxis, and VQwBPM::kYAxis.

+ Here is the call graph for this function:

◆ GetSubElementName()

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

Reimplemented from VQwBPM.

Definition at line 48 of file QwCombinedBPM.h.

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

References fElement.

◆ IncrementErrorCounters()

template<typename T>
void QwCombinedBPM< T >::IncrementErrorCounters ( )
overridevirtual

Increment persistent error counters for all derived outputs.

Implements VQwBPM.

Definition at line 185 of file QwCombinedBPM.cc.

186{
188 fAbsPos[axis].IncrementErrorCounters();
189 fSlope[axis].IncrementErrorCounters();
190 fIntercept[axis].IncrementErrorCounters();
191 fMinimumChiSquare[axis].IncrementErrorCounters();
192 }
193
194 fEffectiveCharge.IncrementErrorCounters();
195}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ InitializeChannel() [1/3]

template<typename T>
void QwCombinedBPM< T >::InitializeChannel ( TString name)

Initialize derived output channels using a simple detector name. Creates absolute position, slope, intercept, chi-square per axis, and an effective charge channel. Clears internal element/weight lists.

Definition at line 37 of file QwCombinedBPM.cc.

38{
39
41
42 fEffectiveCharge.InitializeChannel(name+"WS","derived");
43
45 fAbsPos[axis].InitializeChannel(name+kAxisLabel[axis],"derived");
46 fSlope[axis].InitializeChannel(name+kAxisLabel[axis]+"Slope","derived");
47 fIntercept[axis].InitializeChannel(name+kAxisLabel[axis]+"Intercept","derived");
48 fMinimumChiSquare[axis].InitializeChannel(name+kAxisLabel[axis]+"MinChiSquare","derived");
49 }
50
52
53 fElement.clear();
54 fQWeights.clear();
55 fXWeights.clear();
56 fYWeights.clear();
57
58 fSumQweights = 0.0;
59
61 erra[axis] = 0.0;
62 errb[axis] = 0.0;
63 covab[axis] = 0.0;
64 A[axis] = 0.0;
65 B[axis] = 0.0;
66 D[axis] = 0.0;
67 m[axis] = 0.0;
68 }
69
70 return;
71}
std::vector< Double_t > fQWeights
std::vector< Double_t > fYWeights
Double_t fSumQweights
std::vector< Double_t > fXWeights
Bool_t fixedParamCalculated
static const TString kAxisLabel[2]
Definition VQwBPM.h:25
void InitializeChannel(TString name)
Initialize common BPM state and set the element name.
Definition VQwBPM.cc:35

References A, VQwBPM::axis, B, covab, D, erra, errb, fAbsPos, fEffectiveCharge, fElement, fIntercept, fixedParamCalculated, fMinimumChiSquare, fQWeights, fSlope, fSumQweights, fXWeights, fYWeights, VQwBPM::InitializeChannel(), VQwBPM::kAxisLabel, VQwBPM::kNumAxes, VQwBPM::kXAxis, and m.

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

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

◆ InitializeChannel() [2/3]

template<typename T>
void QwCombinedBPM< T >::InitializeChannel ( TString subsystem,
TString name )

Initialize derived output channels with explicit subsystem scoping. Forwards subsystem/name/type information to child channels.

Definition at line 78 of file QwCombinedBPM.cc.

79{
80
82
83 fEffectiveCharge.InitializeChannel(subsystem, "QwCombinedBPM", name+"WS","derived");
84
86 fAbsPos[axis].InitializeChannel(subsystem, "QwCombinedBPM", name+kAxisLabel[axis],"derived");
87 fSlope[axis].InitializeChannel(subsystem, "QwCombinedBPM", name+kAxisLabel[axis]+"Slope","derived");
88 fIntercept[axis].InitializeChannel(subsystem, "QwCombinedBPM", name+kAxisLabel[axis]+"Intercept","derived");
89 fMinimumChiSquare[axis].InitializeChannel(subsystem, "QwCombinedBPM",name+kAxisLabel[axis]+"MinChiSquare","derived");
90 }
91
93
94 fElement.clear();
95 fQWeights.clear();
96 fXWeights.clear();
97 fYWeights.clear();
98
99 fSumQweights = 0.0;
100
102 erra[axis] = 0.0;
103 errb[axis] = 0.0;
104 covab[axis] = 0.0;
105 A[axis] = 0.0;
106 B[axis] = 0.0;
107 D[axis] = 0.0;
108 m[axis] = 0.0;
109 }
110
111 return;
112}

References A, VQwBPM::axis, B, covab, D, erra, errb, fAbsPos, fEffectiveCharge, fElement, fIntercept, fixedParamCalculated, fMinimumChiSquare, fQWeights, fSlope, fSumQweights, fXWeights, fYWeights, VQwBPM::InitializeChannel(), VQwBPM::kAxisLabel, VQwBPM::kNumAxes, VQwBPM::kXAxis, and m.

+ Here is the call graph for this function:

◆ InitializeChannel() [3/3]

template<typename T>
void QwCombinedBPM< T >::InitializeChannel ( TString subsystem,
TString name,
TString type )
inline

Definition at line 79 of file QwCombinedBPM.h.

79 {
82 }
void SetModuleType(TString ModuleType)
set the type of the beam instrument

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

+ Here is the call graph for this function:

◆ LeastSquareFit()

template<typename T>
void QwCombinedBPM< T >::LeastSquareFit ( VQwBPM::EBeamPositionMonitorAxis axis,
std::vector< Double_t > fWeights )
protected

REF : W.R Leo

For Y = aX +b

A = sigma(X * Wy) B = sigma(Wy) C = sigma(Y*Wy) D = sigma(X *X * Wy) E = sigma(X*Y*Wy) F = sigma(Y * Y *Wy)

then a = (EB-CA)/(DB-AA) b =(DC-EA)/(DB-AA)

Definition at line 678 of file QwCombinedBPM.cc.

679 {
680
681 /**
682 REF : W.R Leo
683
684 For Y = aX +b
685
686 A = sigma(X * Wy) B = sigma(Wy) C = sigma(Y*Wy) D = sigma(X *X * Wy) E = sigma(X*Y*Wy) F = sigma(Y * Y *Wy)
687
688 then
689 a = (EB-CA)/(DB-AA) b =(DC-EA)/(DB-AA)
690 **/
691
693 static Double_t zpos = 0;
694 static T tmp1("tmp1","derived");
695 static T tmp2("tmp2","derived");
696 static T tmp3("tmp3","derived");
697 static T C[kNumAxes];
698 static T E[kNumAxes];
699
700 // initialize the VQWK_Channel arrays
701 C[kXAxis].InitializeChannel("cx","derived");
702 C[kYAxis].InitializeChannel("cy","derived");
703 E[kXAxis].InitializeChannel("ex","derived");
704 E[kYAxis].InitializeChannel("ey","derived");
705
708 for(size_t i=0;i<fElement.size();i++){
709 zpos = fElement[i]->GetPositionInZ();
713 C[axis] += tmp1; //xw or yw
714 tmp1.Scale(zpos);//xzw or yzw
715 E[axis] += tmp1;
716 }
717
718 if(ldebug) std::cout<<"\n A ="<<A[axis]
719 <<" -- B ="<<B[axis]
720 <<" --C ="<<C[axis].GetValue()
721 <<" --D ="<<D[axis]
722 <<" --E ="<<E[axis].GetValue()<<"\n";
723
724 // calculate the slope a = E*erra + C*covab
725 fSlope[axis].AssignScaledValue(E[axis], erra[axis]);
726 tmp2.AssignScaledValue(C[axis], covab[axis]);
727 fSlope[axis] += tmp2;
728
729 // calculate the intercept b = C*errb + E*covab
730 fIntercept[axis].AssignScaledValue(C[axis], errb[axis]);
731 tmp2.AssignScaledValue(E[axis], covab[axis]);
732 fIntercept[axis] += tmp2;
733
734 if(ldebug) std::cout<<" Least Squares Fit Parameters for "<< axis
735 <<" are: \n slope = "<< fSlope[axis].GetValue()
736 <<" \n intercept = " << fIntercept[axis].GetValue()<<"\n\n";
737
738
739 // absolute positions at target using X = Za + b
741 // Absolute position of the combined bpm is not a physical position but a derived one.
742
743
744 zpos = this->GetPositionInZ();
745 //UInt_t err_flag=fAbsPos[axis].GetEventcutErrorFlag();
746 fAbsPos[axis] = fIntercept[axis]; // X = b
747 //fAbsPos[axis].ResetErrorFlag(err_flag);
748 tmp1.AssignScaledValue(fSlope[axis],zpos); //az
749 fAbsPos[axis] += tmp1; //X = az+b
750
751
752 // to perform the minimul chi-square test
753 // We want to calculate (X-az-b)^2 for each bpm in the combination and sum over the values
755 fMinimumChiSquare[axis].ClearEventData();
756
757 for(size_t i=0;i<fElement.size();i++){
760 //std::cout<<"\nName -------- ="<<(fElement[i]->GetElementName())<<std::endl;
761 //std::cout<<"\nRead value ="<<(fElement[i]->GetPosition(axis))->GetValue()<<std::endl;
762
764 //std::cout<<"Read value ="<<tmp1.GetValue()<<std::endl;
765
766 tmp2.AssignScaledValue(fSlope[axis],fElement[i]->GetPositionInZ());
768 //std::cout<<"Calculated abs value ="<<tmp2.GetValue()<<std::endl;
769
770 tmp1 -= tmp2; // = X-Za-b
771 //std::cout<<"Read-calculated ="<<tmp1.GetValue()<<std::endl;
772 tmp1.Product(tmp1,tmp1); // = (X-Za-b)^2
773 //std::cout<<"(Read-calculated)^2 ="<<tmp1.GetValue()<<std::endl;
774 tmp1.Scale(fWeights[i]*fWeights[i]); // = [(X-Za-b)^2]W
775 //std::cout<<"(Read-calculated)^2/weight ="<<tmp1.GetValue()<<std::endl;
776 tmp3+=tmp1; //sum over
777 //std::cout<<"Sum (Read-calculated)^2/weight +="<<tmp3.GetValue()<<std::endl;
778 }
779
780 if (fElement.size()>2){
781 fMinimumChiSquare[axis].AssignScaledValue(tmp3,1.0/(fElement.size()-2)); //minimul chi-square
782 } else {
783 fMinimumChiSquare[axis].AssignScaledValue(tmp3,0.0);
784 }
785
786 //std::cout << "1.0/fElement.size() = " << 1.0/fElement.size() << std::endl;
787
788 return;
789 }
virtual void AssignValueFrom(const VQwDataElement *)
void Scale(Double_t factor) override
void ClearEventData() override

References A, VQwBPM::axis, B, covab, D, erra, errb, fAbsPos, fElement, fIntercept, fMinimumChiSquare, fSlope, GetPosition(), VQwBPM::GetPositionInZ(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and VQwBPM::kYAxis.

Referenced by ProcessEvent().

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

◆ LoadChannelParameters()

template<typename T>
void QwCombinedBPM< T >::LoadChannelParameters ( QwParameterFile & paramfile)
inlineoverridevirtual

Implements VQwBPM.

Definition at line 84 of file QwCombinedBPM.h.

84{};

◆ LoadMockDataParameters()

template<typename T>
void QwCombinedBPM< T >::LoadMockDataParameters ( QwParameterFile & paramfile)
overridevirtual

Reimplemented from VQwDataElement.

Definition at line 1320 of file QwCombinedBPM.cc.

1320 {
1321/*
1322 Bool_t ldebug=kFALSE;
1323 Double_t meanX=0.0, sigmaX=0.0, meanY=0.0, sigmaY=0.0;
1324 Double_t meanXslope=0.0, sigmaXslope=0.0, meanYslope=0.0, sigmaYslope=0.0;
1325*/
1326 Double_t xres=0.0, yres=0.0; // Temporary variables for the resolution.
1327
1328 if (paramfile.GetLine().find("resolution")!=std::string::npos){
1329 paramfile.GetNextToken();
1330 xres = paramfile.GetTypedNextToken<Double_t>();
1331 yres = paramfile.GetTypedNextToken<Double_t>();
1332 this->SetResolution(xres, yres);
1333 } else {
1334 // If we have asym, mean, sigma for each coorindate, then we can do:
1335
1336 TString value = paramfile.GetNextToken();
1337 if (value=="xpos") {
1338 fAbsPos[kXAxis].SetMockDataAsDiff();
1339 fAbsPos[kXAxis].LoadMockDataParameters(paramfile);
1340 }
1341 else if (value=="ypos") {
1342 fAbsPos[kYAxis].SetMockDataAsDiff();
1343 fAbsPos[kYAxis].LoadMockDataParameters(paramfile);
1344 }
1345 else if (value=="xslope") {
1346 fSlope[kXAxis].SetMockDataAsDiff();
1347 fSlope[kXAxis].LoadMockDataParameters(paramfile);
1348 }
1349 else if (value=="yslope") {
1350 fSlope[kYAxis].SetMockDataAsDiff();
1351 fSlope[kYAxis].LoadMockDataParameters(paramfile);
1352 }
1353/*
1354 for(size_t i=kXAxis;i<kNumAxes;i++){
1355 //std::cout << "In QwCombinedBPM: ChannelName = " << GetElementName() << std::endl;
1356 fAbsPos[i].SetMockDataAsDiff();
1357 fAbsPos[i].LoadMockDataParameters(paramfile);
1358 }
1359 for(size_t i=kXAxis;i<kNumAxes;i++){
1360 //std::cout << "In QwCombinedBPM: ChannelName = " << GetElementName() << std::endl;
1361 fSlope[i].SetMockDataAsDiff();
1362 fSlope[i].LoadMockDataParameters(paramfile);
1363 }
1364*/
1365// and so on....
1366/*
1367 meanX = paramfile.GetTypedNextToken<Double_t>();
1368 sigmaX = paramfile.GetTypedNextToken<Double_t>();
1369 meanY = paramfile.GetTypedNextToken<Double_t>();
1370 sigmaY = paramfile.GetTypedNextToken<Double_t>();
1371 meanXslope = paramfile.GetTypedNextToken<Double_t>();
1372 sigmaXslope = paramfile.GetTypedNextToken<Double_t>();
1373 meanYslope = paramfile.GetTypedNextToken<Double_t>();
1374 sigmaYslope = paramfile.GetTypedNextToken<Double_t>();
1375
1376 if (ldebug==1) {
1377 std::cout << "#################### \n";
1378 std::cout << "meanX, sigmaX, meanY, sigmaY, meanXslope, sigmaXslope, meanYslope, sigmaYslope \n" << std::endl;
1379 std::cout << meanX << " / "
1380 << sigmaX << " / "
1381 << meanY << " / "
1382 << sigmaY << " / "
1383 << meanXslope << " / "
1384 << sigmaXslope << " / "
1385 << meanYslope << " / "
1386 << sigmaYslope << " / "
1387 << std::endl;
1388 }
1389 this->SetRandomEventParameters(meanX, sigmaX, meanY, sigmaY, meanXslope, sigmaXslope, meanYslope, sigmaYslope);
1390*/
1391 }
1392}
virtual void SetResolution(Double_t resolutionX, Double_t resolutionY)
Definition VQwBPM.h:256

References fAbsPos, fSlope, QwParameterFile::GetLine(), QwParameterFile::GetNextToken(), QwParameterFile::GetTypedNextToken(), VQwBPM::kXAxis, VQwBPM::kYAxis, and VQwBPM::SetResolution().

+ Here is the call graph for this function:

◆ MakeBPMComboList()

template<typename T>
void QwCombinedBPM< T >::MakeBPMComboList ( )
private

◆ operator+=() [1/2]

template<typename T>
QwCombinedBPM< T > & QwCombinedBPM< T >::operator+= ( const QwCombinedBPM< T > & value)
virtual

Definition at line 912 of file QwCombinedBPM.cc.

913{
914
915 if (this->GetElementName()!=""){
918 this->fSlope[axis]+=value.fSlope[axis];
920 this->fAbsPos[axis]+=value.fAbsPos[axis];
922 }
923 }
924 return *this;
925}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwCombinedBPM().

+ Here is the call graph for this function:

◆ operator+=() [2/2]

template<typename T>
VQwBPM & QwCombinedBPM< T >::operator+= ( const VQwBPM & value)
overridevirtual

Implements VQwBPM.

Definition at line 904 of file QwCombinedBPM.cc.

905{
906 *(dynamic_cast<QwCombinedBPM<T>*>(this))+=
907 *(dynamic_cast<const QwCombinedBPM<T>*>(&value));
908 return *this;
909}

References QwCombinedBPM(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ operator-=() [1/2]

template<typename T>
QwCombinedBPM< T > & QwCombinedBPM< T >::operator-= ( const QwCombinedBPM< T > & value)
virtual

Definition at line 937 of file QwCombinedBPM.cc.

938{
939
940 if (this->GetElementName()!=""){
943 this->fSlope[axis]-=value.fSlope[axis];
945 this->fAbsPos[axis]-=value.fAbsPos[axis];
947 }
948 }
949 return *this;
950}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwCombinedBPM().

+ Here is the call graph for this function:

◆ operator-=() [2/2]

template<typename T>
VQwBPM & QwCombinedBPM< T >::operator-= ( const VQwBPM & value)
overridevirtual

Implements VQwBPM.

Definition at line 928 of file QwCombinedBPM.cc.

929{
930 *(dynamic_cast<QwCombinedBPM<T>*>(this))-=
931 *(dynamic_cast<const QwCombinedBPM<T>*>(&value));
932 return *this;
933}

References QwCombinedBPM(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ operator=() [1/2]

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

Definition at line 887 of file QwCombinedBPM.cc.

888{
890 if (this->GetElementName()!=""){
893 this->fSlope[axis]=value.fSlope[axis];
895 this->fAbsPos[axis]=value.fAbsPos[axis];
897 }
898 }
899 return *this;
900}
virtual VQwBPM & operator=(const VQwBPM &value)=0
Definition VQwBPM.cc:156

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, VQwBPM::operator=(), and QwCombinedBPM().

+ Here is the call graph for this function:

◆ operator=() [2/2]

template<typename T>
VQwBPM & QwCombinedBPM< T >::operator= ( const VQwBPM & value)
overridevirtual

Implements VQwBPM.

Definition at line 879 of file QwCombinedBPM.cc.

880{
881 *(dynamic_cast<QwCombinedBPM<T>*>(this))=
882 *(dynamic_cast<const QwCombinedBPM<T>*>(&value));
883 return *this;
884}

References QwCombinedBPM(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ PrintErrorCounters()

template<typename T>
void QwCombinedBPM< T >::PrintErrorCounters ( ) const
overridevirtual

Print persistent error counters for all derived outputs.

Reimplemented from VQwDataElement.

Definition at line 199 of file QwCombinedBPM.cc.

200{
202 fAbsPos[axis].PrintErrorCounters();
203 fSlope[axis].PrintErrorCounters();
204 fIntercept[axis].PrintErrorCounters();
205 fMinimumChiSquare[axis].PrintErrorCounters();
206 }
207
208 fEffectiveCharge.PrintErrorCounters();
209}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ PrintInfo()

template<typename T>
void QwCombinedBPM< T >::PrintInfo ( ) const
overridevirtual

Print multiple lines of information about this data element.

TODO: To print the Z position, we need to use GetPositionInZ()

Reimplemented from VQwDataElement.

Definition at line 858 of file QwCombinedBPM.cc.

859{
860
862
863 for(axis = kXAxis; axis < kNumAxes; axis++){
864 fAbsPos[axis].PrintInfo();
865 }
866 /// TODO: To print the Z position, we need to use GetPositionInZ()
867 for(axis = kXAxis; axis < kNumAxes; axis++) {
868 fSlope[axis].PrintInfo();
869 fIntercept[axis].PrintInfo();
870 fMinimumChiSquare[axis].PrintInfo();
871 }
872 fEffectiveCharge.PrintInfo();
873
874 return;
875}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ PrintValue()

template<typename T>
void QwCombinedBPM< T >::PrintValue ( ) const
overridevirtual

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

TODO: To print the Z position, we need to use GetPositionInZ()

Reimplemented from VQwDataElement.

Definition at line 838 of file QwCombinedBPM.cc.

839{
841
842 for(axis = kXAxis; axis < kNumAxes; axis++){
843 fAbsPos[axis].PrintValue();
844 }
845 /// TODO: To print the Z position, we need to use GetPositionInZ()
846 for(axis = kXAxis; axis < kNumAxes; axis++) {
847 fSlope[axis].PrintValue();
848 fIntercept[axis].PrintValue();
849 fMinimumChiSquare[axis].PrintValue();
850 }
851 fEffectiveCharge.PrintValue();
852
853 return;
854 }

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ ProcessEvBuffer()

template<typename T>
Int_t QwCombinedBPM< T >::ProcessEvBuffer ( UInt_t * buffer,
UInt_t num_words_left,
UInt_t subelement )
overridevirtual

Process the CODA event buffer for this element.

Implements VQwDataElement.

Definition at line 792 of file QwCombinedBPM.cc.

793 {
795 }

◆ ProcessEvent()

template<typename T>
void QwCombinedBPM< T >::ProcessEvent ( )
overridevirtual

Implements VQwBPM.

Definition at line 529 of file QwCombinedBPM.cc.

530{
532
533 static T tmpQADC("tmpQADC"), tmpADC("tmpADC");
534
535 this->ClearEventData();
536 //check to see if the fixed parameters are calculated
538 if(ldebug) std::cout<<"QwCombinedBPM:Calculating fixed parameters..\n";
542 }
543
544 for(size_t i=0;i<fElement.size();i++){
545 if(ldebug){
546 std::cout<<"*******************************\n";
547 std::cout<<" QwCombinedBPM: Reading "<<fElement[i]->GetElementName()<<" with charge weight ="<<fQWeights[i]
548 <<" and x weight ="<<fXWeights[i]
549 <<" and y weight ="<<fYWeights[i]<<"\n"<<std::flush;
550
551 }
555
556
557 if(ldebug) {
558 std::cout<<"fElement[" << i << "]->GetEffectiveCharge()=="
559 << fElement[i]->GetEffectiveCharge()
560 << std::endl << std::flush;
561 fElement[i]->GetEffectiveCharge()->PrintInfo();
562 std::cout<<"fElement[" << i << "]->GetPosition(kXAxis)=="
563 << fElement[i]->GetPosition(kXAxis)
564 << std::endl << std::flush;
565 std::cout<<"fElement[" << i << "]->GetPosition(kYAxis)=="
566 << fElement[i]->GetPosition(kYAxis)
567 << std::endl << std::flush;
568
570 std::cout<<"fElement[" << i << "]->GetEffectiveCharge returns NULL"
571 << std::endl;
572 } else
573 std::cout<<"got 4-wire.hw_sum = "<<fEffectiveCharge.GetValue()
574 <<" vs actual "
575 << fElement[i]->GetEffectiveCharge()->GetValue()
576 << std::endl << std::flush;
577
578
579 std::cout<<"copied absolute X position hw_sum from device "
580 << fElement[i]->GetPosition(kXAxis)->GetValue() <<std::endl;
581 std::cout<<"copied absolute Y position hw_sum from device "
582 << fElement[i]->GetPosition(kYAxis)->GetValue() <<std::endl;
583
584 }
585 }
586
588 //fAbsPos[0].ResetErrorFlag(0x4000000);
589 //Least squares fit for X
591
592 //Least squares fit for Y
594
595
596 if(ldebug){
597 std::cout<<" QwCombinedBPM:: Projected target X position = "<<fAbsPos[kXAxis].GetValue()
598 <<" and target X slope = "<<fSlope[kXAxis].GetValue()
599 <<" and target X intercept = "<<fIntercept[kXAxis].GetValue()
600 <<" with minimum chi square = "<< fMinimumChiSquare[kXAxis].GetValue()
601 <<" \nProjected target Y position = "<<fAbsPos[kYAxis].GetValue()
602 <<" and target Y slope = "<<fSlope[kYAxis].GetValue()
603 <<" and target Y intercept = "<<fIntercept[kYAxis].GetValue()
604 <<" with minimum chi square = "<< fMinimumChiSquare[kYAxis].GetValue()<<std::endl;
605
606 }
607
608
609 if (ldebug) {
610 //fEffectiveCharge.PrintInfo();
612 fAbsPos[axis].PrintInfo();
613 fSlope[axis].PrintInfo();
614 fIntercept[axis].PrintInfo();
615 //fMinimumChiSquare[axis].PrintInfo();
616 }
617 }
618
619 return;
620
621 }
void LeastSquareFit(VQwBPM::EBeamPositionMonitorAxis axis, std::vector< Double_t > fWeights)
void CalculateFixedParameter(std::vector< Double_t > fWeights, Int_t pos)
const VQwHardwareChannel * GetEffectiveCharge() const override

References VQwBPM::axis, CalculateFixedParameter(), ClearEventData(), fAbsPos, fEffectiveCharge, fElement, fIntercept, fixedParamCalculated, fMinimumChiSquare, fQWeights, fSlope, fSumQweights, fXWeights, fYWeights, GetEffectiveCharge(), VQwBPM::kNumAxes, VQwBPM::kXAxis, VQwBPM::kYAxis, and LeastSquareFit().

+ Here is the call graph for this function:

◆ RandomizeEventData()

template<typename T>
void QwCombinedBPM< T >::RandomizeEventData ( int helicity = 0,
double time = 0.0 )
overridevirtual

Reimplemented from VQwBPM.

Definition at line 1285 of file QwCombinedBPM.cc.

1286{
1287 static Double_t zpos = 0;
1288 static T tmp1("tmp1","derived");
1289 // Randomize the abs position and angle.
1290 for (size_t axis=kXAxis; axis<kNumAxes; axis++)
1291 {
1292 //std::cout << "In QwCombinedBPM::RandomizeEventData-> Slope(before): " << fSlope[axis].GetValue() << std::endl;
1293 //std::cout << "BEFORE RANDOMIZING POS & SLOPE: " << std::endl;
1294 //fSlope[axis].PrintInfo();
1295 //fAbsPos[axis].PrintInfo();
1296
1297 fAbsPos[axis].RandomizeEventData(helicity, time);
1298 fSlope[axis].RandomizeEventData(helicity, time);
1299
1300 //std::cout << "AFTER RANDOMIZING POS & SLOPE: " << std::endl;
1301 //fSlope[axis].PrintInfo();
1302 //fAbsPos[axis].PrintInfo();
1303 //fSlope[axis].PrintValue();
1304 //std::cout << "In QwCombinedBPM::RandomizeEventData-> Slope(after): " << fSlope[axis].GetValue() << std::endl;
1305
1306 zpos = this->GetPositionInZ();
1307 //std::cout << "In QwCombinedBPM: zpos= " << zpos << std::endl;
1308 //UInt_t err_flag=fAbsPos[axis].GetEventcutErrorFlag();
1309 fIntercept[axis] = fAbsPos[axis]; // b = X
1310 //fAbsPos[axis].ResetErrorFlag(err_flag);
1311 tmp1.AssignScaledValue(fSlope[axis],zpos); //az
1312 fIntercept[axis] -= tmp1; //b = X - az
1313 // std::cout << axis << " " << fAbsPos[axis].GetValue() << "-" << fSlope[axis].GetValue() <<"*"<<zpos <<"=?" << fIntercept[axis].GetValue() << std::endl;
1314 }
1315 return;
1316}

References VQwBPM::axis, fAbsPos, fIntercept, fSlope, VQwBPM::GetPositionInZ(), VQwBPM::kNumAxes, and VQwBPM::kXAxis.

+ Here is the call graph for this function:

◆ Ratio() [1/2]

template<typename T>
void QwCombinedBPM< T >::Ratio ( QwCombinedBPM< T > & numer,
QwCombinedBPM< T > & denom )

Definition at line 961 of file QwCombinedBPM.cc.

963{
964 // this function is called when forming asymmetries. In this case what we actually want for the
965 // combined bpm is the difference only not the asymmetries
966
967 *this=numer;
969 if (this->GetElementName()!=""){
970 // The slope, intercept and absolute positions should all be differences, not asymmetries.
972 this->fSlope[axis] = numer.fSlope[axis];
974 this->fAbsPos[axis] = numer.fAbsPos[axis];
976 }
977 }
978
979 return;
980}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwCombinedBPM().

Referenced by Ratio().

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

◆ Ratio() [2/2]

template<typename T>
void QwCombinedBPM< T >::Ratio ( VQwBPM & numer,
VQwBPM & denom )
overridevirtual

Reimplemented from VQwBPM.

Definition at line 954 of file QwCombinedBPM.cc.

955{
956 Ratio(*dynamic_cast<QwCombinedBPM<T>*>(&numer),
957 *dynamic_cast<QwCombinedBPM<T>*>(&denom));
958}
void Ratio(QwCombinedBPM &numer, QwCombinedBPM &denom)

References QwCombinedBPM(), Ratio(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ Scale()

template<typename T>
void QwCombinedBPM< T >::Scale ( Double_t factor)
overridevirtual

Reimplemented from VQwBPM.

Definition at line 984 of file QwCombinedBPM.cc.

985{
988 fSlope[axis].Scale(factor);
989 fIntercept[axis].Scale(factor);
990 fAbsPos[axis].Scale(factor);
992 }
993 return;
994}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ SetBPMForCombo()

template<typename T>
void QwCombinedBPM< T >::SetBPMForCombo ( const VQwBPM * bpm,
Double_t charge_weight,
Double_t x_weight,
Double_t y_weight,
Double_t sumqw )
overridevirtual

Add a constituent BPM and associated weights to the combination.

Parameters
bpmPointer to a constituent BPM instance.
charge_weightWeight contributing to effective charge.
x_weightWeight contributing to X position fit.
y_weightWeight contributing to Y position fit.
sumqwPrecomputed sum of absolute charge weights.

Reimplemented from VQwBPM.

Definition at line 141 of file QwCombinedBPM.cc.

143{
144 fElement.push_back(bpm);
145 fQWeights.push_back(charge_weight);
146 fXWeights.push_back(x_weight);
147 fYWeights.push_back(y_weight);
149
150 size_t i = fElement.size();
151 if (i>=1){
152 i--;
153 // std::cout << "+++++++++++++++++++++++++++\n+++++++++++++++++++++++++++\n" << std::endl;
154 // std::cout << "fElement.size()==" << fElement.size() << " " << i << " "
155 // << fElement.at(i)->GetElementName() << " "
156 // << fQWeights.at(i) << " "
157 // << fXWeights.at(i) << " "
158 // << fYWeights.at(i) << " "
159 // << "fElement.at(i)->GetEffectiveCharge()==" << fElement.at(i)->GetEffectiveCharge() << " "
160 // << std::endl;
161 // fElement.at(i)->GetEffectiveCharge()->PrintInfo();
162 // fElement.at(i)->PrintInfo();
163 }
164 return;
165
166}

References fElement, fQWeights, fSumQweights, fXWeights, fYWeights, and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ SetEventCutMode()

template<typename T>
void QwCombinedBPM< T >::SetEventCutMode ( Int_t bcuts)
overridevirtual

Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel.

Implements VQwBPM.

Definition at line 1244 of file QwCombinedBPM.cc.

1245{
1246
1247 // bEVENTCUTMODE=bcuts;
1249 fSlope[axis].SetEventCutMode(bcuts);
1250 fIntercept[axis].SetEventCutMode(bcuts);
1251 fAbsPos[axis].SetEventCutMode(bcuts);
1252 fMinimumChiSquare[axis].SetEventCutMode(bcuts);
1253 }
1254 fEffectiveCharge.SetEventCutMode(bcuts);
1255
1256 return;
1257}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ SetRandomEventParameters()

template<typename T>
void QwCombinedBPM< T >::SetRandomEventParameters ( Double_t meanX,
Double_t sigmaX,
Double_t meanY,
Double_t sigmaY,
Double_t meanXslope,
Double_t sigmaXslope,
Double_t meanYslope,
Double_t sigmaYslope )
overridevirtual

Reimplemented from VQwBPM.

Definition at line 1396 of file QwCombinedBPM.cc.

1398{
1399/*
1400 fAbsPos[kXAxis].SetMockDataAsDiff();
1401 fAbsPos[kYAxis].SetMockDataAsDiff();
1402 fSlope[kXAxis].SetMockDataAsDiff();
1403 fSlope[kYAxis].SetMockDataAsDiff();
1404*/
1405 fAbsPos[kXAxis].SetRandomEventParameters(meanX, sigmaX);
1406 fAbsPos[kYAxis].SetRandomEventParameters(meanY, sigmaY);
1407 fSlope[kXAxis].SetRandomEventParameters(meanXslope, sigmaXslope);
1408 fSlope[kYAxis].SetRandomEventParameters(meanYslope, sigmaYslope);
1409
1410 return;
1411}

References fAbsPos, fSlope, VQwBPM::kXAxis, and VQwBPM::kYAxis.

◆ SumOver()

template<typename T>
Double_t QwCombinedBPM< T >::SumOver ( std::vector< Double_t > weight,
std::vector< T > val )
protected

Definition at line 659 of file QwCombinedBPM.cc.

660 {
661 Double_t sum = 0.0;
662 if(weight.size()!=fElement.size()){
664 <<"QwCombinedBPM:: Number of devices doesn't match the number of weights."
665 <<" Exiting calculating parameters for the least squares fit"
666 <<std::endl;
667 }
668 else{
669 for(size_t i=0;i<weight.size();i++){
670 val[i].Scale(weight[i]);
671 sum+=val[i].GetValue();
672 }
673 }
674 return sum;
675 }

References fElement.

◆ UpdateErrorFlag() [1/2]

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

Update the error flag based on the error flags of internally contained objects Return parameter is the "Eventcut Error Flag".

Implements VQwBPM.

Definition at line 325 of file QwCombinedBPM.cc.

326{
327 Int_t axis=0;
329 UInt_t pos_error[2];
330 charge_error = 0;
331 pos_error[kXAxis]=0;
332 pos_error[kYAxis]=0;
333
334 UInt_t error = 0;
335
336 for(size_t i=0;i<fElement.size();i++){
337 //To update the event cut failures in individual BPM devices
338 charge_error |= fElement[i]->GetEffectiveCharge()->GetErrorCode();
339 pos_error[kXAxis] |= fElement[i]->GetPosition(kXAxis)->GetErrorCode();
340 pos_error[kYAxis] |= fElement[i]->GetPosition(kYAxis)->GetErrorCode();
341 }
342
343 //Event cuts for X & Y slopes
345 fIntercept[axis].UpdateErrorFlag(pos_error[axis]);
346 fSlope[axis].UpdateErrorFlag(pos_error[axis]);
347 fMinimumChiSquare[axis].UpdateErrorFlag(pos_error[axis]);
348 fAbsPos[axis].UpdateErrorFlag(pos_error[axis]);
349
350 //Get the Event cut error flag for SlopeX/Y
351 error|=fSlope[axis].GetEventcutErrorFlag();
352 error|=fIntercept[axis].GetEventcutErrorFlag();
353 error|=fMinimumChiSquare[axis].GetEventcutErrorFlag();
354 error|=fAbsPos[axis].GetEventcutErrorFlag();
355
356 }
357
358 //Event cuts for four wire sum (EffectiveCharge)
359 fEffectiveCharge.UpdateErrorFlag(charge_error);
360 //Get the Event cut error flag for EffectiveCharge
361 error|=fEffectiveCharge.GetEventcutErrorFlag();
362
363 return error;
364}

References VQwBPM::axis, fAbsPos, fEffectiveCharge, fElement, fIntercept, fMinimumChiSquare, fSlope, VQwBPM::kNumAxes, VQwBPM::kXAxis, and VQwBPM::kYAxis.

◆ UpdateErrorFlag() [2/2]

template<typename T>
void QwCombinedBPM< T >::UpdateErrorFlag ( const VQwBPM * ev_error)
overridevirtual

Implements VQwBPM.

Definition at line 500 of file QwCombinedBPM.cc.

500 {
501 Short_t i=0;
502 try {
503 if(typeid(*ev_error)==typeid(*this)) {
504 // std::cout<<" Here in QwBPMStripline::UpdateErrorFlag \n";
505 if (this->GetElementName()!="") {
506 const QwCombinedBPM<T>* value_bpm = dynamic_cast<const QwCombinedBPM<T>* >(ev_error);
507 for(i=kXAxis;i<kNumAxes;i++) {
508 fAbsPos[i].UpdateErrorFlag(value_bpm->fAbsPos[i]);
509 fSlope[i].UpdateErrorFlag(value_bpm->fSlope[i]);
510 fIntercept[i].UpdateErrorFlag(value_bpm->fIntercept[i]);
511 fMinimumChiSquare[i].UpdateErrorFlag(value_bpm->fMinimumChiSquare[i]);
512 }
514 }
515 } else {
516 TString loc="Standard exception from QwCombinedBPM::UpdateErrorFlag :"+
517 ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
518 +"same type";
519 throw std::invalid_argument(loc.Data());
520 }
521 } catch (std::exception& e) {
522 std::cerr<< e.what()<<std::endl;
523 }
524};

References fAbsPos, fEffectiveCharge, fIntercept, fMinimumChiSquare, fSlope, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, QwCombinedBPM(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ QwEnergyCalculator

template<typename T>
friend class QwEnergyCalculator
friend

Definition at line 41 of file QwCombinedBPM.h.

References QwEnergyCalculator.

Referenced by QwEnergyCalculator.

Field Documentation

◆ A

template<typename T>
Double_t QwCombinedBPM< T >::A[2]
private

◆ B

template<typename T>
Double_t QwCombinedBPM< T >::B[2]
private

◆ chi_square

template<typename T>
Double_t QwCombinedBPM< T >::chi_square[2]
private

Definition at line 211 of file QwCombinedBPM.h.

◆ covab

template<typename T>
Double_t QwCombinedBPM< T >::covab[2]
private

◆ D

template<typename T>
Double_t QwCombinedBPM< T >::D[2]
private

◆ erra

template<typename T>
Double_t QwCombinedBPM< T >::erra[2]
private

◆ errb

template<typename T>
Double_t QwCombinedBPM< T >::errb[2]
private

◆ fAbsPos

◆ fBPMComboElementList

template<typename T>
std::vector<T> QwCombinedBPM< T >::fBPMComboElementList
private

Definition at line 238 of file QwCombinedBPM.h.

Referenced by MakeBPMComboList().

◆ fEffectiveCharge

◆ fElement

◆ fIntercept

◆ fixedParamCalculated

template<typename T>
Bool_t QwCombinedBPM< T >::fixedParamCalculated
private

Definition at line 206 of file QwCombinedBPM.h.

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

◆ fMinimumChiSquare

◆ fQWeights

template<typename T>
std::vector<Double_t> QwCombinedBPM< T >::fQWeights
private

◆ fSlope

◆ fSumQweights

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

◆ fXWeights

template<typename T>
std::vector<Double_t> QwCombinedBPM< T >::fXWeights
private

◆ fYWeights

template<typename T>
std::vector<Double_t> QwCombinedBPM< T >::fYWeights
private

◆ m

template<typename T>
Double_t QwCombinedBPM< T >::m[2]
private

Definition at line 210 of file QwCombinedBPM.h.

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


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