]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCPointCorrection.cxx
Modification related to the new AliAnalysisTask
[u/mrichter/AliRoot.git] / TPC / AliTPCPointCorrection.cxx
CommitLineData
6c104224 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17
18 Unlinearities fitting:
19
20 Model for Outer field cage:
21 Unlinearities at the edge aproximated using two exponential decays.
22
23 dz = dz0(r,z) +dr(r,z)*tan(theta)
24 dy = +dr(r,z)*tan(phi)
25
26
27
28
29*/
30
31
32#include "TLinearFitter.h"
33#include "Riostream.h"
34#include "TList.h"
35#include "TMath.h"
36#include "TCanvas.h"
37#include "TFile.h"
38#include "TF1.h"
39#include "TVectorD.h"
40#include "AliLog.h"
41#include "AliTPCROC.h"
42#include "AliTPCPointCorrection.h"
43
44AliTPCPointCorrection* AliTPCPointCorrection::fgInstance = 0;
45
46ClassImp(AliTPCPointCorrection)
47
48AliTPCPointCorrection::AliTPCPointCorrection():
49 TNamed(),
50 fParamsOutR(38),
51 fParamsOutZ(38),
52 fParamOutRVersion(0),
53 fErrorsOutR(38),
54 fErrorsOutZ(38),
55 fParamOutZVersion(0)
56{
57 //
58 // Default constructor
59 //
60}
61
62AliTPCPointCorrection::AliTPCPointCorrection(const Text_t *name, const Text_t *title):
63 TNamed(name,title),
64 fParamsOutR(38),
65 fParamsOutZ(38),
66 fParamOutRVersion(0),
67 fErrorsOutR(38),
68 fErrorsOutZ(38),
69 fParamOutZVersion(0)
70{
71 //
72 // Non default constructor
73 //
74}
75
76AliTPCPointCorrection::~AliTPCPointCorrection(){
77 //
78 //
79 //
80}
81
82
83AliTPCPointCorrection* AliTPCPointCorrection::Instance()
84{
85 //
86 // Singleton implementation
87 // Returns an instance of this class, it is created if neccessary
88 //
89 if (fgInstance == 0){
90 fgInstance = new AliTPCPointCorrection();
91 }
92 return fgInstance;
93}
94
95
96
97Double_t AliTPCPointCorrection::GetDrOut(Bool_t isGlobal, Bool_t type, Double_t cx, Double_t cy, Double_t cz, Int_t sector){
98 //
99 // return radial correction
100 //
101 if (fParamOutRVersion==0) return CorrectionOutR0(isGlobal, type,cx,cy,cz,sector);
102 return 0;
103}
104
105Double_t AliTPCPointCorrection::SGetDrOut(Bool_t isGlobal, Bool_t type, Double_t cx, Double_t cy, Double_t cz, Int_t sector){
106 //
107 // return radial correction - static function
108 //
109 return fgInstance->GetDrOut(isGlobal, type,cx,cy,cz,sector);
110}
111
112
113
114
115Double_t AliTPCPointCorrection::GetDzOut(Bool_t isGlobal, Bool_t type, Double_t cx, Double_t cy, Double_t cz, Int_t sector){
116 //
117 //
118 //
119 if (fParamOutZVersion==0) return CorrectionOutZ0(isGlobal, type,cx,cy,cz,sector);
120 return 0;
121}
122
123
124Double_t AliTPCPointCorrection::SGetDzOut(Bool_t isGlobal, Bool_t type, Double_t cx, Double_t cy, Double_t cz, Int_t sector){
125 //
126 //
127 //
128 return fgInstance->GetDzOut(isGlobal, type,cx,cy,cz,sector);
129}
130
131
132
133
134Double_t AliTPCPointCorrection::CorrectionOutR0(Bool_t isGlobal, Bool_t type, Double_t cx, Double_t cy, Double_t cz, Int_t sector){
135 //
136 // return dR correction - for correction version 0
137 // Parameters:
138 // isGlobal - is the x in global frame
139 // type - kTRUE - use sectors - kFALSE - only Side param
140 // cx, cy,cz - cluster position
141 // sector - sector number
142 if (isGlobal){
143 // recalculate sector if in global frame
144 Double_t alpha = TMath::ATan2(cy,cx);
145 if (alpha<0) alpha+=TMath::Pi()*2;
146 sector = Int_t(18*alpha/(TMath::Pi()*2));
147 }
148
149 if (type==kFALSE) sector=36+(sector%36>=18); // side level parameters
150 // dout
151 Double_t radius = TMath::Sqrt(cx*cx+cy*cy);
152 AliTPCROC * roc = AliTPCROC::Instance();
153 Double_t xout = roc->GetPadRowRadiiUp(roc->GetNRows(37)-1);
154 Double_t dout = xout-radius;
155 //drift
156 Double_t dr = 0.5 - TMath::Abs(cz/250.);
157 //
158 //
159 TVectorD * vec = GetParamOutR(sector);
160 if (!vec) return 0;
161 Double_t eout10 = TMath::Exp(-dout/10.);
162 Double_t eout5 = TMath::Exp(-dout/5.);
163 Double_t eoutp = (eout10+eout5)*0.5;
164 Double_t eoutm = (eout10-eout5)*0.5;
165 //
166 Double_t result=0;
167 result+=(*vec)[1]*eoutp;
168 result+=(*vec)[2]*eoutm;
169 result+=(*vec)[3]*eoutp*dr;
170 result+=(*vec)[4]*eoutm*dr;
171 result+=(*vec)[5]*eoutp*dr*dr;
172 result+=(*vec)[6]*eoutm*dr*dr;
173 return result;
174
175}
176
177Double_t AliTPCPointCorrection::CorrectionOutZ0(Bool_t isGlobal, Bool_t type, Double_t cx, Double_t cy, Double_t cz, Int_t sector){
178 //
179 // return dR correction - for correction version 0
180 // Parameters:
181 // isGlobal - is the x in global frame
182 // type - kTRUE - use sectors - kFALSE - only Side param
183 // cx, cy,cz - cluster position
184 // sector - sector number
185 if (isGlobal){
186 // recalculate sector if in global frame
187 Double_t alpha = TMath::ATan2(cy,cx);
188 if (alpha<0) alpha+=TMath::Pi()*2;
189 sector = Int_t(18*alpha/(TMath::Pi()*2));
190 }
191
192 if (type==kFALSE) sector=36+(sector%36>=18); // side level parameters
193 // dout
194 Double_t radius = TMath::Sqrt(cx*cx+cy*cy);
195 AliTPCROC * roc = AliTPCROC::Instance();
196 Double_t xout = roc->GetPadRowRadiiUp(roc->GetNRows(37)-1);
197 Double_t dout = xout-radius;
198 //drift
199 Double_t dr = 0.5 - TMath::Abs(cz/250.);
200 //
201 //
202 TVectorD * vec = GetParamOutR(sector);
203 if (!vec) return 0;
204 Double_t eout10 = TMath::Exp(-dout/10.);
205 Double_t eout5 = TMath::Exp(-dout/5.);
206 Double_t eoutp = (eout10+eout5)*0.5;
207 Double_t eoutm = (eout10-eout5)*0.5;
208 //
209 Double_t result=0;
210 result+=(*vec)[1]*eoutp;
211 result+=(*vec)[2]*eoutm;
212 result+=(*vec)[3]*eoutp*dr;
213 result+=(*vec)[4]*eoutm*dr;
214 result+=(*vec)[5]*eoutp*dr*dr;
215 result+=(*vec)[6]*eoutm*dr*dr;
216 return result;
217
218}
219
220
221