Skip to content
Snippets Groups Projects
amplitude.hpp 4.61 KiB
Newer Older
  • Learn to ignore specific revisions
  • // Abstract class for an amplitude. Used so we can easily build observables
    // as the incoherent sum of amplitudes in s, t, and u channels.
    //
    // Author:       Daniel Winney (2020)
    // Affiliation:  Joint Physics Analysis Center (JPAC)
    // Email:        dwinney@iu.edu
    // ---------------------------------------------------------------------------
    
    #ifndef _AMPLITUDE_
    #define _AMPLITUDE_
    
    
    // ---------------------------------------------------------------------------
    // Abstract class to define helicity amplitudes. This will allow multiple different
    // classes (for s, t, and u- channels but also multiple contibutions in each channel)
    // to be added together and evaluated in observables.
    //
    // Any generic amplitude needs a reaction_kinematics object
    // and a way to evaluate the helicity amplitude for given set of helicities,
    // CoM energy and scattering angle.
    // ---------------------------------------------------------------------------
    
    
    #include "reaction_kinematics.hpp"
    
    #include "Math/GSLIntegrator.h"
    #include "Math/IntegrationTypes.h"
    #include "Math/Functor.h"
    
    #include <string>
    
    Daniel Winney's avatar
    Daniel Winney committed
    #include <algorithm>
    
    Daniel Winney's avatar
    Daniel Winney committed
        class amplitude
    
    Daniel Winney's avatar
    Daniel Winney committed
            public:
    
            // Constructor with nParams for backward compatibility (now depricated)
    
            amplitude(reaction_kinematics * xkinem, std::string id = "", int n = 0)
    
    Daniel Winney's avatar
    Daniel Winney committed
            : _kinematics(xkinem), _identifier(id)
    
    Daniel Winney's avatar
    Daniel Winney committed
            // Kinematics object for thresholds and etc.
    
    Daniel Winney's avatar
    Daniel Winney committed
            reaction_kinematics * _kinematics;
    
    Daniel Winney's avatar
    Daniel Winney committed
    
            // saved energies and angle 
    
    Daniel Winney's avatar
    Daniel Winney committed
            double _s, _t, _theta;
    
    Daniel Winney's avatar
    Daniel Winney committed
    
            // Some saveable string by which to identify the amplitude
    
    Daniel Winney's avatar
    Daniel Winney committed
            std::string _identifier;
    
    Daniel Winney's avatar
    Daniel Winney committed
    
            // How the calculate the helicity amplitude
            // Must be given a specific implementation in a user derived class
            virtual std::complex<double> helicity_amplitude(std::array<int, 4> helicities, double s, double t) = 0;
    
            // ---------------------------------------------------------------------------
            // Observables
            // Evaluatable in terms of s and t or an event object (see reaction_kinematics.hpp)
    
            // Modulus of the amplitude summed over all helicity combinations
            double probability_distribution(double s, double t);
    
            // Differential and total cross-section
            double differential_xsection(double s, double t);
    
            // integrated crossection
            double integrated_xsection(double s);
    
            // Spin asymmetries
            double A_LL(double s, double t); // Beam and target
            double K_LL(double s, double t); // Beam and recoil
    
            // Spin density matrix elements
            std::complex<double> SDME(int alpha, int lam, int lamp, double s, double t);
    
            // Beam Asymmetries
            double beam_asymmetry_y(double s, double t);    // Along the y direction
    
    Daniel Winney's avatar
    Daniel Winney committed
            double beam_asymmetry_4pi(double s, double t);  // integrated over decay angles
    
    Daniel Winney's avatar
    Daniel Winney committed
    
            // Parity asymmetry
            double parity_asymmetry(double s, double t);
    
            // ---------------------------------------------------------------------------
            // If helicity amplitudes have already been generated for a value of mV, s, t 
            // store them
    
    Daniel Winney's avatar
    Daniel Winney committed
            double _cached_mX2 = 0., _cached_s = 0., _cached_t = 0.;
            std::vector<std::complex<double>> _cached_helicity_amplitude;
    
    Daniel Winney's avatar
    Daniel Winney committed
            void check_cache(double s, double t);
    
    Daniel Winney's avatar
    Daniel Winney committed
    
            // ---------------------------------------------------------------------------
            // nParams error message
    
    Daniel Winney's avatar
    Daniel Winney committed
            int _nParams = 0;
            inline void set_nParams(int N){ _nParams = N; };
    
    Daniel Winney's avatar
    Daniel Winney committed
            inline void check_nParams(std::vector<double> params)
            {
    
    Daniel Winney's avatar
    Daniel Winney committed
                if (params.size() != _nParams)
    
    Daniel Winney's avatar
    Daniel Winney committed
                {
    
    Daniel Winney's avatar
    Daniel Winney committed
                    std::cout << "\nWarning! Invalid number of parameters (" << params.size() << ") passed to " << _identifier << ".\n";
    
    Daniel Winney's avatar
    Daniel Winney committed
                }
            };
    
            // ---------------------------------------------------------------------------
    
            // Each amplitude must supply a function which returns a vector of allowed 2-tuples {J, P}
            virtual std::vector<std::array<int,2>> allowedJP() = 0;
    
            // Allowed JP error message
    
    Daniel Winney's avatar
    Daniel Winney committed
            inline void check_JP(std::array<int,2> JP)
    
    Daniel Winney's avatar
    Daniel Winney committed
            {
    
               std::vector<std::array<int,2>> allowed_JP = allowedJP();
    
    Daniel Winney's avatar
    Daniel Winney committed
                if (std::find(allowed_JP.begin(), allowed_JP.end(), JP) == allowed_JP.end())
    
    Daniel Winney's avatar
    Daniel Winney committed
                {
    
    Daniel Winney's avatar
    Daniel Winney committed
                    std::cout << "Error! Amplitude for spin: " << JP[0] << " and parity " << JP[1] << " for " << _identifier << " unavailable.\n";
    
    Daniel Winney's avatar
    Daniel Winney committed
                    exit(0);
                }      
            };