QwAnalysis
QwEnergyCalculator Class Reference

#include <QwEnergyCalculator.h>

+ Inheritance diagram for QwEnergyCalculator:
+ Collaboration diagram for QwEnergyCalculator:

Public Member Functions

 QwEnergyCalculator ()
 
 QwEnergyCalculator (TString name)
 
 QwEnergyCalculator (TString subsystem, TString name)
 
 QwEnergyCalculator (const QwEnergyCalculator &source)
 
virtual ~QwEnergyCalculator ()
 
void InitializeChannel (TString name, TString datatosave)
 
void InitializeChannel (TString subsystem, TString name, TString datatosave)
 
void LoadChannelParameters (QwParameterFile &paramfile)
 
void ClearEventData ()
 Clear the event data in this element. More...
 
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 SetRootSaveStatus (TString &prefix)
 
Bool_t ApplyHWChecks ()
 
Bool_t ApplySingleEventCuts ()
 
Int_t SetSingleEventCuts (Double_t mean, Double_t sigma)
 
void SetSingleEventCuts (UInt_t errorflag, Double_t min, Double_t max, Double_t stability)
 Inherited from VQwDataElement to set the upper and lower limits (fULimit and fLLimit), stability % and the error flag on this channel. More...
 
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 QwEnergyCalculator *ev_error)
 
void Set (const VQwBPM *device, TString type, TString property, Double_t tmatrix_ratio)
 
void Ratio (QwEnergyCalculator &numer, QwEnergyCalculator &denom)
 
void Scale (Double_t factor)
 
virtual QwEnergyCalculatoroperator= (const QwEnergyCalculator &value)
 
virtual QwEnergyCalculatoroperator+= (const QwEnergyCalculator &value)
 
virtual QwEnergyCalculatoroperator-= (const QwEnergyCalculator &value)
 
void AccumulateRunningSum (const QwEnergyCalculator &value)
 
void DeaccumulateRunningSum (QwEnergyCalculator &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 &trim_file)
 
void FillTreeVector (std::vector< Double_t > &values) const
 
VQwHardwareChannelGetEnergy ()
 
const VQwHardwareChannelGetEnergy () const
 
std::vector< QwDBInterfaceGetDBEntry ()
 
std::vector< QwErrDBInterfaceGetErrDBEntry ()
 
- 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 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...
 

Protected Attributes

QwVQWK_Channel fEnergyChange
 
- 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 Attributes

std::vector< const VQwBPM * > fDevice
 
std::vector< Double_t > fTMatrixRatio
 
std::vector< TString > fProperty
 
std::vector< TString > fType
 
Int_t fDeviceErrorCode
 
Bool_t bEVENTCUTMODE
 
Bool_t bFullSave
 

Additional Inherited Members

- Public Types inherited from VQwDataElement
enum  EDataToSave { kRaw = 0, kDerived }
 
- 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...
 

Detailed Description

Definition at line 27 of file QwEnergyCalculator.h.

Constructor & Destructor Documentation

QwEnergyCalculator::QwEnergyCalculator ( )
inline

Definition at line 39 of file QwEnergyCalculator.h.

39 { };
QwEnergyCalculator::QwEnergyCalculator ( TString  name)
inline

Definition at line 40 of file QwEnergyCalculator.h.

References InitializeChannel().

40  {
41  InitializeChannel(name,"derived");
42  };
void InitializeChannel(TString name, TString datatosave)

+ Here is the call graph for this function:

QwEnergyCalculator::QwEnergyCalculator ( TString  subsystem,
TString  name 
)
inline

Definition at line 43 of file QwEnergyCalculator.h.

References InitializeChannel().

43  {
44  InitializeChannel(subsystem, name,"derived");
45  };
void InitializeChannel(TString name, TString datatosave)

+ Here is the call graph for this function:

QwEnergyCalculator::QwEnergyCalculator ( const QwEnergyCalculator source)
inline

