QwAnalysis
QwBPMStripline< T > Class Template Reference

#include <QwBPMStripline.h>

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

Public Member Functions

 QwBPMStripline ()
 
 QwBPMStripline (TString name)
 
 QwBPMStripline (TString subsystemname, TString name)
 
 QwBPMStripline (TString subsystemname, TString name, TString type)
 
 QwBPMStripline (const QwBPMStripline &source)
 
virtual ~QwBPMStripline ()
 
void InitializeChannel (TString name)
 
void InitializeChannel (TString subsystem, TString name)
 
void InitializeChannel (TString subsystem, TString name, TString type)
 
void ClearEventData ()
 Clear the event data in this element. More...
 
void LoadChannelParameters (QwParameterFile &paramfile)
 
Int_t ProcessEvBuffer (UInt_t *buffer, UInt_t word_position_in_buffer, UInt_t indexnumber)
 Process the CODA event buffer for this element. More...
 
void ProcessEvent ()
 
void PrintValue () const
 Print single line of value and error of this data element. More...
 
void PrintInfo () const
 Print multiple lines of information about this data element. More...
 
void WritePromptSummary (QwPromptSummary *ps, TString type)
 
const VQwHardwareChannelGetPosition (EBeamPositionMonitorAxis axis) const
 
const VQwHardwareChannelGetEffectiveCharge () const
 
TString GetSubElementName (Int_t subindex)
 
void GetAbsolutePosition ()
 
Bool_t ApplyHWChecks ()
 
Bool_t ApplySingleEventCuts ()
 
void SetEventCutMode (Int_t bcuts)
 
void IncrementErrorCounters ()
 
void PrintErrorCounters () const
 report number of events failed due to HW and event cut failure More...
 
UInt_t GetEventcutErrorFlag ()
 return the error flag on this channel/device More...
 
UInt_t UpdateErrorFlag ()
 Update the error flag based on the error flags of internally contained objects Return paramter is the "Eventcut Error Flag". More...
 
void UpdateErrorFlag (const VQwBPM *ev_error)
 
void SetDefaultSampleSize (Int_t sample_size)
 
void SetRandomEventParameters (Double_t meanX, Double_t sigmaX, Double_t meanY, Double_t sigmaY)
 
void RandomizeEventData (int helicity=0, double time=0.0)
 
void EncodeEventData (std::vector< UInt_t > &buffer)
 
void SetSubElementPedestal (Int_t j, Double_t value)
 
void SetSubElementCalibrationFactor (Int_t j, Double_t value)
 
void Ratio (VQwBPM &numer, VQwBPM &denom)
 
void Ratio (QwBPMStripline &numer, QwBPMStripline &denom)
 
void Scale (Double_t factor)
 
VQwBPMoperator= (const VQwBPM &value)
 
VQwBPMoperator+= (const VQwBPM &value)
 
VQwBPMoperator-= (const VQwBPM &value)
 
virtual QwBPMStriplineoperator= (const QwBPMStripline &value)
 
virtual QwBPMStriplineoperator+= (const QwBPMStripline &value)
 
virtual QwBPMStriplineoperator-= (const QwBPMStripline &value)
 
void AccumulateRunningSum (const QwBPMStripline &value)
 
void AccumulateRunningSum (const VQwBPM &value)
 
void DeaccumulateRunningSum (VQwBPM &value)
 
void DeaccumulateRunningSum (QwBPMStripline &value)
 
void CalculateRunningAverage ()
 
void ConstructHistograms (TDirectory *folder, TString &prefix)
 Construct the histograms for this data element. More...
 
void FillHistograms ()
 Fill the histograms for this data element. More...
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, std::vector< Double_t > &values)
 
void ConstructBranch (TTree *tree, TString &prefix)
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &modulelist)
 
void FillTreeVector (std::vector< Double_t > &values) const
 
std::vector< QwDBInterfaceGetDBEntry ()
 
std::vector< QwErrDBInterfaceGetErrDBEntry ()
 
- Public Member Functions inherited from VQwBPM
 VQwBPM ()
 
 VQwBPM (TString &name)
 
 VQwBPM (const VQwBPM &source)
 
virtual ~VQwBPM ()
 
void InitializeChannel (TString name)
 
void GetSurveyOffsets (Double_t Xoffset, Double_t Yoffset, Double_t Zoffset)
 
void GetElectronicFactors (Double_t BSENfactor, Double_t AlphaX, Double_t AlphaY)
 
void SetRotation (Double_t)
 
void SetRotationOff ()
 
void SetSingleEventCuts (TString, Double_t, Double_t)
 
void SetSingleEventCuts (TString, UInt_t, Double_t, Double_t, Double_t)
 
void SetGains (TString pos, Double_t value)
 
void SetRootSaveStatus (TString &prefix)
 
Double_t GetPositionInZ () const
 
virtual const VQwHardwareChannelGetAngleX () const
 
virtual const VQwHardwareChannelGetAngleY () const
 
virtual void SetBPMForCombo (const VQwBPM *bpm, Double_t charge_weight, Double_t x_weight, Double_t y_weight, Double_t sumqw)
 
- Public Member Functions inherited from VQwDataElement
 VQwDataElement ()
 Default constructor. More...
 
 VQwDataElement (const VQwDataElement &value)
 Copy constructor. More...
 
virtual ~VQwDataElement ()
 Virtual destructor. More...
 
Bool_t IsNameEmpty () const
 Is the name of this element empty? More...
 
void SetElementName (const TString &name)
 Set the name of this element. More...
 
virtual const TString & GetElementName () const
 Get the name of this element. More...
 
size_t GetNumberOfDataWords ()
 Get the number of data words in this data element. More...
 
UInt_t GetGoodEventCount () const
 
virtual void AssignValueFrom (const VQwDataElement *valueptr)
 
virtual VQwDataElementoperator+= (const VQwDataElement &value)
 Addition-assignment operator. More...
 
virtual VQwDataElementoperator-= (const VQwDataElement &value)
 Subtraction-assignment operator. More...
 
virtual void Sum (const VQwDataElement &value1, const VQwDataElement &value2)
 Sum operator. More...
 
virtual void Difference (const VQwDataElement &value1, const VQwDataElement &value2)
 Difference operator. More...
 
virtual void Ratio (const VQwDataElement &numer, const VQwDataElement &denom)
 Ratio operator. More...
 
virtual void SetSingleEventCuts (UInt_t errorflag, Double_t min, Double_t max, Double_t stability)
 set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel More...
 
virtual void SetNeedsExternalClock (Bool_t needed)
 
virtual Bool_t NeedsExternalClock ()
 
virtual std::string GetExternalClockName ()
 
virtual void SetExternalClockPtr (const VQwHardwareChannel *clock)
 
virtual void SetExternalClockName (const std::string name)
 
virtual Double_t GetNormClockValue ()
 
TString GetSubsystemName () const
 Return the name of the inheriting subsystem name. More...
 
void SetSubsystemName (TString sysname)
 Set the name of the inheriting subsystem name. More...
 
TString GetModuleType () const
 Return the type of the beam instrument. More...
 
void SetModuleType (TString ModuleType)
 set the type of the beam instrument More...
 
- Public Member Functions inherited from MQwHistograms
void ShareHistograms (const MQwHistograms *source)
 Share histogram pointers between objects. More...
 

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. More...
 
static VQwBPMCreateStripline (const VQwBPM &source)
 
static VQwBPMCreateCombo (TString subsystemname, TString type, TString name)
 A fast way of creating a BPM stripline of specified type. More...
 
static VQwBPMCreateCombo (const VQwBPM &source)
 

Protected Member Functions

VQwHardwareChannelGetSubelementByName (TString ch_name)
 
- Protected Member Functions inherited from VQwBPM
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. More...
 
virtual VQwDataElementoperator= (const VQwDataElement &value)
 Arithmetic assignment operator: Should only copy event-based data. More...
 
virtual void UpdateErrorFlag (const UInt_t &error)
 
