AmpTools
Amplitude Class Referenceabstract

#include <Amplitude.h>

Inheritance diagram for Amplitude:

Public Member Functions

 Amplitude ()
 
 Amplitude (const vector< string > &args)
 
virtual ~Amplitude ()
 
virtual string name () const =0
 
bool containsFreeParameters () const
 
virtual AmplitudenewAmplitude (const vector< string > &args) const =0
 
virtual Amplitudeclone () const =0
 
bool isDefault () const
 
vector< string > arguments () const
 
virtual void init ()
 
bool setParPtr (const string &name, const double *ptr) const
 
bool setParValue (const string &name, double val) const
 
virtual void updatePar (const AmpParameter &par)
 
bool updatePar (const string &name) const
 
virtual void calcAmplitudeAll (GDouble *pdData, GDouble *pdAmps, int iNEvents, const vector< vector< int > > *pvPermutations) const
 
virtual complex< GDoublecalcAmplitude (GDouble **pKin) const =0
 
complex< GDoublecalcAmplitude (const Kinematics *pKin) const
 
complex< GDoublecalcAmplitude (const Kinematics *pKin, const vector< int > &permutation) const
 
virtual void calcAmplitudeGPU (dim3 dimGrid, dim3 dimBlock, GPU_AMP_PROTO, const vector< int > &perm) const
 
virtual void launchGPUKernel (dim3 dimGrid, dim3 dimBlock, GPU_AMP_PROTO) const
 

Protected Member Functions

void registerParameter (AmpParameter &par)
 
const vector< int > & getCurrentPermutation () const
 

Detailed Description

This class represents a user defined amplitude. In its most abstract sense it is a mechanism to turn a set of four vectors describing an event into a complex number that represents the amplitude for some physics process. These amplitudes can be added to the AmplitudeManager as factors that build-up a decay amplitude for a particular final state.

It is recommended that the user factorize the physics amplitudes as much as possible. For example, a user may have an Amplitude class that defines how to compute a Breit-Wigner and another Amplitude class that describes some two-body angular distribution. The complete decay amplitude for a two-body resonance is given by a product of these two. The factorization ultimately improves optimization potential since only factors with free parameters need to be recomputed at each fit iteration.

In addition users should typically not permute identical particles in the construction of the amplitude. Doing so "breaks" the factorization feature built into the AmplitudeManager since ( a1 + a2 ) * ( b1 + b2 ) is not equal to ( a1 b1 + a2 b2 ) for permutations 1 and 2 and amplitudes a and b. Instead the AmplitudeManager provides a mechanism to permute idnetical particles or charge conjugates for a particular amplitude.

Definition at line 86 of file Amplitude.h.

Constructor & Destructor Documentation

◆ Amplitude() [1/2]

Amplitude::Amplitude ( )
inline

The default constructor. The user's derived class should contain a default constructor that calls this constructor.

Definition at line 95 of file Amplitude.h.

◆ Amplitude() [2/2]

Amplitude::Amplitude ( const vector< string > &  args)
inline

This constructor takes a list of arguments to inititialize an amplitude and then stores them. The user's derived class should contain a similar constructor that calls this one.

Definition at line 102 of file Amplitude.h.

◆ ~Amplitude()

virtual Amplitude::~Amplitude ( )
inlinevirtual

This is the destructor.

Definition at line 108 of file Amplitude.h.

Member Function Documentation

◆ arguments()

vector<string> Amplitude::arguments ( ) const
inline

Returns the list of arguments that was passed to the constructor.

Definition at line 159 of file Amplitude.h.

◆ calcAmplitude() [1/3]

virtual complex< GDouble > Amplitude::calcAmplitude ( GDouble **  pKin) const
pure virtual

This is the user-defined function that computes a single complex amplitude for a set of four-vectos that describe the event kinematics. As discussed above this function should be factorized as much as possible and not include permutations of particles. The user must override this function in his or her amplitude class.

Parameters
[in]pKina pointer to a single event. pKin[0][0-3] define E, px, py, pz for the first particle, pKin[1][0-3] for the second, and so on
Here is the caller graph for this function:

