Diana Software
Public Member Functions | List of all members
QVectorC Class Reference

Interface for complex vectors in Diana analysis. More...

Inheritance diagram for QVectorC:
QObject

Public Member Functions

 QVectorC ()
 default constructor More...
 
 QVectorC (const UInt_t size)
 constructor with its size More...
 
 QVectorC (const QVectorC &orig)
 copy constructor More...
 
 QVectorC (const QVector &re, const QVector &im)
 
 QVectorC (const QVector &vec)
 constructor from a single QVector More...
 
 ~QVectorC ()
 copy only some of the elements More...
 
void Clear ()
 clear the vector More...
 
void SetArray (const double *re, const double *im, UInt_t size)
 
UInt_t Size () const
 size of QVector More...
 
void Initialize (const double re=0, const double im=0)
 initialize elements (default to 0) More...
 
void Initialize (const QComplex val)
 
QComplex operator[] (const UInt_t i)
 retrieve an element More...
 
QComplex operator() (const UInt_t i)
 
const QComplex operator[] (const UInt_t i) const
 retrieve an element More...
 
const QComplex operator() (const UInt_t i) const
 
const QVectorCoperator= (const QVectorC &orig)
 copy the content of another vector More...
 
QVectorRe ()
 
QVectorIm ()
 
const QVectorRe () const
 
const QVectorIm () const
 
QVector GetMagnitudes () const
 
QVector GetMagnitudesSquare () const
 
QVector GetPhase () const
 
QVector GetModulus () const
 
QVector GetModulusSquare () const
 
QVectorC Mult (const QVectorC &other) const
 multiplication element by element More...
 
const QVectorCMultIn (const QVectorC &other)
 multiplication element by element by the given vector More...
 
QVectorC Mult (const QVector &other) const
 multiplication element by element More...
 
QVectorC Div (const QVectorC &other) const
 multiplication element by element More...
 
const QVectorCDivIn (const QVectorC &other)
 division element by element by the given vector More...
 
QVectorC Div (const QVector &other) const
 multiplication element by element More...
 
const QVectorCRebin (const int rebin, bool sum=false)
 Rebin the vector. More...
 
const QVectorCShift (const int nstep)
 Cyclic shift of vector. More...
 
const QVectorCShiftReal (const double fstep)
 Cyclic shift of vector by a real number, first shift by the integer part of fstep then linear interpolation between samples is performed. More...
 
QVectorC operator- () const
 revert sign to all components More...
 
const QVectorCoperator*= (const double t)
 multiplication by scalar More...
 
const QVectorCoperator*= (const QComplex &t)
 multiplication by complex number More...
 
const QVectorCoperator/= (const double v)
 divide by scalar More...
 
const QVectorCoperator/= (const QComplex &t)
 divide by complex number More...
 
const QVectorCoperator-= (const QComplex &t)
 add a QVectorC More...
 
const QVectorCoperator+= (const QVectorC &v)
 
const QVectorCoperator-= (const QVectorC &v)
 subtract a QVectorC More...
 
QComplex operator* (const QVectorC &other) const
 complex conjugate scalar product (v^H * u) More...
 
QVectorC operator* (const double t) const
 multiply by scalar More...
 
QMatrixC operator* (const QMatrixC &) const
 multiply by matrix More...
 
QVectorC operator+ (const QVectorC &other) const
 sum vector More...
 
QVectorC operator- (const QVectorC &other) const
 subtract vector More...
 
QVectorC operator/ (const double t) const
 divide by scalar More...
 
QMatrixC H () const
 transpose conjugate More...
 
QVectorCConjugate ()
 
QVectorC Conj () const
 
QVectorC operator* (const QComplex &t) const
 
QVectorC operator/ (const QComplex &t) const
 divide by complex number
More...
 
void Resize (const UInt_t newsize)
 
void Append (const QComplex &val)
 append More...
 
void Append (const double re, const double im=0)
 
void Append (const QVectorC &vec)
 
void SetRe (const QVector &re)
 Set real part. More...
 
void SetIm (const QVector &im)
 Set imag part. More...
 
- Public Member Functions inherited from QObject
 QObject ()
 default constructor More...
 