Definition at line 46 of file QwEnergyCalculator.h.

48  { }
VQwDataElement()
Default constructor.
QwVQWK_Channel fEnergyChange
virtual QwEnergyCalculator::~QwEnergyCalculator ( )
inlinevirtual

Definition at line 49 of file QwEnergyCalculator.h.

49 { };

Member Function Documentation

void QwEnergyCalculator::AccumulateRunningSum ( const QwEnergyCalculator value)

Definition at line 156 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::AccumulateRunningSum(), and fEnergyChange.

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

156  {
158 }
QwVQWK_Channel fEnergyChange
void AccumulateRunningSum(const QwVQWK_Channel &value)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Bool_t QwEnergyCalculator::ApplyHWChecks ( )

Definition at line 220 of file QwEnergyCalculator.cc.

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

220  {
221  // For the energy calculator there are no physical channels that we can relate to because it is being
222  // derived from combinations of physical channels. Therefore, this is not exactly a "HW Check"
223  // but just a check of the HW checks of the used channels.
224 
225  Bool_t eventokay=kTRUE;
226  return eventokay;
227 }

+ Here is the caller graph for this function:

Bool_t QwEnergyCalculator::ApplySingleEventCuts ( )

Definition at line 97 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::ApplySingleEventCuts(), fDevice, fEnergyChange, fProperty, and VQwBPM::kXAxis.

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

97  {
98  Bool_t status=kTRUE;
99 
100  UInt_t error_code = 0;
101  for(UInt_t i = 0; i<fProperty.size(); i++){
102  if(fProperty[i].Contains("targetbeamangle")){
103  error_code |= ((QwCombinedBPM<QwVQWK_Channel>*)fDevice[i])->fSlope[0].GetErrorCode();
104  } else {
105  error_code |= fDevice[i]->GetPosition(VQwBPM::kXAxis)->GetErrorCode();
106  }
107  }
108  //fEnergyChange.UpdateErrorFlag(error_code);//No need to do this. error codes are ORed when energy is calculated
109 
111  status=kTRUE;
112  }
113  else{
114  status&=kFALSE;
115  }
116  return status;
117 }
std::vector< const VQwBPM * > fDevice
std::vector< TString > fProperty
Bool_t ApplySingleEventCuts(Double_t LL, Double_t UL)
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::CalculateRunningAverage ( )

Definition at line 150 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::CalculateRunningAverage(), and fEnergyChange.

150  {
152 }
void CalculateRunningAverage()
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

void QwEnergyCalculator::ClearEventData ( )
virtual

Clear the event data in this element.

Reimplemented from VQwDataElement.

Definition at line 60 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::ClearEventData(), and fEnergyChange.

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

60  {
62  return;
63 }
void ClearEventData()
Clear the event data in this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 286 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::ConstructBranch(), fEnergyChange, VQwDataElement::GetElementName(), and SetRootSaveStatus().

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

286  {
287  if (GetElementName()==""){
288  // This channel is not used, so skip filling the histograms.
289  }
290  else{
291  TString thisprefix=prefix;
292  if(prefix=="asym_")
293  thisprefix="diff_";
294 
295  SetRootSaveStatus(thisprefix);
296  fEnergyChange.ConstructBranch(tree,thisprefix);
297  }
298  return;
299 }
void SetRootSaveStatus(TString &prefix)
void ConstructBranch(TTree *tree, TString &prefix)
virtual const TString & GetElementName() const
Get the name of this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::ConstructBranch ( TTree *  tree,
TString &  prefix,
QwParameterFile trim_file 
)

Definition at line 301 of file QwEnergyCalculator.cc.

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

