ROOTPWA
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
rpwa::ampIntegralMatrix Class Reference

#include <ampIntegralMatrix.h>

Public Types

typedef boost::multi_array
< std::complex< double >, 2 > 
integralMatrixType

Public Member Functions

 ampIntegralMatrix ()
 ampIntegralMatrix (const ampIntegralMatrix &integral)
virtual ~ampIntegralMatrix ()
void clear ()
ampIntegralMatrixoperator= (const ampIntegralMatrix &integral)
ampIntegralMatrixoperator+= (const ampIntegralMatrix &integral)
ampIntegralMatrixoperator-= (const ampIntegralMatrix &integral)
ampIntegralMatrixoperator*= (const double factor)
ampIntegralMatrixoperator/= (const double factor)
unsigned int nmbWaves () const
 returns number of waves in integral
unsigned long nmbEvents () const
 returns number of events in integral
void setNmbEvents (const unsigned long nmbEvents)
 sets number of events in integral
bool containsWave (const std::string &waveName) const
 returns whether wave is in integral matrix
unsigned int waveIndex (const std::string &waveName) const
 returns wave index for a wave name
const std::string & waveName (const unsigned int waveIndex) const
 returns wave name for a wave index
const std::vector
< rpwa::waveDescription > & 
waveDescriptions () const
 returns array of wave descriptions
const waveDescriptionwaveDesc (const unsigned int waveIndex) const
 returns wave descriptuion for wave index, if existent
const waveDescriptionwaveDesc (const std::string &waveName) const
 returns wave descriptuion for wave name, if existent
bool allWavesHaveDesc () const
 returns whether all waves in integral have description object
integralMatrixTypematrix ()
 returns integral matrix
const integralMatrixTypematrix () const
 returns integral matrix
std::complex< double > element (const unsigned int waveIndexI, const unsigned int waveIndexJ) const
 returns integral matrix element devided by number of events defined by index pair
std::complex< double > element (const std::string &waveNameI, const std::string &waveNameJ) const
 < returns integral matrix element devided by number of events defined by pair of wave names
bool integrate (const std::vector< std::string > &binAmpFileNames, const std::vector< std::string > &rootAmpFileNames, const unsigned long maxNmbEvents=0, const std::string &weightFileName="")
void renormalize (const unsigned long nmbEventsRenorm)
bool writeAscii (std::ostream &out=std::cout) const
bool readAscii (std::istream &in=std::cin)
bool writeAscii (const std::string &outFileName) const
bool readAscii (const std::string &inFileName)
std::ostream & print (std::ostream &out, const bool printIntegralValues=false) const
 prints integral in human-readable form

Static Public Member Functions

static bool debug ()
 returns debug flag
static void setDebug (const bool debug=true)
 sets debug flag

Private Types

typedef std::map< std::string,
unsigned int >::const_iterator 
waveNameToIndexMapIterator
typedef
integralMatrixType::size_type 
sizeType

Private Member Functions

unsigned long openBinAmpFiles (std::vector< std::ifstream * > &ampFiles, const std::vector< std::string > &ampFileNames, const unsigned int waveIndexOffset=0)
 opens array of .amp files, performs some scrunity checks and adds waves to name <-> index maps
unsigned long openRootAmpFiles (std::vector< TTree * > &ampTrees, std::vector< rpwa::amplitudeTreeLeaf * > &ampTreeLeafs, const std::vector< std::string > &ampFileNames, const unsigned int waveIndexOffset=0, const std::string &ampLeafName="amplitude")
 opens array of .root files, performs some scrunity checks and adds waves to name <-> index maps
void rebuildWaveNameToIndexMap ()
 rebuilds the wave name -> index map from _waveNames
bool hasIdenticalWaveSet (const ampIntegralMatrix &integral) const
 checks whether other integral matrix has exactly the same set of waves
void storeMultiArray ()
 copies multiarray into storage variables written to ROOT file
void readMultiArray ()
 rebuilds multiarray from storage variables read from ROOT file

Private Attributes

unsigned int _nmbWaves
 number of waves in integral
std::map< std::string,
unsigned int
_waveNameToIndexMap
std::vector< std::string > _waveNames
 ///< maps wave names to wave indices
unsigned long _nmbEvents
 number of events in integral matrix
integralMatrixType _integrals
std::vector< unsigned int_intStorageShape
 ///< integral matrix
unsigned int _intStorageNmbElements
 number of elements in array
std::complex< double > * _intStorageData
std::vector
< rpwa::waveDescription
_waveDescriptions
 wave descriptions of all waves

