![]() |
AmpTools
|
#include <IntensityManager.h>
Public Types | |
enum | Type { kAmplitude, kMoment } |
Public Member Functions | |
IntensityManager (const vector< string > &reaction, const string &reactionName) | |
virtual | ~IntensityManager () |
virtual Type | type () const =0 |
virtual unsigned int | maxFactorStoragePerEvent () const =0 |
virtual unsigned int | termStoragePerEvent () const =0 |
virtual bool | calcTerms (AmpVecs &Vecs) const =0 |
virtual double | calcIntensities (AmpVecs &Vecs) const =0 |
virtual double | calcSumLogIntensity (AmpVecs &Vecs) const =0 |
virtual void | calcIntegrals (AmpVecs &Vecs, int iNGenEvents) const =0 |
double | calcIntensity (const Kinematics *kinematics) const |
const vector< string > & | getTermNames () const |
const AmpParameter & | getScale (const string &name) const |
virtual bool | hasTermWithFreeParam () const =0 |
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 |
virtual void | setupFromConfigurationInfo (const ConfigurationInfo *configInfo)=0 |
int | addTerm (const string &termName, const string &scale="1.0") |
void | setDefaultProductionFactor (const string &termName, complex< double > prodAmp) |
void | setExternalProductionFactor (const string &Name, const complex< double > *prodAmpPtr) |
virtual void | setParPtr (const string &termName, const string &parName, const double *ampParPtr) |
virtual void | setParValue (const string &termName, const string &parName, double ampParValue) |
virtual void | updatePar (const string &parName) const |
void | resetProductionFactors () |
bool | termsAreRenormalized () const |
Protected Member Functions | |
const NormIntInterface * | normInt () const |
Definition at line 53 of file IntensityManager.h.
Enumerator | |
---|---|
kAmplitude | |
kMoment |
Definition at line 57 of file IntensityManager.h.
IntensityManager::IntensityManager | ( | const vector< string > & | reaction, |
const string & | reactionName | ||
) |
Definition at line 56 of file IntensityManager.cc.
|
inlinevirtual |
Definition at line 62 of file IntensityManager.h.
int IntensityManager::addTerm | ( | const string & | termName, |
const string & | scale = "1.0" |
||
) |
This function adds a new term to the intensity calculation with the name termName. The unique index of this term is provided as a return value, which may be helpful in optimization.
[in] | termName | the name of the new term. If the term already exists then no new term will be created and the index of the old term will be returned (and a warning message will be printed). |
[in] | scale | (optional) the name of a parameter to use for the the scale factor for the term. |
Definition at line 86 of file IntensityManager.cc.
|
pure virtual |
This routine calculates the average values of A_iA_j*, which is useful for normalizing the PDFs. The results are stored in the AmpVecs object.
[in,out] | ampVecs | a reference to the ampVecs structure from which the terms and factors are to be read. |
[in] | iNGenEvents | the number of genereated events (N in the above computation) |
Implemented in AmplitudeManager.
|
pure 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.
[in,out] | ampVecs | a reference to the AmpVecs storage structure, four vectors will be read from this class and intensities written to it. |
Implemented in AmplitudeManager.
double IntensityManager::calcIntensity | ( | const Kinematics * | kinematics | ) | const |
This function calculates the intensity for one event using a Kinematics object. This is only useful for diagnostics on a small number of events. The calcIntensities method should be used to calculate intensities for many events.
[in] | kinematics | a pointer to a Kinematics object |
Definition at line 66 of file IntensityManager.cc.
|
pure virtual |
This function calculates and returns the sum of the log of the intensities stored in the AmpVecs structure.
[in,out] | ampVecs | a reference to the ampVecs structure from which the intensities are to be read. (This structure may be modified and updated by underlying calls to calcIntensities and calcTerms.) |
Implemented in AmplitudeManager.
|
pure virtual |
This function caculates the various intensity terms for each data event. Since it can also be used to update the terms, it returns true if any term was reclaculated, false if there were no changes.
[in,out] | ampVecs | a reference to the AmpVecs storage structure, four vectors will be read from this class and term caculations will be written to this class |
Implemented in AmplitudeManager.
const AmpParameter & IntensityManager::getScale | ( | const string & | name | ) | const |
The function returns a reference to the parameter that is acting as the scale factor for an amplitude. Even if the user does not set a scale factor, by default a fixed parameter is created and its value is inititalized to 1.
Definition at line 111 of file IntensityManager.cc.
const vector< string > & IntensityManager::getTermNames | ( | ) | const |
This function returns a vector of strings. Each string corresponds to the name of a unique amplitude in the amplitude manager. The location of each amplitude in the vector represents the ampIndex, an integer corresponding to each amplitude that is largely used internally.
Definition at line 105 of file IntensityManager.cc.
bool IntensityManager::hasTerm | ( | const string & | termName | ) | const |
This class returns a boolean indicating whether or not a term with the provided name exists in the IntensityManager.
[in] | termName | the string identifying the term |
Definition at line 126 of file IntensityManager.cc.
|
pure virtual |
This function returns a boolean indicating if any term in the IntensityManager 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.
Implemented in AmplitudeManager.
|
pure virtual |
This function should return the maximum number of doubles required to store all factors for any terms for an event. It is used by the framework for memory allocation.
Implemented in AmplitudeManager.
|
inlineprotected |
void IntensityManager::prodFactorArray | ( | double * | array | ) | const |
This fills an array with the real and imaginary parts of the ith production factor in the 2*i and 2*i+1 elements. It is less user friendly, but useful for repeated high-speed access to the data
[out] | prodArray | array of size 2*n that will be filled |
Definition at line 153 of file IntensityManager.cc.
complex< double > IntensityManager::productionFactor | ( | const string & | termName | ) | const |
This return returns the production factor ( ) for a a single term. In general this is a complex number, for moment fits it will have no imaginary part.
[in] | ampName | the string identifying the amplitude |
Definition at line 134 of file IntensityManager.cc.
complex< double > IntensityManager::productionFactor | ( | int | termIndex | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[in] | ampIndex | the index of the amplitude |
Definition at line 146 of file IntensityManager.cc.
|
inline |
This returns the name of the final state that was optionally passed to the constructor of the AmplitudeManager.
Definition at line 217 of file IntensityManager.h.
void IntensityManager::resetProductionFactors | ( | ) |
This resets all of the production amplitudes to their default values. If production amplitudes were referenced from external pointers, this external referencing is broken by this call and the amplitudes are instead derived by internally stored default values.
Definition at line 193 of file IntensityManager.cc.
void IntensityManager::setDefaultProductionFactor | ( | const string & | termName, |
complex< double > | prodAmp | ||
) |
This is used to set the default production amplitude ( ) for a specific amplitude. The production amplitude is the complex number that multiplies the decay amplitude (a collection of amplitude factors) in the construction of the intensity. When fitting, this production amplitude is typically a free parameter or is constrained to some other free parameter in the fit. To generate Monte Carlo, it is useful to be able to set this value to any arbitrary complex number
[in] | ampName | the name of the amplitude that is having its production amplitude set |
[in] | prodAmp | the complex value of the production amplitude to set |
Definition at line 168 of file IntensityManager.cc.
void IntensityManager::setExternalProductionFactor | ( | const string & | ampName, |
const complex< double > * | prodAmpPtr | ||
) |
This is used to set the memory location to which the AmplitudeManager should look to find the production amplitude for a particular amplitude. Note that the AmplitudeManager does not have control over this memory. This relies on the user to create and preserve the memory that holds the acutal values. This is particularly useful when fitting where the ParameterManager manages and updates the production amplitudes and the AmplitudeManager can just look at this memory to recalculate the intensity.
[in] | ampName | the name of the amplitude to set the production parameter for |
[in] | prodAmpPtr | a pointer to memory where the AmplitudeManager can look for the production amplitude |
Definition at line 177 of file IntensityManager.cc.
|
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.
[in] | ampName | the name of the amplitude that contains a factor that contains the paramter of interest |
[in] | parName | the name of the parameter |
[in] | ampParPtr | a pointer to external memory that tells the amplitude where to find the value of the parameter |
Reimplemented in AmplitudeManager.
Definition at line 205 of file IntensityManager.cc.
|
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.
[in] | ampName | the name of the amplitude that contains a factor that contains the paramter of interest |
[in] | parName | the name of the parameter |
[in] | ampParValue | the value to which to set the parameter |
Reimplemented in AmplitudeManager.
Definition at line 215 of file IntensityManager.cc.
|
pure virtual |
This function sets up the IntensityManager 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.
[in] | configInfo | a pointer to a ConfigurationInfo object |
Implemented in AmplitudeManager.
int IntensityManager::termIndex | ( | const string & | termName | ) | const |
This returns the internal index of a term. It is useful for users who may want to index data in an array.
[in] | termName | the name of the term to get the index of |
Definition at line 117 of file IntensityManager.cc.
|
inline |
This will cause amplitude manager to renormalize amplitudes in computations of the intensity only. Each amplitude will be multipled by a factor of that comes from the normalization integral interface.
This scaling is useful when fitting data as it results in a trivial relation between the fit parameters (production amplitudes) and the number of events associated with each amplitude.
This feature should be used with caution when coupled with constraints on the production parameters. If two amplitudes are constrained to have the same production coefficient and have the same scale, turning on renormalization will essentially for the two amplitudes to have the same number of events in the fit.
The default behavior is to have renormalization turned off.
Results of calcAmplitudes or calcIntegrals will remain unchanged. Note that this is necessary to avoid a circular dependency.
(Temporarily disabled until NormIntInterface supports renormalization of amplitudes with free parameters.)
[in] | normInt | the interface to provide normalization integrals |
(Temporarily disabled until NormIntInterface supports renormalization of amplitudes with free parameters.)
Definition at line 450 of file IntensityManager.h.
|
pure virtual |
This function should return the number of doubles required to store all terms for an event. It should be equal to or smaller than that returned by the termFactorStoragePerEvent. The reason being that each term may be composed of multiple factors (for multiple permutations in the case of an amplitude fit). Once the factors are assembled into a term then, as long as the factors don't change, this term (modulo the production factor) remains constant throughout the fit.
Implemented in AmplitudeManager.
|
pure virtual |
This function returns the type of IntensityManager.
The types currently implimented are kAmplitude and kMoment for AmplitudeManager and MomentManager.
Implemented in AmplitudeManager.
|
inlinevirtual |
This function will be called whenever a parameter is updateded.
Reimplemented in AmplitudeManager.
Definition at line 390 of file IntensityManager.h.