EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
incoherentPhotonNucleusLuminosity.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file incoherentPhotonNucleusLuminosity.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:: 45 $: revision of last commit
24 // $Author:: bgrube $: author of last commit
25 // $Date:: 2011-02-27 20:52:35 +0100 #$: date of last commit
26 //
27 // Description:
28 //
29 //
30 //
32 
33 
34 #include <iostream>
35 #include <fstream>
36 #include <cmath>
37 
38 #include "inputParameters.h"
39 #include "beambeamsystem.h"
40 #include "beam.h"
41 #include "starlightconstants.h"
42 #include "nucleus.h"
43 #include "bessel.h"
45 
46 
47 using namespace std;
48 using namespace starlightConstants;
49 
50 
51 //______________________________________________________________________________
53  : photonNucleusCrossSection(inputParametersInstance, bbsystem)
54  ,_baseFileName(inputParametersInstance.baseFileName())
55  ,_beamLorentzGamma(inputParametersInstance.beamLorentzGamma())
56  ,_maxW(inputParametersInstance.maxW())
57  ,_minW(inputParametersInstance.minW())
58  ,_nmbWBins(inputParametersInstance.nmbWBins())
59  ,_maxRapidity(inputParametersInstance.maxRapidity())
60  ,_nmbRapidityBins(inputParametersInstance.nmbRapidityBins())
61  ,_productionMode(inputParametersInstance.productionMode())
62  ,_beamBreakupMode(inputParametersInstance.beamBreakupMode())
63  ,_interferenceEnabled(inputParametersInstance.interferenceEnabled())
64  ,_interferenceStrength(inputParametersInstance.interferenceStrength())
65  ,_maxPtInterference(inputParametersInstance.maxPtInterference())
66  ,_nmbPtBinsInterference(inputParametersInstance.nmbPtBinsInterference())
67  ,_protonEnergy(inputParametersInstance.protonEnergy())
68  ,_parameterValueKey(inputParametersInstance.parameterValueKey())
69 {
70  cout <<"Creating Luminosity Tables for incoherent vector meson production."<<endl;
72  cout <<"Luminosity Tables created."<<endl;
73 }
74 
75 
76 //______________________________________________________________________________
78 { }
79 
80 
81 //______________________________________________________________________________
83 {
84  double W,dW,dY;
85  double Egamma,Y;
86  double testint,dndWdY;
87  double C;
88  int beam;
89 
90  std::string wyFileName;
91  wyFileName = _baseFileName +".txt";
92 
93  ofstream wylumfile;
94  wylumfile.precision(15);
95 
96  double bwnorm,Eth;
97 
98  dW = (_wMax - _wMin)/_nWbins;
99  dY = (_yMax-(-1.0)*_yMax)/_nYbins;
100 
101  // Write the values of W used in the calculation to slight.txt.
102  wylumfile.open(wyFileName.c_str());
103  wylumfile << getbbs().electronBeam().Z() <<endl;
104  wylumfile << getbbs().electronBeam().A() <<endl;
105  wylumfile << getbbs().targetBeam().Z() <<endl;
106  wylumfile << getbbs().targetBeam().A() <<endl;
107  wylumfile << _beamLorentzGamma <<endl;
108  wylumfile << _maxW <<endl;
109  wylumfile << _minW <<endl;
110  wylumfile << _nmbWBins <<endl;
111  wylumfile << _maxRapidity <<endl;
112  wylumfile << _nmbRapidityBins <<endl;
113  wylumfile << _productionMode <<endl;
114  wylumfile << _beamBreakupMode <<endl;
115  wylumfile << _interferenceEnabled <<endl;
116  wylumfile << _interferenceStrength <<endl;
117  wylumfile << starlightConstants::deuteronSlopePar <<endl;
118  wylumfile << _maxPtInterference <<endl;
119  wylumfile << _nmbPtBinsInterference <<endl;
120 
121  // Normalize the Breit-Wigner Distribution and write values of W to slight.txt
122  testint=0.0;
123  //Grabbing default value for C in the breit-wigner calculation
124  C=getDefaultC();
125  for(unsigned int i = 0; i <= _nWbins - 1; ++i) {
126  W = _wMin + double(i)*dW + 0.5*dW;
127  testint = testint + breitWigner(W,C)*dW;
128  wylumfile << W << endl;
129  }
130  bwnorm = 1./testint;
131 
132  // Write the values of Y used in the calculation to slight.txt.
133  for(unsigned int i = 0; i <= _nYbins - 1; ++i) {
134  Y = -1.0*_yMax + double(i)*dY + 0.5*dY;
135  wylumfile << Y << endl;
136  }
137 
138  int A_1 = getbbs().electronBeam().A();
139  int A_2 = getbbs().targetBeam().A();
140 
141  // Do this first for the case when the first beam is the photon emitter
142  // Treat pA separately with defined beams
143  // The variable beam (=1,2) defines which nucleus is the target
144  for(unsigned int i = 0; i <= _nWbins - 1; ++i) {
145 
146  W = _wMin + double(i)*dW + 0.5*dW;
147 
148  double Ep = _protonEnergy;
149 
152 
153  for(unsigned int j = 0; j <= _nYbins - 1; ++j) {
154 
155  Y = -1.0*_yMax + double(j)*dY + 0.5*dY;
156 
157  if( A_2 == 1 && A_1 != 1 ){
158  // pA, first beam is the nucleus and photon emitter
159  Egamma = 0.5*W*exp(Y);
160  beam = 2;
161  } else if( A_1 ==1 && A_2 != 1){
162  // pA, second beam is the nucleus and photon emitter
163  Egamma = 0.5*W*exp(-Y);
164  beam = 1;
165  } else {
166  Egamma = 0.5*W*exp(Y);
167  beam = 2;
168  }
169 
170  dndWdY = 0.;
171 
172  if(Egamma > Eth){
173  if(Egamma > maxPhotonEnergy())Egamma = maxPhotonEnergy();
174  double Wgp = sqrt(2.*Egamma*(Ep+sqrt(Ep*Ep-starlightConstants::protonMass*
175  starlightConstants::protonMass))+starlightConstants::protonMass*starlightConstants::protonMass);
176 
177  double localsig = sigmagp(Wgp);
178  if( A_1 == 1 && A_2 != 1 ){
179  dndWdY = Egamma*photonFlux(Egamma,beam)*localsig*breitWigner(W,bwnorm);
180  }else if (A_2 ==1 && A_1 !=1){
181  dndWdY = Egamma*photonFlux(Egamma,beam)*localsig*breitWigner(W,bwnorm);
182  }else{
183  double csVN = sigma_N(Wgp);
184  double csVA = sigma_A(csVN,beam);
185  double csgA= (csVA/csVN)*sigmagp(Wgp);
186  dndWdY = Egamma*photonFlux(Egamma,beam)*csgA*breitWigner(W,bwnorm);
187  }
188  }
189 
190  wylumfile << dndWdY << endl;
191 
192  }
193  }
194 
195  // Repeat the loop for the case when the second beam is the photon emitter.
196  // Don't repeat for pA
197  if( !( (A_2 == 1 && A_1 != 1) || (A_1 == 1 && A_2 != 1) ) ){
198  for(unsigned int i = 0; i <= _nWbins - 1; ++i) {
199 
200  W = _wMin + double(i)*dW + 0.5*dW;
201 
202  double Ep = _protonEnergy;
203 
206 
207  for(unsigned int j = 0; j <= _nYbins - 1; ++j) {
208 
209  Y = -1.0*_yMax + double(j)*dY + 0.5*dY;
210 
211  beam = 1;
212  Egamma = 0.5*W*exp(-Y);
213 
214  dndWdY = 0.;
215 
216  if(Egamma > Eth){
217  if(Egamma > maxPhotonEnergy())Egamma = maxPhotonEnergy();
218  double Wgp = sqrt(2.*Egamma*(Ep+sqrt(Ep*Ep-starlightConstants::protonMass*
219  starlightConstants::protonMass))+starlightConstants::protonMass*starlightConstants::protonMass);
220 
221  double csVN = sigma_N(Wgp);
222  double csVA = sigma_A(csVN,beam);
223  double csgA= (csVA/csVN)*sigmagp(Wgp);
224  dndWdY = Egamma*photonFlux(Egamma,beam)*csgA*breitWigner(W,bwnorm);
225 
226  }
227 
228  wylumfile << dndWdY << endl;
229 
230  }
231  }
232  }
233 
234  wylumfile << bwnorm << endl;
235  wylumfile << _parameterValueKey << endl;
236  wylumfile.close();
237 
238 }
239 
240