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