1.) Updateing the registerCorrection.C macro to calculate the primitive transformations
[u/mrichter/AliRoot.git] / TPC / CalibMacros / RegisterCorrection.C
CommitLineData
a050b283 1/*
2 marian.ivanov@cern.ch
3 //
4 Register primitive corrections: base functions for minimization:
1cadb1b2 5 Id numbers are associated to given primitive corrections.
a050b283 6 See comments in the function headers.
7 Used only for residuals minimization not in the reconstruction.
1cadb1b2 8 File with all primitives expected to be in the current directory:
9 filenames:
10 TPCCorrectionPrimitives.root - Alignment, Quadrants, 2D symentrid and rod misalingment
11 TPCCorrectionPrimitivesROC.root - ExB distortion due to the common ROC misalignment
12 TPCCorrectionPrimitivesSector.root - ExB distortion due to the one sector misalingment (sector 0)
13 //
a050b283 14
15 RegisterCorrection(); - Reserved id's 0 -999
16 //
17 RegisterAliTPCFCVoltError3D(); - Reserved id's 0 -99
18 RegisterAliTPCBoundaryVoltError(); - Reserved id's 100-199
19 RegisterAliTPCCalibGlobalMisalignment(); - Reserved id's 200-499
20 RegisterAliTPCExBBShape(); - Reserved id's 500-600
21 RegisterAliTPCExBTwist(); - Reserved id's 600-700
eaad068f 22 RegisterAliTPCROCVoltError3D() - Reserved id's 700-800
23 RegisterAliTPCROCVoltError3DSector() - Reserved id's 800-900
a050b283 24 .x ~/rootlogon.C
25 .L $ALICE_ROOT/TPC/CalibMacros/RegisterCorrection.C+
26 RegisterCorrection();
27
28*/
29#if !defined(__CINT__) || defined(__MAKECINT__)
30#include "TFile.h"
31#include "TObjArray.h"
32#include "TTreeStream.h"
33#include "TMath.h"
34#include "TGraph.h"
35#include "TRandom.h"
36#include "TTree.h"
37#include "TF1.h"
38#include "TH2F.h"
39#include "TH3F.h"
40#include "TAxis.h"
41#include "TPad.h"
42#include "TCanvas.h"
43#include "TStyle.h"
44#include "AliTPCParamSR.h"
45#include "TDatabasePDG.h"
46#include "AliTPCCorrection.h"
47#include "AliTPCFCVoltError3D.h"
48#include "AliTPCROCVoltError3D.h"
49#include "AliTPCComposedCorrection.h"
50#include "AliTPCBoundaryVoltError.h"
51#include "AliTPCCalibGlobalMisalignment.h"
52#include "AliTPCExBBShape.h"
53#include "AliTPCExBTwist.h"
1cadb1b2 54#include "AliTPCCorrectionDrift.h"
a050b283 55#include "AliMagF.h"
56#include "AliCDBEntry.h"
57#include "AliTPCROC.h"
58#include <TStatToolkit.h>
59#include "TCut.h"
60#include "TGraphErrors.h"
61#include "AliTrackerBase.h"
62#include "TGeoGlobalMagField.h"
eaad068f 63#include "TROOT.h"
1cadb1b2 64#include "TLinearFitter.h"
a050b283 65#endif
66
67
68
69
70TFile *fCorrections=0; //file with corrections
71//
72//models E field distortion AliTPCFCVoltError3D
73//
74AliTPCFCVoltError3D *rotOFC =0; // fit models
75AliTPCFCVoltError3D *rodOFC1 =0;
76AliTPCFCVoltError3D *rodOFC2 =0;
77AliTPCFCVoltError3D *rotIFC =0;
78AliTPCFCVoltError3D *rodIFC1 =0;
79AliTPCFCVoltError3D *rodIFC2 =0;
80AliTPCFCVoltError3D *rodIFCShift=0; //common IFC shift
81AliTPCFCVoltError3D *rodOFCShift=0; //common OFC shift
82AliTPCFCVoltError3D *rodIFCSin=0; //common IFC shift -sinus
83AliTPCFCVoltError3D *rodOFCSin=0; //common OFC shift -sinus
84AliTPCFCVoltError3D *rodIFCCos=0; //common IFC shift -cos
85AliTPCFCVoltError3D *rodOFCCos=0; //common OFC shift -cos
eaad068f 86
87AliTPCROCVoltError3D *rocRotgXA=0; // roc rotation A side - inclination in X
88AliTPCROCVoltError3D *rocRotgYA=0; // roc rotation A side - inclination in Y
89AliTPCROCVoltError3D *rocRotgXC=0; // roc rotation C side - inclination in X
90AliTPCROCVoltError3D *rocRotgYC=0; // roc rotation C side - inclination in Y
1cadb1b2 91//
eaad068f 92AliTPCROCVoltError3D *rocDzIROCA=0; // roc shift A side - in Z
93AliTPCROCVoltError3D *rocDzIROCC=0; // roc shift C side - in Z
94AliTPCROCVoltError3D *rocRotIROCA=0; // roc rotation A side - in Z
95AliTPCROCVoltError3D *rocRotIROCC=0; // roc rotation C side - in Z
1cadb1b2 96AliTPCROCVoltError3D *rocDzUDA=0; // roc shift Up-Down A side
97AliTPCROCVoltError3D *rocDzUDC=0; // roc shift Up-Down C side
98AliTPCROCVoltError3D *rocRotUDA=0; // roc rotation updown A side
99AliTPCROCVoltError3D *rocRotUDC=0; // roc rotation updown C side
100
eaad068f 101//
102AliTPCROCVoltError3D *rocShiftIROCA0=0; // IROC shift A0 side
103AliTPCROCVoltError3D *rocRotIROCA0=0; // IROC rot A0 side
104AliTPCROCVoltError3D *rocShiftOROCA0=0; // OROC shift A0 side
105AliTPCROCVoltError3D *rocRotOROCA0=0; // OROC rot A0 side
106AliTPCROCVoltError3D *rocShiftIROCC0=0; // IROC shift C0 side
107AliTPCROCVoltError3D *rocRotIROCC0=0; // IROC rot C0 side
108AliTPCROCVoltError3D *rocShiftOROCC0=0; // OROC shift C0 side
109AliTPCROCVoltError3D *rocRotOROCC0=0; // OROC rot C0 side
110//
111//
112//
a050b283 113AliTPCBoundaryVoltError *boundaryVoltErrorA[8]; // boundary voltage error A side
114AliTPCBoundaryVoltError *boundaryVoltErrorC[8]; // boundary voltage error C side
eaad068f 115AliTPCExBBShape *exbShape = 0; // nominal correctin
116AliTPCExBBShape *exbShapeT1X = 0; // nominal +deltaT1=0.1
117AliTPCExBBShape *exbShapeT2X = 0; // nominal +deltaT2=0.1
a050b283 118AliTPCExBTwist *twistX = 0;
119AliTPCExBTwist *twistY = 0;
120//
121AliTPCCalibGlobalMisalignment *alignRot0=0;
122AliTPCCalibGlobalMisalignment *alignRot1=0;
123AliTPCCalibGlobalMisalignment *alignRot2=0;
124AliTPCCalibGlobalMisalignment *alignTrans0=0;
125AliTPCCalibGlobalMisalignment *alignTrans1=0;
126AliTPCCalibGlobalMisalignment *alignTrans2=0;
1cadb1b2 127//
128AliTPCCalibGlobalMisalignment *alignTrans0D[4]={0}; // delta alignemnt 4 quadrants
129AliTPCCalibGlobalMisalignment *alignTrans1D[4]={0}; //
130AliTPCCalibGlobalMisalignment *alignTrans2D[4]={0}; //
131AliTPCCalibGlobalMisalignment *alignRot0D[4]={0};
132AliTPCCalibGlobalMisalignment *alignRot1D[4]={0};
133AliTPCCalibGlobalMisalignment *alignRot2D[4]={0};
134
135
a050b283 136
137
1cadb1b2 138AliTPCCorrectionDrift *calibDrift[7]={0};
139
a050b283 140
141//
142void RegisterAliTPCFCVoltError3D();
143void RegisterAliTPCCalibGlobalMisalignment();
144void RegisterAliTPCBoundaryVoltError();
145void RegisterAliTPCExBShape();
146void RegisterAliTPCExBTwist();
eaad068f 147void RegisterAliTPCROCVoltError3D();
148void RegisterAliTPCROCVoltError3DSector();
1cadb1b2 149void RegisterAliTPCCorrectionDrift();
150
eaad068f 151//
a050b283 152
eaad068f 153void RegisterCorrection(Int_t type=0){
a050b283 154 //
155 //
156 //
157 // check the presence of corrections in file
158 //
1cadb1b2 159 //gROOT->Macro("ConfigCalibTrain.C(119037)");
eaad068f 160 //
161 //
162 if (type==1) return RegisterAliTPCROCVoltError3D();
163 if (type==2) return RegisterAliTPCROCVoltError3DSector();
a050b283 164 fCorrections = new TFile("TPCCorrectionPrimitives.root");
eaad068f 165 AliTPCComposedCorrection *corrField3D = (AliTPCComposedCorrection*) fCorrections->Get("TPCFCVoltError3D");
a050b283 166 // if not make new file
167 if (!corrField3D) fCorrections = new TFile("TPCCorrectionPrimitives.root","update");
eaad068f 168 if (type==0) {
169 RegisterAliTPCROCVoltError3D();
170 RegisterAliTPCROCVoltError3DSector();
171 }
a050b283 172 RegisterAliTPCCalibGlobalMisalignment();
173 RegisterAliTPCBoundaryVoltError();
174 RegisterAliTPCFCVoltError3D();
175 RegisterAliTPCExBShape();
176 RegisterAliTPCExBTwist();
1cadb1b2 177 RegisterAliTPCCorrectionDrift();
a050b283 178 if (fCorrections) fCorrections->Close();
179 //
180}
181
182
183
184void RegisterAliTPCFCVoltError3D(){
185 //
186 // Load the models from the file
187 // Or create it
188 // Register functions with following IDs:
189 // IMPORTANT: The nominal shift is in mm
190 //
191 // rotOFC - 0
192 // rodOFC1 - 1
193 // rodOFC2 - 2
194 // rotIFC - 3
195 // rodIFC1 - 4
196 // rodIFC2 - 5
197 // rodIFCShift - 6
198 // rodIFCSin - 7
199 // rodIFCCos - 8
200 // rodOFCShift - 9
201 // rodOFCSin - 10
202 // rodOFCCos - 11
203 //
204 printf("RegisterAliTPCFCVoltError3D()");
205 Int_t volt = 40; // 40 V ~ 1mm
206 AliTPCComposedCorrection *corrField3D = (AliTPCComposedCorrection*) fCorrections->Get("TPCFCVoltError3D");
207 if (corrField3D) { // load form file
208 corrField3D->Print();
209 TCollection *iter = corrField3D->GetCorrections();
210 rotOFC = (AliTPCFCVoltError3D*)iter->FindObject("rotOFC");
211 rodOFC1 = (AliTPCFCVoltError3D*)iter->FindObject("rodOFC1");
212 rodOFC2 = (AliTPCFCVoltError3D*)iter->FindObject("rodOFC2");
213 rotIFC = (AliTPCFCVoltError3D*)iter->FindObject("rotIFC");
214 rodIFC1 = (AliTPCFCVoltError3D*)iter->FindObject("rodIFC1");
215 rodIFC2 = (AliTPCFCVoltError3D*)iter->FindObject("rodIFC2");
216 //
217 rodIFCShift = (AliTPCFCVoltError3D*)iter->FindObject("rodIFCShift");
218 rodOFCShift = (AliTPCFCVoltError3D*)iter->FindObject("rodOFCShift");
219 rodIFCSin = (AliTPCFCVoltError3D*)iter->FindObject("rodIFCSin");
220 rodOFCSin = (AliTPCFCVoltError3D*)iter->FindObject("rodOFCSin");
221 rodIFCCos = (AliTPCFCVoltError3D*)iter->FindObject("rodIFCCos");
222 rodOFCCos = (AliTPCFCVoltError3D*)iter->FindObject("rodOFCCos");
223 } else {
224 // OFC
225 rotOFC = new AliTPCFCVoltError3D();
226 rotOFC->SetOmegaTauT1T2(0,1,1);
227 rotOFC->SetRotatedClipVoltA(1,volt);
228 rotOFC->SetRotatedClipVoltC(1,volt);
229 //
230 rodOFC1 = new AliTPCFCVoltError3D();
231 rodOFC1->SetOmegaTauT1T2(0,1,1);
232 rodOFC1->SetRodVoltShiftA(18,volt);
233 rodOFC1->SetRodVoltShiftC(18,volt);
234 //
235 rodOFC2 = new AliTPCFCVoltError3D();
236 rodOFC2->SetOmegaTauT1T2(0,1,1);
237 rodOFC2->SetCopperRodShiftA(18,volt);
238 rodOFC2->SetCopperRodShiftC(18,volt);
239 // IFC
240 rotIFC = new AliTPCFCVoltError3D();
241 rotIFC->SetOmegaTauT1T2(0,1,1);
242 rotIFC->SetRotatedClipVoltA(0,volt);
243 rotIFC->SetRotatedClipVoltC(0,volt);
244 //
245 rodIFC1 = new AliTPCFCVoltError3D();
246 rodIFC1->SetOmegaTauT1T2(0,1,1);
247 rodIFC1->SetRodVoltShiftA(0,volt);
248 rodIFC1->SetRodVoltShiftC(0,volt);
249 //
250 rodIFC2 = new AliTPCFCVoltError3D();
251 rodIFC2->SetOmegaTauT1T2(0,1,1);
252 rodIFC2->SetCopperRodShiftA(0,volt);
253 rodIFC2->SetCopperRodShiftC(0,volt);
254 //
255 rodIFCShift = new AliTPCFCVoltError3D();
256 rodIFCSin = new AliTPCFCVoltError3D();
257 rodIFCCos = new AliTPCFCVoltError3D();
258 rodOFCShift = new AliTPCFCVoltError3D();
259 rodOFCSin = new AliTPCFCVoltError3D();
260 rodOFCCos = new AliTPCFCVoltError3D();
261 for (Int_t isec=0; isec<18; isec++){
262 Double_t phi=TMath::Pi()*isec/9.;
263 rodIFCShift->SetOmegaTauT1T2(0,1,1);
264 rodIFCShift->SetRodVoltShiftA(isec,volt);
265 rodIFCShift->SetRodVoltShiftC(isec,volt);
266 rodIFCSin->SetOmegaTauT1T2(0,1,1);
267 rodIFCSin->SetRodVoltShiftA(isec,volt*TMath::Sin(phi));
268 rodIFCSin->SetRodVoltShiftC(isec,volt*TMath::Sin(phi));
269 rodIFCCos->SetOmegaTauT1T2(0,1,1);
270 rodIFCCos->SetRodVoltShiftA(isec,volt*TMath::Cos(phi));
271 rodIFCCos->SetRodVoltShiftC(isec,volt*TMath::Cos(phi));
272 //
273 rodOFCShift->SetOmegaTauT1T2(0,1,1);
274 rodOFCShift->SetRodVoltShiftA(18+isec,volt);
275 rodOFCShift->SetRodVoltShiftC(18+isec,volt);
276 rodOFCSin->SetOmegaTauT1T2(0,1,1);
277 rodOFCSin->SetRodVoltShiftA(18+isec,volt*TMath::Sin(phi));
278 rodOFCSin->SetRodVoltShiftC(18+isec,volt*TMath::Sin(phi));
279 rodOFCCos->SetOmegaTauT1T2(0,1,1);
280 rodOFCCos->SetRodVoltShiftA(18+isec,volt*TMath::Cos(phi));
281 rodOFCCos->SetRodVoltShiftC(18+isec,volt*TMath::Cos(phi));
282 }
283 //
284 //
285 // Initialization of the lookup tables
286 //
287 printf(" ------- OFC rotated clip:\n"); rotOFC->InitFCVoltError3D();
288 printf(" ------- OFC rod & strip:\n"); rodOFC1->InitFCVoltError3D();
289 printf(" ------- OFC copper rod:\n"); rodOFC2->InitFCVoltError3D();
290 printf(" ------- IFC rotated clip:\n"); rotIFC->InitFCVoltError3D();
291 printf(" ------- IFC rod & strip:\n"); rodIFC1->InitFCVoltError3D();
292 printf(" ------- IFC copper rod:\n"); rodIFC2->InitFCVoltError3D();
293
294 printf(" ------- IFC rod & strip shift:\n"); rodIFCShift->InitFCVoltError3D();
295 printf(" ------- IFC rod & strip sin:\n"); rodIFCSin->InitFCVoltError3D();
296 printf(" ------- IFC rod & strip cos:\n"); rodIFCCos->InitFCVoltError3D();
297 printf(" ------- OFC rod & strip shift:\n"); rodOFCShift->InitFCVoltError3D();
298 printf(" ------- OFC rod & strip sin:\n"); rodOFCSin->InitFCVoltError3D();
299 printf(" ------- OFC rod & strip cos:\n"); rodOFCCos->InitFCVoltError3D();
300
301 // give names
302 rotOFC->SetName("rotOFC");rotOFC->SetTitle("rotOFC");
303 rodOFC1->SetName("rodOFC1");rodOFC1->SetTitle("rodOFC1");
304 rodOFC2->SetName("rodOFC2");rodOFC2->SetTitle("rodOFC2");
305 rotIFC->SetName("rotIFC");rotIFC->SetTitle("rotIFC");
306 rodIFC1->SetName("rodIFC1");rodIFC1->SetTitle("rodIFC1");
307 rodIFC2->SetName("rodIFC2");rodIFC2->SetTitle("rodIFC2");
308 //
309 rodIFCShift->SetName("rodIFCShift");rodIFCShift->SetTitle("rodIFCShift");
310 rodIFCSin->SetName("rodIFCSin");rodIFCSin->SetTitle("rodIFCSin");
311 rodIFCCos->SetName("rodIFCCos");rodIFCCos->SetTitle("rodIFCCos");
312 //
313 rodOFCShift->SetName("rodOFCShift");rodOFCShift->SetTitle("rodOFCShift");
314 rodOFCSin->SetName("rodOFCSin");rodOFCSin->SetTitle("rodOFCSin");
315 rodOFCCos->SetName("rodOFCCos");rodOFCCos->SetTitle("rodOFCCos");
316 //
317 // save in file
318 corrField3D = new AliTPCComposedCorrection();
319 TObjArray *cs = new TObjArray();
320 cs->Add(rotIFC); cs->Add(rotOFC);
321 cs->Add(rodIFC1); cs->Add(rodOFC1);
322 cs->Add(rodIFC2); cs->Add(rodOFC2);
323 cs->Add(rodIFCShift); cs->Add(rodIFCSin); cs->Add(rodIFCCos);
324 cs->Add(rodOFCShift); cs->Add(rodOFCSin); cs->Add(rodOFCCos);
325 //
326 corrField3D->SetCorrections(cs);
327 corrField3D->SetOmegaTauT1T2(0,1.,1.);
328 corrField3D->Print();
329 fCorrections->cd();
330 corrField3D->Write("TPCFCVoltError3D");
331 }
332 //
333 AliTPCCorrection::AddVisualCorrection(rotOFC,0);
334 AliTPCCorrection::AddVisualCorrection(rodOFC1,1);
335 AliTPCCorrection::AddVisualCorrection(rodOFC2,2);
336 AliTPCCorrection::AddVisualCorrection(rotIFC,3);
337 AliTPCCorrection::AddVisualCorrection(rodIFC1,4);
338 AliTPCCorrection::AddVisualCorrection(rodIFC2,5);
339 // common corrections
340 //
341 AliTPCCorrection::AddVisualCorrection(rodIFCShift,6);
342 AliTPCCorrection::AddVisualCorrection(rodIFCSin,7);
343 AliTPCCorrection::AddVisualCorrection(rodIFCCos,8);
344 //
345 AliTPCCorrection::AddVisualCorrection(rodIFCShift,9);
346 AliTPCCorrection::AddVisualCorrection(rodIFCSin,10);
347 AliTPCCorrection::AddVisualCorrection(rodIFCCos,11);
348}
349
350
351void RegisterAliTPCCalibGlobalMisalignment(){
352 //
353 // Register primitive alignment components.
354 // Linear conbination of primitev forulas used for fit
355 // The nominal delta 1 mm in shift and 1 mrad in rotation
356 // Primitive formulas registeren in AliTPCCoreection::AddvisualCorrection
357 // 20 - deltaX
358 // 21 - deltaY
359 // 22 - deltaZ
360 // 23 - rot0 (phi)
361 // 24 - rot1 (theta)
362 // 25 - rot2
363 //
364 printf("RegisterAliTPCCalibGlobalMisalignment()\n");
365 TGeoHMatrix matrixX;
366 TGeoHMatrix matrixY;
367 TGeoHMatrix matrixZ;
368 TGeoRotation rot0;
369 TGeoRotation rot1;
370 TGeoRotation rot2; //transformation matrices
371 TGeoRotation rot90; //transformation matrices
372 matrixX.SetDx(0.1); matrixY.SetDy(0.1); matrixZ.SetDz(0.1); //1 mm translation
373 rot0.SetAngles(0.001*TMath::RadToDeg(),0,0);
374 rot1.SetAngles(0,0.001*TMath::RadToDeg(),0);
375 rot2.SetAngles(0,0,0.001*TMath::RadToDeg());
376 //how to get rot02 ?
377 rot90.SetAngles(0,90,0);
378 rot2.MultiplyBy(&rot90,kTRUE);
379 rot90.SetAngles(0,-90,0);
380 rot2.MultiplyBy(&rot90,kFALSE);
1cadb1b2 381 //
a050b283 382 alignRot0 =new AliTPCCalibGlobalMisalignment;
383 alignRot0->SetAlignGlobal(&rot0);
384 alignRot0->SetName("alignRot0");
385 alignRot1=new AliTPCCalibGlobalMisalignment;
386 alignRot1->SetAlignGlobal(&rot1);
387 alignRot1->SetName("alignRot1");
388 alignRot2=new AliTPCCalibGlobalMisalignment;
389 alignRot2->SetAlignGlobal(&rot2);
390 alignRot2->SetName("alignRot2");
391 //
392 alignTrans0 =new AliTPCCalibGlobalMisalignment;
393 alignTrans0->SetAlignGlobal(&matrixX);
394 alignTrans0->SetName("alignTrans0");
395 alignTrans1=new AliTPCCalibGlobalMisalignment;
396 alignTrans1->SetAlignGlobal(&matrixY);
397 alignTrans1->SetName("alignTrans1");
398 alignTrans2=new AliTPCCalibGlobalMisalignment;
399 alignTrans2->SetAlignGlobal(&matrixZ);
400 alignTrans2->SetName("alignTrans2");
401 //
1cadb1b2 402
403
404 alignRot0D[0] =new AliTPCCalibGlobalMisalignment;
405 alignRot0D[0]->SetAlignGlobalDelta(&rot0);
406 alignRot0D[0]->SetName("alignRot0D");
407 alignRot1D[0]=new AliTPCCalibGlobalMisalignment;
408 alignRot1D[0]->SetAlignGlobalDelta(&rot1);
409 alignRot1D[0]->SetName("alignRot1D");
410 alignRot2D[0]=new AliTPCCalibGlobalMisalignment;
411 alignRot2D[0]->SetAlignGlobalDelta(&rot2);
412 alignRot2D[0]->SetName("alignRot2D");
413 //
414 alignTrans0D[0] =new AliTPCCalibGlobalMisalignment;
415 alignTrans0D[0]->SetAlignGlobalDelta(&matrixX);
416 alignTrans0D[0]->SetName("alignTrans0D");
417 alignTrans1D[0]=new AliTPCCalibGlobalMisalignment;
418 alignTrans1D[0]->SetAlignGlobalDelta(&matrixY);
419 alignTrans1D[0]->SetName("alignTrans1D");
420 alignTrans2D[0]=new AliTPCCalibGlobalMisalignment;
421 alignTrans2D[0]->SetAlignGlobalDelta(&matrixZ);
422 alignTrans2D[0]->SetName("alignTrans2D");
423
424 TObjArray * arrayDX = new TObjArray(72);
425 TObjArray * arrayDY = new TObjArray(72);
426 TObjArray * arrayDPhi = new TObjArray(72);
427 //
428 // Up down A side
429 //
430 for (Int_t isec=0; isec<72; isec++){ //A side
431 TGeoHMatrix *matrixDX = new TGeoHMatrix;
432 TGeoHMatrix *matrixDY = new TGeoHMatrix;
433 TGeoRotation *matrixDPhi= new TGeoRotation;
434 arrayDX->AddAt(matrixDX,isec);
435 arrayDY->AddAt(matrixDY,isec);
436 arrayDPhi->AddAt(matrixDPhi,isec);
437 if (isec%36<18) matrixDX->SetDx(isec%18<9?0.1:-0.1);
438 if (isec%36<18) matrixDY->SetDy(isec%18<9?0.1:-0.1);
439 if (isec%36<18) matrixDPhi->SetAngles((isec%18<9?0.001:-0.001)*TMath::RadToDeg(),0,0);
440 }
441 alignTrans0D[1] =new AliTPCCalibGlobalMisalignment;
442 alignTrans0D[1]->SetName("alignTrans0UDA");
443 alignTrans0D[1]->SetAlignSectors((TObjArray *)(arrayDX->Clone()));
444 alignTrans1D[1] =new AliTPCCalibGlobalMisalignment;
445 alignTrans1D[1]->SetName("alignTrans1UDA");
446 alignTrans1D[1]->SetAlignSectors((TObjArray *)(arrayDY->Clone()));
447 alignRot0D[1] =new AliTPCCalibGlobalMisalignment;
448 alignRot0D[1]->SetName("alignRot0UDA");
449 alignRot0D[1]->SetAlignSectors((TObjArray *)(arrayDPhi->Clone()));
450 //
451 // Uu-down C side
452 //
453 for (Int_t isec=0; isec<72; isec++){ //A side
454 TGeoHMatrix *matrixDX = new TGeoHMatrix;
455 TGeoHMatrix *matrixDY = new TGeoHMatrix;
456 TGeoRotation *matrixDPhi= new TGeoRotation;
457 arrayDX->AddAt(matrixDX,isec);
458 arrayDY->AddAt(matrixDY,isec);
459 arrayDPhi->AddAt(matrixDPhi,isec);
460 if (isec%36>=18) matrixDX->SetDx(isec%18<9?0.1:-0.1);
461 if (isec%36>=18) matrixDY->SetDy(isec%18<9?0.1:-0.1);
462 if (isec%36>=18) matrixDPhi->SetAngles((isec%18<9?0.001:-0.001)*TMath::RadToDeg(),0,0);
463 }
464 alignTrans0D[2] =new AliTPCCalibGlobalMisalignment;
465 alignTrans0D[2]->SetName("alignTrans0UDC");
466 alignTrans0D[2]->SetAlignSectors((TObjArray *)(arrayDX->Clone()));
467 alignTrans1D[2] =new AliTPCCalibGlobalMisalignment;
468 alignTrans1D[2]->SetName("alignTrans1UDC");
469 alignTrans1D[2]->SetAlignSectors((TObjArray *)(arrayDY->Clone()));
470 alignRot0D[2] =new AliTPCCalibGlobalMisalignment;
471 alignRot0D[2]->SetName("alignRot0UDC");
472 alignRot0D[2]->SetAlignSectors((TObjArray *)(arrayDPhi->Clone()));
473 //
474
475
476 //
a050b283 477 AliTPCCorrection::AddVisualCorrection(alignTrans0 ,200);
478 AliTPCCorrection::AddVisualCorrection(alignTrans1 ,201);
479 AliTPCCorrection::AddVisualCorrection(alignTrans2 ,202);
480 AliTPCCorrection::AddVisualCorrection(alignRot0 ,203);
481 AliTPCCorrection::AddVisualCorrection(alignRot1 ,204);
482 AliTPCCorrection::AddVisualCorrection(alignRot2 ,205);
1cadb1b2 483
a050b283 484}
485
486
487void RegisterAliTPCBoundaryVoltError(){
488 //
489 // Register phi symetric E filed distortions
eaad068f 490 // 100-108 - A side 0 Field
491 // 110-118 - C side 0 Field
492 // 120-128 - A side +0.5 Field
493 // 130-138 - C side +0.5 Field
494 // 140-148 - A side -0.5 Field
495 // 150-158 - C side -0.5 Field
a050b283 496 //
eaad068f 497 Double_t vdrift = 2.64; // [cm/us] // to be updated: per second (ideally)
498 Double_t ezField = 400; // [V/cm] // to be updated: never (hopefully)
499 Double_t T1 = 1.0;
500 Double_t T2 = 1.0;
501 Double_t wtP = -10.0 * (0.5*10) * vdrift / ezField ;
502 Double_t wtM = -10.0 * (0.5*10) * vdrift / -ezField ;
503
a050b283 504 printf("RegisterAliTPCBoundaryVoltError()\n");
505 AliTPCComposedCorrection *corrField2D = (AliTPCComposedCorrection*) fCorrections->Get("TPCFCVoltError2D");
506 //
507 if (!corrField2D){
508 TObjArray *array=new TObjArray(16);
509 Double_t val = 40.; // 1mm
510 Float_t bound0[8] = { 0, 0,0,0,0,0,0,0};
511 Float_t boundAi[8] = { 0, 0,0,0,0,0,0,0};
512 Float_t boundCi[8] = { 0, 0,0,0,0,0,0,0};
513 for (Int_t ipar=0; ipar<8; ipar++){
514 //
515 boundaryVoltErrorA[ipar] = new AliTPCBoundaryVoltError;
516 boundaryVoltErrorC[ipar] = new AliTPCBoundaryVoltError;
517 boundaryVoltErrorA[ipar]->SetName(Form("BoundaryVoltErrorAsidePar%d",ipar));
518 boundaryVoltErrorA[ipar]->SetTitle(Form("BoundaryVoltErrorAsidePar%d",ipar));
519 boundaryVoltErrorC[ipar]->SetName(Form("BoundaryVoltErrorCsidePar%d",ipar));
520 boundaryVoltErrorC[ipar]->SetTitle(Form("BoundaryVoltErrorCsidePar%d",ipar));
521 for (Int_t jpar=0; jpar<8; jpar++) if (ipar!=jpar){
522 boundAi[jpar]=0;
523 boundCi[jpar]=0;
524 }
525 boundAi[ipar]=val;
526 boundCi[ipar]=val;
527 //
528 boundaryVoltErrorA[ipar]->SetBoundariesA(boundAi);
529 boundaryVoltErrorA[ipar]->SetBoundariesC(bound0);
530 boundaryVoltErrorA[ipar]->InitBoundaryVoltErrorDistortion();
531 boundaryVoltErrorA[ipar]->SetOmegaTauT1T2(0.,1,1);
532 //
533 Float_t tempboundAi[8] = { 0, 0,0,0,0,0,-boundCi[6],-boundCi[7]};
534 boundaryVoltErrorC[ipar]->SetBoundariesA(tempboundAi);
535 boundaryVoltErrorC[ipar]->SetBoundariesC(boundCi);
536
537 boundaryVoltErrorC[ipar]->InitBoundaryVoltErrorDistortion();
538 boundaryVoltErrorC[ipar]->SetOmegaTauT1T2(0.,1,1);
539 array->AddAt(boundaryVoltErrorA[ipar],ipar);
540 array->AddAt(boundaryVoltErrorC[ipar],ipar+8);
541 boundaryVoltErrorA[ipar]->Print();
542 boundaryVoltErrorC[ipar]->Print();
543 AliTPCCorrection::AddVisualCorrection(boundaryVoltErrorA[ipar], 100+ipar);
544 AliTPCCorrection::AddVisualCorrection(boundaryVoltErrorC[ipar], 150+ipar);
545 }
546 corrField2D = new AliTPCComposedCorrection;
547 corrField2D->SetCorrections(array);
548 corrField2D->SetOmegaTauT1T2(0,1.,1.);
549 corrField2D->Print();
550 fCorrections->cd();
551 corrField2D->SetName("TPCFCVoltError2D");
552 corrField2D->SetTitle("TPCFCVoltError2D");
553 corrField2D->Write("TPCFCVoltError2D");
554 }else{
555 TObjArray *array = (TObjArray*)corrField2D->GetCorrections();
556 for (Int_t ipar=0; ipar<8; ipar++){
557 boundaryVoltErrorA[ipar] = (AliTPCBoundaryVoltError*) array->At(ipar);
558 boundaryVoltErrorC[ipar] = (AliTPCBoundaryVoltError*) array->At(ipar+8);
a050b283 559 }
560 }
eaad068f 561 //
562 // Register correction
563 for (Int_t ipar=0; ipar<8; ipar++){
564 AliTPCCorrection::AddVisualCorrection(boundaryVoltErrorA[ipar], 100+ipar);
565 AliTPCCorrection::AddVisualCorrection(boundaryVoltErrorC[ipar], 110+ipar);
566 //
567 // correction for +-0.5 T setting
568 AliTPCCorrection *corrField =0;
569 corrField=(AliTPCCorrection *)boundaryVoltErrorA[ipar]->Clone();
570 corrField->SetOmegaTauT1T2(wtP,T1,T2);
571 AliTPCCorrection::AddVisualCorrection(corrField,120+ipar);
572
573 corrField=(AliTPCCorrection *)boundaryVoltErrorC[ipar]->Clone();
574 corrField->SetOmegaTauT1T2(wtP,T1,T2);
575 AliTPCCorrection::AddVisualCorrection(corrField,130+ipar);
1cadb1b2 576 // correction for +-0.5 T setting
eaad068f 577 corrField=(AliTPCCorrection *)boundaryVoltErrorA[ipar]->Clone();
578 corrField->SetOmegaTauT1T2(wtM,T1,T2);
579 AliTPCCorrection::AddVisualCorrection(corrField,140+ipar);
580
581 corrField=(AliTPCCorrection *)boundaryVoltErrorC[ipar]->Clone();
582 corrField->SetOmegaTauT1T2(wtM,T1,T2);
583 AliTPCCorrection::AddVisualCorrection(corrField,150+ipar);
584 }
585
a050b283 586}
587
588
589
590void RegisterAliTPCExBShape(){
591 //
592 //
593 //
594 AliMagF *magF = new AliMagF("mag","mag");
595
596 exbShape = new AliTPCExBBShape;
597 exbShape->SetBField(magF);
598 exbShape->SetName("TPCExBShape");
599 exbShape->SetTitle("TPCExBShape");
600 exbShape->SetOmegaTauT1T2(0,1.,1.);
601 exbShape->Print();
602 AliTPCCorrection::AddVisualCorrection(exbShape,500);
eaad068f 603 exbShapeT1X = new AliTPCExBBShape;
604 exbShapeT1X->SetBField(magF);
605 exbShapeT1X->SetName("TPCExbShapeT1X");
606 exbShapeT1X->SetTitle("TPCExbShapeT1X");
607 exbShapeT1X->SetOmegaTauT1T2(0,1.2,1.);
608 exbShapeT1X->Print();
609 AliTPCCorrection::AddVisualCorrection(exbShapeT1X,501);
610 exbShapeT2X = new AliTPCExBBShape;
611 exbShapeT2X->SetBField(magF);
612 exbShapeT2X->SetName("TPCExbShapeT2X");
613 exbShapeT2X->SetTitle("TPCExbShapeT2X");
614 exbShapeT2X->SetOmegaTauT1T2(0,1.0,1.2);
615 exbShapeT2X->Print();
616 AliTPCCorrection::AddVisualCorrection(exbShapeT2X,502);
a050b283 617}
618
619
620void RegisterAliTPCExBTwist(){
621 //
622 //
623 //
624 twistX = new AliTPCExBTwist;
625 twistY = new AliTPCExBTwist;
626 twistX->SetXTwist(0.001); // 1 mrad twist in x
627 twistX->SetName("ExBTwistX");
628 twistX->SetTitle("ExBTwistX");
629 twistY->SetYTwist(0.001); // 1 mrad twist in y
630 twistY->SetName("ExBTwistY");
631 twistY->SetTitle("ExBTwistY");
632 twistX->SetOmegaTauT1T2(0,1.,1.);
633 twistY->SetOmegaTauT1T2(0,1.,1.);
634 AliTPCCorrection::AddVisualCorrection(twistX,600);
635 AliTPCCorrection::AddVisualCorrection(twistY,601);
636}
637
1cadb1b2 638void RegisterAliTPCCorrectionDrift(){
639 //
640 // Drift distortion/correction
641 //
642 for (Int_t idrift=0; idrift<7; idrift++) {
643 calibDrift[idrift]=new AliTPCCorrectionDrift;
644 }
645 calibDrift[0]->SetName("driftT0");
646 calibDrift[0]->SetTitle("driftT0");
647 calibDrift[0]->fZ0Aside=0.1;
648 calibDrift[0]->fZ0Cside=0.1;
649 calibDrift[1]->SetName("driftScale0");
650 calibDrift[1]->SetTitle("driftScale0");
651 calibDrift[1]->fVScale0=0.001;
652 calibDrift[2]->SetName("driftScaleR");
653 calibDrift[2]->SetTitle("driftScaleR");
654 calibDrift[2]->fVScaleR=0.001;
655 calibDrift[3]->SetName("driftScaleX");
656 calibDrift[3]->SetTitle("driftScaleX");
657 calibDrift[3]->fVScaleX=0.001;
658 calibDrift[4]->SetName("driftScaleY");
659 calibDrift[4]->SetTitle("driftScaleY");
660 calibDrift[4]->fVScaleY=0.001;
661 //
662 calibDrift[5]->SetName("driftIROCDZ");
663 calibDrift[5]->SetTitle("driftIROCDZ");
664 calibDrift[5]->fIROCZ0=0.1; //delta Z for IROCORC
665 //
666 calibDrift[6]->SetName("driftOROCDT");
667 calibDrift[6]->SetTitle("driftOROCDT");
668 calibDrift[6]->fOROCDZ=0.001; //delta Z for IROCORC
669
670
671}
672
a050b283 673
eaad068f 674void RegisterAliTPCROCVoltError3D(){
675 //
676 // ROC rotation transformation
677 // 700 -709 - 0 field
678 // 710 -719 - +0.5 field
679 // 720 -729 - -0.5 field
680 Double_t vdrift = 2.64; // [cm/us] // to be updated: per second (ideally)
681 Double_t ezField = 400; // [V/cm] // to be updated: never (hopefully)
682 Double_t T1 = 1.0;
683 Double_t T2 = 1.0;
684 Double_t wtP = -10.0 * (0.5*10) * vdrift / ezField ;
685 Double_t wtM = -10.0 * (0.5*10) * vdrift / -ezField ;
686
687 //
688 rocRotgXA=0; // roc rotation A side - inclination in X
689 rocRotgYA=0; // roc rotation A side - inclination in Y
690 rocRotgXC=0; // roc rotation C side - inclination in X
691 rocRotgYC=0; // roc rotation C side - inclination in Y
692 rocDzIROCA=0; // roc shift A side - in Z
693 rocDzIROCC=0; // roc shift C side - in Z
1cadb1b2 694 //
695 rocDzUDA=0; // roc shift up-down - A side
696 rocDzUDC=0; // roc shift up-down - C side
697 //
eaad068f 698 rocRotIROCA=0; // roc rot IROC A side - in Z
699 rocRotIROCC=0; // roc rot OROC C side - in Z
1cadb1b2 700 rocRotUDA=0; // roc rot updown A side
701 rocRotUDC=0; // roc rot updown C side
eaad068f 702 //
703 printf("RegisterAliTPCROCVoltError3D()");
704 Double_t kAngle=0.001;
705 // reference in lx
706 AliTPCROC * rocInfo = AliTPCROC::Instance();
707 Double_t lxRef = (rocInfo->GetPadRowRadii(0,62)+rocInfo->GetPadRowRadii(36,0))/2;
708 //
709 TMatrixD matrix(72,3);
710
711 AliTPCComposedCorrection *corrField3D = 0;
712 TFile *fCorrectionsROC=0;
713 fCorrectionsROC = new TFile("TPCCorrectionPrimitivesROC.root");
714 corrField3D = ( AliTPCComposedCorrection *)fCorrectionsROC->Get("TPCROCVoltError3DRotationgXgY");
715 //
716 if (!corrField3D){
717 fCorrectionsROC = new TFile("TPCCorrectionPrimitivesROC.root","recreate");
718 }
719 if (corrField3D) { // load from file
720 corrField3D->Print();
721 TCollection *iter = corrField3D->GetCorrections();
722
723 rocRotgXA=(AliTPCROCVoltError3D*)iter->FindObject("rocRotgXA");
724
725 rocRotgYA=(AliTPCROCVoltError3D*)iter->FindObject("rocRotgYA");
726
727 rocRotgXC=(AliTPCROCVoltError3D*)iter->FindObject("rocRotgXC");
728
729 rocRotgYC=(AliTPCROCVoltError3D*)iter->FindObject("rocRotgYC");
730
731 rocDzIROCA=(AliTPCROCVoltError3D*)iter->FindObject("rocDzIROCA");
732
733 rocDzIROCC=(AliTPCROCVoltError3D*)iter->FindObject("rocDzIROCC");
1cadb1b2 734 //
735 rocDzUDA=(AliTPCROCVoltError3D*)iter->FindObject("rocDzUDA");
736
737 rocDzUDC=(AliTPCROCVoltError3D*)iter->FindObject("rocDzUDC");
eaad068f 738
739 rocRotIROCA=(AliTPCROCVoltError3D*)iter->FindObject("rocRotIROCA");
740
741 rocRotIROCC=(AliTPCROCVoltError3D*)iter->FindObject("rocRotIROCC");
1cadb1b2 742
743 rocRotUDA=(AliTPCROCVoltError3D*)iter->FindObject("rocRotUDA");
744
745 rocRotUDC=(AliTPCROCVoltError3D*)iter->FindObject("rocRotUDC");
eaad068f 746
747 } else {
748 corrField3D = new AliTPCComposedCorrection;
749 rocRotgXA=new AliTPCROCVoltError3D;
750 rocRotgYA=new AliTPCROCVoltError3D;
751 rocRotgXC=new AliTPCROCVoltError3D;
752 rocRotgYC=new AliTPCROCVoltError3D;
753 rocDzIROCA=new AliTPCROCVoltError3D;
754 rocDzIROCC=new AliTPCROCVoltError3D;
1cadb1b2 755 rocDzUDA=new AliTPCROCVoltError3D;
756 rocDzUDC=new AliTPCROCVoltError3D;
eaad068f 757 rocRotIROCA=new AliTPCROCVoltError3D;
758 rocRotIROCC=new AliTPCROCVoltError3D;
1cadb1b2 759 rocRotUDA=new AliTPCROCVoltError3D;
760 rocRotUDC=new AliTPCROCVoltError3D;
eaad068f 761 //
762 for (Int_t isec=0; isec<72; isec++){
763 Double_t secAlpha = TMath::DegToRad()*(10.+20.*(((Int_t)isec)%18));
764 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
765 if (isec%36<18){
766 matrix(isec,0) = kAngle*TMath::Cos(secAlpha)*lxRef;
767 matrix(isec,1) = kAngle*TMath::Cos(secAlpha);
768 matrix(isec,2) = -kAngle*TMath::Sin(secAlpha);
769 }
770 }
771 rocRotgXA->SetROCData(&matrix);
772 //
773 for (Int_t isec=0; isec<72; isec++){
774 Double_t secAlpha = TMath::DegToRad()*(10.+20.*(((Int_t)isec)%18));
775 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
776 if (isec%36<18){
777 matrix(isec,0) = kAngle*TMath::Sin(secAlpha)*lxRef;
778 matrix(isec,1) = kAngle*TMath::Sin(secAlpha);
779 matrix(isec,2) = kAngle*TMath::Cos(secAlpha);
780 }
781 }
782 rocRotgYA->SetROCData(&matrix);
783 //
784 for (Int_t isec=0; isec<72; isec++){
785 Double_t secAlpha = TMath::DegToRad()*(10.+20.*(((Int_t)isec)%18));
786 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
787 if (isec%36>=18){
788 matrix(isec,0) = kAngle*TMath::Cos(secAlpha)*lxRef;
789 matrix(isec,1) = kAngle*TMath::Cos(secAlpha);
790 matrix(isec,2) = -kAngle*TMath::Sin(secAlpha);
791 }
792 }
793 rocRotgXC->SetROCData(&matrix);
794 //
795 for (Int_t isec=0; isec<72; isec++){
796 Double_t secAlpha = TMath::DegToRad()*(10.+20.*(((Int_t)isec)%18));
797 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
798 if (isec%36>=18){
799 matrix(isec,0) = kAngle*TMath::Sin(secAlpha)*lxRef;
800 matrix(isec,1) = kAngle*TMath::Sin(secAlpha);
801 matrix(isec,2) = kAngle*TMath::Cos(secAlpha);
802 }
803 }
804 rocRotgYC->SetROCData(&matrix);
805
806 //
807 //
808 for (Int_t isec=0; isec<72; isec++){
809 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
810 if (isec<18){
811 matrix(isec,0) = 0.1; // 1 mm
812 matrix(isec,1) = 0;
813 matrix(isec,2) = 0;
814 }
815 }
816 rocDzIROCA->SetROCData(&matrix);
817 //
818 for (Int_t isec=0; isec<72; isec++){
819 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
820 if (isec>=18 && isec<36){
821 matrix(isec,0) = 0.1; // 1 mm
822 matrix(isec,1) = 0;
823 matrix(isec,2) = 0;
824 }
825 }
826 rocDzIROCC->SetROCData(&matrix);
1cadb1b2 827
828 //
829 //
830 for (Int_t isec=0; isec<72; isec++){
831 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
832 if (isec%36<18){
833 matrix(isec,0) = (isec%18<9)? 0.05:-0.05; // 1 mm
834 matrix(isec,1) = 0;
835 matrix(isec,2) = 0;
836 }
837 }
838 rocDzUDA->SetROCData(&matrix);
839 //
840 for (Int_t isec=0; isec<72; isec++){
841 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
842 if (isec%36>=18){
843 matrix(isec,0) = (isec%18<9)?0.05:-0.05; // 1 mm
844 matrix(isec,1) = 0;
845 matrix(isec,2) = 0;
846 }
847 }
848 rocDzUDC->SetROCData(&matrix);
eaad068f 849 //
850 //
851 for (Int_t isec=0; isec<72; isec++){
852 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
853 if (isec<18){
854 matrix(isec,0) = 0;
855 matrix(isec,1) = kAngle;
856 matrix(isec,2) = 0;
857 }
858 }
1cadb1b2 859 //
eaad068f 860 rocRotIROCA->SetROCData(&matrix);
861 //
862 for (Int_t isec=0; isec<72; isec++){
863 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
864 if (isec>=18 && isec<36){
865 matrix(isec,0) = 0;
866 matrix(isec,1) = kAngle;
867 matrix(isec,2) = 0;
868 }
869 }
870 rocRotIROCC->SetROCData(&matrix);
1cadb1b2 871 //
872 //
873 for (Int_t isec=0; isec<72; isec++){
874 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
875 if (isec%36<18){
876 matrix(isec,0) = 0;
877 matrix(isec,1) = (isec%18<9)?kAngle:-kAngle;
878 matrix(isec,2) = 0;
879 }
880 }
881 //
882 rocRotUDA->SetROCData(&matrix);
883 //
884 for (Int_t isec=0; isec<72; isec++){
885 matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
886 if (isec%36>=18){
887 matrix(isec,0) = 0;
888 matrix(isec,1) = (isec%18<9)?kAngle:-kAngle;
889 matrix(isec,2) = 0;
890 }
891 }
892 rocRotUDC->SetROCData(&matrix);
eaad068f 893
894
895 //
896 rocRotgXA->SetElectronArrivalCorrection(kFALSE);
897 rocRotgYA->SetElectronArrivalCorrection(kFALSE);
898 rocRotgXC->SetElectronArrivalCorrection(kFALSE);
899 rocRotgYC->SetElectronArrivalCorrection(kFALSE);
900 rocDzIROCA->SetElectronArrivalCorrection(kFALSE);
901 rocDzIROCC->SetElectronArrivalCorrection(kFALSE);
1cadb1b2 902 rocDzUDA->SetElectronArrivalCorrection(kFALSE);
903 rocDzUDC->SetElectronArrivalCorrection(kFALSE);
eaad068f 904 rocRotIROCA->SetElectronArrivalCorrection(kFALSE);
905 rocRotIROCC->SetElectronArrivalCorrection(kFALSE);
1cadb1b2 906 rocRotUDA->SetElectronArrivalCorrection(kFALSE);
907 rocRotUDC->SetElectronArrivalCorrection(kFALSE);
eaad068f 908
909 /* // verification plots
910 rocRotgXA.CreateHistoOfZAlignment(0,500,500)->Draw("surf2");
911 rocRotgYA.CreateHistoOfZAlignment(0,500,500)->Draw("surf2");
912 rocRotgXC.CreateHistoOfZAlignment(1,500,500)->Draw("surf2");
913 rocRotgYC.CreateHistoOfZAlignment(1,500,500)->Draw("surf2");
914 */
915
916 //
917 rocRotgXA->SetName("rocRotgXA");rocRotgXA->SetTitle("rocRotgXA");
918 rocRotgYA->SetName("rocRotgYA");rocRotgYA->SetTitle("rocRotgYA");
919 rocRotgXC->SetName("rocRotgXC");rocRotgXC->SetTitle("rocRotgXC");
920 rocRotgYC->SetName("rocRotgYC");rocRotgYC->SetTitle("rocRotgYC");
921 rocDzIROCA->SetName("rocDzIROCA");rocDzIROCA->SetTitle("rocDzIROCA");
922 rocDzIROCC->SetName("rocDzIROCC");rocDzIROCC->SetTitle("rocDzIROCC");
1cadb1b2 923 rocDzUDA->SetName("rocDzUDA");rocDzUDA->SetTitle("rocDzUDA");
924 rocDzUDC->SetName("rocDzUDC");rocDzUDC->SetTitle("rocDzUDC");
eaad068f 925 rocRotIROCA->SetName("rocRotIROCA");rocRotIROCA->SetTitle("rocRotIROCA");
926 rocRotIROCC->SetName("rocRotIROCC");rocRotIROCC->SetTitle("rocRotIROCC");
1cadb1b2 927 rocRotUDA->SetName("rocRotUDA");rocRotUDA->SetTitle("rocRotUDA");
928 rocRotUDC->SetName("rocRotUDC");rocRotUDC->SetTitle("rocRotUDC");
eaad068f 929 //
930 //
931 TObjArray *cs = new TObjArray();
932 cs->Add(rocRotgXA);
933 cs->Add(rocRotgYA);
934 cs->Add(rocRotgXC);
935 cs->Add(rocRotgYC);
936 cs->Add(rocDzIROCA);
937 cs->Add(rocDzIROCC);
1cadb1b2 938 cs->Add(rocDzUDA);
939 cs->Add(rocDzUDC);
eaad068f 940 cs->Add(rocRotIROCA);
941 cs->Add(rocRotIROCC);
1cadb1b2 942 cs->Add(rocRotUDA);
943 cs->Add(rocRotUDC);
eaad068f 944 corrField3D->SetCorrections(cs);
945 corrField3D->SetOmegaTauT1T2(0,1.,1.);
946 corrField3D->Print();
947 fCorrectionsROC->cd();
948 corrField3D->Init();
949 corrField3D->Print("da");
950 fCorrectionsROC->cd();
951 corrField3D->Write("TPCROCVoltError3DRotationgXgY");
eaad068f 952 }
953 AliTPCCorrection::AddVisualCorrection(rocRotgXA,701);
954 AliTPCCorrection::AddVisualCorrection(rocRotgYA,702);
955 AliTPCCorrection::AddVisualCorrection(rocRotgXC,703);
956 AliTPCCorrection::AddVisualCorrection(rocRotgYC,704);
957 AliTPCCorrection::AddVisualCorrection(rocDzIROCA,705);
958 AliTPCCorrection::AddVisualCorrection(rocDzIROCC,706);
1cadb1b2 959 AliTPCCorrection::AddVisualCorrection(rocDzUDA,709);
960 AliTPCCorrection::AddVisualCorrection(rocDzUDC,710);
eaad068f 961 AliTPCCorrection::AddVisualCorrection(rocRotIROCA,707);
962 AliTPCCorrection::AddVisualCorrection(rocRotIROCC,708);
1cadb1b2 963 AliTPCCorrection::AddVisualCorrection(rocRotUDA,711);
964 AliTPCCorrection::AddVisualCorrection(rocRotUDC,712);
eaad068f 965
966 AliTPCCorrection *corrPlus =0;
967 //
968 corrPlus=(AliTPCCorrection *)rocRotgXA->Clone();
969 corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
970 AliTPCCorrection::AddVisualCorrection(corrPlus,711);
971 //
972 corrPlus=(AliTPCCorrection *)rocRotgYA->Clone();
973 corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
974 AliTPCCorrection::AddVisualCorrection(corrPlus,712);
975 //
976 corrPlus=(AliTPCCorrection *)rocRotgXC->Clone();
977 corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
978 AliTPCCorrection::AddVisualCorrection(corrPlus,713);
979 //
980 corrPlus=(AliTPCCorrection *)rocRotgYC->Clone();
981 corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
982 AliTPCCorrection::AddVisualCorrection(corrPlus,714);
983 //
984 corrPlus=(AliTPCCorrection *)rocDzIROCA->Clone();
985 corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
986 AliTPCCorrection::AddVisualCorrection(corrPlus,715);
987 //
988 corrPlus=(AliTPCCorrection *)rocDzIROCC->Clone();
989 corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
990 AliTPCCorrection::AddVisualCorrection(corrPlus,716);
991 //
992 corrPlus=(AliTPCCorrection *)rocRotIROCA->Clone();
993 corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
994 AliTPCCorrection::AddVisualCorrection(corrPlus,717);
995 //
996 corrPlus=(AliTPCCorrection *)rocDzIROCC->Clone();
997 corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
998 AliTPCCorrection::AddVisualCorrection(corrPlus,718);
999 //
1000 //
1001 AliTPCCorrection *corrMinus =0;
1002 //
1003 corrMinus=(AliTPCCorrection *)rocRotgXA->Clone();
1004 corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
1005 AliTPCCorrection::AddVisualCorrection(corrMinus,721);
1006 //
1007 corrMinus=(AliTPCCorrection *)rocRotgYA->Clone();
1008 corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
1009 AliTPCCorrection::AddVisualCorrection(corrMinus,722);
1010 //
1011 corrMinus=(AliTPCCorrection *)rocRotgXC->Clone();
1012 corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
1013 AliTPCCorrection::AddVisualCorrection(corrMinus,723);
1014 //
1015 corrMinus=(AliTPCCorrection *)rocRotgYC->Clone();
1016 corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
1017 AliTPCCorrection::AddVisualCorrection(corrMinus,724);
1018 //
1019 corrMinus=(AliTPCCorrection *)rocDzIROCA->Clone();
1020 corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
1021 AliTPCCorrection::AddVisualCorrection(corrMinus,725);
1022 //
1023 corrMinus=(AliTPCCorrection *)rocDzIROCC->Clone();
1024 corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
1025 AliTPCCorrection::AddVisualCorrection(corrMinus,726);
1026 //
1027 corrMinus=(AliTPCCorrection *)rocRotIROCA->Clone();
1028 corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
1029 AliTPCCorrection::AddVisualCorrection(corrMinus,727);
1030 //
1031 corrMinus=(AliTPCCorrection *)rocDzIROCC->Clone();
1032 corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
1033 AliTPCCorrection::AddVisualCorrection(corrMinus,728);
1034 //
1035
1036 fCorrectionsROC->Close();
1037 delete fCorrectionsROC;
1038}
1039
1040
1041void RegisterAliTPCROCVoltError3DSector(){
1042 //
1043 // ROC rotation and shift transformation
1044 // 800-819 - 0.0 Field
1045 // 820-839 - +0.5 Field
1046 // 840-859 - +0.5 Field
1047
1048 rocShiftIROCA0=0; // IROC shift A0 side
1049 rocRotIROCA0=0; // IROC rot A0 side
1050 rocShiftOROCA0=0; // OROC shift A0 side
1051 rocRotOROCA0=0; // OROC rot A0 side
1052 rocShiftIROCC0=0; // IROC shift C0 side
1053 rocRotIROCC0=0; // IROC rot C0 side
1054 rocShiftOROCC0=0; // OROC shift C0 side
1055 rocRotOROCC0=0; // OROC rot C0 side
1056 Double_t vdrift = 2.64; // [cm/us] // to be updated: per second (ideally)
1057 Double_t ezField = 400; // [V/cm] // to be updated: never (hopefully)
1058 Double_t T1 = 1.0;
1059 Double_t T2 = 1.0;
1060
1061 // Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
1062
1063 //
1064 //
1065 printf("RegisterAliTPCROCVoltError3DSector()");
1066 Double_t kAngle=0.001;
1067 Double_t kDz=0.1;
1068 // reference in lx
1069 //
1070 TMatrixD matrix(72,3);
1071
1072 AliTPCComposedCorrection *corrField3DSector = 0;
1073 TFile *fCorrectionsROC=0;
1074 fCorrectionsROC = new TFile("TPCCorrectionPrimitivesSector.root");
1075 corrField3DSector = ( AliTPCComposedCorrection *)fCorrectionsROC->Get("TPCROCVoltError3DSector");
1076 //
1077 if (!corrField3DSector){
1078 fCorrectionsROC = new TFile("TPCCorrectionPrimitivesSector.root","recreate");
1079 }
1080 if (corrField3DSector) { // load from file
1081 corrField3DSector->Print();
1082 TCollection *iter = corrField3DSector->GetCorrections();
1083 //
1084 rocShiftIROCA0=(AliTPCROCVoltError3D*)iter->FindObject("rocShiftIROCA0"); // IROC shift A0 side
1085 rocRotIROCA0=(AliTPCROCVoltError3D*)iter->FindObject("rocRotIROCA0"); // IROC rot A0 side
1086 rocShiftOROCA0=(AliTPCROCVoltError3D*)iter->FindObject("rocShiftOROCA0"); // OROC shift A0 side
1087 rocRotOROCA0=(AliTPCROCVoltError3D*)iter->FindObject("rocRotOROCA0"); // OROC rot A0 side
1088 rocShiftIROCC0=(AliTPCROCVoltError3D*)iter->FindObject("rocShiftIROCC0"); // IROC shift C0 side
1089 rocRotIROCC0=(AliTPCROCVoltError3D*)iter->FindObject("rocRotIROCC0"); // IROC rot C0 side
1090 rocShiftOROCC0=(AliTPCROCVoltError3D*)iter->FindObject("rocShiftOROCC0"); // OROC shift C0 side
1091 rocRotOROCC0=(AliTPCROCVoltError3D*)iter->FindObject("rocRotOROCC0"); // OROC rot C0 side
1092
1093 } else {
1094 corrField3DSector = new AliTPCComposedCorrection;
1095 rocShiftIROCA0=new AliTPCROCVoltError3D; // IROC shift A0 side
1096 rocRotIROCA0=new AliTPCROCVoltError3D; // IROC rot A0 side
1097 rocShiftOROCA0=new AliTPCROCVoltError3D; // OROC shift A0 side
1098 rocRotOROCA0=new AliTPCROCVoltError3D; // OROC rot A0 side
1099 rocShiftIROCC0=new AliTPCROCVoltError3D; // IROC shift C0 side
1100 rocRotIROCC0=new AliTPCROCVoltError3D; // IROC rot C0 side
1101 rocShiftOROCC0=new AliTPCROCVoltError3D; // OROC shift C0 side
1102 rocRotOROCC0=new AliTPCROCVoltError3D; // OROC rot C0 side
1103 //
1104 matrix.Zero(); matrix(0,0)=kDz;
1105 rocShiftIROCA0->SetROCData(&matrix);
1106 matrix.Zero(); matrix(0,1)=kAngle;
1107 rocRotIROCA0->SetROCData(&matrix);
1108 matrix.Zero(); matrix(36,0)=kDz;
1109 rocShiftOROCA0->SetROCData(&matrix);
1110 matrix.Zero(); matrix(36,1)=kAngle;
1111 rocRotOROCA0->SetROCData(&matrix);
1112
1113 matrix.Zero(); matrix(18,0)=kDz;
1114 rocShiftIROCC0->SetROCData(&matrix);
1115 matrix.Zero(); matrix(18,1)=kAngle;
1116 rocRotIROCC0->SetROCData(&matrix);
1117 matrix.Zero(); matrix(36+18,0)=kDz;
1118 rocShiftOROCC0->SetROCData(&matrix);
1119 matrix.Zero(); matrix(36+18,1)=kAngle;
1120 rocRotOROCC0->SetROCData(&matrix);
1121 //
1122 rocShiftIROCA0->SetElectronArrivalCorrection(kFALSE); // IROC shift A0 side
1123 rocRotIROCA0->SetElectronArrivalCorrection(kFALSE); // IROC rot A0 side
1124 rocShiftOROCA0->SetElectronArrivalCorrection(kFALSE); // OROC shift A0 side
1125 rocRotOROCA0->SetElectronArrivalCorrection(kFALSE); // OROC rot A0 side
1126 rocShiftIROCC0->SetElectronArrivalCorrection(kFALSE); // IROC shift C0 side
1127 rocRotIROCC0->SetElectronArrivalCorrection(kFALSE); // IROC rot C0 side
1128 rocShiftOROCC0->SetElectronArrivalCorrection(kFALSE); // OROC shift C0 side
1129 rocRotOROCC0->SetElectronArrivalCorrection(kFALSE); // OROC rot C0 side
1130
1131 /* // verification plots
1132 */
1133 //
1134 rocShiftIROCA0->SetName("rocShiftIROCA0");rocShiftIROCA0->SetTitle("rocShiftIROCA0");
1135 rocRotIROCA0->SetName("rocRotIROCA0");rocRotIROCA0->SetTitle("rocRotIROCA0");
1136 rocShiftOROCA0->SetName("rocShiftOROCA0"); rocShiftOROCA0->SetTitle("rocShiftOROCA0");
1137 rocRotOROCA0->SetName("rocRotOROCA0");rocRotOROCA0->SetTitle("rocRotOROCA0");
1138 //
1139 rocShiftIROCC0->SetName("rocShiftIROCC0");rocShiftIROCC0->SetTitle("rocShiftIROCC0");
1140 rocRotIROCC0->SetName("rocRotIROCC0");rocRotIROCC0->SetTitle("rocRotIROCC0");
1141 rocShiftOROCC0->SetName("rocShiftOROCC0");rocShiftOROCC0->SetTitle("rocShiftOROCC0");
1142 rocRotOROCC0->SetName("rocRotOROCC0");rocRotOROCC0->SetTitle("rocRotOROCC0");
1143 //
1144 //
1145 TObjArray *cs = new TObjArray();
1146 cs->Add(rocShiftIROCA0); // IROC shift A0 side
1147 cs->Add(rocRotIROCA0); // IROC rot A0 side
1148 cs->Add(rocShiftOROCA0); // OROC shift A0 side
1149 cs->Add(rocRotOROCA0); // OROC rot A0 side
1150 cs->Add(rocShiftIROCC0); // IROC shift C0 side
1151 cs->Add(rocRotIROCC0); // IROC rot C0 side
1152 cs->Add(rocShiftOROCC0); // OROC shift C0 side
1153 cs->Add(rocRotOROCC0); // OROC rot C0 side
1154 //
1155 corrField3DSector->SetCorrections(cs);
1156 corrField3DSector->SetOmegaTauT1T2(0,T1,T2);
1157 corrField3DSector->Print();
1158 //
1159
1160 fCorrectionsROC->cd();
1161 corrField3DSector->Init();
1162 corrField3DSector->Print("da");
1163 fCorrectionsROC->cd();
1164 corrField3DSector->Write("TPCROCVoltError3DSector");
1165 }
1166 AliTPCCorrection::AddVisualCorrection(rocShiftIROCA0,800); // IROC shift A0 side
1167 AliTPCCorrection::AddVisualCorrection(rocRotIROCA0,801); // IROC rot A0 side
1168 AliTPCCorrection::AddVisualCorrection(rocShiftOROCA0,802); // OROC shift A0 side
1169 AliTPCCorrection::AddVisualCorrection(rocRotOROCA0,803); // OROC rot A0 side
1170 AliTPCCorrection::AddVisualCorrection(rocShiftIROCC0,804); // IROC shift C0 side
1171 AliTPCCorrection::AddVisualCorrection(rocRotIROCC0,805); // IROC rot C0 side
1172 AliTPCCorrection::AddVisualCorrection(rocShiftOROCC0,806); // OROC shift C0 side
1173 AliTPCCorrection::AddVisualCorrection(rocRotOROCC0,807); // OROC rot C0 side
1174 //
1175 // Register correction for plus setting
1176 AliTPCCorrection *corr =0;
1177 Double_t wtp = -10.0 * (0.5*10) * vdrift / ezField ;
1178 Double_t wtm = -10.0 * (0.5*10) * vdrift / -ezField ;
1179
1180 corr=(AliTPCCorrection *)rocShiftIROCA0->Clone();
1181 corr->SetOmegaTauT1T2(wtp,T1,T2);
1182 AliTPCCorrection::AddVisualCorrection(corr,820); // IROC shift A0 side + Plus field
1183 //
1184 corr=(AliTPCCorrection *)rocRotIROCA0->Clone();
1185 corr->SetOmegaTauT1T2(wtp,T1,T2);
1186 AliTPCCorrection::AddVisualCorrection(corr,821); // IROC rot A0 side
1187 //
1188 corr=(AliTPCCorrection *)rocShiftOROCA0->Clone();
1189 corr->SetOmegaTauT1T2(wtp,T1,T2);
1190 AliTPCCorrection::AddVisualCorrection(corr,822); // OROC shift A0 side
1191 //
1192 corr=(AliTPCCorrection *)rocRotOROCA0->Clone();
1193 corr->SetOmegaTauT1T2(wtp,T1,T2);
1194 AliTPCCorrection::AddVisualCorrection(corr,823); // OROC rot A0 side
1195 corr=(AliTPCCorrection *)rocShiftIROCC0->Clone();
1196 corr->SetOmegaTauT1T2(wtp,T1,T2);
1197 AliTPCCorrection::AddVisualCorrection(corr,824); // IROC shift C0 side + Plus field
1198 //
1199 corr=(AliTPCCorrection *)rocRotIROCC0->Clone();
1200 corr->SetOmegaTauT1T2(wtp,T1,T2);
1201 AliTPCCorrection::AddVisualCorrection(corr,825); // IROC rot C0 side
1202 //
1203 corr=(AliTPCCorrection *)rocShiftOROCC0->Clone();
1204 corr->SetOmegaTauT1T2(wtp,T1,T2);
1205 AliTPCCorrection::AddVisualCorrection(corr,826); // OROC shift C0 side
1206 //
1207 corr=(AliTPCCorrection *)rocRotOROCC0->Clone();
1208 corr->SetOmegaTauT1T2(wtp,T1,T2);
1209 AliTPCCorrection::AddVisualCorrection(corr,827); // OROC rot C0 side
1210 //
1211 corr=(AliTPCCorrection *)rocShiftIROCA0->Clone();
1212 corr->SetOmegaTauT1T2(wtm,T1,T2);
1213 AliTPCCorrection::AddVisualCorrection(corr,840); // IROC shift A0 side + Plus field
1214 //
1215 corr=(AliTPCCorrection *)rocRotIROCA0->Clone();
1216 corr->SetOmegaTauT1T2(wtm,T1,T2);
1217 AliTPCCorrection::AddVisualCorrection(corr,841); // IROC rot A0 side
1218 //
1219 corr=(AliTPCCorrection *)rocShiftOROCA0->Clone();
1220 corr->SetOmegaTauT1T2(wtm,T1,T2);
1221 AliTPCCorrection::AddVisualCorrection(corr,842); // OROC shift A0 side
1222 //
1223 corr=(AliTPCCorrection *)rocRotOROCA0->Clone();
1224 corr->SetOmegaTauT1T2(wtm,T1,T2);
1225 AliTPCCorrection::AddVisualCorrection(corr,843); // OROC rot A0 side
1226 corr=(AliTPCCorrection *)rocShiftIROCC0->Clone();
1227 corr->SetOmegaTauT1T2(wtm,T1,T2);
1228 AliTPCCorrection::AddVisualCorrection(corr,844); // IROC shift C0 side + Plus field
1229 //
1230 corr=(AliTPCCorrection *)rocRotIROCC0->Clone();
1231 corr->SetOmegaTauT1T2(wtm,T1,T2);
1232 AliTPCCorrection::AddVisualCorrection(corr,845); // IROC rot C0 side
1233 //
1234 corr=(AliTPCCorrection *)rocShiftOROCC0->Clone();
1235 corr->SetOmegaTauT1T2(wtm,T1,T2);
1236 AliTPCCorrection::AddVisualCorrection(corr,846); // OROC shift C0 side
1237 //
1238 corr=(AliTPCCorrection *)rocRotOROCC0->Clone();
1239 corr->SetOmegaTauT1T2(wtm,T1,T2);
1240 AliTPCCorrection::AddVisualCorrection(corr,847); // OROC rot C0 side
1241 //
1242 fCorrectionsROC->Close();
1243 delete fCorrectionsROC;
1244}
1245
1246
1247
1248
1249
a050b283 1250AliTPCComposedCorrection * MakeComposedCorrectionExB(){
1251 //
1252 // make composed corection for ExB scanning
1253 //
1254 RegisterCorrection();
1255 //
1cadb1b2 1256 //
1257 TObjArray * corr = new TObjArray; // primitive corrections - for fitting
1258 TObjArray * testCorr = new TObjArray; // test corrections - to be used as benchmark for fitting
a050b283 1259 //
a050b283 1260 corr->AddLast(twistX);
1261 corr->AddLast(twistY);
1cadb1b2 1262 corr->AddLast(exbShape);
1263 corr->AddLast(exbShapeT1X);
1264 corr->AddLast(exbShapeT2X);
1265 //
a050b283 1266 for (Int_t i=0; i<8; i++){
1267 corr->AddLast(boundaryVoltErrorA[i]);
1268 corr->AddLast(boundaryVoltErrorC[i]);
1269 }
1cadb1b2 1270 //
1271 // ROD alignment
1272 //
1273 corr->AddLast(rodIFCCos);
1274 corr->AddLast(rodIFCSin);
1275 corr->AddLast(rodOFCSin);
1276 corr->AddLast(rodOFCCos);
1277 //alignment
a050b283 1278 corr->AddLast(alignTrans0);
1279 corr->AddLast(alignTrans1);
1280 corr->AddLast(alignTrans2);
1281 corr->AddLast(alignRot0);
1282 corr->AddLast(alignRot1);
1283 corr->AddLast(alignRot2);
1cadb1b2 1284 //
1285 corr->AddLast(alignTrans0D[0]);
1286 corr->AddLast(alignTrans1D[0]);
1287 corr->AddLast(alignTrans2D[0]);
1288 corr->AddLast(alignRot0D[0]);
1289 corr->AddLast(alignRot1D[0]);
1290 corr->AddLast(alignRot2D[0]);
1291 corr->AddLast(alignTrans0D[1]);
1292 corr->AddLast(alignTrans1D[1]);
1293 corr->AddLast(alignRot0D[1]);
1294 corr->AddLast(alignTrans0D[2]);
1295 corr->AddLast(alignTrans1D[2]);
1296 corr->AddLast(alignRot0D[2]);
1297 //
1298 // z alignment + E field distortion due z misalignment
1299 //
1300 corr->AddLast(rocRotgXA); // A side C side
eaad068f 1301 corr->AddLast(rocRotgYA);
1302 corr->AddLast(rocRotgXC);
1303 corr->AddLast(rocRotgYC);
1304 corr->AddLast(rocDzIROCA);
1305 corr->AddLast(rocDzIROCC);
1cadb1b2 1306 corr->AddLast(rocRotIROCA);
1307 corr->AddLast(rocRotIROCC);
1308 corr->AddLast(rocDzUDA);
1309 corr->AddLast(rocDzUDC);
1310 corr->AddLast(rocRotUDA);
1311 corr->AddLast(rocRotUDC);
1312 //
1313 //
1314 corr->AddLast(calibDrift[0]);
1315 corr->AddLast(calibDrift[1]);
1316 corr->AddLast(calibDrift[2]);
1317 corr->AddLast(calibDrift[3]);
1318 corr->AddLast(calibDrift[4]);
1319 corr->AddLast(calibDrift[5]);
1320 corr->AddLast(calibDrift[6]);
1321 //
1322 // setup test correction
1323 //
1324 testCorr->AddLast(rodIFCCos);
1325 testCorr->AddLast(rodIFCSin);
1326 testCorr->AddLast(rodOFCSin);
1327 testCorr->AddLast(rodOFCCos);
1328 //
1329 testCorr->AddLast(twistX);
1330 testCorr->AddLast(twistY);
1331 testCorr->AddLast(alignTrans0);
1332 testCorr->AddLast(alignTrans1);
1333 testCorr->AddLast(alignTrans2);
1334 testCorr->AddLast(alignRot0);
1335 testCorr->AddLast(alignRot1);
1336 testCorr->AddLast(alignRot2);
1337 testCorr->AddLast(rocRotgXA); // A side C side
1338 testCorr->AddLast(rocRotgYA);
1339 testCorr->AddLast(rocRotgXC);
1340 testCorr->AddLast(rocRotgYC);
1341 testCorr->AddLast(rocDzIROCA);
1342 testCorr->AddLast(rocDzIROCC);
1343 testCorr->AddLast(rocRotIROCA);
1344 testCorr->AddLast(rocRotIROCC);
1345 Int_t entries=testCorr->GetEntries();
1346 TVectorD weights(entries);
1347 for (Int_t i=0; i<entries; i++) weights[i]=1;
1348 //
1349 AliTPCComposedCorrection *composedTest= new AliTPCComposedCorrection ;
1350 composedTest->SetName("FitSample");
1351 composedTest->SetTitle("FitSample");
1352 composedTest->SetCorrections(testCorr);
1353 composedTest->SetWeights(&weights);
1354 //
1355 corr->AddLast(composedTest);
a050b283 1356 AliTPCComposedCorrection *cc= new AliTPCComposedCorrection ;
1357 cc->SetCorrections((TObjArray*)(corr));
1cadb1b2 1358 //cc->Init();
a050b283 1359 cc->Print("DA"); // Print used correction classes
1360 cc->SetName("ComposedExB");
1361 TFile fexb("RegisterCorrectionExB.root","recreate");
1362 cc->Write("ComposedExB");
1363 fexb.Close();
1364 return cc;
1365}
1cadb1b2 1366
1367
1368AliTPCComposedCorrection * GetCorrectionFromFile(){
1369 //
1370 // Getthe appropariate correction form the closest file
1371 //
1372 TFile * fexb= TFile::Open("RegisterCorrectionExB.root");
1373 if (!fexb) fexb= TFile::Open("../RegisterCorrectionExB.root");
1374 if (!fexb) fexb= TFile::Open("../../RegisterCorrectionExB.root");
1375 if (!fexb) fexb= TFile::Open("../../../RegisterCorrectionExB.root");
1376 //
1377 if (!fexb) return 0;
1378 TFile * fitter= TFile::Open("fitCorrection.root");
1379
1380 if (!fitter) fitter= TFile::Open("../fitCorrection.root");
1381 if (!fitter) fitter= TFile::Open("../../fitCorrection.root");
1382 if (!fitter) fitter= TFile::Open("../../../fitCorrection.root");
1383 //
1384 AliTPCComposedCorrection *cc= (AliTPCComposedCorrection*) fexb->Get("ComposedExB");
1385 {if (!cc){
1386 printf("File or correction RegisterCorrectionExB.root doees not exist or corrupted\n\n\n");
1387 return 0;
1388 }}
1389 TObjArray * corr = (TObjArray*)(cc->GetCorrections());
1390 TObjArray * corrLocal =new TObjArray;
1391 TObjArray * corrGlobal =new TObjArray;
1392 //
1393 if (fitter){
1394 if (fitter->GetKey("FitBoundary")) corr->AddLast(fitter->Get("FitBoundary"));
1395 if (fitter->GetKey("FitExBTwist")) corr->AddLast(fitter->Get("FitExBTwist"));
1396 if (fitter->GetKey("FitAlignGlobal")) corr->AddLast(fitter->Get("FitAlignGlobal"));
1397 if (fitter->GetKey("FitRodAlignGloba")) corr->AddLast(fitter->Get("FitRodAlignGlobal"));
1398 if (fitter->GetKey("FitRocAlignGlobal")) corr->AddLast(fitter->Get("FitRocAlignGlobal"));
1399 if (fitter->GetKey("FitRocAlignZ")) corr->AddLast(fitter->Get("FitRocAlignZ"));
1400 if (fitter->GetKey("FitAlignLocal")) corr->AddLast(fitter->Get("FitAlignLocal"));
1401 if (fitter->GetKey("FitAlignTPC")) corr->AddLast(fitter->Get("FitAlignTPC"));
1402 if (fitter->GetKey("FitAlignTOF")) corr->AddLast(fitter->Get("FitAlignTOF"));
1403 if (fitter->GetKey("FitAlignTRD")) corr->AddLast(fitter->Get("FitAlignTRD"));
1404 }
1405 return cc;
1406}