- Protected Member Functions inherited from MQwHistograms
 MQwHistograms ()
 Default constructor. More...
 
 MQwHistograms (const MQwHistograms &source)
 Copy constructor. More...
 
virtual ~MQwHistograms ()
 Virtual destructor. More...
 
virtual MQwHistogramsoperator= (const MQwHistograms &value)
 
void Fill_Pointer (TH1_ptr hist_ptr, Double_t value)
 
void AddHistogram (TH1 *h)
 Register a histogram. More...
 

Protected Attributes

fWire [4]
 
fRelPos [2]
 
fAbsPos [2]
 
fEffectiveCharge
 
- Protected Attributes inherited from VQwBPM
std::vector< TString > fSubelementNames
 
Double_t fPositionCenter [3]
 
Double_t fQwStriplineCalibration
 
Double_t fRelativeGains [2]
 
Double_t fGains [2]
 
Bool_t bRotated
 
Double_t fRotationAngle
 
Double_t fCosRotation
 
Double_t fSinRotation
 
Bool_t fGoodEvent
 
Bool_t bFullSave
 
- Protected Attributes inherited from VQwDataElement
TString fElementName
 Name of this data element. More...
 
UInt_t fNumberOfDataWords
 Number of raw data words in this data element. More...
 
Int_t fGoodEventCount
 Number of good events accumulated in this element. More...
 
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) More...
 
UInt_t fErrorConfigFlag
 contains the global/local/stability flags More...
 
- Protected Attributes inherited from MQwHistograms
std::vector< TH1_ptrfHistograms
 Histograms associated with this data element. More...
 

Private Member Functions

void SetEventData (Double_t *block, UInt_t sequencenumber)
 
void MakeBPMList ()
 

Private Attributes

std::vector< T > fBPMElementList
 

Static Private Attributes

static const Double_t kRotationCorrection
 
static const TString subelement [4] ={"XP","XM","YP","YM"}
 

Friends

template<typename TT >
class QwCombinedBPM
 
class QwEnergyCalculator
 

Additional Inherited Members

- Public Types inherited from VQwBPM
enum  EBeamPositionMonitorAxis { kXAxis =0, kYAxis, kNumAxes }
 
- Public Types inherited from VQwDataElement
enum  EDataToSave { kRaw = 0, kDerived }
 
- Static Protected Attributes inherited from VQwBPM
static const TString kAxisLabel [2] ={"X","Y"}
 
static const TString axis [3]
 
static const Bool_t bDEBUG =kFALSE
 

Detailed Description

template<typename T>
class QwBPMStripline< T >

Definition at line 33 of file QwBPMStripline.h.

Constructor & Destructor Documentation

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

Definition at line 41 of file QwBPMStripline.h.

41 { };
template<typename T>
QwBPMStripline< T >::QwBPMStripline ( TString  name)
inline

Definition at line 42 of file QwBPMStripline.h.

References VQwBPM::bRotated, VQwBPM::fRotationAngle, QwBPMStripline< T >::InitializeChannel(), and VQwBPM::SetRotation().

42  {
43  InitializeChannel(name);
44  fRotationAngle = 45.0;
46  bRotated=kTRUE;
47  };
Bool_t bRotated
Definition: VQwBPM.h:263
Double_t fRotationAngle
Definition: VQwBPM.h:264
void SetRotation(Double_t)
Definition: VQwBPM.cc:68
void InitializeChannel(TString name)

+ Here is the call graph for this function:

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

Definition at line 48 of file QwBPMStripline.h.

References VQwBPM::bRotated, VQwBPM::fRotationAngle, QwBPMStripline< T >::InitializeChannel(), VQwBPM::SetRotation(), and VQwDataElement::SetSubsystemName().

48  {
49  SetSubsystemName(subsystemname);
50  InitializeChannel(subsystemname, name);
51  fRotationAngle = 45.0;
53  bRotated=kTRUE;
54  };
Bool_t bRotated
Definition: VQwBPM.h:263
Double_t fRotationAngle
Definition: VQwBPM.h:264
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.
void SetRotation(Double_t)
Definition: VQwBPM.cc:68
void InitializeChannel(TString name)

+ Here is the call graph for this function:

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

Definition at line 55 of file QwBPMStripline.h.

References VQwBPM::bRotated, VQwBPM::fRotationAngle, QwBPMStripline< T >::InitializeChannel(), VQwBPM::SetRotation(), and VQwDataElement::SetSubsystemName().

55  {
56  SetSubsystemName(subsystemname);
57  InitializeChannel(subsystemname, name, type);
58  fRotationAngle = 45.0;
60  bRotated=kTRUE;
61  };
Bool_t bRotated
Definition: VQwBPM.h:263
Double_t fRotationAngle
Definition: VQwBPM.h:264
void SetSubsystemName(TString sysname)
Set the name of the inheriting subsystem name.
void SetRotation(Double_t)
Definition: VQwBPM.cc:68
void InitializeChannel(TString name)

+ Here is the call graph for this function:

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

Definition at line 62 of file QwBPMStripline.h.

63  : VQwBPM(source),
64  fWire(source.fWire),fRelPos(source.fRelPos),fAbsPos(source.fAbsPos),
66  { }
VQwBPM()
Definition: VQwBPM.h:58
template<typename T>
virtual QwBPMStripline< T >::~QwBPMStripline ( )
inlinevirtual

Definition at line 67 of file QwBPMStripline.h.

67 { };

Member Function Documentation

template<typename T >
void QwBPMStripline< T >::AccumulateRunningSum ( const QwBPMStripline< T > &  value)

Definition at line 683 of file QwBPMStripline.cc.

References QwBPMStripline< T >::fAbsPos, QwBPMStripline< T >::fEffectiveCharge, QwBPMStripline< T >::fRelPos, and QwBPMStripline< T >::fWire.

684 {
685  Short_t i = 0;
686  for (i = 0; i < 4; i++){
687  fWire[i].AccumulateRunningSum(value.fWire[i]);
688  }
689  for (i = 0; i < 2; i++){
690  fRelPos[i].AccumulateRunningSum(value.fRelPos[i]);
691  fAbsPos[i].AccumulateRunningSum(value.fAbsPos[i]);
692  }
693  fEffectiveCharge.AccumulateRunningSum(value.fEffectiveCharge);
694  return;
695 }
template<typename T >
void QwBPMStripline< T >::AccumulateRunningSum ( const VQwBPM value)
virtual

Reimplemented from VQwBPM.

Definition at line 677 of file QwBPMStripline.cc.

References QwEnergyCalculator::AccumulateRunningSum().

678 {
679  AccumulateRunningSum(*dynamic_cast<const QwBPMStripline<T>* >(&value));
680 }
void AccumulateRunningSum(const QwBPMStripline &value)

+ Here is the call graph for this function:

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

Definition at line 104 of file QwBPMStripline.cc.

105 {
106  Bool_t eventokay=kTRUE;
107 
108  UInt_t deviceerror=0;
109  for(Short_t i=0;i<4;i++)
110  {
111  deviceerror|= fWire[i].ApplyHWChecks(); //OR the error code from each wire
112  eventokay &= (deviceerror & 0x0);//AND with 0 since zero means HW is good.
113 
114  // if (bDEBUG) std::cout<<" Inconsistent within BPM terminals wire[ "<<i<<" ] "<<std::endl;
115  // if (bDEBUG) std::cout<<" wire[ "<<i<<" ] sequence num "<<fWire[i].GetSequenceNumber()<<" sample size "<<fWire[i].GetNumberOfSamples()<<std::endl;
116  }
117 
118  return eventokay;
119 }
template<typename T >
Bool_t QwBPMStripline< T >::ApplySingleEventCuts ( )
virtual

Implements VQwBPM.

Definition at line 213 of file QwBPMStripline.cc.

References QwEnergyCalculator::ApplySingleEventCuts().

