+ fPtPullLPT->Fill(mcpt,poolPt);
+ fPtPullHPT->Fill(mcpt,poolPt);
+}
+
+
+
+TH1F* AliComparisonDraw::MakeResol(TH2F * his, Int_t integ, Bool_t type){
+ TH1F *hisr, *hism;
+ if (!gPad) new TCanvas;
+ hisr = AliTreeDraw::CreateResHistoI(his,&hism,integ);
+ if (type) return hism;
+ else
+ return hisr;
+}
+
+
+TGraph2D * AliComparisonDraw::MakeStat2D(TH3 * his, Int_t delta0, Int_t delta1, Int_t type){
+ //
+ //
+ //
+ // delta - number of bins to integrate
+ // type - 0 - mean value
+
+ TAxis * xaxis = his->GetXaxis();
+ TAxis * yaxis = his->GetYaxis();
+ // TAxis * zaxis = his->GetZaxis();
+ Int_t nbinx = xaxis->GetNbins();
+ Int_t nbiny = yaxis->GetNbins();
+ char name[1000];
+ Int_t icount=0;
+ TGraph2D *graph = new TGraph2D(nbinx*nbiny);
+ TF1 f1("f1","gaus");
+ for (Int_t ix=0; ix<nbinx;ix++)
+ for (Int_t iy=0; iy<nbiny;iy++){
+ Float_t xcenter = xaxis->GetBinCenter(ix);
+ Float_t ycenter = yaxis->GetBinCenter(iy);
+ sprintf(name,"%s_%d_%d",his->GetName(), ix,iy);
+ TH1 *projection = his->ProjectionZ(name,ix-delta0,ix+delta0,iy-delta1,iy+delta1);
+ Float_t stat= 0;
+ if (type==0) stat = projection->GetMean();
+ if (type==1) stat = projection->GetRMS();
+ if (type==2 || type==3){
+ TVectorD vec(3);
+ AliMathBase::LTM((TH1F*)projection,&vec,0.7);
+ if (type==2) stat= vec[1];
+ if (type==3) stat= vec[0];
+ }
+ if (type==4|| type==5){
+ projection->Fit(&f1);
+ if (type==4) stat= f1.GetParameter(1);
+ if (type==5) stat= f1.GetParameter(2);
+ }
+ //printf("%d\t%f\t%f\t%f\n", icount,xcenter, ycenter, stat);
+ graph->SetPoint(icount,xcenter, ycenter, stat);
+ icount++;
+ }
+ return graph;
+}
+
+TGraph * AliComparisonDraw::MakeStat1D(TH3 * his, Int_t delta1, Int_t type){
+ //
+ //
+ //
+ // delta - number of bins to integrate
+ // type - 0 - mean value
+
+ TAxis * xaxis = his->GetXaxis();
+ TAxis * yaxis = his->GetYaxis();
+ // TAxis * zaxis = his->GetZaxis();
+ Int_t nbinx = xaxis->GetNbins();
+ Int_t nbiny = yaxis->GetNbins();
+ char name[1000];
+ Int_t icount=0;
+ TGraph *graph = new TGraph(nbinx);
+ TF1 f1("f1","gaus");
+ for (Int_t ix=0; ix<nbinx;ix++){
+ Float_t xcenter = xaxis->GetBinCenter(ix);
+ // Float_t ycenter = yaxis->GetBinCenter(iy);
+ sprintf(name,"%s_%d",his->GetName(), ix);
+ TH1 *projection = his->ProjectionZ(name,ix-delta1,ix+delta1,0,nbiny);
+ Float_t stat= 0;
+ if (type==0) stat = projection->GetMean();
+ if (type==1) stat = projection->GetRMS();
+ if (type==2 || type==3){
+ TVectorD vec(3);
+ AliMathBase::LTM((TH1F*)projection,&vec,0.7);
+ if (type==2) stat= vec[1];
+ if (type==3) stat= vec[0];
+ }
+ if (type==4|| type==5){
+ projection->Fit(&f1);
+ if (type==4) stat= f1.GetParameter(1);
+ if (type==5) stat= f1.GetParameter(2);
+ }
+ //printf("%d\t%f\t%f\t%f\n", icount,xcenter, ycenter, stat);
+ graph->SetPoint(icount,xcenter, stat);
+ icount++;
+ }
+ return graph;
+}
+
+//
+// Make derived plots
+//
+
+void AliComparisonDraw::MakePlots(){
+ //
+ //
+ //
+ AliComparisonDraw * comp=this;
+
+ TFile *fp = new TFile("picutures.root","recreate");
+ TH1F *hiss=0, *hism=0;
+ TGraph2D * gr=0, gr2=0;
+ TGraph * gr0 = 0;
+ TCanvas * c = new TCanvas("Phi resol Tan","Phi resol Tan");
+ //
+ //
+ //
+ hiss = comp->MakeResol(comp->fCPtResolTan,1,0);
+ hiss->SetXTitle("Tan(#theta)");
+ hiss->SetYTitle("#sigmap_{t}/p_{t}");
+ hiss->Draw();
+ hiss->Write("CptResolTan");
+ //
+ //
+ hiss = comp->MakeResol(comp->fCPhiResolTan,1,0);
+ c->cd();
+ hiss->SetXTitle("Tan(#theta)");
+ hiss->SetYTitle("#sigma#phi (rad)");
+ hiss->Draw();
+ fp->cd();
+ hiss->Write("PhiResolTan");
+ //
+ hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
+ c->cd();
+ hiss->SetXTitle("Tan(#theta)");
+ hiss->SetYTitle("#sigma#theta (rad)");
+ hiss->Draw();
+ fp->cd();
+ hiss->Write("ThetaResolTan");
+ //
+ //
+ hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
+ c->cd();
+ hiss->SetXTitle("Tan(#theta)");
+ hiss->SetYTitle("#sigmap_{t}/p_{t} ");
+ hiss->Draw();
+ fp->cd();
+ //
+ //
+ //
+ hiss = comp->MakeResol(comp->fTPCSignalNormTan,4,0);
+ hiss->SetXTitle("Tan(#theta)");
+ hiss->SetYTitle("#sigma_{dEdx}");
+ hiss->Draw();
+ fp->cd();
+ hiss->Write("TPCdEdxResolTan");
+ //
+ //
+ //
+ hiss = comp->MakeResol(comp->fTPCSignalNormTan,4,1);
+ hiss->SetXTitle("Tan(#theta)");
+ hiss->SetYTitle("<dEdx>");
+ hiss->Draw();
+ hiss->Write("TPCdEdxMeanTan");
+ //
+ //
+ gr = comp->MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,4);
+ gr->GetXaxis()->SetTitle("Tan(#theta)");
+ gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
+ gr->GetZaxis()->SetTitle("<dEdx>");
+ gr->Draw("colz");
+ gr->GetHistogram()->Write("TPCdEdxMeanTanPt");
+ //
+ //
+ gr = comp->MakeStat2D(comp->fTPCSignalNormTanSPt,3,1,5);
+ gr->GetXaxis()->SetTitle("Tan(#theta)");
+ gr->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
+ gr->GetZaxis()->SetTitle("#sigma_{dEdx}");
+ gr->Draw("colz");
+ gr->GetHistogram()->Write("TPCdEdxMeanTanPt");
+ //
+ //
+ //
+ comp->fEffTPCTanF->SetXTitle("Tan(#theta)");
+ comp->fEffTPCTanF->SetYTitle("eff_{findable}");
+ comp->fEffTPCTanF->Draw();
+ comp->fEffTPCTanF->Write("EffTanFindable");
+ //
+ //
+ comp->fEffTPCTan->SetXTitle("Tan(#theta)");
+ comp->fEffTPCTan->SetYTitle("eff_{all}");
+ comp->fEffTPCTan->Draw();
+ comp->fEffTPCTan->Write("EffTanAll");
+ //
+ //DCA resolution
+ //
+ gr0 = comp->MakeStat1D(comp->fD0TanSPtB1,2,5);
+ gr0->GetXaxis()->SetTitle("Tan(#theta)");
+ gr0->GetYaxis()->SetTitle("#sigmaDCA (cm)");
+ gPad->Clear();
+ gr0->Draw("al*");
+ gr->GetHistogram()->Write("DCAResolTan");
+ //
+ //
+ //
+ gr = comp->MakeStat2D(comp->fD0TanSPtB1,4,2,5);
+ gr0->GetXaxis()->SetTitle("Tan(#theta)");
+ gr0->GetYaxis()->SetTitle("#sigmaDCA (cm)");
+ gPad->Clear();
+ gr0->Draw("al*");
+ gr->GetHistogram()->Write("DCAResolSPTTan");
+
+ fp->Close();
+
+