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