AmpTools
FitResults Class Reference

#include <FitResults.h>

Public Member Functions

 FitResults (ConfigurationInfo *cfgInfo, vector< IntensityManager * > intenManVec, map< string, LikelihoodCalculator * > likCalcMap, map< string, NormIntInterface * > normIntMap, MinuitMinimizationManager *minManager, ParameterManager *parManager)
 
 FitResults (const string &inFile)
 
 ~FitResults ()
 
bool valid () const
 
const NormIntInterfacenormInt (const string &reactionName) const
 
const ConfigurationInfoconfigInfo () const
 
double likelihood () const
 
double likelihood (const string &reactionName) const
 
pair< double, double > intensity (bool accCorrected=true) const
 
pair< double, double > intensity (const vector< string > &amplitudes, bool accCorrected=true) const
 
pair< double, double > phaseDiff (const string &amp1, const string &amp2) const
 
string realProdParName (const string &amplitude) const
 
string imagProdParName (const string &amplitude) const
 
string ampScaleName (const string &amplitude) const
 
double parValue (const string &parName) const
 
double parError (const string &parName) const
 
double covariance (const string &par1, const string &par2) const
 
map< string, complex< double > > ampProdParMap () const
 
map< string, double > ampScaleParMap () const
 
map< string, double > ampParMap () const
 
complex< double > productionParameter (const string &ampName) const
 
complex< double > scaledProductionParameter (const string &ampName) const
 
double ampScale (const string &ampName) const
 
int eMatrixStatus () const
 
int lastMinuitCommandStatus () const
 
int lastMinuitCommand () const
 
double minuitPrecision () const
 
int minuitStrategy () const
 
double estDistToMinimum () const
 
double bestMinimum () const
 
const vector< string > & parNameList () const
 
const vector< double > & parValueList () const
 
const vector< vector< double > > & errorMatrix () const
 
const vector< string > & reactionList () const
 
vector< string > ampList () const
 
vector< string > ampList (const string &reaction) const
 
void saveResults ()
 
void writeResults (const string &fileName) const
 
void writeSeed (const string &fileName) const
 
void loadResults (const string &fileName)
 
void rotateResults ()
 
void writeFitResults (const string &fileName)
 

Protected Member Functions

 FitResults (const FitResults &fitResults)
 
 FitResults ()
 
FitResultsoperator= (const FitResults &results)
 

Detailed Description

A class for storing the information from a fit and providing an interface to stored information so that subsequent analysis can be performed.

This class captures a snapshot of the relevant information from the AmplitudeManager, LikelihoodCalculator, MinuitMinimizationManager and ParameterManager after a fit. In addition it has the capability to store and redeliver NormIntInterface objects to provide the normalization integrals for the amplitude. It also stores a working copy of the configuration file used to perfrom the fit. The stored config file is not a verbatim copy of the original file, but it functions identically.

Definition at line 70 of file FitResults.h.

Constructor & Destructor Documentation

◆ FitResults() [1/4]

FitResults::FitResults ( ConfigurationInfo cfgInfo,
vector< IntensityManager * >  intenManVec,
map< string, LikelihoodCalculator * >  likCalcMap,
map< string, NormIntInterface * >  normIntMap,
MinuitMinimizationManager minManager,
ParameterManager parManager 
)

Constructor for recording results of fits.

This constructor should be used when the FitResults object is going to capture the results of a fit. It needs to have pointers to the various classes that contain critical information. FitResults d does not delete these pointers in its destructor so the calling function is responsible for managing the memory allocated by these objects. The AmpToolsInterface class utilizes this constructor. It is typically not the constructor that a user would use.

Parameters
[in]cfgInfopointer to ConfigurationInfo class
[in]intenManVecvector of IntensityManager pointers, one for each reaction
[in]likCalcMapmap from reaction name to LikelihoodCalculator pointer
[in]normIntMapmap from reaction name to NormIntInterface pointer
[in]parManagera pointer to the ParameterManager used in the fit

Definition at line 52 of file FitResults.cc.

◆ FitResults() [2/4]

FitResults::FitResults ( const string &  inFile)

Constructor for accessing the results of fits.

