]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
In alignment code:
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Jul 2009 12:54:54 +0000 (12:54 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 2 Jul 2009 12:54:54 +0000 (12:54 +0000)
- Fixed bug in misalignment transformation to ocdb format
- Added delta_z degree of freedom
- Changed default setting of B field (to 0)
- Use local constraints instead of global
(Javier)

MUON/AliMUONAlignment.cxx
MUON/AliMUONAlignment.h
MUON/MUONAlignment.C

index 374511bbca936b21b3b21dbbddb47c8d3f4dbc33..23c4336764eb55410c52f1368c2d6c82dfcecf1a 100644 (file)
@@ -55,7 +55,7 @@ ClassImp(AliMUONAlignment)
   Int_t AliMUONAlignment::fgNDetElem = 4*2+4*2+18*2+26*2+26*2;
   Int_t AliMUONAlignment::fgNDetElemCh[10] = {4,4,4,4,18,18,26,26,26,26};
   Int_t AliMUONAlignment::fgSNDetElemCh[10] = {4,8,12,16,34,52,78,104,130,156};
-  Int_t AliMUONAlignment::fgNParCh = 3;
+  Int_t AliMUONAlignment::fgNParCh = 4;
   Int_t AliMUONAlignment::fgNTrkMod = 16;
   Int_t AliMUONAlignment::fgNCh = 10;
   Int_t AliMUONAlignment::fgNSt = 5;
@@ -63,7 +63,7 @@ ClassImp(AliMUONAlignment)
 AliMUONAlignment::AliMUONAlignment() 
   : TObject(),
     fBFieldOn(kTRUE),
-    fStartFac(16.), 
+    fStartFac(256.), 
     fResCutInitial(100.), 
     fResCut(100.),
     fMillepede(0),
@@ -85,8 +85,8 @@ AliMUONAlignment::AliMUONAlignment()
   fSigma[0] = 1.0e-1;
   fSigma[1] = 1.0e-2;
 
-  fDoF[0] = kTRUE;  fDoF[1] = kTRUE;  fDoF[2] = kTRUE;
-  fAllowVar[0] = 0.05;  fAllowVar[1] = 0.05;  fAllowVar[2] = 0.001;
+  fDoF[0] = kTRUE;  fDoF[1] = kTRUE;  fDoF[2] = kTRUE;  fDoF[3] = kTRUE;
+  fAllowVar[0] = 0.05;  fAllowVar[1] = 0.05;  fAllowVar[2] = 0.001;  fAllowVar[3] = 0.5;
   
   AliInfo(Form("fAllowVar[0]: %f\t fAllowVar[1]: %f\t fPhi: %f\t fgNDetElem: %i\t fNGlobal: %i\t fNLocal: %i",fAllowVar[0],fAllowVar[1],fPhi,fgNDetElem,fNGlobal,fNLocal));
 
@@ -152,6 +152,7 @@ void AliMUONAlignment::FixStation(Int_t iSt){
     FixParameter(i*fgNParCh+0, 0.0);
     FixParameter(i*fgNParCh+1, 0.0);
     FixParameter(i*fgNParCh+2, 0.0);
+    FixParameter(i*fgNParCh+3, 0.0);
   }
 }
 
@@ -163,6 +164,27 @@ void AliMUONAlignment::FixChamber(Int_t iCh){
     FixParameter(i*fgNParCh+0, 0.0);
     FixParameter(i*fgNParCh+1, 0.0);
     FixParameter(i*fgNParCh+2, 0.0);
+    FixParameter(i*fgNParCh+3, 0.0);
+  }
+}
+
+void AliMUONAlignment::FixDetElem(Int_t iDetElemId, TString sVarXYT){
+  /// Fix a given detection element
+  Int_t iDetElemNumber = iDetElemId%100;
+  for (int iCh=0; iCh<iDetElemId/100-1; iCh++){
+    iDetElemNumber += fgNDetElemCh[iCh];
+  }
+  if (sVarXYT.Contains("X")) { // X constraint
+    FixParameter(iDetElemNumber*fgNParCh+0, 0.0);
+  }
+  if (sVarXYT.Contains("Y")) { // Y constraint
+    FixParameter(iDetElemNumber*fgNParCh+1, 0.0);
+  }
+  if (sVarXYT.Contains("T")) { // T constraint
+    FixParameter(iDetElemNumber*fgNParCh+2, 0.0);
+  }
+  if (sVarXYT.Contains("Z")) { // T constraint
+    FixParameter(iDetElemNumber*fgNParCh+3, 0.0);
   }
 }
 
