]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/macros/DrawEtaPhi.C
add jet trigger
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / DrawEtaPhi.C
CommitLineData
8c1c76e9 1AliCFContainer *MakeSlice(AliCFContainer *cont, Double_t pmin = 2., Int_t charge = 0){
2 TArrayI steps(cont->GetNStep()); for(Int_t istep = 0; istep < cont->GetNStep(); istep++) steps[istep] = istep;
3 Int_t vars[2] = {1,2};
4 TArrayD min(cont->GetNVar()), max(cont->GetNVar());
5 for(Int_t ivar = 0; ivar < cont->GetNVar(); ivar++){
6 if(ivar == 0){
7 min[ivar] = pmin;
8 max[ivar] = 10.;
9 } else if(ivar == 3){
10 if(charge == -1){
11 min[ivar] = max[ivar] = -1;
12 } else if(charge == 1){
13 min[ivar] = max[ivar] = 1;
14 } else {
15 min[ivar] = 1;
16 max[ivar] = -1;
17 }
18 } else {
19 min[ivar] = cont->GetAxis(ivar, 0)->GetXmin();
20 max[ivar] = cont->GetAxis(ivar, 0)->GetXmax();
21 }
22 }
23 return cont->MakeSlice(cont->GetNStep(), steps.GetArray(), 2, vars, min.GetArray(), max.GetArray());
24}
25
26void DrawEtaPhi(Double_t pmin = 2.){
27 TFile *in = TFile::Open("HFEtaskTRD2.root");
28 TList *res = (TList *)in->Get("TRD_HFE_Results2");
29 // Container with tracks
30 AliHFEcontainer *hfecont = (AliHFEcontainer *)res->FindObject("trackContainer");
31 AliCFContainer *cont = hfecont->GetCFContainer("recTrackContReco");
32 // Container with number of events for normalization
33 AliCFContainer *evc = (AliCFContainer *)res->FindObject("eventContainer");
34 TH1 *h1 = (TH1 *)evc->Project(4, 0);
35 Int_t nEvents = h1->GetEntries();
36 cout << "Number of events: " << nEvents << endl;
37 // For plotting
38 Double_t rm = 0.2;
39 Double_t ts = 0.045;
40
41 Int_t steps = cont->GetNStep() - 1;
42 TH2 *htpr = 0;
43 TCanvas *plotall = new TCanvas("plot", "Eta-phi maps for different cut steps (all charge)", 1000, 600);
44 plotall->Divide(steps/2, 2);
45 AliCFContainer *scall= MakeSlice(cont, pmin, 0);
46 for(Int_t istep = 1; istep < cont->GetNStep(); istep++){
47 plotall->cd(istep);
48 gPad->SetRightMargin(rm);
49 hptr = (TH2 *)scall->Project(istep, 0,1);
50 hptr->Scale(1e5/static_cast<Double_t>(nEvents));
51 hptr->SetStats(0);
52 hptr->SetName(Form("%sall", cont->GetStepTitle(istep)));
53 hptr->SetTitle(Form("Step %s", cont->GetStepTitle(istep)));
54 hptr->GetXaxis()->SetTitle("#eta");
55 hptr->GetYaxis()->SetTitle("#phi");
56 hptr->GetZaxis()->SetTitle("Tracks / 100000 Events");
57 hptr->GetZaxis()->SetTitleOffset(1.2);
58 hptr->GetXaxis()->SetTitleSize(ts);
59 hptr->GetYaxis()->SetTitleSize(ts);
60 hptr->GetZaxis()->SetTitleSize(ts);
61 hptr->GetZaxis()->SetRangeUser(0, 2.2);
62 hptr->Draw("colz");
63 }
64 plotall->cd();
65
66 TCanvas *plotpos = new TCanvas("plotpos", "Eta-phi maps for different cut steps (pos charge)", 1000, 600);
67 plotpos->Divide(steps/2, 2);
68 AliCFContainer *scpos = MakeSlice(cont, pmin, 1);
69 for(Int_t istep = 1; istep < cont->GetNStep(); istep++){
70 plotpos->cd(istep);
71 gPad->SetRightMargin(rm);
72 hptr = (TH2 *)scpos->Project(istep, 0,1);
73 hptr->Scale(1e5/static_cast<Double_t>(nEvents));
74 hptr->SetStats(0);
75 hptr->SetTitle(Form("Step %s", cont->GetStepTitle(istep)));
76 hptr->SetName(Form("%spos", cont->GetStepTitle(istep)));
77 hptr->GetXaxis()->SetTitle("#eta");
78 hptr->GetYaxis()->SetTitle("#phi");
79 hptr->GetZaxis()->SetTitle("Tracks / 100000 Events");
80 hptr->GetZaxis()->SetTitleOffset(1.2);
81 hptr->GetXaxis()->SetTitleSize(ts);
82 hptr->GetYaxis()->SetTitleSize(ts);
83 hptr->GetZaxis()->SetTitleSize(ts);
84 hptr->GetZaxis()->SetRangeUser(0, 1.1);
85 hptr->Draw("colz");
86 }
87 plotpos->cd();
88
89 TCanvas *plotneg = new TCanvas("plotneg", "Eta-phi maps for different cut steps (neg charge)", 1000, 600);
90 plotneg->Divide(steps/2, 2);
91 AliCFContainer *scneg = MakeSlice(cont, pmin, -1);
92 for(Int_t istep = 1; istep < cont->GetNStep(); istep++){
93 plotneg->cd(istep);
94 gPad->SetRightMargin(rm);
95 hptr = (TH2 *)scneg->Project(istep, 0,1);
96 hptr->Scale(1e5/static_cast<Double_t>(nEvents));
97 hptr->SetStats(0);
98 hptr->SetName(Form("%sneg", cont->GetStepTitle(istep)));
99 hptr->SetTitle(Form("Step %s", cont->GetStepTitle(istep)));
100 hptr->GetXaxis()->SetTitle("#eta");
101 hptr->GetYaxis()->SetTitle("#phi");
102 hptr->GetZaxis()->SetTitle("Tracks / 100000 Events");
103 hptr->GetZaxis()->SetTitleOffset(1.2);
104 hptr->GetXaxis()->SetTitleSize(ts);
105 hptr->GetYaxis()->SetTitleSize(ts);
106 hptr->GetZaxis()->SetTitleSize(ts);
107 hptr->GetZaxis()->SetRangeUser(0, 1.1);
108 hptr->Draw("colz");
109 }
110 plotneg->cd();
111
112}