This constructor will reconstitute a FitResults object from a file. This is the constructor that is most useful for users to open and access saved results of the fit.

Parameters
[in]inFilethe name of the input file

Definition at line 71 of file FitResults.cc.

Here is the call graph for this function:

◆ ~FitResults()

FitResults::~FitResults ( )

The destructor.

The FitResults object only cleans up memory that it allocated itself. It will not delete the AmplitudeManagers, LikelihoodCalculator, etc. pointers that were passed in at construction time.

Definition at line 79 of file FitResults.cc.

◆ FitResults() [3/4]

FitResults::FitResults ( const FitResults fitResults)
protected

Copy constructor.

This is disabled to avoid memory handling complications since FitResults may hold pointers to many objects.

◆ FitResults() [4/4]

FitResults::FitResults ( )
protected

Default constructor.

Disabled. The user should use one of the two provided constructors.

Member Function Documentation

◆ ampList() [1/2]

vector< string > FitResults::ampList ( ) const

A single vector of all the amplitude names for all reactions.

Definition at line 574 of file FitResults.cc.

Here is the caller graph for this function:

◆ ampList() [2/2]

vector< string > FitResults::ampList ( const string &  reaction) const

A vector of amplitude names for a particular reaction.

Parameters
[in]reactionthe name of the reaction

Definition at line 596 of file FitResults.cc.

◆ ampParMap()

map< string, double > FitResults::ampParMap ( ) const

Return a map of parameter names (strings) to the values of the parameters for all amplitude parameters used in the fit.

Definition at line 472 of file FitResults.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ampProdParMap()

map< string, complex< double > > FitResults::ampProdParMap ( ) const

Return a map of amplitude names (strings) to values for the complex production amplitudes for each amplitude.

Definition at line 440 of file FitResults.cc.

Here is the call graph for this function:

◆ ampScale()

double FitResults::ampScale ( const string &  ampName) const

Return the real-valued scale for the amplitude. The default for this is unity, but some fits may scale amplitudes, e.g., for isospin relations within a fit, or float a common scale for several amplitudes.

Parameters
[in]ampNamethe name of the amplitude.

Definition at line 545 of file FitResults.cc.

Here is the caller graph for this function:

◆ ampScaleName()

string FitResults::ampScaleName ( const string &  amplitude) const

Return the name of the parameter for the scale factor for an amplitude

Parameters
[in]amplitudethe amplitude name

Definition at line 410 of file FitResults.cc.

Here is the caller graph for this function:

◆ ampScaleParMap()

map< string, double > FitResults::ampScaleParMap ( ) const

Return a map of amplitude names (strings) to values for the scale factors for each amplitude.

Definition at line 456 of file FitResults.cc.

Here is the call graph for this function:

◆ bestMinimum()

double FitResults::bestMinimum ( ) const
inline

The value of the best minimum found by MINUIT.

Definition at line 354 of file FitResults.h.

◆ configInfo()

const ConfigurationInfo* FitResults::configInfo ( ) const
inline

Returns a const pointer to the configuration info that is being used in the fit or was read in from the input file.

Definition at line 140 of file FitResults.h.

◆ covariance()

double FitResults::covariance ( const string &  par1,
const string &  par2 
) const

Return the covaraince of two parameters

Parameters
[in]par1the first parameter
[in]par2the second parameter

Definition at line 528 of file FitResults.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eMatrixStatus()

int FitResults::eMatrixStatus ( ) const
inline

Returns the status of the error matrix as reported by MINUIT at the end of the of the fit. The return value has the following meanings:

  0 = not calculated at all
  1 = approximation only, not accurate
  2 = full matrix, but forced positive-definite
  3 = full accurate covariance matrix
See also
MinuitMinimizationManager::EMatrixStatus

Definition at line 293 of file FitResults.h.

◆ errorMatrix()

const vector< vector< double > >& FitResults::errorMatrix ( ) const
inline

The covariance matrix of the fit. The order of the rows and columns is as the parameters appear in the parNameList.

See also
FitResults::parNameList

Definition at line 381 of file FitResults.h.

Here is the caller graph for this function:

◆ estDistToMinimum()

