]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CORRFW/test/testSlice.C
Added new functionalities for projections and slices.
[u/mrichter/AliRoot.git] / CORRFW / test / testSlice.C
CommitLineData
9105291d 1
2void testSlice() {
3
4 gStyle->SetPalette(1);
5
6 gSystem->Load("libANALYSIS");
7 gSystem->Load("libCORRFW");
8
9 TFile * f = TFile::Open("output.root");
10
11 AliCFContainer * c_in = (AliCFContainer*)f->Get("container");
12
13 printf("====\n");
14 printf("old container properties\n");
15 printf("nvar=%d\t nstep=%d\t nbins[0]=%d\t nbins[1]=%d\n",c_in->GetNVar(),c_in->GetNStep(),c_in->GetNBins(0),c_in->GetNBins(1));
16 printf("====\n");
17
18
19 TCanvas * can = new TCanvas("can","",1300,850);
20 can->Divide(3,2);
21 Short_t iCan=1;
22
23 can->cd(iCan++);
24 TH2D* h_in_step0 = c_in->ShowProjection(0,1,0);
25 h_in_step0->SetTitle("input container - step 0");
26 h_in_step0->Draw("text colz");
27
28 can->cd(iCan++);
29 TH2D* h_in_step1 = c_in->ShowProjection(0,1,1) ;
30 h_in_step1->SetTitle("input container - step 1");
31 h_in_step1->Draw("text colz");
32
33
34 Int_t* vars = new Int_t[1 /*2*/];
35 vars[0]=0;
36 //vars[1]=1;
37
38 Double_t epsilon=1.e-07;
39
40 Double_t varMin[2]={0.0 , 0.0 };
41 Double_t varMax[2]={2.0 - epsilon , 1.0 };
42
43
44 can->cd(iCan++);
45 TH1D* h_slice_step0 = c_in->ShowSlice(0,varMin,varMax,0);
46 h_slice_step0->SetTitle("test slice - step 0");
47 h_slice_step0->Draw();
48
49 printf("Creating Slice...\n");
50 AliCFContainer* c_out = c_in->MakeSlice(1,vars,varMin,varMax);
51
52 printf("====\n");
53 printf("new container properties\n");
54 printf("nvar=%d\t nstep=%d\t nbins[0]=%d\n",c_out->GetNVar(),c_out->GetNStep(),c_out->GetNBins(0));
55 printf("range = %d -> %d\n",((AliCFGridSparse*)c_out->GetGrid(0))->GetGrid()->GetAxis(0)->GetFirst(),((AliCFGridSparse*)c_out->GetGrid(0))->GetGrid()->GetAxis(0)->GetLast());
56 printf("====\n");
57
58 can->cd(iCan++);
59 TH1D* h_out_step0 = c_out->ShowProjection(0,0);
60 h_out_step0->SetTitle("output container - step 0");
61 h_out_step0->Draw();
62
63 can->cd(iCan++);
64 TH1D* h_out_step1 = c_out->ShowProjection(0,1);
65 h_out_step1->SetTitle("output container - step 1");
66 h_out_step1->Draw();
67
68
69
70 AliCFEffGrid * eff = new AliCFEffGrid("eff","",*c_out);
71 eff->CalculateEfficiency(1,0);
72
73 printf("====\n");
74 printf("efficiency map properties\n");
75 printf("nvar=%d\t nbins[0]=%d\n",eff->GetNVar(),eff->GetNBins(0));
76 printf("====\n");
77
78 can->cd(iCan++);
79 eff->Project(0)->Draw();
80
81}