]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/totEt/macros/hadEt/dEdx.C
Updates to macros to get code working on grid
[u/mrichter/AliRoot.git] / PWGLF / totEt / macros / hadEt / dEdx.C
1 //Christine Nattrass, University of Tennessee at Knoxville
2 //This macro is for  plotting the dE/dx from the TPC as used for particle identification for the transverse energy analysis
3 //Particles identified are colored
4 //Uses the output of AliAnalysisTaskHadEt
5
6 void dEdx(char *prodname = "LHC10d4 PYTHIA D6T 7 TeV p+p", char *shortprodname = "LHC10d4",bool TPC = true, char *filename="Et.ESD.new.sim.LHC10d4.pp.merged.root"){
7   TFile *file =  new TFile(filename);
8   if(!file){
9     cerr<<"Error, no file found"<<endl;
10     return;
11   }
12
13   char *myname = "ITS";
14   if(TPC) myname = "TPC";
15   TH2F *all = out2->FindObject(Form("dEdxAll%s",myname));
16   TH2F *pi = out2->FindObject(Form("dEdxPion%s",myname));
17   TH2F *k = out2->FindObject(Form("dEdxKaon%s",myname));
18   TH2F *p = out2->FindObject(Form("dEdxProton%s",myname));
19   TH2F *e = out2->FindObject(Form("dEdxElectron%s",myname));
20   gStyle->SetPalette(1);
21   pi->SetMarkerColor(2);
22   k->SetMarkerColor(3);
23   p->SetMarkerColor(4);
24   e->SetMarkerColor(TColor::kYellow);
25   pi->SetLineColor(2);
26   k->SetLineColor(3);
27   p->SetLineColor(4);
28   e->SetLineColor(TColor::kYellow);
29   pi->SetFillColor(2);
30   k->SetFillColor(3);
31   p->SetFillColor(4);
32   e->SetFillColor(TColor::kYellow);
33
34   if(!TPC){all->GetXaxis()->SetRange(all->GetXaxis()->FindBin(0.05));}
35   else{all->GetXaxis()->SetRange(all->GetXaxis()->FindBin(0.1));}
36   //all->GetYaxis()->SetRange(all->GetYaxis()->FindBin(35.0));
37
38   //e->SetMarkerStyle(20);
39
40   gStyle->SetOptTitle(0);
41   gStyle->SetOptStat(0);
42   gStyle->SetOptFit(0);
43   TCanvas *c = new TCanvas("c","c",600,400);
44   c->SetTopMargin(0.02);
45   c->SetRightMargin(0.02);
46   c->SetBorderSize(0);
47   c->SetFillColor(0);
48   c->SetFillColor(0);
49   c->SetBorderMode(0);
50   c->SetFrameFillColor(0);
51   c->SetFrameBorderMode(0);
52   c->SetLogx();
53   all->Draw();
54   pi->Draw("same");
55   k->Draw("same");
56   p->Draw("same");
57   e->Draw("same");
58   TLegend *leg = new  TLegend(0.825503,0.768817,0.963087,0.954301);
59  leg->AddEntry(pi,"#pi^{#pm}","F");
60  leg->AddEntry(k,"K^{#pm}","F");
61  leg->AddEntry(p,"p,#bar{p}","F");
62  leg->AddEntry(e,"e^{#pm}","F");
63   leg->SetFillStyle(0);
64   leg->SetFillColor(0);
65   leg->SetBorderSize(0);
66  leg->Draw();
67
68
69  float y = 141.021;
70  if(!TPC) y = 463.693;
71  TLatex *tex = new TLatex(0.119617,y,prodname);
72   tex->SetTextSize(0.0537634);
73   tex->Draw();
74   if(TPC){
75     c->SaveAs(Form("pics/%s/dEdx.eps",shortprodname));
76     c->SaveAs(Form("pics/%s/dEdx.png",shortprodname));
77   }
78   else{
79     c->SaveAs(Form("pics/%s/dEdxITS.eps",shortprodname));
80     c->SaveAs(Form("pics/%s/dEdxITS.png",shortprodname));
81   }
82 }