ROOTPWA
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
TPWALikelihood< complexT > Class Template Reference

#include <TPWALikelihood.h>

Classes

struct  functionCallInfo

Public Types

enum  functionCallEnum {
  FDF = 0, GRADIENT = 1, DOEVAL = 2, DODERIVATIVE = 3,
  NMB_FUNCTIONCALLENUM = 4
}
typedef complexT::value_type value_type
typedef boost::multi_array
< std::string, 2 > 
waveNameArrayType
typedef boost::multi_array
< double, 2 > 
waveThrArrayType
typedef boost::multi_array
< unsigned int, 2 > 
waveToIntMapType
typedef boost::multi_array
< unsigned int, 2 > 
waveToListMapType
typedef boost::multi_array
< boost::tuple< int, int >, 3 > 
ampToParMapType
typedef boost::multi_array
< complexT, 3 > 
ampsArrayType
typedef boost::multi_array
< complexT, 4 > 
normMatrixArrayType
typedef boost::multi_array
< value_type, 2 > 
phaseSpaceIntType

Public Member Functions

 TPWALikelihood ()
 ~TPWALikelihood ()
virtual TPWALikelihoodClone () const
 clones the function using the default copy constructor
virtual unsigned int NDim () const
 returns total number of function parameters (= dimension of the function)
virtual void FdF (const double *par, double &funcVal, double *gradient) const
 optimized method to evaluate function value and derivative at a point defined by par at the same time
virtual void Gradient (const double *par, double *gradient) const
 calculates gradient (vector of partial derivatives) of function at point defined by par
virtual double DoEval (const double *par) const
virtual double DoDerivative (const double *par, unsigned int derivativeIndex) const
unsigned int nmbEvents () const
 returns number of events that enter in the likelihood
unsigned int rank () const
 returns rank of spin density matrix
unsigned int nmbWaves (const int reflectivity=0) const
 returns total number of waves (reflectivity == 0) or number or number of waves with positive/negative reflectivity; flat wave is not counted!
unsigned int nmbPars () const
 returns total number of parameters
std::vector< std::string > waveNames () const
 returns vector with all wave names ordered like in input wave list
std::string parName (const unsigned int parIndex) const
 returns name of likelihood parameter at parIndex
double parThreshold (const unsigned int parIndex) const
 returns threshold in GeV/c^2 above which likelihood parameter at parIndex becomes free
double dLcache (const unsigned int i) const
unsigned int ncalls (const functionCallEnum func=FDF) const
double Ltime (const functionCallEnum func=FDF) const
double Ntime (const functionCallEnum func=FDF) const
void enableCuda (const bool enableCuda=true)
bool cudaEnabled () const
void useNormalizedAmps (const bool useNorm=true)
void init (const unsigned int rank, const std::string &waveListFileName, const std::string &normIntFileName, const std::string &accIntFileName, const std::string &ampDirName=".", const unsigned int numbAccEvents=0, const bool useRootAmps=false)
 prepares all internal data structures
void getIntegralMatrices (TCMatrix &normMatrix, TCMatrix &accMatrix, std::vector< double > &phaseSpaceIntegral) const
void buildProdAmpArrays (const double *inPar, std::vector< std::complex< double > > &prodAmps, std::vector< std::pair< int, int > > &parIndices, std::vector< std::string > &prodAmpNames, const bool withFlat=false) const
std::ostream & print (std::ostream &out=std::cout) const
std::ostream & printFuncInfo (std::ostream &out=std::cout) const
std::vector< unsigned intorderedParIndices () const
void copyFromParArray (const double *inPar, ampsArrayType &outVal, value_type &outFlatVal) const
void copyToParArray (const ampsArrayType &inVal, const value_type inFlatVal, double *outPar) const

Static Public Member Functions

static void setQuiet (const bool flag=true)

Private Member Functions

void readWaveList (const std::string &waveListFileName)
 reads wave names and thresholds from wave list file
void buildParDataStruct (const unsigned int rank)
 builds parameter data structures
void readIntegrals (const std::string &normIntFileName, const std::string &accIntFileName, const std::string &integralTKeyName="integral")
 reads normalization and acceptance integrals from file
