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

Cavity-style BPM using VQWK channels. More...

#include <QwBPMCavity.h>

+ Inheritance diagram for QwBPMCavity:
+ Collaboration diagram for QwBPMCavity:

Public Types

enum  ECavElements { kXElem =0 , kYElem , kQElem , kNumElements }
 
- 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

 QwBPMCavity ()
 
 QwBPMCavity (TString name)
 
 QwBPMCavity (TString subsystemname, TString name)
 
 QwBPMCavity (const QwBPMCavity &source)
 
 ~QwBPMCavity () override
 
void InitializeChannel (TString name)
 
void InitializeChannel (TString subsystem, TString name)
 
void ClearEventData () override
 
void LoadChannelParameters (QwParameterFile &paramfile) override
 
Int_t ProcessEvBuffer (UInt_t *buffer, UInt_t word_position_in_buffer, UInt_t indexnumber) override
 
void ProcessEvent () override
 
void PrintValue () const override
 
void PrintInfo () const override
 
const VQwHardwareChannelGetPosition (EBeamPositionMonitorAxis axis) const override
 
const VQwHardwareChannelGetEffectiveCharge () const override
 
TString GetSubElementName (Int_t subindex) override
 
void GetAbsolutePosition () override
 
Bool_t ApplyHWChecks ()
 
Bool_t ApplySingleEventCuts () override
 
void SetSingleEventCuts (TString ch_name, UInt_t errorflag, Double_t minX, Double_t maxX, Double_t stability, Double_t burplevel)
 Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel.
 
void SetEventCutMode (Int_t bcuts) override
 
void IncrementErrorCounters () override
 
void PrintErrorCounters () const override
 
UInt_t GetEventcutErrorFlag () override
 
UInt_t UpdateErrorFlag () override
 
void UpdateErrorFlag (const VQwBPM *ev_error) override
 
Bool_t CheckForBurpFail (const VQwDataElement *ev_error) override
 
void SetDefaultSampleSize (Int_t sample_size) override
 
void SetRandomEventParameters (Double_t meanX, Double_t sigmaX, Double_t meanY, Double_t sigmaY) override
 
void RandomizeEventData (int helicity=0, double time=0.0) override
 
void SetEventData (Double_t *block, UInt_t sequencenumber)
 
void EncodeEventData (std::vector< UInt_t > &buffer) override
 
void SetSubElementPedestal (Int_t j, Double_t value) override
 
void SetSubElementCalibrationFactor (Int_t j, Double_t value) override
 
void Ratio (QwBPMCavity &numer, QwBPMCavity &denom)
 
void Scale (Double_t factor) override
 
VQwBPMoperator= (const VQwBPM &value) override
 
VQwBPMoperator+= (const VQwBPM &value) override
 
VQwBPMoperator-= (const VQwBPM &value) override
 
virtual QwBPMCavityoperator= (const QwBPMCavity &value)
 
virtual QwBPMCavityoperator+= (const QwBPMCavity &value)
 
virtual QwBPMCavityoperator-= (const QwBPMCavity &value)
 
void AccumulateRunningSum (const VQwBPM &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
 
void AccumulateRunningSum (const QwBPMCavity &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
 
void DeaccumulateRunningSum (VQwBPM &value, Int_t ErrorMask=0xFFFFFFF) override
 
void DeaccumulateRunningSum (QwBPMCavity &value, Int_t ErrorMask=0xFFFFFFF)
 
void CalculateRunningAverage () override
 
void ConstructHistograms (TDirectory *folder, TString &prefix) override
 
void FillHistograms () override
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
 
void FillTreeVector (QwRootTreeBranchVector &values) const override
 
void ConstructBranch (TTree *tree, TString &prefix) override
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &modulelist) override
 
std::vector< QwDBInterfaceGetDBEntry ()
 
std::vector< QwErrDBInterfaceGetErrDBEntry ()
 
- 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 GetProjectedPosition (VQwBPM *)
 
virtual size_t GetNumberOfElements ()
 
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)
 
Double_t GetPositionInZ () const
 
virtual void Ratio (VQwBPM &, VQwBPM &)
 
void PrintErrorCounters () const override
 report number of events failed due to HW and event cut failure
 
virtual const VQwHardwareChannelGetAngleX () const
 
virtual const VQwHardwareChannelGetAngleY () const
 
virtual void SetBPMForCombo (const VQwBPM *, Double_t, Double_t, Double_t, Double_t)
 
virtual void SetResolution (Double_t resolutionX, Double_t resolutionY)
 
virtual void SetRandomEventParameters (Double_t, Double_t, Double_t, Double_t, Double_t, Double_t, Double_t, Double_t)
 
virtual void SetRandomEventAsymmetry (Double_t)
 
virtual void ApplyResolutionSmearing ()
 
virtual void ApplyResolutionSmearing (EBeamPositionMonitorAxis)
 
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.
 
virtual void LoadMockDataParameters (QwParameterFile &)
 
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.
 

Static Public Member Functions

static UInt_t GetSubElementIndex (TString subname)
 
static Bool_t ParseChannelName (const TString &channel, TString &detname, TString &subname, UInt_t &localindex)
 
- 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)
 

Protected Member Functions

VQwHardwareChannelGetSubelementByName (TString ch_name) override
 
- 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< QwVQWK_Channel, kNumElementsfElement
 
std::array< QwVQWK_Channel, kNumAxesfRelPos
 
std::array< QwVQWK_Channel, kNumAxesfAbsPos
 
- 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 MakeBPMCavityList ()
 

Private Attributes

std::vector< QwVQWK_ChannelfBPMElementList
 

Static Private Attributes

static const Double_t kQwCavityCalibration = 1.0
 
static const TString subelement [kNumElements] ={"XI","YI","Q"}
 

Friends

template<typename TT>
class QwCombinedBPM
 
class QwEnergyCalculator
 

Additional Inherited Members

- 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

Cavity-style BPM using VQWK channels.

Provides X/Y position and effective charge from cavity readouts, with utilities for cuts, histograms, and tree/NTuple output.

Definition at line 38 of file QwBPMCavity.h.

Member Enumeration Documentation

◆ ECavElements

Enumerator
kXElem 
kYElem 
kQElem 
kNumElements 

Definition at line 43 of file QwBPMCavity.h.

Constructor & Destructor Documentation

◆ QwBPMCavity() [1/4]

QwBPMCavity::QwBPMCavity ( )
inline

Definition at line 48 of file QwBPMCavity.h.

48{ };

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

+ Here is the caller graph for this function:

◆ QwBPMCavity() [2/4]

QwBPMCavity::QwBPMCavity ( TString name)
inline

Definition at line 49 of file QwBPMCavity.h.

49 :VQwBPM(name){
51 };
void InitializeChannel(TString name)
VQwBPM()
Definition VQwBPM.h:76

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

+ Here is the call graph for this function:

◆ QwBPMCavity() [3/4]

QwBPMCavity::QwBPMCavity ( TString subsystemname,
TString name )
inline

Definition at line 52 of file QwBPMCavity.h.

53 : VQwBPM(name) {
54 SetSubsystemName(subsystemname);
55 InitializeChannel(subsystemname, name);
56 };
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.

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

+ Here is the call graph for this function:

◆ QwBPMCavity() [4/4]

QwBPMCavity::QwBPMCavity ( const QwBPMCavity & source)
inline

Definition at line 57 of file QwBPMCavity.h.

