#include "TCanvas.h" #include "TH1.h" #include "TF1.h" #include "TLatex.h" #include #define KPI_COLOR 2 #define KP_COLOR 3 #define PPI_COLOR 4 #define DEDX_COLOR 2 #define OOH_I_HATE_THAT_UGLY_GRID double tdiff(double *x,double *m) { double r = 140; double rbc1 = sqrt(1+m[0]*m[0]/(x[0]*x[0]))/29.98; double rbc2 = sqrt(1+m[1]*m[1]/(x[0]*x[0]))/29.98; return r*(rbc2-rbc1)*10.0; } double cotdedx(double *x, double *par) { double a01 = -55.190; double a02 = -10.171; double b = 36.035; double c00 = 32.195; double c01 = 5.8856; double sgdedx = 82; double offset = 32.1; double scale = 0.4; double nctc = 20; double p = x[0]; double m1 = par[0]; double m2 = par[1]; double z1 = p/m1; double z2 = p/m2; double beta1 = sqrt(1/(1+1/(z1*z1))); double beta2 = sqrt(1/(1+1/(z2*z2))); double dedx1 = (c01*log(z1/(b+z1))+c00)/(beta1*beta1) + (beta1-1)*(a01+(beta1-1)*a02); double dedx2 = (c01*log(z2/(b+z2))+c00)/(beta2*beta2) + (beta2-1)*(a01+(beta2-1)*a02); double ededx = (sgdedx+(dedx2*1.25-offset)*scale)/nctc; return fabs(dedx1-dedx2)/ededx; } void TofSeparation() { gROOT->SetStyle("Plain"); TCanvas *c1 = new TCanvas("c1","TOF Separation",0,0,600,500); c1->cd(); TH1F *h = gPad->DrawFrame(0.5,0,5,5); #ifndef OOH_I_HATE_THAT_UGLY_GRID gPad->SetGridx(); gPad->SetGridy(); #endif h->GetXaxis()->SetTitle("Momentum (GeV/c)"); h->GetXaxis()->SetTitleFont(52); h->GetXaxis()->SetLabelFont(52); h->GetYaxis()->SetTitle("Separation power (#sigma)"); h->GetYaxis()->SetTitleFont(52); h->GetYaxis()->SetLabelFont(52); h->GetXaxis()->SetNdivisions(510); h->GetYaxis()->SetNdivisions(505); TF1 *fkpi = new TF1("fkpi",tdiff,0.5,5,2); fkpi->SetNpx(500); fkpi->SetParameters(0.13956995,0.493677); fkpi->SetLineColor(KPI_COLOR); fkpi->SetLineWidth(3); fkpi->Draw("SAME"); TF1 *fkp = new TF1("fkp",tdiff,0.5,5,2); fkp->SetNpx(500); fkp->SetParameters(0.493677,0.93827200); fkp->SetLineColor(KP_COLOR); fkp->SetLineWidth(3); fkp->Draw("SAME"); TF1 *fppi = new TF1("ppi",tdiff,0.5,5,2); fppi->SetNpx(500); fppi->SetParameters(0.13956995,0.93827200); fppi->SetLineColor(PPI_COLOR); fppi->SetLineWidth(3); fppi->Draw("SAME"); TF1 *fcot = new TF1("cot",cotdedx,0.5,5.0,2); fcot->SetNpx(500); fcot->SetParameters(0.13956995,0.493677); fcot->SetLineColor(DEDX_COLOR); fcot->SetLineStyle(2); fcot->SetLineWidth(3); fcot->Draw("SAME"); TLatex *labels[5]; labels[0] = new TLatex(0.47,0.62,"p-#pi"); labels[1] = new TLatex(0.36,0.47,"K-p"); labels[2] = new TLatex(0.24,0.65,"K-#pi"); labels[3] = new TLatex(0.19,0.29,"K-#pi from "); labels[4] = new TLatex(0.17,0.25,"COT dE/dx"); for ( int i=0; i<5; i++ ) { labels[i]->SetNDC(); labels[i]->SetTextFont(52); labels[i]->Draw(); } c1->Print("dtof.eps"); }