void readDecayAmplitudes (const std::string &ampDirName=".", const bool useRootAmps=false, const std::string &ampLeafName="amplitude")
 reads decay amplitudes from files in specified directory
void clear ()
void reorderIntegralMatrix (integral &integral, normMatrixArrayType &reorderedMatrix) const
void reorderIntegralMatrix (const rpwa::ampIntegralMatrix &integral, normMatrixArrayType &reorderedMatrix) const
void resetFuncCallInfo () const

Static Private Member Functions

static int getReflectivity (const TString &waveName)

Private Attributes

unsigned int _nmbEvents
unsigned int _rank
unsigned int _nmbWaves
unsigned int _nmbWavesRefl [2]
unsigned int _nmbWavesReflMax
unsigned int _nmbPars
bool _useNormalizedAmps
unsigned int _numbAccEvents
double _totAcc
waveNameArrayType _waveNames
waveThrArrayType _waveThresholds
waveToListMapType _waveToWaveIndex
std::vector< std::string > _parNames
std::vector< double > _parThresholds
ampToParMapType _prodAmpToFuncParMap
ampsArrayType _decayAmps
std::vector< double > _parCache
std::vector< double > _derivCache
normMatrixArrayType _normMatrix
normMatrixArrayType _accMatrix
phaseSpaceIntType _phaseSpaceIntegral
functionCallInfo _funcCallInfo [NMB_FUNCTIONCALLENUM]

Static Private Attributes

static bool _debug = true

Friends

std::ostream & operator<< (std::ostream &out, const TPWALikelihood &func)

Detailed Description

template<typename complexT>
class TPWALikelihood< complexT >

Definition at line 65 of file TPWALikelihood.h.

Member Typedef Documentation

template<typename complexT>
typedef boost::multi_array<complexT, 3> TPWALikelihood< complexT >::ampsArrayType

Definition at line 77 of file TPWALikelihood.h.

template<typename complexT>
typedef boost::multi_array<boost::tuple<int, int>, 3> TPWALikelihood< complexT >::ampToParMapType

Definition at line 76 of file TPWALikelihood.h.

template<typename complexT>
typedef boost::multi_array<complexT, 4> TPWALikelihood< complexT >::normMatrixArrayType

Definition at line 78 of file TPWALikelihood.h.

template<typename complexT>
typedef boost::multi_array<value_type, 2> TPWALikelihood< complexT >::phaseSpaceIntType

Definition at line 79 of file TPWALikelihood.h.

template<typename complexT>
typedef complexT::value_type TPWALikelihood< complexT >::value_type

Definition at line 69 of file TPWALikelihood.h.

template<typename complexT>
typedef boost::multi_array<std::string, 2> TPWALikelihood< complexT >::waveNameArrayType

Definition at line 72 of file TPWALikelihood.h.

template<typename complexT>
typedef boost::multi_array<double, 2> TPWALikelihood< complexT >::waveThrArrayType

Definition at line 73 of file TPWALikelihood.h.

template<typename complexT>
typedef boost::multi_array<unsigned int, 2> TPWALikelihood< complexT >::waveToIntMapType

Definition at line 74 of file TPWALikelihood.h.

template<typename complexT>
typedef boost::multi_array<unsigned int, 2> TPWALikelihood< complexT >::waveToListMapType

Definition at line 75 of file TPWALikelihood.h.

Member Enumeration Documentation

template<typename complexT>
enum TPWALikelihood::functionCallEnum
Enumerator:
FDF 
GRADIENT 
DOEVAL 
DODERIVATIVE 
NMB_FUNCTIONCALLENUM 

Definition at line 85 of file TPWALikelihood.h.

Constructor & Destructor Documentation

template<typename complexT >
TPWALikelihood< complexT >::TPWALikelihood ( )
template<typename complexT >
TPWALikelihood< complexT >::~TPWALikelihood ( )

Definition at line 98 of file TPWALikelihood.cc.

Member Function Documentation

template<typename complexT >
void TPWALikelihood< complexT >::buildParDataStruct ( const unsigned int  rank)
private

builds parameter data structures

Definition at line 631 of file TPWALikelihood.cc.

