Diana Software
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
QAverageVector Class Reference

average vector object More...

Inheritance diagram for QAverageVector:

Public Member Functions

 QAverageVector ()
 Default ctor. More...
 
 QAverageVector (const QAverageVector &orig)
 Copy ctor. More...
 
 QAverageVector (const Diana::QVector &orig)
 Construct from a QVector(). More...
 
void Clear ()
 Clear the attributes. More...
 
void SetNumEvents (int nEvents)
 Set the number of events in the average. More...
 
int GetNumEvents () const
 Get the number of events in the average. More...
 
void SetSourceRuns (const std::vector< int > &sourceRuns)
 Set the list of source runs. More...
 
std::vector< int > & GetSourceRuns ()
 Get the list of source runs. More...
 
const std::vector< int > & GetSourceRuns () const
 Get the list of source runs. More...
 
QError WriteOnStream (std::ostream &o) const
 Write the object to a stream. More...
 
QError ReadFromStream (std::istream &ob)
 Read the object from a stream. More...
 
void Dump (std::ostream &o) const
 
void Print () const
 Print vector to stdout. More...
 
const QAverageVectoroperator= (const Diana::QVector &orig)
 Assignment operator. More...
 
const QAverageVectoroperator= (const QAverageVector &orig)
 Assignment operator. More...
 

Public Attributes

std::vector< int > fSourceRuns
 Add two average vectors. More...
 
int fNumEvents
 The number of events contributing to this average. More...
 

Protected Member Functions

 QObjectDef (QAverageVector, 2)
 

Detailed Description

average vector object

Author
Claudia Tomei, J. Ouellet

Contains average pulse or average nps, source runs and number of events.

Technical note: For some reason, the data attributes of this class are publicly accessible. They should not be, but will be left so for backward compatibility.

Definition at line 24 of file QAverageVector.hh.

Constructor & Destructor Documentation

◆ QAverageVector() [1/3]

QAverageVector::QAverageVector ( )

Default ctor.

Definition at line 14 of file QAverageVector.cc.

◆ QAverageVector() [2/3]

QAverageVector::QAverageVector ( const QAverageVector orig)

Copy ctor.

Definition at line 17 of file QAverageVector.cc.

References fNumEvents, and fSourceRuns.

◆ QAverageVector() [3/3]

QAverageVector::QAverageVector ( const Diana::QVector &  orig)

Construct from a QVector().

Definition at line 24 of file QAverageVector.cc.

Member Function Documentation

◆ Clear()

void QAverageVector::Clear ( )

Clear the attributes.

Calls QVector::Clear() and frees all internal memory.

Definition at line 28 of file QAverageVector.cc.

References QVector::Clear(), fNumEvents, and fSourceRuns.

Referenced by QAverageNoiseHandle::FillFromDB(), QAveragePulseHandle::FillFromDB(), and operator=().

◆ Dump()

void QAverageVector::Dump ( std::ostream &  o) const
inline

\breif Same as WriteOnStream().

Definition at line 81 of file QAverageVector.hh.

References WriteOnStream().

Referenced by Print().

◆ GetNumEvents()

int QAverageVector::GetNumEvents ( ) const
inline

Get the number of events in the average.

Definition at line 52 of file QAverageVector.hh.

References fNumEvents.

Referenced by QAverageNoiseHandle::StoreOnDB(), and QAveragePulseHandle::StoreOnDB().

◆ GetSourceRuns() [1/2]

std::vector<int>& QAverageVector::GetSourceRuns ( )
inline

◆ GetSourceRuns() [2/2]

const std::vector<int>& QAverageVector::GetSourceRuns ( ) const
inline

Get the list of source runs.

Definition at line 65 of file QAverageVector.hh.

References fSourceRuns.

◆ operator=() [1/2]

const QAverageVector & QAverageVector::operator= ( const Diana::QVector &  orig)

Assignment operator.

Clears the data and copies from the QVector orig.

Definition at line 155 of file QAverageVector.cc.

References Clear(), and QVector::operator=().

◆ operator=() [2/2]

const QAverageVector & QAverageVector::operator= ( const QAverageVector orig)

Assignment operator.

Clears the data and copies from the orig.

Definition at line 161 of file QAverageVector.cc.

References Clear(), fNumEvents, fSourceRuns, and QVector::operator=().

◆ Print()

void QAverageVector::Print ( ) const
inline

Print vector to stdout.

Definition at line 85 of file QAverageVector.hh.

References Dump().

◆ QObjectDef()

QAverageVector::QObjectDef ( QAverageVector  ,
 
)
protected

◆ ReadFromStream()

QError QAverageVector::ReadFromStream ( std::istream &  ob)

Read the object from a stream.

Used for reading from txt files.

Definition at line 56 of file QAverageVector.cc.

References err, fNumEvents, fSourceRuns, QVector::operator=(), QERR_SUCCESS, QERR_UNKNOWN_ERR, and vec.

◆ SetNumEvents()

void QAverageVector::SetNumEvents ( int  nEvents)
inline

Set the number of events in the average.

Definition at line 48 of file QAverageVector.hh.

References fNumEvents.

Referenced by MAveragePulses::Done(), QAverageNoiseHandle::FillFromDB(), and QAveragePulseHandle::FillFromDB().

◆ SetSourceRuns()

void QAverageVector::SetSourceRuns ( const std::vector< int > &  sourceRuns)
inline

Set the list of source runs.

Definition at line 56 of file QAverageVector.hh.

References fSourceRuns.

Referenced by MAveragePulses::Done().

◆ WriteOnStream()

QError QAverageVector::WriteOnStream ( std::ostream &  o) const

Write the object to a stream.

Used for writing to txt files.

Definition at line 35 of file QAverageVector.cc.

References err, fNumEvents, fSourceRuns, QERR_SUCCESS, and vec.

Referenced by Dump().

Member Data Documentation

◆ fNumEvents

int QAverageVector::fNumEvents

The number of events contributing to this average.

Definition at line 115 of file QAverageVector.hh.

Referenced by Clear(), GetNumEvents(), operator=(), QAverageVector(), ReadFromStream(), SetNumEvents(), and WriteOnStream().

◆ fSourceRuns

std::vector<int> QAverageVector::fSourceRuns

Add two average vectors.

This performs a weighted average of the two vectors.

Add two average vectors

This performs a weighted average of the two vectors.

The list of source runs

Definition at line 113 of file QAverageVector.hh.

Referenced by Clear(), GetSourceRuns(), operator=(), QAverageVector(), ReadFromStream(), SetSourceRuns(), and WriteOnStream().


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