Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:56

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