AmpTools
AmplitudeManager Class Reference

#include <AmplitudeManager.h>

Inheritance diagram for AmplitudeManager:
Collaboration diagram for AmplitudeManager:

Public Member Functions

 AmplitudeManager (const vector< string > &finalState, const string &reactionName="")
 
 ~AmplitudeManager ()
 
Type type () const
 
unsigned int maxFactorStoragePerEvent () const
 
unsigned int termStoragePerEvent () const
 
bool calcTerms (AmpVecs &ampVecs) const
 
double calcIntensities (AmpVecs &ampVecs) const
 
double calcSumLogIntensity (AmpVecs &ampVecs) const
 
void calcIntegrals (AmpVecs &ampVecs, int iNGenEvents) const
 
const vector< vector< int > > & getPermutations (const string &name) const
 
const vector< const Amplitude *> & getFactors (const string &name) const
 
bool hasTermWithFreeParam () const
 
void setupFromConfigurationInfo (const ConfigurationInfo *configInfo)
 
void addAmpFactor (const string &ampName, const string &factorName, const vector< string > &args, const string &sum="", const string &scale="1.0")
 
void addAmpPermutation (const string &ampName, const vector< int > &permutation)
 
void registerAmplitudeFactor (const Amplitude &defaultAmplitude)
 
void setParPtr (const string &termName, const string &parName, const double *ampParPtr)
 
void setParValue (const string &termName, const string &parName, double ampParValue)
 
void updatePar (const string &parName) const
 
void setOptimizeParIteration (bool flag)
 
- Public Member Functions inherited from IntensityManager
 IntensityManager (const vector< string > &reaction, const string &reactionName)
 
virtual ~IntensityManager ()
 
double calcIntensity (const Kinematics *kinematics) const
 
const vector< string > & getTermNames () const
 
const AmpParametergetScale (const string &name) const
 
int termIndex (const string &termName) const
 
string reactionName () const
 
complex< double > productionFactor (const string &termName) const
 
complex< double > productionFactor (int termIndex) const
 
void prodFactorArray (double *array) const
 
bool hasTerm (const string &termName) const
 
int addTerm (const string &termName, const string &scale="1.0")
 
void setDefaultProductionFactor (const string &termName, complex< double > prodAmp)
 
void setExternalProductionFactor (const string &ampName, const complex< double > *prodAmpPtr)
 
void resetProductionFactors ()
 
bool termsAreRenormalized () const
 

Additional Inherited Members

- Public Types inherited from IntensityManager
enum  Type { kAmplitude, kMoment }
 
- Protected Member Functions inherited from IntensityManager
const NormIntInterfacenormInt () const
 

Detailed Description

A class for managing the construction of a sum of amplitudes.

This class is used to construct the intensity for each event. It manages multiple interfering amplitudes, each of which can be composed of multiple amplitude factors. It also maintains a link to the production parameters (typically fit parameters) stored by the parameter manager.

Tyipcally the user will setup this class once at the start of some job which could be either fitting data or generating Monte Carlo. Once the class is setup, then the const member functions can be called to calculate intensities for blocks of events.

There should be one instance of the AmplitudeManager for each reaction or set of unique final state particles in the fit.

Definition at line 85 of file AmplitudeManager.h.

Constructor & Destructor Documentation

◆ AmplitudeManager()

AmplitudeManager::AmplitudeManager ( const vector< string > &  finalState,
const string &  reactionName = "" 
)

Constructor. Constructs an AmplitudeManager

Parameters
[in]finalStatea vector of strings, one to identify each final state argument. Particles with identical string identifiers will be automatically permuted when the intesnity is calculated.
[in]reactionNamean optional name for the reaction
See also
getPermutations
addAmpPermutation

Definition at line 50 of file AmplitudeManager.cc.

◆ ~AmplitudeManager()

AmplitudeManager::~AmplitudeManager ( )

Destructor.

Definition at line 137 of file AmplitudeManager.cc.

Member Function Documentation

◆ addAmpFactor()

