Index: trunk/src/eventfilewriter.cpp =================================================================== --- trunk/src/eventfilewriter.cpp (revision 8) +++ trunk/src/eventfilewriter.cpp (revision 9) @@ -1,189 +1,189 @@ /////////////////////////////////////////////////////////////////////////// // // Copyright 2010 // // This file is part of starlight. // // starlight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // starlight is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with starlight. If not, see . // /////////////////////////////////////////////////////////////////////////// // // File and Version Information: // $Rev:: 228 $: revision of last commit // $Author:: butter $: author of last commit // $Date:: 2016-01-18 17:10:17 +0000 #$: date of last commit // // Description: // // // /////////////////////////////////////////////////////////////////////////// #include "eventfilewriter.h" #include "starlightparticlecodes.h" //______________________________________________________________________________ eventFileWriter::eventFileWriter() : fileWriter() ,_writeFullPythia(false) { } //______________________________________________________________________________ eventFileWriter::eventFileWriter(std::string filename) : fileWriter(filename) { } //______________________________________________________________________________ int eventFileWriter::writeInit(inputParameters &_p) { _fileStream<<"CONFIG_OPT: "<<_p.productionMode()<<" "<<_p.prodParticleId()<<" "<<_p.nmbEvents() <<" "<<_p.quantumGlauber()<<" "<<_p.impulseVM()<<" "<<_p.randomSeed()<size(); } else { for(unsigned int i = 0; isize(); ++i) { if(event.getParticles()->at(i).getStatus() >= 0) numberoftracks++; } } // sometimes we don't have tracks due to wrongly picked W , check it if(numberoftracks){ eventnumber++; _fileStream << "EVENT: " << eventnumber << " " << numberoftracks << " " << 1 << std::endl; if(event.getGammaEnergies()->size()) _fileStream << "GAMMAENERGIES:"; for(unsigned int n = 0; n < event.getGammaEnergies()->size(); n++) { _fileStream << " " << event.getGammaEnergies()->at(n); } if(event.getGammaEnergies()->size()) _fileStream<< std::endl; _fileStream <<"VERTEX: "<<0.<<" "<<0.<<" "<<0.<<" "<<0.<<" "<<1<<" "<<0<<" "<<0<<" "<::const_iterator part = (event.getParticles())->begin(); for (part = event.getParticles()->begin(); part != event.getParticles()->end(); part++, ipart++) { if(!_writeFullPythia) { if((*part).getStatus() < 0) continue; } _fileStream << "TRACK: " << " " << starlightParticleCodes::jetsetToGeant((*part).getPdgCode()) <<" "<< (*part).GetPx() << " " << (*part).GetPy() << " "<< (*part).GetPz() << " " << eventnumber << " " << ipart << " " << 0 << " " << (*part).getPdgCode(); if(_writeFullPythia) { lorentzVector vtx = (*part).getVertex(); _fileStream << " " << vtx.GetPx() << " " << vtx.GetPy() << " " << vtx.GetPz() << " " << vtx.GetE(); _fileStream << " " << (*part).getFirstParent() << " " << (*part).getLastParent() << " " << (*part).getFirstDaughter() << " " << (*part).getLastDaughter() << " " << (*part).getStatus(); } _fileStream <size(); } else { for(unsigned int i = 0; isize(); ++i) { if(event.getParticles()->at(i).getStatus() >= 0) numberoftracks++; } } // sometimes we don't have tracks due to wrongly picked W , check it if(numberoftracks){ eventnumber++; _fileStream << "EVENT: " << eventnumber << " " << numberoftracks << " " << 1 << std::endl; _fileStream <<"VERTEX: "<<0.<<" "<<0.<<" "<<0.<<" "<<0.<<" "<<1<<" "<<0<<" "<<0<<" "<size(); ++igam){ + for(unsigned int igam = 0 ; igam < event.getGammaEnergies()->size(); ++igam){ _fileStream <<"GAMMA: "<at(igam)<<" "<at(igam)<at(igam); // Write the photon 4-vector out to file. Might be used in later iterations, so I keep it here //_fileStream <<"GAMMA VECTOR: "<size(); ++itarget){ + for(unsigned int itarget = 0 ; itarget < event.getTarget()->size(); ++itarget){ lorentzVector target = event.getTarget()->at(itarget); _fileStream <<"t: "<at(itarget)<size(); ++iel){ + for(unsigned int iel = 0 ; iel < event.getSources()->size(); ++iel){ lorentzVector el = event.getSources()->at(iel); _fileStream <<"SOURCE: "<::const_iterator part = (event.getParticles())->begin(); for (part = event.getParticles()->begin(); part != event.getParticles()->end(); part++, ipart++) { if(!_writeFullPythia) { if((*part).getStatus() < 0) continue; } _fileStream << "TRACK: " << " "<< starlightParticleCodes::jetsetToGeant((*part).getPdgCode()) <<" "<< (*part).GetPx() << " " << (*part).GetPy() << " "<< (*part).GetPz() << " " << eventnumber << " " << ipart << " " << 0 << " " << (*part).getPdgCode(); if(_writeFullPythia) { lorentzVector vtx = (*part).getVertex(); _fileStream << " " << vtx.GetPx() << " " << vtx.GetPy() << " " << vtx.GetPz() << " " << vtx.GetE(); _fileStream << " " << (*part).getFirstParent() << " " << (*part).getLastParent() << " " << (*part).getFirstDaughter() << " " << (*part).getLastDaughter() << " " << (*part).getStatus(); } _fileStream <. // /////////////////////////////////////////////////////////////////////////// // // File and Version Information: // $Rev:: 265 $: revision of last commit // $Author:: butter $: author of last commit // $Date:: 2016-06-06 21:37:26 +0100 #$: date of last commit // // Description: // Added 18->19 for reading in the luminosity table // Incoherent factor added to table --Joey // // // /////////////////////////////////////////////////////////////////////////// #include #include #include "readinluminosity.h" #include "starlightconstants.h" #include "inputParameters.h" using namespace std; //______________________________________________________________________________ readLuminosity::readLuminosity(const inputParameters& inputParametersInstance) : _Warray(0), _Yarray(0), _Farray(0), _Farray1(0), _Farray2(0), _f_WYarray(0), _g_Earray(0)/*, _g_EQ2array(0)*/ , _ReadInputNPT(inputParametersInstance.nmbPtBinsInterference()) , _ReadInputnumy(inputParametersInstance.nmbRapidityBins()) , _ReadInputnumw(inputParametersInstance.nmbWBins()) , _ReadInputnumega(inputParametersInstance.nmbEnergyBins()) , _ReadInputnumQ2(inputParametersInstance.nmbGammaQ2Bins()) , _ReadInputgg_or_gP(inputParametersInstance.productionMode()) , _ReadInputinterferencemode(inputParametersInstance.interferenceEnabled()) , _baseFileName(inputParametersInstance.baseFileName()) { } //______________________________________________________________________________ readLuminosity::~readLuminosity() { if(_Warray) delete [] _Warray; if(_Yarray) delete [] _Yarray; if(_Farray) delete [] _Farray; if(_Farray1) delete [] _Farray1; if(_Farray2) delete [] _Farray2; // For eSTARLIGHT if(_f_WYarray) delete [] _f_WYarray; if(_g_Earray) delete [] _g_Earray; if(_g_EQ2array) delete _g_EQ2array; } //______________________________________________________________________________ void readLuminosity::read() { if(!_Warray) _Warray = new double[_ReadInputnumw]; if(!_Yarray) _Yarray = new double[_ReadInputnumy]; if(!_Farray) { _Farray = new double*[_ReadInputnumw]; for(int i = 0; i < _ReadInputnumw; i++) { _Farray[i] = new double[_ReadInputnumy]; } } if(!_Farray1) { _Farray1 = new double*[_ReadInputnumw]; for(int i = 0; i < _ReadInputnumw; i++) { _Farray1[i] = new double[_ReadInputnumy]; } } if(!_Farray2) { _Farray2 = new double*[_ReadInputnumw]; for(int i = 0; i < _ReadInputnumw; i++) { _Farray2[i] = new double[_ReadInputnumy]; } } double dummy[17]; //number of lines used to read in input parameters saved to lookup table[slight.txt]. std::string wyFileName; wyFileName = _baseFileName +".txt"; // cout << "wyFileName being read in" << wyFileName << endl; double fpart =0.; double fptsum=0.; ifstream wylumfile; _f_max=0.0; _f_max1=0.0; _f_max2=0.0; wylumfile.open(wyFileName.c_str()); for(int i=0;i < 17;i++){ wylumfile >> dummy[i]; } int A_1 = dummy[1]; int A_2 = dummy[3]; for(int i=0;i<_ReadInputnumw;i++){ wylumfile >> _Warray[i]; } for(int i=0;i<_ReadInputnumy;i++){ wylumfile >> _Yarray[i]; } if( (_ReadInputgg_or_gP == 1) || (A_2 == 1 && A_1 != 1) || (A_1 ==1 && A_2 != 1) ){ for(int i=0;i<_ReadInputnumw;i++){ for(int j=0;j<_ReadInputnumy;j++){ wylumfile >> _Farray[i][j]; if( _Farray[i][j] > _f_max ) _f_max=_Farray[i][j]; } } //Normalize farray for(int i=0;i<_ReadInputnumw;i++){ for(int j=0;j<_ReadInputnumy;j++){ _Farray[i][j]=_Farray[i][j]/_f_max; } } } else { for(int i=0;i<_ReadInputnumw;i++){ for(int j=0;j<_ReadInputnumy;j++){ wylumfile >> _Farray1[i][j]; } } for(int i=0;i<_ReadInputnumw;i++){ for(int j=0;j<_ReadInputnumy;j++){ wylumfile >> _Farray2[i][j]; if( _Farray1[i][j] + _Farray2[i][j] > _f_max ) _f_max=(_Farray1[i][j] + _Farray2[i][j]); } } //Normalize farray, farray1, farray2 for(int i=0;i<_ReadInputnumw;i++){ for(int j=0;j<_ReadInputnumy;j++){ _Farray1[i][j]=_Farray1[i][j]/_f_max; _Farray2[i][j]=_Farray2[i][j]/_f_max; _Farray[i][j]=_Farray1[i][j]+_Farray2[i][j]; } } } wylumfile >> _bwnormsave; if (_ReadInputgg_or_gP != 1 && _ReadInputinterferencemode != 0) { // only numy/2 y bins here, from 0 (not -ymax) to ymax double **finterm = new double*[starlightLimits::MAXWBINS]; for (int i = 0; i < starlightLimits::MAXWBINS; i++) finterm[i] = new double[starlightLimits::MAXYBINS]; for (int i=0;i<_ReadInputnumy;i++) { //fmax=0; //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 fptsum=0.; for (int j=0;j<_ReadInputNPT;j++) { wylumfile >> fpart; finterm[i][j] = fpart; _fptarray[i][j]=0.; fptsum=fptsum+fpart; } //convert array to integral _fptarray[i][0]=finterm[i][0]/fptsum; for (int j=1;j<_ReadInputNPT;j++) { for (int k=0;k> dummy[i]; } int A_1 = dummy[1]; int A_2 = dummy[3]; for(int i=0;i<_ReadInputnumw;i++){ wylumfile >> _Warray[i]; } //No longer needed, can be removed later for(int i=0;i<_ReadInputnumy;i++){ wylumfile >> _Yarray[i]; } //New table saving the Breit-Wigner function for form factor double bw_max = 0 ; for(int i=0;i<_ReadInputnumw;i++){ wylumfile >> _BWarray[i]; if( _BWarray[i] > bw_max ) bw_max = _BWarray[i]; } for(int i=0;i<_ReadInputnumw;i++){ _BWarray[i] = _BWarray[i]/bw_max; } if( (A_2 == 0 && A_1 >= 1) || (A_1 ==0 && A_2 >= 1) ){ for(int i=0;i<_ReadInputnumega;i++){ for(int j=0;j<_ReadInputnumQ2;j++){ wylumfile >> _f_WYarray[i][j]; if( _f_WYarray[i][j] > _f_WYmax ) _f_WYmax=_f_WYarray[i][j]; // //wylumfile >> _g_Earray[i][j]; //if( _g_Earray[i][j] > _g_Emax ) _g_Emax = _g_Earray[i][j]; } } //Normalize f_WY array, g does not need to be normalized, it is used for normalization for(int i=0;i<_ReadInputnumega;i++){ for(int j=0;j<_ReadInputnumQ2;j++){ _f_WYarray[i][j] = _f_WYarray[i][j]/( _f_WYmax ); //_g_Earray[i][j] = _g_Earray[i][j]/_g_Emax; } } } wylumfile >> _bwnormsave; wylumfile.close(); cout<<"Done reading wylumi file"<> n_steps; double integrated_max = 0 ; // _g_EQ2array = new map >(); _g_EQ2array = new vector< std::pair< double, vector > > (); while( !EQlumfile.eof() ){ _g_EQ2max = 0 ; double integral; std::vector p; for( int iQ2 = 0 ; iQ2 < _ReadInputnumQ2+3 ; ++iQ2){ if(iQ2 == 0 ){ EQlumfile >> integral; if( integral > integrated_max) integrated_max = integral; } else{ double temp; EQlumfile >> temp; p.push_back(temp); //cout< 2 && p[iQ2-1] > _g_EQ2max){ _g_EQ2max = p[iQ2-1]; } } - for( uint iQ2=2; iQ2 < p.size(); ++iQ2) + for( unsigned int iQ2=2; iQ2 < p.size(); ++iQ2) p[iQ2] = p[iQ2]/_g_EQ2max; _g_EQ2array->push_back(std::pair< double, std::vector >(integral,p)); } for( std::vector< std::pair > >::iterator it =_g_EQ2array->begin() ; it != _g_EQ2array->end(); ++it){ //cout<first<first = it->first/integrated_max; //cout<<"Now"<first< >::iterator it =_g_EQ2array->begin() ; it != _g_EQ2array->end(); ++it){ std::string key = it->first; if(key=="") continue; - for( uint iQ2=2; iQ2 < it->second.size(); ++iQ2) + for(unsigned int iQ2=2; iQ2 < it->second.size(); ++iQ2) it->second[iQ2] = it->second[iQ2]/_g_EQ2max; }*/ EQlumfile.close(); return; } Index: trunk/src/gammaeluminosity.cpp =================================================================== --- trunk/src/gammaeluminosity.cpp (revision 8) +++ trunk/src/gammaeluminosity.cpp (revision 9) @@ -1,209 +1,209 @@ /////////////////////////////////////////////////////////////////////////// // // Copyright 2010 // // This file is part of starlight. // // starlight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // starlight is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with starlight. If not, see . // /////////////////////////////////////////////////////////////////////////// // // File and Version Information: // $Rev:: 264 $: revision of last commit // $Author:: jseger $: author of last commit // $Date:: 2016-06-06 21:05:12 +0100 #$: date of last commit // // Description: // // // /////////////////////////////////////////////////////////////////////////// #include #include #include #include "inputParameters.h" #include "beambeamsystem.h" #include "beam.h" #include "starlightconstants.h" #include "nucleus.h" #include "bessel.h" #include "gammaeluminosity.h" using namespace std; using namespace starlightConstants; //______________________________________________________________________________ photonElectronLuminosity::photonElectronLuminosity(const inputParameters& inputParametersInstance, beamBeamSystem& bbsystem) : photonNucleusCrossSection(inputParametersInstance, bbsystem) ,_protonEnergy(inputParametersInstance.protonEnergy()) ,_electronEnergy(inputParametersInstance.electronEnergy()) ,_beamLorentzGamma(inputParametersInstance.beamLorentzGamma()) ,_baseFileName(inputParametersInstance.baseFileName()) ,_maxW(inputParametersInstance.maxW()) ,_minW(inputParametersInstance.minW()) ,_nmbWBins(inputParametersInstance.nmbWBins()) ,_maxRapidity(inputParametersInstance.maxRapidity()) ,_nmbRapidityBins(inputParametersInstance.nmbRapidityBins()) ,_nEBins(inputParametersInstance.nmbEnergyBins()) ,_minGammaQ2(inputParametersInstance.minGammaQ2()) ,_maxGammaQ2(inputParametersInstance.maxGammaQ2()) ,_nmbGammaQ2Bins(inputParametersInstance.nmbGammaQ2Bins()) ,_cmsMaxPhotonEnergy(inputParametersInstance.cmsMaxPhotonEnergy()) ,_cmsMinPhotonEnergy(inputParametersInstance.cmsMinPhotonEnergy()) ,_targetMaxPhotonEnergy(inputParametersInstance.targetMaxPhotonEnergy()) ,_targetMinPhotonEnergy(inputParametersInstance.targetMinPhotonEnergy()) ,_productionMode(inputParametersInstance.productionMode()) ,_beamBreakupMode(inputParametersInstance.beamBreakupMode()) { cout <<"Creating Luminosity Tables."<* this_energy = Q2arraylimits(Egamma); double Q2min = this_energy->first; double Q2max = this_energy->second; if( Q2min > Q2max) continue; //Accounts for the phase space factor g_E = Egamma*integrated_Q2_dep(Egamma, Q2min, Q2max); EQ2lumfile << g_E<