double FitResults::estDistToMinimum ( ) const
inline

The estimated distance to minimum as reported by MINUIT.

Definition at line 349 of file FitResults.h.

◆ imagProdParName()

string FitResults::imagProdParName ( const string &  amplitude) const

Return the name of the parameter for the imaginary value of the production coefficienct of an amplitude.

Parameters
[in]amplitudethe amplitude name

Definition at line 398 of file FitResults.cc.

Here is the caller graph for this function:

◆ intensity() [1/2]

pair< double, double > FitResults::intensity ( bool  accCorrected = true) const

Return the intensity (first) and its statistical error (second) for all amplitudes.

Parameters
[in]accCorrectedan optional boolean argument that when true (default) will correct the intenisty for acceptance and when false will not perform the correction

Definition at line 107 of file FitResults.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intensity() [2/2]

pair< double, double > FitResults::intensity ( const vector< string > &  amplitudes,
bool  accCorrected = true 
) const

Return the intensity (first) and its statistical error (second) for a subset of amplitudes. By default this is the acceptenace corrected intensity. To obtain the product of intensity weighted by the efficiency then pass in 'false' to the function.

Parameters
[in]amplitudesa vector of amplitudes names to sum over when calculating the intensity
[in]accCorrectedan optional boolean argument that when true (default) will correct the intenisty for acceptance and when false will not perform the correction

Definition at line 114 of file FitResults.cc.

Here is the call graph for this function:

◆ lastMinuitCommand()

int FitResults::lastMinuitCommand ( ) const
inline

An integer corresponding to the last command that was executed by the MinuitMinimizationManager. The return value has the following meaning:

  0 = unkown
  1 = migrad
  2 = minos
  3 = hesse
See also
MinuitMinimizationManager::Commands

Definition at line 325 of file FitResults.h.

◆ lastMinuitCommandStatus()

int FitResults::lastMinuitCommandStatus ( ) const
inline

Returns the status of the last command executed by MINUIT. It may be useful to use this to verify that minimization did not terminate abnormally. Many of the other potential return values are not possible because the user does not interact with MINUIT directly. The return value has the following meanings:

  -1 = undefined status
   0 = normal
   1 = blank command
   2 = unreadable command
   3 = unkown command
   4 = abnormal termination (e.g., MIGRAD not converged)
See also
MinuitMinimizationManager::MinuitStatus

Definition at line 311 of file FitResults.h.

◆ likelihood() [1/2]

double FitResults::likelihood ( ) const
inline

Return the global likelihood.

Definition at line 145 of file FitResults.h.

◆ likelihood() [2/2]

double FitResults::likelihood ( const string &  reactionName) const

Return the contribution the global likelihood from a particular reaction.

Parameters
[in]reactionNamethe name of the reaction

Definition at line 93 of file FitResults.cc.

Here is the call graph for this function:

◆ loadResults()

void FitResults::loadResults ( const string &  fileName)

Reconstitutues a FitResults object from a file. Users will typically not use this function directly, but instead use the constructor that calls this function. It remains public for convenience.

Parameters
[in]fileNameloadResults

Definition at line 758 of file FitResults.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ minuitPrecision()

double FitResults::minuitPrecision ( ) const
inline

The value that MINUIT is assuming for the machine precision when performing calculations of the likelihood. This is typically automatically determined by MINUIT, however some fits, especially those that use GPU hardware, may need to specify this precision so MINUIT doesn't try to minimize what are fluctions in the likelihood due to machine precision.

Definition at line 336 of file FitResults.h.

◆ minuitStrategy()

int FitResults::minuitStrategy ( ) const
inline

The minimization strategy used by MINUIT. See MINUIT documenation for details. Strategy ranges from 0-2 with 0 being the fastest and 2 being the most robust. Any final fits should be done with strategy 2 to guarantee a proper minium.

Definition at line 344 of file FitResults.h.

◆ normInt()

const NormIntInterface * FitResults::normInt ( const string &  reactionName) const

Returns a const pointer to the NormIntInterface that is being used in the fit or was reconstructed from the input file.

Parameters
[in]reactionNamethe name reaction to return the interface for