214 {
215  Bool_t status=kTRUE;
216  Int_t i=0;
217 
218  UInt_t element_error_code[2];
219  //Event cuts for four wires
220  for(i=0;i<4;i++){
221  if (fWire[i].ApplySingleEventCuts()){ //for RelX
222  status&=kTRUE;
223  }
224  else{
225  status&=kFALSE;
226  if (bDEBUG) std::cout<<" Abs X event cut failed ";
227  }
228  }
229 
230  //Get the rex/abs X event cut error flag from xm and xp
231  element_error_code[kXAxis] = GetSubelementByName("xm")->GetErrorCode() | GetSubelementByName("xp")->GetErrorCode();
232  //Get the rex/abs Y event cut error flag from ym and yp
233  element_error_code[kYAxis] = GetSubelementByName("ym")->GetErrorCode() | GetSubelementByName("yp")->GetErrorCode();
234  //Update the error flags for rel and abs positions
235  fRelPos[kXAxis].UpdateErrorFlag(element_error_code[kXAxis]);
236  fRelPos[kYAxis].UpdateErrorFlag(element_error_code[kYAxis]);
237  fAbsPos[kXAxis].UpdateErrorFlag(element_error_code[kXAxis]);
238  fAbsPos[kYAxis].UpdateErrorFlag(element_error_code[kYAxis]);
239  //update the sum of error flags of all wires to the charge element
240  fEffectiveCharge.UpdateErrorFlag(element_error_code[kXAxis]|element_error_code[kYAxis]);
241 
242 
243 
244  //Event cuts for Relative X & Y
245  for(i=kXAxis;i<kNumAxes;i++){
246  if (fRelPos[i].ApplySingleEventCuts()){ //for RelX
247  status&=kTRUE;
248  }
249  else{
250  status&=kFALSE;
251  if (bDEBUG) std::cout<<" Rel X event cut failed ";
252  }
253  }
254 
255  for(i=kXAxis;i<kNumAxes;i++){
256  if (fAbsPos[i].ApplySingleEventCuts()){ //for RelX
257  status&=kTRUE;
258  }
259  else{
260  status&=kFALSE;
261  if (bDEBUG) std::cout<<" Abs X event cut failed ";
262  }
263  }
264 
265  //Event cuts for four wire sum (EffectiveCharge) are already ORed when EffectiveCharge is calculated
266  if (fEffectiveCharge.ApplySingleEventCuts()){
267  status&=kTRUE;
268  }
269  else{
270  status&=kFALSE;
271  if (bDEBUG) std::cout<<"EffectiveCharge event cut failed ";
272  }
273  return status;
274 }
Bool_t ApplySingleEventCuts()
static const Bool_t bDEBUG
Definition: VQwBPM.h:275
virtual UInt_t GetErrorCode() const
VQwHardwareChannel * GetSubelementByName(TString ch_name)

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::CalculateRunningAverage ( )
virtual

Implements VQwBPM.

Definition at line 660 of file QwBPMStripline.cc.

661 {
662  Short_t i = 0;
663  for (i = 0; i < 4; i++){
664  fWire[i].CalculateRunningAverage();
665  }
666 
667  for (i = 0; i < 2; i++){
668  fRelPos[i].CalculateRunningAverage();
669  fAbsPos[i].CalculateRunningAverage();
670  }
671  fEffectiveCharge.CalculateRunningAverage();
672  return;
673 }
template<typename T >
void QwBPMStripline< T >::ClearEventData ( )
virtual

Clear the event data in this element.

Reimplemented from VQwDataElement.

Definition at line 87 of file QwBPMStripline.cc.

References QwEnergyCalculator::ClearEventData().

88 {
89  Short_t i=0;
90 
91  for(i=0;i<4;i++) fWire[i].ClearEventData();
92 
93  for(i=kXAxis;i<kNumAxes;i++){
94  fAbsPos[i].ClearEventData();
95  fRelPos[i].ClearEventData();
96  }
97  fEffectiveCharge.ClearEventData();
98 
99  return;
100 }
void ClearEventData()
Clear the event data in this element.

+ Here is the call graph for this function:

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

Implements VQwBPM.

Definition at line 789 of file QwBPMStripline.cc.

References QwEnergyCalculator::bFullSave, QwEnergyCalculator::ConstructBranch(), VQwDataElement::GetElementName(), and QwEnergyCalculator::SetRootSaveStatus().

790 {
791  if (GetElementName()==""){
792  // This channel is not used, so skip constructing trees.
793  }
794  else {
795  TString thisprefix=prefix;
796  if(prefix=="asym_")
797  thisprefix="diff_";
798 
799  this->SetRootSaveStatus(prefix);
800 
801  fEffectiveCharge.ConstructBranch(tree,prefix);
802  Short_t i = 0;
803  if(bFullSave) {
804  for(i=0;i<4;i++) fWire[i].ConstructBranch(tree,thisprefix);
805  }
806  for(i=kXAxis;i<kNumAxes;i++) {
807  fRelPos[i].ConstructBranch(tree,thisprefix);
808  fAbsPos[i].ConstructBranch(tree,thisprefix);
809  }
810 
811  }
812  return;
813 }
void SetRootSaveStatus(TString &prefix)
Definition: VQwBPM.cc:178
Bool_t bFullSave
Definition: VQwBPM.h:273
void ConstructBranch(TTree *tree, TString &prefix)
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

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

Implements VQwBPM.

Definition at line 816 of file QwBPMStripline.cc.

References QwEnergyCalculator::bFullSave, QwEnergyCalculator::ConstructBranch(), QwLog::endl(), VQwDataElement::GetElementName(), QwParameterFile::HasValue(), QwMessage, and QwEnergyCalculator::SetRootSaveStatus().

