]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCExB.cxx
Removing obsolete function - WriteTracks (Marian)
[u/mrichter/AliRoot.git] / TPC / AliTPCExB.cxx
1 #include "AliTPCExB.h"
2 #include "TMath.h"
3 #include "TTreeStream.h"
4
5
6 //
7 // Abstract class for ExB effect parameterization
8 // 
9 //
10 // 
11 // The ExB correction map is stored in the calib DB
12 // The lookup can be dumped to the tree:
13 /*
14
15    //
16   char *storage = "local://OCDBres"
17   Int_t RunNumber=0;
18   AliCDBManager::Instance()->SetDefaultStorage(storage);
19   AliCDBManager::Instance()->SetRun(RunNumber) 
20   AliTPCExBFirst * exb = AliTPCcalibDB::Instance()->GetExB();
21   //
22   // See example macro $ALICE_ROOT/TPC/macros/AliTPCExBdraw.C 
23   //
24   .L $ALICE_ROOT/TPC/macros/AliTPCExBdraw.C 
25   Draw0(0)
26
27
28
29
30 */
31
32 AliTPCExB* AliTPCExB::fgInstance = 0;
33
34 ClassImp(AliTPCExB)
35
36
37 void AliTPCExB::TestExB(const char* fileName) {
38   //
39   // well, as the name sais...
40   //
41   TTreeSRedirector ts(fileName);
42   Double_t x[3];
43   for (x[0]=-250.;x[0]<=250.;x[0]+=10.)
44     for (x[1]=-250.;x[1]<=250.;x[1]+=10.)
45       for (x[2]=-250.;x[2]<=250.;x[2]+=10.) {
46         Double_t d[3];
47         Correct(x,d);
48         Double_t r=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]);
49         Double_t rd=TMath::Sqrt(d[0]*d[0]+d[1]*d[1]);
50         Double_t dr=r-rd;
51         Double_t phi=TMath::ATan2(x[0],x[1]);
52         Double_t phid=TMath::ATan2(d[0],d[1]);
53         Double_t dphi=phi-phid;
54         if (dphi<0.) dphi+=TMath::TwoPi();
55         if (dphi>TMath::Pi()) dphi=TMath::TwoPi()-dphi;
56         Double_t drphi=r*dphi;
57         Double_t dx=x[0]-d[0];
58         Double_t dy=x[1]-d[1];
59         Double_t dz=x[2]-d[2];
60         ts<<"positions"
61           <<"x0="<<x[0]
62           <<"x1="<<x[1]
63           <<"x2="<<x[2]
64           <<"dx="<<dx
65           <<"dy="<<dy
66           <<"dz="<<dz
67           <<"r="<<r
68           <<"phi="<<phi
69           <<"dr="<<dr
70           <<"drphi="<<drphi
71           <<"\n";
72       }
73 }
74
75
76
77 Double_t AliTPCExB::GetDr(Double_t r, Double_t phi, Double_t z){
78   //
79   // Static function
80   // Posibble to us it for visualization 
81   // 
82   //
83   if (!fgInstance) return 0;
84   Double_t pos0[3] = {r*TMath::Sin(phi), r*TMath::Cos(phi),z};
85   Double_t pos1[3];
86   fgInstance->Correct(pos0,pos1);
87   Double_t dx=pos1[0]-pos0[0];
88   Double_t dy=pos1[1]-pos0[1];
89   //  Double_t dz=pos1[2]-pos0[2];
90   return TMath::Sqrt(dx*dx+dy*dy);  
91 }
92
93
94 Double_t AliTPCExB::GetDrphi(Double_t r, Double_t phi, Double_t z){
95   //
96   //
97   //
98   if (!fgInstance) return 0;
99   Double_t pos0[3] = {r*TMath::Sin(phi), r*TMath::Cos(phi),z};
100   Double_t pos1[3];
101   fgInstance->Correct(pos0,pos1);
102   Double_t dphi=TMath::ATan2(pos1[1],pos1[0])-TMath::ATan2(pos0[1],pos0[0]);
103   return r*dphi;  
104
105 }
106
107
108 Double_t AliTPCExB::GetDphi(Double_t r, Double_t phi, Double_t z){
109   //
110   //
111   //
112   if (!fgInstance) return 0;
113   Double_t pos0[3] = {r*TMath::Sin(phi), r*TMath::Cos(phi),z};
114   Double_t pos1[3];
115   fgInstance->Correct(pos0,pos1);
116   Double_t dphi=TMath::ATan2(pos1[1],pos1[0])-TMath::ATan2(pos0[1],pos0[0]);
117   return dphi;  
118
119 }
120
121 Double_t AliTPCExB::GetDz(Double_t r, Double_t phi, Double_t z){
122   //
123   //
124   //
125   if (!fgInstance) return 0;
126   Double_t pos0[3] = {r*TMath::Sin(phi), r*TMath::Cos(phi),z};
127   Double_t pos1[3];
128   fgInstance->Correct(pos0,pos1);
129   Double_t dz=pos1[2]-pos0[2];
130   return dz;  
131 }