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

Quadrant photodiode BPM computing X/Y and effective charge. More...

#include <QwQPD.h>

+ Inheritance diagram for QwQPD:
+ Collaboration diagram for QwQPD:

Public Member Functions

 QwQPD ()
 
 QwQPD (TString name)
 
 QwQPD (TString subsystemname, TString name)
 
 QwQPD (const QwQPD &source)
 
 ~QwQPD () override
 
void InitializeChannel (TString name)
 
void InitializeChannel (TString subsystem, TString name)
 
void LoadChannelParameters (QwParameterFile &paramfile) override
 
void GetCalibrationFactors (Double_t AlphaX, Double_t AlphaY)
 
void ClearEventData () override
 
Int_t ProcessEvBuffer (UInt_t *buffer, UInt_t word_position_in_buffer, UInt_t indexnumber) override
 
void ProcessEvent () 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 (QwQPD &numer, QwQPD &denom)
 
void Scale (Double_t factor) override
 
VQwBPMoperator= (const VQwBPM &value) override
 
VQwBPMoperator+= (const VQwBPM &value) override
 
VQwBPMoperator-= (const VQwBPM &value) override
 
virtual QwQPDoperator= (const QwQPD &value)
 
virtual QwQPDoperator+= (const QwQPD &value)
 
virtual QwQPDoperator-= (const QwQPD &value)
 