virtual ~QObject ()
 destructor More...
 
QObjectoperator= (const QObject &rhs)
 operator= More...
 
void Validate ()
 make object valid More...
 
void InValidate ()
 make object non valid More...
 
bool IsValid () const
 check wheter object is valid More...
 
void SetWrite (bool write=true)
 write or not this object More...
 
bool GetWrite () const
 check wheter write or not this object More...
 
bool IsRequired () const
 check wheter this object is required by some module More...
 
void SetIsRequired (bool required=true)
 set that this object is required
More...
 
bool IsJustAdded () const
 check wheter this object has been just added by some module More...
 
void SetIsJustAdded (bool added=true)
 set that this object has been just added
More...
 
void Reset ()
 set object to non valid and calls Clear() More...
 
virtual bool Fill (QObject *evData) const =0
 calls operator= of inheriting classes. Validity flag and bits are not copied. This function is automatically declared/implemented in derived classes by QObjectDef/QObjectImp. If evData type mismatches returns false, true otherwise. More...
 
void FullyFill (QObject *evData) const
 calls Fill(QObject*) if this QObject IsValid(). Copies Validity flag and bits More...
 
virtual QObjectDuplicate () const =0
 create object of same type, this function is automatically declared/implemented in derived classes by QObjectDef/QObjectImp More...
 
virtual void Dump (std::ostream &o) const
 print content to stream (intended for screen print or log files) More...
 
virtual void Print () const
 print content on screen More...
 
virtual QError WriteOnStream (std::ostream &o) const
 print content to stream (intended for storage in text files) More...
 
virtual QError ReadFromStream (std::istream &o)
 fill content from stream (intended for storage in text files) More...
 
void CopyBits (QObject *obj) const
 copy validity and temporary bits to another QObject More...
 
virtual void Draw (Option_t *option="")
 

Additional Inherited Members

- Public Types inherited from QObject
enum  { kIsValid = BIT(15) , kWrite = BIT(0) , kIsRequired = BIT(1) , kIsJustAdded = BIT(2) }
 TObject bits. More...
 
- Static Public Member Functions inherited from QObject
static QObjectNew (const char *object)
 

Detailed Description

Interface for complex vectors in Diana analysis.

Definition at line 25 of file QVectorC.hh.

Constructor & Destructor Documentation

◆ QVectorC() [1/5]

QVectorC::QVectorC ( )

default constructor

Definition at line 41 of file QVectorC.cc.

◆ QVectorC() [2/5]

QVectorC::QVectorC ( const UInt_t  size)
explicit

constructor with its size

Parameters
sizestart size of QVector

Definition at line 54 of file QVectorC.cc.

References QVector::ArrayAlloc().

◆ QVectorC() [3/5]

QVectorC::QVectorC ( const QVectorC orig)

copy constructor

Parameters
origoriginal QVector

Definition at line 66 of file QVectorC.cc.

◆ QVectorC() [4/5]

QVectorC::QVectorC ( const QVector re,
const QVector im 
)

@constructed from two vectors

Parameters
rereal part
imimaginary part

Definition at line 86 of file QVectorC.cc.

References QVector::ArrayAlloc(), DianaThrow, QVector::fSize, QERR_SIZE_NOT_MATCH, QVector::Size(), and Size().

◆ QVectorC() [5/5]

QVectorC::QVectorC ( const QVector vec)
explicit

constructor from a single QVector

assumes input QVector has even number of members the first half is the real part, the second half the imaginary part

Definition at line 70 of file QVectorC.cc.

References QVector::ArrayAlloc(), QVector::Size(), Size(), and vec.

◆ ~QVectorC()

QVectorC::~QVectorC ( )

copy only some of the elements

Parameters
origoriginal QVector
sizenumber of elements to copy
iofffirst element to copy

constructor from QMatrix

build a vector out of a QMatrix taking only the first column

Parameters
matQMatrix of origin

destructor

Definition at line 153 of file QVectorC.cc.

References QVector::ArrayFree().

Member Function Documentation

◆ Append() [1/3]

void QVectorC::Append ( const double  re,
const double  im = 0 
)

Definition at line 601 of file QVectorC.cc.

References Append().

◆ Append() [2/3]

