AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTPCCalibGlobalMisalignment.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 
28 
30 #include "TMath.h"
31 #include "TGeoMatrix.h"
32 #include "AliTPCROC.h"
33 #include "AliTPCcalibDB.h"
34 #include "AliTPCParam.h"
35 #include <TGeoPhysicalNode.h>
36 //
37 #include "AliAlignObjParams.h"
38 #include "AliGeomManager.h"
39 #include "AliCDBManager.h"
40 #include "AliCDBEntry.h"
41 
43  : AliTPCCorrection("mialign","Misalignment"),
44  fXShift(0.),fYShift(0.),fZShift(0.),
45  fRotPhiA(0.),fRotPhiC(0.),
46  fdRPhiOffsetA(0.),
47  fdRPhiOffsetC(0.),
48  fQuadrantQ0(0), //OROC medium pads -delta ly+ - ly - shift
49  fQuadrantRQ0(0), //OROC medium pads -delta ly+ - ly - rotation
50  fQuadrantQ1(0), //OROC long pads -delta ly+ - ly - shift
51  fQuadrantQ2(0), //OROC long pads -shift
52  fQuadrantRQ1(0), //OROC long pads -delta ly+ - ly - rotation
53  fQuadrantRQ2(0), //OROC long pads -rotation
54  fMatrixGlobal(0), // global Alignment common
55  fMatrixGlobalDelta(0), // global Alignment Delta A side-c side
56  fArraySector(0) // fArraySector
57 {
59 
60 }
61 
64 
65  delete fQuadrantQ0; //OROC medium pads -delta ly+ - ly - shift
66  delete fQuadrantRQ0; //OROC medium pads -delta ly+ - ly - rotation
67  delete fQuadrantQ1; //OROC long pads -delta ly+ - ly - shift
68  delete fQuadrantQ2; //OROC long pads -shift
69  delete fQuadrantRQ1; //OROC long pads -delta ly+ - ly - rotation
70  delete fQuadrantRQ2; //OROC long pads -rotation
71  delete fMatrixGlobal; // global matrix
72  delete fMatrixGlobal; // global matrix
73  delete fArraySector; // sector matrices
74 }
75 
76 
77 
83 
84  if (corr==NULL) {
85  //AliError("Zerro pointer - correction");
86  return kFALSE;
87  }
88  AliTPCCalibGlobalMisalignment* corrC = dynamic_cast<AliTPCCalibGlobalMisalignment *>(corr);
89  if (corrC == NULL) {
90  //AliError(TString::Format("Inconsistent class types: %s\%s",IsA()->GetName(),corr->IsA()->GetName()).Data());
91  return kFALSE;
92  }
93  //
94  AliTPCCalibGlobalMisalignment & add = *corrC;
95  fXShift+=weight*add.fXShift; // Shift in global X [cm]
96  fYShift+=weight*add.fYShift; // Shift in global Y [cm]
97  fZShift+=weight*add.fZShift; // Shift in global Z [cm]
98 
99  fRotPhiA+=weight*add.fRotPhiA; // simple rotation of A side read-out plane around the Z axis [rad]
100  fRotPhiC+=weight*add.fRotPhiC; // simple rotation of C side read-out plane around the Z axis [rad]
101  fdRPhiOffsetA+=weight*add.fdRPhiOffsetA; // add a constant offset of dRPhi (or local Y) in [cm]: purely for calibration purposes!
102  fdRPhiOffsetC+=weight*add.fdRPhiOffsetC; // add a constant offset of dRPhi (or local Y) in [cm]: purely for calibration purposes!
103  //
104  // Quadrant alignment
105  //
106  if (add.fQuadrantQ0) {
107  if (!fQuadrantQ0) fQuadrantQ0 = new TVectorD(add.fQuadrantQ0->GetNrows());
108  fQuadrantQ0->Add(weight*(*(add.fQuadrantQ0)));
109  }
110  if (add.fQuadrantRQ0) {
111  if (!fQuadrantRQ0) fQuadrantRQ0 = new TVectorD(add.fQuadrantRQ0->GetNrows());
112  fQuadrantRQ0->Add(weight*(*(add.fQuadrantRQ0)));
113  }
114  //
115  if (add.fQuadrantQ1) {
116  if (!fQuadrantQ1) fQuadrantQ1 = new TVectorD(add.fQuadrantQ1->GetNrows());
117  fQuadrantQ1->Add(weight*(*(add.fQuadrantQ1)));
118  }
119  if (add.fQuadrantRQ1) {
120  if (!fQuadrantRQ1) fQuadrantRQ1 = new TVectorD(add.fQuadrantRQ1->GetNrows());
121  fQuadrantRQ1->Add(weight*(*(add.fQuadrantRQ1)));
122  }
123  //
124  if (add.fQuadrantQ2) {
125  if (!fQuadrantQ2) fQuadrantQ2 = new TVectorD(add.fQuadrantQ2->GetNrows());
126  fQuadrantQ2->Add(weight*(*(add.fQuadrantQ2)));
127  }
128  if (add.fQuadrantRQ2) {
129  if (!fQuadrantRQ2) fQuadrantRQ2 = new TVectorD(add.fQuadrantRQ2->GetNrows());
130  fQuadrantRQ2->Add(weight*(*(add.fQuadrantRQ2)));
131  }
132  //
133  // Global alignment - use native ROOT representation
134  //
135  Double_t delta[3]={0};
136  if (add.fMatrixGlobal){
137  TGeoHMatrix matrixW=*(add.fMatrixGlobal);
138  TGeoHMatrix matrixScaled;
139  const Double_t *rotMatrix = matrixW.GetRotationMatrix();
140  const Double_t *transMatrix = matrixW.GetTranslation();
141  matrixScaled.RotateZ(-rotMatrix[1]*TMath::RadToDeg()*weight);
142  matrixScaled.RotateY(rotMatrix[2]*TMath::RadToDeg()*weight);
143  matrixScaled.RotateX(-rotMatrix[5]*TMath::RadToDeg()*weight);
144  for (Int_t i=0; i<3; i++) delta[i]=weight*transMatrix[i];
145  matrixScaled.SetTranslation(delta);
146  // (matrixScaled*matrixW).Print(); in case weight -1 should be unit matrix
147  //
148  if (!fMatrixGlobal) {
149  fMatrixGlobal = new TGeoHMatrix(matrixScaled);
150  }else{
151  ((TGeoHMatrix*)fMatrixGlobal)->Multiply(&matrixScaled);
152  }
153  }
154  if (add.fMatrixGlobalDelta){
155  TGeoHMatrix matrixW=*(add.fMatrixGlobalDelta);
156  TGeoHMatrix matrixScaled;
157  const Double_t *rotMatrix = matrixW.GetRotationMatrix();
158  const Double_t *transMatrix = matrixW.GetTranslation();
159  matrixScaled.RotateZ(-rotMatrix[1]*TMath::RadToDeg()*weight);
160  matrixScaled.RotateY(rotMatrix[2]*TMath::RadToDeg()*weight);
161  matrixScaled.RotateX(-rotMatrix[5]*TMath::RadToDeg()*weight);
162  for (Int_t i=0; i<3; i++) delta[i]=weight*transMatrix[i];
163  matrixScaled.SetTranslation(delta);
164  // (matrixScaled*matrixW).Print(); in case weight -1 should be unit matrix
165  //
166  if (!fMatrixGlobalDelta) {
167  fMatrixGlobalDelta = new TGeoHMatrix(matrixScaled);
168  }else{
169  ((TGeoHMatrix*)fMatrixGlobalDelta)->Multiply(&matrixScaled);
170  }
171  }
172  if (add.fArraySector){
173  if (!fArraySector) {
174  fArraySector = new TObjArray(72);
175  for (Int_t isec=0; isec<72; isec++) fArraySector->AddAt(new TGeoHMatrix,isec);
176  }
177  for (Int_t isec=0; isec<72; isec++){
178  TGeoHMatrix *mat0= (TGeoHMatrix*)fArraySector->At(isec);
179  TGeoHMatrix *mat1= (TGeoHMatrix*)add.fArraySector->At(isec);
180  if (mat0&&mat1){
181  TGeoHMatrix matrixW=*(mat1);
182  TGeoHMatrix matrixScaled;
183  const Double_t *rotMatrix = matrixW.GetRotationMatrix();
184  const Double_t *transMatrix = matrixW.GetTranslation();
185  matrixScaled.RotateZ(-rotMatrix[1]*TMath::RadToDeg()*weight);
186  matrixScaled.RotateY(rotMatrix[2]*TMath::RadToDeg()*weight);
187  matrixScaled.RotateX(-rotMatrix[5]*TMath::RadToDeg()*weight);
188  for (Int_t i=0; i<3; i++) delta[i]=weight*transMatrix[i];
189  matrixScaled.SetTranslation(delta);
190  mat0->Multiply(&matrixScaled);
191  }
192  }
193  }
194  //
195  return kTRUE;
196 }
197 
198 
199 
200 
201 void AliTPCCalibGlobalMisalignment::SetQuadranAlign(const TVectorD *quadrantQ0, const TVectorD *quadrantRQ0, const TVectorD *quadrantQ1,const TVectorD *quadrantRQ1, const TVectorD *quadrantQ2, const TVectorD *quadrantRQ2){
204 
205  if (quadrantQ0) fQuadrantQ0 = new TVectorD(*quadrantQ0);
206  if (quadrantRQ0) fQuadrantRQ0 = new TVectorD(*quadrantRQ0);
207  //
208  if (quadrantQ1) fQuadrantQ1 = new TVectorD(*quadrantQ1);
209  if (quadrantQ1) fQuadrantRQ1 = new TVectorD(*quadrantRQ1);
210  if (quadrantQ2) fQuadrantQ2 = new TVectorD(*quadrantQ2);
211  if (quadrantQ2) fQuadrantRQ2 = new TVectorD(*quadrantRQ2);
212 }
213 
214 
215 
216 void AliTPCCalibGlobalMisalignment::SetAlignGlobal(const TGeoMatrix * matrixGlobal){
219 
220  if (fMatrixGlobal) delete fMatrixGlobal;
221  fMatrixGlobal=0;
222  if (matrixGlobal) fMatrixGlobal = new TGeoHMatrix(*matrixGlobal);
223 }
224 
225 void AliTPCCalibGlobalMisalignment::SetAlignGlobalDelta(const TGeoMatrix * matrixGlobalDelta){
228 
231  if (matrixGlobalDelta) fMatrixGlobalDelta = new TGeoHMatrix(*matrixGlobalDelta);
232 }
233 
237 
238  if (fArraySector) delete fArraySector;
239  fArraySector=0;
240  if (arraySector) fArraySector = (TObjArray*)arraySector->Clone();
241 }
242 
243 
244 //void AliTPCCalibGlobalMisalignment::Init() {
245 // //
246 // // Initialization funtion
247 // //
248 
249 // // nothing to be initialized, results of this calibration class will go to the global aligment structure
250 
251 //}
252 
253 //void AliTPCCalibGlobalMisalignment::Update(const TTimeStamp &/*timeStamp*/) {
254 // //
255 // // Update function
256 // //
257 //
258 // // nothing to be updated, results of this calibration class will go to the global aligment structure
259 //
260 //}
261 
262 
263 
264 void AliTPCCalibGlobalMisalignment::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
266 
267  static AliTPCROC *tpcRoc =AliTPCROC::Instance();
268  Double_t xref = ( tpcRoc->GetPadRowRadii(0,0)+tpcRoc->GetPadRowRadii(36,tpcRoc->GetNRows(36)-1))*0.5;
269  Double_t xquadrant = tpcRoc->GetPadRowRadii(36,53); // row 53 from uli
270  Double_t xIO = ( tpcRoc->GetPadRowRadii(0,tpcRoc->GetNRows(0)-1)+tpcRoc->GetPadRowRadii(36,0))*0.5;
271  Double_t r=0, phi=0;
272  r = TMath::Sqrt( x[0]*x[0] + x[1]*x[1] );
273  phi = TMath::ATan2(x[1],x[0]);
274  // Getsector number
275  Double_t sec=TMath::Nint(-0.5+(phi*9./TMath::Pi()));
276  if (sec<0) sec+=18;
277  Int_t isec = TMath::Nint(sec);
278  if (roc%36>=18) isec+=18;
279  //
280  // Get the point on the local coordiante frame
281  //
282  Double_t alpha=(sec+0.5)*TMath::Pi()/9;
283  Double_t pos[3]={0,0,x[2]};
284  pos[0]= TMath::Cos(alpha)*x[0]+TMath::Sin(alpha)*x[1];
285  pos[1]= -TMath::Sin(alpha)*x[0]+TMath::Cos(alpha)*x[1];
286  if (pos[0]>tpcRoc->GetPadRowRadiiUp(0)) isec+=36;
287 
288  //
289  // apply quadrant alignment if available - in local coordinate frame
290  //
291  //
292  Double_t posQG[3]={x[0],x[1],x[2]};
293  {
294  Double_t dly=0;
295  Bool_t isQ0 = (pos[0]<xquadrant)&&(pos[0]>xIO);
296  Bool_t isQ1 = (pos[0]>xquadrant);
297  Double_t sign = (pos[1]>0)? 1.: -1.;
298  if (isQ0){
299  if (fQuadrantQ0) dly+=sign*(*fQuadrantQ0)[isec%36]; // shift in cm
300  if (fQuadrantRQ0) dly+=sign*(*fQuadrantRQ0)[isec%36]*(pos[0]-xref);
301  }
302  if (isQ1){
303  if (fQuadrantQ1) dly+=sign*(*fQuadrantQ1)[isec%36]; // shift in cm
304  if (fQuadrantRQ1) dly+=sign*(*fQuadrantRQ1)[isec%36]*(pos[0]-xref);
305  if (fQuadrantQ2) dly+=(*fQuadrantQ2)[isec%36]; // shift in cm
306  if (fQuadrantRQ2) dly+=(*fQuadrantRQ2)[isec%36]*(pos[0]-xref);
307  }
308  // Tranform the corrected point to the global frame
309  posQG[0]= TMath::Cos(alpha)*pos[0]-TMath::Sin(alpha)*(pos[1]+dly);
310  posQG[1]= TMath::Sin(alpha)*pos[0]+TMath::Cos(alpha)*(pos[1]+dly);
311  }
312  //
313  // rotation of the read-out planes
314  if (roc%36<18) // A side
315  phi += fRotPhiA;
316  else // C side
317  phi += fRotPhiC;
318 
319  // Simply adding a constant dRPHi residual. PURELY FOR CALIBRATION PURPOSES
320  if (roc%36<18) // A side
321  phi += fdRPhiOffsetA/r;
322  else // C side
323  phi += fdRPhiOffsetC/r;
324 
325  dx[0] = r * TMath::Cos(phi) - x[0];
326  dx[1] = r * TMath::Sin(phi) - x[1];
327  dx[2] = 0.;
328 
329  // Simple shifts
330  dx[0] -= fXShift;
331  dx[1] -= fYShift;
332  dx[2] -= fZShift;
333  // quadrant shifts
334  dx[0] += (posQG[0]-x[0]);
335  dx[1] += (posQG[1]-x[1]);
336  //
337  //
338  if (fMatrixGlobal){
339  // apply global alignment matrix
340  Double_t ppos[3]={x[0],x[1],x[2]};
341  Double_t pposC[3]={x[0],x[1],x[2]};
342  fMatrixGlobal->LocalToMaster(ppos,pposC);
343  dx[0]+=pposC[0]-ppos[0];
344  dx[1]+=pposC[1]-ppos[1];
345  dx[2]+=pposC[2]-ppos[2];
346  }
347  if (fMatrixGlobalDelta){
348  // apply global alignment matrix A-C Side side
349  Double_t ppos[3]={x[0],x[1],x[2]};
350  Double_t pposC[3]={x[0],x[1],x[2]};
351  fMatrixGlobalDelta->LocalToMaster(ppos,pposC);
352  Double_t ssign=(roc%36<18) ? 1.:-1.;
353  dx[0]+=ssign*(pposC[0]-ppos[0]);
354  dx[1]+=ssign*(pposC[1]-ppos[1]);
355  dx[2]+=ssign*(pposC[2]-ppos[2]);
356  }
357 
358  if (fArraySector){
359  // apply global alignment matrix
360  TGeoMatrix *mat = (TGeoMatrix*)fArraySector->At(isec);
361  if (mat){
362  Double_t ppos[3]={x[0],x[1],x[2]};
363  Double_t pposC[3]={x[0],x[1],x[2]};
364  mat->LocalToMaster(ppos,pposC);
365  dx[0]+=pposC[0]-ppos[0];
366  dx[1]+=pposC[1]-ppos[1];
367  dx[2]+=pposC[2]-ppos[2];
368  }
369  }
370 }
371 
372 void AliTPCCalibGlobalMisalignment::Print(Option_t* option ) const{
374 
375  printf("%s",GetTitle());
376  printf(" - Trivial Misalignments for calibration purposes: \n");
377  printf(" - X-Shift: %1.3f cm, Y-Shift: %1.3f cm, Z-Shift: %1.3f cm \n",fXShift,fYShift,fZShift);
378  printf(" - Phi-Rotations: A side: %1.5f rad, C side: %1.5f rad\n",fRotPhiA,fRotPhiC);
379  printf(" - dRPhi offsets: A side: %1.5f cm, C side: %1.5f cm\n",fdRPhiOffsetA,fdRPhiOffsetC);
380  TString opt = option; opt.ToLower();
381  if (opt.Contains("a")){
382  if (GetAlignGlobal()){
383  printf("GetAlignGlobal()\n");
384  GetAlignGlobal()->Print();
385  }
386  if (GetAlignGlobalDelta()){
387  printf("GetAlignGlobalDelta()\n");
388  GetAlignGlobalDelta()->Print();
389  }
390  if (GetAlignSectors()){
391  printf("GetAlignSectors()\n");
392  GetAlignSectors()->Print();
393  }
394  }
395 }
396 
399 
400  fXShift+=add.fXShift; // Shift in global X [cm]
401  fYShift+=add.fYShift; // Shift in global Y [cm]
402  fZShift+=add.fZShift; // Shift in global Z [cm]
403 
404  fRotPhiA+=add.fRotPhiA; // simple rotation of A side read-out plane around the Z axis [rad]
405  fRotPhiC+=add.fRotPhiC; // simple rotation of C side read-out plane around the Z axis [rad]
406  fdRPhiOffsetA+=add.fdRPhiOffsetA; // add a constant offset of dRPhi (or local Y) in [cm]: purely for calibration purposes!
407  fdRPhiOffsetC+=add.fdRPhiOffsetC; // add a constant offset of dRPhi (or local Y) in [cm]: purely for calibration purposes!
408  //
409  // Quadrant alignment
410  //
411  if (add.fQuadrantQ0) {
412  if (fQuadrantQ0) fQuadrantQ0->Add(*(add.fQuadrantQ0));
413  if (!fQuadrantQ0) fQuadrantQ0 = (TVectorD*)(add.fQuadrantQ0->Clone());
414  }
415  if (add.fQuadrantRQ0) {
416  if (fQuadrantRQ0) fQuadrantRQ0->Add(*(add.fQuadrantRQ0));
417  if (!fQuadrantRQ0) fQuadrantRQ0 = (TVectorD*)(add.fQuadrantRQ0->Clone());
418  }
419  //
420  if (add.fQuadrantQ1) {
421  if (fQuadrantQ1) fQuadrantQ1->Add(*(add.fQuadrantQ1));
422  if (!fQuadrantQ1) fQuadrantQ1 = (TVectorD*)(add.fQuadrantQ1->Clone());
423  }
424  if (add.fQuadrantRQ1) {
425  if (fQuadrantRQ1) fQuadrantRQ1->Add(*(add.fQuadrantRQ1));
426  if (!fQuadrantRQ1) fQuadrantRQ1 = (TVectorD*)(add.fQuadrantRQ1->Clone());
427  }
428  //
429  if (add.fQuadrantQ2) {
430  if (fQuadrantQ2) fQuadrantQ2->Add(*(add.fQuadrantQ2));
431  if (!fQuadrantQ2) fQuadrantQ2 = (TVectorD*)(add.fQuadrantQ2->Clone());
432  }
433  if (add.fQuadrantRQ2) {
434  if (fQuadrantRQ2) fQuadrantRQ2->Add(*(add.fQuadrantRQ2));
435  if (!fQuadrantRQ2) fQuadrantRQ2 = (TVectorD*)(add.fQuadrantRQ2->Clone());
436  }
437  //
438  // Global alignment - use native ROOT representation
439  //
440  if (add.fMatrixGlobal){
441  if (!fMatrixGlobal) fMatrixGlobal = new TGeoHMatrix(*(add.fMatrixGlobal));
442  if (fMatrixGlobal) ((TGeoHMatrix*)fMatrixGlobal)->Multiply(add.fMatrixGlobal);
443  }
444  if (add.fArraySector){
446  }else{
447  for (Int_t isec=0; isec<72; isec++){
448  TGeoHMatrix *mat0= (TGeoHMatrix*)fArraySector->At(isec);
449  TGeoHMatrix *mat1= (TGeoHMatrix*)add.fArraySector->At(isec);
450  if (mat0&&mat1) mat0->Multiply(mat1);
451  }
452  }
453  }
454 }
455 
456 
461 
462  AliCDBEntry * entry = AliCDBManager::Instance()->Get("TPC/Align/Data");
463  if (!entry){
464  printf("Missing alignmnet entry. OCDB not initialized?\n");
465  return 0;
466  }
467  TClonesArray * array = (TClonesArray*)entry->GetObject();
468  Int_t entries = array->GetEntries();
469  TGeoHMatrix matrixGlobal;
470  TObjArray *alignArrayOCDB= new TObjArray(73); // sector misalignment + global misalignment
471  // // global is number 72
472  //
473  { for (Int_t i=0;i<entries; i++){
474  //
475  //
476  TGeoHMatrix matrix;
477  AliAlignObjParams *alignP = (AliAlignObjParams*)array->UncheckedAt(i);
478  alignP->GetMatrix(matrix);
479  Int_t imod;
480  AliGeomManager::ELayerID ilayer;
481  alignP->GetVolUID(ilayer, imod);
482  if (ilayer==AliGeomManager::kInvalidLayer) {
483  alignArrayOCDB->AddAt(matrix.Clone(),72);
484  alignP->GetMatrix(matrixGlobal);
485  }else{
486  Int_t sector=imod;
487  if (ilayer==AliGeomManager::kTPC2) sector+=36;
488  alignArrayOCDB->AddAt(matrix.Clone(),sector);
489  }
490  }
491  }
493  align->SetAlignGlobal(&matrixGlobal);
494  align->SetAlignSectors(alignArrayOCDB);
495  return align;
496 }
497 
498 
505 
506  TObjArray * array = alignIn->GetAlignSectors();
507  TObjArray * arrayNew = new TObjArray(72);
508  //
509  //Get mean transformation
510  TGeoHMatrix matrix;
511  {for (Int_t isec=0; isec<72; isec++){
512  const TGeoMatrix* cmatrix=(TGeoMatrix*)array->At(isec);
513  if (!cmatrix) continue;
514  matrix.Multiply(cmatrix);
515  }}
516  TGeoHMatrix matrixMean(matrix);
517  matrixMean.SetDx(matrix.GetTranslation()[0]/72.);
518  matrixMean.SetDy(matrix.GetTranslation()[1]/72.);
519  matrixMean.SetDz(matrix.GetTranslation()[2]/72.);
520  Double_t rotation[12];
521  {for (Int_t i=0; i<12; i++) {
522  rotation[i]=1.0;
523  if (TMath::Abs(matrix.GetRotationMatrix()[i]-1.)>0.1){
524  rotation[i]=matrix.GetRotationMatrix()[i]/72.;
525  }
526  }}
527  matrixMean.SetRotation(rotation);
528  TGeoHMatrix matrixInv = matrixMean.Inverse();
529  //
530  {for (Int_t isec=0; isec<72; isec++){
531  TGeoHMatrix* amatrix=(TGeoHMatrix*)(array->At(isec)->Clone());
532  if (!amatrix) continue;
533  amatrix->Multiply(&matrixInv);
534  arrayNew->AddAt(amatrix,isec);
535  }}
536  if (alignIn->GetAlignGlobal()) matrixMean.Multiply((alignIn->GetAlignGlobal()));
538  alignOut->SetAlignGlobal(&matrixMean);
539  alignOut->SetAlignSectors(arrayNew);
540  /*
541  Checks transformation:
542  AliTPCCalibGlobalMisalignment * alignIn = AliTPCCalibGlobalMisalignment::CreateOCDBAlign()
543  AliTPCCalibGlobalMisalignment * alignOut = AliTPCCalibGlobalMisalignment::CreateMeanAlign(alignIn)
544  alignOutM= (AliTPCCalibGlobalMisalignment*)alignOut->Clone();
545  alignOutS= (AliTPCCalibGlobalMisalignment*)alignOut->Clone();
546  alignOutS->SetAlignGlobal(0);
547  alignOutM->SetAlignSectors(0);
548  //
549  AliTPCCorrection::AddVisualCorrection(alignOut,0);
550  AliTPCCorrection::AddVisualCorrection(alignOutM,1);
551  AliTPCCorrection::AddVisualCorrection(alignOutS,2);
552  AliTPCCorrection::AddVisualCorrection(alignIn,3);
553 
554  TF1 f0("f0","AliTPCCorrection::GetCorrSector(x,85,0.9,1,0)",0,18);
555  TF1 f1("f1","AliTPCCorrection::GetCorrSector(x,85,0.9,1,1)",0,18);
556  TF1 f2("f2","AliTPCCorrection::GetCorrSector(x,85,0.9,1,2)",0,18);
557  TF1 f3("f3","AliTPCCorrection::GetCorrSector(x,85,0.9,1,3)",0,18);
558  f0->SetLineColor(1);
559  f1->SetLineColor(2);
560  f2->SetLineColor(3);
561  f3->SetLineColor(4);
562  f0->Draw();
563  f1->Draw("same");
564  f2->Draw("same");
565  f3->Draw("same");
566 
567  TF2 f2D("f2D","AliTPCCorrection::GetCorrSector(x,y,0.9,1,0)-AliTPCCorrection::GetCorrSector(x,y,0.9,1,3)",0,18,85,245);
568  */
569  return alignOut;
570 }
571 
572 
575 
576  TObjArray * array = align->GetAlignSectors();
577  if (!array) return;
578  //
579  //Get mean transformation
580  TGeoHMatrix matrix;
581  {for (Int_t isec=0; isec<72; isec++){
582  TGeoHMatrix* cmatrix=(TGeoHMatrix*)array->At(isec);
583  TGeoHMatrix* cmatrixDown=(TGeoHMatrix*)array->At(isec%36);
584  TGeoHMatrix* cmatrixUp=(TGeoHMatrix*)array->At(isec%36+36);
585  TGeoHMatrix diff(*cmatrixDown);
586  diff.Multiply(&(cmatrixUp->Inverse()));
587  (*pcstream)<<name<<
588  "isec="<<isec<<
589  "m0.="<<cmatrix<<
590  "diff.="<<&diff<<
591  "\n";
592  }
593  }
594 
595 }
void AddAlign(const AliTPCCalibGlobalMisalignment &add)
static AliTPCCalibGlobalMisalignment * CreateMeanAlign(const AliTPCCalibGlobalMisalignment *alignIn)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
Float_t fRotPhiC
simple rotation of C side read-out plane around the Z axis [rad]
TObjArray * fArraySector
local Alignmnet Sector
void SetQuadranAlign(const TVectorD *quadrantQ0, const TVectorD *quadrantRQ0, const TVectorD *quadrantQ1, const TVectorD *quadrantRQ1, const TVectorD *quadrantQ2, const TVectorD *quadrantRQ2)
#define TObjArray
AliTPCcalibAlign align
Definition: CalibAlign.C:43
Float_t fYShift
Shift in global Y [cm].
UInt_t GetNRows(UInt_t sector) const
Definition: AliTPCROC.h:28
virtual void GetCorrection(const Float_t x[], const Short_t roc, Float_t dx[])
TMatrixD mat
Definition: AnalyzeLaser.C:9
Float_t fXShift
Shift in global X [cm].
TTreeSRedirector * pcstream
TVectorD * fQuadrantQ1
OROC long pads -delta ly+ - ly - shift.
virtual void Print(Option_t *option="") const
TObjArray * array
Definition: AnalyzeLaser.C:12
AliTPCCorrection class.
TVectorD * fQuadrantQ2
OROC long pads -shift.
static void DumpAlignment(AliTPCCalibGlobalMisalignment *align, TTreeSRedirector *pcstream, const char *name)
void SetAlignSectors(const TObjArray *arraySector)
Float_t GetPadRowRadiiUp(UInt_t irow) const
Definition: AliTPCROC.h:55
Geometry class for a single ROC.
Definition: AliTPCROC.h:14
TGeoMatrix * fMatrixGlobal
global Alignment common
Float_t fdRPhiOffsetA
add a constant offset of dRPhi (or local Y) in [cm]: purely for calibration purposes! ...
void SetAlignGlobalDelta(const TGeoMatrix *matrixGlobalDelta)
TGeoMatrix * fMatrixGlobalDelta
global Alignment common A side-C side
void SetAlignGlobal(const TGeoMatrix *matrixGlobal)
Float_t fZShift
Shift in global Z [cm].
virtual Bool_t AddCorrectionCompact(AliTPCCorrection *corr, Double_t weight)
Float_t fRotPhiA
simple rotation of A side read-out plane around the Z axis [rad]
static AliTPCROC * Instance()
Definition: AliTPCROC.cxx:34
TVectorD * fQuadrantRQ1
OROC long pads -delta ly+ - ly - rotation.
TVectorD * fQuadrantQ0
OROC medium pads -delta ly+ - ly - shift (cm)
Float_t GetPadRowRadii(UInt_t isec, UInt_t irow) const
Definition: AliTPCROC.h:56
static AliTPCCalibGlobalMisalignment * CreateOCDBAlign()
Float_t fdRPhiOffsetC
add a constant offset of dRPhi (or local Y) in [cm]: purely for calibration purposes! ...
TVectorD * fQuadrantRQ0
OROC medium pads -delta ly+ - ly - rotation (rad)
TVectorD * fQuadrantRQ2
OROC long pads -rotation.