Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:27

0001 // NucleonExcitations.h is a part of the PYTHIA event generator.
0002 // Copyright (C) 2024 Torbjorn Sjostrand.
0003 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
0004 // Please respect the MCnet Guidelines, see GUIDELINES for details.
0005 
0006 // Header file for computing mass-dependent widths and branching ratios
0007 
0008 #ifndef Pythia8_NucleonExcitations_H
0009 #define Pythia8_NucleonExcitations_H
0010 
0011 #include "Pythia8/HadronWidths.h"
0012 #include "Pythia8/MathTools.h"
0013 #include "Pythia8/ParticleData.h"
0014 #include "Pythia8/PhysicsBase.h"
0015 
0016 namespace Pythia8 {
0017 
0018 //==========================================================================
0019 
0020 // The NucleonExcitations class is used to calculate cross sections for
0021 // explicit nucleon excitation channels, e.g. p p -> p p(1520).
0022 
0023 class NucleonExcitations : public PhysicsBase {
0024 
0025 public:
0026 
0027   // Constructor.
0028   NucleonExcitations() = default;
0029 
0030   // Objects of this class should only be passed as references.
0031   NucleonExcitations(const NucleonExcitations&) = delete;
0032   NucleonExcitations(NucleonExcitations&&) = delete;
0033   NucleonExcitations& operator=(const NucleonExcitations&) = delete;
0034   NucleonExcitations& operator=(NucleonExcitations&&) = delete;
0035 
0036   // Read in excitation data from the specified file.
0037   bool init(string path);
0038 
0039   // Read in excitation data from the specified stream.
0040   bool init(istream& stream);
0041 
0042   // Validate that the loaded data makes sense.
0043   bool check();
0044 
0045   // Get all nucleon excitations from particle data.
0046   vector<int> getExcitationMasks() const;
0047 
0048   // Get masks (ids without quark content) for all implemented cross sections.
0049   vector<pair<int, int>> getChannels() const;
0050 
0051   // Get total excitation cross sections for NN at the specified energy.
0052   double sigmaExTotal(double eCM) const;
0053 
0054   // Get cross section for NN -> CD. Quark content in masks is ignored.
0055   double sigmaExPartial(double eCM, int maskC, int maskD) const;
0056 
0057   // Pick excited particles and their masses.
0058   bool pickExcitation(int idA, int idB, double eCM,
0059     int& idCOut, double& mCOut, int& idDOut, double& mDOut);
0060 
0061   // Calculate the total excitation cross section without using interpolation.
0062   double sigmaCalc(double eCM) const {
0063     double sig = 0.;
0064     for (int maskEx : getExcitationMasks())
0065       sig += sigmaCalc(eCM, 0002, maskEx) + sigmaCalc(eCM, 0004, maskEx);
0066     return sig;
0067   }
0068 
0069   // Calculate partial excitation cross section without using interpolation.
0070   double sigmaCalc(double eCM, int maskC, int maskD) const;
0071 
0072   // Regenerate parameterization for all cross sections.
0073   bool parameterizeAll(int precision, double threshold = 8.);
0074 
0075   // Write all cross section data to an xml file.
0076   bool save(ostream& stream) const;
0077   bool save(string file = "NucleonExcitations.dat") const {
0078     ofstream stream(file); return save(stream); }
0079 
0080 private:
0081 
0082   // Struct for storing parameterized sigma for each excitation channel.
0083   struct ExcitationChannel {
0084     LinearInterpolator sigma;
0085 
0086     // The particle ids without quark content (e.g. 0002 for p and n).
0087     int maskA, maskB;
0088 
0089     // Scale factor used at high energies.
0090     double scaleFactor;
0091   };
0092 
0093   // The available excitation channels.
0094   vector<ExcitationChannel> excitationChannels;
0095 
0096   // Total excitation cross section, precalculated for efficiency.
0097   LinearInterpolator sigmaTotal;
0098 
0099   // Get total available phase space.
0100   double psSize(double eCM, ParticleDataEntry& prodA,
0101     ParticleDataEntry& prodB) const;
0102 
0103 };
0104 
0105 //==========================================================================
0106 
0107 } // end namespace Pythia8
0108 
0109 #endif // Pythia8_HadronWidths_H