void AmplitudeManager::addAmpFactor ( const string &  ampName,
const string &  factorName,
const vector< string > &  args,
const string &  sum = "",
const string &  scale = "1.0" 
)

This routine will create an instance of the amplitude specified in factorName using the arguments specified in args and add it to the list of factors that define the amplitude ampName in the (optional) sum. Before addAmpFactor can be called, the specific type of amplitude (factorName) that user wants to add needs to be registered with the AmplitudeManager.

Parameters
[in]ampNamethe name of the amplitude inside of the AmplitudeManager to which the factor is to be added. If an amplitude with this name does not exist already, then it will be created.
[in]factorNamethe type of amplitude to be added. This is typically the name of a user-defined class that inherits from the Amplitude base class. It must be registered in advance and factorName should match the return value of the member function name() in the amplitude class.
[in]argsa list of arguments to passed in the creation of the new amplitude factor. This vector gets passed on to the newAmplitude function defined in the users amplitude class.
[in]sum(optional) the name of a coherent sum that the amplitude should be added to (for use in cases where multiple coherent sums are needed to construct the intensity).
[in]scale(optional) the name of a parameter to use for the the scale factor for the full amplitude (not a factor). This must be passed in the with the first factor of the amplitude. The setupFromConfigurationInfo method does this properly.
See also
getFactors
registerAmplitudeFactor
Amplitude::newAmplitude

Definition at line 641 of file AmplitudeManager.cc.

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

◆ addAmpPermutation()

void AmplitudeManager::addAmpPermutation ( const string &  ampName,
const vector< int > &  permutation 
)

This adds an additional permutation to any amplitude that is has not already been added by the constructor. Particles with identical names are permuted automatically (this is setup in the constructor), but there are other cases where one may want to permute particles for a particular amplitude. For example if one is analyzing the final state with particle names "K+" "K-" "pi0", the default permutation 0 1 2 will exist for all amplitudes. It is possible that one wants to define a K* amplitude that incorporates CP symmetry and therefore the permutation 1 0 2 (swapping the two charged kaons) should also be added to the amplitude. The routine checks to be sure that all permutations are unique to avoid double-counting.

Parameters
[in]ampNamethe name of the amplitude to which to add the permutation
[in]permutationthe vector of integers describing how to rearrange the particle indices. The four momentum of the particle in the i^th position of the vector will be replaced by the four momentum of the particle indexed by the value in the i^th position of the vector.
See also
getPermutations

Definition at line 719 of file AmplitudeManager.cc.

Here is the caller graph for this function:

◆ calcIntegrals()

void AmplitudeManager::calcIntegrals ( AmpVecs ampVecs,
int  iNGenEvents 
) const
virtual

This routine calculates a square matrix with dimension equal to the number of amplitudes and each element (index i,j) set to $ \sum_{k=1}^{N} w_k A_i A_j^* / N $, where N is the number of events in the ampVecs structure and $ w_k $ is the weight of each event. In general the matrix is block diagonal since the elements i,j where amplitudes i and j appear in different coherent sums are zero. The returned matrix is packed in a flat array of doubles with size 2*n^2. Access to the real and imaginary parts of element i,j is by 2*i*n+2*j and 2*i*n+2*j+1, respectively.

Parameters
[in,out]ampVecsa reference to the ampVecs structure from which the amplitudes are to be read. (This structure will be modified and updated by underlying calls to calcAmplitudes.)
[in]iNGenEventsthe number of genereated events (N in the above computation)
[in]bIsFirstPassan optional boolean argument to aid in optimizaiton of calculations if the amplitudes have not changed. Set to true if it is the first computation on this data set, and set to false otherwise.
See also
calcAmplitudes
calcIntensities

Implements IntensityManager.

Definition at line 531 of file AmplitudeManager.cc.

Here is the call graph for this function:

◆ calcIntensities()

double AmplitudeManager::calcIntensities ( AmpVecs ampVecs) const
virtual

