LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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 // *********************************************************************
10 
11 {
12 gROOT->Reset();
13 
14 gStyle->SetPalette(1);
15 gROOT->SetStyle("Plain");
16 gStyle->SetOptStat(000000);
17 
18 c1 = new TCanvas ("c1","",60,60,500,500);
19 c1->Divide(1,1);
20 
21 FILE * fp = fopen("s.txt","r");
22 
23 Float_t radius,E,s,ss;
24 Int_t ncols = 0;
25 Int_t nlines = 0;
26 
27 TNtuple *ntuple = new TNtuple("ntuple","s","radius:E:s:ss");
28 while (1)
29 {
30  ncols = fscanf(fp,"%f %f %f %f",&radius,&E,&s,&ss);
31  if (ncols < 0) break;
32  ntuple->Fill(radius,E,s,ss);
33  nlines++;
34 }
35 fclose(fp);
36 
37 c1->cd(1);
38 gPad->SetLogx();
39 gPad->SetLogy();
40 
41 TH2F * h2 = new TH2F ("h2","",2,99.999,1e4,2,1e2,1e4);
42 h2->Draw();
43 ntuple->SetMarkerStyle(20);
44 ntuple->SetMarkerSize(1.);
45 ntuple->Draw("s:E","","LPsame");
46 
47 h2->GetXaxis()->SetLabelSize(0.025);
48 h2->GetYaxis()->SetLabelSize(0.025);
49 h2->GetXaxis()->SetTitleSize(0.035);
50 h2->GetYaxis()->SetTitleSize(0.035);
51 h2->GetXaxis()->SetTitleOffset(1.4);
52 h2->GetYaxis()->SetTitleOffset(1.4);
53 h2->GetXaxis()->SetTitle("E (eV)");
54 h2->GetYaxis()->SetTitle("S (Gy/Bq.s)");
55 
56 }
Float_t s
Definition: plot.C:23
Float_t E
Definition: plot.C:23
Float_t ss
Definition: plot.C:23
TNtuple * ntuple
Definition: plot.C:20
FILE * fp
Definition: plot.C:36
Double_t radius
Definition: plot.C:235
TH1F * h2
Definition: plot.C:46
fclose(fp)
c1
Definition: plot.C:28
Int_t nlines
Definition: plot.C:53
Int_t ncols
Definition: plot.C:54