Static Private Attributes

static bool _debug = false
 if set to true, debug messages are printed

Friends

bool operator== (const ampIntegralMatrix &lhsInt, const ampIntegralMatrix &rhsInt)

Detailed Description

Definition at line 69 of file ampIntegralMatrix.h.

Member Typedef Documentation

typedef boost::multi_array<std::complex<double>, 2> rpwa::ampIntegralMatrix::integralMatrixType

Definition at line 79 of file ampIntegralMatrix.h.

typedef integralMatrixType::size_type rpwa::ampIntegralMatrix::sizeType
private

Definition at line 81 of file ampIntegralMatrix.h.

typedef std::map<std::string, unsigned int>::const_iterator rpwa::ampIntegralMatrix::waveNameToIndexMapIterator
private

Definition at line 72 of file ampIntegralMatrix.h.

Constructor & Destructor Documentation

ampIntegralMatrix::ampIntegralMatrix ( )

Definition at line 69 of file ampIntegralMatrix.cc.

ampIntegralMatrix::ampIntegralMatrix ( const ampIntegralMatrix integral)

Definition at line 85 of file ampIntegralMatrix.cc.

ampIntegralMatrix::~ampIntegralMatrix ( )
virtual

Definition at line 91 of file ampIntegralMatrix.cc.

Member Function Documentation

bool ampIntegralMatrix::allWavesHaveDesc ( ) const

returns whether all waves in integral have description object

Definition at line 236 of file ampIntegralMatrix.cc.

References _waveDescriptions, and i.

Referenced by integrate().

void ampIntegralMatrix::clear ( )
bool ampIntegralMatrix::containsWave ( const std::string &  waveName) const

returns whether wave is in integral matrix

Definition at line 193 of file ampIntegralMatrix.cc.

References _waveNameToIndexMap.

Referenced by hasIdenticalWaveSet(), openBinAmpFiles(), openRootAmpFiles(), and rebuildWaveNameToIndexMap().

static bool rpwa::ampIntegralMatrix::debug ( )
inlinestatic

returns debug flag

Definition at line 145 of file ampIntegralMatrix.h.

References _debug.

Referenced by setDebug().

complex< double > ampIntegralMatrix::element ( const unsigned int  waveIndexI,
const unsigned int  waveIndexJ 
) const

returns integral matrix element devided by number of events defined by index pair

Definition at line 246 of file ampIntegralMatrix.cc.

References _integrals, _nmbEvents, and _nmbWaves.

Referenced by TPWALikelihood< complexT >::reorderIntegralMatrix().

std::complex<double> rpwa::ampIntegralMatrix::element ( const std::string &  waveNameI,
const std::string &  waveNameJ 
) const
inline

< returns integral matrix element devided by number of events defined by pair of wave names

Definition at line 125 of file ampIntegralMatrix.h.

References element(), and waveIndex().

Referenced by element().

bool ampIntegralMatrix::hasIdenticalWaveSet ( const ampIntegralMatrix integral) const
private

checks whether other integral matrix has exactly the same set of waves

Definition at line 746 of file ampIntegralMatrix.cc.

References _nmbWaves, containsWave(), i, nmbWaves(), and waveName().

Referenced by operator+=(), operator-=(), and rpwa::operator==().

bool ampIntegralMatrix::integrate ( const std::vector< std::string > &  binAmpFileNames,
const std::vector< std::string > &  rootAmpFileNames,
const unsigned long  maxNmbEvents = 0,
const std::string &  weightFileName = "" 
)

!! this should be provided as a friend tree for the amlitudes

Definition at line 264 of file ampIntegralMatrix.cc.

References _debug, _integrals, _nmbEvents, _nmbWaves, _waveDescriptions, _waveNames, allWavesHaveDesc(), conj(), i, openBinAmpFiles(), openRootAmpFiles(), progressIndicator(), and waveIndex().

Referenced by main().

integralMatrixType& rpwa::ampIntegralMatrix::matrix ( )
inline

returns integral matrix

Definition at line 119 of file ampIntegralMatrix.h.

References _integrals.

Referenced by operator+=(), operator-=(), and rpwa::operator==().

const integralMatrixType& rpwa::ampIntegralMatrix::matrix ( ) const
inline

returns integral matrix

Definition at line 120 of file ampIntegralMatrix.h.

References _integrals.

unsigned long rpwa::ampIntegralMatrix::nmbEvents ( ) const
inline

returns number of events in integral

Definition at line 105 of file ampIntegralMatrix.h.

