Functions | Variables
hA_basic_analysis.C File Reference
#include <string>
#include <TFile.h>
#include <TTree.h>
#include <TH1D.h>
#include <TCanvas.h>
#include <TMath.h>
#include <TStyle.h>

Go to the source code of this file.

Functions

void hA_basic_analysis (string evtfile, int A)
 

Variables

const double NR = 3
 
const double R0 = 1.4
 
const double kemin = 0
 
const double kemax = 1500
 
const double nke = 50
 

Function Documentation

void hA_basic_analysis ( string  evtfile,
int  A 
)

Definition at line 42 of file hA_basic_analysis.C.

43 {
44  TFile * finp = new TFile(evtfile.c_str(), "READ");
45  TTree * ghA = (TTree*)finp->Get("ghA");
46  if(!ghA) return;
47 
48  TH1D * pip_nall = new TH1D("pip_nall", "", nke,kemin,kemax);
49  TH1D * pip_sigma_tot = new TH1D("pip_sigma_tot", Form("pi+ A(=%d) total",A), nke,kemin,kemax);
50  TH1D * pip_sigma_reac = new TH1D("pip_sigma_reac", Form("pi+ A(=%d) reaction",A), nke,kemin,kemax);
51  TH1D * pip_sigma_cex = new TH1D("pip_sigma_cex", Form("pi+ A(=%d) charge exchange",A), nke,kemin,kemax);
52  TH1D * pip_sigma_el = new TH1D("pip_sigma_el", Form("pi+ A(=%d) elastic",A), nke,kemin,kemax);
53  TH1D * pip_sigma_inel = new TH1D("pip_sigma_inel", Form("pi+ A(=%d) inelastic",A), nke,kemin,kemax);
54  TH1D * pip_sigma_abs = new TH1D("pip_sigma_abs", Form("pi+ A(=%d) absorption",A), nke,kemin,kemax);
55  TH1D * pip_sigma_pipro = new TH1D("pip_sigma_pipro", Form("pi+ A(=%d) pi production",A), nke,kemin,kemax);
56 
57  ghA->Draw("1000*ke>>pip_nall","","");
58  ghA->Draw("1000*ke>>pip_sigma_tot", Form("A==%d && probe==%d && fsi>0",A,211), "goff");
59  ghA->Draw("1000*ke>>pip_sigma_reac", Form("A==%d && probe==%d && fsi>0 && fsi!=2",A,211), "goff");
60  ghA->Draw("1000*ke>>pip_sigma_cex", Form("A==%d && probe==%d && fsi==1",A,211), "goff");
61  ghA->Draw("1000*ke>>pip_sigma_el", Form("A==%d && probe==%d && fsi==2",A,211), "goff");
62  ghA->Draw("1000*ke>>pip_sigma_inel", Form("A==%d && probe==%d && fsi==3",A,211), "goff");
63  ghA->Draw("1000*ke>>pip_sigma_abs", Form("A==%d && probe==%d && fsi>=4 && fsi<=9",A,211),"goff");
64  ghA->Draw("1000*ke>>pip_sigma_pipro",Form("A==%d && probe==%d && fsi>9",A,211), "goff");
65 
66  const double fm2tomb = 10.; // fm^2 -> mb
67 
68  double R = NR * R0 * TMath::Power((double)A,0.3333);
69  double S = fm2tomb * TMath::Pi() * TMath::Power(R,2);
70 
71  pip_sigma_tot -> Divide (pip_nall); pip_sigma_tot -> Scale (S); pip_sigma_tot -> Sumw2 ();
72  pip_sigma_reac -> Divide (pip_nall); pip_sigma_reac -> Scale (S); pip_sigma_reac -> Sumw2 ();
73  pip_sigma_cex -> Divide (pip_nall); pip_sigma_cex -> Scale (S); pip_sigma_cex -> Sumw2 ();
74  pip_sigma_el -> Divide (pip_nall); pip_sigma_el -> Scale (S); pip_sigma_el -> Sumw2 ();
75  pip_sigma_inel -> Divide (pip_nall); pip_sigma_inel -> Scale (S); pip_sigma_inel -> Sumw2 ();
76  pip_sigma_abs -> Divide (pip_nall); pip_sigma_abs -> Scale (S); pip_sigma_abs -> Sumw2 ();
77  pip_sigma_pipro -> Divide (pip_nall); pip_sigma_pipro -> Scale (S); pip_sigma_pipro -> Sumw2 ();
78 
79  pip_sigma_tot -> SetFillColor(kBlue);
80  pip_sigma_reac -> SetFillColor(kGreen);
81  pip_sigma_cex -> SetFillColor(kRed);
82  pip_sigma_el -> SetFillColor(kRed);
83  pip_sigma_inel -> SetFillColor(kRed);
84  pip_sigma_abs -> SetFillColor(kRed);
85  pip_sigma_pipro -> SetFillColor(kRed);
86 
87  pip_sigma_tot ->GetXaxis()->SetTitle("#pi^{+} KE (MeV)"); pip_sigma_tot ->GetYaxis()->SetTitle("#sigma (mb)");
88  pip_sigma_reac ->GetXaxis()->SetTitle("#pi^{+} KE (MeV)"); pip_sigma_reac ->GetYaxis()->SetTitle("#sigma (mb)");
89  pip_sigma_cex ->GetXaxis()->SetTitle("#pi^{+} KE (MeV)"); pip_sigma_cex ->GetYaxis()->SetTitle("#sigma (mb)");
90  pip_sigma_el ->GetXaxis()->SetTitle("#pi^{+} KE (MeV)"); pip_sigma_el ->GetYaxis()->SetTitle("#sigma (mb)");
91  pip_sigma_inel ->GetXaxis()->SetTitle("#pi^{+} KE (MeV)"); pip_sigma_inel ->GetYaxis()->SetTitle("#sigma (mb)");
92  pip_sigma_abs ->GetXaxis()->SetTitle("#pi^{+} KE (MeV)"); pip_sigma_abs ->GetYaxis()->SetTitle("#sigma (mb)");
93  pip_sigma_pipro->GetXaxis()->SetTitle("#pi^{+} KE (MeV)"); pip_sigma_pipro->GetYaxis()->SetTitle("#sigma (mb)");
94 
95  gStyle->SetOptStat(0);
96 
97  TCanvas * ctot = new TCanvas("ctot","",10,10,500,500);
98  pip_sigma_tot -> Draw("E4");
99  pip_sigma_reac -> Draw("E4SAME");
100  ctot->Update();
101  TCanvas * cfates = new TCanvas("cfates","",110,110,600,600);
102  cfates->Divide(2,2);
103  cfates->cd(1);
104  pip_sigma_cex -> Draw ("E4");
105  cfates->cd(2);
106  pip_sigma_inel -> Draw ("E4");
107  cfates->cd(3);
108  pip_sigma_abs -> Draw ("E4");
109  cfates->cd(4);
110  pip_sigma_pipro -> Draw ("E4");
111  cfates->Update();
112 
113  TFile fout("hAana.root","RECREATE");
114  pip_sigma_tot -> Write("pip_sigma_tot");
115  pip_sigma_reac -> Write("pip_sigma_reac");
116  pip_sigma_cex -> Write("pip_sigma_cex");
117  pip_sigma_el -> Write("pip_sigma_el");
118  pip_sigma_inel -> Write("pip_sigma_inel");
119  pip_sigma_abs -> Write("pip_sigma_abs");
120  pip_sigma_pipro -> Write("pip_sigma_pipro");
121  fout.Close();
122 
123 // finp.Close();
124 }
const double kemin
const double R0
legend SetFillColor(0)
void Draw(const char *plot, const char *title)
Definition: gXSecComp.cxx:580
const double kemax
c2 Divide(2, 2)
static const double A
Definition: Units.h:82
const double NR
const double nke
gm Write()

Variable Documentation

const double kemax = 1500

Definition at line 39 of file hA_basic_analysis.C.

const double kemin = 0

Definition at line 38 of file hA_basic_analysis.C.

const double nke = 50

Definition at line 40 of file hA_basic_analysis.C.

const double NR = 3

Definition at line 36 of file hA_basic_analysis.C.

const double R0 = 1.4

Definition at line 37 of file hA_basic_analysis.C.