]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/totEt/macros/emEt/PlotEmEtFractions.C
Updating macros for electromagnetic et
[u/mrichter/AliRoot.git] / PWGLF / totEt / macros / emEt / PlotEmEtFractions.C
CommitLineData
17dae597 1void SetStyles(TH1 *histo,int marker, int color){
2 histo->Sumw2();
3 histo->SetMarkerStyle(marker);
4 histo->SetMarkerColor(color);
5 histo->SetLineColor(color);
6 //histo->GetXaxis()->SetTitle(xtitle);
7 //histo->GetYaxis()->SetTitle(ytitle);
8}
9void PlotEmEtFractions(Bool_t isPhos = kFALSE){
10
11 gStyle->SetOptTitle(0);
12 gStyle->SetOptStat(0);
13 gStyle->SetOptFit(0);
14 Float_t min = 0;
15 float max = 1;
16 TString filename, detname;
17 if(isPhos){
18 min = 0.655;
19 max = 0.785;
20 detname = "PHOS";
21 filename = "rootFiles/LHC11a10a_bis/Et.ESD.simPbPb.PHOS.LHC11a10a_bis.Run139465.root";
22 }
23 else{
24 min = 0.58;
25 max = 0.725;
26 filename = "rootFiles/LHC11a10a_bis/Et.ESD.simPbPb.EMCal.LHC11a10a_bis.Run139465.root";
27 detname = "EMCal";
28 }
29
30 TFile *f = TFile::Open(filename, "READ");
31 TList *l = dynamic_cast<TList*>(f->Get("out1"));
32 TString part[] = {"Signal","Hadrons","Neutrons","Kaons","Secondaries"};
33 Int_t nparts = 5;
34 TString var[] = {"NClusters","NMultiplicity","NMatchedTracks","NTotalTracks"};
35 Int_t nvar = 4;
36 Int_t partnum = 0;
37 Int_t varnum = 0;
38
39 for(Int_t partnum = 0; partnum<nparts;partnum++){
40 for(Int_t varnum = 0;varnum<nvar; varnum++){
41 TString histoname = "fHistFrac"+part[partnum]+"Vs"+var[varnum];
42
43 TH2F *histo = l->FindObject(histoname.Data());
44 histo->GetXaxis()->SetTitle(var[varnum].Data());
45 TString ytitle = part[partnum]+" fraction";
46 histo->GetYaxis()->SetTitle(ytitle.Data());
47 //this line here keeps the zeros from plotting
48 histo->GetYaxis()->SetRange(2,histo->GetYaxis()->GetNbins());
49
50 TCanvas *c1 = new TCanvas("c1","Simulation",600,400);
51 c1->SetTopMargin(0.02);
52 c1->SetRightMargin(0.03);
53 c1->SetLeftMargin(0.11745);
54 c1->SetBottomMargin(0.11745);
55 c1->SetBorderSize(0);
56 c1->SetFillColor(0);
57 c1->SetFillColor(0);
58 c1->SetBorderMode(0);
59 c1->SetFrameFillColor(0);
60 c1->SetFrameBorderMode(0);
61 histo->Draw("colz");
62 TH1 * prof = histo->ProfileX();
63 prof->Draw("same");
64 TString canvasname = "/tmp/"+histoname+detname+".png";
65 c1->SaveAs(canvasname.Data());
66 //return;
67 delete c1;
68 delete prof;
69 }
70 }
71}