58 : VQwBPM(source)
59 {
63 }
void QwCopyArray(const T &a, T &b)
Definition QwUtil.h:15
std::array< QwVQWK_Channel, kNumAxes > fRelPos
std::array< QwVQWK_Channel, kNumElements > fElement
std::array< QwVQWK_Channel, kNumAxes > fAbsPos

References fAbsPos, fElement, fRelPos, QwBPMCavity(), QwCopyArray(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ ~QwBPMCavity()

QwBPMCavity::~QwBPMCavity ( )
inlineoverride

Definition at line 64 of file QwBPMCavity.h.

64{ };

Member Function Documentation

◆ AccumulateRunningSum() [1/2]

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

Accumulate running sums for raw and derived channels.

Definition at line 717 of file QwBPMCavity.cc.

718{
719
720 size_t i = 0;
721 for(i=0;i<kNumElements;i++)
722 fElement[i].AccumulateRunningSum(value.fElement[i], count, ErrorMask);
723 for (i = 0; i < 2; i++){
724 fRelPos[i].AccumulateRunningSum(value.fRelPos[i], count, ErrorMask);
725 fAbsPos[i].AccumulateRunningSum(value.fAbsPos[i], count, ErrorMask);
726 }
727 return;
728}
void AccumulateRunningSum(const VQwBPM &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override

References AccumulateRunningSum(), fAbsPos, fElement, fRelPos, kNumElements, and QwBPMCavity().

+ Here is the call graph for this function:

◆ AccumulateRunningSum() [2/2]

void QwBPMCavity::AccumulateRunningSum ( const VQwBPM & value,
Int_t count = 0,
Int_t ErrorMask = 0xFFFFFFF )
overridevirtual

Type-erased running-sum accumulate; forwards to concrete overload.

Reimplemented from VQwBPM.

Definition at line 712 of file QwBPMCavity.cc.

712 {
713 AccumulateRunningSum(*dynamic_cast<const QwBPMCavity* >(&value), count, ErrorMask);
714};

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

Referenced by AccumulateRunningSum(), and AccumulateRunningSum().

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

◆ ApplyHWChecks()

Bool_t QwBPMCavity::ApplyHWChecks ( )

Apply hardware-level checks to each subelement and aggregate status.

Returns
true if no hardware errors are detected across all subelements.

Definition at line 158 of file QwBPMCavity.cc.

159{
160 Bool_t eventokay=kTRUE;
161
162 UInt_t deviceerror=0;
163 for(size_t i=0;i<kNumElements;i++)
164 {
165 deviceerror|= fElement[i].ApplyHWChecks(); //OR the error code from each wire
166 eventokay &= (deviceerror & 0x0);//AND with 0 since zero means HW is good.
167
168 if (bDEBUG) std::cout<<" Inconsistent within BPM terminals wire[ "<<i<<" ] "<<std::endl;
169 if (bDEBUG) std::cout<<" wire[ "<<i<<" ] sequence num "<<fElement[i].GetSequenceNumber()<<" sample size "<<fElement[i].GetNumberOfSamples()<<std::endl;
170 }
171 return eventokay;
172}
static const Bool_t bDEBUG
Definition VQwBPM.h:350

References VQwBPM::bDEBUG, fElement, and kNumElements.

Referenced by ProcessEvent().

+ Here is the caller graph for this function:

◆ ApplySingleEventCuts()

Bool_t QwBPMCavity::ApplySingleEventCuts ( )
overridevirtual

Apply analysis-level single-event cuts to raw and derived quantities.

Returns
true if all configured channels pass their single-event cuts.

Implements VQwBPM.

Definition at line 246 of file QwBPMCavity.cc.

247{
248 Bool_t status=kTRUE;
249 Int_t i=0;
250 UInt_t error_code = 0;
251 //Event cuts for elements
252 for(i=0;i<kNumElements;i++){
254 status&=kTRUE;
255 }
256 else{
257 status&=kFALSE;
258 if (bDEBUG) std::cout<<" Element "<< fElement[i].GetElementName()
259 << " event cut failed ";
260 }
261 error_code |= fElement[i].GetErrorCode();
262 }
263 for(i=kXAxis;i<kNumAxes;i++){
264 fRelPos[i].UpdateErrorFlag(error_code);
265 if (fRelPos[i].ApplySingleEventCuts()){ //for RelX
266 status&=kTRUE;
267 }
268 else{
269 status&=kFALSE;
270 if (bDEBUG) std::cout<<" Rel X event cut failed ";
271 }
272 }
273
274 for(i=kXAxis;i<kNumAxes;i++){
275 fAbsPos[i].UpdateErrorFlag(error_code);
276 if (fAbsPos[i].ApplySingleEventCuts()){ //for RelX
277 status&=kTRUE;
278 }
279 else{
280 status&=kFALSE;
281 if (bDEBUG) std::cout<<" Abs X event cut failed ";
282 }
283 }
284 return status;
285}
Bool_t ApplySingleEventCuts() override
@ kXAxis
Definition VQwBPM.h:72
@ kNumAxes
Definition VQwBPM.h:72

References ApplySingleEventCuts(), VQwBPM::bDEBUG, fAbsPos, fElement, fRelPos, VQwBPM::kNumAxes, kNumElements, and VQwBPM::kXAxis.

Referenced by ApplySingleEventCuts().

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

◆ CalculateRunningAverage()

void QwBPMCavity::CalculateRunningAverage ( )
overridevirtual

Update per-channel running averages based on accumulated sums.

Implements VQwBPM.

Definition at line 699 of file QwBPMCavity.cc.

700{
701 size_t i = 0;
702 for(i=0;i<kNumElements;i++)
704 for (i = 0; i < kNumAxes; i++){
705 fRelPos[i].CalculateRunningAverage();
706 fAbsPos[i].CalculateRunningAverage();
707 }
708 return;
709}
void CalculateRunningAverage() override

References CalculateRunningAverage(), fAbsPos, fElement, fRelPos, VQwBPM::kNumAxes, and kNumElements.

Referenced by CalculateRunningAverage().

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

◆ CheckForBurpFail()

Bool_t QwBPMCavity::CheckForBurpFail ( const VQwDataElement * ev_error)
overridevirtual

Polymorphic burp/burst failure check against a reference element of the same concrete type. For each subelement and derived channel, delegate to its CheckForBurpFail implementation.

Parameters
ev_errorReference data element to compare against.
Returns
true if any sub-channel reports a burp/burst failure.
Exceptions
std::invalid_argumentif ev_error is not a QwBPMCavity.

Reimplemented from VQwBPM.

Definition at line 399 of file QwBPMCavity.cc.

399 {
400 Short_t i=0;
401 Bool_t burpstatus = kFALSE;
402 try {
403 if(typeid(*ev_error)==typeid(*this)) {
404 //std::cout<<" Here in QwBPMCavity::CheckForBurpFail \n";
405 if (this->GetElementName()!="") {
406 const QwBPMCavity* value_bpm = dynamic_cast<const QwBPMCavity* >(ev_error);
407 for(i=0;i<2;i++){
408 burpstatus |= fElement[i].CheckForBurpFail(&(value_bpm->fElement[i]));
409 burpstatus |= fRelPos[i].CheckForBurpFail(&(value_bpm->fRelPos[i]));
410 burpstatus |= fAbsPos[i].CheckForBurpFail(&(value_bpm->fAbsPos[i]));
411 }
412 burpstatus |= fElement[kQElem].CheckForBurpFail(&(value_bpm->fElement[kQElem]));
413 }
414 } else {
415 TString loc="Standard exception from QwBPMCavity::CheckForBurpFail :"+
416 ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
417 +"same type";
418 throw std::invalid_argument(loc.Data());
419 }
420 } catch (std::exception& e) {
421 std::cerr<< e.what()<<std::endl;
422 }
423 return burpstatus;
424}
virtual const TString & GetElementName() const
Get the name of this element.

References fAbsPos, fElement, fRelPos, VQwDataElement::GetElementName(), kQElem, QwBPMCavity(), and VQwDataElement::VQwDataElement().

+ Here is the call graph for this function:

◆ ClearEventData()

void QwBPMCavity::ClearEventData ( )
overridevirtual

Clear all owned subelement and derived channel state for the current event.

Reimplemented from VQwDataElement.

Definition at line 139 of file QwBPMCavity.cc.

140{
141 size_t i=0;
142
143 for(i=0;i<kNumElements;i++){
144 fElement[i].ClearEventData();
145 }
146 for(i=0;i<kNumAxes;i++){
147 fAbsPos[i].ClearEventData();
148 fRelPos[i].ClearEventData();
149 }
150}

References fAbsPos, fElement, fRelPos, VQwBPM::kNumAxes, and kNumElements.

◆ ConstructBranch() [1/2]

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

Define TTree branches for output variables using the provided prefix. The prefix "asym_" is converted to "diff_" for positions.

Implements VQwBPM.

Definition at line 827 of file QwBPMCavity.cc.

828 {
829 if (GetElementName()==""){
830 // This channel is not used, so skip constructing trees.
831 }
832 else {
833 TString thisprefix=prefix;
834 if(prefix.Contains("asym_"))
835 thisprefix.ReplaceAll("asym_","diff_");
836 SetRootSaveStatus(prefix);
837
838 fElement[kQElem].ConstructBranch(tree,prefix);
839 size_t i = 0;
840 for(i=kXAxis;i<kNumAxes;i++) {
841 if (bFullSave) fElement[i].ConstructBranch(tree,thisprefix);
842 // fRelPos[i].ConstructBranch(tree,thisprefix);
843 fAbsPos[i].ConstructBranch(tree,thisprefix);
844 }
845
846 }
847 return;
848 }
void SetRootSaveStatus(TString &prefix)
Definition VQwBPM.cc:220
Bool_t bFullSave
Definition VQwBPM.h:348

References VQwBPM::bFullSave, fAbsPos, fElement, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, kQElem, VQwBPM::kXAxis, and VQwBPM::SetRootSaveStatus().

+ Here is the call graph for this function:

◆ ConstructBranch() [2/2]

void QwBPMCavity::ConstructBranch ( TTree * tree,
TString & prefix,
QwParameterFile & modulelist )
overridevirtual

Conditionally define TTree branches based on a module list filter. Only branches present in the module list are created.

Implements VQwBPM.

Definition at line 854 of file QwBPMCavity.cc.

855 {
856 TString devicename;
857 /*
858 QwMessage <<" QwBCM::ConstructBranch "<<QwLog::endl;
859 modulelist.RewindToFileStart();
860 while (modulelist.ReadNextLine()){
861 modulelist.TrimComment('!'); // Remove everything after a '!' character.
862 modulelist.TrimWhitespace(); // Get rid of leading and trailing spaces
863 QwMessage <<" "<<modulelist.GetLine()<<" ";
864 }
865 QwMessage <<QwLog::endl;
866 */
867 devicename=GetElementName();
868 devicename.ToLower();
869 if (GetElementName()==""){
870 // This channel is not used, so skip filling the histograms.
871 } else
872 {
873 if (modulelist.HasValue(devicename)){
874 TString thisprefix=prefix;
875 if(prefix.Contains("asym_"))
876 thisprefix.ReplaceAll("asym_","diff_");
877 SetRootSaveStatus(prefix);
878
879 fElement[kQElem].ConstructBranch(tree,prefix);
880 size_t i = 0;
881 for(i=kXAxis;i<kNumAxes;i++) {
882 if (bFullSave) fElement[i].ConstructBranch(tree,thisprefix);
883 // fRelPos[i].ConstructBranch(tree,thisprefix);
884 fAbsPos[i].ConstructBranch(tree,thisprefix);
885 }
886
887 QwMessage <<" Tree leaves added to "<<devicename<<" Corresponding channels"<<QwLog::endl;
888 }
889 // this functions doesn't do anything yet
890 }
891
892
893
894
895
896 return;
897 }
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Bool_t HasValue(TString &vname)

References VQwBPM::bFullSave, QwLog::endl(), fAbsPos, fElement, VQwDataElement::GetElementName(), QwParameterFile::HasValue(), VQwBPM::kNumAxes, kQElem, VQwBPM::kXAxis, QwMessage, and VQwBPM::SetRootSaveStatus().

+ Here is the call graph for this function:

◆ ConstructBranchAndVector()

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

Define TTree branches and attach backing vectors for output variables. The prefix "asym_" is converted to "diff_" for positions.

Implements VQwBPM.

Definition at line 800 of file QwBPMCavity.cc.

801{
802 if (GetElementName()==""){
803 // This channel is not used, so skip constructing trees.
804 }
805 else {
806 TString thisprefix=prefix;
807 if(prefix.Contains("asym_"))
808 thisprefix.ReplaceAll("asym_","diff_");
809 SetRootSaveStatus(prefix);
810
811 fElement[kQElem].ConstructBranchAndVector(tree,prefix,values);
812 size_t i = 0;
813 for(i=kXAxis;i<kNumAxes;i++) {
814 if (bFullSave) fElement[i].ConstructBranchAndVector(tree,thisprefix,values);
815 // fRelPos[i].ConstructBranchAndVector(tree,thisprefix,values);
816 fAbsPos[i].ConstructBranchAndVector(tree,thisprefix,values);
817 }
818
819 }
820 return;
821}

References VQwBPM::bFullSave, fAbsPos, fElement, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, kQElem, VQwBPM::kXAxis, and VQwBPM::SetRootSaveStatus().

+ Here is the call graph for this function:

◆ ConstructHistograms()

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

Define ROOT histograms for subelements and derived absolute positions. The prefix "asym_" is converted to "diff_" for positions.

Implements VQwBPM.

Definition at line 755 of file QwBPMCavity.cc.

756{
757
758 if (GetElementName()=="") {
759 // This channel is not used, so skip filling the histograms.
760 } else {
761 fElement[kQElem].ConstructHistograms(folder, prefix);
762 TString thisprefix=prefix;
763
764 if(prefix.Contains("asym_"))
765 thisprefix.ReplaceAll("asym_","diff_");
766 SetRootSaveStatus(prefix);
767 size_t i = 0;
768 for(i=kXAxis;i<kNumAxes;i++) {
769 if(bFullSave) fElement[i].ConstructHistograms(folder, thisprefix);
770 // fRelPos[i].ConstructHistograms(folder, thisprefix);
771 fAbsPos[i].ConstructHistograms(folder, thisprefix);
772 }
773 }
774 return;
775}

References VQwBPM::bFullSave, fAbsPos, fElement, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, kQElem, VQwBPM::kXAxis, and VQwBPM::SetRootSaveStatus().

+ Here is the call graph for this function:

◆ DeaccumulateRunningSum() [1/2]

void QwBPMCavity::DeaccumulateRunningSum ( QwBPMCavity & value,
Int_t ErrorMask = 0xFFFFFFF )

Deaccumulate running sums for raw and derived channels.

Definition at line 736 of file QwBPMCavity.cc.

737{
738 size_t i = 0;
739 for(i=0;i<kNumElements;i++)
740 fElement[i].DeaccumulateRunningSum(value.fElement[i], ErrorMask);
741 for (i = 0; i < kNumAxes; i++){
742 fRelPos[i].DeaccumulateRunningSum(value.fRelPos[i], ErrorMask);
743 fAbsPos[i].DeaccumulateRunningSum(value.fAbsPos[i], ErrorMask);
744 }
745 return;
746}
void DeaccumulateRunningSum(VQwBPM &value, Int_t ErrorMask=0xFFFFFFF) override

References DeaccumulateRunningSum(), fAbsPos, fElement, fRelPos, VQwBPM::kNumAxes, kNumElements, and QwBPMCavity().

+ Here is the call graph for this function:

◆ DeaccumulateRunningSum() [2/2]

void QwBPMCavity::DeaccumulateRunningSum ( VQwBPM & value,
Int_t ErrorMask = 0xFFFFFFF )
overridevirtual

Type-erased running-sum deaccumulate; forwards to concrete overload.

Implements VQwBPM.

Definition at line 731 of file QwBPMCavity.cc.

731 {
732 DeaccumulateRunningSum(*dynamic_cast<QwBPMCavity* >(&value), ErrorMask);
733};

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

Referenced by DeaccumulateRunningSum(), and DeaccumulateRunningSum().

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

◆ EncodeEventData()

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

Serialize raw element data into a CODA-like output buffer.

Reimplemented from VQwBPM.

Definition at line 1084 of file QwBPMCavity.cc.

1085{
1086 for (size_t i=0; i<kNumElements; i++)
1087 fElement[i].EncodeEventData(buffer);
1088}
void EncodeEventData(std::vector< UInt_t > &buffer) override

References EncodeEventData(), fElement, and kNumElements.

Referenced by EncodeEventData().

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

◆ FillHistograms()

void QwBPMCavity::FillHistograms ( )
overridevirtual

Fill previously constructed ROOT histograms for this detector.

Implements VQwBPM.

Definition at line 778 of file QwBPMCavity.cc.

779{
780 if (GetElementName()=="") {
781 // This channel is not used, so skip filling the histograms.
782 }
783 else {
784 fElement[kQElem].FillHistograms();
785 size_t i = 0;
786 for(i=kXAxis;i<kNumAxes;i++){
787 if (bFullSave) fElement[i].FillHistograms();
788 // fRelPos[i].FillHistograms();
789 fAbsPos[i].FillHistograms();
790 }
791 //No data for z position
792 }
793 return;
794}

References VQwBPM::bFullSave, fAbsPos, fElement, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, kQElem, and VQwBPM::kXAxis.

+ Here is the call graph for this function:

◆ FillTreeVector()

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

Append this detector's values to the provided output vector.

Implements VQwBPM.

Definition at line 901 of file QwBPMCavity.cc.

902{
903 if (GetElementName()=="") {
904 // This channel is not used, so skip filling the tree.
905 }
906 else {
907 fElement[kQElem].FillTreeVector(values);
908 size_t i = 0;
909 for(i=kXAxis;i<kNumAxes;i++){
910 if (bFullSave) fElement[i].FillTreeVector(values);
911 // fRelPos[i].FillTreeVector(values);
912 fAbsPos[i].FillTreeVector(values);
913 }
914 }
915 return;
916}

References VQwBPM::bFullSave, fAbsPos, fElement, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, kQElem, and VQwBPM::kXAxis.

+ Here is the call graph for this function:

◆ GetAbsolutePosition()

void QwBPMCavity::GetAbsolutePosition ( )
overridevirtual

Recompute absolute positions from raw elements and stored offsets. Intended for use after externally setting raw subelements.

Reimplemented from VQwBPM.

Definition at line 573 of file QwBPMCavity.cc.

574{
575 for(size_t i=0;i<kNumAxes;i++){
576 fRelPos[i].Ratio(fElement[i],fElement[kQElem]);
577 fAbsPos[i]= fRelPos[i];
578 fAbsPos[i].AddChannelOffset(fPositionCenter[i]);
579 }
580 // For Z, the absolute position will be the offset we are reading from the
581 // geometry map file. Since we are not putting that to the tree it is not
582 // treated as a vqwk channel.
583}
Double_t fPositionCenter[3]
Definition VQwBPM.h:328

References fAbsPos, fElement, VQwBPM::fPositionCenter, fRelPos, VQwBPM::kNumAxes, and kQElem.

◆ GetDBEntry()

std::vector< QwDBInterface > QwBPMCavity::GetDBEntry ( )

◆ GetEffectiveCharge()

const VQwHardwareChannel * QwBPMCavity::GetEffectiveCharge ( ) const
inlineoverridevirtual

Implements VQwBPM.

Definition at line 90 of file QwBPMCavity.h.

90{return &fElement[kQElem];}

References fElement, and kQElem.

◆ GetErrDBEntry()

std::vector< QwErrDBInterface > QwBPMCavity::GetErrDBEntry ( )

◆ GetEventcutErrorFlag()

UInt_t QwBPMCavity::GetEventcutErrorFlag ( )
overridevirtual

Return the OR of per-channel event-cut error flags for this detector. This includes raw elements, relative and absolute positions.

Reimplemented from VQwDataElement.

Definition at line 205 of file QwBPMCavity.cc.

206{
207 size_t i=0;
208 UInt_t error=0;
209 for(i=0;i<kNumElements;i++) {
210 error|=fElement[i].GetEventcutErrorFlag();
211 }
212 for(i=0;i<kNumAxes;i++){
213 error|=fRelPos[i].GetEventcutErrorFlag();
214 error|=fAbsPos[i].GetEventcutErrorFlag();
215 }
216 return error;
217}

References fAbsPos, fElement, fRelPos, VQwBPM::kNumAxes, and kNumElements.

◆ GetPosition()

const VQwHardwareChannel * QwBPMCavity::GetPosition ( EBeamPositionMonitorAxis axis) const
inlineoverridevirtual

Reimplemented from VQwBPM.

Definition at line 82 of file QwBPMCavity.h.

82 {
83 if (axis<0 || axis>2){
84 TString loc="QwBPMCavity::GetPosition for "
85 +this->GetElementName()+" failed for axis value "+Form("%d",axis);
86 throw std::out_of_range(loc.Data());
87 }
88 return &fAbsPos[axis];
89 }
static const TString axis[3]
Definition VQwBPM.h:333

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

+ Here is the call graph for this function:

◆ GetSubelementByName()

VQwHardwareChannel * QwBPMCavity::GetSubelementByName ( TString ch_name)
overrideprotectedvirtual

Map a human-readable subelement name to the corresponding channel. Valid names include: relx, rely, absx/x, absy/y, effectivecharge/charge/q, as well as xi/yi to access raw elements.

Exceptions
std::invalid_argumenton an unrecognized subelement request.

Implements VQwBPM.

Definition at line 294 of file QwBPMCavity.cc.

295{
296 VQwHardwareChannel* tmpptr = NULL;
297 ch_name.ToLower();
298 if (ch_name=="relx"){
299 tmpptr = &fRelPos[0];
300 }else if (ch_name=="rely"){
301 tmpptr = &fRelPos[1];
302 }else if (ch_name=="absx" || ch_name=="x" ){
303 tmpptr = &fAbsPos[0];
304 }else if (ch_name=="absy" || ch_name=="y"){
305 tmpptr = &fAbsPos[1];
306 }else if (ch_name=="effectivecharge" || ch_name=="charge" || ch_name=="q"){
307 tmpptr = &fElement[kQElem];
308 } else {
309 TString loc="QwLinearDiodeArray::GetSubelementByName for"
310 + this->GetElementName() + " was passed "
311 + ch_name + ", which is an unrecognized subelement name.";
312 throw std::invalid_argument(loc.Data());
313 }
314 return tmpptr;
315}

References fAbsPos, fElement, fRelPos, VQwDataElement::GetElementName(), and kQElem.

+ Here is the call graph for this function:

◆ GetSubElementIndex()

UInt_t QwBPMCavity::GetSubElementIndex ( TString subname)
static

Convert a subelement tag (XI, YI, Q) into an enum index.

Definition at line 555 of file QwBPMCavity.cc.

556{
557 subname.ToUpper();
558 UInt_t localindex=kInvalidSubelementIndex;
559 for(size_t i=0;i<kNumElements;i++)
560 if(subname==subelement[i])localindex=i;
561
562 if(localindex==kInvalidSubelementIndex)
563 std::cerr << "QwBPMCavity::GetSubElementIndex is unable to associate the string -"
564 <<subname<<"- to any index"<<std::endl;
565
566 return localindex;
567}
static const UInt_t kInvalidSubelementIndex
Definition QwTypes.h:198
static const TString subelement[kNumElements]
Definition QwBPMCavity.h:34

References kInvalidSubelementIndex, kNumElements, and subelement.

◆ GetSubElementName()

TString QwBPMCavity::GetSubElementName ( Int_t subindex)
overridevirtual

Return the element name for a given raw subelement index.

Parameters
subindexIndex into the raw elements array.
Returns
Element name; logs an error and returns empty on invalid index.

Reimplemented from VQwBPM.

Definition at line 543 of file QwBPMCavity.cc.

544{
545 TString thisname;
546 if(subindex<kNumElements&&subindex>-1)
547 thisname=fElement[subindex].GetElementName();
548 else
549 std::cerr<<"QwBPMCavity::GetSubElementName for "<<
550 GetElementName()<<" this subindex doesn't exists \n";
551 return thisname;
552}

References fElement, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ IncrementErrorCounters()

void QwBPMCavity::IncrementErrorCounters ( )
overridevirtual

Increment persistent error counters across subelements and derived channels.

Implements VQwBPM.

Definition at line 175 of file QwBPMCavity.cc.

176{
177 size_t i=0;
178
179 for(i=0;i<kNumElements;i++){
180 fElement[i].IncrementErrorCounters();
181 }
182 for(i=0;i<kNumAxes;i++){
183 fRelPos[i].IncrementErrorCounters();
184 fAbsPos[i].IncrementErrorCounters();
185 }
186}

References fAbsPos, fElement, fRelPos, VQwBPM::kNumAxes, and kNumElements.

◆ InitializeChannel() [1/2]

void QwBPMCavity::InitializeChannel ( TString name)

Initialize channels and derived quantities using a simple name. Creates three raw hardware channels (XI, YI, Q) and two derived channels for relative and absolute positions along each transverse axis.

Parameters
nameDetector base name.

Definition at line 84 of file QwBPMCavity.cc.

85{
86 size_t i=0;
87 Bool_t localdebug = kFALSE;
88
90
91 for(i=0;i<kNumElements;i++) {
92 fElement[i].InitializeChannel(name+subelement[i],"raw");
93 if(localdebug)
94 std::cout<<" Wire ["<<i<<"]="<<fElement[i].GetElementName()<<"\n";
95 }
96
97 for(i=kXAxis;i<kNumAxes;i++){
98 fRelPos[i].InitializeChannel(name+"Rel"+subelement[i],"derived");
99 fAbsPos[i].InitializeChannel(name+kAxisLabel[i],"derived");
100 }
101
102 bFullSave=kTRUE;
103
104 return;
105}
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 VQwBPM::bFullSave, fAbsPos, fElement, fRelPos, VQwBPM::InitializeChannel(), VQwBPM::kAxisLabel, VQwBPM::kNumAxes, kNumElements, VQwBPM::kXAxis, and subelement.

Referenced by QwBPMCavity(), and QwBPMCavity().

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

◆ InitializeChannel() [2/2]

void QwBPMCavity::InitializeChannel ( TString subsystem,
TString name )

Initialize channels with explicit subsystem and detector name. This variant forwards subsystem information down to subelements so that output branches and histograms carry proper scoping.

Parameters
subsystemSubsystem name.
nameDetector base name.

Definition at line 115 of file QwBPMCavity.cc.

116{
117 size_t i=0;
118 Bool_t localdebug = kFALSE;
119
121
122 for(i=0;i<kNumElements;i++) {
123 fElement[i].InitializeChannel(subsystem, "QwBPMCavity", name+subelement[i],"raw");
124 if(localdebug)
125 std::cout<<" Wire ["<<i<<"]="<<fElement[i].GetElementName()<<"\n";
126 }
127
128 for(i=kXAxis;i<kNumAxes;i++){
129 fRelPos[i].InitializeChannel(subsystem, "QwBPMCavity", name+"Rel"+subelement[i],"derived");
130 fAbsPos[i].InitializeChannel(subsystem, "QwBPMCavity", name+kAxisLabel[i],"derived");
131 }
132
133 bFullSave=kTRUE;
134
135 return;
136}

References VQwBPM::bFullSave, fAbsPos, fElement, fRelPos, VQwBPM::InitializeChannel(), VQwBPM::kAxisLabel, VQwBPM::kNumAxes, kNumElements, VQwBPM::kXAxis, and subelement.

+ Here is the call graph for this function:

◆ LoadChannelParameters()

void QwBPMCavity::LoadChannelParameters ( QwParameterFile & paramfile)
inlineoverridevirtual

Implements VQwBPM.

Definition at line 71 of file QwBPMCavity.h.

71 {
72 for(Short_t i=0;i<kNumElements;i++)
73 fElement[i].LoadChannelParameters(paramfile);
74 }
void LoadChannelParameters(QwParameterFile &paramfile) override
Definition QwBPMCavity.h:71

References fElement, kNumElements, and LoadChannelParameters().

Referenced by LoadChannelParameters().

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

◆ MakeBPMCavityList()

void QwBPMCavity::MakeBPMCavityList ( )
private

Build a flat list of representative channels for legacy consumers.

Definition at line 981 of file QwBPMCavity.cc.

982{
983 for (size_t i = kXAxis; i < kNumAxes; i++) {
984 QwVQWK_Channel relpos(fRelPos[i]);
985 relpos = fRelPos[i];
986 fBPMElementList.push_back(relpos);
987 }
988 QwVQWK_Channel effectivecharge(fElement[kQElem]);
989 effectivecharge = fElement[kQElem];
990 fBPMElementList.push_back(effectivecharge);
991}
std::vector< QwVQWK_Channel > fBPMElementList

References fBPMElementList, fElement, fRelPos, VQwBPM::kNumAxes, kQElem, and VQwBPM::kXAxis.

◆ operator+=() [1/2]

QwBPMCavity & QwBPMCavity::operator+= ( const QwBPMCavity & value)
virtual

Element-wise addition of raw and derived channels.

Definition at line 614 of file QwBPMCavity.cc.

615{
616
617 if (GetElementName()!=""){
618 size_t i = 0;
619 for(i=0;i<kNumElements;i++) {
620 this->fElement[i]+=value.fElement[i];
621 }
622 for(i=0;i<kNumAxes;i++){
623 this->fRelPos[i]+=value.fRelPos[i];
624 this->fAbsPos[i]+=value.fAbsPos[i];
625 }
626 }
627 return *this;
628}

References fAbsPos, fElement, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, kNumElements, and QwBPMCavity().

+ Here is the call graph for this function:

◆ operator+=() [2/2]

VQwBPM & QwBPMCavity::operator+= ( const VQwBPM & value)
overridevirtual

Type-erased addition; forwards to the concrete operator+=.

Implements VQwBPM.

Definition at line 631 of file QwBPMCavity.cc.

632{
633 *(dynamic_cast<QwBPMCavity*>(this)) +=
634 *(dynamic_cast<const QwBPMCavity*>(&value));
635 return *this;
636}

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

+ Here is the call graph for this function:

◆ operator-=() [1/2]

QwBPMCavity & QwBPMCavity::operator-= ( const QwBPMCavity & value)
virtual

Element-wise subtraction of raw and derived channels.

Definition at line 641 of file QwBPMCavity.cc.

642{
643
644 if (GetElementName()!=""){
645 size_t i = 0;
646 for(i=0;i<kNumElements;i++) {
647 this->fElement[i]-=value.fElement[i];
648 }
649 for(i=0;i<kNumAxes;i++){
650 this->fRelPos[i]-=value.fRelPos[i];
651 this->fAbsPos[i]-=value.fAbsPos[i];
652 }
653 }
654 return *this;
655}

References fAbsPos, fElement, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, kNumElements, and QwBPMCavity().

+ Here is the call graph for this function:

◆ operator-=() [2/2]

VQwBPM & QwBPMCavity::operator-= ( const VQwBPM & value)
overridevirtual

Type-erased subtraction; forwards to the concrete operator-=.

Implements VQwBPM.

Definition at line 658 of file QwBPMCavity.cc.

659{
660 *(dynamic_cast<QwBPMCavity*>(this)) -=
661 *(dynamic_cast<const QwBPMCavity*>(&value));
662 return *this;
663}

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

+ Here is the call graph for this function:

◆ operator=() [1/2]

QwBPMCavity & QwBPMCavity::operator= ( const QwBPMCavity & value)
virtual

Concrete assignment; copies raw elements and derived channels.

Definition at line 595 of file QwBPMCavity.cc.

596{
597 VQwBPM::operator= (value);
598
599 if (GetElementName()!=""){
600 size_t i = 0;
601 for(i=0;i<kNumElements;i++) {
602 this->fElement[i]=value.fElement[i];
603 }
604 for(i=0;i<kNumAxes;i++){
605 this->fRelPos[i]=value.fRelPos[i];
606 this->fAbsPos[i]=value.fAbsPos[i];
607 }
608 }
609 return *this;
610}
virtual VQwBPM & operator=(const VQwBPM &value)=0
Definition VQwBPM.cc:156

References fAbsPos, fElement, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, kNumElements, VQwBPM::operator=(), and QwBPMCavity().

+ Here is the call graph for this function:

◆ operator=() [2/2]

VQwBPM & QwBPMCavity::operator= ( const VQwBPM & value)
overridevirtual

Type-erased assignment; forwards to the concrete operator=.

Implements VQwBPM.

Definition at line 587 of file QwBPMCavity.cc.

588{
589 *(dynamic_cast<QwBPMCavity*>(this)) =
590 *(dynamic_cast<const QwBPMCavity*>(&value));
591 return *this;
592}

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

+ Here is the call graph for this function:

◆ ParseChannelName()

Bool_t QwBPMCavity::ParseChannelName ( const TString & channel,
TString & detname,
TString & subname,
UInt_t & localindex )
static

Decode a fully qualified channel name into detector and subelement parts.

Parameters
channelFull channel name (e.g. "bpm3iXI").
detnameOut-parameter set to the detector base name.
subnameOut-parameter set to the recognized subelement tag.
localindexOut-parameter set to the subelement enum index or kInvalidSubelementIndex on failure.
Returns
true if a valid subelement suffix is recognized; false otherwise.

Definition at line 47 of file QwBPMCavity.cc.

51{
52 localindex=kInvalidSubelementIndex;
53 //QwMessage << "Channel Name: " << channel << QwLog::endl;
54 for(size_t i=0;i<kNumElements;i++){
55 if(channel.EndsWith(subelement[i],TString::kIgnoreCase)){
56 localindex=i;
57 subname = subelement[i];
58 size_t detnamesize = channel.Sizeof() - subname.Sizeof();
59 detname = channel(0,detnamesize);
60 break;
61 }
62 }
63
64 //QwMessage << "Detector Name: " << detname << QwLog::endl;
65 //QwMessage << "Sub Name: " << subname << QwLog::endl;
66
67 if(localindex==kInvalidSubelementIndex){
68 detname = "";
69 subname = "";
70 QwWarning << "QwBPMCavity::GetSubElementIndex is unable to associate the string -"
71 <<subname<<"- to any index" << QwLog::endl;
72 }
73 return (localindex!=kInvalidSubelementIndex);
74}
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44

References QwLog::endl(), kInvalidSubelementIndex, kNumElements, QwWarning, and subelement.

Referenced by QwBeamDetectorID::QwBeamDetectorID().

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

◆ PrintErrorCounters()

void QwBPMCavity::PrintErrorCounters ( ) const
overridevirtual

Print persistent error counter summaries for diagnostics.

Reimplemented from VQwDataElement.

Definition at line 189 of file QwBPMCavity.cc.

190{
191 size_t i=0;
192 for(i=0;i<kNumElements;i++) {
193 fElement[i].PrintErrorCounters();
194 }
195 for(i=0;i<kNumAxes;i++){
196 // fRelPos[i].PrintErrorCounters();
197 fAbsPos[i].PrintErrorCounters();
198 }
199}

References fAbsPos, fElement, VQwBPM::kNumAxes, and kNumElements.

◆ PrintInfo()

void QwBPMCavity::PrintInfo ( ) const
overridevirtual

Print a description of the raw and absolute position channels.

Reimplemented from VQwDataElement.

Definition at line 524 of file QwBPMCavity.cc.

525{
526 size_t i = 0;
527 for (i = 0; i < kNumElements; i++) {
528 fElement[i].PrintInfo();
529 }
530 for(i=0;i<kNumAxes;i++){
531 // fRelPos[i].PrintInfo();
532 fAbsPos[i].PrintInfo();
533 }
534}

References fAbsPos, fElement, VQwBPM::kNumAxes, and kNumElements.

◆ PrintValue()

void QwBPMCavity::PrintValue ( ) const
overridevirtual

Print the current values of raw and absolute position channels.

Reimplemented from VQwDataElement.

Definition at line 512 of file QwBPMCavity.cc.

513{
514 for (size_t i = 0; i < kNumElements; i++) {
515 fElement[i].PrintValue();
516 }
517 for (size_t i=0;i<kNumAxes;i++){
518 // fRelPos[i].PrintValue();
519 fAbsPos[i].PrintValue();
520 }
521}

References fAbsPos, fElement, VQwBPM::kNumAxes, and kNumElements.

◆ ProcessEvBuffer()

Int_t QwBPMCavity::ProcessEvBuffer ( UInt_t * buffer,
UInt_t word_position_in_buffer,
UInt_t index )
overridevirtual

Decode and route a raw data buffer into the requested subelement.

Parameters
bufferCODA/raw buffer pointer.
word_position_in_bufferStarting word index to parse.
indexTarget subelement index (0..kNumElements-1).
Returns
The original word_position_in_buffer (legacy behavior).

Implements VQwDataElement.

Definition at line 497 of file QwBPMCavity.cc.

498{
499 if(index<kNumElements) {
500 fElement[index].ProcessEvBuffer(buffer,word_position_in_buffer);
501 }
502 else {
503 std::cerr <<
504 "QwBPMCavity::ProcessEvBuffer(): attempt to fill in raw date for a wire that doesn't exist \n";
505 }
506 return word_position_in_buffer;
507}

References fElement, and kNumElements.

◆ ProcessEvent()

void QwBPMCavity::ProcessEvent ( )
overridevirtual

Process the current event by first applying hardware checks and then computing relative and absolute positions from raw subelements.

First apply HW checks and update HW error flags. Calling this routine here and not in ApplySingleEventCuts
makes a difference for a BPMs because they have derived devices.

Implements VQwBPM.

Definition at line 465 of file QwBPMCavity.cc.

466{
467 size_t i = 0;
468
470 /**First apply HW checks and update HW error flags.
471 Calling this routine here and not in ApplySingleEventCuts
472 makes a difference for a BPMs because they have derived devices.
473 */
474 for(i=0;i<kNumElements;i++) {
475 fElement[i].ProcessEvent();
476 }
477
478 for(i=kXAxis;i<kNumAxes;i++){
479 fRelPos[i].Ratio(fElement[i],fElement[kQElem]);
481 fAbsPos[i]= fRelPos[i];
482 fAbsPos[i].AddChannelOffset(fPositionCenter[i]);
483 }
484
485 return;
486}
Bool_t ApplyHWChecks()
static const Double_t kQwCavityCalibration

References ApplyHWChecks(), fAbsPos, fElement, VQwBPM::fPositionCenter, fRelPos, VQwBPM::kNumAxes, kNumElements, kQElem, kQwCavityCalibration, and VQwBPM::kXAxis.

+ Here is the call graph for this function:

◆ RandomizeEventData()

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

Generate random event data in owned raw elements for mock runs.

Reimplemented from VQwBPM.

Definition at line 1063 of file QwBPMCavity.cc.

1064{
1065 for (size_t i=0; i<kNumElements; i++) fElement[i].RandomizeEventData(helicity, time);
1066
1067 return;
1068}
void RandomizeEventData(int helicity=0, double time=0.0) override

References fElement, kNumElements, and RandomizeEventData().

Referenced by RandomizeEventData().

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

◆ Ratio()

void QwBPMCavity::Ratio ( QwBPMCavity & numer,
QwBPMCavity & denom )

Special ratio behavior for cavity BPMs when forming asymmetries. Only the effective charge channel participates; transverse positions are kept as differences (consistent with stripline BPM behavior).

Definition at line 672 of file QwBPMCavity.cc.

673{
674 // this function is called when forming asymmetries. In this case what we actually want for the
675 // stripline is the difference only not the asymmetries
676
677 *this=numer;
678 this->fElement[kQElem].Ratio(numer.fElement[kQElem],denom.fElement[kQElem]);
679 return;
680}

References fElement, kQElem, and QwBPMCavity().

+ Here is the call graph for this function:

◆ Scale()

void QwBPMCavity::Scale ( Double_t factor)
overridevirtual

Scale all raw and derived channels by a common factor.

Reimplemented from VQwBPM.

Definition at line 685 of file QwBPMCavity.cc.

686{
687 for(size_t i=0;i<kNumElements;i++){
688 fElement[i].Scale(factor);
689 }
690 for(size_t i=0;i<kNumAxes;i++){
691 fRelPos[i].Scale(factor);
692 fAbsPos[i].Scale(factor);
693 }
694 return;
695}

References fAbsPos, fElement, fRelPos, VQwBPM::kNumAxes, and kNumElements.

◆ SetDefaultSampleSize()

void QwBPMCavity::SetDefaultSampleSize ( Int_t sample_size)
overridevirtual

Set the default sample size for all raw subelements.

Reimplemented from VQwBPM.

Definition at line 1092 of file QwBPMCavity.cc.

1093{
1094 for(size_t i=0;i<kNumElements;i++)
1095 fElement[i].SetDefaultSampleSize((size_t)sample_size);
1096}
void SetDefaultSampleSize(Int_t sample_size) override

References fElement, kNumElements, and SetDefaultSampleSize().

Referenced by SetDefaultSampleSize().

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

◆ SetEventCutMode()

void QwBPMCavity::SetEventCutMode ( Int_t bcuts)
overridevirtual

Propagate event-cut mode bitmask to all owned subchannels.

Implements VQwBPM.

Definition at line 966 of file QwBPMCavity.cc.

967{
968 size_t i = 0;
969 // bEVENTCUTMODE=bcuts;
970 for (i=0;i<kNumElements;i++) {
971 fElement[i].SetEventCutMode(bcuts);
972 }
973 for(i=0;i<kNumAxes;i++){
974 fRelPos[i].SetEventCutMode(bcuts);
975 fAbsPos[i].SetEventCutMode(bcuts);
976 }
977}

References fAbsPos, fElement, fRelPos, VQwBPM::kNumAxes, and kNumElements.

◆ SetEventData()

void QwBPMCavity::SetEventData ( Double_t * relpos,
UInt_t sequencenumber )

Set relative position hardware sums and sequence numbers directly.

Definition at line 1072 of file QwBPMCavity.cc.

1073{
1074 for (size_t i=0; i<kNumElements; i++)
1075 {
1076 fRelPos[i].SetHardwareSum(relpos[i], sequencenumber);
1077 }
1078
1079 return;
1080}

References fRelPos, and kNumElements.

◆ SetRandomEventParameters()

void QwBPMCavity::SetRandomEventParameters ( Double_t meanX,
Double_t sigmaX,
Double_t meanY,
Double_t sigmaY )
overridevirtual

Configure mock-data generation parameters for testing. Currently a placeholder for cavity-specific randomization strategies.

Reimplemented from VQwBPM.

Definition at line 1028 of file QwBPMCavity.cc.

1029{
1030 // Average values of the signals in the stripline ADCs
1031 //Double_t sumX = 1.1e8; // These are just guesses, but I made X and Y different
1032 //Double_t sumY = 0.9e8; // to make it more interesting for the analyzer...
1033
1034 // Rotate the requested position if necessary (this is not tested yet)
1035 /* if (bRotated) {
1036 Double_t rotated_meanX = (meanX + meanY) / kRotationCorrection;
1037 Double_t rotated_meanY = (meanX - meanY) / kRotationCorrection;
1038 meanX = rotated_meanX;
1039 meanY = rotated_meanY;
1040 }*/
1041
1042 // Determine the asymmetry from the position
1043 //Double_t meanXP = (1.0 + meanX / kQwCavityCalibration) * sumX / 2.0;
1044 //Double_t meanXM = (1.0 - meanX / kQwCavityCalibration) * sumX / 2.0; // = sumX - meanXP;
1045 //Double_t meanYP = (1.0 + meanY / kQwCavityCalibration) * sumY / 2.0;
1046 //Double_t meanYM = (1.0 - meanY / kQwCavityCalibration) * sumY / 2.0; // = sumY - meanYP;
1047
1048 // Determine the spread of the asymmetry (this is not tested yet)
1049 // (negative sigma should work in the QwVQWK_Channel, but still using fabs)
1050 //Double_t sigmaXP = fabs(sumX * sigmaX / meanX);
1051 //Double_t sigmaXM = sigmaXP;
1052 //Double_t sigmaYP = fabs(sumY * sigmaY / meanY);
1053 //Double_t sigmaYM = sigmaYP;
1054
1055 // Propagate these parameters to the ADCs
1056 //fElement[0].SetRandomEventParameters(meanXP, sigmaXM);
1057 //fElement[1].SetRandomEventParameters(meanXM, sigmaYM);
1058 //fElement[2].SetRandomEventParameters(meanYP, sigmaYP);
1059}

◆ SetSingleEventCuts()

void QwBPMCavity::SetSingleEventCuts ( TString ch_name,
UInt_t errorflag,
Double_t minX,
Double_t maxX,
Double_t stability,
Double_t burplevel )

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

Configure single-event cuts for one subelement by name.

Parameters
ch_nameSubchannel selector (e.g. relx, rely, absx, absy, effectivecharge, xi, yi).
errorflagError mask bit(s) to associate with failures.
minXLower limit for the channel value.
maxXUpper limit for the channel value.
stabilityAllowed fractional stability (implementation-specific).
burplevelThreshold for burp/burst detection (implementation-specific).

Definition at line 356 of file QwBPMCavity.cc.

356 {
357 errorflag|=kBPMErrorFlag;//update the device flag
358 if (ch_name=="relx"){
359 QwMessage<<"RelX LL " << minX <<" UL " << maxX <<QwLog::endl;
360 fRelPos[0].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
361
362 }else if (ch_name=="rely"){
363 QwMessage<<"RelY LL " << minX <<" UL " << maxX <<QwLog::endl;
364 fRelPos[1].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
365
366 } else if (ch_name=="absx"){
367 QwMessage<<"AbsX LL " << minX <<" UL " << maxX <<QwLog::endl;
368 fAbsPos[0].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
369
370 }else if (ch_name=="absy"){
371 QwMessage<<"AbsY LL " << minX <<" UL " << maxX <<QwLog::endl;
372 fAbsPos[1].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
373
374 }else if (ch_name=="effectivecharge"){
375 QwMessage<<"EffectveQ LL " << minX <<" UL " << maxX <<QwLog::endl;
376 fElement[kQElem].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
377
378 }else if (ch_name=="xi"){
379 QwMessage<<"XI " << minX <<" UL " << maxX <<QwLog::endl;
380 fElement[0].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
381
382 }else if (ch_name=="yi"){
383 QwMessage<<"YI " << minX <<" UL " << maxX <<QwLog::endl;
384 fElement[1].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
385
386 }
387
388}
static const UInt_t kBPMErrorFlag
Definition QwTypes.h:170

References QwLog::endl(), fAbsPos, fElement, fRelPos, kBPMErrorFlag, kQElem, and QwMessage.

+ Here is the call graph for this function:

◆ SetSubElementCalibrationFactor()

void QwBPMCavity::SetSubElementCalibrationFactor ( Int_t j,
Double_t value )
overridevirtual

Set the calibration factor for a specific raw subelement.

Reimplemented from VQwBPM.

Definition at line 1106 of file QwBPMCavity.cc.

1107{
1108 fElement[j].SetCalibrationFactor(value);
1109}

References fElement.

◆ SetSubElementPedestal()

void QwBPMCavity::SetSubElementPedestal ( Int_t j,
Double_t value )
overridevirtual

Set the pedestal for a specific raw subelement.

Reimplemented from VQwBPM.

Definition at line 1100 of file QwBPMCavity.cc.

1101{
1102 fElement[j].SetPedestal(value);
1103}

References fElement.

◆ UpdateErrorFlag() [1/2]

UInt_t QwBPMCavity::UpdateErrorFlag ( )
overridevirtual

Update derived channel error flags based on raw element error codes and return the aggregated event-cut error mask.

Implements VQwBPM.

Definition at line 223 of file QwBPMCavity.cc.

224{
225 size_t i=0;
226 UInt_t error1=0;
227 UInt_t error2=0;
228 for(i=0;i<kNumElements;i++) {
229 error1|=fElement[i].GetErrorCode();
230 error2|=fElement[i].GetEventcutErrorFlag();
231 }
232 for(i=kXAxis;i<kNumAxes;i++) {
233 fRelPos[i].UpdateErrorFlag(error1);
234 fAbsPos[i].UpdateErrorFlag(error1);
235 error2|=fRelPos[i].GetEventcutErrorFlag();
236 error2|=fAbsPos[i].GetEventcutErrorFlag();
237 }
238 return error2;
239}

References fAbsPos, fElement, fRelPos, VQwBPM::kNumAxes, kNumElements, and VQwBPM::kXAxis.

◆ UpdateErrorFlag() [2/2]

void QwBPMCavity::UpdateErrorFlag ( const VQwBPM * ev_error)
overridevirtual

Update error flags by copying flags from a reference BPM of the same concrete type. This is used to propagate error state across containers.

Parameters
ev_errorReference BPM (must be QwBPMCavity).
Exceptions
std::invalid_argumentif ev_error is not a QwBPMCavity.

Implements VQwBPM.

Definition at line 433 of file QwBPMCavity.cc.

433 {
434 size_t i=0;
435 try {
436 if(typeid(*ev_error)==typeid(*this)) {
437 // std::cout<<" Here in QwBPMStripline::UpdateErrorFlag \n";
438 if (this->GetElementName()!="") {
439 const QwBPMCavity* value_bpm = dynamic_cast<const QwBPMCavity* >(ev_error);
440 for(i=0;i<kNumElements;i++){
441 fElement[i].UpdateErrorFlag(value_bpm->fElement[i]);
442 }
443 for(i=kXAxis;i<kNumAxes;i++) {
444 fRelPos[i].UpdateErrorFlag(value_bpm->fRelPos[i]);
445 fAbsPos[i].UpdateErrorFlag(value_bpm->fAbsPos[i]);
446 }
447 }
448 } else {
449 TString loc="Standard exception from QwBPMCavity::UpdateErrorFlag :"+
450 ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
451 +"same type";
452 throw std::invalid_argument(loc.Data());
453 }
454 } catch (std::exception& e) {
455 std::cerr<< e.what()<<std::endl;
456 }
457};

References fAbsPos, fElement, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, kNumElements, VQwBPM::kXAxis, QwBPMCavity(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ QwCombinedBPM

template<typename TT>
friend class QwCombinedBPM
friend

Definition at line 39 of file QwBPMCavity.h.

References QwCombinedBPM.

Referenced by QwCombinedBPM.

◆ QwEnergyCalculator

friend class QwEnergyCalculator
friend

Definition at line 40 of file QwBPMCavity.h.

References QwEnergyCalculator.

Referenced by QwEnergyCalculator.

Field Documentation

◆ fAbsPos

◆ fBPMElementList

std::vector<QwVQWK_Channel> QwBPMCavity::fBPMElementList
private

Definition at line 173 of file QwBPMCavity.h.

Referenced by MakeBPMCavityList().

◆ fElement

◆ fRelPos

◆ kQwCavityCalibration

const Double_t QwBPMCavity::kQwCavityCalibration = 1.0
staticprivate

Definition at line 156 of file QwBPMCavity.h.

Referenced by ProcessEvent().

◆ subelement

const TString QwBPMCavity::subelement ={"XI","YI","Q"}
staticprivate

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