LArSoft  v07_13_02
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("wvalue.txt","r");
22 
23 Float_t E,nbioni,snbioni,w,sw;
24 Int_t ncols = 0;
25 Int_t nlines = 0;
26 
27 TNtuple *ntuple = new TNtuple("ntuple","w","E:nbioni:snbioni:w:sw");
28 while (1)
29 {
30  ncols = fscanf(fp,"%f %f %f %f %f",&E,&nbioni,&snbioni,&w,&sw);
31  if (ncols < 0) break;
32  ntuple->Fill(E,nbioni,snbioni,w,sw);
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,9.99,1e3,2,9.99,1e3);
42 h2->Draw();
43 ntuple->SetMarkerStyle(20);
44 ntuple->SetMarkerSize(1.);
45 ntuple->Draw("w: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("W (eV)");
55 
56 }
Float_t nbioni
Definition: plot.C:23
Float_t E
Definition: plot.C:23
TNtuple * ntuple
Definition: plot.C:20
Float_t snbioni
Definition: plot.C:23
FILE * fp
Definition: plot.C:36
TH1F * h2
Definition: plot.C:46
fclose(fp)
Float_t sw
Definition: plot.C:23
c1
Definition: plot.C:28
Int_t nlines
Definition: plot.C:53
Float_t w
Definition: plot.C:23
Int_t ncols
Definition: plot.C:54