StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
NucleonExcitations.h
1 // NucleonExcitations.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2020 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // Header file for computing mass-dependent widths and branching ratios
7 
8 #ifndef Pythia8_NucleonExcitations_H
9 #define Pythia8_NucleonExcitations_H
10 
11 #include "Pythia8/HadronWidths.h"
12 #include "Pythia8/MathTools.h"
13 #include "Pythia8/ParticleData.h"
14 #include "Pythia8/PhysicsBase.h"
15 
16 namespace Pythia8 {
17 
18 //==========================================================================
19 
20 // The NucleonExcitations class is used to calculate cross sections for
21 // explicit nucleon excitation channels, e.g. p p -> p p(1520).
22 
24 
25 public:
26 
27  // Constructor.
28  NucleonExcitations() = default;
29 
30  // Objects of this class should only be passed as references.
31  NucleonExcitations(const NucleonExcitations&) = delete;
33  NucleonExcitations& operator=(const NucleonExcitations&) = delete;
34  NucleonExcitations& operator=(NucleonExcitations&&) = delete;
35 
36  // Read in excitation data from the specified file.
37  bool init(string path);
38 
39  // Read in excitation data from the specified stream.
40  bool init(istream& stream);
41 
42  // Validate that the loaded data makes sense.
43  bool check();
44 
45  // Get all nucleon excitations from particle data.
46  vector<int> getExcitationMasks() const;
47 
48  // Get masks (ids without quark content) for all implemented cross sections.
49  vector<pair<int, int>> getChannels() const;
50 
51  // Get total excitation cross sections for NN at the specified energy.
52  double sigmaExTotal(double eCM) const;
53 
54  // Get cross section for NN -> CD. Quark content in masks is ignored.
55  double sigmaExPartial(double eCM, int maskC, int maskD) const;
56 
57  // Pick excited particles and their masses.
58  bool pickExcitation(int idA, int idB, double eCM,
59  int& idCOut, double& mCOut, int& idDOut, double& mDOut);
60 
61  // Calculate the total excitation cross section without using interpolation.
62  double sigmaCalc(double eCM) const {
63  double sig = 0.;
64  for (int maskEx : getExcitationMasks())
65  sig += sigmaCalc(eCM, 0002, maskEx) + sigmaCalc(eCM, 0004, maskEx);
66  return sig;
67  }
68 
69  // Calculate partial excitation cross section without using interpolation.
70  double sigmaCalc(double eCM, int maskC, int maskD) const;
71 
72  // Regenerate parameterization for all cross sections.
73  bool parameterizeAll(int precision, double threshold = 8.);
74 
75  // Write all cross section data to an xml file.
76  bool save(ostream& stream) const;
77  bool save(string file = "NucleonExcitations.dat") const {
78  ofstream stream(file); return save(stream); }
79 
80 private:
81 
82  // Struct for storing parameterized sigma for each excitation channel.
83  struct ExcitationChannel {
84  LinearInterpolator sigma;
85 
86  // The particle ids without quark content (e.g. 0002 for p and n).
87  int maskA, maskB;
88 
89  // Scale factor used at high energies.
90  double scaleFactor;
91  };
92 
93  // The available excitation channels.
94  vector<ExcitationChannel> excitationChannels;
95 
96  // Total excitation cross section, precalculated for efficiency.
97  LinearInterpolator sigmaTotal;
98 
99  // Get total available phase space.
100  double psSize(double eCM, ParticleDataEntry& prodA,
101  ParticleDataEntry& prodB) const;
102 
103 };
104 
105 //==========================================================================
106 
107 } // end namespace Pythia8
108 
109 #endif // Pythia8_HadronWidths_H