53 #include "TGeoGlobalMagField.h"
78 for (Int_t i=0; i<6; i++){
79 fInitLookUpBasic[i]= kFALSE;
83 for (Int_t i=0; i<36; i++){
84 fRodVoltShiftA[i] = 0;
85 fRodVoltShiftC[i] = 0;
87 for (Int_t i=0; i<2; i++){
88 fRotatedClipVoltA[i] = 0;
89 fRotatedClipVoltC[i] = 0;
92 for (Int_t i=0; i<36; i++){
93 fCopperRodShiftA[i] = 0;
94 fCopperRodShiftC[i] = 0;
100 for ( Int_t k = 0 ; k < kNPhi ; k++ ) {
101 fLookUpErOverEz[k] =
new TMatrixF(kNR,kNZ);
102 fLookUpEphiOverEz[k] =
new TMatrixF(kNR,kNZ);
103 fLookUpDeltaEz[k] =
new TMatrixF(kNR,kNZ);
106 for ( Int_t k = 0 ; k < kPhiSlices ; k++ ) {
107 fLookUpBasic1ErOverEz[k] = 0;
108 fLookUpBasic1EphiOverEz[k] = 0;
109 fLookUpBasic1DeltaEz[k] = 0;
111 fLookUpBasic2ErOverEz[k] = 0;
112 fLookUpBasic2EphiOverEz[k] = 0;
113 fLookUpBasic2DeltaEz[k] = 0;
115 fLookUpBasic3ErOverEz[k] = 0;
116 fLookUpBasic3EphiOverEz[k] = 0;
117 fLookUpBasic3DeltaEz[k] = 0;
119 fLookUpBasic4ErOverEz[k] = 0;
120 fLookUpBasic4EphiOverEz[k] = 0;
121 fLookUpBasic4DeltaEz[k] = 0;
123 fLookUpBasic5ErOverEz[k] = 0;
124 fLookUpBasic5EphiOverEz[k] = 0;
125 fLookUpBasic5DeltaEz[k] = 0;
127 fLookUpBasic6ErOverEz[k] = 0;
128 fLookUpBasic6EphiOverEz[k] = 0;
129 fLookUpBasic6DeltaEz[k] = 0;
137 for ( Int_t k = 0 ; k <
kNPhi ; k++ ) {
179 AliError(
"Zerro pointer - correction");
184 AliError(TString::Format(
"Inconsistent class types: %s\%s",IsA()->GetName(),corr->IsA()->GetName()).Data());
188 for (Int_t isec=0; isec<36; isec++){
194 for (Int_t isec=0; isec<2; isec++){
207 AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
208 if (!magF) AliError(
"Magneticd field - not initialized");
209 Double_t bzField = magF->SolenoidField()/10.;
211 if (!param) AliError(
"Parameters - not initialized");
213 Double_t ezField = 400;
214 Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
224 AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
225 if (!magF) AliError(
"Magneticd field - not initialized");
226 Double_t bzField = magF->SolenoidField()/10.;
228 if (!param) AliError(
"Parameters - not initialized");
230 Double_t ezField = 400;
231 Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
243 const Double_t
kEpsilon=Double_t(FLT_MIN);
246 AliInfo(
"Lookup table was not initialized! Perform the inizialisation now ...");
250 static Bool_t forceInit=kTRUE;
261 Float_t intEr, intEphi, intDeltaEz;
265 r = TMath::Sqrt( x[0]*x[0] + x[1]*x[1] ) ;
266 phi = TMath::ATan2(x[1],x[0]) ;
267 if ( phi < 0 ) phi += TMath::TwoPi() ;
270 if ( (roc%36) < 18 ) {
280 if ( (sign==1 && z<0) || (sign==-1 && z>0) )
281 AliError(
"ROC number does not correspond to z coordinate! Calculation of distortions is most likely wrong!");
295 phi = phi + (
fC0*intEphi -
fC1*intEr ) / r;
296 r = r + (
fC0*intEr +
fC1*intEphi );
300 dx[0] = r * TMath::Cos(phi) - x[0];
301 dx[1] = r * TMath::Sin(phi) - x[1];
313 const Int_t order = 1 ;
329 philist[k] = gridSizePhi * k;
330 for ( Int_t i = 0 ; i <
kRows ; i++ ) {
332 for ( Int_t j = 0 ; j <
kColumns ; j++ ) {
333 zedlist[j] = j * gridSizeZ ;
342 const Int_t symmetry[6] = {1,1,-1,-1,1,1};
346 Bool_t needTable[6] ={kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE};
349 for ( Int_t rod = 0 ; rod < 18 ; rod++ ) {
353 for ( Int_t rod = 18 ; rod < 36 ; rod++ ) {
362 for ( Int_t rod = 0 ; rod < 18 ; rod++ ) {
367 for ( Int_t rod = 18; rod < 36 ; rod++ ) {
425 for (Int_t look=0; look<6; look++) {
427 Float_t inner18[18] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ;
428 Float_t outer18[18] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ;
435 AliInfo(Form(
"IFC - ROD&Strip shift : Filling table (~ %d sec)",3*(
int)(kPhiSlices/5)));
437 }
else if (look==1) {
438 AliInfo(Form(
"OFC - ROD&Strip shift : Filling table (~ %d sec)",3*(
int)(kPhiSlices/5)));
440 }
else if (look==2) {
441 AliInfo(Form(
"IFC - Clip rot. : Filling table (~ %d sec)",3*(
int)(kPhiSlices/5)));
443 }
else if (look==3) {
444 AliInfo(Form(
"OFC - Clip rot. : Filling table (~ %d sec)",3*(
int)(kPhiSlices/5)));
446 }
else if (look==4) {
447 AliInfo(Form(
"IFC - CopperRod shift : Filling table (~ %d sec)",3*(
int)(kPhiSlices/5)));
449 }
else if (look==5) {
450 AliInfo(Form(
"OFC - CopperRod shift : Filling table (~ %d sec)",3*(
int)(kPhiSlices/5)));
458 Int_t ipoint = k/slices ;
459 innerList[k] = (((ipoint+1)*slices-k)*inner18[ipoint]-(k-ipoint*slices)*inner18[ipoint+1])/slices ;
460 outerList[k] = (((ipoint+1)*slices-k)*outer18[ipoint]-(k-ipoint*slices)*outer18[ipoint+1])/slices ;
461 if ( (k%slices) == 0 && symmetry[look] == -1 ) { innerList[k] = 0.0 ; outerList[k] = 0.0 ; }
468 innerList[k] = outerList[k] = 0;
469 innerList[0] = inner18[0];
470 innerList[0] = inner18[0]/4*3;
475 innerList[k] = outerList[k] = 0;
476 outerList[0] = outer18[0];
477 outerList[1] = outer18[0]/4;
482 TMatrixD &arrayV = *arrayofArrayV[k] ;
483 TMatrixD &charge = *arrayofCharge[k] ;
484 for ( Int_t i = 0 ; i <
kRows ; i++ ) {
485 for ( Int_t j = 0 ; j <
kColumns ; j++ ) {
488 if ( i == 0 ) arrayV(i,j) = innerList[k] ;
489 if ( i == kRows-1 ) arrayV(i,j) = outerList[k] ;
493 for ( Int_t i = 1 ; i < kRows-1 ; i++ ) {
494 for ( Int_t j = 1 ; j <
kColumns-1 ; j++ ) {
506 AliInfo(
"IFC - ROD&Strip shift : done ");
507 }
else if (look==1) {
512 AliInfo(
"OFC - ROD&Strip shift : done ");
513 }
else if (look==2) {
517 AliInfo(
"IFC - Clip rot. : done ");
518 }
else if (look==3) {
522 AliInfo(
"OFC - Clip rot. : done ");
523 }
else if (look==4) {
527 AliInfo(
"IFC - CopperRod shift : done ");
528 }
else if (look==5) {
532 AliInfo(
"OFC - CopperRod shift : done ");
543 Float_t erIntegralSum = 0.0 ;
544 Float_t ephiIntegralSum = 0.0 ;
545 Float_t ezIntegralSum = 0.0 ;
547 Double_t phiPrime = 0. ;
548 Double_t erIntegral = 0. ;
549 Double_t ephiIntegral = 0. ;
550 Double_t ezIntegral = 0. ;
553 AliInfo(
"Calculation of combined Look-up Table");
557 for ( Int_t k = 0 ; k <
kNPhi ; k++ ) {
564 for ( Int_t i = 0 ; i <
kNZ ; i++ ) {
566 for ( Int_t j = 0 ; j <
kNR ; j++ ) {
570 erIntegralSum = 0.0 ;
571 ephiIntegralSum = 0.0 ;
572 ezIntegralSum = 0.0 ;
577 for ( Int_t rod = 0 ; rod < 18 ; rod++ ) {
579 erIntegral = ephiIntegral = ezIntegral = 0.0 ;
587 if ( phiPrime < 0 ) phiPrime += TMath::TwoPi() ;
589 if ( (phiPrime >= 0) && (phiPrime <= kPhiSlices*gridSizePhi) ) {
598 }
else if ( (phiPrime <= TMath::TwoPi()) && (phiPrime >= (TMath::TwoPi()-kPhiSlices*gridSizePhi)) ){
600 phiPrime = TMath::TwoPi() - phiPrime ;
610 if ( symmetry[0] == 1 ) ephiIntegral *= -1 ;
612 if ( symmetry[0] == -1 ) erIntegral *= -1 ;
628 for ( Int_t rod = 18 ; rod < 36 ; rod++ ) {
630 erIntegral = ephiIntegral = ezIntegral = 0.0 ;
638 if ( phiPrime < 0 ) phiPrime += TMath::TwoPi() ;
640 if ( (phiPrime >= 0) && (phiPrime <= kPhiSlices*gridSizePhi) ) {
649 }
else if ( (phiPrime <= TMath::TwoPi()) && (phiPrime >= (TMath::TwoPi()-kPhiSlices*gridSizePhi)) ){
651 phiPrime = TMath::TwoPi() - phiPrime ;
661 if ( symmetry[1] == 1 ) ephiIntegral *= -1 ;
663 if ( symmetry[1] == -1 ) erIntegral *= -1 ;
687 for ( Int_t rod = rodIFC ; rod < rodIFC+1 ; rod++ ) {
689 erIntegral = ephiIntegral = ezIntegral = 0.0 ;
696 if ( phiPrime < 0 ) phiPrime += TMath::TwoPi() ;
698 if ( (phiPrime >= 0) && (phiPrime <= kPhiSlices*gridSizePhi) ) {
707 }
else if ( (phiPrime <= TMath::TwoPi()) && (phiPrime >= (TMath::TwoPi()-kPhiSlices*gridSizePhi)) ){
709 phiPrime = TMath::TwoPi() - phiPrime ;
719 if ( symmetry[2] == 1 ) ephiIntegral *= -1 ;
721 if ( symmetry[2] == -1 ) erIntegral *= -1 ;
737 for ( Int_t rod = rodOFC ; rod < rodOFC+1 ; rod++ ) {
739 erIntegral = ephiIntegral = ezIntegral = 0.0 ;
748 if ( phiPrime < 0 ) phiPrime += TMath::TwoPi() ;
750 if ( (phiPrime >= 0) && (phiPrime <= kPhiSlices*gridSizePhi) ) {
759 }
else if ( (phiPrime <= TMath::TwoPi()) && (phiPrime >= (TMath::TwoPi()-kPhiSlices*gridSizePhi)) ){
761 phiPrime = TMath::TwoPi() - phiPrime ;
771 if ( symmetry[3] == 1 ) ephiIntegral *= -1 ;
773 if ( symmetry[3] == -1 ) erIntegral *= -1 ;
789 for ( Int_t rod = 0 ; rod < 18 ; rod++ ) {
791 erIntegral = ephiIntegral = ezIntegral = 0.0 ;
799 if ( phiPrime < 0 ) phiPrime += TMath::TwoPi() ;
801 if ( (phiPrime >= 0) && (phiPrime <= kPhiSlices*gridSizePhi) ) {
810 }
else if ( (phiPrime <= TMath::TwoPi()) && (phiPrime >= (TMath::TwoPi()-kPhiSlices*gridSizePhi)) ){
812 phiPrime = TMath::TwoPi() - phiPrime ;
822 if ( symmetry[4] == 1 ) ephiIntegral *= -1 ;
824 if ( symmetry[4] == -1 ) erIntegral *= -1 ;
840 for ( Int_t rod = 18 ; rod < 36 ; rod++ ) {
842 erIntegral = ephiIntegral = ezIntegral = 0.0 ;
850 if ( phiPrime < 0 ) phiPrime += TMath::TwoPi() ;
852 if ( (phiPrime >= 0) && (phiPrime <= kPhiSlices*gridSizePhi) ) {
861 }
else if ( (phiPrime <= TMath::TwoPi()) && (phiPrime >= (TMath::TwoPi()-kPhiSlices*gridSizePhi)) ){
863 phiPrime = TMath::TwoPi() - phiPrime ;
873 if ( symmetry[5] == 1 ) ephiIntegral *= -1 ;
875 if ( symmetry[5] == -1 ) erIntegral *= -1 ;
891 erOverEz(j,i) = erIntegralSum;
892 ephiOverEz(j,i) = ephiIntegralSum;
893 deltaEz(j,i) = ezIntegralSum;
904 delete arrayofArrayV[k];
905 delete arrayofCharge[k];
917 TString opt = option; opt.ToLower();
918 printf(
"%s\n",GetTitle());
919 printf(
" - ROD shifts (residual voltage settings): 40V correspond to 1mm of shift\n");
921 printf(
" : A-side - (Rod & Strips) \n ");
922 for (Int_t i=0; i<36;i++) {
928 printf(
"-> all at 0 V\n");
934 printf(
" : C-side - (Rod & Strips) \n ");
935 for (Int_t i=0; i<36;i++) {
941 printf(
"-> all at 0 V\n");
948 printf(
" - Rotated clips (residual voltage settings): 40V correspond to 1mm of 'offset'\n");
954 printf(
" -> no rotated clips \n");
957 printf(
" - Copper ROD shifts (without strips):\n");
958 printf(
" : A-side - (Copper Rod shift) \n ");
959 for (Int_t i=0; i<36;i++) {
965 printf(
"-> all at 0 V\n");
971 printf(
" : C-side - (Copper Rod shift) \n ");
972 for (Int_t i=0; i<36;i++) {
978 printf(
"-> all at 0 V\n");
985 if (opt.Contains(
"a")) {
990 if (!
fInitLookUp) AliError(
"Lookup table was not initialized! You should do InitFCVoltError3D() ...");
static AliTPCcalibDB * Instance()
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TMatrixD * fLookUpBasic6EphiOverEz[kPhiSlices]
! Array to store electric field integral
Double_t fgkZList[kNZ]
points in the z direction (for the lookup table)
Float_t fRodVoltShiftC[36]
Rod (&strips) shift in Volt (40V~1mm)
AliTPCFCVoltError3D class.
TMatrixD * fLookUpBasic5DeltaEz[kPhiSlices]
! Array to store electric field integral
TMatrixD * fLookUpBasic3DeltaEz[kPhiSlices]
! Array to store electric field integral
virtual ~AliTPCFCVoltError3D()
virtual void SetOmegaTauT1T2(Float_t omegaTau, Float_t t1, Float_t t2)
Manager and of geomety classes for set: TPC.
Float_t GetDriftV() const
Double_t Interpolate3DTable(Int_t order, Double_t x, Double_t y, Double_t z, Int_t nx, Int_t ny, Int_t nz, const Double_t xv[], const Double_t yv[], const Double_t zv[], TMatrixD **arrayofArrays)
TMatrixD * fLookUpBasic2EphiOverEz[kPhiSlices]
! Array to store electric field integral
virtual void Print(const Option_t *option="") const
TMatrixD * fLookUpBasic6DeltaEz[kPhiSlices]
! Array to store electric field integral
Float_t fRotatedClipVoltA[2]
rotated clips at HV rod
static const Double_t fgkOFCRadius
Mean Radius of the Outer Field Cage (252.55 min, 256.45 max) (cm)
AliTPCParam * GetParameters() const
virtual Bool_t AddCorrectionCompact(AliTPCCorrection *corr, Double_t weight)
Float_t fCopperRodShiftC[36]
only Rod shift
virtual void GetCorrection(const Float_t x[], const Short_t roc, Float_t dx[])
Double_t fT1
tensor term of wt - T1
static const Double_t fgkZOffSet
Offset from CE: calculate all distortions closer to CE as if at this point.
TMatrixD * fLookUpBasic3EphiOverEz[kPhiSlices]
! Array to store electric field integral
TMatrixD * fLookUpBasic3ErOverEz[kPhiSlices]
! Array to store electric field integral
TMatrixD * fLookUpBasic4EphiOverEz[kPhiSlices]
! Array to store electric field integral
virtual void Update(const TTimeStamp &timeStamp)
TMatrixD * fLookUpBasic6ErOverEz[kPhiSlices]
! Array to store electric field integral
static const Double_t fgkTPCZ0
nominal gating grid position
Float_t fRotatedClipVoltC[2]
rotated clips at HV rod
TMatrixD * fLookUpBasic4ErOverEz[kPhiSlices]
! Array to store electric field integral
Bool_t fInitLookUpBasic[6]
! flag if the basic lookup was created (shifted Rod (IFC,OFC) or rotated clip (IFC,OFC))
Bool_t fInitLookUp
flag to check if the Look Up table was created (SUM)
TMatrixF * fLookUpEphiOverEz[kNPhi]
Array to store electric field integral (int Er/Ez)
void PoissonRelaxation3D(TMatrixD **arrayofArrayV, TMatrixD **arrayofChargeDensities, TMatrixD **arrayofEroverEz, TMatrixD **arrayofEPhioverEz, TMatrixD **arrayofEz, Int_t rows, Int_t columns, Int_t phislices, Float_t deltaphi, Int_t iterations, Int_t summetry, Bool_t rocDisplacement=kTRUE)
Float_t fCopperRodShiftA[36]
only Rod shift
TMatrixD * fLookUpBasic5ErOverEz[kPhiSlices]
! Array to store electric field integral
void ForceInitFCVoltError3D()
TMatrixD * fLookUpBasic2ErOverEz[kPhiSlices]
! Array to store electric field integral
TMatrixD * fLookUpBasic2DeltaEz[kPhiSlices]
! Array to store electric field integral
TMatrixD * fLookUpBasic1DeltaEz[kPhiSlices]
! Array to store electric field integral (int Ez)
TMatrixD * fLookUpBasic1ErOverEz[kPhiSlices]
! Array to store electric field integral (int Er/Ez)
Float_t fRodVoltShiftA[36]
Rod (&strips) shift in Volt (40V~1mm)
Float_t fC1
coefficient C1 (compare Jim Thomas's notes for definitions)
Double_t fgkPhiList[kNPhi]
points in the phi direction (for the lookup table)
Double_t fT2
tensor term of wt - T2
Double_t fgkRList[kNR]
points in the radial direction (for the lookup table)
TMatrixD * fLookUpBasic1EphiOverEz[kPhiSlices]
! Array to store electric field integral (int Ephi/Ez)
TMatrixF * fLookUpDeltaEz[kNPhi]
Array to store electric field integral (int Er/Ez)
TMatrixF * fLookUpErOverEz[kNPhi]
Array to store electric field integral (int Er/Ez)
TMatrixD * fLookUpBasic4DeltaEz[kPhiSlices]
! Array to store electric field integral
Float_t fC0
coefficient C0 (compare Jim Thomas's notes for definitions)
static const Double_t fgkIFCRadius
Mean Radius of the Inner Field Cage ( 82.43 min, 83.70 max) (cm)
TMatrixD * fLookUpBasic5EphiOverEz[kPhiSlices]
! Array to store electric field integral