void QVectorC::Append ( const QComplex val)

append

add one more element at the end of the vector

Parameters
val

Definition at line 579 of file QVectorC.cc.

References QVector::ArrayAlloc(), QVector::ArrayFree(), DianaThrow, QComplex::Im(), QERR_SIZE_NOT_MATCH, QComplex::Re(), and Size().

Referenced by Append().

◆ Append() [3/3]

void QVectorC::Append ( const QVectorC vec)

Definition at line 607 of file QVectorC.cc.

References Append(), QVector::Size(), and vec.

◆ Clear()

void QVectorC::Clear ( )
inlinevirtual

clear the vector

Implements QObject.

Definition at line 75 of file QVectorC.hh.

References Resize().

Referenced by QAverageVectorC::Clear().

◆ Conj()

QVectorC QVectorC::Conj ( ) const

Definition at line 572 of file QVectorC.cc.

References Conjugate().

Referenced by H().

◆ Conjugate()

QVectorC & QVectorC::Conjugate ( )

Definition at line 565 of file QVectorC.cc.

References Size().

Referenced by Conj().

◆ Div() [1/2]

QVectorC QVectorC::Div ( const QVector other) const

multiplication element by element

v[i]=v1[i]/v2[i]

Parameters
other
Returns
A new value

Definition at line 427 of file QVectorC.cc.

References b, DianaThrow, QERR_SIZE_NOT_MATCH, QVector::Size(), and Size().

◆ Div() [2/2]

QVectorC QVectorC::Div ( const QVectorC other) const

multiplication element by element

v[i]=v1[i]/v2[i]

Parameters
other
Returns
A new value

Definition at line 403 of file QVectorC.cc.

References b, DianaThrow, QVector::fMathVec, QVector::fSize, QERR_SIZE_NOT_MATCH, and QVector::SetMathVector().

◆ DivIn()

const QVectorC & QVectorC::DivIn ( const QVectorC other)

division element by element by the given vector

v[i]=v1[i]/v2[i]

Parameters
other
Returns
A const reference to the updated object

Definition at line 416 of file QVectorC.cc.

References b, DianaThrow, QVector::fMathVec, QVector::fSize, QERR_SIZE_NOT_MATCH, and QVector::SetMathVector().

◆ GetMagnitudes()

QVector QVectorC::GetMagnitudes ( ) const

Definition at line 337 of file QVectorC.cc.

References Size().

Referenced by GetModulus().

◆ GetMagnitudesSquare()

QVector QVectorC::GetMagnitudesSquare ( ) const

Definition at line 345 of file QVectorC.cc.

References Size().

Referenced by GetModulusSquare().

◆ GetModulus()

QVector QVectorC::GetModulus ( ) const
inline

Definition at line 120 of file QVectorC.hh.

References GetMagnitudes().

◆ GetModulusSquare()

QVector QVectorC::GetModulusSquare ( ) const
inline

Definition at line 121 of file QVectorC.hh.

References GetMagnitudesSquare().

◆ GetPhase()

QVector QVectorC::GetPhase ( ) const

Definition at line 328 of file QVectorC.cc.

References QComplex::GetPhase(), operator[](), and Size().

◆ H()

QMatrixC QVectorC::H ( ) const

transpose conjugate

a transposed vector is a matrix with a single row

Returns
matrix

Definition at line 559 of file QVectorC.cc.

References Conj(), QMatrixC::SetRow(), and Size().

◆ Im() [1/2]

QVector & QVectorC::Im ( )

Definition at line 313 of file QVectorC.cc.

◆ Im() [2/2]

const QVector & QVectorC::Im ( ) const

Definition at line 323 of file QVectorC.cc.

◆ Initialize() [1/2]

void QVectorC::Initialize ( const double  re = 0,
const double  im = 0 
)

initialize elements (default to 0)

Parameters
val

Definition at line 216 of file QVectorC.cc.

References Size().

Referenced by Initialize().

◆ Initialize() [2/2]

void QVectorC::Initialize ( const QComplex  val)

Definition at line 223 of file QVectorC.cc.

References QComplex::Im(), Initialize(), and QComplex::Re().

◆ Mult() [1/2]

