1 ///////////////////////////////////////////////////////////////////////////
5 // This file is part of starlight.
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.
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.
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/>.
20 ///////////////////////////////////////////////////////////////////////////
22 // File and Version Information:
23 // $Rev:: 164 $: revision of last commit
24 // $Author:: odjuvsla $: author of last commit
25 // $Date:: 2013-10-06 16:18:08 +0200 #$: date of last commit
28 // Added 18->19 for reading in the luminosity table
29 // Incoherent factor added to table --Joey
33 ///////////////////////////////////////////////////////////////////////////
39 #include "readinluminosity.h"
40 #include "starlightconstants.h"
41 #include "inputParameters.h"
47 //______________________________________________________________________________
48 readLuminosity::readLuminosity()//:inputread(input)
49 : _Warray(0), _Yarray(0), _Farray(0)
51 //storing inputparameters into protected variables for the object to use them
52 _ReadInputNPT=inputParametersInstance.nmbPtBinsInterference();
53 _ReadInputnumy=inputParametersInstance.nmbRapidityBins();
54 _ReadInputnumw=inputParametersInstance.nmbWBins();
55 _ReadInputgg_or_gP=inputParametersInstance.productionMode();
56 _ReadInputinterferencemode=inputParametersInstance.interferenceEnabled();
61 //______________________________________________________________________________
62 readLuminosity::~readLuminosity()
64 if(_Warray) delete [] _Warray;
65 if(_Yarray) delete [] _Yarray;
66 if(_Farray) delete [] _Farray;
70 //______________________________________________________________________________
71 void readLuminosity::read()
74 if(!_Warray) _Warray = new double[_ReadInputnumw];
75 if(!_Yarray) _Yarray = new double[_ReadInputnumy];
78 _Farray = new double*[_ReadInputnumw];
79 for(int i = 0; i < _ReadInputnumw; i++)
81 _Farray[i] = new double[_ReadInputnumy];
84 double dummy[19]; //14//18
85 // double (*finterm)[starlightLimits::MAXWBINS]=new double[starlightLimits::MAXWBINS][starlightLimits::MAXYBINS];
87 //decreased from 1000*1000; too big! causes fault!
94 wylumfile.open("slight.txt");
95 for(int i=0;i < 19;i++){ // was 14; this is to account for sergei's additional parameters ie d-Au//was19
96 wylumfile >> dummy[i];
98 for(int i=0;i<_ReadInputnumw;i++){
99 wylumfile >> _Warray[i];
101 for(int i=0;i<_ReadInputnumy;i++){
102 wylumfile >> _Yarray[i];
104 for(int i=0;i<_ReadInputnumw;i++){
105 for(int j=0;j<_ReadInputnumy;j++){
106 wylumfile >> _Farray[i][j];
107 if( _Farray[i][j] > _f_max ) _f_max=_Farray[i][j];
110 //Normalize farray (JN 010402)
111 for(int i=0;i<_ReadInputnumw;i++){
112 for(int j=0;j<_ReadInputnumy;j++){
113 _Farray[i][j]=_Farray[i][j]/_f_max;
117 if (_ReadInputgg_or_gP != 1 && _ReadInputinterferencemode != 0) {
118 // only numy/2 y bins here, from 0 (not -ymax) to ymax
119 double **finterm = new double*[starlightLimits::MAXWBINS];
120 for (int i = 0; i < starlightLimits::MAXWBINS; i++) finterm[i] = new double[starlightLimits::MAXYBINS];
121 for (int i=0;i<_ReadInputnumy/2;i++) {
123 //we want to convert _fptarray to an integral array where fpt(i,j) is near 0, and fpt(j,NPT) ~1. This will facilitate a simple table loookup
125 for (int j=0;j<_ReadInputNPT;j++) {
127 finterm[i][j] = fpart;
131 //convert array to integral
132 _fptarray[i][0]=finterm[i][0]/fptsum;
133 for (int j=1;j<_ReadInputNPT;j++) {
134 for (int k=0;k<=j;k++) {
135 _fptarray[i][j]=_fptarray[i][j]+finterm[i][k];
137 _fptarray[i][j]=_fptarray[i][j]/fptsum;
143 wylumfile >> _bwnormsave;