301  {
302 
303  TString devicename;
304  devicename=GetElementName();
305  devicename.ToLower();
306  if (GetElementName()==""){
307  // This channel is not used, so skip filling the histograms.
308  }
309  else
310  if (modulelist.HasValue(devicename)){
311  TString thisprefix=prefix;
312  if(prefix=="asym_")
313  thisprefix="diff_";
314  SetRootSaveStatus(thisprefix);
315  fEnergyChange.ConstructBranch(tree,thisprefix);
316  QwMessage <<" Tree leave added to "<<devicename<<QwLog::endl;
317  }
318  return;
319 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void SetRootSaveStatus(TString &prefix)
void ConstructBranch(TTree *tree, TString &prefix)
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
virtual const TString & GetElementName() const
Get the name of this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

void QwEnergyCalculator::ConstructBranchAndVector ( TTree *  tree,
TString &  prefix,
std::vector< Double_t > &  values 
)

Definition at line 267 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::ConstructBranchAndVector(), fEnergyChange, VQwDataElement::GetElementName(), and SetRootSaveStatus().

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

268  {
269  if (GetElementName()==""){
270  // This channel is not used, so skip filling the histograms.
271  }
272  else{
273  TString thisprefix=prefix;
274  if(prefix=="asym_")
275  thisprefix="diff_";
276 
277  SetRootSaveStatus(thisprefix);
278 
279  fEnergyChange.ConstructBranchAndVector(tree,thisprefix,values);
280  }
281  return;
282 }
void SetRootSaveStatus(TString &prefix)
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
virtual const TString & GetElementName() const
Get the name of this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::ConstructHistograms ( TDirectory *  folder,
TString &  prefix 
)
virtual

Construct the histograms for this data element.

Implements VQwDataElement.

Definition at line 243 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::ConstructHistograms(), fEnergyChange, VQwDataElement::GetElementName(), and SetRootSaveStatus().

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

243  {
244  if (GetElementName()==""){
245  // This channel is not used, so skip filling the histograms.
246  }
247  else{
248  TString thisprefix=prefix;
249  if(prefix=="asym_")
250  thisprefix="diff_";
251  SetRootSaveStatus(thisprefix);
252  fEnergyChange.ConstructHistograms(folder, thisprefix);
253  }
254  return;
255 }
void SetRootSaveStatus(TString &prefix)
void ConstructHistograms(TDirectory *folder, TString &prefix)
Construct the histograms for this data element.
virtual const TString & GetElementName() const
Get the name of this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::DeaccumulateRunningSum ( QwEnergyCalculator value)

Definition at line 160 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::DeaccumulateRunningSum(), and fEnergyChange.

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

160  {
162 }
void DeaccumulateRunningSum(const QwVQWK_Channel &value)
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::FillHistograms ( )
virtual

Fill the histograms for this data element.

Implements VQwDataElement.

Definition at line 257 of file QwEnergyCalculator.cc.

References fEnergyChange, QwVQWK_Channel::FillHistograms(), and VQwDataElement::GetElementName().

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

257  {
258  if (GetElementName()==""){
259  // This channel is not used, so skip filling the histograms.
260  }
261  else
263 
264  return;
265 }
void FillHistograms()
Fill the histograms for this data element.
virtual const TString & GetElementName() const
Get the name of this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::FillTreeVector ( std::vector< Double_t > &  values) const

Definition at line 321 of file QwEnergyCalculator.cc.

References fEnergyChange, QwVQWK_Channel::FillTreeVector(), and VQwDataElement::GetElementName().

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

322 {
323  if (GetElementName()==""){
324  // This channel is not used, so skip filling the histograms.
325  }
326  else
328  return;
329 }
void FillTreeVector(std::vector< Double_t > &values) const
virtual const TString & GetElementName() const
Get the name of this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 332 of file QwEnergyCalculator.cc.

References VQwHardwareChannel::AddEntriesToList(), and fEnergyChange.

333 {
334  std::vector <QwDBInterface> row_list;
335  row_list.clear();
337  return row_list;
338 
339 }
void AddEntriesToList(std::vector< QwDBInterface > &row_list)
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

VQwHardwareChannel* QwEnergyCalculator::GetEnergy ( )
inline

Definition at line 104 of file QwEnergyCalculator.h.

References fEnergyChange.

Referenced by GetEnergy().

104  {
105  return &fEnergyChange;
106  };
QwVQWK_Channel fEnergyChange

+ Here is the caller graph for this function:

const VQwHardwareChannel* QwEnergyCalculator::GetEnergy ( ) const
inline

Definition at line 108 of file QwEnergyCalculator.h.

References GetEnergy().

108  {
109  return const_cast<QwEnergyCalculator*>(this)->GetEnergy();
110  };
VQwHardwareChannel * GetEnergy()

+ Here is the call graph for this function:

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

Definition at line 341 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::AddErrEntriesToList(), and fEnergyChange.

342 {
343  std::vector <QwErrDBInterface> row_list;
344  row_list.clear();
346  return row_list;
347 }
void AddErrEntriesToList(std::vector< QwErrDBInterface > &row_list)
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

UInt_t QwEnergyCalculator::GetEventcutErrorFlag ( )
inlinevirtual

return the error flag on this channel/device

Reimplemented from VQwDataElement.

Definition at line 76 of file QwEnergyCalculator.h.

References fEnergyChange, and VQwDataElement::GetEventcutErrorFlag().

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

76  {//return the error flag
78  }
virtual UInt_t GetEventcutErrorFlag()
return the error flag on this channel/device
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::IncrementErrorCounters ( )

Definition at line 119 of file QwEnergyCalculator.cc.

References fEnergyChange, and QwVQWK_Channel::IncrementErrorCounters().

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

120 {
122 }
void IncrementErrorCounters()
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::InitializeChannel ( TString  name,
TString  datatosave 
)

Definition at line 21 of file QwEnergyCalculator.cc.

References fEnergyChange, QwVQWK_Channel::InitializeChannel(), and VQwDataElement::SetElementName().

Referenced by QwBPMStripline< T >::InitializeChannel(), and QwEnergyCalculator().

22 {
23  SetElementName(name);
24  fEnergyChange.InitializeChannel(name,datatosave);
25  // beamx.InitializeChannel("beamx","derived");
26  return;
27 }
void SetElementName(const TString &name)
Set the name of this element.
void InitializeChannel(TString name, TString datatosave)
Initialize the fields in this object.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::InitializeChannel ( TString  subsystem,
TString  name,
TString  datatosave 
)

Definition at line 29 of file QwEnergyCalculator.cc.

References fEnergyChange, QwVQWK_Channel::InitializeChannel(), and VQwDataElement::SetElementName().

30 {
31  SetElementName(name);
32  fEnergyChange.InitializeChannel(subsystem, "QwEnergyCalculator", name,datatosave);
33  // beamx.InitializeChannel("beamx","derived");
34  return;
35 }
void SetElementName(const TString &name)
Set the name of this element.
void InitializeChannel(TString name, TString datatosave)
Initialize the fields in this object.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

void QwEnergyCalculator::LoadChannelParameters ( QwParameterFile paramfile)
inlinevirtual

Reimplemented from VQwDataElement.

Definition at line 55 of file QwEnergyCalculator.h.

55 {};
QwEnergyCalculator & QwEnergyCalculator::operator+= ( const QwEnergyCalculator value)
virtual

Definition at line 178 of file QwEnergyCalculator.cc.

References fEnergyChange, and VQwDataElement::GetElementName().

178  {
179 
180  if (GetElementName()!="")
181  this->fEnergyChange+=value.fEnergyChange;
182 
183  return *this;
184 }
virtual const TString & GetElementName() const
Get the name of this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

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

Definition at line 186 of file QwEnergyCalculator.cc.

References fEnergyChange, and VQwDataElement::GetElementName().

186  {
187  if (GetElementName()!="")
188  this->fEnergyChange-=value.fEnergyChange;
189 
190  return *this;
191 }
virtual const TString & GetElementName() const
Get the name of this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

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

Definition at line 171 of file QwEnergyCalculator.cc.

References fEnergyChange, and VQwDataElement::GetElementName().

171  {
172  if (GetElementName()!="")
173  this->fEnergyChange=value.fEnergyChange;
174 
175  return *this;
176 }
virtual const TString & GetElementName() const
Get the name of this element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

void QwEnergyCalculator::PrintErrorCounters ( ) const
virtual

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

Reimplemented from VQwDataElement.

Definition at line 125 of file QwEnergyCalculator.cc.

References fEnergyChange, and QwVQWK_Channel::PrintErrorCounters().

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

125  {
126  // report number of events failed due to HW and event cut faliure
128 }
void PrintErrorCounters() const
report number of events failed due to HW and event cut failure
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::PrintInfo ( ) const
virtual

Print multiple lines of information about this data element.

Reimplemented from VQwDataElement.

Definition at line 209 of file QwEnergyCalculator.cc.

References fEnergyChange, and QwVQWK_Channel::PrintInfo().

209  {
211  return;
212 }
void PrintInfo() const
Print multiple lines of information about this data element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

void QwEnergyCalculator::PrintValue ( ) const
virtual

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

Reimplemented from VQwDataElement.

Definition at line 215 of file QwEnergyCalculator.cc.

References fEnergyChange, and QwVQWK_Channel::PrintValue().

215  {
217  return;
218 }
void PrintValue() const
Print single line of value and error of this data element.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

Int_t QwEnergyCalculator::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 166 of file QwEnergyCalculator.cc.

166  {
167  return 0;
168 }
void QwEnergyCalculator::ProcessEvent ( )

Definition at line 67 of file QwEnergyCalculator.cc.

References QwVQWK_Channel::AddChannelOffset(), QwVQWK_Channel::AssignValueFrom(), QwVQWK_Channel::ClearEventData(), fDevice, fEnergyChange, fProperty, fTMatrixRatio, QwVQWK_Channel::GetValue(), QwVQWK_Channel::InitializeChannel(), VQwBPM::kXAxis, and QwVQWK_Channel::Scale().

67  {
68 
69  Bool_t ldebug = kFALSE;
70  Double_t targetbeamangle = 0;
71 
72  static QwVQWK_Channel tmp;
73  tmp.InitializeChannel("tmp","derived");
74  tmp.ClearEventData();
75 
76  for(UInt_t i = 0; i<fProperty.size(); i++){
77  if(fProperty[i].Contains("targetbeamangle")){
78  targetbeamangle = atan((((QwCombinedBPM<QwVQWK_Channel>*)fDevice[i])->fSlope[VQwBPM::kXAxis]).GetValue());
79  targetbeamangle *= fTMatrixRatio[i];
80  if(ldebug) std::cout<<"QwEnegyCalculator::ProcessEvent() :: Beam angle in X at target = "<<targetbeamangle<<std::endl;
81  fEnergyChange.AddChannelOffset(targetbeamangle);
82  if(ldebug) std::cout<<"QwEnegyCalculator::ProcessEvent() :: dp/p += (M12/M16)*X angle = "<<fEnergyChange.GetValue()<<std::endl;
83  }
84  else {
85  tmp.AssignValueFrom(fDevice[i]->GetPosition(VQwBPM::kXAxis));
86  if(ldebug) std::cout<<"QwEnegyCalculator::ProcessEvent() :: X position from "<<fDevice[i]->GetElementName()<<" = "<<tmp.GetValue()<<std::endl;
87  tmp.Scale(fTMatrixRatio[i]);
88  if(ldebug) std::cout<<"QwEnegyCalculator::ProcessEvent() :: (M11/M16)*X position = "<<tmp.GetValue()<<std::endl;
89  fEnergyChange += tmp;
90  }
91  }
92  if(ldebug) std::cout<<"QwEnegyCalculator::ProcessEvent() :: dp/p = "<<fEnergyChange.GetValue()<<std::endl;
93  return;
94 }
void AssignValueFrom(const VQwDataElement *valueptr)
std::vector< const VQwBPM * > fDevice
Double_t GetValue(size_t element) const
void Scale(Double_t Offset)
std::vector< TString > fProperty
std::vector< Double_t > fTMatrixRatio
void ClearEventData()
Clear the event data in this element.
void InitializeChannel(TString name, TString datatosave)
Initialize the fields in this object.
void AddChannelOffset(Double_t Offset)
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

void QwEnergyCalculator::Ratio ( QwEnergyCalculator numer,
QwEnergyCalculator denom 
)

Definition at line 194 of file QwEnergyCalculator.cc.

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

194  {
195  // this function is called when forming asymmetries. In this case waht we actually want for the
196  // qwk_energy/(dp/p) is the difference only not the asymmetries
197 
198  *this=numer;
199  return;
200 }

+ Here is the caller graph for this function:

void QwEnergyCalculator::Scale ( Double_t  factor)

Definition at line 203 of file QwEnergyCalculator.cc.

References fEnergyChange, and QwVQWK_Channel::Scale().

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

203  {
204  fEnergyChange.Scale(factor);
205  return;
206 }
void Scale(Double_t Offset)
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::Set ( const VQwBPM device,
TString  type,
TString  property,
Double_t  tmatrix_ratio 
)

Definition at line 37 of file QwEnergyCalculator.cc.

References fDevice, fProperty, fTMatrixRatio, fType, and VQwDataElement::GetElementName().

38 {
39  Bool_t ldebug = kFALSE;
40 
41  fDevice.push_back(device);
42  fProperty.push_back(property);
43  fType.push_back(type);
44  fTMatrixRatio.push_back(tmatrix_ratio);
45 
46  if(ldebug)
47  std::cout<<"QwEnergyCalculator:: Using "<<device->GetElementName()<<" with ratio "<< tmatrix_ratio <<" for "<<property<<std::endl;
48 
49  return;
50 }
std::vector< TString > fType
std::vector< const VQwBPM * > fDevice
std::vector< TString > fProperty
std::vector< Double_t > fTMatrixRatio
virtual const TString & GetElementName() const
Get the name of this element.

+ Here is the call graph for this function:

void QwEnergyCalculator::SetEventCutMode ( Int_t  bcuts)
inline

Definition at line 70 of file QwEnergyCalculator.h.

References bEVENTCUTMODE, fEnergyChange, and VQwHardwareChannel::SetEventCutMode().

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

70  {
71  bEVENTCUTMODE=bcuts;
73  }
void SetEventCutMode(Int_t bcuts)
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEnergyCalculator::SetRootSaveStatus ( TString &  prefix)

Definition at line 52 of file QwEnergyCalculator.cc.

References bFullSave.

Referenced by ConstructBranch(), QwBPMStripline< T >::ConstructBranch(), ConstructBranchAndVector(), QwBPMStripline< T >::ConstructBranchAndVector(), ConstructHistograms(), and QwBPMStripline< T >::ConstructHistograms().

53 {
54  if(prefix=="diff_"||prefix=="yield_"|| prefix=="asym_")
55  bFullSave=kFALSE;
56 
57  return;
58 }

+ Here is the caller graph for this function:

Int_t QwEnergyCalculator::SetSingleEventCuts ( Double_t  mean,
Double_t  sigma 
)

Definition at line 230 of file QwEnergyCalculator.cc.

References fEnergyChange, and VQwHardwareChannel::SetSingleEventCuts().

230  {
232  return 1;
233 }
void SetSingleEventCuts(Double_t min, Double_t max)
Set the upper and lower limits (fULimit and fLLimit) for this channel.
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

void QwEnergyCalculator::SetSingleEventCuts ( UInt_t  errorflag,
Double_t  min = 0,
Double_t  max = 0,
Double_t  stability = 0 
)
virtual

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

Reimplemented from VQwDataElement.

Definition at line 235 of file QwEnergyCalculator.cc.

References QwLog::endl(), fEnergyChange, kBCMErrorFlag, QwMessage, and VQwHardwareChannel::SetSingleEventCuts().

235  {
236  //set the unique tag to identify device type (bcm,bpm & etc)
237  errorflag|=kBCMErrorFlag;//currently I use the same flag for bcm
238  QwMessage<<"QwEnergyCalculator Error Code passing to QwVQWK_Ch "<<errorflag<<QwLog::endl;
239  fEnergyChange.SetSingleEventCuts(errorflag,LL,UL,stability);
240 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
static const UInt_t kBCMErrorFlag
Definition: QwTypes.h:167
void SetSingleEventCuts(Double_t min, Double_t max)
Set the upper and lower limits (fULimit and fLLimit) for this channel.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

UInt_t QwEnergyCalculator::UpdateErrorFlag ( )
virtual

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

Reimplemented from VQwDataElement.

Definition at line 130 of file QwEnergyCalculator.cc.

References fDevice, fEnergyChange, fProperty, VQwDataElement::GetEventcutErrorFlag(), VQwBPM::kXAxis, and VQwHardwareChannel::UpdateErrorFlag().

131 {
132  UInt_t error_code = 0;
133  for(UInt_t i = 0; i<fProperty.size(); i++){
134  if(fProperty[i].Contains("targetbeamangle")){
135  error_code |= ((QwCombinedBPM<QwVQWK_Channel>*)fDevice[i])->fSlope[0].GetErrorCode();
136  } else {
137  error_code |= fDevice[i]->GetPosition(VQwBPM::kXAxis)->GetErrorCode();
138  }
139  }
140  fEnergyChange.UpdateErrorFlag(error_code);
142 }
UInt_t UpdateErrorFlag()
Update the error flag based on the error flags of internally contained objects Return paramter is the...
std::vector< const VQwBPM * > fDevice
std::vector< TString > fProperty
virtual UInt_t GetEventcutErrorFlag()
return the error flag on this channel/device
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

void QwEnergyCalculator::UpdateErrorFlag ( const QwEnergyCalculator ev_error)

Definition at line 145 of file QwEnergyCalculator.cc.

References fEnergyChange, and VQwHardwareChannel::UpdateErrorFlag().

145  {
147 };
UInt_t UpdateErrorFlag()
Update the error flag based on the error flags of internally contained objects Return paramter is the...
QwVQWK_Channel fEnergyChange

+ Here is the call graph for this function:

Field Documentation

Bool_t QwEnergyCalculator::bEVENTCUTMODE
private

Definition at line 125 of file QwEnergyCalculator.h.

Referenced by SetEventCutMode().

std::vector<const VQwBPM*> QwEnergyCalculator::fDevice
private

Definition at line 120 of file QwEnergyCalculator.h.

Referenced by ApplySingleEventCuts(), ProcessEvent(), Set(), and UpdateErrorFlag().

Int_t QwEnergyCalculator::fDeviceErrorCode
private

Definition at line 124 of file QwEnergyCalculator.h.

std::vector<TString> QwEnergyCalculator::fProperty
private

Definition at line 122 of file QwEnergyCalculator.h.

Referenced by ApplySingleEventCuts(), ProcessEvent(), Set(), and UpdateErrorFlag().

std::vector<Double_t> QwEnergyCalculator::fTMatrixRatio
private

Definition at line 121 of file QwEnergyCalculator.h.

Referenced by ProcessEvent(), and Set().

std::vector<TString> QwEnergyCalculator::fType
private

Definition at line 123 of file QwEnergyCalculator.h.

Referenced by Set().


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