◆ calcAmplitude() [2/3]

complex< GDouble > Amplitude::calcAmplitude ( const Kinematics pKin) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This is a user-friendly interface to calcAmplitude used for diagnostics. It takes a pointer to a Kinematics object, converts it into a GDouble** format, then calls the standard calcAmplitude method.

Parameters
[in]pKina pointer to a Kinematics object
See also
calcAmplitude

Definition at line 116 of file Amplitude.cc.

Here is the call graph for this function:

◆ calcAmplitude() [3/3]

complex< GDouble > Amplitude::calcAmplitude ( const Kinematics pKin,
const vector< int > &  permutation 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This is a user-friendly interface to calcAmplitude used for diagnostics. It takes a pointer to a Kinematics object, rearranges it according to the permutation specified, converts it into a GDouble** format, then calls the standard calcAmplitude method.

Parameters
[in]pKina pointer to a Kinematics object
[in]permutationa vector of permuted particle indices
See also
calcAmplitude
AmplitudeManager::addAmpPermutation

Definition at line 132 of file Amplitude.cc.

Here is the call graph for this function:

◆ calcAmplitudeAll()

void Amplitude::calcAmplitudeAll ( GDouble pdData,
GDouble pdAmps,
int  iNEvents,
const vector< vector< int > > *  pvPermutations 
) const
virtual

This loops over all events and calculates the amplitude for each event. It does so by calling the user-defined calcAmplitude routine for each permutation of particles. The function is virtual since, in principle, the user may choose to override it and perform the loop and computation directly and more efficiently than using a separate function call for each event.

Parameters
[in]pdDataa pointer to the array of data. This is a long list of GDoubles E, px, py, pz repeated sequentially for each particle in the event and then the series repeated for each event in the data set.
[out]pdAmpsa pointer to a block of memory where the calculated amplitudes should go. The values are stored as real and imaginary parts repeated for each permutation and then for each event. Total length of memory needed is 2 * sizeof( GDDouble ) * N_evts * N_perms
[in]iNEventsthe number of events in the data set
[in]pvPermutationsa pointer to the vector that contains the various permutations. The size of this vector is the number of permutations and the size of one element of this vector is the number of particles.
See also
calcAmplitudeAll
AmplitudeManager::addAmpPermutation

Definition at line 52 of file Amplitude.cc.

Here is the call graph for this function:

◆ calcAmplitudeGPU()

void Amplitude::calcAmplitudeGPU ( dim3  dimGrid,
dim3  dimBlock,
GPU_AMP_PROTO  ,
const vector< int > &  perm 
) const
virtual

If GPU_ACCELERATION flag is set this is the member function that sets the current permutation and then calls the user-defined routine to launch the GPU kernel. It is the GPU analog of calcAmplitudeAll.

Definition at line 168 of file Amplitude.cc.

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

◆ clone()

virtual Amplitude* Amplitude::clone ( ) const
pure virtual

A function that the user must write that indicates how an amplitude can duplicate itself. It returns a pointer to a new instance of the Amplitude that behaves in exactly the same way as the original.

The user can avoid writing this method by inheriting from the UserAmplitude class (which derives from this class).

See also
UserAmplitude

Implemented in UserAmplitude< T >.

Here is the caller graph for this function:

◆ containsFreeParameters()

bool Amplitude::containsFreeParameters ( ) const

Returns a boolean to indicate if this amplitude contains at least one floating parameter.

Definition at line 183 of file Amplitude.cc.

Here is the caller graph for this function:

◆ getCurrentPermutation()

const vector< int >& Amplitude::getCurrentPermutation ( ) const
inlineprotected

A helper function so that the user's calcAmplitude routine can access which permutation has been passed to it. In general the user does not need to know this as the calcAllAmplitudes routine permutes the particles before calling the user-defined calcAmplitude. However in some case the user code may want to include additional factors, e.g., isospin Clebsch-Gordan coefficients that can only be computed if the the permutation of the particles is known.

See also
calcAllAmplitudes
calcAmplitude

Definition at line 353 of file Amplitude.h.

◆ init()

virtual void Amplitude::init ( )
inlinevirtual

The user can override this to do specific one-time tasks that before the fit begins, but after the parameters have been initialized. In general these tasks should go into the this init routine rather than the consructor.

Definition at line 167 of file Amplitude.h.

Here is the caller graph for this function:

◆ isDefault()

bool Amplitude::isDefault ( ) const
inline

A function that indicates if this amplitude was created with the default constructor.

Definition at line 154 of file Amplitude.h.

◆ launchGPUKernel()

virtual void Amplitude::launchGPUKernel ( dim3  dimGrid,
dim3  dimBlock,
GPU_AMP_PROTO   
) const
inlinevirtual

The user override this route and use it pass any parameters to a global C function that actually launches the GPU kernel

Definition at line 321 of file Amplitude.h.

Here is the caller graph for this function:

◆ name()

virtual string Amplitude::name ( ) const
pure virtual

Must be overridden by the user to provide the name of the amplitude. This is necessary to connect ConfigurationInfo to specific class instances when the AmplitudeManager is being setup.

Here is the caller graph for this function:

◆ newAmplitude()

virtual Amplitude* Amplitude::newAmplitude ( const vector< string > &  args) const
pure virtual

This must be overriden by the user and indicates how to convert a list of strings (arguments) into a pointer to a new instance of the users defined amplitude.

The user can avoid writing this method by inheriting from the UserAmplitude class (which derives from this class).

Parameters
[in]argsa list of string arguments that may, for example, be specified in a configuration file
See also
UserAmplitude

Implemented in UserAmplitude< T >.

Here is the caller graph for this function:

◆ registerParameter()

void Amplitude::registerParameter ( AmpParameter par)
protected

Any user-defined class derived from Amplitude that has a parameter in the amplitude should register the parameter using this routine. This shoudl be done for each parameter in the constructor of the user's Amplitude class.

Parameters
[in]para reference to the AmpParmeter object

Definition at line 280 of file Amplitude.cc.

◆ setParPtr()

bool Amplitude::setParPtr ( const string &  name,
const double *  ptr 
) const

This tells the AmpParameter with the indicated name to obtain its value from some external location in memory. This functionality is is useful when fitting as the ParameterManager can automatically updated these external values. The function returns true if the a parameter of the indicated name was found in the list of registered parameters for this amplitude, false otherwise. The function calls updatePar after setting the value.

Parameters
[in]namethe name of the AmpParameter
[in]ptrthe location in memory to find the value of the AmpParameter
See also
updatePar
AmplitudeManager::setAmpParPtr

Definition at line 198 of file Amplitude.cc.

Here is the call graph for this function:

◆ setParValue()

bool Amplitude::setParValue ( const string &  name,
double  val 
) const

This tells the AmpParameter with the indicated name to set its value to the specified value. The function returns true if the a parameter of the indicated name was found in the list of registered parameters for this amplitude, false otherwise. Function calls updatePar after setting the value.

Parameters
[in]namethe name of the AmpParameter
[in]valthe value to set AmpParameter to
See also
updatePar
AmplitudeManager::setAmpParValue

Definition at line 222 of file Amplitude.cc.

Here is the call graph for this function:

◆ updatePar() [1/2]

virtual void Amplitude::updatePar ( const AmpParameter par)
inlinevirtual

The user may override this function to recalculate member data in the amplitude class whenever a parameter changes. For example, the user's amplitude calculation may have expensive integration or other functions that only need to be computed whenever a parameter changes, rather than being computed on the fly for every event.

Parameters
[in]para const reference to the parameter that has been updated

Definition at line 210 of file Amplitude.h.

Here is the caller graph for this function:

◆ updatePar() [2/2]

bool Amplitude::updatePar ( const string &  name) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

A function used by the framework to signal that a parameter with a particular name has changed. This function searches the registered parameters to see if this amplitude contains that parameter. If so it calls the virtual function updatePar with the AmpParameter. The function returns true of a parameter with the specified name is found.

Parameters
[in]namethe name of the updated parameter

Definition at line 246 of file Amplitude.cc.

Here is the call graph for this function:

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