Adding more "primitive" corrections needed for
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Oct 2010 11:42:27 +0000 (11:42 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Oct 2010 11:42:27 +0000 (11:42 +0000)
for fitting routines

(Marian)

TPC/CalibMacros/RegisterCorrection.C

index 848a1ab..2e31e5d 100644 (file)
@@ -16,7 +16,8 @@
   RegisterAliTPCCalibGlobalMisalignment();      - Reserved id's  200-499
   RegisterAliTPCExBBShape();                    - Reserved id's  500-600
   RegisterAliTPCExBTwist();                     - Reserved id's  600-700
-  
+  RegisterAliTPCROCVoltError3D()                - Reserved id's  700-800
+  RegisterAliTPCROCVoltError3DSector()          - Reserved id's  800-900
   .x ~/rootlogon.C
   .L $ALICE_ROOT/TPC/CalibMacros/RegisterCorrection.C+
   RegisterCorrection();
@@ -55,6 +56,7 @@
 #include "TGraphErrors.h"
 #include  "AliTrackerBase.h"
 #include  "TGeoGlobalMagField.h"
+#include  "TROOT.h"
 #endif
 
 
@@ -76,9 +78,32 @@ AliTPCFCVoltError3D *rodIFCSin=0;       //common IFC shift -sinus
 AliTPCFCVoltError3D *rodOFCSin=0;       //common OFC shift -sinus
 AliTPCFCVoltError3D *rodIFCCos=0;       //common IFC shift -cos
 AliTPCFCVoltError3D *rodOFCCos=0;       //common OFC shift -cos
+
+AliTPCROCVoltError3D *rocRotgXA=0;     // roc rotation A side - inclination in X
+AliTPCROCVoltError3D *rocRotgYA=0;     // roc rotation A side - inclination in Y
+AliTPCROCVoltError3D *rocRotgXC=0;     // roc rotation C side - inclination in X
+AliTPCROCVoltError3D *rocRotgYC=0;     // roc rotation C side - inclination in Y
+AliTPCROCVoltError3D *rocDzIROCA=0;      // roc shift A side - in Z
+AliTPCROCVoltError3D *rocDzIROCC=0;      // roc shift C side - in Z
+AliTPCROCVoltError3D *rocRotIROCA=0;      // roc rotation A side - in Z
+AliTPCROCVoltError3D *rocRotIROCC=0;      // roc rotation C side - in Z
+//
+AliTPCROCVoltError3D *rocShiftIROCA0=0;      // IROC shift A0 side
+AliTPCROCVoltError3D *rocRotIROCA0=0;        // IROC rot   A0 side
+AliTPCROCVoltError3D *rocShiftOROCA0=0;      // OROC shift A0 side
+AliTPCROCVoltError3D *rocRotOROCA0=0;        // OROC rot   A0 side
+AliTPCROCVoltError3D *rocShiftIROCC0=0;      // IROC shift C0 side
+AliTPCROCVoltError3D *rocRotIROCC0=0;        // IROC rot   C0 side
+AliTPCROCVoltError3D *rocShiftOROCC0=0;      // OROC shift C0 side
+AliTPCROCVoltError3D *rocRotOROCC0=0;        // OROC rot   C0 side
+//
+//
+//
 AliTPCBoundaryVoltError *boundaryVoltErrorA[8];  // boundary voltage error A side
 AliTPCBoundaryVoltError *boundaryVoltErrorC[8];  // boundary voltage error C side
-AliTPCExBBShape *exbShape  = 0;
+AliTPCExBBShape *exbShape     = 0;               // nominal correctin
+AliTPCExBBShape *exbShapeT1X  = 0;               // nominal +deltaT1=0.1
+AliTPCExBBShape *exbShapeT2X  = 0;               // nominal +deltaT2=0.1
 AliTPCExBTwist  *twistX    = 0;
 AliTPCExBTwist  *twistY    = 0;
 //
@@ -97,19 +122,29 @@ void RegisterAliTPCCalibGlobalMisalignment();
 void RegisterAliTPCBoundaryVoltError();
 void RegisterAliTPCExBShape();
 void RegisterAliTPCExBTwist();
+void RegisterAliTPCROCVoltError3D();
+void RegisterAliTPCROCVoltError3DSector();
+//
 
-void RegisterCorrection(){
+void RegisterCorrection(Int_t type=0){
   //
   //
   //
   // check the presence of corrections in file
   //
+  gROOT->Macro("ConfigCalibTrain.C(119037)");
+  //
+  //
+  if (type==1) return RegisterAliTPCROCVoltError3D();
+  if (type==2) return RegisterAliTPCROCVoltError3DSector();
   fCorrections = new TFile("TPCCorrectionPrimitives.root");
-  AliTPCComposedCorrection *corrField3D = (AliTPCComposedCorrection*) fCorrections->Get("TPCFCVoltError3D");    
+  AliTPCComposedCorrection *corrField3D = (AliTPCComposedCorrection*) fCorrections->Get("TPCFCVoltError3D");
   // if not make new file
   if (!corrField3D) fCorrections = new TFile("TPCCorrectionPrimitives.root","update");
-  //
-  //
+  if (type==0) {
+    RegisterAliTPCROCVoltError3D();
+    RegisterAliTPCROCVoltError3DSector();
+  }
   RegisterAliTPCCalibGlobalMisalignment();
   RegisterAliTPCBoundaryVoltError();
   RegisterAliTPCFCVoltError3D();
@@ -359,8 +394,20 @@ void RegisterAliTPCCalibGlobalMisalignment(){
 void RegisterAliTPCBoundaryVoltError(){
   //
   // Register phi symetric E filed distortions
+  // 100-108 - A side 0 Field  
+  // 110-118 - C side 0 Field  
+  // 120-128 - A side +0.5 Field  
+  // 130-138 - C side +0.5 Field  
+  // 140-148 - A side -0.5 Field  
+  // 150-158 - C side -0.5 Field  
   //
-  //
+  Double_t vdrift = 2.64; // [cm/us]   // to be updated: per second (ideally)
+  Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
+  Double_t T1 = 1.0;
+  Double_t T2 = 1.0;
+  Double_t wtP = -10.0 * (0.5*10) * vdrift /  ezField ; 
+  Double_t wtM = -10.0 * (0.5*10) * vdrift / -ezField ; 
+
   printf("RegisterAliTPCBoundaryVoltError()\n");
   AliTPCComposedCorrection *corrField2D = (AliTPCComposedCorrection*) fCorrections->Get("TPCFCVoltError2D");    
   //
@@ -416,10 +463,33 @@ void RegisterAliTPCBoundaryVoltError(){
     for (Int_t ipar=0; ipar<8; ipar++){
       boundaryVoltErrorA[ipar] = (AliTPCBoundaryVoltError*) array->At(ipar);
       boundaryVoltErrorC[ipar] = (AliTPCBoundaryVoltError*) array->At(ipar+8);      
-      if (boundaryVoltErrorA[ipar]) AliTPCCorrection::AddVisualCorrection(boundaryVoltErrorA[ipar], 40+ipar); 
-      if (boundaryVoltErrorC[ipar]) AliTPCCorrection::AddVisualCorrection(boundaryVoltErrorC[ipar], 50+ipar);     
     }
   }
+  //
+  // Register correction
+  for (Int_t ipar=0; ipar<8; ipar++){
+    AliTPCCorrection::AddVisualCorrection(boundaryVoltErrorA[ipar], 100+ipar); 
+    AliTPCCorrection::AddVisualCorrection(boundaryVoltErrorC[ipar], 110+ipar);     
+    //
+    // correction for +-0.5 T setting
+    AliTPCCorrection *corrField =0; 
+    corrField=(AliTPCCorrection *)boundaryVoltErrorA[ipar]->Clone();
+    corrField->SetOmegaTauT1T2(wtP,T1,T2);
+    AliTPCCorrection::AddVisualCorrection(corrField,120+ipar);
+
+    corrField=(AliTPCCorrection *)boundaryVoltErrorC[ipar]->Clone();
+    corrField->SetOmegaTauT1T2(wtP,T1,T2);
+    AliTPCCorrection::AddVisualCorrection(corrField,130+ipar);
+
+    corrField=(AliTPCCorrection *)boundaryVoltErrorA[ipar]->Clone();
+    corrField->SetOmegaTauT1T2(wtM,T1,T2);
+    AliTPCCorrection::AddVisualCorrection(corrField,140+ipar);
+
+    corrField=(AliTPCCorrection *)boundaryVoltErrorC[ipar]->Clone();
+    corrField->SetOmegaTauT1T2(wtM,T1,T2);
+    AliTPCCorrection::AddVisualCorrection(corrField,150+ipar);
+  }
+  
 }
 
 
@@ -437,6 +507,20 @@ void RegisterAliTPCExBShape(){
   exbShape->SetOmegaTauT1T2(0,1.,1.);
   exbShape->Print();   
   AliTPCCorrection::AddVisualCorrection(exbShape,500); 
+  exbShapeT1X             = new AliTPCExBBShape;
+  exbShapeT1X->SetBField(magF);
+  exbShapeT1X->SetName("TPCExbShapeT1X");
+  exbShapeT1X->SetTitle("TPCExbShapeT1X");
+  exbShapeT1X->SetOmegaTauT1T2(0,1.2,1.);
+  exbShapeT1X->Print();   
+  AliTPCCorrection::AddVisualCorrection(exbShapeT1X,501); 
+  exbShapeT2X             = new AliTPCExBBShape;
+  exbShapeT2X->SetBField(magF);
+  exbShapeT2X->SetName("TPCExbShapeT2X");
+  exbShapeT2X->SetTitle("TPCExbShapeT2X");
+  exbShapeT2X->SetOmegaTauT1T2(0,1.0,1.2);
+  exbShapeT2X->Print();   
+  AliTPCCorrection::AddVisualCorrection(exbShapeT2X,502); 
 }
 
 
@@ -459,19 +543,522 @@ void RegisterAliTPCExBTwist(){
 }
 
 
+void RegisterAliTPCROCVoltError3D(){
+  //
+  // ROC rotation transformation
+  //       700 -709 - 0 field
+  //       710 -719 - +0.5 field
+  //       720 -729 - -0.5 field
+  Double_t vdrift = 2.64; // [cm/us]   // to be updated: per second (ideally)
+  Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
+  Double_t T1 = 1.0;
+  Double_t T2 = 1.0;
+  Double_t wtP = -10.0 * (0.5*10) * vdrift /  ezField ; 
+  Double_t wtM = -10.0 * (0.5*10) * vdrift / -ezField ; 
+
+  //
+  rocRotgXA=0;     // roc rotation A side - inclination in X
+  rocRotgYA=0;     // roc rotation A side - inclination in Y
+  rocRotgXC=0;     // roc rotation C side - inclination in X
+  rocRotgYC=0;     // roc rotation C side - inclination in Y
+  rocDzIROCA=0;      // roc shift A side - in Z
+  rocDzIROCC=0;      // roc shift C side - in Z
+  rocRotIROCA=0;      // roc rot IROC A side - in Z
+  rocRotIROCC=0;      // roc rot OROC C side - in Z
+ //
+  printf("RegisterAliTPCROCVoltError3D()");
+  Double_t kAngle=0.001;
+  // reference in lx
+  AliTPCROC * rocInfo = AliTPCROC::Instance();
+  Double_t lxRef  = (rocInfo->GetPadRowRadii(0,62)+rocInfo->GetPadRowRadii(36,0))/2;
+  //
+  TMatrixD matrix(72,3);
+  AliTPCComposedCorrection *corrField3D = 0;
+  TFile *fCorrectionsROC=0;
+  fCorrectionsROC = new TFile("TPCCorrectionPrimitivesROC.root");
+  corrField3D = ( AliTPCComposedCorrection *)fCorrectionsROC->Get("TPCROCVoltError3DRotationgXgY");
+  //
+  if (!corrField3D){
+    fCorrectionsROC = new TFile("TPCCorrectionPrimitivesROC.root","recreate");
+  }  
+  if (corrField3D) { // load from file
+    corrField3D->Print();
+    TCollection *iter = corrField3D->GetCorrections();
+   
+    rocRotgXA=(AliTPCROCVoltError3D*)iter->FindObject("rocRotgXA");    
+   
+    rocRotgYA=(AliTPCROCVoltError3D*)iter->FindObject("rocRotgYA");  
+   
+    rocRotgXC=(AliTPCROCVoltError3D*)iter->FindObject("rocRotgXC");  
+   
+    rocRotgYC=(AliTPCROCVoltError3D*)iter->FindObject("rocRotgYC");  
+    
+    rocDzIROCA=(AliTPCROCVoltError3D*)iter->FindObject("rocDzIROCA");  
+   
+    rocDzIROCC=(AliTPCROCVoltError3D*)iter->FindObject("rocDzIROCC");  
+
+    rocRotIROCA=(AliTPCROCVoltError3D*)iter->FindObject("rocRotIROCA");  
+   
+    rocRotIROCC=(AliTPCROCVoltError3D*)iter->FindObject("rocRotIROCC");  
+     
+  } else {
+    corrField3D = new AliTPCComposedCorrection;
+    rocRotgXA=new AliTPCROCVoltError3D;    
+    rocRotgYA=new AliTPCROCVoltError3D;  
+    rocRotgXC=new AliTPCROCVoltError3D;  
+    rocRotgYC=new AliTPCROCVoltError3D;  
+    rocDzIROCA=new AliTPCROCVoltError3D;  
+    rocDzIROCC=new AliTPCROCVoltError3D;  
+    rocRotIROCA=new AliTPCROCVoltError3D;  
+    rocRotIROCC=new AliTPCROCVoltError3D;  
+    //
+    for (Int_t isec=0; isec<72; isec++){
+      Double_t secAlpha = TMath::DegToRad()*(10.+20.*(((Int_t)isec)%18));
+      matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
+      if (isec%36<18){
+        matrix(isec,0) = kAngle*TMath::Cos(secAlpha)*lxRef;
+        matrix(isec,1) = kAngle*TMath::Cos(secAlpha);
+        matrix(isec,2) = -kAngle*TMath::Sin(secAlpha);
+      }
+    }
+    rocRotgXA->SetROCData(&matrix);
+    //
+    for (Int_t isec=0; isec<72; isec++){
+      Double_t secAlpha = TMath::DegToRad()*(10.+20.*(((Int_t)isec)%18));
+      matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
+      if (isec%36<18){
+        matrix(isec,0) = kAngle*TMath::Sin(secAlpha)*lxRef;
+        matrix(isec,1) = kAngle*TMath::Sin(secAlpha);
+        matrix(isec,2) = kAngle*TMath::Cos(secAlpha);
+      }
+    }
+    rocRotgYA->SetROCData(&matrix);
+    //
+    for (Int_t isec=0; isec<72; isec++){
+     Double_t secAlpha = TMath::DegToRad()*(10.+20.*(((Int_t)isec)%18));
+      matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
+      if (isec%36>=18){
+        matrix(isec,0) = kAngle*TMath::Cos(secAlpha)*lxRef;
+        matrix(isec,1) = kAngle*TMath::Cos(secAlpha);
+        matrix(isec,2) = -kAngle*TMath::Sin(secAlpha);
+      }
+    }
+    rocRotgXC->SetROCData(&matrix);
+    //
+    for (Int_t isec=0; isec<72; isec++){
+      Double_t secAlpha = TMath::DegToRad()*(10.+20.*(((Int_t)isec)%18));
+      matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
+      if (isec%36>=18){
+        matrix(isec,0) = kAngle*TMath::Sin(secAlpha)*lxRef;
+        matrix(isec,1) = kAngle*TMath::Sin(secAlpha);
+        matrix(isec,2) = kAngle*TMath::Cos(secAlpha);
+      }
+    }
+    rocRotgYC->SetROCData(&matrix);
+
+    //
+    //
+    for (Int_t isec=0; isec<72; isec++){
+      matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
+      if (isec<18){
+        matrix(isec,0) = 0.1;  // 1 mm 
+        matrix(isec,1) = 0;
+        matrix(isec,2) = 0;
+      }
+    }
+    rocDzIROCA->SetROCData(&matrix);
+    //
+    for (Int_t isec=0; isec<72; isec++){
+      matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
+      if (isec>=18 && isec<36){
+        matrix(isec,0) = 0.1;  // 1 mm 
+        matrix(isec,1) = 0;
+        matrix(isec,2) = 0;
+      }
+    }
+    rocDzIROCC->SetROCData(&matrix);
+    //
+    //
+    for (Int_t isec=0; isec<72; isec++){
+      matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
+      if (isec<18){
+        matrix(isec,0) = 0;   
+        matrix(isec,1) = kAngle;
+        matrix(isec,2) = 0;
+      }
+    }
+    rocRotIROCA->SetROCData(&matrix);
+    //
+    for (Int_t isec=0; isec<72; isec++){
+      matrix(isec,0)=0; matrix(isec,1)=0; matrix(isec,2)=0;
+      if (isec>=18 && isec<36){
+        matrix(isec,0) = 0;
+        matrix(isec,1) = kAngle;
+        matrix(isec,2) = 0;
+      }
+    }
+    rocRotIROCC->SetROCData(&matrix);
+
+
+    //
+    rocRotgXA->SetElectronArrivalCorrection(kFALSE);
+    rocRotgYA->SetElectronArrivalCorrection(kFALSE);
+    rocRotgXC->SetElectronArrivalCorrection(kFALSE);
+    rocRotgYC->SetElectronArrivalCorrection(kFALSE);
+    rocDzIROCA->SetElectronArrivalCorrection(kFALSE);
+    rocDzIROCC->SetElectronArrivalCorrection(kFALSE);
+    rocRotIROCA->SetElectronArrivalCorrection(kFALSE);
+    rocRotIROCC->SetElectronArrivalCorrection(kFALSE);
+
+    /* // verification plots
+    rocRotgXA.CreateHistoOfZAlignment(0,500,500)->Draw("surf2"); 
+    rocRotgYA.CreateHistoOfZAlignment(0,500,500)->Draw("surf2"); 
+    rocRotgXC.CreateHistoOfZAlignment(1,500,500)->Draw("surf2"); 
+    rocRotgYC.CreateHistoOfZAlignment(1,500,500)->Draw("surf2"); 
+    */
+
+    //
+    rocRotgXA->SetName("rocRotgXA");rocRotgXA->SetTitle("rocRotgXA");
+    rocRotgYA->SetName("rocRotgYA");rocRotgYA->SetTitle("rocRotgYA");
+    rocRotgXC->SetName("rocRotgXC");rocRotgXC->SetTitle("rocRotgXC");
+    rocRotgYC->SetName("rocRotgYC");rocRotgYC->SetTitle("rocRotgYC");
+    rocDzIROCA->SetName("rocDzIROCA");rocDzIROCA->SetTitle("rocDzIROCA");
+    rocDzIROCC->SetName("rocDzIROCC");rocDzIROCC->SetTitle("rocDzIROCC");
+    rocRotIROCA->SetName("rocRotIROCA");rocRotIROCA->SetTitle("rocRotIROCA");
+    rocRotIROCC->SetName("rocRotIROCC");rocRotIROCC->SetTitle("rocRotIROCC");
+    //
+    //
+    TObjArray *cs = new TObjArray();
+    cs->Add(rocRotgXA);
+    cs->Add(rocRotgYA);
+    cs->Add(rocRotgXC);
+    cs->Add(rocRotgYC);
+    cs->Add(rocDzIROCA);
+    cs->Add(rocDzIROCC);
+    cs->Add(rocRotIROCA);
+    cs->Add(rocRotIROCC);
+    corrField3D->SetCorrections(cs);
+    corrField3D->SetOmegaTauT1T2(0,1.,1.);
+    corrField3D->Print();
+    fCorrectionsROC->cd();
+    corrField3D->Init();
+    corrField3D->Print("da");
+    fCorrectionsROC->cd();
+    corrField3D->Write("TPCROCVoltError3DRotationgXgY");
+    //     rocRotgXA->Write();       
+    //     rocRotgYA->Write(); 
+    //     rocRotgXC->Write(); 
+    //     rocRotgYC->Write(); 
+    //     rocDzIROCA->Write(); 
+    //     rocDzIROCC->Write(); 
+  }
+  AliTPCCorrection::AddVisualCorrection(rocRotgXA,701); 
+  AliTPCCorrection::AddVisualCorrection(rocRotgYA,702); 
+  AliTPCCorrection::AddVisualCorrection(rocRotgXC,703); 
+  AliTPCCorrection::AddVisualCorrection(rocRotgYC,704); 
+  AliTPCCorrection::AddVisualCorrection(rocDzIROCA,705); 
+  AliTPCCorrection::AddVisualCorrection(rocDzIROCC,706); 
+  AliTPCCorrection::AddVisualCorrection(rocRotIROCA,707); 
+  AliTPCCorrection::AddVisualCorrection(rocRotIROCC,708); 
+
+  AliTPCCorrection *corrPlus =0; 
+  //
+  corrPlus=(AliTPCCorrection *)rocRotgXA->Clone();
+  corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrPlus,711);
+  //
+  corrPlus=(AliTPCCorrection *)rocRotgYA->Clone();
+  corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrPlus,712);
+  //
+  corrPlus=(AliTPCCorrection *)rocRotgXC->Clone();
+  corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrPlus,713);
+  //
+  corrPlus=(AliTPCCorrection *)rocRotgYC->Clone();
+  corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrPlus,714);
+  //
+  corrPlus=(AliTPCCorrection *)rocDzIROCA->Clone();
+  corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrPlus,715);
+  //
+  corrPlus=(AliTPCCorrection *)rocDzIROCC->Clone();
+  corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrPlus,716);
+  //
+  corrPlus=(AliTPCCorrection *)rocRotIROCA->Clone();
+  corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrPlus,717);
+  //
+  corrPlus=(AliTPCCorrection *)rocDzIROCC->Clone();
+  corrPlus->SetOmegaTauT1T2(wtP,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrPlus,718);
+  //
+  //
+  AliTPCCorrection *corrMinus =0; 
+  //
+  corrMinus=(AliTPCCorrection *)rocRotgXA->Clone();
+  corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrMinus,721);
+  //
+  corrMinus=(AliTPCCorrection *)rocRotgYA->Clone();
+  corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrMinus,722);
+  //
+  corrMinus=(AliTPCCorrection *)rocRotgXC->Clone();
+  corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrMinus,723);
+  //
+  corrMinus=(AliTPCCorrection *)rocRotgYC->Clone();
+  corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrMinus,724);
+  //
+  corrMinus=(AliTPCCorrection *)rocDzIROCA->Clone();
+  corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrMinus,725);
+  //
+  corrMinus=(AliTPCCorrection *)rocDzIROCC->Clone();
+  corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrMinus,726);
+  //
+  corrMinus=(AliTPCCorrection *)rocRotIROCA->Clone();
+  corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrMinus,727);
+  //
+  corrMinus=(AliTPCCorrection *)rocDzIROCC->Clone();
+  corrMinus->SetOmegaTauT1T2(wtM,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corrMinus,728);
+  //
+
+  fCorrectionsROC->Close();
+  delete fCorrectionsROC;
+}
+
+
+void RegisterAliTPCROCVoltError3DSector(){
+  //
+  // ROC rotation and shift transformation
+  // 800-819 -   0.0 Field
+  // 820-839 -  +0.5 Field
+  // 840-859 -  +0.5 Field
+
+  rocShiftIROCA0=0;      // IROC shift A0 side
+  rocRotIROCA0=0;        // IROC rot   A0 side
+  rocShiftOROCA0=0;      // OROC shift A0 side
+  rocRotOROCA0=0;        // OROC rot   A0 side
+  rocShiftIROCC0=0;      // IROC shift C0 side
+  rocRotIROCC0=0;        // IROC rot   C0 side
+  rocShiftOROCC0=0;      // OROC shift C0 side
+  rocRotOROCC0=0;        // OROC rot   C0 side
+  Double_t vdrift = 2.64; // [cm/us]   // to be updated: per second (ideally)
+  Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
+  Double_t T1 = 1.0;
+  Double_t T2 = 1.0;
+
+  //  Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
+
+  //
+  //
+  printf("RegisterAliTPCROCVoltError3DSector()");
+  Double_t kAngle=0.001;
+  Double_t kDz=0.1;
+  // reference in lx
+  //
+  TMatrixD matrix(72,3);
+  AliTPCComposedCorrection *corrField3DSector = 0;
+  TFile *fCorrectionsROC=0;
+  fCorrectionsROC = new TFile("TPCCorrectionPrimitivesSector.root");
+  corrField3DSector = ( AliTPCComposedCorrection *)fCorrectionsROC->Get("TPCROCVoltError3DSector");
+  //
+  if (!corrField3DSector){
+    fCorrectionsROC = new TFile("TPCCorrectionPrimitivesSector.root","recreate");
+  }  
+  if (corrField3DSector) { // load from file
+    corrField3DSector->Print();
+    TCollection *iter = corrField3DSector->GetCorrections();
+    //
+    rocShiftIROCA0=(AliTPCROCVoltError3D*)iter->FindObject("rocShiftIROCA0");   // IROC shift A0 side
+    rocRotIROCA0=(AliTPCROCVoltError3D*)iter->FindObject("rocRotIROCA0");       // IROC rot   A0 side
+    rocShiftOROCA0=(AliTPCROCVoltError3D*)iter->FindObject("rocShiftOROCA0");   // OROC shift A0 side
+    rocRotOROCA0=(AliTPCROCVoltError3D*)iter->FindObject("rocRotOROCA0");       // OROC rot   A0 side
+    rocShiftIROCC0=(AliTPCROCVoltError3D*)iter->FindObject("rocShiftIROCC0");   // IROC shift C0 side
+    rocRotIROCC0=(AliTPCROCVoltError3D*)iter->FindObject("rocRotIROCC0");       // IROC rot   C0 side
+    rocShiftOROCC0=(AliTPCROCVoltError3D*)iter->FindObject("rocShiftOROCC0");   // OROC shift C0 side
+    rocRotOROCC0=(AliTPCROCVoltError3D*)iter->FindObject("rocRotOROCC0");       // OROC rot   C0 side
+     
+  } else {
+    corrField3DSector = new AliTPCComposedCorrection;
+    rocShiftIROCA0=new AliTPCROCVoltError3D;      // IROC shift A0 side
+    rocRotIROCA0=new AliTPCROCVoltError3D;        // IROC rot   A0 side
+    rocShiftOROCA0=new AliTPCROCVoltError3D;      // OROC shift A0 side
+    rocRotOROCA0=new AliTPCROCVoltError3D;        // OROC rot   A0 side
+    rocShiftIROCC0=new AliTPCROCVoltError3D;      // IROC shift C0 side
+    rocRotIROCC0=new AliTPCROCVoltError3D;        // IROC rot   C0 side
+    rocShiftOROCC0=new AliTPCROCVoltError3D;      // OROC shift C0 side
+    rocRotOROCC0=new AliTPCROCVoltError3D;        // OROC rot   C0 side
+    //
+    matrix.Zero(); matrix(0,0)=kDz; 
+    rocShiftIROCA0->SetROCData(&matrix);
+    matrix.Zero(); matrix(0,1)=kAngle; 
+    rocRotIROCA0->SetROCData(&matrix);
+    matrix.Zero(); matrix(36,0)=kDz; 
+    rocShiftOROCA0->SetROCData(&matrix);
+    matrix.Zero(); matrix(36,1)=kAngle; 
+    rocRotOROCA0->SetROCData(&matrix);
+
+    matrix.Zero(); matrix(18,0)=kDz; 
+    rocShiftIROCC0->SetROCData(&matrix);
+    matrix.Zero(); matrix(18,1)=kAngle; 
+    rocRotIROCC0->SetROCData(&matrix);
+    matrix.Zero(); matrix(36+18,0)=kDz; 
+    rocShiftOROCC0->SetROCData(&matrix);
+    matrix.Zero(); matrix(36+18,1)=kAngle; 
+    rocRotOROCC0->SetROCData(&matrix);
+    //
+    rocShiftIROCA0->SetElectronArrivalCorrection(kFALSE);     // IROC shift A0 side
+    rocRotIROCA0->SetElectronArrivalCorrection(kFALSE);        // IROC rot   A0 side
+    rocShiftOROCA0->SetElectronArrivalCorrection(kFALSE);      // OROC shift A0 side
+    rocRotOROCA0->SetElectronArrivalCorrection(kFALSE);        // OROC rot   A0 side
+    rocShiftIROCC0->SetElectronArrivalCorrection(kFALSE);      // IROC shift C0 side
+    rocRotIROCC0->SetElectronArrivalCorrection(kFALSE);        // IROC rot   C0 side
+    rocShiftOROCC0->SetElectronArrivalCorrection(kFALSE);      // OROC shift C0 side
+    rocRotOROCC0->SetElectronArrivalCorrection(kFALSE);        // OROC rot   C0 side
+
+    /* // verification plots
+    */
+    //
+    rocShiftIROCA0->SetName("rocShiftIROCA0");rocShiftIROCA0->SetTitle("rocShiftIROCA0");
+    rocRotIROCA0->SetName("rocRotIROCA0");rocRotIROCA0->SetTitle("rocRotIROCA0");
+    rocShiftOROCA0->SetName("rocShiftOROCA0"); rocShiftOROCA0->SetTitle("rocShiftOROCA0");
+    rocRotOROCA0->SetName("rocRotOROCA0");rocRotOROCA0->SetTitle("rocRotOROCA0");
+    //
+    rocShiftIROCC0->SetName("rocShiftIROCC0");rocShiftIROCC0->SetTitle("rocShiftIROCC0");
+    rocRotIROCC0->SetName("rocRotIROCC0");rocRotIROCC0->SetTitle("rocRotIROCC0");
+    rocShiftOROCC0->SetName("rocShiftOROCC0");rocShiftOROCC0->SetTitle("rocShiftOROCC0");
+    rocRotOROCC0->SetName("rocRotOROCC0");rocRotOROCC0->SetTitle("rocRotOROCC0");
+    //
+    //
+    TObjArray *cs = new TObjArray();
+    cs->Add(rocShiftIROCA0);      // IROC shift A0 side
+    cs->Add(rocRotIROCA0);        // IROC rot   A0 side
+    cs->Add(rocShiftOROCA0);      // OROC shift A0 side
+    cs->Add(rocRotOROCA0);        // OROC rot   A0 side
+    cs->Add(rocShiftIROCC0);      // IROC shift C0 side
+    cs->Add(rocRotIROCC0);        // IROC rot   C0 side
+    cs->Add(rocShiftOROCC0);      // OROC shift C0 side
+    cs->Add(rocRotOROCC0);        // OROC rot   C0 side
+    //
+    corrField3DSector->SetCorrections(cs);
+    corrField3DSector->SetOmegaTauT1T2(0,T1,T2);
+    corrField3DSector->Print();
+    //
+
+    fCorrectionsROC->cd();
+    corrField3DSector->Init();
+    corrField3DSector->Print("da");
+    fCorrectionsROC->cd();
+    corrField3DSector->Write("TPCROCVoltError3DSector");
+  }
+  AliTPCCorrection::AddVisualCorrection(rocShiftIROCA0,800);      // IROC shift A0 side
+  AliTPCCorrection::AddVisualCorrection(rocRotIROCA0,801);        // IROC rot   A0 side
+  AliTPCCorrection::AddVisualCorrection(rocShiftOROCA0,802);      // OROC shift A0 side
+  AliTPCCorrection::AddVisualCorrection(rocRotOROCA0,803);        // OROC rot   A0 side
+  AliTPCCorrection::AddVisualCorrection(rocShiftIROCC0,804);      // IROC shift C0 side
+  AliTPCCorrection::AddVisualCorrection(rocRotIROCC0,805);        // IROC rot   C0 side
+  AliTPCCorrection::AddVisualCorrection(rocShiftOROCC0,806);      // OROC shift C0 side
+  AliTPCCorrection::AddVisualCorrection(rocRotOROCC0,807);        // OROC rot   C0 side 
+  //
+  // Register correction for plus setting
+  AliTPCCorrection *corr =0; 
+  Double_t wtp = -10.0 * (0.5*10) * vdrift / ezField ; 
+  Double_t wtm = -10.0 * (0.5*10) * vdrift / -ezField ; 
+
+  corr=(AliTPCCorrection *)rocShiftIROCA0->Clone();
+  corr->SetOmegaTauT1T2(wtp,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,820);           // IROC shift A0 side + Plus field
+  //
+  corr=(AliTPCCorrection *)rocRotIROCA0->Clone();
+  corr->SetOmegaTauT1T2(wtp,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,821);           // IROC rot   A0 side
+  //
+  corr=(AliTPCCorrection *)rocShiftOROCA0->Clone();
+  corr->SetOmegaTauT1T2(wtp,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,822);            // OROC shift   A0 side
+  //
+  corr=(AliTPCCorrection *)rocRotOROCA0->Clone();
+  corr->SetOmegaTauT1T2(wtp,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,823);            // OROC rot   A0 side
+  corr=(AliTPCCorrection *)rocShiftIROCC0->Clone();
+  corr->SetOmegaTauT1T2(wtp,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,824);           // IROC shift C0 side + Plus field
+  //
+  corr=(AliTPCCorrection *)rocRotIROCC0->Clone();
+  corr->SetOmegaTauT1T2(wtp,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,825);           // IROC rot   C0 side
+  //
+  corr=(AliTPCCorrection *)rocShiftOROCC0->Clone();
+  corr->SetOmegaTauT1T2(wtp,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,826);            // OROC shift   C0 side
+  //
+  corr=(AliTPCCorrection *)rocRotOROCC0->Clone();
+  corr->SetOmegaTauT1T2(wtp,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,827);            // OROC rot   C0 side
+  //
+  corr=(AliTPCCorrection *)rocShiftIROCA0->Clone();
+  corr->SetOmegaTauT1T2(wtm,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,840);           // IROC shift A0 side + Plus field
+  //
+  corr=(AliTPCCorrection *)rocRotIROCA0->Clone();
+  corr->SetOmegaTauT1T2(wtm,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,841);           // IROC rot   A0 side
+  //
+  corr=(AliTPCCorrection *)rocShiftOROCA0->Clone();
+  corr->SetOmegaTauT1T2(wtm,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,842);            // OROC shift   A0 side
+  //
+  corr=(AliTPCCorrection *)rocRotOROCA0->Clone();
+  corr->SetOmegaTauT1T2(wtm,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,843);            // OROC rot   A0 side
+  corr=(AliTPCCorrection *)rocShiftIROCC0->Clone();
+  corr->SetOmegaTauT1T2(wtm,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,844);           // IROC shift C0 side + Plus field
+  //
+  corr=(AliTPCCorrection *)rocRotIROCC0->Clone();
+  corr->SetOmegaTauT1T2(wtm,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,845);           // IROC rot   C0 side
+  //
+  corr=(AliTPCCorrection *)rocShiftOROCC0->Clone();
+  corr->SetOmegaTauT1T2(wtm,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,846);            // OROC shift   C0 side
+  //
+  corr=(AliTPCCorrection *)rocRotOROCC0->Clone();
+  corr->SetOmegaTauT1T2(wtm,T1,T2);
+  AliTPCCorrection::AddVisualCorrection(corr,847);            // OROC rot   C0 side
+  //
+  fCorrectionsROC->Close();
+  delete fCorrectionsROC;
+}
+
+
+
+
+
 AliTPCComposedCorrection * MakeComposedCorrectionExB(){
   //
   // make composed corection for ExB scanning
   //
   RegisterCorrection();
   //
-  Double_t bzField=AliTrackerBase::GetBz();    
+  //Double_t bzField=AliTrackerBase::GetBz();    
   //  AliMagF* magF= (AliMagF*)(TGeoGlobalMagField::Instance()->GetField());
-  Double_t vdrift = 2.6; // [cm/us]   // to be updated: per second (ideally)
-  Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
-  Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
-  Double_t T1 = 1.0;
-  Double_t T2 = 1.0;
+  //Double_t vdrift = 2.6; // [cm/us]   // to be updated: per second (ideally)
+  //Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
+  //  Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ; 
+  //Double_t T1 = 1.0;
+  //Double_t T2 = 1.0;
   //
   TObjArray * corr = new TObjArray;
   corr->AddLast(twistX);
@@ -486,11 +1073,25 @@ AliTPCComposedCorrection * MakeComposedCorrectionExB(){
   corr->AddLast(alignRot0);
   corr->AddLast(alignRot1);
   corr->AddLast(alignRot2);
-
+  corr->AddLast(rocRotgXA);
+  corr->AddLast(rocRotgYA);
+  corr->AddLast(rocRotgXC);
+  corr->AddLast(rocRotgYC);
+  corr->AddLast(exbShape);
+  corr->AddLast(exbShapeT1X);
+  corr->AddLast(exbShapeT2X);
+  corr->AddLast(rocRotgXA);
+  corr->AddLast(rocRotgYA);
+  corr->AddLast(rocRotgXC);
+  corr->AddLast(rocRotgYC);
+  corr->AddLast(rocDzIROCA);
+  corr->AddLast(rocDzIROCC);
   AliTPCComposedCorrection *cc= new AliTPCComposedCorrection ;
   cc->SetCorrections((TObjArray*)(corr));
-  cc->SetOmegaTauT1T2(wt,T1,T2);
-  cc->Init();
+  //cc->SetOmegaTauT1T2(wt,T1,T2);  
+  //exbShapeT1X->SetOmegaTauT1T2(0,1.2,1.0);
+  //exbShapeT2X->SetOmegaTauT1T2(0,1.0,1.2);
+  //cc->Init();
   cc->Print("DA"); // Print used correction classes
   cc->SetName("ComposedExB");
   TFile fexb("RegisterCorrectionExB.root","recreate");