]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/fastSimul/AliTPCclusterAnalysis.C
Update master to aliroot
[u/mrichter/AliRoot.git] / TPC / fastSimul / AliTPCclusterAnalysis.C
1 /// \file AliTPCclusterAnalysis.C
2 ///
3 /// 0. Load libraries
4 /// ~~~
5 /// gSystem->Load("libSTAT");
6 /// .x ~/NimStyle.C
7 /// .L $ALICE_ROOT/TPC/fastSimul/AliTPCclusterFast.cxx+
8 /// .L $ALICE_ROOT/TPC/fastSimul/AliTPCclusterAnalysis.C
9 /// ~~~
10 ///
11 /// 1. load tree
12 ///
13 /// ~~~
14 /// LoadTree();
15 /// LoadTrack();
16 /// ~~~
17
18 TChain * treeCluster=0;
19 TChain * treeTrack=0;
20 AliTPCfastTrack * track =0;
21
22 void LoadTree(const char* fname="cluterSimul.root"){
23   ///
24
25   treeCluster = new TChain("simul","simul");
26   treeCluster->AddFile(fname);
27 }
28
29 void LoadTrack(const char* fname="trackerSimul.root"){
30   ///
31
32   treeTrack = new TChain("simulTrack","simulTrack");
33   treeTrack->AddFile(fname);
34   TFile f(fname);
35   
36 }
37
38
39
40
41
42
43 void MakeQNormalization(Int_t maxPoints){
44   /// Normalize Q to the diffusion and angular effect
45
46   TStatToolkit toolkit;
47   Double_t chi2;
48   TVectorD fitParam;
49   TMatrixD covMatrix;
50   Int_t npoints;
51   TString fstringQ="";
52   fstringQ+="fDiff++";
53   fstringQ+="abs(fAngleY)++";
54   fstringQ+="abs(fAngleZ)++";
55   TString *strQmax=0;
56   TString *strQtot=0;
57   //
58   strQmax = toolkit.FitPlane(treeCluster,"s.GetQmax(0.33,2.5,1,1,1)/s.fNtot",fstringQ.Data(), "", chi2,npoints,fitParam,covMatrix,-1,0,50000);
59   printf("Qmax norm\t%f\n",TMath::Sqrt(chi2/npoints));
60   strQmax->Tokenize("++")->Print();
61   treeCluster->SetAlias("qMaxCorr",strQmax->Data());
62   //
63   strQtot = toolkit.FitPlane(treeCluster,"s.GetQtot(0.33,2.5,1,1,1)/s.fNtot",fstringQ.Data(),"", chi2,npoints,fitParam,covMatrix,-1,0,50000);
64   printf("Qmax norm\t%f\n",TMath::Sqrt(chi2/npoints));
65   strQtot->Tokenize("++")->Print();
66   treeCluster->SetAlias("qTotCorr",strQtot->Data());    
67   //
68   //
69 }
70
71
72
73
74 //
75 // Correction tests - normalization of response functions
76 //
77
78 void sum(){
79   TF2 f2("f2","AliTPCclusterFast::GaussConvolution(x,y,2,0.5,0.5,0.5)",-3,3,-3,3);
80   Float_t sumg=0;
81   for (Float_t x=-5; x<5; x+=0.5)  for (Float_t y=-5; y<5; y+=0.5) sumg+=f2->Eval(x,y);
82   printf("%f\n", sumg);
83 }
84
85
86
87 Double_t testSumGaus(Float_t k0,Float_t k1, Float_t s0, Float_t s1){
88   TF2 f2("f2",Form("AliTPCclusterFast::GaussConvolution(x,y,%f,%f,%f,%f)",k0,k1,s0,s1),-2,2,-2,2);
89   Float_t sumg=0;
90   for (Float_t x=-5; x<5; x+=0.2)  for (Float_t y=-5; y<5; y+=0.2) sumg+=f2.Eval(x,y);
91   sumg*=0.2*0.2;
92   printf("%f\t%f\t%f\t%f\t%f\n",k0,k1,s0,s1, sumg);
93   return sumg;
94 }
95
96 Double_t testSumExp(Float_t s0, Float_t k1){
97   TF1 f1("f1",Form("AliTPCclusterFast::GaussExpConvolution(x,%f,%f)",s0,k1),-2,2);
98   Float_t sumg=0;
99   for (Float_t x=-5; x<5; x+=0.2)  sumg+=f1.Eval(x);
100   sumg*=0.2;
101   printf("%f\t%f\t%f\t%f\t%f\n",s0,k1, sumg);
102   return sumg;
103 }
104
105
106
107