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