plot.C
Go to the documentation of this file.
1 // -------------------------------------------------------------------
2 // $Id: plot.C 70323 2013-05-29 07:57:44Z gcosmo $
3 // -------------------------------------------------------------------
4 //
5 // *********************************************************************
6 // To execute this macro under ROOT after your simulation ended,
7 // 1 - launch ROOT (usually type 'root' at your machine's prompt)
8 // 2 - type '.X plot.C' at the ROOT session prompt
9 // 3 - OR type directly 'root plot.C'
10 // *********************************************************************
11 
12 {
13 gROOT->Reset();
14 
15 gStyle->SetPalette(1);
16 gROOT->SetStyle("Plain");
17 gStyle->SetOptStat(000000);
18 
19 c1 = new TCanvas ("c1","",60,60,800,800);
20 c1->Divide(1,1);
21 
22 FILE * fp = fopen("s.txt","r");
23 
24 Float_t radius,E,s,ss;
25 Int_t ncols = 0;
26 Int_t nlines = 0;
27 
28 TNtuple *ntuple = new TNtuple("ntuple","s","radius:E:s:ss");
29 while (1)
30 {
31  ncols = fscanf(fp,"%f %f %f %f",&radius,&E,&s,&ss);
32  if (ncols < 0) break;
33  ntuple->Fill(radius,E,s,ss);
34  nlines++;
35 }
36 fclose(fp);
37 
38 c1->cd(1);
39 gPad->SetLogx();
40 gPad->SetLogy();
41 
42 TH2F * h2 = new TH2F ("h2","",2,99.999,1e4,2,1e2,1e4);
43 h2->Draw();
44 ntuple->SetMarkerStyle(20);
45 ntuple->SetMarkerSize(1.);
46 ntuple->Draw("s:E","","LPsame");
47 
48 h2->GetXaxis()->SetLabelSize(0.025);
49 h2->GetYaxis()->SetLabelSize(0.025);
50 h2->GetXaxis()->SetTitleSize(0.035);
51 h2->GetYaxis()->SetTitleSize(0.035);
52 h2->GetXaxis()->SetTitleOffset(1.4);
53 h2->GetYaxis()->SetTitleOffset(1.4);
54 h2->GetXaxis()->SetTitle("E (eV)");
55 h2->GetYaxis()->SetTitle("S (Gy/Bq.s)");
56 
57 }
Float_t s
Definition: plot.C:24
Float_t ss
Definition: plot.C:24
TNtuple * ntuple
Definition: plot.C:20
Float_t E
Definition: plot.C:20
FILE * fp
Definition: plot.C:35
Double_t radius
Definition: plot.C:42
TH1F * h2
Definition: plot.C:45
fclose(fp)
c1
Definition: plot.C:28
Int_t nlines
Definition: plot.C:52
Int_t ncols
Definition: plot.C:53