Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
makePlot_EtaDistribution.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file makePlot_EtaDistribution.C
1 
3  const TString infile = "data/pythia.ep.100.test.root"
4  )
5 {
6  gStyle->SetOptStat(kFALSE);
7 
8  TFile *f_pyth = new TFile( infile, "OPEN");
9  TTree* T_pyth = (TTree*)f_pyth->Get("tree");
10  tree->Print();
11 
12  TCut electron_cut = "p.fKF == 11";
13  TCut Pion_cut = "abs(p.fKF) == 211 || p.fKF == 111";
14 
15  TH1F *h_eta = new TH1F("h_eta", "", 60, -6, 6);
16  TH1F *h_eta_e = (TH1F*)h_eta->Clone();
17  TCanvas *c_eta = new TCanvas("c_eta");
18 
19  tree->Draw("TMath::ASinH(p.fPz/sqrt(((p.fPx)**2 + (p.fPy)**2)))>>h_eta", Pion_cut);
20  h_eta->SetLineStyle(2);
21  tree->Draw("TMath::ASinH(p.fPz/sqrt(((p.fPx)**2 + (p.fPy)**2)))>>h_eta_e", electron_cut && "p.fParent == 0", "same");
22 
23  h_eta->GetXaxis()->SetTitle("Pseudorapidity #eta");
24  h_eta->GetYaxis()->SetTitle("dN/d#eta");
25 
26  TLegend* leg_eta = new TLegend( 0.25, 0.70, 0.45, 0.90);
27  leg_eta->AddEntry(h_eta, "Pions", "L");
28  leg_eta->AddEntry(h_eta_e, "Electrons", "L");
29  leg_eta->Draw();
30 
31  c_eta->Print("EtaDistributions.eps");
32  c_eta->Print("EtaDistributions.png");
33 
34  return 0;
35 }