Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:06

0001 //
0002 // *********************************************************************
0003 // To execute this macro under ROOT after your simulation ended,
0004 //   1 - launch ROOT (usually type 'root' at your machine's prompt)
0005 //   2 - type '.X plot.C' at the ROOT session prompt
0006 //   3 - OR directly type 'root plot.C'
0007 // *********************************************************************
0008 
0009 {
0010 gROOT->Reset();
0011 gStyle->SetPalette(1);
0012 gROOT->SetStyle("Plain");
0013 gStyle->SetOptStat(00000);
0014 
0015 c1 = new TCanvas ("c1","Range",60,60,700,700);
0016 c1->Divide(1,1);
0017 
0018 c1->cd(1);
0019 gPad->SetLogx();
0020 gPad->SetLogy();
0021 
0022 TH2F * h2  = new TH2F("h2","",2,9.99,1e+4,2,1e-1,1e+4);
0023 h2->Draw();
0024 h2->GetXaxis()->SetLabelSize(0.025);
0025 h2->GetYaxis()->SetLabelSize(0.025);
0026 h2->GetXaxis()->SetTitleSize(0.035);
0027 h2->GetYaxis()->SetTitleSize(0.035);
0028 h2->GetXaxis()->SetTitleOffset(1.4);
0029 h2->GetYaxis()->SetTitleOffset(1.4);
0030 h2->GetXaxis()->SetTitle("E (eV)");
0031 h2->GetYaxis()->SetTitle("Distance (nm)");
0032 
0033 FILE * fp = fopen("range.txt","r");
0034 
0035 Float_t e,track,strack,proj,sproj,pene,spene;
0036 Int_t ncols = 0;
0037 Int_t nlines = 0;
0038 
0039 TNtuple *ntuple = new TNtuple("ntuple","range","e:track:strack:proj:sproj:pene:spene");
0040 
0041 while (1)
0042 {
0043   ncols = fscanf(fp,"%f %f %f %f %f %f %f",&e,&track,&strack,&proj,&sproj,&pene,&spene);
0044   if (ncols < 0) break;
0045   ntuple->Fill(e,track,strack,proj,sproj,pene,spene);
0046   nlines++;
0047 }
0048 fclose(fp);
0049 
0050 ntuple->SetLineWidth(3);
0051 
0052 ntuple->SetLineColor(2);
0053 ntuple->Draw("track:e","","Lsame");
0054 
0055 ntuple->SetLineColor(3);
0056 ntuple->Draw("pene:e","","Lsame");
0057 
0058 ntuple->SetLineColor(4);
0059 ntuple->Draw("proj:e","","Lsame");
0060 }