template<typename complexT>
void TPWALikelihood< complexT >::buildProdAmpArrays ( const double *  inPar,
std::vector< std::complex< double > > &  prodAmps,
std::vector< std::pair< int, int > > &  parIndices,
std::vector< std::string > &  prodAmpNames,
const bool  withFlat = false 
) const

Definition at line 1045 of file TPWALikelihood.cc.

Referenced by main().

template<typename complexT >
void TPWALikelihood< complexT >::clear ( )
private

Definition at line 1087 of file TPWALikelihood.cc.

template<typename complexT>
virtual TPWALikelihood* TPWALikelihood< complexT >::Clone ( ) const
inlinevirtual

clones the function using the default copy constructor

Definition at line 108 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::TPWALikelihood().

template<typename complexT >
void TPWALikelihood< complexT >::copyFromParArray ( const double *  inPar,
ampsArrayType outVal,
value_type outFlatVal 
) const

Definition at line 1126 of file TPWALikelihood.cc.

Referenced by main().

template<typename complexT >
void TPWALikelihood< complexT >::copyToParArray ( const ampsArrayType inVal,
const value_type  inFlatVal,
double *  outPar 
) const

Definition at line 1160 of file TPWALikelihood.cc.

template<typename complexT >
bool TPWALikelihood< complexT >::cudaEnabled ( ) const

Definition at line 530 of file TPWALikelihood.cc.

template<typename complexT>
double TPWALikelihood< complexT >::dLcache ( const unsigned int  i) const
inline

Definition at line 133 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_derivCache, and i.

template<typename complexT >
double TPWALikelihood< complexT >::DoDerivative ( const double *  par,
unsigned int  derivativeIndex 
) const
virtual

Definition at line 330 of file TPWALikelihood.cc.

References i.

template<typename complexT >
double TPWALikelihood< complexT >::DoEval ( const double *  par) const
virtual

Definition at line 227 of file TPWALikelihood.cc.

References conj().

Referenced by main().

template<typename complexT >
void TPWALikelihood< complexT >::enableCuda ( const bool  enableCuda = true)

Definition at line 524 of file TPWALikelihood.cc.

Referenced by main().

template<typename complexT >
void TPWALikelihood< complexT >::FdF ( const double *  par,
double &  funcVal,
double *  gradient 
) const
virtual

optimized method to evaluate function value and derivative at a point defined by par at the same time

Definition at line 107 of file TPWALikelihood.cc.

References conj(), and i.

Referenced by main().

template<typename complexT >
void TPWALikelihood< complexT >::getIntegralMatrices ( TCMatrix normMatrix,
TCMatrix accMatrix,
std::vector< double > &  phaseSpaceIntegral 
) const

Definition at line 1010 of file TPWALikelihood.cc.

References TCMatrix::set().

Referenced by main().

template<typename complexT >
int TPWALikelihood< complexT >::getReflectivity ( const TString &  waveName)
staticprivate

Definition at line 1097 of file TPWALikelihood.cc.

template<typename complexT >
void TPWALikelihood< complexT >::Gradient ( const double *  par,
double *  gradient 
) const
virtual

calculates gradient (vector of partial derivatives) of function at point defined by par

Definition at line 365 of file TPWALikelihood.cc.

References conj(), and i.

Referenced by main().

template<typename complexT >
void TPWALikelihood< complexT >::init ( const unsigned int  rank,
const std::string &  waveListFileName,
const std::string &  normIntFileName,
const std::string &  accIntFileName,
const std::string &  ampDirName = ".",
const unsigned int  numbAccEvents = 0,
const bool  useRootAmps = false 
)

prepares all internal data structures

Definition at line 542 of file TPWALikelihood.cc.

Referenced by main().

template<typename complexT>
double TPWALikelihood< complexT >::Ltime ( const functionCallEnum  func = FDF) const
inline

Definition at line 136 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_funcCallInfo.

template<typename complexT>
unsigned int TPWALikelihood< complexT >::ncalls ( const functionCallEnum  func = FDF) const
inline
template<typename complexT>
virtual unsigned int TPWALikelihood< complexT >::NDim ( ) const
inlinevirtual

returns total number of function parameters (= dimension of the function)

Definition at line 110 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::nmbPars().

Referenced by main().

