EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nucleus.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file nucleus.cpp
1 
2 //
3 // Copyright 2010
4 //
5 // This file is part of starlight.
6 //
7 // starlight is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // starlight is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with starlight. If not, see <http://www.gnu.org/licenses/>.
19 //
21 //
22 // File and Version Information:
23 // $Rev:: 262 $: revision of last commit
24 // $Author:: jnystrand $: author of last commit
25 // $Date:: 2016-06-01 14:14:20 +0100 #$: date of last commit
26 //
27 // Description:
28 //
29 //
30 //
32 
33 
34 #include <iostream>
35 #include <fstream>
36 
37 #include "starlightconstants.h"
38 #include "reportingUtils.h"
39 #include "nucleus.h"
40 #include <inputParameters.h>
41 
42 
43 using namespace std;
44 using namespace starlightConstants;
45 
46 //______________________________________________________________________________
47 nucleus::nucleus(const int Z,
48  const int A,
49  const int productionMode)
50  : _Z(Z),
51  _A(A),
52  _productionMode(productionMode)
53 {
54  init();
55 }
56 
58 {
59  switch (_Z) {
60  case 82:
61  {
62  _Radius = 6.624;
63  _rho0 = 0.160696;
64  }
65  break;
66  case 79:
67  {
68  _Radius = 6.38;
69  _rho0 = 0.169551;
70  }
71  break;
72  case 29:
73  {
74  _Radius = 4.214;
75  _rho0 = 0.173845;
76  }
77  break;
78  case 1:
79  {
80  //is this a proton or deuteron
81  if(_A==1){
82  _Radius = 0.7;
83  _rho0 = -1.0; //Not relevant for protons
84  }
85  // this is electron
86  else if(_A==0){
87  _Radius = 0.;
88  _rho0 = -1.0;
89  }
90  else {
91  _Radius = 2.1;
92  _rho0 = _A;
93  }
94  }
95  break;
96  case -1:
97  {
98  //is this a anti-proton
99  if(_A==1){
100  _Radius = 0.7;
101  _rho0 = -1.0; //Not relevant for protons
102  }
103  // this is positron
104  else if(_A==0){
105  _Radius = 0.;
106  _rho0 = -1.0;
107  }
108  else {
109  _Radius = 2.1;
110  _rho0 = _A;
111  }
112  }
113  break;
114  default:
115  printWarn << "density not defined for projectile with Z = " << _Z << ". using defaults." << endl;
116  _Radius = 1.2*pow(_A, 1. / 3.);
117  _rho0 = 0.138/(1.13505-0.0004283*_A); //This matches the radius above
118  if( _Z < 7 ){
119  // This is for Gaussian form factors/densities
120  _rho0 = _A;
121  }
122  }
123 }
124 
125 //______________________________________________________________________________
127 { }
128 
129 //______________________________________________________________________________
130 double
131 nucleus::rws(const double r) const
132 {
133  if( _Z < 7 ){
134  // Gaussian density distribution for light nuclei
135  double norm = (3./(2.*starlightConstants::pi))*sqrt( (3./(2.*starlightConstants::pi)) );
136  norm = norm/(nuclearRadius()*nuclearRadius()*nuclearRadius());
137  return norm*exp(-((3./2.)*r*r)/(nuclearRadius()*nuclearRadius()));
138  }else{
139  // Fermi density distribution for heavy nuclei
140  return 1.0 / (1. + exp((r - nuclearRadius()) / woodSaxonSkinDepth()));
141  }
142 }
143 
144 //______________________________________________________________________________
145 double
146 nucleus::formFactor(const double t) const
147 {
148  // electromagnetic form factor of proton
149  if ((_Z == 1) && (_A == 1)) {
150  const double rec = 1. / (1. + t / 0.71);
151  return rec * rec;
152  }
153 
154  if( _Z < 7 ){
155  // Gaussian form factor for light nuclei
156  const double R_G = nuclearRadius();
157  return exp(-R_G*R_G*t/(6.*starlightConstants::hbarc*starlightConstants::hbarc));
158  } else {
159  // nuclear form factor, from Klein Nystrand PRC 60 (1999) 014903, Eq. 14
160  const double R = nuclearRadius();
161  const double q = sqrt(t);
162  const double arg1 = q * R / hbarc;
163  const double arg2 = hbarc / (q * R);
164  const double sph = (sin(arg1) - arg1 * cos(arg1)) * 3. * arg2 * arg2 * arg2;
165  const double a0 = 0.70; // [fm]
166  return sph / (1. + (a0 * a0 * t) / (hbarc * hbarc));
167  }
168 }
169 
170 //______________________________________________________________________________
171 
172 double
173 nucleus::dipoleFormFactor(const double t, const double t0) const
174 {
175  const double rec = 1. / (1. + t / t0);
176  return rec * rec;
177 }
178 
179 //______________________________________________________________________________
180 double
181 nucleus::thickness(const double b) const
182 {
183  // JS This code calculates the nuclear thickness function as per Eq. 4 in
184  // Klein and Nystrand, PRC 60.
185  // former DOUBLE PRECISION FUNCTION T(b)
186 
187  // data for Gauss integration
188  const unsigned int nmbPoints = 5;
189  const double xg[nmbPoints + 1] = {0., 0.1488743390, 0.4333953941, 0.6794095683,
190  0.8650633667, 0.9739065285};
191  const double ag[nmbPoints + 1] = {0., 0.2955242247, 0.2692667193, 0.2190863625,
192  0.1494513492, 0.0666713443};
193 
194  const double zMin = 0;
195  const double zMax = 15;
196  const double zRange = 0.5 * (zMax - zMin);
197  const double zMean = 0.5 * (zMax + zMin);
198  double sum = 0;
199  for(unsigned int i = 1; i <= nmbPoints; ++i) {
200  double zsp = zRange * xg[i] + zMean;
201  double radius = sqrt(b * b + zsp * zsp);
202  sum += ag[i] * rws(radius);
203  zsp = zRange * (-xg[i]) + zMean;
204  radius = sqrt(b * b + zsp * zsp);
205  sum += ag[i] * rws(radius);
206  }
207 
208  return 2. * zRange * sum;
209 }