]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/Upgrade/macros/toyMCRecPlots.C
robust drawing in TStatToolkit::DrawHistogram (1D only so far) and first drawing...
[u/mrichter/AliRoot.git] / TPC / Upgrade / macros / toyMCRecPlots.C
1 /*
2
3 root.exe -l $ALICE_ROOT/TPC/Upgrade/macros/{loadlibs.C,ConfigOCDB.C}
4 .x $ALICE_ROOT/TPC/Upgrade/macros/toyMCRecPlots.C
5
6 */
7
8 void toyMCRecPlots(TString inFileName = "toyMC.debug.root"){
9   //
10   // do all the plots for Toy MC Reconstruction for the TDR 
11   //
12
13   //gStyle->SetOptStat(0);
14
15   // parameters
16   const Int_t nT0          = 2;
17   const Int_t nT02D        = 2;
18   const Int_t nTrackParams = 9;
19
20   Int_t col = kBlack;
21
22   TString sT0[nT0] = {"fTime0-t0","fTime0-t0+z0*TMath::Sign(1,tOrig.Eta())/vdrift"};
23   TString sT02D[nT02D] = {"fTime0-t0+z0*TMath::Sign(1,tOrig.Eta())/vdrift:tOrig.fP[3]","fTime0-t0+z0*TMath::Sign(1,tOrig.Eta())/vdrift:tOrig.fP[4]"};
24   TString sTrackParams[nTrackParams] = {"track.fP[0]-tOrig.fP[0]","track.fP[1]-tOrig.fP[1]","track.fP[2]-tOrig.fP[2]","track.fP[3]-tOrig.fP[3]","track.fP[4]-tOrig.fP[4]","track.fAlpha-tOrig.fAlpha","track.fX/tOrig.fX","track.fY/tOrig.fY","track.fZ/tOrig.fZ"};
25
26   TString tT0[nT0] = {"T_{0} resolution","intrinsic T_{0} resolution"};
27   TString tT02D[nT0] = {"intrinsic T_{0} resolution vs. tan#lambda","intrinsic T_{0} resolution vs. 1/p_{T}"};
28   TString tTrackParams[nTrackParams] = {"local y","z","sin inclination angle","tan#lambda","1/p_{T}","#alpha","X","Y","Z"};
29
30   TString sSel = "fTime0>-1"; // seeding successful
31
32   // get file
33   TFile *fIn  = TFile::Open(inFileName.Data(),"READ");
34   if(!fIn){
35     Printf("No file %s found",inFileName.Data());
36     return;
37   }
38
39   // get tree
40   TTree *Tracks = fIn->Get("Tracks");
41   if(!Tracks){
42     Printf("No TTree found");
43     return;
44   }
45  // output canvases
46   TCanvas *cT0 = new TCanvas("cT0","cT0",1200,500);
47   cT0->Divide(2,1);
48
49   TCanvas *cT02D = new TCanvas("cT02D","cT02D",1200,500);
50   cT02D->Divide(2,1);
51
52   TCanvas *cTrackParams = new TCanvas("cTrackParams","cTrackParams",1200,900);
53   cTrackParams->Divide(3,3);
54
55
56   // output histograms
57   TH2D *hT02D[nT02D];
58   
59   // legends
60   TLegend *l[nT0];
61
62
63
64   // draw T0 resolution
65   for(Int_t iT0 = 0; iT0 < nT0; iT0 ++){
66
67     cT0->cd(iT0+1);
68     TStatToolkit::DrawHistogram(Tracks,sT0[iT0].Data(),sSel.Data(),Form("hT0%d",iT0),Form("%s",tT0[iT0].Data()),3);
69
70     //hT0[iT0]->Fit("gaus","","");
71     //l[iT0]= new TLegend(0.55,0.7,0.8,0.8,Form(""));
72     //myLegendSetUp(l[iT0],0.03);
73     //l[iT0]->AddEntry( hT0[iT0], Form("#sigma = (%.2f #pm %.2f) #mus",hT0[iT0]->GetFunction("gaus")->GetParameter(2)*1e6,hT0[iT0]->GetFunction("gaus")->GetParError(2)*1e6));
74     //l[iT0]->Draw();
75
76   }
77
78
79   // draw T0 resolution (2D)
80   for(Int_t iT02D = 0; iT02D < nT02D; iT02D ++){
81
82     hT02D[iT02D] = new TH2D(Form("hT02D%d",iT02D),Form("%s",tT02D[iT02D].Data()),200,-3,3,200,-1e-6,1e-6);
83
84     cT02D->cd(iT02D+1);
85     Tracks->Draw(Form("%s>>hT02D%d",sT02D[iT02D].Data(),iT02D),Form("%s",sSel.Data()),"colz");
86
87   }
88
89
90   // draw track parameters
91   for(Int_t iTrackParams = 0; iTrackParams < nTrackParams; iTrackParams ++){
92
93     cTrackParams->cd(iTrackParams+1);
94     TStatToolkit::DrawHistogram(Tracks,sTrackParams[iTrackParams].Data(),sSel.Data(),Form("hTrackParams%d",iTrackParams),Form("%s",tTrackParams[iTrackParams].Data()),3);
95
96   }
97
98
99   // plots
100   TString outFileName = inFileName;
101   outFileName.ReplaceAll(".root","");
102   cT0->SaveAs(Form("%s_T0.eps",outFileName.Data()));
103   cT02D->SaveAs(Form("%s_T02D.eps",outFileName.Data()));
104   cTrackParams->SaveAs(Form("%s_TrackParams.eps",outFileName.Data()));
105
106 }
107
108 void myLegendSetUp(TLegend *currentLegend = NULL,Float_t currentTextSize=0.07){
109   currentLegend->SetTextFont(42);
110   currentLegend->SetBorderSize(0);
111   currentLegend->SetFillStyle(1);
112   currentLegend->SetFillColor(0);
113   currentLegend->SetMargin(0.25);
114   currentLegend->SetTextSize(currentTextSize);
115   currentLegend->SetEntrySeparation(0.5);
116   return;
117 }
118
119 void myHistoSetUp( TH1 *h = NULL, Int_t col = kBlack, Int_t mar = 20){
120
121   h->SetLineColor(col);
122   h->SetMarkerColor(col);
123   h->SetMarkerStyle(mar);
124
125 }
126