template<typename complexT>
unsigned int TPWALikelihood< complexT >::nmbEvents ( ) const
inline

returns number of events that enter in the likelihood

Definition at line 124 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_nmbEvents.

Referenced by main().

template<typename complexT>
unsigned int TPWALikelihood< complexT >::nmbPars ( ) const
inline

returns total number of parameters

Definition at line 127 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_nmbPars.

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

template<typename complexT >
unsigned int TPWALikelihood< complexT >::nmbWaves ( const int  reflectivity = 0) const

returns total number of waves (reflectivity == 0) or number or number of waves with positive/negative reflectivity; flat wave is not counted!

Definition at line 505 of file TPWALikelihood.cc.

Referenced by main().

template<typename complexT>
double TPWALikelihood< complexT >::Ntime ( const functionCallEnum  func = FDF) const
inline

Definition at line 138 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_funcCallInfo.

template<typename complexT >
vector< unsigned int > TPWALikelihood< complexT >::orderedParIndices ( ) const

Definition at line 1226 of file TPWALikelihood.cc.

Referenced by main().

template<typename complexT>
std::string TPWALikelihood< complexT >::parName ( const unsigned int  parIndex) const
inline

returns name of likelihood parameter at parIndex

Definition at line 130 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_parNames.

Referenced by main().

template<typename complexT>
double TPWALikelihood< complexT >::parThreshold ( const unsigned int  parIndex) const
inline

returns threshold in GeV/c^2 above which likelihood parameter at parIndex becomes free

Definition at line 131 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_parThresholds.

Referenced by main().

template<typename complexT >
ostream & TPWALikelihood< complexT >::print ( std::ostream &  out = std::cout) const

Definition at line 1179 of file TPWALikelihood.cc.

template<typename complexT >
ostream & TPWALikelihood< complexT >::printFuncInfo ( std::ostream &  out = std::cout) const

Definition at line 1209 of file TPWALikelihood.cc.

References i.

Referenced by main().

template<typename complexT>
unsigned int TPWALikelihood< complexT >::rank ( ) const
inline

returns rank of spin density matrix

Definition at line 125 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_rank.

template<typename complexT >
void TPWALikelihood< complexT >::readDecayAmplitudes ( const std::string &  ampDirName = ".",
const bool  useRootAmps = false,
const std::string &  ampLeafName = "amplitude" 
)
private

reads decay amplitudes from files in specified directory

Definition at line 855 of file TPWALikelihood.cc.

References rpwa::amplitudeTreeLeaf::incohSubAmp(), and rpwa::amplitudeTreeLeaf::nmbIncohSubAmps().

template<typename complexT >
void TPWALikelihood< complexT >::readIntegrals ( const std::string &  normIntFileName,
const std::string &  accIntFileName,
const std::string &  integralTKeyName = "integral" 
)
private

reads normalization and acceptance integrals from file

Definition at line 759 of file TPWALikelihood.cc.

References integral::events(), integral::nevents(), and integral::scan().

template<typename complexT >
void TPWALikelihood< complexT >::readWaveList ( const std::string &  waveListFileName)
private

reads wave names and thresholds from wave list file

Definition at line 566 of file TPWALikelihood.cc.

References getReflectivity().

template<typename complexT >
void TPWALikelihood< complexT >::reorderIntegralMatrix ( integral integral,
normMatrixArrayType reorderedMatrix 
) const
private
template<typename complexT >
void TPWALikelihood< complexT >::reorderIntegralMatrix ( const rpwa::ampIntegralMatrix integral,
normMatrixArrayType reorderedMatrix 
) const
private

Definition at line 740 of file TPWALikelihood.cc.

References rpwa::ampIntegralMatrix::element().

template<typename complexT >
void TPWALikelihood< complexT >::resetFuncCallInfo ( ) const
private

Definition at line 1274 of file TPWALikelihood.cc.

References i.

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

template<typename complexT>
static void TPWALikelihood< complexT >::setQuiet ( const bool  flag = true)
inlinestatic

Definition at line 146 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_debug.

Referenced by main().

template<typename complexT>
void TPWALikelihood< complexT >::useNormalizedAmps ( const bool  useNorm = true)
inline

Definition at line 145 of file TPWALikelihood.h.