QVectorC QVectorC::Mult ( const QVector other) const

multiplication element by element

v[i]=v1[i]*v2[i]

Parameters
other
Returns
a new value

Definition at line 386 of file QVectorC.cc.

References b, DianaThrow, QERR_SIZE_NOT_MATCH, QVector::Size(), and Size().

◆ Mult() [2/2]

QVectorC QVectorC::Mult ( const QVectorC other) const

multiplication element by element

v[i]=v1[i]*v2[i]

Parameters
other
Returns
a new value

Definition at line 360 of file QVectorC.cc.

References b, DianaThrow, QVector::fMathVec, QERR_SIZE_NOT_MATCH, QVector::SetMathVector(), QVector::Size(), and Size().

◆ MultIn()

const QVectorC & QVectorC::MultIn ( const QVectorC other)

multiplication element by element by the given vector

v[i]=v1[i]*v2[i]

Parameters
other
Returns
a const reference to the updated current object

Definition at line 374 of file QVectorC.cc.

References b, DianaThrow, QVector::fMathVec, QERR_SIZE_NOT_MATCH, QVector::SetMathVector(), QVector::Size(), and Size().

◆ operator()() [1/2]

QComplex QVectorC::operator() ( const UInt_t  i)
inline

Definition at line 95 of file QVectorC.hh.

References operator[]().

◆ operator()() [2/2]

const QComplex QVectorC::operator() ( const UInt_t  i) const
inline

Definition at line 104 of file QVectorC.hh.

References operator[]().

◆ operator*() [1/4]

QVectorC QVectorC::operator* ( const double  t) const

multiply by scalar

Parameters
tright element
Returns
scaled vector

Definition at line 488 of file QVectorC.cc.

◆ operator*() [2/4]

QVectorC QVectorC::operator* ( const QComplex t) const

Definition at line 546 of file QVectorC.cc.

◆ operator*() [3/4]

QMatrixC QVectorC::operator* ( const QMatrixC matrix) const

multiply by matrix

Parameters
tright element
Returns
matrix

Definition at line 301 of file QVectorC.cc.

References QMatrixC::SetCol(), and Size().

◆ operator*() [4/4]

QComplex QVectorC::operator* ( const QVectorC other) const

complex conjugate scalar product (v^H * u)

Parameters
otherright element
Returns
scalar product

Definition at line 479 of file QVectorC.cc.

◆ operator*=() [1/2]

const QVectorC & QVectorC::operator*= ( const double  t)

multiplication by scalar

Parameters
t
Returns
the same object modified

Definition at line 449 of file QVectorC.cc.

Referenced by operator/=().

◆ operator*=() [2/2]

const QVectorC & QVectorC::operator*= ( const QComplex t)

multiplication by complex number

Parameters
t
Returns
the same object modified

Definition at line 516 of file QVectorC.cc.

References QComplex::Get_gsl_complex().

◆ operator+()

QVectorC QVectorC::operator+ ( const QVectorC other) const

sum vector

Parameters
otherright element
Returns
sum vector

Definition at line 502 of file QVectorC.cc.

◆ operator+=()

const QVectorC & QVectorC::operator+= ( const QVectorC v)

Definition at line 457 of file QVectorC.cc.

References b, DianaThrow, QVector::fMathVec, QVector::fSize, QERR_SIZE_NOT_MATCH, and QVector::SetMathVector().

Referenced by operator-=().

◆ operator-() [1/2]

QVectorC QVectorC::operator- ( ) const

revert sign to all components

Definition at line 354 of file QVectorC.cc.

◆ operator-() [2/2]

QVectorC QVectorC::operator- ( const QVectorC other) const

subtract vector

Parameters
otherright element
Returns
difference vector

Definition at line 509 of file QVectorC.cc.

◆ operator-=() [1/2]

const QVectorC & QVectorC::operator-= ( const QComplex t)

add a QVectorC

Parameters
v
Returns
the same object modified

subtract a complex number

Parameters
t
Returns
the same object modified

Definition at line 525 of file QVectorC.cc.

References QComplex::Get_gsl_complex().

◆ operator-=() [2/2]

const QVectorC & QVectorC::operator-= ( const QVectorC v)

subtract a QVectorC

