void calc_phi_t_xsec_parameters(int dataset){ gStyle->SetOptStat(0); double eff[50],deff[50]; double y[50],dy[50]; double t[50],dt[50]; double Nps[48]; double dsdt0[48],ddsdt0[48]; double tslope[48],dtslope[48]; double eff1[50],deff1[50]; double y1[50],dy1[50]; double dsdt01[48],ddsdt01[48]; double tslope1[48],dtslope1[48]; // int bin=int((Eg-2.8)/0.2); TFile *f=NULL; switch(dataset){ case 0: f=TFile::Open("/work/halld/home/staylor/recon/xsecs/flux_51384_51457.root"); cout << "Flux file: flux_51384_51457.root" << endl; break; case 1: f=TFile::Open("/work/halld/home/staylor/recon/xsecs/flux_40856_41105.root"); cout << "Flux file: flux_40856_41105.root" << endl; break; case 2: f=TFile::Open("/work/halld/home/staylor/recon/xsecs/flux_41106_41257.root"); cout << "Flux file: flux_41106_41257.root" << endl; break; default: cout << "No data set specified" << endl; break; } if (f!=NULL){ f->cd(); TH1D *tagged_flux=(TH1D*)f->FindObjectAny("tagged_flux"); for (int i=0;i<48;i++){ Nps[i]=tagged_flux->GetBinContent(i+1); } f->Close(); ofstream phi_parms_file("phi_parms.dat"); for (int bin=0;bin<48;bin++){ double Nps_sum=Nps[bin]; //Nps_sum=1e11; ifstream in1("phi_t_yields2.dat"); for (int i=0;i> dummy; //cout << dummy << endl; for (int i=0;i<50;i++){ in1 >> y[i]; in1 >> dy[i]; } in1.close(); ifstream in2("phi_kk_t_acc2.dat"); for (int i=0;i> dummy; for (int i=0;i<50;i++){ in2 >> eff[i]; //eff[i]=0.5; in2 >> deff[i]; } in2.close(); double y_acc[50],dy_acc[50]; for (int i=0;i<50;i++){ //cout << eff[i] << endl; if (eff[i]>0.){ double scale=1e6/1.293/Nps_sum/0.492/0.04; y_acc[i]=scale*y[i]/eff[i]; // cout << y[i] << endl; dy_acc[i]=y_acc[i]*sqrt(deff[i]*deff[i]/(eff[i]*eff[i])+dy[i]*dy[i]/(y[i]*y[i])); } t[i]=0.02+0.04*i; dt[i]=0.02; } TGraphErrors *g1=new TGraphErrors(35,&t[2],&y_acc[2],&dt[2],&dy_acc[2]); TF1 *f1=new TF1("f1","[0]*exp([1]*x)",0.1,1.); f1->SetParameters(1,-4); g1->Fit(f1,"rq"); phi_parms_file << 2.9+0.2*bin << " " << f1->GetParameter(0) << " " << f1->GetParError(0) << " " << f1->GetParameter(1) << " " << f1->GetParError(1) << endl; } phi_parms_file.close(); ofstream phi_parms_file1("phi_parms_method1.dat"); for (int bin=0;bin<48;bin++){ double Nps_sum=Nps[bin]; //Nps_sum=1e11; ifstream in3("phi_t_yields.dat"); for (int i=0;i> dummy; //cout << dummy << endl; for (int i=0;i<50;i++){ in3 >> y1[i]; in3 >> dy1[i]; } in3.close(); ifstream in4("phi_kk_t_acc.dat"); for (int i=0;i> dummy; double eff1[50],deff1[50]; for (int i=0;i<50;i++){ in4 >> eff1[i]; //eff[i]=0.5; in4 >> deff1[i]; } in4.close(); double y_acc1[50],dy_acc1[50]; for (int i=0;i<50;i++){ //cout << eff[i] << endl; if (eff1[i]>0.){ double scale=1e6/1.293/Nps_sum/0.492/0.04; y_acc1[i]=scale*y1[i]/eff1[i]; // cout << y[i] << endl; dy_acc1[i]=y_acc1[i]*sqrt(deff1[i]*deff1[i]/(eff1[i]*eff1[i])+dy1[i]*dy1[i]/(y1[i]*y1[i])); } } TGraphErrors *g2=new TGraphErrors(35,&t[2],&y_acc1[2],&dt[2],&dy_acc1[2]); TF1 *f1=new TF1("f1","[0]*exp([1]*x)",0.1,1.); f1->SetParameters(1,-4); g2->Fit(f1,"rq"); phi_parms_file1 << 2.9+0.2*bin << " " << f1->GetParameter(0) << " " << f1->GetParError(0) << " " << f1->GetParameter(1) << " " << f1->GetParError(1) << endl; } phi_parms_file1.close(); } }