ROOT logo

void testSlice() {
  
  gStyle->SetPalette(1);
  gStyle->SetOptStat(1111111);

  gSystem->Load("libANALYSIS");
  gSystem->Load("libCORRFW");

  TFile * f = TFile::Open("output.root");

  AliCFContainer * c_in = (AliCFContainer*)f->Get("container");
  
  printf("====\n");
  printf("old container properties\n");
  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));
  printf("====\n");


  TCanvas * can = new TCanvas("can","",1300,850);
  can->Divide(3,2);
  Short_t iCan=1;

  can->cd(iCan++);
  TH2D* h_in_step0 = c_in->ShowProjection(0,1,0);
  h_in_step0->SetTitle("input container - step 0");
  h_in_step0->Draw("text colz");

  can->cd(iCan++);
  TH2D* h_in_step1 = c_in->ShowProjection(0,1,1) ;
  h_in_step1->SetTitle("input container - step 1");
  h_in_step1->Draw("text colz");
  

  Int_t* vars = new Int_t[1 /*2*/];
  vars[0]=0;
  //vars[1]=1;

  Double_t epsilon=1.e-07;

  Double_t varMin[2]={0.0  ,  -1.0-epsilon  };
  Double_t varMax[2]={8.0  ,   1.0-epsilon  };


  can->cd(iCan++);
  TH1D* h_slice_step0 = c_in->ShowSlice(0,varMin,varMax,0);
  h_slice_step0->SetTitle("test slice - step 0");
  h_slice_step0->Draw();

  printf("Creating Slice...\n");
  AliCFContainer* c_out = c_in->MakeSlice(1,vars,varMin,varMax);

  printf("====\n");
  printf("new container properties\n");
  printf("nvar=%d\t nstep=%d\t nbins[0]=%d\n",c_out->GetNVar(),c_out->GetNStep(),c_out->GetNBins(0));
  printf("range = %d  -> %d\n",((AliCFGridSparse*)c_out->GetGrid(0))->GetGrid()->GetAxis(0)->GetFirst(),((AliCFGridSparse*)c_out->GetGrid(0))->GetGrid()->GetAxis(0)->GetLast());
  printf("====\n");
  
  can->cd(iCan++);
  TH1D* h_out_step0 = c_out->ShowProjection(0,0);
  h_out_step0->SetTitle("output container - step 0");
  h_out_step0->Draw();

  can->cd(iCan++);
  TH1D* h_out_step1 = c_out->ShowProjection(0,1);
  h_out_step1->SetTitle("output container - step 1");
  h_out_step1->Draw();



  AliCFEffGrid * eff = new AliCFEffGrid("eff","",*c_out);
  eff->CalculateEfficiency(1,0);

  printf("====\n");
  printf("efficiency map properties\n");
  printf("nvar=%d\t nbins[0]=%d\n",eff->GetNVar(),eff->GetNBins(0));
  printf("range = %d  -> %d\n",((AliCFGridSparse*)eff->GetNum())->GetGrid()->GetAxis(0)->GetFirst(),((AliCFGridSparse*)eff->GetNum())->GetGrid()->GetAxis(0)->GetLast());
  printf("====\n");
  
  can->cd(iCan++);
  eff->Project(0)->Draw();

}
 testSlice.C:1
 testSlice.C:2
 testSlice.C:3
 testSlice.C:4
 testSlice.C:5
 testSlice.C:6
 testSlice.C:7
 testSlice.C:8
 testSlice.C:9
 testSlice.C:10
 testSlice.C:11
 testSlice.C:12
 testSlice.C:13
 testSlice.C:14
 testSlice.C:15
 testSlice.C:16
 testSlice.C:17
 testSlice.C:18
 testSlice.C:19
 testSlice.C:20
 testSlice.C:21
 testSlice.C:22
 testSlice.C:23
 testSlice.C:24
 testSlice.C:25
 testSlice.C:26
 testSlice.C:27
 testSlice.C:28
 testSlice.C:29
 testSlice.C:30
 testSlice.C:31
 testSlice.C:32
 testSlice.C:33
 testSlice.C:34
 testSlice.C:35
 testSlice.C:36
 testSlice.C:37
 testSlice.C:38
 testSlice.C:39
 testSlice.C:40
 testSlice.C:41
 testSlice.C:42
 testSlice.C:43
 testSlice.C:44
 testSlice.C:45
 testSlice.C:46
 testSlice.C:47
 testSlice.C:48
 testSlice.C:49
 testSlice.C:50
 testSlice.C:51
 testSlice.C:52
 testSlice.C:53
 testSlice.C:54
 testSlice.C:55
 testSlice.C:56
 testSlice.C:57
 testSlice.C:58
 testSlice.C:59
 testSlice.C:60
 testSlice.C:61
 testSlice.C:62
 testSlice.C:63
 testSlice.C:64
 testSlice.C:65
 testSlice.C:66
 testSlice.C:67
 testSlice.C:68
 testSlice.C:69
 testSlice.C:70
 testSlice.C:71
 testSlice.C:72
 testSlice.C:73
 testSlice.C:74
 testSlice.C:75
 testSlice.C:76
 testSlice.C:77
 testSlice.C:78
 testSlice.C:79
 testSlice.C:80
 testSlice.C:81
 testSlice.C:82
 testSlice.C:83
 testSlice.C:84