817 {
818  TString devicename;
819  /*
820  QwMessage <<" QwBCM::ConstructBranch "<<QwLog::endl;
821  modulelist.RewindToFileStart();
822  while (modulelist.ReadNextLine()){
823  modulelist.TrimComment('!'); // Remove everything after a '!' character.
824  modulelist.TrimWhitespace(); // Get rid of leading and trailing spaces.
825  QwMessage <<" "<<modulelist.GetLine()<<" ";
826  }
827  QwMessage <<QwLog::endl;
828  */
829  devicename=GetElementName();
830  devicename.ToLower();
831  if (GetElementName()==""){
832  // This channel is not used, so skip filling the histograms.
833  } else
834  {
835  if (modulelist.HasValue(devicename)){
836  TString thisprefix=prefix;
837  if(prefix=="asym_")
838  thisprefix="diff_";
839 
840  this->SetRootSaveStatus(prefix);
841 
842  fEffectiveCharge.ConstructBranch(tree,prefix);
843  Short_t i = 0;
844  if(bFullSave) {
845  for(i=0;i<4;i++) fWire[i].ConstructBranch(tree,thisprefix);
846  }
847  for(i=kXAxis;i<kNumAxes;i++) {
848  fRelPos[i].ConstructBranch(tree,thisprefix);
849  fAbsPos[i].ConstructBranch(tree,thisprefix);
850  }
851 
852  QwMessage <<" Tree leaves added to "<<devicename<<" Corresponding channels"<<QwLog::endl;
853  }
854  // this functions doesn't do anything yet
855  }
856 
857 
858 
859 
860 
861  return;
862 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void SetRootSaveStatus(TString &prefix)
Definition: VQwBPM.cc:178
Bool_t bFullSave
Definition: VQwBPM.h:273
Bool_t HasValue(TString &vname)
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
void ConstructBranch(TTree *tree, TString &prefix)
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::ConstructBranchAndVector ( TTree *  tree,
TString &  prefix,
std::vector< Double_t > &  values 
)
virtual

Implements VQwBPM.

Definition at line 762 of file QwBPMStripline.cc.

References QwEnergyCalculator::bFullSave, QwEnergyCalculator::ConstructBranchAndVector(), VQwDataElement::GetElementName(), and QwEnergyCalculator::SetRootSaveStatus().

763 {
764  if (GetElementName()==""){
765  // This channel is not used, so skip constructing trees.
766  }
767  else {
768  TString thisprefix=prefix;
769  if(prefix=="asym_")
770  thisprefix="diff_";
771 
772  this->SetRootSaveStatus(prefix);
773 
774  fEffectiveCharge.ConstructBranchAndVector(tree,prefix,values);
775  Short_t i = 0;
776  if(bFullSave) {
777  for(i=0;i<4;i++) fWire[i].ConstructBranchAndVector(tree,thisprefix,values);
778  }
779  for(i=kXAxis;i<kNumAxes;i++) {
780  fRelPos[i].ConstructBranchAndVector(tree,thisprefix,values);
781  fAbsPos[i].ConstructBranchAndVector(tree,thisprefix,values);
782  }
783 
784  }
785  return;
786 }
void SetRootSaveStatus(TString &prefix)
Definition: VQwBPM.cc:178
Bool_t bFullSave
Definition: VQwBPM.h:273
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

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

Construct the histograms for this data element.

Implements VQwBPM.

Definition at line 716 of file QwBPMStripline.cc.

References QwEnergyCalculator::bFullSave, QwEnergyCalculator::ConstructHistograms(), VQwDataElement::GetElementName(), and QwEnergyCalculator::SetRootSaveStatus().

717 {
718 
719  if (GetElementName()=="") {
720  // This channel is not used, so skip filling the histograms.
721  } else {
722  fEffectiveCharge.ConstructHistograms(folder, prefix);
723  TString thisprefix=prefix;
724 
725  if(prefix=="asym_")
726  thisprefix="diff_";
727  this->SetRootSaveStatus(prefix);
728  Short_t i = 0;
729  if(bFullSave) {
730  for(i=0;i<4;i++) fWire[i].ConstructHistograms(folder, thisprefix);
731  }
732  for(i=kXAxis;i<kNumAxes;i++) {
733  fRelPos[i].ConstructHistograms(folder, thisprefix);
734  fAbsPos[i].ConstructHistograms(folder, thisprefix);
735  }
736  }
737  return;
738 }
void SetRootSaveStatus(TString &prefix)
Definition: VQwBPM.cc:178
void ConstructHistograms(TDirectory *folder, TString &prefix)
Construct the histograms for this data element.
Bool_t bFullSave
Definition: VQwBPM.h:273
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::DeaccumulateRunningSum ( VQwBPM value)
virtual

Implements VQwBPM.

Definition at line 697 of file QwBPMStripline.cc.

References QwEnergyCalculator::DeaccumulateRunningSum().

697  {
698  DeaccumulateRunningSum(*dynamic_cast<QwBPMStripline<T>* >(&value));
699 };
void DeaccumulateRunningSum(VQwBPM &value)

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::DeaccumulateRunningSum ( QwBPMStripline< T > &  value)

Definition at line 702 of file QwBPMStripline.cc.

References QwBPMStripline< T >::fAbsPos, QwBPMStripline< T >::fEffectiveCharge, QwBPMStripline< T >::fRelPos, and QwBPMStripline< T >::fWire.

702  {
703  Short_t i = 0;
704  for (i = 0; i < 4; i++){
705  fWire[i].DeaccumulateRunningSum(value.fWire[i]);
706  }
707  for (i = 0; i < 2; i++){
708  fRelPos[i].DeaccumulateRunningSum(value.fRelPos[i]);
709  fAbsPos[i].DeaccumulateRunningSum(value.fAbsPos[i]);
710  }
711  fEffectiveCharge.DeaccumulateRunningSum(value.fEffectiveCharge); return;
712 
713 };
template<typename T >
void QwBPMStripline< T >::EncodeEventData ( std::vector< UInt_t > &  buffer)
virtual

Reimplemented from VQwBPM.

Definition at line 1008 of file QwBPMStripline.cc.

1009 {
1010  for (Short_t i=0; i<4; i++) fWire[i].EncodeEventData(buffer);
1011 }
void EncodeEventData(std::vector< UInt_t > &buffer)
template<typename T >
void QwBPMStripline< T >::FillHistograms ( )
virtual

Fill the histograms for this data element.

Implements VQwBPM.

Definition at line 741 of file QwBPMStripline.cc.

References QwEnergyCalculator::bFullSave, QwEnergyCalculator::FillHistograms(), and VQwDataElement::GetElementName().

742 {
743  if (GetElementName()=="") {
744  // This channel is not used, so skip filling the histograms.
745  }
746  else {
747  fEffectiveCharge.FillHistograms();
748  Short_t i = 0;
749  if(bFullSave) {
750  for(i=0;i<4;i++) fWire[i].FillHistograms();
751  }
752  for(i=kXAxis;i<kNumAxes;i++){
753  fRelPos[i].FillHistograms();
754  fAbsPos[i].FillHistograms();
755  }
756  //No data for z position
757  }
758  return;
759 }
void FillHistograms()
Fill the histograms for this data element.
Bool_t bFullSave
Definition: VQwBPM.h:273
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::FillTreeVector ( std::vector< Double_t > &  values) const
virtual

Implements VQwBPM.

Definition at line 865 of file QwBPMStripline.cc.

References QwEnergyCalculator::bFullSave, QwEnergyCalculator::FillTreeVector(), and VQwDataElement::GetElementName().

866 {
867  if (GetElementName()=="") {
868  // This channel is not used, so skip filling the tree.
869  }
870  else {
871  fEffectiveCharge.FillTreeVector(values);
872  Short_t i = 0;
873  if(bFullSave) {
874  for(i=0;i<4;i++) fWire[i].FillTreeVector(values);
875  }
876  for(i=kXAxis;i<kNumAxes;i++){
877  fRelPos[i].FillTreeVector(values);
878  fAbsPos[i].FillTreeVector(values);
879  }
880  }
881  return;
882 }
Bool_t bFullSave
Definition: VQwBPM.h:273
void FillTreeVector(std::vector< Double_t > &values) const
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::GetAbsolutePosition ( )
virtual

Reimplemented from VQwBPM.

Definition at line 539 of file QwBPMStripline.cc.

540 {
541  for(Short_t i=kXAxis;i<kNumAxes;i++){
542  fAbsPos[i]= fRelPos[i];
543  fAbsPos[i].AddChannelOffset(fPositionCenter[i]);
544  }
545  // For Z, the absolute position will be the offset we are reading from the
546  // geometry map file. Since we are not putting that to the tree it is not
547  // treated as a vqwk channel.
548 }
Double_t fPositionCenter[3]
Definition: VQwBPM.h:256
template<typename T >
std::vector< QwDBInterface > QwBPMStripline< T >::GetDBEntry ( )
virtual

Implements VQwBPM.

Definition at line 916 of file QwBPMStripline.cc.

917 {
918  std::vector <QwDBInterface> row_list;
919  row_list.clear();
920 
921  for(size_t i=0;i<2;i++) {
922  fRelPos[i].AddEntriesToList(row_list);
923  fAbsPos[i].AddEntriesToList(row_list);
924  }
925  fEffectiveCharge.AddEntriesToList(row_list);
926  return row_list;
927 }
template<typename T>
const VQwHardwareChannel* QwBPMStripline< T >::GetEffectiveCharge ( ) const
inlinevirtual

Implements VQwBPM.

Definition at line 96 of file QwBPMStripline.h.

References QwBPMStripline< T >::fEffectiveCharge.

96 {return &fEffectiveCharge;}
template<typename T >
std::vector< QwErrDBInterface > QwBPMStripline< T >::GetErrDBEntry ( )
virtual

Implements VQwBPM.

Definition at line 931 of file QwBPMStripline.cc.

932 {
933  std::vector <QwErrDBInterface> row_list;
934  row_list.clear();
935 
936  for(size_t i=0;i<2;i++) {
937  fRelPos[i].AddErrEntriesToList(row_list);
938  fAbsPos[i].AddErrEntriesToList(row_list);
939  }
940  fEffectiveCharge.AddErrEntriesToList(row_list);
941  return row_list;
942 }
template<typename T >
UInt_t QwBPMStripline< T >::GetEventcutErrorFlag ( )
virtual

return the error flag on this channel/device

Reimplemented from VQwDataElement.

Definition at line 149 of file QwBPMStripline.cc.

References QwEnergyCalculator::GetEventcutErrorFlag().

149  {
150  Short_t i=0;
151  UInt_t error=0;
152  for(i=0;i<4;i++) error|=fWire[i].GetEventcutErrorFlag();
153  for(i=kXAxis;i<kNumAxes;i++) {
154  error|=fRelPos[i].GetEventcutErrorFlag();
155  error|=fAbsPos[i].GetEventcutErrorFlag();
156  }
157  error|=fEffectiveCharge.GetEventcutErrorFlag();
158  return error;
159 }
UInt_t GetEventcutErrorFlag()
return the error flag on this channel/device

+ Here is the call graph for this function:

template<typename T>
const VQwHardwareChannel* QwBPMStripline< T >::GetPosition ( EBeamPositionMonitorAxis  axis) const
inlinevirtual

Implements VQwBPM.

Definition at line 88 of file QwBPMStripline.h.

References VQwBPM::axis, QwBPMStripline< T >::fAbsPos, and VQwDataElement::GetElementName().

88  {
89  if (axis<0 || axis>2){
90  TString loc="QwBPMStripline::GetPosition for "
91  +this->GetElementName()+" failed for axis value "+Form("%d",axis);
92  throw std::out_of_range(loc.Data());
93  }
94  return &fAbsPos[axis];
95  }
static const TString axis[3]
Definition: VQwBPM.h:260
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

template<typename T >
VQwHardwareChannel * QwBPMStripline< T >::GetSubelementByName ( TString  ch_name)
protectedvirtual

Implements VQwBPM.

Definition at line 277 of file QwBPMStripline.cc.

References VQwDataElement::GetElementName().

278 {
279  VQwHardwareChannel* tmpptr = NULL;
280  ch_name.ToLower();
281  if (ch_name=="xp"){
282  tmpptr = &fWire[0];
283  }else if (ch_name=="xm"){
284  tmpptr = &fWire[1];
285  }else if (ch_name=="yp"){
286  tmpptr = &fWire[2];
287  }else if (ch_name=="ym"){
288  tmpptr = &fWire[3];
289  }else if (ch_name=="relx"){
290  tmpptr = &fRelPos[0];
291  }else if (ch_name=="rely"){
292  tmpptr = &fRelPos[1];
293  }else if (ch_name=="absx" || ch_name=="x" ){
294  tmpptr = &fAbsPos[0];
295  }else if (ch_name=="absy" || ch_name=="y"){
296  tmpptr = &fAbsPos[1];
297  }else if (ch_name=="effectivecharge" || ch_name=="charge"){
298  tmpptr = &fEffectiveCharge;
299  } else {
300  TString loc="QwBPMStripline::GetSubelementByName for"
301  + this->GetElementName() + " was passed "
302  + ch_name + ", which is an unrecognized subelement name.";
303  throw std::invalid_argument(loc.Data());
304  }
305  return tmpptr;
306 }
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

template<typename T >
UInt_t QwBPMStripline< T >::GetSubElementIndex ( TString  subname)
static

Definition at line 526 of file QwBPMStripline.cc.

References kInvalidSubelementIndex.

Referenced by QwBeamDetectorID::QwBeamDetectorID().

527 {
528  subname.ToUpper();
529  UInt_t localindex = kInvalidSubelementIndex;
530  for(Short_t i=0;i<4;i++) if(subname==subelement[i])localindex=i;
531 
532  if(localindex==kInvalidSubelementIndex)
533  std::cerr << "QwBPMStripline::GetSubElementIndex is unable to associate the string -"
534  <<subname<<"- to any index"<<std::endl;
535  return localindex;
536 }
static const TString subelement[4]
static const UInt_t kInvalidSubelementIndex
Definition: QwTypes.h:191

+ Here is the caller graph for this function:

template<typename T >
TString QwBPMStripline< T >::GetSubElementName ( Int_t  subindex)
virtual

Reimplemented from VQwBPM.

Definition at line 513 of file QwBPMStripline.cc.

References VQwDataElement::GetElementName().

514 {
515  TString thisname;
516  if(subindex<4&&subindex>-1)
517  thisname=fWire[subindex].GetElementName();
518  else
519  std::cerr<<"QwBPMStripline::GetSubElementName for "<<
520  GetElementName()<<" this subindex doesn't exists \n";
521 
522  return thisname;
523 }
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::IncrementErrorCounters ( )
virtual

Implements VQwBPM.

Definition at line 123 of file QwBPMStripline.cc.

References QwEnergyCalculator::IncrementErrorCounters().

124 {
125  Short_t i=0;
126 
127  for(i=0;i<4;i++) fWire[i].IncrementErrorCounters();
128  for(i=kXAxis;i<kNumAxes;i++) {
129  fRelPos[i].IncrementErrorCounters();
130  fAbsPos[i].IncrementErrorCounters();
131  }
132  fEffectiveCharge.IncrementErrorCounters();
133 }
void IncrementErrorCounters()

+ Here is the call graph for this function:

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

Definition at line 26 of file QwBPMStripline.cc.

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

Referenced by QwBPMStripline< T >::QwBPMStripline().

27 {
28  Short_t i=0;
29  Bool_t localdebug = kFALSE;
30 
31 
33 
34  for(i=kXAxis;i<kNumAxes;i++)
35  fAbsPos[i].InitializeChannel(name+kAxisLabel[i],"derived");
36 
37  fEffectiveCharge.InitializeChannel(name+"_EffectiveCharge","derived");
38 
39  for(i=0;i<4;i++) {
40  fWire[i].InitializeChannel(name+subelement[i],"raw");
41  if(localdebug)
42  std::cout<<" Wire ["<<i<<"]="<<fWire[i].GetElementName()<<"\n";
43  }
44 
45  for(i=kXAxis;i<kNumAxes;i++) fRelPos[i].InitializeChannel(name+"Rel"+kAxisLabel[i],"derived");
46 
47  bFullSave=kTRUE;
48 
49  return;
50 }
static const TString subelement[4]
static const TString kAxisLabel[2]
Definition: VQwBPM.h:239
Bool_t bFullSave
Definition: VQwBPM.h:273
void InitializeChannel(TString name)
Definition: VQwBPM.cc:25
void InitializeChannel(TString name)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 61 of file QwBPMStripline.cc.

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

62 {
63  Short_t i=0;
64  Bool_t localdebug = kFALSE;
65 
67 
68  for(i=kXAxis;i<kNumAxes;i++)
69  fAbsPos[i].InitializeChannel(subsystem, "QwBPMStripline", name+kAxisLabel[i],"derived");
70 
71  fEffectiveCharge.InitializeChannel(subsystem, "QwBPMStripline", name+"_EffectiveCharge","derived");
72 
73  for(i=0;i<4;i++) {
74  fWire[i].InitializeChannel(subsystem, "QwBPMStripline", name+subelement[i],"raw");
75  if(localdebug)
76  std::cout<<" Wire ["<<i<<"]="<<fWire[i].GetElementName()<<"\n";
77  }
78 
79  for(i=kXAxis;i<kNumAxes;i++) fRelPos[i].InitializeChannel(subsystem, "QwBPMStripline", name+"Rel"+kAxisLabel[i],"derived");
80 
81  bFullSave=kTRUE;
82 
83  return;
84 }
static const TString subelement[4]
static const TString kAxisLabel[2]
Definition: VQwBPM.h:239
Bool_t bFullSave
Definition: VQwBPM.h:273
void InitializeChannel(TString name)
Definition: VQwBPM.cc:25
void InitializeChannel(TString name)

+ Here is the call graph for this function:

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

Definition at line 53 of file QwBPMStripline.cc.

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

55 {
56  SetModuleType(type);
57  InitializeChannel(subsystem, name);
58 }
void SetModuleType(TString ModuleType)
set the type of the beam instrument
void InitializeChannel(TString name)

+ Here is the call graph for this function:

template<typename T>
void QwBPMStripline< T >::LoadChannelParameters ( QwParameterFile paramfile)
inlinevirtual

Implements VQwBPM.

Definition at line 75 of file QwBPMStripline.h.

References QwBPMStripline< T >::fWire.

75  {
76  for(Short_t i=0;i<4;i++)
77  fWire[i].LoadChannelParameters(paramfile);
78  }
void LoadChannelParameters(QwParameterFile &paramfile)
template<typename T >
void QwBPMStripline< T >::MakeBPMList ( )
private

Definition at line 899 of file QwBPMStripline.cc.

References Qw::T.

900 {
901  for(size_t i=kXAxis;i<kNumAxes;i++) {
902  T relpos(fRelPos[i]);
903  relpos = fRelPos[i]; // data
904  fBPMElementList.push_back(relpos);
905  T abspos(fAbsPos[i]);
906  abspos = fAbsPos[i]; // data
907  fBPMElementList.push_back(abspos);
908  }
909  T bpm_sub_element(fEffectiveCharge);
910  bpm_sub_element = fEffectiveCharge;
911  fBPMElementList.push_back(bpm_sub_element);
912 }
static const double T
Magnetic field: base unit is T.
Definition: QwUnits.h:111
std::vector< T > fBPMElementList
template<typename T >
VQwBPM & QwBPMStripline< T >::operator+= ( const VQwBPM value)
virtual

Implements VQwBPM.

Definition at line 578 of file QwBPMStripline.cc.

579 {
580  *(dynamic_cast<QwBPMStripline<T>*>(this)) +=
581  *(dynamic_cast<const QwBPMStripline<T>*>(&value));
582  return *this;
583 }
template<typename T >
QwBPMStripline< T > & QwBPMStripline< T >::operator+= ( const QwBPMStripline< T > &  value)
virtual

Definition at line 586 of file QwBPMStripline.cc.

References QwBPMStripline< T >::fAbsPos, QwBPMStripline< T >::fEffectiveCharge, QwBPMStripline< T >::fRelPos, QwBPMStripline< T >::fWire, and VQwDataElement::GetElementName().

587 {
588 
589  if (GetElementName()!=""){
590  Short_t i = 0;
591  this->fEffectiveCharge+=value.fEffectiveCharge;
592  for(i=0;i<4;i++) this->fWire[i]+=value.fWire[i];
593  for(i=kXAxis;i<kNumAxes;i++) {
594  this->fRelPos[i]+=value.fRelPos[i];
595  this->fAbsPos[i]+=value.fAbsPos[i];
596  }
597  }
598  return *this;
599 }
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

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

Implements VQwBPM.

Definition at line 602 of file QwBPMStripline.cc.

603 {
604  *(dynamic_cast<QwBPMStripline<T>*>(this)) -=
605  *(dynamic_cast<const QwBPMStripline<T>*>(&value));
606  return *this;
607 }
template<typename T >
QwBPMStripline< T > & QwBPMStripline< T >::operator-= ( const QwBPMStripline< T > &  value)
virtual

Definition at line 609 of file QwBPMStripline.cc.

References QwBPMStripline< T >::fAbsPos, QwBPMStripline< T >::fEffectiveCharge, QwBPMStripline< T >::fRelPos, QwBPMStripline< T >::fWire, and VQwDataElement::GetElementName().

610 {
611 
612  if (GetElementName()!=""){
613  Short_t i = 0;
614  this->fEffectiveCharge-=value.fEffectiveCharge;
615  for(i=0;i<4;i++) this->fWire[i]-=value.fWire[i];
616  for(i=kXAxis;i<kNumAxes;i++) {
617  this->fRelPos[i]-=value.fRelPos[i];
618  this->fAbsPos[i]-=value.fAbsPos[i];
619  }
620  }
621  return *this;
622 }
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

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

Implements VQwBPM.

Definition at line 552 of file QwBPMStripline.cc.

553 {
554  *(dynamic_cast<QwBPMStripline<T>*>(this)) =
555  *(dynamic_cast<const QwBPMStripline<T>*>(&value));
556  return *this;
557 }
template<typename T >
QwBPMStripline< T > & QwBPMStripline< T >::operator= ( const QwBPMStripline< T > &  value)
virtual

Definition at line 560 of file QwBPMStripline.cc.

References VQwBPM::bRotated, QwBPMStripline< T >::fAbsPos, QwBPMStripline< T >::fEffectiveCharge, QwBPMStripline< T >::fRelPos, QwBPMStripline< T >::fWire, VQwDataElement::GetElementName(), and VQwBPM::operator=().

561 {
562  VQwBPM::operator= (value);
563 
564  this->bRotated=value.bRotated;
565  if (GetElementName()!=""){
566  Short_t i = 0;
568  for(i=0;i<4;i++) this->fWire[i]=value.fWire[i];
569  for(i=kXAxis;i<kNumAxes;i++) {
570  this->fRelPos[i]=value.fRelPos[i];
571  this->fAbsPos[i]=value.fAbsPos[i];
572  }
573  }
574  return *this;
575 }
Bool_t bRotated
Definition: VQwBPM.h:263
virtual const TString & GetElementName() const
Get the name of this element.
virtual VQwBPM & operator=(const VQwBPM &value)=0
Definition: VQwBPM.cc:115

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::PrintErrorCounters ( ) const
virtual

report number of events failed due to HW and event cut failure

Reimplemented from VQwBPM.

Definition at line 136 of file QwBPMStripline.cc.

References QwEnergyCalculator::PrintErrorCounters().

137 {
138  Short_t i=0;
139 
140  for(i=0;i<4;i++) fWire[i].PrintErrorCounters();
141  for(i=kXAxis;i<kNumAxes;i++) {
142  fRelPos[i].PrintErrorCounters();
143  fAbsPos[i].PrintErrorCounters();
144  }
145  fEffectiveCharge.PrintErrorCounters();
146 }
void PrintErrorCounters() const
report number of events failed due to HW and event cut failure

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::PrintInfo ( ) const
virtual

Print multiple lines of information about this data element.

Reimplemented from VQwBPM.

Definition at line 500 of file QwBPMStripline.cc.

References PrintInfo().

501 {
502  Short_t i = 0;
503  for (i = 0; i < 4; i++) fWire[i].PrintInfo();
504  for (i = 0; i < 2; i++) {
505  fRelPos[i].PrintInfo();
506  fAbsPos[i].PrintInfo();
507  }
508  fEffectiveCharge.PrintInfo();
509 }
void PrintInfo() const
Print multiple lines of information about this data element.

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::PrintValue ( ) const
virtual

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

Reimplemented from VQwDataElement.

Definition at line 476 of file QwBPMStripline.cc.

477 {
478  for (Short_t i = 0; i < 2; i++) {
479  fAbsPos[i].PrintValue();
480  fRelPos[i].PrintValue();
481  }
482  return;
483 }
template<typename T >
Int_t QwBPMStripline< T >::ProcessEvBuffer ( UInt_t *  buffer,
UInt_t  num_words_left,
UInt_t  subelement 
)
virtual

Process the CODA event buffer for this element.

Implements VQwDataElement.

Definition at line 459 of file QwBPMStripline.cc.

460 {
461  if(index<4)
462  {
463  fWire[index].ProcessEvBuffer(buffer,word_position_in_buffer);
464  }
465  else
466  {
467  std::cerr <<
468  "QwBPMStripline::ProcessEvBuffer(): attemp to fill in raw date for a wire that doesn't exist \n";
469  }
470  return word_position_in_buffer;
471 }
template<typename T >
void QwBPMStripline< T >::ProcessEvent ( )
virtual

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 derrived devices.

To obtain the beam position in X and Y in the CEBAF coordinates, we use the following equations

                                                        (XP - AlphaX XM)

RelX (bpm coordinates) = fQwStriplineCalibration x GainX x -------------— (XP + AlphaX XM)

(YP - AplhaY YM) RelY (bpm coordinates) = fQwStriplineCalibration x GainY x -------------— (YP + AlphaY YM)

To get back to accelerator coordinates, rotate anti-clockwise around +Z by phi degrees (angle w.r.t X axis).

RelX (accelarator coordinates) = cos(phi) RelX - sin(phi)RelY

RelY (accelarator coordinates) = sin(phi) RelX + cos(Phi)RelY

Implements VQwBPM.

Definition at line 365 of file QwBPMStripline.cc.

References QwEnergyCalculator::ApplyHWChecks(), VQwDataElement::fElementName, and Qw::T.

366 {
367  Bool_t localdebug = kFALSE;
368  static T numer("numerator","derived"), denom("denominator","derived");
369  static T tmp1("tmp1","derived"), tmp2("tmp2","derived");
370  static T rawpos[2] = {T("rawpos_0","derived"),T("rawpos_1","derived")};
371 
372  Short_t i = 0;
373 
374  ApplyHWChecks();
375  /**First apply HW checks and update HW error flags.
376  Calling this routine here and not in ApplySingleEventCuts
377  makes a difference for a BPMs because they have derrived devices.
378  */
379 
380  fEffectiveCharge.ClearEventData();
381 
382  for(i=0;i<4;i++)
383  {
384  fWire[i].ProcessEvent();
386  }
387 
388 
389  /**
390  To obtain the beam position in X and Y in the CEBAF coordinates, we use the following equations
391 
392  (XP - AlphaX XM)
393  RelX (bpm coordinates) = fQwStriplineCalibration x GainX x ----------------
394  (XP + AlphaX XM)
395 
396  (YP - AplhaY YM)
397  RelY (bpm coordinates) = fQwStriplineCalibration x GainY x ----------------
398  (YP + AlphaY YM)
399 
400  To get back to accelerator coordinates, rotate anti-clockwise around +Z by phi degrees (angle w.r.t X axis).
401 
402  RelX (accelarator coordinates) = cos(phi) RelX - sin(phi)RelY
403 
404  RelY (accelarator coordinates) = sin(phi) RelX + cos(Phi)RelY
405 
406  */
407 
408  for(i=kXAxis;i<kNumAxes;i++)
409  {
410  fWire[i*2+1].Scale(fRelativeGains[i]);
411  numer.Difference(fWire[i*2],fWire[i*2+1]);
412  denom.Sum(fWire[i*2],fWire[i*2+1]);
413  rawpos[i].Ratio(numer,denom);
414  rawpos[i].Scale(fQwStriplineCalibration);
415 
416  if(localdebug)
417  {
418  std::cout<<" stripline name="<<fElementName<<std::endl;
419  // std::cout<<" event number= "<<fWire[i*2].GetSequenceNumber()<<std::endl;
420  std::cout<<" hw Wire["<<i*2<<"]="<<fWire[i*2].GetValue()<<" ";
421  std::cout<<" hw relative gain * Wire["<<i*2+1<<"]="<<fWire[i*2+1].GetValue()<<"\n";
422  std::cout<<" Relative gain["<<i<<"]="<<fRelativeGains[i]<<"\n";
423  std::cout<<" hw numerator= "<<numer.GetValue()<<" ";
424  std::cout<<" hw denominator= "<<denom.GetValue()<<"\n";
425  std::cout<<" Rotation = "<<fRotationAngle<<std::endl;
426  }
427  }
428 
429  for(i=kXAxis;i<kNumAxes;i++){
430  tmp1.AssignScaledValue(rawpos[i], fCosRotation);
431  tmp2.AssignScaledValue(rawpos[1-i], fSinRotation);
432  if (i == kXAxis) {
433  fRelPos[i].Difference(tmp1,tmp2);
434  } else {
435  fRelPos[i].Sum(tmp1,tmp2);
436  }
437  }
438 
439 
440  for(i=kXAxis;i<kNumAxes;i++){
441  fAbsPos[i] = fRelPos[i];
442  fAbsPos[i].AddChannelOffset(fPositionCenter[i]);
443  fAbsPos[i].Scale(1.0/fGains[i]);
444 
445  if(localdebug)
446  {
447  std::cout<<" hw fRelPos["<<kAxisLabel[i]<<"]="<<fRelPos[i].GetValue()<<"\n";
448  std::cout<<" hw fOffset["<<kAxisLabel[i]<<"]="<<fPositionCenter[i]<<"\n";
449  std::cout<<" hw fAbsPos["<<kAxisLabel[i]<<"]="<<fAbsPos[i].GetValue()<<"\n \n";
450  }
451 
452  }
453 
454  return;
455 }
Double_t fQwStriplineCalibration
Definition: VQwBPM.h:257
Double_t fRelativeGains[2]
Definition: VQwBPM.h:258
Double_t fGains[2]
Definition: VQwBPM.h:259
Double_t fRotationAngle
Definition: VQwBPM.h:264
Double_t fPositionCenter[3]
Definition: VQwBPM.h:256
static const TString kAxisLabel[2]
Definition: VQwBPM.h:239
Double_t fCosRotation
Definition: VQwBPM.h:265
static const double T
Magnetic field: base unit is T.
Definition: QwUnits.h:111
Bool_t ApplyHWChecks()
Double_t fSinRotation
Definition: VQwBPM.h:266
TString fElementName
Name of this data element.

+ Here is the call graph for this function:

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

Reimplemented from VQwBPM.

Definition at line 987 of file QwBPMStripline.cc.

988 {
989  for (Short_t i=0; i<4; i++) fWire[i].RandomizeEventData(helicity, time);
990 
991  return;
992 }
void RandomizeEventData(int helicity=0, double time=0.0)
template<typename T >
void QwBPMStripline< T >::Ratio ( VQwBPM numer,
VQwBPM denom 
)
virtual

Reimplemented from VQwBPM.

Definition at line 625 of file QwBPMStripline.cc.

References QwEnergyCalculator::Ratio().

Referenced by QwBPMStripline< T >::Ratio().

626 {
627  Ratio(*dynamic_cast<QwBPMStripline<T>*>(&numer),
628  *dynamic_cast<QwBPMStripline<T>*>(&denom));
629 }
void Ratio(VQwBPM &numer, VQwBPM &denom)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 632 of file QwBPMStripline.cc.

References QwBPMStripline< T >::fEffectiveCharge, and QwBPMStripline< T >::Ratio().

633 {
634  // this function is called when forming asymmetries. In this case waht we actually want for the
635  // stripline is the difference only not the asymmetries
636 
637  *this=numer;
638  this->fEffectiveCharge.Ratio(numer.fEffectiveCharge,denom.fEffectiveCharge);
639  return;
640 }

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::Scale ( Double_t  factor)
virtual

Reimplemented from VQwBPM.

Definition at line 645 of file QwBPMStripline.cc.

References QwEnergyCalculator::Scale().

646 {
647  Short_t i = 0;
648  fEffectiveCharge.Scale(factor);
649 
650  for(i=0;i<4;i++) fWire[i].Scale(factor);
651  for(Short_t i=kXAxis;i<kNumAxes;i++){
652  fRelPos[i].Scale(factor);
653  fAbsPos[i].Scale(factor);
654  }
655  return;
656 }
void Scale(Double_t factor)

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::SetDefaultSampleSize ( Int_t  sample_size)
virtual

Reimplemented from VQwBPM.

Definition at line 1015 of file QwBPMStripline.cc.

1016 {
1017  for(Short_t i=0;i<4;i++) fWire[i].SetDefaultSampleSize((size_t)sample_size);
1018  return;
1019 }
void SetDefaultSampleSize(Int_t sample_size)
template<typename T >
void QwBPMStripline< T >::SetEventCutMode ( Int_t  bcuts)
virtual

Implements VQwBPM.

Definition at line 885 of file QwBPMStripline.cc.

References QwEnergyCalculator::SetEventCutMode().

886 {
887  Short_t i = 0;
888  // bEVENTCUTMODE=bcuts;
889  for (i=0;i<4;i++) fWire[i].SetEventCutMode(bcuts);
890  for (i=kXAxis;i<kNumAxes;i++) {
891  fRelPos[i].SetEventCutMode(bcuts);
892  fAbsPos[i].SetEventCutMode(bcuts);
893  }
894  fEffectiveCharge.SetEventCutMode(bcuts);
895 }
void SetEventCutMode(Int_t bcuts)

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::SetEventData ( Double_t *  block,
UInt_t  sequencenumber 
)
private

Definition at line 996 of file QwBPMStripline.cc.

997 {
998  for (Short_t i=0; i<2; i++)
999  {
1000  //fRelPos[i].SetHardwareSum(relpos[i], sequencenumber);
1001  }
1002 
1003  return;
1004 }
template<typename T >
void QwBPMStripline< T >::SetRandomEventParameters ( Double_t  meanX,
Double_t  sigmaX,
Double_t  meanY,
Double_t  sigmaY 
)
virtual

Reimplemented from VQwBPM.

Definition at line 951 of file QwBPMStripline.cc.

952 {
953  // Average values of the signals in the stripline ADCs
954  Double_t sumX = 1.1e8; // These are just guesses, but I made X and Y different
955  Double_t sumY = 0.9e8; // to make it more interesting for the analyzer...
956 
957  // Rotate the requested position if necessary (this is not tested yet)
958  if (bRotated) {
959  Double_t rotated_meanX = (meanX*fCosRotation - meanY*fSinRotation);// / fRotationCorrection;
960  Double_t rotated_meanY = (meanX*fSinRotation + meanY*fCosRotation);// / fRotationCorrection;
961  meanX = rotated_meanX;
962  meanY = rotated_meanY;
963  }
964 
965  // Determine the asymmetry from the position
966  Double_t meanXP = (1.0 + meanX / fQwStriplineCalibration) * sumX / 2.0;
967  Double_t meanXM = (1.0 - meanX / fQwStriplineCalibration) * sumX / 2.0; // = sumX - meanXP;
968  Double_t meanYP = (1.0 + meanY / fQwStriplineCalibration) * sumY / 2.0;
969  Double_t meanYM = (1.0 - meanY / fQwStriplineCalibration) * sumY / 2.0; // = sumY - meanYP;
970 
971  // Determine the spread of the asymmetry (this is not tested yet)
972  // (negative sigma should work in the QwVQWK_Channel, but still using fabs)
973  Double_t sigmaXP = fabs(sumX * sigmaX / meanX);
974  Double_t sigmaXM = sigmaXP;
975  Double_t sigmaYP = fabs(sumY * sigmaY / meanY);
976  Double_t sigmaYM = sigmaYP;
977 
978  // Propagate these parameters to the ADCs
979  fWire[0].SetRandomEventParameters(meanXP, sigmaXP);
980  fWire[1].SetRandomEventParameters(meanXM, sigmaXM);
981  fWire[2].SetRandomEventParameters(meanYP, sigmaYP);
982  fWire[3].SetRandomEventParameters(meanYM, sigmaYM);
983 }
Double_t fQwStriplineCalibration
Definition: VQwBPM.h:257
Bool_t bRotated
Definition: VQwBPM.h:263
Double_t fCosRotation
Definition: VQwBPM.h:265
Double_t fSinRotation
Definition: VQwBPM.h:266
template<typename T >
void QwBPMStripline< T >::SetSubElementCalibrationFactor ( Int_t  j,
Double_t  value 
)
virtual

Reimplemented from VQwBPM.

Definition at line 1030 of file QwBPMStripline.cc.

1031 {
1032  fWire[j].SetCalibrationFactor(value);
1033  return;
1034 }
template<typename T >
void QwBPMStripline< T >::SetSubElementPedestal ( Int_t  j,
Double_t  value 
)
virtual

Reimplemented from VQwBPM.

Definition at line 1023 of file QwBPMStripline.cc.

1024 {
1025  fWire[j].SetPedestal(value);
1026  return;
1027 }
template<typename T >
UInt_t QwBPMStripline< T >::UpdateErrorFlag ( )
virtual

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

Implements VQwBPM.

Definition at line 162 of file QwBPMStripline.cc.

Referenced by QwBPMStripline< T >::UpdateErrorFlag().

163 {
164  Short_t i=0;
165  UInt_t error1=0;
166  UInt_t error2=0;
167  for(i=0;i<4;i++){
168  error1 |= fWire[i].GetErrorCode();
169  error2 |= fWire[i].GetEventcutErrorFlag();
170  }
171  for(i=kXAxis;i<kNumAxes;i++) {
172  fRelPos[i].UpdateErrorFlag(error1);
173  fAbsPos[i].UpdateErrorFlag(error1);
174  error2|=fRelPos[i].GetEventcutErrorFlag();
175  error2|=fAbsPos[i].GetEventcutErrorFlag();
176  }
177  fEffectiveCharge.UpdateErrorFlag(error1);
178  error2|=fEffectiveCharge.GetEventcutErrorFlag();
179  return error2;
180 };

+ Here is the caller graph for this function:

template<typename T >
void QwBPMStripline< T >::UpdateErrorFlag ( const VQwBPM ev_error)
virtual

Implements VQwBPM.

Definition at line 184 of file QwBPMStripline.cc.

References Qw::e, QwBPMStripline< T >::fAbsPos, QwBPMStripline< T >::fEffectiveCharge, QwBPMStripline< T >::fRelPos, QwBPMStripline< T >::fWire, VQwDataElement::GetElementName(), and QwBPMStripline< T >::UpdateErrorFlag().

184  {
185  Short_t i=0;
186  try {
187  if(typeid(*ev_error)==typeid(*this)) {
188  // std::cout<<" Here in QwBPMStripline::UpdateErrorFlag \n";
189  if (this->GetElementName()!="") {
190  const QwBPMStripline<T>* value_bpm = dynamic_cast<const QwBPMStripline<T>* >(ev_error);
191  for(i=0;i<4;i++){
192  fWire[i].UpdateErrorFlag(value_bpm->fWire[i]);
193  }
194  for(i=kXAxis;i<kNumAxes;i++) {
195  fRelPos[i].UpdateErrorFlag(value_bpm->fRelPos[i]);
196  fAbsPos[i].UpdateErrorFlag(value_bpm->fAbsPos[i]);
197  }
198  fEffectiveCharge.UpdateErrorFlag(value_bpm->fEffectiveCharge);
199  }
200  } else {
201  TString loc="Standard exception from QwBPMStripline::UpdateErrorFlag :"+
202  ev_error->GetElementName()+" "+this->GetElementName()+" are not of the "
203  +"same type";
204  throw std::invalid_argument(loc.Data());
205  }
206  } catch (std::exception& e) {
207  std::cerr<< e.what()<<std::endl;
208  }
209 };
static const double e
Definition: QwUnits.h:91
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

template<typename T >
void QwBPMStripline< T >::WritePromptSummary ( QwPromptSummary ps,
TString  type 
)

Definition at line 487 of file QwBPMStripline.cc.

References QwLog::endl(), and QwMessage.

488 {
489 
490  QwMessage << "void QwBPMStripline<T>::WritePromptSummary() const test " << QwLog::endl;
491  // for (Short_t i = 0; i < 2; i++) {
492  // fAbsPos[i].PrintValue();
493  // fRelPos[i].PrintValue();
494  // }
495  return;
496 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

Friends And Related Function Documentation

template<typename T>
template<typename TT >
friend class QwCombinedBPM
friend

Definition at line 34 of file QwBPMStripline.h.

template<typename T>
friend class QwEnergyCalculator
friend

Definition at line 35 of file QwBPMStripline.h.

Field Documentation

template<typename T>
std::vector<T> QwBPMStripline< T >::fBPMElementList
private

Definition at line 181 of file QwBPMStripline.h.

template<typename T>
const Double_t QwBPMStripline< T >::kRotationCorrection
staticprivate

Definition at line 164 of file QwBPMStripline.h.

template<typename T>
const TString QwBPMStripline< T >::subelement ={"XP","XM","YP","YM"}
staticprivate

Definition at line 165 of file QwBPMStripline.h.


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