This function calculates the intensity (one number) for all events and stores it in the AmpVecs structure. It returns the maximum intensity in the data set, which is useful for accept/reject MC generation algorithms. The routine will call calcAmplitudes, so the amplitudes do not need to be explicitly calculated first.

Parameters
[in,out]ampVecsa reference to the AmpVecs storage structure, four vectors will be read from this class and intensities written to it.
See also
calcAmplitudes
calcSumLogIntensity
calcIntegrals

Implements IntensityManager.

Definition at line 359 of file AmplitudeManager.cc.

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

◆ calcSumLogIntensity()

double AmplitudeManager::calcSumLogIntensity ( AmpVecs ampVecs) const
virtual

This function calculates and returns the sum of the log of the intensities stored in the AmpVecs structure. The routine will call calcIntensities so the intensities do not need to be explicitly calculated first.

Parameters
[in,out]ampVecsa reference to the ampVecs structure from which the intensities are to be read. (This structure will be modified and updated by underlying calls to calcIntensities and calcAmplitudes.)
See also
calcAmplitudes
calcIntensities
calcIntegrals

Implements IntensityManager.

Definition at line 465 of file AmplitudeManager.cc.

Here is the call graph for this function:

◆ calcTerms()

bool AmplitudeManager::calcTerms ( AmpVecs ampVecs) const
virtual

This function caculates the amplitudes for each data event and stores them in the AmpVecs structure. It returns true if it alters the terms in the structure (helpful to see if an update actually happenend when recalculating).

Parameters
[in,out]ampVecsa reference to the AmpVecs storage structure, four vectors will be read from this class and amplitude caculations will be written to this class
See also
calcIntensities
calcSumLogIntensity
calcIntegrals

Implements IntensityManager.

Definition at line 205 of file AmplitudeManager.cc.

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

◆ getFactors()

const vector< const Amplitude *> & AmplitudeManager::getFactors ( const string &  name) const

This function returns a vector of const points to the Amplitude classes that make up the factors that are multipled together to get a single amplitude.

Parameters
[in]namethe name of the amplitude to get the factors of
See also
addAmpFactor
registerAmplitudeFactor

Definition at line 629 of file AmplitudeManager.cc.

Here is the caller graph for this function:

◆ getPermutations()

const vector< vector< int > > & AmplitudeManager::getPermutations ( const string &  name) const

The function returns a list of permutations that will be performed on a particular amplitude when then amplitude is computed. Each permutation is a list of vectors that specifies how to reorder the particles in the amplitude calculation. For example, in a four-particle final state the default permutation (the one that exists for every amplitude) is 0 1 2 3. If particles 2 and 3 are to be permuted in computing the amplitude then the vector 0 1 3 2 will also be in the list of permutations.

Parameters
[in]namethe name of the amplitude to get the permutations for
See also
addAmpPermutation

Definition at line 617 of file AmplitudeManager.cc.

Here is the caller graph for this function:

◆ hasTermWithFreeParam()

bool AmplitudeManager::hasTermWithFreeParam ( ) const
virtual

This function returns a boolean indicating if any amplitude in the AmplitudeManager contains a free parameter than might be changing with each fit iteration. It is used to trigger the recalculation of normalization integrals at each fit iteration.

See also
setParPtr
setParValue

Implements IntensityManager.

Definition at line 192 of file AmplitudeManager.cc.

Here is the caller graph for this function:

◆ maxFactorStoragePerEvent()

unsigned int AmplitudeManager::maxFactorStoragePerEvent ( ) const
virtual

This function returns the number of doubles needed to store all factors for all amplitudes for each permutation in each event. It is the maximum of number of factors * number of permutations for any term.

Implements IntensityManager.

Definition at line 158 of file AmplitudeManager.cc.

Here is the call graph for this function:

◆ registerAmplitudeFactor()

void AmplitudeManager::registerAmplitudeFactor ( const Amplitude defaultAmplitude)

This function is used to register a user-defined amplitude, which inherits from the amplitude base class. Amplitudes must be registered before they can be added as factors to specifc, named decay amplitudes in the AmplitudeManager.