Definition at line 366 of file FitResults.cc.

◆ operator=()

FitResults& FitResults::operator= ( const FitResults results)
protected

The assignment operator is disabled due to complications with memory handling.

◆ parError()

double FitResults::parError ( const string &  parName) const

Return the error on a parameter.

Parameters
[in]parNamethe name of the parameter

Definition at line 522 of file FitResults.cc.

Here is the call graph for this function:

◆ parNameList()

const vector< string >& FitResults::parNameList ( ) const
inline

A vector of all the names of all of the parameters that used in the fit. These are the actual parameters that MINUIT is manipulating. The values of the parameters can be obtained by the parValueList function and appear in the same order as the names.

See also
FitResults::parValueList

Definition at line 365 of file FitResults.h.

◆ parValue()

double FitResults::parValue ( const string &  parName) const

Return the value of a parameter.

Parameters
[in]parNamethe name of the parameter

Definition at line 506 of file FitResults.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parValueList()

const vector< double >& FitResults::parValueList ( ) const
inline

A vector of all of the values of the parameters that are used in the fit. The order is as they appear in the parNameList.

See also
FitResults::parNameList

Definition at line 373 of file FitResults.h.

◆ phaseDiff()

pair< double, double > FitResults::phaseDiff ( const string &  amp1,
const string &  amp2 
) const

Return the pahse difference (first) and its error (second) in radians for two different amplitudes.

Parameters
[in]amp1the first amplitude
[in]amp2the second amplitude

Definition at line 299 of file FitResults.cc.

Here is the call graph for this function:

◆ productionParameter()

complex< double > FitResults::productionParameter ( const string &  ampName) const

Return the value of the complex production parameter for an amplitude.

Parameters
[in]ampNamethe name of the amplitude

Definition at line 490 of file FitResults.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reactionList()

const vector< string >& FitResults::reactionList ( ) const
inline

A vector of all of the reaction names.

Definition at line 386 of file FitResults.h.

◆ realProdParName()

string FitResults::realProdParName ( const string &  amplitude) const

Return the name of the parameter for the real value of the production coefficienct of an amplitude.

Parameters
[in]amplitudethe amplitude name

Definition at line 386 of file FitResults.cc.

Here is the caller graph for this function:

◆ rotateResults()

void FitResults::rotateResults ( )

Rotates the results of a fit to have the following phase convention:

  1. In a loop over the amplitudes, the first one which is constrained to be real must have a positive value
  2. The total amplitude must have a positive phase

Definition at line 969 of file FitResults.cc.

Here is the call graph for this function:

◆ saveResults()

void FitResults::saveResults ( )

This function fetches the likelihood, parameters, MINUIT status, from all of the various classes and captures this info as member data of this class. It is the function used after a fit to take a snapshot of the results.

Definition at line 610 of file FitResults.cc.

Here is the caller graph for this function:

◆ scaledProductionParameter()

complex< double > FitResults::scaledProductionParameter ( const string &  ampName) const

Return the value of the complex production parameter scaled by the scale factor. This is the actual production amplitude used in the fit.

Parameters
[in]ampNamethe name of the amplitude.

Definition at line 500 of file FitResults.cc.

Here is the call graph for this function:

◆ valid()

bool FitResults::valid ( ) const
inline

A function to test if the FitResults object is valid. This returns true if the object was successfully constructed from a file

Definition at line 126 of file FitResults.h.

◆ writeFitResults()

void FitResults::writeFitResults ( const string &  fileName)

Definition at line 1149 of file FitResults.cc.

◆ writeResults()

void FitResults::writeResults ( const string &  fileName) const

Writes the current fit results object to a file. It sould typically be called after saveResults.

Parameters
[in]fileNamethe name of the output file

Definition at line 622 of file FitResults.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeSeed()

void FitResults::writeSeed ( const string &  fileName) const

Writes a file that is useful for seeding the results of subsequent fits. The file contains commands to initalize the production parameters of the amplitudes to the current values stored in the FitResults object.

Parameters
[in]fileNamethe name of the output file

Definition at line 707 of file FitResults.cc.

Here is the call graph for this function:

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