![]() |
AmpTools
|
#include <AmplitudeManager.h>
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 &Vecs) const |
double | calcIntensities (AmpVecs &Vecs) const |
double | calcSumLogIntensity (AmpVecs &Vecs) const |
void | calcIntegrals (AmpVecs &Vecs, 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 &Name, const string &factorName, const vector< string > &args, const string &sum="", const string &scale="1.0") |
void | addAmpPermutation (const string &Name, 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) |
![]() | |
IntensityManager (const vector< string > &reaction, const string &reactionName) | |
virtual | ~IntensityManager () |
double | calcIntensity (const Kinematics *kinematics) const |
const vector< string > & | getTermNames () const |
const AmpParameter & | getScale (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 &Name, const complex< double > *prodAmpPtr) |
void | resetProductionFactors () |
bool | termsAreRenormalized () const |
Additional Inherited Members | |
![]() | |
enum | Type { kAmplitude, kMoment } |
![]() | |
const NormIntInterface * | normInt () const |
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.
AmplitudeManager::AmplitudeManager | ( | const vector< string > & | finalState, |
const string & | reactionName = "" |
||
) |
Constructor. Constructs an AmplitudeManager
[in] | finalState | a 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] | reactionName | an optional name for the reaction |
Definition at line 50 of file AmplitudeManager.cc.
AmplitudeManager::~AmplitudeManager | ( | ) |
Destructor.
Definition at line 137 of file AmplitudeManager.cc.
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.
[in] | ampName | the 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] | factorName | the 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] | args | a 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. |
Definition at line 641 of file AmplitudeManager.cc.
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.
[in] | ampName | the name of the amplitude to which to add the permutation |
[in] | permutation | the 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. |
Definition at line 719 of file AmplitudeManager.cc.
|
virtual |
This routine calculates a square matrix with dimension equal to the number of amplitudes and each element (index i,j) set to , where N is the number of events in the ampVecs structure and
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.
[in,out] | ampVecs | a 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] | iNGenEvents | the number of genereated events (N in the above computation) |
[in] | bIsFirstPass | an 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. |
Implements IntensityManager.
Definition at line 531 of file AmplitudeManager.cc.
|
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.
[in,out] | ampVecs | a reference to the AmpVecs storage structure, four vectors will be read from this class and intensities written to it. |
Implements IntensityManager.
Definition at line 359 of file AmplitudeManager.cc.
|
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.
[in,out] | ampVecs | a 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.) |
Implements IntensityManager.
Definition at line 465 of file AmplitudeManager.cc.
|
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).
[in,out] | ampVecs | a reference to the AmpVecs storage structure, four vectors will be read from this class and amplitude caculations will be written to this class |
Implements IntensityManager.
Definition at line 205 of file AmplitudeManager.cc.
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.
[in] | name | the name of the amplitude to get the factors of |
Definition at line 629 of file AmplitudeManager.cc.
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.
[in] | name | the name of the amplitude to get the permutations for |
Definition at line 617 of file AmplitudeManager.cc.
|
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.
Implements IntensityManager.
Definition at line 192 of file AmplitudeManager.cc.
|
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.
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.
[in] | defaultAmplitude | a 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() ) |
Definition at line 895 of file AmplitudeManager.cc.
|
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.
[in] | flag | set to true to enable the optimization |
Definition at line 403 of file AmplitudeManager.h.
|
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 from IntensityManager.
Definition at line 831 of file AmplitudeManager.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 from IntensityManager.
Definition at line 850 of file AmplitudeManager.cc.
|
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.
[in] | configInfo | a pointer to a ConfigurationInfo object |
Implements IntensityManager.
Definition at line 771 of file AmplitudeManager.cc.
|
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.
|
inlinevirtual |
This returns an enum to identify the type of intensity calculation being done.
Implements IntensityManager.
Definition at line 113 of file AmplitudeManager.h.
|
virtual |
This function will be called whenever a parameter is updated.
Reimplemented from IntensityManager.
Definition at line 873 of file AmplitudeManager.cc.