@@ -180,11 +202,13 @@ void AliMUONAlignment::FixHalfSpectrometer(Bool_t *lChOnOff, Bool_t *lSpecLROnOf
          FixParameter(i*fgNParCh+0, 0.0);
          FixParameter(i*fgNParCh+1, 0.0);
          FixParameter(i*fgNParCh+2, 0.0);
+         FixParameter(i*fgNParCh+3, 0.0);
        }
        if ((lDetElemNumber==0 || lDetElemNumber==3) && !lSpecLROnOff[1]){ // From track crossings
          FixParameter(i*fgNParCh+0, 0.0);
          FixParameter(i*fgNParCh+1, 0.0);
          FixParameter(i*fgNParCh+2, 0.0);
+         FixParameter(i*fgNParCh+3, 0.0);
        }
       }
       if (iCh>=5 && iCh<=6){
@@ -192,12 +216,14 @@ void AliMUONAlignment::FixHalfSpectrometer(Bool_t *lChOnOff, Bool_t *lSpecLROnOf
          FixParameter(i*fgNParCh+0, 0.0);
          FixParameter(i*fgNParCh+1, 0.0);
          FixParameter(i*fgNParCh+2, 0.0);
+         FixParameter(i*fgNParCh+3, 0.0);
        }
        if (((lDetElemNumber>=0&&lDetElemNumber<=4) || 
             (lDetElemNumber>=14&&lDetElemNumber<=17)) && !lSpecLROnOff[1]){
          FixParameter(i*fgNParCh+0, 0.0);
          FixParameter(i*fgNParCh+1, 0.0);
          FixParameter(i*fgNParCh+2, 0.0);
+         FixParameter(i*fgNParCh+3, 0.0);
        }
       }
       if (iCh>=7 && iCh<=10){
@@ -205,12 +231,14 @@ void AliMUONAlignment::FixHalfSpectrometer(Bool_t *lChOnOff, Bool_t *lSpecLROnOf
          FixParameter(i*fgNParCh+0, 0.0);
          FixParameter(i*fgNParCh+1, 0.0);
          FixParameter(i*fgNParCh+2, 0.0);
+         FixParameter(i*fgNParCh+3, 0.0);
        }
        if (((lDetElemNumber>=0&&lDetElemNumber<=6) || 
             (lDetElemNumber>=20&&lDetElemNumber<=25)) && !lSpecLROnOff[1]){
          FixParameter(i*fgNParCh+0, 0.0);
          FixParameter(i*fgNParCh+1, 0.0);
          FixParameter(i*fgNParCh+2, 0.0);
+         FixParameter(i*fgNParCh+3, 0.0);
        }
       }
     }
@@ -234,6 +262,9 @@ void AliMUONAlignment::SetNonLinear(Bool_t *lChOnOff,Bool_t *lVarXYT){
       if (lVarXYT[2]) { // T constraint
        SetNonLinear(i*fgNParCh+2);
       }
+      if (lVarXYT[3]) { // Z constraint
+       SetNonLinear(i*fgNParCh+3);
+      }
     }
   }
 }