Parameters
v
Returns
the same object modified

Definition at line 473 of file QVectorC.cc.

References operator+=().

◆ operator/() [1/2]

QVectorC QVectorC::operator/ ( const double  t) const

divide by scalar

Parameters
tright element
Returns
scaled vector

Definition at line 495 of file QVectorC.cc.

◆ operator/() [2/2]

QVectorC QVectorC::operator/ ( const QComplex t) const

divide by complex number

Parameters
t
Returns
the same object modified

Definition at line 553 of file QVectorC.cc.

◆ operator/=() [1/2]

const QVectorC & QVectorC::operator/= ( const double  v)

divide by scalar

Parameters
t
Returns
the same object modified

Definition at line 444 of file QVectorC.cc.

References operator*=().

◆ operator/=() [2/2]

const QVectorC & QVectorC::operator/= ( const QComplex t)

divide by complex number

Parameters
t
Returns
the same object modified

Definition at line 536 of file QVectorC.cc.

References QComplex::Get_gsl_complex().

◆ operator=()

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

copy the content of another vector

Parameters
origoriginal QVector

Definition at line 294 of file QVectorC.cc.

References Resize(), and Size().

Referenced by QAverageVectorC::operator=(), and QAverageVectorC::ReadFromStream().

◆ operator[]() [1/2]

QComplex QVectorC::operator[] ( const UInt_t  i)

retrieve an element

Parameters
iith element
Returns
element i of the QVector

Definition at line 272 of file QVectorC.cc.

References DianaThrow, Q_DOUBLE_DEFAULT, QERR_OUT_OF_RANGE, and Size().

Referenced by GetPhase(), and operator()().

◆ operator[]() [2/2]

const QComplex QVectorC::operator[] ( const UInt_t  i) const

retrieve an element

version for objects that cannot modify the QVector

Parameters
iith element
Returns
element i of the QVector

Definition at line 283 of file QVectorC.cc.

References DianaThrow, Q_DOUBLE_DEFAULT, QERR_OUT_OF_RANGE, and Size().

◆ Re() [1/2]

QVector & QVectorC::Re ( )

Definition at line 308 of file QVectorC.cc.

◆ Re() [2/2]

const QVector & QVectorC::Re ( ) const

Definition at line 318 of file QVectorC.cc.

◆ Rebin()

const QVectorC & QVectorC::Rebin ( const int  rebin,
bool  sum = false 
)

Rebin the vector.

Parameters
rebinCombine rebin bins into one
sumEither sum the bins together (if sum is true), otherwise average them
Returns
the same object modified

Definition at line 227 of file QVectorC.cc.

References Resize(), and Size().

◆ Resize()

void QVectorC::Resize ( const UInt_t  newsize)

◆ SetArray()

void QVectorC::SetArray ( const double *  re,
const double *  im,
UInt_t  size 
)

Definition at line 208 of file QVectorC.cc.

References Resize().

◆ SetIm()

void QVectorC::SetIm ( const QVector im)

Set imag part.

Definition at line 628 of file QVectorC.cc.

References DianaThrow, QERR_SIZE_NOT_MATCH, QVector::Size(), and Size().

◆ SetRe()

void QVectorC::SetRe ( const QVector re)

Set real part.

Definition at line 615 of file QVectorC.cc.

References DianaThrow, QERR_SIZE_NOT_MATCH, QVector::Size(), and Size().

◆ Shift()

const QVectorC & QVectorC::Shift ( const int  nstep)

Cyclic shift of vector.

Parameters
nstepif > 0 shift right, if < 0 shift left
Returns
the same object modified

Definition at line 240 of file QVectorC.cc.

References abs(), and Size().

Referenced by ShiftReal(), and QFFT::ZeroPad().

◆ ShiftReal()

const QVectorC & QVectorC::ShiftReal ( const double  fstep)

Cyclic shift of vector by a real number, first shift by the integer part of fstep then linear interpolation between samples is performed.

Parameters
fstepif > 0 shift right, if < 0 shift left
Returns
the same object modified

Definition at line 258 of file QVectorC.cc.

References Shift(), and Size().

◆ Size()

UInt_t QVectorC::Size ( ) const
inline

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