Parameters
[in]defaultAmplitudea reference to user-defined amplitude object that is simply constructed using the default construction. For example if the user amplitude class is called MyAmp, the call
ampManager.registerAmplitudeFactor( MyAmp() )
is sufficent to register the amplitude.
See also
addAmpFactor

Definition at line 895 of file AmplitudeManager.cc.

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

◆ setOptimizeParIteration()

void AmplitudeManager::setOptimizeParIteration ( bool  flag)
inline

This function can be used to set a flag to optimize subsequent calls to calcTerms in the case that amplitudes have free parameters. It uses functionality in the updatePar function to only force a recalculation of the amplitude for a particular AmpVecs class if one of the AmpParameters for that amplitude has changed since the last calculation. This should signficiantly enhance the speed for fits with parameters floating in amplitudes, since there will only be an expensive recomputation when MINUIT changes the parameter.

Parameters
[in]flagset to true to enable the optimization

Definition at line 403 of file AmplitudeManager.h.

◆ setParPtr()

void AmplitudeManager::setParPtr ( const string &  termName,
const string &  parName,
const double *  ampParPtr 
)
virtual

This tells an amplitude to use an external pointer to resolve the value of some parameter inside of an amplitude. The parameter is not a production paramater as discussed above, but instead a parameter that may be floating in the description of the decay, e.g., the mass or width of some state. This routine is here for convenience, one could also get a list of all the amplitude factors and check each one for the parameter and then use the functionality of the Amplitude class to set the parameter pointer.

Parameters
[in]ampNamethe name of the amplitude that contains a factor that contains the paramter of interest
[in]parNamethe name of the parameter
[in]ampParPtra pointer to external memory that tells the amplitude where to find the value of the parameter
See also
setAmpParValue
Amplitude::setParPtr

Reimplemented from IntensityManager.

Definition at line 831 of file AmplitudeManager.cc.

Here is the call graph for this function:

◆ setParValue()

void AmplitudeManager::setParValue ( const string &  termName,
const string &  parName,
double  ampParValue 
)
virtual

This tells an amplitude to use a particular value for some parameter inside of an amplitude. The parameter is not a production paramater as discussed above, but instead a parameter that may be floating in the description of the decay, e.g., the mass or width of some state. This routine is here for convenience, one could also get a list of all the amplitude factors and check each one for the parameter and then use the functionality of the Amplitude class to set the parameter value.

Parameters
[in]ampNamethe name of the amplitude that contains a factor that contains the paramter of interest
[in]parNamethe name of the parameter
[in]ampParValuethe value to which to set the parameter
See also
setAmpParValue
Amplitude::setParValue

Reimplemented from IntensityManager.

Definition at line 850 of file AmplitudeManager.cc.

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

◆ setupFromConfigurationInfo()

void AmplitudeManager::setupFromConfigurationInfo ( const ConfigurationInfo configInfo)
virtual

This function sets up the AmplitudeManager based on information provided by a ConfigurationInfo object. It is intended to be the most user-friendly way of configuring the amplitude manager for use.

Parameters
[in]configInfoa pointer to a ConfigurationInfo object

Implements IntensityManager.

Definition at line 771 of file AmplitudeManager.cc.

Here is the call graph for this function:

◆ termStoragePerEvent()

unsigned int AmplitudeManager::termStoragePerEvent ( ) const
virtual

This function returns the number of doubles needed to store all complete complex decay amplitudes for each event. It is just 2 * nAmps the size of a double.

Implements IntensityManager.

Definition at line 182 of file AmplitudeManager.cc.

Here is the call graph for this function:

◆ type()

Type AmplitudeManager::type ( ) const
inlinevirtual

This returns an enum to identify the type of intensity calculation being done.

Implements IntensityManager.

Definition at line 113 of file AmplitudeManager.h.

◆ updatePar()

void AmplitudeManager::updatePar ( const string &  parName) const
virtual

This function will be called whenever a parameter is updated.

See also
Amplitude::updatePar

Reimplemented from IntensityManager.

Definition at line 873 of file AmplitudeManager.cc.


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