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