@@ -255,6 +286,9 @@ void AliMUONAlignment::AddConstraints(Bool_t *lChOnOff,Bool_t *lVarXYT){
       if (lVarXYT[2]) { // T constraint
        fConstraintP[i*fgNParCh+2]=1.0;
       }
+//       if (lVarXYT[3]) { // Z constraint
+//     fConstraintP[i*fgNParCh+3]=1.0;
+//       }
     }
   }
   if (lVarXYT[0]) { // X constraint
@@ -266,6 +300,9 @@ void AliMUONAlignment::AddConstraints(Bool_t *lChOnOff,Bool_t *lVarXYT){
   if (lVarXYT[2]) { // T constraint
     AddConstraint(fConstraintP,0.0);
   }
+//   if (lVarXYT[3]) { // Z constraint
+//     AddConstraint(fConstraintP,0.0);
+//   }
 }
 
 void AliMUONAlignment::AddConstraints(Bool_t *lChOnOff,Bool_t *lVarXYT, Bool_t *lDetTLBR, Bool_t *lSpecLROnOff){
@@ -760,6 +797,8 @@ void AliMUONAlignment::LocalEquationX() {
                        +fCosPhi*(fTrackPos0[1]+fTrackSlope0[1]*
                                  (fTrackPos[2]-fTrackPos0[2])-fDetElemPos[1]));
   }
+  SetGlobalDerivative(fDetElemNumber*fgNParCh+3, 
+                     fCosPhi*fTrackSlope0[0]+fSinPhi*fTrackSlope0[1]);
 
   fMillepede->SetLocalEquation(fGlobalDerivatives, fLocalDerivatives, fMeas[0], fSigma[0]);
 }
@@ -787,6 +826,8 @@ void AliMUONAlignment::LocalEquationY() {
                        -fSinPhi*(fTrackPos0[1]+fTrackSlope0[1]*
                                  (fTrackPos[2]-fTrackPos0[2])-fDetElemPos[1]));
   }
+  SetGlobalDerivative(fDetElemNumber*fgNParCh+3,
+                     -fSinPhi*fTrackSlope0[0]+fCosPhi*fTrackSlope0[1]);
 
   fMillepede->SetLocalEquation(fGlobalDerivatives, fLocalDerivatives, fMeas[1], fSigma[1]);
 }
