]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/Upgrade/macros/fitResolution.C
//
[u/mrichter/AliRoot.git] / TPC / Upgrade / macros / fitResolution.C
CommitLineData
0104ee1c 1void EmpiricalGEMQFit(){
2 //
3 // Empirical fit of the relative Q resolution for the iron source with 4 GEM layers
4 // Fit:
5 // Assumption :
6 // 1.) Effective electron transparency proportiaonal to the effective ion transparency
7 // 2.) RMS of the effecitive gain can be expressed as linear function of U1/U3,U2/U4 and U3/U4
8 //
9 // Agreement with data within the expect error estimate -relative agreement
10 // RMS (sigma_{meas}/sigma_{fit}) ~ 3%
11 //
12 TFile *fgem = TFile::Open("GEMScansIKF.root");
13 TTree * tree= (TTree*)f.Get("NeCO2N2");
14 tree->SetMarkerStyle(25);
15 TStatToolkit toolkit;
16 Double_t chi20=0;
17 Int_t npoints=0;
18 Int_t npointsMax=10000;
19 TVectorD param0,param1,param2,param3;
20 TMatrixD covar0,covar1,covar2,covar3;
21
22 tree->SetAlias("UGEMA","(UGEM1+UGEM2+UGEM3+UGEM4)");
23 TString fstringFast="";
24 fstringFast+="1/IB++"; // fraction of the
25 fstringFast+="(UGEM1/UGEMA)/IB++"; // fraction of the gain
26 fstringFast+="(UGEM2/UGEMA)/IB++"; // fraction of the gain
27 fstringFast+="(UGEM3/UGEMA)/IB++"; // fraction of the gain
28 //
29 TString *strResolFit = TStatToolkit::FitPlane(tree,"Sigma^2:Sigma^2", fstringFast.Data(),cutFit, chi20,npoints,param0,covar0,-1,0, npointsMax, 0);
30 strResolFit->Tokenize("++")->Print();
31 tree->SetAlias("fitSigma2",strResolFit->Data());
32 //
33 gStyle->SetOptTitle(0);
34 //
35 TCanvas *canvas = new TCanvas("canvasEmp","canvasEmp",600,500);
36 canvas->SetBottomMargin(0.15);
37 canvas->SetRightMargin(0.1);
38 canvas->SetTicks(1,1);
39 tree->SetMarkerSize(0.7)
40 tree->Draw("Sigma:sqrt(fitSigma2):sqrt(1/IB)",cutFit,"colz");
41 TH2F *htemp = (TH2F*)gPad->GetPrimitive("htemp");
42 htemp->GetXaxis()->SetTitle("#sigma_{fit}(%)");
43 htemp->GetYaxis()->SetTitle("#sigma_{meas}(%)");
44 htemp->GetZaxis()->SetTitle("#sqrt{IBF}");
45 htemp->SetTitle("Fe resolution");
46 htemp->GetXaxis()->SetLimits(8,20);
47 htemp->GetYaxis()->SetLimits(8,20);
48 htemp->Draw("colz");
49 TLatex latex;
50 latex.DrawLatex(8.5,18.5,"#sigma=#sqrt{p_{0}+p_{1}#frac{1}{IB}+p_{2}#frac{U1}{U4xIB}+p_{3}#frac{U2}{U4xIB} + p_{4}#frac{U3}{U4xIB}}");
51 latex.DrawLatex(8.5,17,TString::Format("p_{0}=%1.f",param0[0]));
52 latex.DrawLatex(8.5,16,TString::Format("p_{1}=%1.f",param0[1]));
53 latex.DrawLatex(8.5,15,TString::Format("p_{2}=%1.f",param0[2]));
54 latex.DrawLatex(8.5,14,TString::Format("p_{3}=%1.f",param0[3]));
55 latex.DrawLatex(8.5,13,TString::Format("p_{4}=%1.f",param0[4]));
56
57 canvasFit->SaveAs("canvasFEResolutionFit.pdf");
58 canvasFit->SaveAs("canvasFEResolutionFit.png");
59}