![]() |
AmpTools
|
#include <Amplitude.h>
Public Member Functions | |
Amplitude () | |
Amplitude (const vector< string > &args) | |
virtual | ~Amplitude () |
virtual string | name () const =0 |
bool | containsFreeParameters () const |
virtual Amplitude * | newAmplitude (const vector< string > &args) const =0 |
virtual Amplitude * | clone () 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< GDouble > | calcAmplitude (GDouble **pKin) const =0 |
complex< GDouble > | calcAmplitude (const Kinematics *pKin) const |
complex< GDouble > | calcAmplitude (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 |
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.
|
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.
|
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.
|
inlinevirtual |
This is the destructor.
Definition at line 108 of file Amplitude.h.
|
inline |
Returns the list of arguments that was passed to the constructor.
Definition at line 159 of file Amplitude.h.
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.
[in] | pKin | a 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 |
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.
[in] | pKin | a pointer to a Kinematics object |
Definition at line 116 of file Amplitude.cc.
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.
[in] | pKin | a pointer to a Kinematics object |
[in] | permutation | a vector of permuted particle indices |
Definition at line 132 of file Amplitude.cc.
|
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.
[in] | pdData | a 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] | pdAmps | a 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] | iNEvents | the number of events in the data set |
[in] | pvPermutations | a 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. |
Definition at line 52 of file Amplitude.cc.
|
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.
|
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).
Implemented in UserAmplitude< T >.
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.
|
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.
Definition at line 353 of file Amplitude.h.
|
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.
|
inline |
A function that indicates if this amplitude was created with the default constructor.
Definition at line 154 of file Amplitude.h.
|
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.
|
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.
|
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).
[in] | args | a list of string arguments that may, for example, be specified in a configuration file |
Implemented in UserAmplitude< T >.
|
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.
[in] | par | a reference to the AmpParmeter object |
Definition at line 280 of file Amplitude.cc.
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.
[in] | name | the name of the AmpParameter |
[in] | ptr | the location in memory to find the value of the AmpParameter |
Definition at line 198 of file Amplitude.cc.
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.
[in] | name | the name of the AmpParameter |
[in] | val | the value to set AmpParameter to |
Definition at line 222 of file Amplitude.cc.
|
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.
[in] | par | a const reference to the parameter that has been updated |
Definition at line 210 of file Amplitude.h.
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.
[in] | name | the name of the updated parameter |
Definition at line 246 of file Amplitude.cc.