References _nmbEvents.

Referenced by main(), operator+=(), operator-=(), rpwa::operator==(), and setNmbEvents().

unsigned int rpwa::ampIntegralMatrix::nmbWaves ( ) const
inline

returns number of waves in integral

Definition at line 104 of file ampIntegralMatrix.h.

References _nmbWaves.

Referenced by hasIdenticalWaveSet(), and rpwa::operator==().

unsigned long ampIntegralMatrix::openBinAmpFiles ( std::vector< std::ifstream * > &  ampFiles,
const std::vector< std::string > &  ampFileNames,
const unsigned int  waveIndexOffset = 0 
)
private

opens array of .amp files, performs some scrunity checks and adds waves to name <-> index maps

Definition at line 566 of file ampIntegralMatrix.cc.

References _debug, _waveNames, _waveNameToIndexMap, containsWave(), i, waveIndex(), and waveName().

Referenced by integrate().

unsigned long ampIntegralMatrix::openRootAmpFiles ( std::vector< TTree * > &  ampTrees,
std::vector< rpwa::amplitudeTreeLeaf * > &  ampTreeLeafs,
const std::vector< std::string > &  ampFileNames,
const unsigned int  waveIndexOffset = 0,
const std::string &  ampLeafName = "amplitude" 
)
private

opens array of .root files, performs some scrunity checks and adds waves to name <-> index maps

Definition at line 621 of file ampIntegralMatrix.cc.

References _debug, _waveDescriptions, _waveNames, _waveNameToIndexMap, containsWave(), i, waveDesc(), waveIndex(), and waveName().

Referenced by integrate().

ampIntegralMatrix & ampIntegralMatrix::operator*= ( const double  factor)

Definition at line 171 of file ampIntegralMatrix.cc.

References _integrals, _nmbEvents, _nmbWaves, and i.

ampIntegralMatrix & ampIntegralMatrix::operator+= ( const ampIntegralMatrix integral)
ampIntegralMatrix & ampIntegralMatrix::operator-= ( const ampIntegralMatrix integral)
ampIntegralMatrix & ampIntegralMatrix::operator/= ( const double  factor)

Definition at line 182 of file ampIntegralMatrix.cc.

References _integrals, _nmbEvents, _nmbWaves, and i.

ampIntegralMatrix & ampIntegralMatrix::operator= ( const ampIntegralMatrix integral)
ostream & ampIntegralMatrix::print ( std::ostream &  out,
const bool  printIntegralValues = false 
) const

prints integral in human-readable form

Definition at line 544 of file ampIntegralMatrix.cc.

References _integrals, _nmbEvents, _nmbWaves, _waveNames, _waveNameToIndexMap, i, and if.

Referenced by rpwa::operator<<().

bool ampIntegralMatrix::readAscii ( std::istream &  in = std::cin)

Definition at line 462 of file ampIntegralMatrix.cc.

References _integrals, _nmbEvents, _nmbWaves, _waveNames, _waveNameToIndexMap, i, waveIndex(), and waveName().

Referenced by main(), and readAscii().

bool ampIntegralMatrix::readAscii ( const std::string &  inFileName)

Definition at line 525 of file ampIntegralMatrix.cc.

References _debug, and readAscii().

void ampIntegralMatrix::readMultiArray ( )
private

rebuilds multiarray from storage variables read from ROOT file

Definition at line 775 of file ampIntegralMatrix.cc.

References _integrals, _intStorageData, _intStorageNmbElements, _intStorageShape, and i.

void ampIntegralMatrix::rebuildWaveNameToIndexMap ( )
private

rebuilds the wave name -> index map from _waveNames

Definition at line 733 of file ampIntegralMatrix.cc.

References _waveNames, _waveNameToIndexMap, containsWave(), and i.

void ampIntegralMatrix::renormalize ( const unsigned long  nmbEventsRenorm)

Definition at line 426 of file ampIntegralMatrix.cc.

References _debug, and _nmbEvents.

Referenced by main().

static void rpwa::ampIntegralMatrix::setDebug ( const bool  debug = true)
inlinestatic

sets debug flag

Definition at line 146 of file ampIntegralMatrix.h.

References _debug, and debug().

void rpwa::ampIntegralMatrix::setNmbEvents ( const unsigned long  nmbEvents)
inline

sets number of events in integral

Definition at line 107 of file ampIntegralMatrix.h.

References _nmbEvents, and nmbEvents().

void ampIntegralMatrix::storeMultiArray ( )
private

copies multiarray into storage variables written to ROOT file

