]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/CalibMacros/CalibExB.C
ea9131e9586653880c3addab0fe10920c9137610
[u/mrichter/AliRoot.git] / TPC / CalibMacros / CalibExB.C
1 void CalibExB(){
2   // 
3   // Macro to test ExB correction versus laser B filed scan data
4   //
5   // Before running it be sure the file laserScan.root exist
6   // 
7
8
9
10   //AliMagF* field = new AliMagWrapCheb("Maps","Maps", 2, 1., 10., AliMagWrapCheb::k5kG);
11   AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 2);
12   AliTracker::SetFieldMap(field,1);
13   AliTPCExBFirst *exbfirst = new  AliTPCExBFirst(field,2.64000000000000000e+04,50,50,50);
14   AliTPCExB::SetInstance(exbfirst);
15   //
16   // Create this file from scan - See AliTPCCalibLaser.C
17   //
18   TFile fscan("laserScan.root");
19   TTree * treeT = (TTree*)fscan.Get("Mean");
20   gSystem->Load("libSTAT.so");
21   TStatToolkit toolkit;
22   Double_t chi2;
23   TVectorD fitParam;
24   TMatrixD covMatrix;
25   Int_t npoints;
26   
27   TCut cutF0("abs(gphi1-(pphi0+pphi1*bz))<0.05");
28   TCut cutF1("abs(gphiP1-(pphiP0+pphiP1*bz))<0.0005");
29   TCut cutN("entries>2");
30   
31   TCut cutA = cutF0+cutF1+cutN;
32   
33   treeT->SetAlias("side","(-1+(LTr.fP[2]>0)*2)");       // side
34   treeT->SetAlias("dr","(abs(LTr.fP[1]/250.))");
35   treeT->SetAlias("sa","sin(atan2(lx1+0.0,lx0+0.0))");
36   treeT->SetAlias("ca","cos(atan2(lx1+0.0,lx0+0.0))");
37   treeT->SetAlias("ta","tan(asin(LTr.fP[2]+0.0))");
38
39   TString fstring="";
40   //
41   fstring+="((dr)^3-1)*bz++";           //1
42   fstring+="((dr)^3-1)*bz*ta++";        //2
43   fstring+="((dr)^3-1)*bz*sa++";        //3
44   fstring+="((dr)^3-1)*bz*sa*ta++";     //4
45   fstring+="((dr)^3-1)*bz*ca++";        //5
46   fstring+="((dr)^3-1)*bz*ca*ta++";     //6
47
48   fstring+="side*((dr)^3-1)*bz++";           //1
49   fstring+="side*((dr)^3-1)*bz*ta++";        //2
50   fstring+="side*((dr)^3-1)*bz*sa++";        //3
51   fstring+="side*((dr)^3-1)*bz*sa*ta++";     //4
52   fstring+="side*((dr)^3-1)*bz*ca++";        //5
53   fstring+="side*((dr)^3-1)*bz*ca*ta++";     //6
54
55   fstring+="side*((dr)^1-1)*bz++";           //7
56   fstring+="side*((dr)^1-1)*bz*ta++";        //8 
57   fstring+="side*((dr)^1-1)*bz*sa++";        //9
58   fstring+="side*((dr)^1-1)*bz*sa*ta++";     //10
59   fstring+="side*((dr)^1-1)*bz*ca++";        //11
60   fstring+="side*((dr)^1-1)*bz*ca*ta++";     //12
61
62
63
64
65   TString *strq0 = toolkit.FitPlane(treeT,"gphi1-pphi0",fstring->Data(), cutA, chi2,npoints,fitParam,covMatrix);
66   strq0->Tokenize("+")->Print();
67   treeT->SetAlias("fit",strq0->Data());
68   
69   
70   TString fstringeb="";
71   //
72   fstringeb+="AliTPCExB::GetDrphi(260,atan2(lx1,lx0),LTr.fP[1])++";       //1
73   fstringeb+="AliTPCExB::GetDr(260,atan2(lx1,lx0),LTr.fP[1])*ta++";       //1
74   // fstringeb+="bz*bz*AliTPCExB::GetDrphi(260,atan2(lx1,lx0),LTr.fP[1])++";              //1
75   //fstringeb+="bz*bz*AliTPCExB::GetDr(260,atan2(lx1,lx0),LTr.fP[1])*ta++";       //1
76   
77   //  fstringeb+="side*((dr)^1-1)*bz++";           //3
78   //  fstringeb+="side*((dr)^1-1)*bz*ta++";        //4 
79   //  fstringeb+="side*((dr)^1-1)*bz*sa++";        //7
80   //  fstringeb+="side*((dr)^1-1)*bz*sa*ta++";     //8   
81   //  fstringeb+="side*((dr)^1-1)*bz*ca++";        //11
82   //  fstringeb+="side*((dr)^1-1)*bz*ca*ta++";     //12
83   
84   
85   
86   TString *strExB = toolkit.FitPlane(treeT,"gphi1-pphi0",fstringeb->Data(), "abs(bz+0.4)<0.05"+cutA, chi2,npoints,fitParam,covMatrix);
87   strExB->Tokenize("+")->Print();
88   treeT->SetAlias("fitEB",strExB->Data());
89 }