@@ -933,9 +974,10 @@ TGeoCombiTrans AliMUONAlignment::ReAlign(const TGeoCombiTrans & transform, doubl
 //     rot = new TGeoRotation("rot");
 //   }                 // default constructor.
 
-  cartMisAlig[0] = -lMisAlignment[0];
-  cartMisAlig[1] = -lMisAlignment[1];
-  angMisAlig[2] = -lMisAlignment[2]*180./TMath::Pi();
+  cartMisAlig[0] = -TMath::Sign(1.0,transform.GetRotationMatrix()[0])*lMisAlignment[0];
+  cartMisAlig[1] = -TMath::Sign(1.0,transform.GetRotationMatrix()[4])*lMisAlignment[1];
+  cartMisAlig[2] = -TMath::Sign(1.0,transform.GetRotationMatrix()[8])*lMisAlignment[3];
+  angMisAlig[2] = -TMath::Sign(1.0,transform.GetRotationMatrix()[0]*transform.GetRotationMatrix()[4])*lMisAlignment[2]*180./TMath::Pi();
 
   TGeoTranslation deltaTrans(cartMisAlig[0], cartMisAlig[1], cartMisAlig[2]);
   TGeoRotation deltaRot;
@@ -970,7 +1012,7 @@ AliMUONAlignment::ReAlign(const AliMUONGeometryTransformer * transformer,
   // Returns the new geometry transformer
 
   Double_t lModuleMisAlignment[3] = {0.,0.,0.};
-  Double_t lDetElemMisAlignment[3] = {0.,0.,0.};
+  Double_t lDetElemMisAlignment[4] = {0.,0.,0.,0.};
   Int_t iDetElemId = 0;
   Int_t iDetElemNumber = 0;
 
index 0c36cd7e031b4e5ee4a22ccd05e0ade3549a09bc..d81552588c08817438193a47d7a3add16cddc57f 100644 (file)
@@ -12,6 +12,7 @@
 // Authors: Bruce Becker, Javier Castillo
 
 #include <TObject.h>
+#include <TString.h>
 
 class TGeoCombiTrans;
 class TClonesArray;
@@ -50,6 +51,7 @@ public:
   }
   void FixStation(Int_t iSt);
   void FixChamber(Int_t iCh);
+  void FixDetElem(Int_t iDetElemId, TString sVarXYT = "XYTZ");
   void FixHalfSpectrometer(Bool_t *bChOnOff, Bool_t *bSpecLROnOff);
   void AllowVariations(Bool_t *bChOnOff);
   void SetNonLinear(Bool_t *bChOnOff, Bool_t *bVarXYT);
@@ -102,8 +104,8 @@ public:
   Bool_t fBFieldOn;        ///< Flag for Magnetic filed On/Off
   Bool_t fChOnOff[10];     ///< Flags for chamber On/Off
   Bool_t fSpecLROnOff[2];  ///< Flags for left right On/Off                                                                   
-  Bool_t fDoF[3];          ///< Flags degrees of freedom to align (x,y,phi)
-  Double_t fAllowVar[3];   ///< "Encouraged" variation for degrees of freedom 
+  Bool_t fDoF[4];          ///< Flags degrees of freedom to align (x,y,phi)
+  Double_t fAllowVar[4];   ///< "Encouraged" variation for degrees of freedom 
   Double_t fStartFac;      ///< Initial value for chi2 cut 
                            ///< if > 1 Iterations in AliMillepede are turned on
   Double_t fResCutInitial; ///< Cut on residual for first iteration
@@ -129,55 +131,55 @@ public:
   Double_t fMeas[2];        ///< Current measurement (depend on B field On/Off)  
   Double_t fSigma[2];       ///< Estimated resolution on measurement
 
-  Double_t fGlobalDerivatives[468]; ///< Array of global derivatives
+  Double_t fGlobalDerivatives[624]; ///< Array of global derivatives
   Double_t fLocalDerivatives[4];    ///< Array of local derivatives
 
-  Double_t fConstraintX[468];   ///< Array for constraint equation all X
-  Double_t fConstraintY[468];   ///< Array for constraint equation all Y
-  Double_t fConstraintP[468];   ///< Array for constraint equation all P
-  Double_t fConstraintXT[468];  ///< Array for constraint equation X Top half
-  Double_t fConstraintYT[468];  ///< Array for constraint equation Y Top half
-  Double_t fConstraintPT[468];  ///< Array for constraint equation P Top half
-  Double_t fConstraintXZT[468];  ///< Array for constraint equation X vs Z Top half
-  Double_t fConstraintYZT[468];  ///< Array for constraint equation Y vs Z Top half
-  Double_t fConstraintPZT[468];  ///< Array for constraint equation P vs Z Top half
-  Double_t fConstraintXYT[468];  ///< Array for constraint equation X vs Y Top half
-  Double_t fConstraintYYT[468];  ///< Array for constraint equation Y vs Y Top half
-  Double_t fConstraintPYT[468];  ///< Array for constraint equation P vs Y Top half
-  Double_t fConstraintXB[468];  ///< Array for constraint equation X Bottom half
-  Double_t fConstraintYB[468];  ///< Array for constraint equation Y Bottom half
-  Double_t fConstraintPB[468];  ///< Array for constraint equation P Bottom half
-  Double_t fConstraintXZB[468];  ///< Array for constraint equation X vs Z Bottom half
-  Double_t fConstraintYZB[468];  ///< Array for constraint equation Y vs Z Bottom half
-  Double_t fConstraintPZB[468];  ///< Array for constraint equation P vs Z Bottom half
-  Double_t fConstraintXYB[468];  ///< Array for constraint equation X vs Y Bottom half
-  Double_t fConstraintYYB[468];  ///< Array for constraint equation Y vs Y Bottom half
-  Double_t fConstraintPYB[468];  ///< Array for constraint equation P vs Y Bottom half
-  Double_t fConstraintXR[468];  ///< Array for constraint equation X Right half
-  Double_t fConstraintYR[468];  ///< Array for constraint equation Y Right half
-  Double_t fConstraintPR[468];  ///< Array for constraint equation P Right half
-  Double_t fConstraintXZR[468];  ///< Array for constraint equation X vs Z Right half
-  Double_t fConstraintYZR[468];  ///< Array for constraint equation Y vs Z Right half
-  Double_t fConstraintPZR[468];  ///< Array for constraint equation P vs Z Right half
-  Double_t fConstraintXYR[468];  ///< Array for constraint equation X vs Y Right half
-  Double_t fConstraintYYR[468];  ///< Array for constraint equation Y vs Y Right half
-  Double_t fConstraintPYR[468];  ///< Array for constraint equation P vs Y Right half
-  Double_t fConstraintXL[468];  ///< Array for constraint equation X Left half
-  Double_t fConstraintYL[468];  ///< Array for constraint equation Y Left half
-  Double_t fConstraintPL[468];  ///< Array for constraint equation P Left half
-  Double_t fConstraintXZL[468];  ///< Array for constraint equation X vs Z Left half
-  Double_t fConstraintYZL[468];  ///< Array for constraint equation Y vs Z Left half
-  Double_t fConstraintPZL[468];  ///< Array for constraint equation P vs Z Left half
-  Double_t fConstraintXYL[468];  ///< Array for constraint equation X vs Y Left half
-  Double_t fConstraintYYL[468];  ///< Array for constraint equation Y vs Y Left half
-  Double_t fConstraintPYL[468];  ///< Array for constraint equation P vs Y Left half
-  Double_t fConstraintX3[468];  ///< Array for constraint equation St3 X
-  Double_t fConstraintY3[468];  ///< Array for constraint equation St3 Y
-  Double_t fConstraintX4[468];  ///< Array for constraint equation St4 X
-  Double_t fConstraintY4[468];  ///< Array for constraint equation St4 Y
-  Double_t fConstraintP4[468];  ///< Array for constraint equation St4 P
-  Double_t fConstraintX5[468];  ///< Array for constraint equation St5 X
-  Double_t fConstraintY5[468];  ///< Array for constraint equation St5 Y
+  Double_t fConstraintX[624];   ///< Array for constraint equation all X
+  Double_t fConstraintY[624];   ///< Array for constraint equation all Y
+  Double_t fConstraintP[624];   ///< Array for constraint equation all P
+  Double_t fConstraintXT[624];  ///< Array for constraint equation X Top half
+  Double_t fConstraintYT[624];  ///< Array for constraint equation Y Top half
+  Double_t fConstraintPT[624];  ///< Array for constraint equation P Top half
+  Double_t fConstraintXZT[624];  ///< Array for constraint equation X vs Z Top half
+  Double_t fConstraintYZT[624];  ///< Array for constraint equation Y vs Z Top half
+  Double_t fConstraintPZT[624];  ///< Array for constraint equation P vs Z Top half
+  Double_t fConstraintXYT[624];  ///< Array for constraint equation X vs Y Top half
+  Double_t fConstraintYYT[624];  ///< Array for constraint equation Y vs Y Top half
+  Double_t fConstraintPYT[624];  ///< Array for constraint equation P vs Y Top half
+  Double_t fConstraintXB[624];  ///< Array for constraint equation X Bottom half
+  Double_t fConstraintYB[624];  ///< Array for constraint equation Y Bottom half
+  Double_t fConstraintPB[624];  ///< Array for constraint equation P Bottom half
+  Double_t fConstraintXZB[624];  ///< Array for constraint equation X vs Z Bottom half
+  Double_t fConstraintYZB[624];  ///< Array for constraint equation Y vs Z Bottom half
+  Double_t fConstraintPZB[624];  ///< Array for constraint equation P vs Z Bottom half
+  Double_t fConstraintXYB[624];  ///< Array for constraint equation X vs Y Bottom half
+  Double_t fConstraintYYB[624];  ///< Array for constraint equation Y vs Y Bottom half
+  Double_t fConstraintPYB[624];  ///< Array for constraint equation P vs Y Bottom half
+  Double_t fConstraintXR[624];  ///< Array for constraint equation X Right half
+  Double_t fConstraintYR[624];  ///< Array for constraint equation Y Right half
+  Double_t fConstraintPR[624];  ///< Array for constraint equation P Right half
+  Double_t fConstraintXZR[624];  ///< Array for constraint equation X vs Z Right half
+  Double_t fConstraintYZR[624];  ///< Array for constraint equation Y vs Z Right half
+  Double_t fConstraintPZR[624];  ///< Array for constraint equation P vs Z Right half
+  Double_t fConstraintXYR[624];  ///< Array for constraint equation X vs Y Right half
+  Double_t fConstraintYYR[624];  ///< Array for constraint equation Y vs Y Right half
+  Double_t fConstraintPYR[624];  ///< Array for constraint equation P vs Y Right half
+  Double_t fConstraintXL[624];  ///< Array for constraint equation X Left half
+  Double_t fConstraintYL[624];  ///< Array for constraint equation Y Left half
+  Double_t fConstraintPL[624];  ///< Array for constraint equation P Left half
+  Double_t fConstraintXZL[624];  ///< Array for constraint equation X vs Z Left half
+  Double_t fConstraintYZL[624];  ///< Array for constraint equation Y vs Z Left half
+  Double_t fConstraintPZL[624];  ///< Array for constraint equation P vs Z Left half
+  Double_t fConstraintXYL[624];  ///< Array for constraint equation X vs Y Left half
+  Double_t fConstraintYYL[624];  ///< Array for constraint equation Y vs Y Left half
+  Double_t fConstraintPYL[624];  ///< Array for constraint equation P vs Y Left half
+  Double_t fConstraintX3[624];  ///< Array for constraint equation St3 X
+  Double_t fConstraintY3[624];  ///< Array for constraint equation St3 Y
+  Double_t fConstraintX4[624];  ///< Array for constraint equation St4 X
+  Double_t fConstraintY4[624];  ///< Array for constraint equation St4 Y
+  Double_t fConstraintP4[624];  ///< Array for constraint equation St4 P
+  Double_t fConstraintX5[624];  ///< Array for constraint equation St5 X
+  Double_t fConstraintY5[624];  ///< Array for constraint equation St5 Y
 
   Int_t fDetElemId;        ///< Detection element id
   Int_t fDetElemNumber;    ///< Detection element number
index 362c7cd5b743f8106c53cf2a927cfd1139d24382..eb325465e27ba35f5fbfc75e5f2151f361bf70ad 100644 (file)
@@ -83,16 +83,17 @@ void MUONAlignment(Int_t nEvents = 100000, char* geoFilename = "geometry.root",
   // waiting for mag field in CDB 
   if (!TGeoGlobalMagField::Instance()->GetField()) {
     printf("Loading field map...\n");
-    AliMagF* field = new AliMagF("Maps","Maps",2,1.,1., 10.,AliMagF::k5kG);
+    //    AliMagF* field = new AliMagF("Maps","Maps",2,1.,1., 10.,AliMagF::k5kG);
+    AliMagF* field = new AliMagF("Maps","Maps",2,0.,0., 10.,AliMagF::k5kG);
     TGeoGlobalMagField::Instance()->SetField(field);
   }
   // set the magnetic field for track extrapolations
   AliMUONTrackExtrap::SetField();
 
-  Double_t parameters[3*156];
-  Double_t errors[3*156];
-  Double_t pulls[3*156];
-  for(Int_t k=0;k<3*156;k++) {
+  Double_t parameters[4*156];
+  Double_t errors[4*156];
+  Double_t pulls[4*156];
+  for(Int_t k=0;k<4*156;k++) {
     parameters[k]=0.;
     errors[k]=0.;
     pulls[k]=0.;
@@ -151,10 +152,14 @@ void MUONAlignment(Int_t nEvents = 100000, char* geoFilename = "geometry.root",
   alig->SetChOnOff(bChOnOff);
   alig->SetSpecLROnOff(bChOnOff);
 
+  // Here we can fix some detection elements
+  alig->FixDetElem(908);
+  alig->FixDetElem(1020);
+
   // Set predifined global constrains: X, Y, P, XvsZ, YvsZ, PvsZ, XvsY, YvsY, PvsY
   Bool_t bVarXYT[9] = {kTRUE,kTRUE,kTRUE,kTRUE,kTRUE,kTRUE,kTRUE,kTRUE,kTRUE};
   Bool_t bDetTLBR[4] = {kFALSE,kTRUE,kFALSE,kTRUE};
-  alig->AddConstraints(bChOnOff,bVarXYT,bDetTLBR,bSpecLROnOff);
+  //  alig->AddConstraints(bChOnOff,bVarXYT,bDetTLBR,bSpecLROnOff);
 
 
   char cFileName[100];  
@@ -176,7 +181,7 @@ void MUONAlignment(Int_t nEvents = 100000, char* geoFilename = "geometry.root",
       sprintf(cFileName,esdFileName.Data());
       bKeepLoop = kFALSE;
     }
-    if (!strstr(cFileName,"AliESDs.root")) continue;      
+    if (!strstr(cFileName,"AliESDs")) continue;      
     cout << "Using file: " << cFileName << endl;
     
     // load ESD event
@@ -237,13 +242,13 @@ void MUONAlignment(Int_t nEvents = 100000, char* geoFilename = "geometry.root",
   Double_t DEid[156] = {0};
   Double_t MSDEx[156] = {0};
   Double_t MSDEy[156] = {0};
-  Double_t MSDExt[156] = {0};
-  Double_t MSDEyt[156] = {0};
+  Double_t MSDEz[156] = {0};
+  Double_t MSDEp[156] = {0};
   Double_t DEidErr[156] = {0};
   Double_t MSDExErr[156] = {0};
   Double_t MSDEyErr[156] = {0};
-  Double_t MSDExtErr[156] = {0};
-  Double_t MSDEytErr[156] = {0};
+  Double_t MSDEzErr[156] = {0};
+  Double_t MSDEpErr[156] = {0};
   Int_t lNDetElem = 4*2+4*2+18*2+26*2+26*2;
   Int_t lNDetElemCh[10] = {4,4,4,4,18,18,26,26,26,26};
   // Int_t lSNDetElemCh[10] = {4,8,12,16,34,52,78,104,130,156};
@@ -261,22 +266,22 @@ void MUONAlignment(Int_t nEvents = 100000, char* geoFilename = "geometry.root",
        DEid[iDE] -= lNDetElemCh[iCh];
       }
     }
-    MSDEx[iDE]=parameters[3*iDE+0];
-    MSDEy[iDE]=parameters[3*iDE+1];
-    MSDExt[iDE]=parameters[3*iDE+2];
-    MSDEyt[iDE]=parameters[3*iDE+2];
-    MSDExErr[iDE]=(Double_t)alig->GetParError(3*iDE+0);
-    MSDEyErr[iDE]=(Double_t)alig->GetParError(3*iDE+1);
-    MSDExtErr[iDE]=(Double_t)alig->GetParError(3*iDE+2);
-    MSDEytErr[iDE]=(Double_t)alig->GetParError(3*iDE+2);
+    MSDEx[iDE]=parameters[4*iDE+0];
+    MSDEy[iDE]=parameters[4*iDE+1];
+    MSDEz[iDE]=parameters[4*iDE+3];
+    MSDEp[iDE]=parameters[4*iDE+2];
+    MSDExErr[iDE]=(Double_t)alig->GetParError(4*iDE+0);
+    MSDEyErr[iDE]=(Double_t)alig->GetParError(4*iDE+1);
+    MSDEzErr[iDE]=(Double_t)alig->GetParError(4*iDE+3);
+    MSDEpErr[iDE]=(Double_t)alig->GetParError(4*iDE+2);
   }
 
   cout << "Let's create graphs ...  " << endl;
 
   TGraphErrors *gMSDEx = new TGraphErrors(lNDetElem,DEid,MSDEx,DEidErr,MSDExErr); 
   TGraphErrors *gMSDEy = new TGraphErrors(lNDetElem,DEid,MSDEy,DEidErr,MSDEyErr); 
-  TGraphErrors *gMSDExt = new TGraphErrors(lNDetElem,DEid,MSDExt,DEidErr,MSDExtErr); 
-  TGraphErrors *gMSDEyt = new TGraphErrors(lNDetElem,DEid,MSDEyt,DEidErr,MSDEytErr); 
+  TGraphErrors *gMSDEz = new TGraphErrors(lNDetElem,DEid,MSDEz,DEidErr,MSDEzErr); 
+  TGraphErrors *gMSDEp = new TGraphErrors(lNDetElem,DEid,MSDEp,DEidErr,MSDEpErr); 
 
   cout << "... graphs created, open file ...  " << endl;
 
@@ -286,8 +291,8 @@ void MUONAlignment(Int_t nEvents = 100000, char* geoFilename = "geometry.root",
 
   gMSDEx->Write("gMSDEx");
   gMSDEy->Write("gMSDEy");
-  gMSDExt->Write("gMSDExt");
-  gMSDEyt->Write("gMSDEyt");
+  gMSDEz->Write("gMSDEz");
+  gMSDEp->Write("gMSDEp");
   fInvBenMom->Write();
   fBenMom->Write();
   hFile->Close();