Definition at line 763 of file ampIntegralMatrix.cc.

References _integrals, _intStorageData, _intStorageNmbElements, _intStorageShape, and i.

const waveDescription * ampIntegralMatrix::waveDesc ( const unsigned int  waveIndex) const

returns wave descriptuion for wave index, if existent

Definition at line 227 of file ampIntegralMatrix.cc.

References _waveDescriptions.

Referenced by openRootAmpFiles().

const waveDescription* rpwa::ampIntegralMatrix::waveDesc ( const std::string &  waveName) const
inline

returns wave descriptuion for wave name, if existent

Definition at line 115 of file ampIntegralMatrix.h.

References waveDesc(), and waveIndex().

Referenced by waveDesc().

const std::vector<rpwa::waveDescription>& rpwa::ampIntegralMatrix::waveDescriptions ( ) const
inline

returns array of wave descriptions

Definition at line 113 of file ampIntegralMatrix.h.

References _waveDescriptions.

unsigned int ampIntegralMatrix::waveIndex ( const std::string &  waveName) const

returns wave index for a wave name

Definition at line 203 of file ampIntegralMatrix.cc.

References _waveNameToIndexMap.

Referenced by element(), integrate(), openBinAmpFiles(), openRootAmpFiles(), operator+=(), operator-=(), rpwa::operator==(), readAscii(), and waveDesc().

const string & ampIntegralMatrix::waveName ( const unsigned int  waveIndex) const

returns wave name for a wave index

Definition at line 215 of file ampIntegralMatrix.cc.

References _waveNames.

Referenced by hasIdenticalWaveSet(), openBinAmpFiles(), openRootAmpFiles(), operator+=(), operator-=(), rpwa::operator==(), and readAscii().

bool ampIntegralMatrix::writeAscii ( std::ostream &  out = std::cout) const

Definition at line 437 of file ampIntegralMatrix.cc.

References _integrals, _nmbEvents, _nmbWaves, _waveNameToIndexMap, and i.

Referenced by main(), and writeAscii().

bool ampIntegralMatrix::writeAscii ( const std::string &  outFileName) const

Definition at line 506 of file ampIntegralMatrix.cc.

References _debug, and writeAscii().

Friends And Related Function Documentation

bool operator== ( const ampIntegralMatrix lhsInt,
const ampIntegralMatrix rhsInt 
)
friend

Definition at line 195 of file ampIntegralMatrix.h.

Member Data Documentation

bool ampIntegralMatrix::_debug = false
staticprivate

if set to true, debug messages are printed

Definition at line 166 of file ampIntegralMatrix.h.

Referenced by debug(), integrate(), openBinAmpFiles(), openRootAmpFiles(), readAscii(), renormalize(), setDebug(), and writeAscii().

integralMatrixType rpwa::ampIntegralMatrix::_integrals
private
std::complex<double>* rpwa::ampIntegralMatrix::_intStorageData
private

Definition at line 180 of file ampIntegralMatrix.h.

Referenced by clear(), readMultiArray(), and storeMultiArray().

unsigned int rpwa::ampIntegralMatrix::_intStorageNmbElements
private

number of elements in array

Definition at line 179 of file ampIntegralMatrix.h.

Referenced by clear(), readMultiArray(), and storeMultiArray().

std::vector<unsigned int> rpwa::ampIntegralMatrix::_intStorageShape
private

///< integral matrix

array shape

Definition at line 178 of file ampIntegralMatrix.h.

Referenced by clear(), readMultiArray(), and storeMultiArray().

unsigned long rpwa::ampIntegralMatrix::_nmbEvents
private
unsigned int rpwa::ampIntegralMatrix::_nmbWaves
private
std::vector<rpwa::waveDescription> rpwa::ampIntegralMatrix::_waveDescriptions
private

wave descriptions of all waves

Definition at line 182 of file ampIntegralMatrix.h.

Referenced by allWavesHaveDesc(), clear(), integrate(), openRootAmpFiles(), operator+=(), operator-=(), operator=(), waveDesc(), and waveDescriptions().

std::vector<std::string> rpwa::ampIntegralMatrix::_waveNames
private

///< maps wave names to wave indices

maps wave indices to wave names

Definition at line 170 of file ampIntegralMatrix.h.

Referenced by clear(), integrate(), openBinAmpFiles(), openRootAmpFiles(), operator=(), print(), readAscii(), rebuildWaveNameToIndexMap(), and waveName().

std::map<std::string, unsigned int> rpwa::ampIntegralMatrix::_waveNameToIndexMap
private

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