References TPWALikelihood< complexT >::_useNormalizedAmps.

Referenced by main().

template<typename complexT >
vector< string > TPWALikelihood< complexT >::waveNames ( ) const

returns vector with all wave names ordered like in input wave list

Definition at line 1260 of file TPWALikelihood.cc.

Referenced by main().

Friends And Related Function Documentation

template<typename complexT>
std::ostream& operator<< ( std::ostream &  out,
const TPWALikelihood< complexT > &  func 
)
friend

Definition at line 170 of file TPWALikelihood.h.

Member Data Documentation

template<typename complexT>
normMatrixArrayType TPWALikelihood< complexT >::_accMatrix
private

Definition at line 244 of file TPWALikelihood.h.

template<typename complexT>
bool TPWALikelihood< complexT >::_debug = true
staticprivate

Definition at line 222 of file TPWALikelihood.h.

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

template<typename complexT>
ampsArrayType TPWALikelihood< complexT >::_decayAmps
private

Definition at line 237 of file TPWALikelihood.h.

template<typename complexT>
std::vector<double> TPWALikelihood< complexT >::_derivCache
mutableprivate

Definition at line 240 of file TPWALikelihood.h.

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

template<typename complexT>
functionCallInfo TPWALikelihood< complexT >::_funcCallInfo[NMB_FUNCTIONCALLENUM]
mutableprivate
template<typename complexT>
unsigned int TPWALikelihood< complexT >::_nmbEvents
private

Definition at line 211 of file TPWALikelihood.h.

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

template<typename complexT>
unsigned int TPWALikelihood< complexT >::_nmbPars
private

Definition at line 216 of file TPWALikelihood.h.

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

template<typename complexT>
unsigned int TPWALikelihood< complexT >::_nmbWaves
private

Definition at line 213 of file TPWALikelihood.h.

template<typename complexT>
unsigned int TPWALikelihood< complexT >::_nmbWavesRefl[2]
private

Definition at line 214 of file TPWALikelihood.h.

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

template<typename complexT>
unsigned int TPWALikelihood< complexT >::_nmbWavesReflMax
private

Definition at line 215 of file TPWALikelihood.h.

template<typename complexT>
normMatrixArrayType TPWALikelihood< complexT >::_normMatrix
private

Definition at line 243 of file TPWALikelihood.h.

template<typename complexT>
unsigned int TPWALikelihood< complexT >::_numbAccEvents
private

Definition at line 224 of file TPWALikelihood.h.

template<typename complexT>
std::vector<double> TPWALikelihood< complexT >::_parCache
mutableprivate

Definition at line 239 of file TPWALikelihood.h.

template<typename complexT>
std::vector<std::string> TPWALikelihood< complexT >::_parNames
private

Definition at line 230 of file TPWALikelihood.h.

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

template<typename complexT>
std::vector<double> TPWALikelihood< complexT >::_parThresholds
private

Definition at line 231 of file TPWALikelihood.h.

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

template<typename complexT>
phaseSpaceIntType TPWALikelihood< complexT >::_phaseSpaceIntegral
private

Definition at line 245 of file TPWALikelihood.h.

template<typename complexT>
ampToParMapType TPWALikelihood< complexT >::_prodAmpToFuncParMap
private

Definition at line 232 of file TPWALikelihood.h.

template<typename complexT>
unsigned int TPWALikelihood< complexT >::_rank
private

Definition at line 212 of file TPWALikelihood.h.

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

template<typename complexT>
double TPWALikelihood< complexT >::_totAcc
private

Definition at line 225 of file TPWALikelihood.h.

template<typename complexT>
bool TPWALikelihood< complexT >::_useNormalizedAmps
private

Definition at line 221 of file TPWALikelihood.h.

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

template<typename complexT>
waveNameArrayType TPWALikelihood< complexT >::_waveNames
private

Definition at line 227 of file TPWALikelihood.h.

template<typename complexT>
waveThrArrayType TPWALikelihood< complexT >::_waveThresholds
private

Definition at line 228 of file TPWALikelihood.h.

template<typename complexT>
waveToListMapType TPWALikelihood< complexT >::_waveToWaveIndex
private

Definition at line 229 of file TPWALikelihood.h.


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