Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:14:53

0001 // Class to sum up any number of generic amplitudes and build observables.

0002 // Amplitudes are loaded up in a vector and summed incoherently

0003 //

0004 // Author:       Daniel Winney (2020)

0005 // Affiliation:  Joint Physics Analysis Center (JPAC)

0006 // Email:        dwinney@iu.edu

0007 // ---------------------------------------------------------------------------

0008 
0009 #ifndef _SUM_
0010 #define _SUM_
0011 
0012 #include "amplitudes/amplitude.hpp"
0013 
0014 // ---------------------------------------------------------------------------

0015 // The amplitude_sum class can take a vector of the above amplitude objects

0016 // and add them together to get observables!

0017 // ---------------------------------------------------------------------------

0018 
0019 namespace jpacPhoto
0020 {
0021   class amplitude_sum : public amplitude
0022   {
0023   private:
0024     // Store a vector of all the amplitudes you want to sum incoherently

0025     std::vector<amplitude*> _amps;
0026 
0027   public:
0028     // Empty constructor

0029     amplitude_sum(reaction_kinematics * xkinem, std::string identifer = "amplitude_sum")
0030     : amplitude(xkinem, identifer)
0031     {};
0032 
0033     // Constructor with a vector already set up

0034     amplitude_sum(reaction_kinematics * xkinem, std::vector<amplitude*> vec, std::string identifer = "amplitude_sum")
0035     : amplitude(xkinem, identifer), _amps(vec)
0036     {};
0037 
0038     // Add a new amplitude to the vector

0039     void add_amplitude(amplitude * new_amp)
0040     {
0041       _amps.push_back(new_amp);
0042     };
0043 
0044     // Add all the members of an existing sum to a new sum

0045     void add_amplitude(amplitude_sum * new_sum)
0046     {
0047       for (int i = 0; i < new_sum->_amps.size(); i++)
0048       {
0049         _amps.push_back(new_sum->_amps[i]);
0050       }
0051     };
0052 
0053     // empty allowedJP, leave the checks to the individual amps instead

0054     inline std::vector<std::array<int,2>> allowedJP()
0055     {
0056         return {};
0057     };
0058 
0059     // TODO: Add a set_params which timesi in one vector and allocates approriaten number of

0060     // params to each sub amplitude

0061 
0062     // Evaluate the sum for given set of helicites, energy, and cos

0063     std::complex<double> helicity_amplitude(std::array<int, 4> helicities, double s, double t);
0064   };
0065 };
0066 
0067 #endif