void AccumulateRunningSum (const QwQPD &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
 
void AccumulateRunningSum (const VQwBPM &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF) override
 
void DeaccumulateRunningSum (VQwBPM &value, Int_t ErrorMask=0xFFFFFFF) override
 
void DeaccumulateRunningSum (QwQPD &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 MakeQPDList ()
 
- 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)
 
virtual void PrintValue () const
 Print single line of value and error of this data element.
 
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 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, 4 > fPhotodiode
 
std::array< QwVQWK_Channel, 2 > fRelPos
 
std::array< QwVQWK_Channel, 2 > fAbsPos
 
QwVQWK_Channel fEffectiveCharge
 
std::vector< QwVQWK_ChannelfQPDElementList
 
- 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 Attributes

Double_t fQwQPDCalibration [2]
 

Static Private Attributes

static const TString subelement [4] ={"BR","TR","BL","TL"}
 

Additional Inherited Members

- Public Types inherited from VQwBPM
enum  EBeamPositionMonitorAxis { kXAxis =0 , kYAxis , kNumAxes }
 
- Public Types inherited from VQwDataElement
enum  EDataToSave { kRaw = 0 , kDerived , kMoments }
 
- 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

Quadrant photodiode BPM computing X/Y and effective charge.

Definition at line 38 of file QwQPD.h.

Constructor & Destructor Documentation

◆ QwQPD() [1/4]

QwQPD::QwQPD ( )
inline

Definition at line 43 of file QwQPD.h.

43 {
44 };

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

+ Here is the caller graph for this function:

◆ QwQPD() [2/4]

QwQPD::QwQPD ( TString name)
inline

Definition at line 45 of file QwQPD.h.

45 :VQwBPM(name){
47 };
void InitializeChannel(TString name)
Definition QwQPD.cc:31
VQwBPM()
Definition VQwBPM.h:76

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

+ Here is the call graph for this function:

◆ QwQPD() [3/4]

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

Definition at line 48 of file QwQPD.h.

48 :VQwBPM(name){
49 SetSubsystemName(subsystemname);
50 InitializeChannel(subsystemname, name);
51 fQwQPDCalibration[0] = 1.0;
52 fQwQPDCalibration[1] = 1.0;
53 };
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.
Double_t fQwQPDCalibration[2]
Definition QwQPD.h:163

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

+ Here is the call graph for this function:

◆ QwQPD() [4/4]

QwQPD::QwQPD ( const QwQPD & source)
inline

Definition at line 54 of file QwQPD.h.

55 : VQwBPM(source),
57 {
61 }
void QwCopyArray(const T &a, T &b)
Definition QwUtil.h:15
std::array< QwVQWK_Channel, 4 > fPhotodiode
Definition QwQPD.h:167
std::array< QwVQWK_Channel, 2 > fAbsPos
Definition QwQPD.h:172
QwVQWK_Channel fEffectiveCharge
Definition QwQPD.h:173
std::array< QwVQWK_Channel, 2 > fRelPos
Definition QwQPD.h:168

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, QwCopyArray(), QwQPD(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

◆ ~QwQPD()

QwQPD::~QwQPD ( )
inlineoverride

Definition at line 62 of file QwQPD.h.

62{ };

Member Function Documentation

◆ AccumulateRunningSum() [1/2]

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

Definition at line 702 of file QwQPD.cc.

703{
704 Short_t i = 0;
705 for(i=0;i<4;i++) fPhotodiode[i].AccumulateRunningSum(value.fPhotodiode[i], count, ErrorMask);
706 for (i = 0; i < 2; i++){
707 fRelPos[i].AccumulateRunningSum(value.fRelPos[i], count, ErrorMask);
708 fAbsPos[i].AccumulateRunningSum(value.fAbsPos[i], count, ErrorMask);
709 }
710 fEffectiveCharge.AccumulateRunningSum(value.fEffectiveCharge, count, ErrorMask);
711 return;
712
713
714}
void AccumulateRunningSum(const QwQPD &value, Int_t count=0, Int_t ErrorMask=0xFFFFFFF)
Definition QwQPD.cc:702

References AccumulateRunningSum(), fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, and QwQPD().

Referenced by AccumulateRunningSum(), and AccumulateRunningSum().

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

◆ AccumulateRunningSum() [2/2]

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

Reimplemented from VQwBPM.

Definition at line 697 of file QwQPD.cc.

698{
699 AccumulateRunningSum(*dynamic_cast<const QwQPD* >(&value), count, ErrorMask);
700}
QwQPD()
Definition QwQPD.h:43

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

+ Here is the call graph for this function:

◆ ApplyHWChecks()

Bool_t QwQPD::ApplyHWChecks ( )

Apply hardware-level checks to all four photodiode channels and aggregate their status.

Returns
true if all photodiodes pass hardware checks.

Definition at line 129 of file QwQPD.cc.

130{
131 Bool_t eventokay=kTRUE;
132
133 UInt_t deviceerror=0;
134 for(Short_t i=0;i<4;i++)
135 {
136 deviceerror|= fPhotodiode[i].ApplyHWChecks(); //OR the error code from each wire
137 eventokay &= (deviceerror & 0x0);//AND with 0 since zero means HW is good.
138
139 if (bDEBUG) std::cout<<" Inconsistent within QPD terminals photodiode[ "<<i<<" ] "<<std::endl;
140 if (bDEBUG) std::cout<<" photodiode[ "<<i<<" ] sequence num "<<fPhotodiode[i].GetSequenceNumber()<<" sample size "<<fPhotodiode[i].GetNumberOfSamples()<<std::endl;
141 }
142
143 return eventokay;
144}
static const Bool_t bDEBUG
Definition VQwBPM.h:350

References VQwBPM::bDEBUG, and fPhotodiode.

Referenced by ProcessEvent().

+ Here is the caller graph for this function:

◆ ApplySingleEventCuts()

Bool_t QwQPD::ApplySingleEventCuts ( )
overridevirtual

Apply single-event cuts to photodiodes and derived channels, propagating error codes to position and charge outputs.

Returns
true if all channels pass their cuts.

Implements VQwBPM.

Definition at line 219 of file QwQPD.cc.

220{
221 Bool_t status=kTRUE;
222 Int_t i=0;
223 UInt_t error_code = 0;
224 //Event cuts for four pads
225 for(i=0;i<4;i++){
226 if (fPhotodiode[i].ApplySingleEventCuts()){ //for RelX
227 status&=kTRUE;
228 }
229 else{
230 status&=kFALSE;
231 if (bDEBUG) std::cout<<" single pad "<<fPhotodiode[i].GetElementName()<<" event cut failed ";
232 }
233 //Get the Event cut error flag for the pads
234 error_code|=fPhotodiode[i].GetErrorCode();
235 }
236
237 for(i=0;i<2;i++){
238 fRelPos[i].UpdateErrorFlag(error_code);//To update the rel/abs error code from the channels/wires event cut error codes
239 status &= fRelPos[i].ApplySingleEventCuts();
240
241 fAbsPos[i].UpdateErrorFlag(error_code);//To update the rel/abs error code from the channels/wires event cut error codes
242 status &= fAbsPos[i].ApplySingleEventCuts();
243 }
244 fEffectiveCharge.UpdateErrorFlag(error_code);// To update the eff-charge error code from the channels/wires event cut error codes
245 status &= fEffectiveCharge.ApplySingleEventCuts();
246
247 return status;
248}
Bool_t ApplySingleEventCuts() override
Definition QwQPD.cc:219

References ApplySingleEventCuts(), VQwBPM::bDEBUG, fAbsPos, fEffectiveCharge, fPhotodiode, and fRelPos.

Referenced by ApplySingleEventCuts().

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

◆ CalculateRunningAverage()

void QwQPD::CalculateRunningAverage ( )
overridevirtual

Implements VQwBPM.

Definition at line 685 of file QwQPD.cc.

686{
687 Short_t i = 0;
688 for(i=0;i<4;i++) fPhotodiode[i].CalculateRunningAverage();
689 for (i = 0; i < 2; i++){
690 fRelPos[i].CalculateRunningAverage();
691 fAbsPos[i].CalculateRunningAverage();
692 }
693 fEffectiveCharge.CalculateRunningAverage();
694 return;
695}
void CalculateRunningAverage() override
Definition QwQPD.cc:685

References CalculateRunningAverage(), fAbsPos, fEffectiveCharge, fPhotodiode, and fRelPos.

Referenced by CalculateRunningAverage().

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

◆ CheckForBurpFail()

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

Polymorphic burp check against a reference QPD, delegating to all photodiodes, position, and charge channels.

Returns
true if any subchannel reports a burp failure.
Exceptions
std::invalid_argumentif ev_error is not a QwQPD.

Reimplemented from VQwBPM.

Definition at line 383 of file QwQPD.cc.

383 {
384 Short_t i=0;
385 Bool_t burpstatus = kFALSE;
386 try {
387 if(typeid(*ev_error)==typeid(*this)) {
388 //std::cout<<" Here in QwQPD::CheckForBurpFail \n";
389 if (this->GetElementName()!="") {
390 const QwQPD* value_qpd = dynamic_cast<const QwQPD* >(ev_error);
391 for(i=0;i<4;i++){
392 burpstatus |= fPhotodiode[i].CheckForBurpFail(&(value_qpd->fPhotodiode[i]));
393 }
394 for(i=kXAxis;i<kNumAxes;i++) {
395 burpstatus |= fRelPos[i].CheckForBurpFail(&(value_qpd->fRelPos[i]));
396 burpstatus |= fAbsPos[i].CheckForBurpFail(&(value_qpd->fAbsPos[i]));
397 }
398 burpstatus |= fEffectiveCharge.CheckForBurpFail(&(value_qpd->fEffectiveCharge));
399 }
400 } else {
401 TString loc="Standard exception from QwQPD::CheckForBurpFail :"+
402 ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
403 +"same type";
404 throw std::invalid_argument(loc.Data());
405 }
406 } catch (std::exception& e) {
407 std::cerr<< e.what()<<std::endl;
408 }
409 return burpstatus;
410};
virtual const TString & GetElementName() const
Get the name of this element.
@ kXAxis
Definition VQwBPM.h:72
@ kNumAxes
Definition VQwBPM.h:72

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, QwQPD(), and VQwDataElement::VQwDataElement().

+ Here is the call graph for this function:

◆ ClearEventData()

void QwQPD::ClearEventData ( )
overridevirtual

Clear event data for all photodiodes and derived position/charge channels.

Reimplemented from VQwDataElement.

Definition at line 106 of file QwQPD.cc.

107{
108 Short_t i=0;
109
110 for(i=0;i<4;i++) fPhotodiode[i].ClearEventData();
111
112 for(i=kXAxis;i<kNumAxes;i++) {
113 fRelPos[i].ClearEventData();
114 fAbsPos[i].ClearEventData();
115 }
116
117 fEffectiveCharge.ClearEventData();
118
119 return;
120}
void ClearEventData() override
Definition QwQPD.cc:106

References ClearEventData(), fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

Referenced by ClearEventData().

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

◆ ConstructBranch() [1/2]

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

Implements VQwBPM.

Definition at line 807 of file QwQPD.cc.

808{
809 if (GetElementName()==""){
810 // This channel is not used, so skip constructing trees.
811 }
812 else {
813 TString thisprefix=prefix;
814 if(prefix.Contains("asym_"))
815 thisprefix.ReplaceAll("asym_","diff_");
816
817 SetRootSaveStatus(prefix);
818
819 fEffectiveCharge.ConstructBranch(tree,prefix);
820 Short_t i = 0;
821 if(bFullSave) {
822 for(i=0;i<4;i++) fPhotodiode[i].ConstructBranch(tree,thisprefix);
823 }
824 for(i=kXAxis;i<kNumAxes;i++) {
825 fAbsPos[i].ConstructBranch(tree,thisprefix);
826 fRelPos[i].ConstructBranch(tree,thisprefix);
827 }
828
829 }
830 return;
831}
void ConstructBranch(TTree *tree, TString &prefix) override
Definition QwQPD.cc:807
void SetRootSaveStatus(TString &prefix)
Definition VQwBPM.cc:220
Bool_t bFullSave
Definition VQwBPM.h:348

References VQwBPM::bFullSave, ConstructBranch(), fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and VQwBPM::SetRootSaveStatus().

Referenced by ConstructBranch(), and ConstructBranch().

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

◆ ConstructBranch() [2/2]

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

Implements VQwBPM.

Definition at line 833 of file QwQPD.cc.

834{
835 TString devicename;
836
837 devicename=GetElementName();
838 devicename.ToLower();
839 if (GetElementName()==""){
840 // This channel is not used, so skip filling the histograms.
841 } else
842 {
843 if (modulelist.HasValue(devicename)){
844 TString thisprefix=prefix;
845 if(prefix.Contains("asym_"))
846 thisprefix.ReplaceAll("asym_","diff_");
847
848 SetRootSaveStatus(prefix);
849
850 fEffectiveCharge.ConstructBranch(tree,prefix);
851 Short_t i = 0;
852 if(bFullSave) {
853 for(i=0;i<4;i++) fPhotodiode[i].ConstructBranch(tree,thisprefix);
854 }
855 for(i=kXAxis;i<kNumAxes;i++) {
856 fAbsPos[i].ConstructBranch(tree,thisprefix);
857 fRelPos[i].ConstructBranch(tree,thisprefix);
858 }
859
860 QwMessage <<" Tree leaves added to "<<devicename<<" Corresponding channels"<<QwLog::endl;
861 }
862 // this functions doesn't do anything yet
863 }
864
865
866
867
868
869 return;
870}
#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, ConstructBranch(), QwLog::endl(), fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwDataElement::GetElementName(), QwParameterFile::HasValue(), VQwBPM::kNumAxes, VQwBPM::kXAxis, QwMessage, and VQwBPM::SetRootSaveStatus().

+ Here is the call graph for this function:

◆ ConstructBranchAndVector()

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

Implements VQwBPM.

Definition at line 781 of file QwQPD.cc.

782{
783 if (GetElementName()==""){
784 // This channel is not used, so skip constructing trees.
785 }
786 else {
787 TString thisprefix=prefix;
788 if(prefix.Contains("asym_"))
789 thisprefix.ReplaceAll("asym_","diff_");
790
791 SetRootSaveStatus(prefix);
792
793 fEffectiveCharge.ConstructBranchAndVector(tree,prefix,values);
794 Short_t i = 0;
795 if(bFullSave) {
796 for(i=0;i<4;i++) fPhotodiode[i].ConstructBranchAndVector(tree,thisprefix,values);
797 }
798 for(i=kXAxis;i<kNumAxes;i++) {
799 fAbsPos[i].ConstructBranchAndVector(tree,thisprefix,values);
800 fRelPos[i].ConstructBranchAndVector(tree,thisprefix,values);
801 }
802
803 }
804 return;
805}
void ConstructBranchAndVector(TTree *tree, TString &prefix, QwRootTreeBranchVector &values) override
Definition QwQPD.cc:781

References VQwBPM::bFullSave, ConstructBranchAndVector(), fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and VQwBPM::SetRootSaveStatus().

Referenced by ConstructBranchAndVector().

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

◆ ConstructHistograms()

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

Construct the histograms for this data element.

Implements VQwBPM.

Definition at line 738 of file QwQPD.cc.

739{
740
741 if (GetElementName()=="") {
742 // This channel is not used, so skip filling the histograms.
743 } else {
744 fEffectiveCharge.ConstructHistograms(folder, prefix);
745 TString thisprefix=prefix;
746
747 if(prefix.Contains("asym_"))
748 thisprefix.ReplaceAll("asym_","diff_");
749 SetRootSaveStatus(prefix);
750 Short_t i = 0;
751 if(bFullSave) {
752 for(i=0;i<4;i++) fPhotodiode[i].ConstructHistograms(folder, thisprefix);
753 }
754 for(i=kXAxis;i<kNumAxes;i++) {
755 fAbsPos[i].ConstructHistograms(folder, thisprefix);
756 fRelPos[i].ConstructHistograms(folder, thisprefix);
757 }
758 }
759 return;
760}
void ConstructHistograms(TDirectory *folder, TString &prefix) override
Construct the histograms for this data element.
Definition QwQPD.cc:738

References VQwBPM::bFullSave, ConstructHistograms(), fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and VQwBPM::SetRootSaveStatus().

Referenced by ConstructHistograms().

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

◆ DeaccumulateRunningSum() [1/2]

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

Definition at line 721 of file QwQPD.cc.

722{
723
724 Short_t i = 0;
725 for(i=0;i<4;i++) fPhotodiode[i].DeaccumulateRunningSum(value.fPhotodiode[i]);
726 for (i = 0; i < 2; i++){
727 fRelPos[i].DeaccumulateRunningSum(value.fRelPos[i], ErrorMask);
728 fAbsPos[i].DeaccumulateRunningSum(value.fAbsPos[i], ErrorMask);
729 }
730 fEffectiveCharge.DeaccumulateRunningSum(value.fEffectiveCharge, ErrorMask);
731 return;
732
733
734}
void DeaccumulateRunningSum(VQwBPM &value, Int_t ErrorMask=0xFFFFFFF) override
Definition QwQPD.cc:716

References DeaccumulateRunningSum(), fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, and QwQPD().

+ Here is the call graph for this function:

◆ DeaccumulateRunningSum() [2/2]

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

Implements VQwBPM.

Definition at line 716 of file QwQPD.cc.

717{
718 DeaccumulateRunningSum(*dynamic_cast<QwQPD* >(&value), ErrorMask);
719}

References DeaccumulateRunningSum(), QwQPD(), 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 QwQPD::EncodeEventData ( std::vector< UInt_t > & buffer)
overridevirtual

Reimplemented from VQwBPM.

Definition at line 1043 of file QwQPD.cc.

1044{
1045 for (Short_t i=0; i<4; i++) fPhotodiode[i].EncodeEventData(buffer);
1046}
void EncodeEventData(std::vector< UInt_t > &buffer) override
Definition QwQPD.cc:1043

References EncodeEventData(), and fPhotodiode.

Referenced by EncodeEventData().

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

◆ FillHistograms()

void QwQPD::FillHistograms ( )
overridevirtual

Fill the histograms for this data element.

Implements VQwBPM.

Definition at line 762 of file QwQPD.cc.

763{
764 if (GetElementName()=="") {
765 // This channel is not used, so skip filling the histograms.
766 }
767 else {
768 fEffectiveCharge.FillHistograms();
769 Short_t i = 0;
770 if(bFullSave) {
771 for(i=0;i<4;i++) fPhotodiode[i].FillHistograms();
772 }
773 for(i=kXAxis;i<kNumAxes;i++){
774 fAbsPos[i].FillHistograms();
775 fRelPos[i].FillHistograms();
776 }
777 }
778 return;
779}
void FillHistograms() override
Fill the histograms for this data element.
Definition QwQPD.cc:762

References VQwBPM::bFullSave, fAbsPos, fEffectiveCharge, FillHistograms(), fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, and VQwBPM::kXAxis.

Referenced by FillHistograms().

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

◆ FillTreeVector()

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

Implements VQwBPM.

Definition at line 872 of file QwQPD.cc.

873{
874 if (GetElementName()=="") {
875 // This channel is not used, so skip filling the tree.
876 }
877 else {
878 fEffectiveCharge.FillTreeVector(values);
879 Short_t i = 0;
880 if(bFullSave) {
881 for(i=0;i<4;i++) fPhotodiode[i].FillTreeVector(values);
882 }
883
884 for(i=kXAxis;i<kNumAxes;i++){
885 fAbsPos[i].FillTreeVector(values);
886 fRelPos[i].FillTreeVector(values);
887 }
888 }
889 return;
890}
void FillTreeVector(QwRootTreeBranchVector &values) const override
Definition QwQPD.cc:872

References VQwBPM::bFullSave, fAbsPos, fEffectiveCharge, FillTreeVector(), fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, and VQwBPM::kXAxis.

Referenced by FillTreeVector().

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

◆ GetAbsolutePosition()

void QwQPD::GetAbsolutePosition ( )
inlineoverridevirtual

Reimplemented from VQwBPM.

Definition at line 91 of file QwQPD.h.

91{};

◆ GetCalibrationFactors()

void QwQPD::GetCalibrationFactors ( Double_t AlphaX,
Double_t AlphaY )

Apply QPD-specific calibration factors converting ADC counts to mm. These come from geometry/calibration files for each axis.

Definition at line 84 of file QwQPD.cc.

85{
86 // Read in the calibration factors from the injector_beamline_geometry.map
87 // for the QPD, AlphaX and AlphaY gives the conversion from adc counts to mm.
88
89 Bool_t ldebug = kFALSE;
90
91 fQwQPDCalibration[0]=1.0/AlphaX;
92 fQwQPDCalibration[1]=1.0/AlphaY;
93
94 if(ldebug){
95 std::cout<<"\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
96 std::cout<<this->GetElementName();
97 std::cout<<"\nfQwQPDCalibration[0] = "<<fQwQPDCalibration[0]<<std::endl;
98 std::cout<<"\nfQwQPDCalibration[1] = "<<fQwQPDCalibration[1]<<std::endl;
99 std::cout<<"AlphaX = "<<fRelativeGains[0]<<std::endl;
100 std::cout<<"AlphaY = "<<fRelativeGains[1]<<std::endl;
101 }
102 return;
103}
Double_t fRelativeGains[2]
Definition VQwBPM.h:331

References fQwQPDCalibration, VQwBPM::fRelativeGains, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ GetEffectiveCharge()

const VQwHardwareChannel * QwQPD::GetEffectiveCharge ( ) const
inlineoverridevirtual

Implements VQwBPM.

Definition at line 88 of file QwQPD.h.

88{return &fEffectiveCharge;}

References fEffectiveCharge.

◆ GetEventcutErrorFlag()

UInt_t QwQPD::GetEventcutErrorFlag ( )
overridevirtual

Return OR of event-cut error flags across all photodiodes and derived channels.

Reimplemented from VQwDataElement.

Definition at line 173 of file QwQPD.cc.

174{
175 Short_t i=0;
176 UInt_t error=0;
177 for(i=0;i<4;i++)
179
180 for(i=kXAxis;i<kNumAxes;i++) {
181 error|=fRelPos[i].GetEventcutErrorFlag();
182 error|=fAbsPos[i].GetEventcutErrorFlag();
183 }
184
185 error|=fEffectiveCharge.GetEventcutErrorFlag();
186 return error;
187}
UInt_t GetEventcutErrorFlag() override
Definition QwQPD.cc:173

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, GetEventcutErrorFlag(), VQwBPM::kNumAxes, and VQwBPM::kXAxis.

Referenced by GetEventcutErrorFlag().

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

◆ GetPosition()

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

Reimplemented from VQwBPM.

Definition at line 80 of file QwQPD.h.

80 {
81 if (axis<0 || axis>2){
82 TString loc="QwQPD::GetPosition for "
83 +this->GetElementName()+" failed for axis value "+Form("%d",axis);
84 throw std::out_of_range(loc.Data());
85 }
86 return &fAbsPos[axis];
87 }
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 * QwQPD::GetSubelementByName ( TString ch_name)
overrideprotectedvirtual

Map a human-readable name to the corresponding channel pointer. Supports: tl/tr/br/bl (photodiodes), relx/rely, absx/x, absy/y, effectivecharge/charge.

Exceptions
std::invalid_argumenton unrecognized names.

Implements VQwBPM.

Definition at line 257 of file QwQPD.cc.

258{
259 VQwHardwareChannel* tmpptr = NULL;
260 ch_name.ToLower();
261 if (ch_name=="tl"){
262 tmpptr = &fPhotodiode[0];
263 }else if (ch_name=="tr"){
264 tmpptr = &fPhotodiode[1];
265 }else if (ch_name=="br"){
266 tmpptr = &fPhotodiode[2];
267 }else if (ch_name=="bl"){
268 tmpptr = &fPhotodiode[3];
269 }else if (ch_name=="relx"){
270 tmpptr = &fRelPos[0];
271 }else if (ch_name=="rely"){
272 tmpptr = &fRelPos[1];
273 }else if (ch_name=="absx" || ch_name=="x" ){
274 tmpptr = &fAbsPos[0];
275 }else if (ch_name=="absy" || ch_name=="y"){
276 tmpptr = &fAbsPos[1];
277 }else if (ch_name=="effectivecharge" || ch_name=="charge"){
278 tmpptr = &fEffectiveCharge;
279 } else {
280 TString loc="QwQPD::GetSubelementByName for"
281 + this->GetElementName() + " was passed "
282 + ch_name + ", which is an unrecognized subelement name.";
283 throw std::invalid_argument(loc.Data());
284 }
285 return tmpptr;
286}

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ GetSubElementIndex()

UInt_t QwQPD::GetSubElementIndex ( TString subname)
static

Definition at line 584 of file QwQPD.cc.

585{
586 subname.ToUpper();
587 UInt_t localindex=kInvalidSubelementIndex;
588 for(Short_t i=0;i<4;i++) if(subname==subelement[i])localindex=i;
589
590 if(localindex>3)
591 std::cerr << "QwQPD::GetSubElementIndex is unable to associate the string -"
592 <<subname<<"- to any index"<<std::endl;
593
594 return localindex;
595}
static const UInt_t kInvalidSubelementIndex
Definition QwTypes.h:198
static const TString subelement[4]
Definition QwQPD.h:27

References kInvalidSubelementIndex, and subelement.

Referenced by QwBeamDetectorID::QwBeamDetectorID().

+ Here is the caller graph for this function:

◆ GetSubElementName()

TString QwQPD::GetSubElementName ( Int_t subindex)
overridevirtual

Reimplemented from VQwBPM.

Definition at line 572 of file QwQPD.cc.

573{
574 TString thisname;
575 if(subindex<4&&subindex>-1)
576 thisname=fPhotodiode[subindex].GetElementName();
577 else
578 std::cerr<<"QwQPD::GetSubElementName for "<<
579 GetElementName()<<" this subindex doesn't exists \n";
580
581 return thisname;
582}

References fPhotodiode, and VQwDataElement::GetElementName().

+ Here is the call graph for this function:

◆ IncrementErrorCounters()

void QwQPD::IncrementErrorCounters ( )
overridevirtual

Increment persistent error counters for all channels.

Implements VQwBPM.

Definition at line 147 of file QwQPD.cc.

148{
149 Short_t i=0;
150 for(i=0;i<4;i++)
152 for(i=kXAxis;i<kNumAxes;i++) {
153 fRelPos[i].IncrementErrorCounters();
154 fAbsPos[i].IncrementErrorCounters();
155 }
156 fEffectiveCharge.IncrementErrorCounters();
157}
void IncrementErrorCounters() override
Definition QwQPD.cc:147

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, IncrementErrorCounters(), VQwBPM::kNumAxes, and VQwBPM::kXAxis.

Referenced by IncrementErrorCounters().

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

◆ InitializeChannel() [1/2]

void QwQPD::InitializeChannel ( TString name)

Initialize QPD with 4 photodiode raw channels and derived position/charge.

Definition at line 31 of file QwQPD.cc.

32{
33 Short_t i=0;
34 Bool_t localdebug = kFALSE;
35
37
38 fEffectiveCharge.InitializeChannel(name+"WS","derived");
39
40 for(i=0;i<4;i++) {
41 fPhotodiode[i].InitializeChannel(name+subelement[i],"raw");
42
43 if(localdebug)
44 std::cout<<" photodiode ["<<i<<"]="<<fPhotodiode[i].GetElementName()<<"\n";
45 }
46
47 for(i=kXAxis;i<kNumAxes;i++) {
48 fRelPos[i].InitializeChannel(name+"Rel"+kAxisLabel[i],"derived");
49 fAbsPos[i].InitializeChannel(name+kAxisLabel[i],"derived");
50 }
51
52 bFullSave=kTRUE;
53
54 return;
55}
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, fEffectiveCharge, fPhotodiode, fRelPos, VQwBPM::InitializeChannel(), VQwBPM::kAxisLabel, VQwBPM::kNumAxes, VQwBPM::kXAxis, and subelement.

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

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

◆ InitializeChannel() [2/2]

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

Initialize QPD with subsystem scoping for proper tree/histogram naming.

Definition at line 58 of file QwQPD.cc.

59{
60 Short_t i=0;
61 Bool_t localdebug = kFALSE;
62
64
65 fEffectiveCharge.InitializeChannel(subsystem, "QwQPD", name+"WS","derived");
66
67 for(i=0;i<4;i++) {
68 fPhotodiode[i].InitializeChannel(subsystem, "QwQPD", name+subelement[i],"raw");
69 if(localdebug)
70 std::cout<<" photodiode ["<<i<<"]="<<fPhotodiode[i].GetElementName()<<"\n";
71 }
72 for(i=kXAxis;i<kNumAxes;i++) fRelPos[i].InitializeChannel(subsystem, "QwQPD", name+"Rel"+kAxisLabel[i],"derived");
73 for(i=kXAxis;i<kNumAxes;i++) fAbsPos[i].InitializeChannel(subsystem, "QwQPD", name+kAxisLabel[i],"derived");
74
75 bFullSave=kTRUE;
76
77 return;
78}

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

+ Here is the call graph for this function:

◆ LoadChannelParameters()

void QwQPD::LoadChannelParameters ( QwParameterFile & paramfile)
inlineoverridevirtual

Implements VQwBPM.

Definition at line 68 of file QwQPD.h.

68 {
69 for(Short_t i=0;i<4;i++)
71 }
void LoadChannelParameters(QwParameterFile &paramfile) override
Definition QwQPD.h:68

References fPhotodiode, and LoadChannelParameters().

Referenced by LoadChannelParameters().

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

◆ MakeQPDList()

void QwQPD::MakeQPDList ( )

Definition at line 955 of file QwQPD.cc.

956{
957 for (size_t i = kXAxis; i < kNumAxes; i++) {
958 QwVQWK_Channel abspos(fAbsPos[i]);
959 abspos = fAbsPos[i];
960 fQPDElementList.push_back(abspos);
961 }
962 QwVQWK_Channel effectivecharge(fEffectiveCharge);
963 effectivecharge = fEffectiveCharge;
964 fQPDElementList.push_back(effectivecharge);
965}
std::vector< QwVQWK_Channel > fQPDElementList
Definition QwQPD.h:175

References fAbsPos, fEffectiveCharge, fQPDElementList, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ operator+=() [1/2]

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

Definition at line 623 of file QwQPD.cc.

624{
625 if (GetElementName()!=""){
626 Short_t i = 0;
628 for(i=0;i<4;i++) this->fPhotodiode[i]+=value.fPhotodiode[i];
629
630 for(i=kXAxis;i<kNumAxes;i++){
631 this->fRelPos[i]+=value.fRelPos[i];
632 this->fAbsPos[i]+=value.fAbsPos[i];
633 }
634 }
635 return *this;
636}

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwQPD().

+ Here is the call graph for this function:

◆ operator+=() [2/2]

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

Implements VQwBPM.

Definition at line 617 of file QwQPD.cc.

618{
619 *(dynamic_cast<QwQPD*>(this)) += *(dynamic_cast<const QwQPD*>(&value));
620 return *this;
621}

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

+ Here is the call graph for this function:

◆ operator-=() [1/2]

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

Definition at line 644 of file QwQPD.cc.

645{
646 if (GetElementName()!=""){
647 Short_t i = 0;
649 for(i=0;i<4;i++) this->fPhotodiode[i]-=value.fPhotodiode[i];
650
651 for(i=kXAxis;i<kNumAxes;i++){
652 this->fRelPos[i]-=value.fRelPos[i];
653 this->fAbsPos[i]-=value.fAbsPos[i];
654 }
655 }
656 return *this;
657}

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwQPD().

+ Here is the call graph for this function:

◆ operator-=() [2/2]

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

Implements VQwBPM.

Definition at line 638 of file QwQPD.cc.

639{
640 *(dynamic_cast<QwQPD*>(this)) -= *(dynamic_cast<const QwQPD*>(&value));
641 return *this;
642}

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

+ Here is the call graph for this function:

◆ operator=() [1/2]

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

Definition at line 603 of file QwQPD.cc.

604{
605 if (GetElementName()!=""){
606 Short_t i = 0;
608 for(i=0;i<4;i++) this->fPhotodiode[i]=value.fPhotodiode[i];
609 for(i=kXAxis;i<kNumAxes;i++){
610 this->fRelPos[i]=value.fRelPos[i];
611 this->fAbsPos[i]=value.fAbsPos[i];
612 }
613 }
614 return *this;
615}

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwQPD().

+ Here is the call graph for this function:

◆ operator=() [2/2]

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

Implements VQwBPM.

Definition at line 597 of file QwQPD.cc.

598{
599 *(dynamic_cast<QwQPD*>(this)) = *(dynamic_cast<const QwQPD*>(&value));
600 return *this;
601}

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

+ Here is the call graph for this function:

◆ PrintErrorCounters()

void QwQPD::PrintErrorCounters ( ) const
overridevirtual

Print error counter summaries for all channels.

Reimplemented from VQwDataElement.

Definition at line 160 of file QwQPD.cc.

161{
162 Short_t i=0;
163 for(i=0;i<4;i++)
165 for(i=kXAxis;i<kNumAxes;i++) {
166 fRelPos[i].PrintErrorCounters();
167 fAbsPos[i].PrintErrorCounters();
168 }
169 fEffectiveCharge.PrintErrorCounters();
170}
void PrintErrorCounters() const override
Definition QwQPD.cc:160

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwBPM::kNumAxes, VQwBPM::kXAxis, and PrintErrorCounters().

Referenced by PrintErrorCounters().

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

◆ ProcessEvBuffer()

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

Route raw buffer data to the specified photodiode channel.

Parameters
bufferRaw event buffer
word_position_in_bufferPosition in buffer to read from
indexTarget photodiode index (0-3)
Returns
Original word_position_in_buffer

Implements VQwDataElement.

Definition at line 557 of file QwQPD.cc.

558{
559 if(index<4)
560 {
561 fPhotodiode[index].ProcessEvBuffer(buffer,word_position_in_buffer);
562 }
563 else
564 {
565 std::cerr <<
566 "QwQPD::ProcessEvBuffer(): attempt to fill in raw date for a wire that doesn't exist \n";
567 }
568 return word_position_in_buffer;
569}

References fPhotodiode.

◆ ProcessEvent()

void QwQPD::ProcessEvent ( )
overridevirtual

Process the current event: apply HW checks, sum photodiodes for effective charge, and calculate X/Y positions using the standard QPD formula: X = ((TL-TR) + (BL-BR)) / (TL+TR+BL+BR) Y = ((TL-BL) + (TR-BR)) / (TL+TR+BL+BR)

The positions X and Y from a QPD are calculated using following equations,

TL ------— TR

| 4 | 2 |

BL | 3 | 1 | BR

     (4-2) + (3-1)                (4-3) + (2-1)
 X =  ------------           Y =  -------------
        1+2+3+4                      1+2+3+4

Implements VQwBPM.

Definition at line 453 of file QwQPD.cc.

454{
455 Bool_t localdebug = kFALSE;
456 static QwVQWK_Channel numer[2];
457 static QwVQWK_Channel tmp("tmp");
458 static QwVQWK_Channel tmp1("tmp1");
459 static QwVQWK_Channel tmp2("tmp2");
460
461 numer[0].InitializeChannel("Xnumerator","raw");
462 numer[1].InitializeChannel("Ynumerator","raw");
463
464 Short_t i = 0;
465
467 /* Frst apply HW checks and update HW error flags.
468 Calling this routine here and not in ApplySingleEventCuts
469 makes a difference for a QPDs because they are derived devices.
470 */
471
472 fEffectiveCharge.ClearEventData();
473
474 for(i=0;i<4;i++){
475 fPhotodiode[i].ProcessEvent();
477 }
478
479 if (localdebug) fEffectiveCharge.PrintInfo();
480
481
482 /** The positions X and Y from a QPD are calculated using following equations,
483
484 TL --------- TR
485 | 4 | 2 |
486 ---------
487 BL | 3 | 1 | BR
488 ---------
489
490
491 (4-2) + (3-1) (4-3) + (2-1)
492 X = ------------ Y = -------------
493 1+2+3+4 1+2+3+4
494 **/
495
496 if(localdebug){
497 std::cout<<"#############################\n";
498 std::cout<<" QPD name = "<<fElementName<<std::endl;
499 std::cout<<" event number = "<<fPhotodiode[0].GetSequenceNumber()<<"\n";
500 std::cout<<" hw BR ="<<fPhotodiode[0].GetValue()<<"\n";
501 std::cout<<" hw TR ="<<fPhotodiode[1].GetValue()<<"\n";
502 std::cout<<" hw BL ="<<fPhotodiode[2].GetValue()<<"\n";
503 std::cout<<" hw TL ="<<fPhotodiode[3].GetValue()<<"\n\n";
504 }
505
506 // X numerator
507 tmp1.ClearEventData();
508 tmp1.Difference(fPhotodiode[3],fPhotodiode[1]); // 4-2
509 tmp2.ClearEventData();
510 tmp2.Difference(fPhotodiode[2],fPhotodiode[0]); // 3-1
511 tmp.ClearEventData();
512 numer[0].Sum(tmp1,tmp2);
513
514 // Y numerator
515 tmp1.ClearEventData();
516 tmp1.Difference(fPhotodiode[3],fPhotodiode[2]); // 4-3
517 tmp2.ClearEventData();
518 tmp2.Difference(fPhotodiode[1],fPhotodiode[0]); // 2-1
519 tmp.ClearEventData();
520 numer[1].Sum(tmp1,tmp2);
521
522 for(i=kXAxis;i<kNumAxes;i++){
523 tmp.ClearEventData();
524 tmp.Sum(fPhotodiode[0],fPhotodiode[1]);
525 tmp1.ClearEventData();
526 tmp1.Sum(fPhotodiode[2],fPhotodiode[3]);
527 fEffectiveCharge.Sum(tmp,tmp1);
528
529 // X/Y reading in ADC counts
530 fRelPos[i].Ratio(numer[i],fEffectiveCharge);
531
532 // X/Y reading in mm.
533 fAbsPos[i]=fRelPos[i];
534 fAbsPos[i].Scale(fQwQPDCalibration[i]);
535
536 if(localdebug){
537 std::cout<<" hw numerator= "<<numer[i].GetValue()<<" ";
538 std::cout<<" hw denominator (== Effective_Charge)= "<<fEffectiveCharge.GetValue()<<"\n";
539 std::cout<<" hw clibration factors= "<<fQwQPDCalibration[i]<<"\n";
540 std::cout<<" hw fRelPos["<<kAxisLabel[i]<<"]="<<fRelPos[i].GetValue()<<"\n \n";
541 std::cout<<" hw fAbsPos["<<kAxisLabel[i]<<"]="<<fAbsPos[i].GetValue()<<"\n \n";
542 }
543 }
544
545 return;
546}
void InitializeChannel(TString name, TString datatosave) override
Initialize the fields in this object.
void Sum(const QwVQWK_Channel &value1, const QwVQWK_Channel &value2)
Double_t GetValue(size_t element) const override
TString fElementName
Name of this data element.
Bool_t ApplyHWChecks()
Definition QwQPD.cc:129

References ApplyHWChecks(), QwVQWK_Channel::ClearEventData(), QwVQWK_Channel::Difference(), fAbsPos, fEffectiveCharge, VQwDataElement::fElementName, fPhotodiode, fQwQPDCalibration, fRelPos, QwVQWK_Channel::GetValue(), QwVQWK_Channel::InitializeChannel(), VQwBPM::kAxisLabel, VQwBPM::kNumAxes, VQwBPM::kXAxis, and QwVQWK_Channel::Sum().

+ Here is the call graph for this function:

◆ RandomizeEventData()

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

Reimplemented from VQwBPM.

Definition at line 1024 of file QwQPD.cc.

1025{
1026 for (Short_t i=0; i<4; i++) fPhotodiode[i].RandomizeEventData(helicity, time);
1027
1028 return;
1029}
void RandomizeEventData(int helicity=0, double time=0.0) override
Definition QwQPD.cc:1024

References fPhotodiode, and RandomizeEventData().

Referenced by RandomizeEventData().

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

◆ Ratio()

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

Definition at line 660 of file QwQPD.cc.

661{
662 // this function is called when forming asymmetries. In this case what we actually want for the
663 // QPD is the difference only not the asymmetries
664
665 *this=numer;
666 this->fEffectiveCharge.Ratio(numer.fEffectiveCharge,denom.fEffectiveCharge);
667 return;
668}

References fEffectiveCharge, and QwQPD().

+ Here is the call graph for this function:

◆ Scale()

void QwQPD::Scale ( Double_t factor)
overridevirtual

Reimplemented from VQwBPM.

Definition at line 672 of file QwQPD.cc.

673{
674 Short_t i = 0;
675
676 for(i=0;i<4;i++) fPhotodiode[i].Scale(factor);
677 for(i=kXAxis;i<kNumAxes;i++){
678 fRelPos[i].Scale(factor);
679 fAbsPos[i].Scale(factor);
680 }
681 fEffectiveCharge.Scale(factor);
682 return;
683}
void Scale(Double_t factor) override
Definition QwQPD.cc:672

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwBPM::kNumAxes, VQwBPM::kXAxis, and Scale().

Referenced by Scale().

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

◆ SetDefaultSampleSize()

void QwQPD::SetDefaultSampleSize ( Int_t sample_size)
overridevirtual

Reimplemented from VQwBPM.

Definition at line 1049 of file QwQPD.cc.

1050{
1051 for(Short_t i=0;i<4;i++) fPhotodiode[i].SetDefaultSampleSize((size_t)sample_size);
1052 return;
1053}
void SetDefaultSampleSize(Int_t sample_size) override
Definition QwQPD.cc:1049

References fPhotodiode, and SetDefaultSampleSize().

Referenced by SetDefaultSampleSize().

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

◆ SetEventCutMode()

void QwQPD::SetEventCutMode ( Int_t bcuts)
overridevirtual

Implements VQwBPM.

Definition at line 942 of file QwQPD.cc.

943{
944 Short_t i = 0;
945 // bEVENTCUTMODE=bcuts;
946 for (i=0;i<4;i++) fPhotodiode[i].SetEventCutMode(bcuts);
947 for (i=kXAxis;i<kNumAxes;i++) {
948 fAbsPos[i].SetEventCutMode(bcuts);
949 fRelPos[i].SetEventCutMode(bcuts);
950 }
951 fEffectiveCharge.SetEventCutMode(bcuts);
952}
void SetEventCutMode(Int_t bcuts) override
Definition QwQPD.cc:942

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwBPM::kNumAxes, VQwBPM::kXAxis, and SetEventCutMode().

Referenced by SetEventCutMode().

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

◆ SetEventData()

void QwQPD::SetEventData ( Double_t * block,
UInt_t sequencenumber )

Definition at line 1032 of file QwQPD.cc.

1033{
1034 for (Short_t i=0; i<2; i++)
1035 {
1036 fAbsPos[i].SetHardwareSum(relpos[i], sequencenumber);
1037 }
1038
1039 return;
1040}

References fAbsPos.

◆ SetRandomEventParameters()

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

Reimplemented from VQwBPM.

Definition at line 996 of file QwQPD.cc.

997{
998 // Average values of the signals in the stripline ADCs
999 Double_t sumX = 1.1e8; // These are just guesses, but I made X and Y different
1000 Double_t sumY = 0.9e8; // to make it more interesting for the analyzer...
1001
1002
1003 // Determine the asymmetry from the position
1004 Double_t meanXP = (1.0 + meanX / fQwQPDCalibration[0]) * sumX / 2.0;
1005 Double_t meanXM = (1.0 - meanX / fQwQPDCalibration[0]) * sumX / 2.0; // = sumX - meanXP;
1006 Double_t meanYP = (1.0 + meanY / fQwQPDCalibration[1]) * sumY / 2.0;
1007 Double_t meanYM = (1.0 - meanY / fQwQPDCalibration[1]) * sumY / 2.0; // = sumY - meanYP;
1008
1009 // Determine the spread of the asymmetry (this is not tested yet)
1010 // (negative sigma should work in the QwVQWK_Channel, but still using fabs)
1011 Double_t sigmaXP = fabs(sumX * sigmaX / meanX);
1012 Double_t sigmaXM = sigmaXP;
1013 Double_t sigmaYP = fabs(sumY * sigmaY / meanY);
1014 Double_t sigmaYM = sigmaYP;
1015
1016 // Propagate these parameters to the ADCs
1017 fPhotodiode[0].SetRandomEventParameters(meanXP, sigmaXP);
1018 fPhotodiode[1].SetRandomEventParameters(meanXM, sigmaXM);
1019 fPhotodiode[2].SetRandomEventParameters(meanYP, sigmaYP);
1020 fPhotodiode[3].SetRandomEventParameters(meanYM, sigmaYM);
1021}

References fPhotodiode, and fQwQPDCalibration.

◆ SetSingleEventCuts()

void QwQPD::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 a specific subelement by name, including error flags, limits, stability, and burp detection parameters.

Parameters
ch_nameSubelement name (tl,tr,bl,br,relx,rely,absx,absy,effectivecharge)
errorflagError flag mask to set when the cut fails
minXLower limit
maxXUpper limit
stabilityStability cut width
burplevelBurp detection threshold

Definition at line 334 of file QwQPD.cc.

334 {
335 errorflag|=kBPMErrorFlag;//update the device flag
336 if (ch_name=="tl"){
337 QwMessage<<"TL LL " << minX <<" UL " << maxX <<QwLog::endl;
338 fPhotodiode[0].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
339
340 }else if (ch_name=="tr"){
341 QwMessage<<"TR LL " << minX <<" UL " << maxX <<QwLog::endl;
342 fPhotodiode[1].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
343
344 }else if (ch_name=="br"){
345 QwMessage<<"BR LL " << minX <<" UL " << maxX <<QwLog::endl;
346 fPhotodiode[2].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
347
348 }else if (ch_name=="bl"){
349 QwMessage<<"BL LL " << minX <<" UL " << maxX <<QwLog::endl;
350 fPhotodiode[3].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
351
352 }else if (ch_name=="relx"){
353 QwMessage<<"RelX LL " << minX <<" UL " << maxX <<QwLog::endl;
354 fRelPos[0].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
355
356 }else if (ch_name=="rely"){
357 QwMessage<<"RelY LL " << minX <<" UL " << maxX <<QwLog::endl;
358 fRelPos[1].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
359
360 }else if (ch_name=="absx"){
361 QwMessage<<"AbsX LL " << minX <<" UL " << maxX <<QwLog::endl;
362 fAbsPos[0].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
363
364 }else if (ch_name=="absy"){
365 QwMessage<<"AbsY LL " << minX <<" UL " << maxX <<QwLog::endl;
366 fAbsPos[1].SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
367
368 }else if (ch_name=="effectivecharge"){
369 QwMessage<<"EffectveQ LL " << minX <<" UL " << maxX <<QwLog::endl;
370 fEffectiveCharge.SetSingleEventCuts(errorflag,minX,maxX,stability,burplevel);
371
372 }
373
374}
static const UInt_t kBPMErrorFlag
Definition QwTypes.h:170

References QwLog::endl(), fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, kBPMErrorFlag, and QwMessage.

+ Here is the call graph for this function:

◆ SetSubElementCalibrationFactor()

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

Reimplemented from VQwBPM.

Definition at line 1062 of file QwQPD.cc.

1063{
1064 fPhotodiode[j].SetCalibrationFactor(value);
1065 return;
1066}

References fPhotodiode.

◆ SetSubElementPedestal()

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

Reimplemented from VQwBPM.

Definition at line 1056 of file QwQPD.cc.

1057{
1058 fPhotodiode[j].SetPedestal(value);
1059 return;
1060}

References fPhotodiode.

◆ UpdateErrorFlag() [1/2]

UInt_t QwQPD::UpdateErrorFlag ( )
overridevirtual

Update derived channel error flags based on photodiode error codes and return aggregated event-cut flags.

Implements VQwBPM.

Definition at line 193 of file QwQPD.cc.

194{
195 Short_t i=0;
196 UInt_t error1=0;
197 UInt_t error2=0;
198 for(i=0;i<4;i++){
199 error1|=fPhotodiode[i].GetErrorCode();
200 error2|=fPhotodiode[i].GetEventcutErrorFlag();
201 }
202 for(i=kXAxis;i<kNumAxes;i++) {
203 fRelPos[i].UpdateErrorFlag(error1);
204 fAbsPos[i].UpdateErrorFlag(error1);
205 error2|=fRelPos[i].GetEventcutErrorFlag();
206 error2|=fAbsPos[i].GetEventcutErrorFlag();
207 }
208 fEffectiveCharge.UpdateErrorFlag(error1);
209 error2|=fEffectiveCharge.GetEventcutErrorFlag();
210 return error2;
211}

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwBPM::kNumAxes, and VQwBPM::kXAxis.

◆ UpdateErrorFlag() [2/2]

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

Copy error flags from a reference QPD to this instance.

Exceptions
std::invalid_argumentif ev_error is not a QwQPD.

Implements VQwBPM.

Definition at line 417 of file QwQPD.cc.

417 {
418 Short_t i=0;
419 try {
420 if(typeid(*ev_error)==typeid(*this)) {
421 // std::cout<<" Here in QwQPD::UpdateErrorFlag \n";
422 if (this->GetElementName()!="") {
423 const QwQPD* value_bpm = dynamic_cast<const QwQPD* >(ev_error);
424 for(i=0;i<4;i++){
425 fPhotodiode[i].UpdateErrorFlag(value_bpm->fPhotodiode[i]);
426 }
427 for(i=kXAxis;i<kNumAxes;i++) {
428 fRelPos[i].UpdateErrorFlag(value_bpm->fRelPos[i]);
429 fAbsPos[i].UpdateErrorFlag(value_bpm->fAbsPos[i]);
430 }
431 fEffectiveCharge.UpdateErrorFlag(value_bpm->fEffectiveCharge);
432 }
433 } else {
434 TString loc="Standard exception from QwQPD::UpdateErrorFlag :"+
435 ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
436 +"same type";
437 throw std::invalid_argument(loc.Data());
438 }
439 } catch (std::exception& e) {
440 std::cerr<< e.what()<<std::endl;
441 }
442
443};

References fAbsPos, fEffectiveCharge, fPhotodiode, fRelPos, VQwDataElement::GetElementName(), VQwBPM::kNumAxes, VQwBPM::kXAxis, QwQPD(), and VQwBPM::VQwBPM().

+ Here is the call graph for this function:

Field Documentation

◆ fAbsPos

◆ fEffectiveCharge

◆ fPhotodiode

◆ fQPDElementList

std::vector<QwVQWK_Channel> QwQPD::fQPDElementList
protected

Definition at line 175 of file QwQPD.h.

Referenced by MakeQPDList().

◆ fQwQPDCalibration

Double_t QwQPD::fQwQPDCalibration[2]
private

Definition at line 163 of file QwQPD.h.

Referenced by GetCalibrationFactors(), ProcessEvent(), QwQPD(), and SetRandomEventParameters().

◆ fRelPos

◆ subelement

const TString QwQPD::subelement ={"BR","TR","BL","TL"}
staticprivate

Definition at line 27 of file QwQPD.h.

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


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