// Created by Chathuranga Sirimanna (chathuranga.sirimanna@wayne.edu), Gojko Vujanovic (vujanovic@wayne.edu) // Requires FinalState hadrons status, E, Px, Py, Pz, eta, phi as input, also requires pTHatCrossSection (in mb) as input // Output is a txt file which contains p_T, Single hadron yield and statistical error #include #include #include #include #include "iomanip" #include "string" #include using namespace std; int main(int argc, char* argv[]){ int StartTime = time(NULL); const double sigma_inel=70.0;//total inelastic p-p cross section at 5.02 TeV int NpTHatBin = 1; //Number of pTHat bins //These arrays are used to get the minimum and maximum values of current pTHat bin int pTHatMin[NpTHatBin] = {50}; int pTHatMax[NpTHatBin] = {70}; int NpTBin = 10; //Number of pT bins used in the Histogram double pTMin = 1; //Minimum pT in the Histogram in GeV double pTMax = 31; //Maximum pT in the Histogram in GeV double EtaCut =2.8; //Absolute value of the eta range double pTHad=0.0; //Use to store pT of each hadron before put into the histogram double pTBinW = (pTMax - pTMin)/NpTBin; //pT Bin width of the histogram if we use same size bins double HardCS[NpTHatBin]; //Store hard cross section for each pT hat bin double HardCSErr[NpTHatBin]; //Store error of the hard cross section for each pT hat bin double dNdpTCount_hard_ind[NpTHatBin][NpTBin]; //2D array used to store hadron (non recoil) count. index order: [ptHatBin] [Regular pt] double dNdpTCount_soft_ind[NpTHatBin][NpTBin]; //2D array used to store hadron count giving rise to source/sink terms to hydrodynamics caused by recoil hadrons. index order: [ptHatBin] [Regular pt] double CS_Err_hard_ind[NpTHatBin][NpTBin]; //2D array used to store hadron (non recoil) error. index order: [ptHatBin] [Regular pt] double CS_Err_soft_ind[NpTHatBin][NpTBin]; //2D array used to store hadron error stemming from hadrons that are source/sink terms to hydrodynamics. index order: [ptHatBin] [Regular pt] double TotalCS[NpTBin]; //Total cross section per pTHat bin double TotalCSErr[NpTBin]; //Total cross section error per pTHat bin int TotalEvents[NpTHatBin]; //Total events in each pT hat bin //cout << "\nStart the analysis\n\n" << endl; cout << "......Start Filing the Histograms.....\n" << endl; // For loop to open different pTHat bin files for (int k = 0; k> SN1 >> PID1 >> stat1 >> E1 >> Px1 >> Py1 >> Pz1 >> Eta1 >> Phi1) { //if the first string is # complete the event if(MyString.compare(SN1)==0) { TotalEvents[k]++; continue; } //convert all the strings read to appropreate data type (double, int, etc.) PID=std::stoi(PID1); // PDG Particle ID stat=std::stoi(stat1); // 0 if non recoil (hard induced) particle, 1 if recoil (soft induced ) particle, -1 sink/source left behind by recoil particles. /* 4-momentum components */ E=std::stod(E1); Px=std::stod(Px1); Py=std::stod(Py1); Pz=std::stod(Pz1); /* done */ Eta=std::stod(Eta1); //pseudorapidity //select particles in a given eta range/particle id and bin them if(fabs(PID) == 211 || fabs(PID) == 111) //only pions { if(fabs(Eta)= 0 && Hadbin < NpTBin && pTMin <= pTHad){ if(stat!=-1){ dNdpTCount_hard_ind[k][Hadbin]++; //hard-induced or non recoil particle if stat = 0 } else if(stat==-1){ dNdpTCount_soft_ind[k][Hadbin]++; //if stat=-1, those are soft-induced sources/sinks to the hydrodynamical simulation left by recoil particles } else{ cout<<"Error, unknown status"<> HardCS[k]>>HardCSErr[k]; cout< 0.0)//calculate cross section error and store it in CS_Err_hard_ind[k][j] or CS_Err_soft_ind[k][j] { CS_Err_hard_ind[k][j] = (dNdpTCount_hard_ind[k][j]*HardCS[k]/(TotalEvents[k]*sigma_inel*2*M_PI*pTBinW*(pTMin + pTBinW * (j+0.5))*2.0*EtaCut)); CS_Err_hard_ind[k][j] *= sqrt( (1/dNdpTCount_hard_ind[k][j]) + pow(HardCSErr[k]/HardCS[k],2.0)); cout<<"For pT Bin j = "<0) { CS_hard_ind[j] = (dNdpTCount_hard_ind[k][j]*HardCS[k])/(TotalEvents[k]*sigma_inel*2*M_PI*pTBinW*(pTMin + pTBinW * (j+0.5))*2.0*EtaCut); } //cross section of source/sink terms originating from recoil (soft-induced) particles if(dNdpTCount_soft_ind[k][j]>0){ CS_soft_ind[j] = (dNdpTCount_soft_ind[k][j]*HardCS[k])/(TotalEvents[k]*sigma_inel*2*M_PI*pTBinW*(pTMin + pTBinW * (j+0.5))*2.0*EtaCut); } //Total cross section = cross section of non-recoil (hard-induced) particles - cross section of particles giving source/sinks to the hydro if(CS_hard_ind[j] >= CS_soft_ind[j]){ TotalCS[j] += CS_hard_ind[j] - CS_soft_ind[j]; } //Calculate variance in the total cross section TotalCSErr[j] += pow( CS_Err_hard_ind[k][j], 2.0) + pow( CS_Err_soft_ind[k][j], 2.0); pT[j] = pTMin + pTBinW * (j+0.5); cout<