]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Transform1to2 - global to local system - taken from TGeoManager (M.Ivanov)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Apr 2006 15:09:04 +0000 (15:09 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Apr 2006 15:09:04 +0000 (15:09 +0000)
TPC/AliTPCParam.cxx
TPC/AliTPCParam.h

index a8bff23cdfd1142759e689e5fd8e5070db887255..4d90fd272f4fef9293b618bfeed8317b271a3fd3 100644 (file)
@@ -538,15 +538,17 @@ Bool_t AliTPCParam::ReadGeoMatrices(){
   }
   AliAlignObjAngles o;
   //
-//   if (fTrackingMatrix) delete [] fTrackingMatrix;
-//   fTrackingMatrix = new TGeoHMatrix*[fNSector];
-//   if (fClusterMatrix) delete [] fClusterMatrix;
-//   fClusterMatrix = new TGeoHMatrix*[fNSector];
+  if (fTrackingMatrix) delete [] fTrackingMatrix;
+  fTrackingMatrix = new TGeoHMatrix*[fNSector];
+  if (fClusterMatrix) delete [] fClusterMatrix;
+  fClusterMatrix = new TGeoHMatrix*[fNSector];
   if (fGlobalMatrix) delete [] fGlobalMatrix;
   fGlobalMatrix = new TGeoHMatrix*[fNSector];
   //
   for (Int_t isec=0; isec<fNSector; isec++) {
     fGlobalMatrix[isec] = 0;
+    fClusterMatrix[isec]= 0;
+    fTrackingMatrix[isec]=0;   
     AliAlignObj::ELayerID iLayer;
     Int_t iModule;
 
@@ -566,12 +568,34 @@ Bool_t AliTPCParam::ReadGeoMatrices(){
     //
     TGeoRotation mchange; 
     mchange.RotateY(90); mchange.RotateX(90);
-    Float_t x0 = GetChamberCenter(isec);
-    TGeoTranslation center("center",-x0,0,0);
+    Float_t ROCcenter[3]; 
+    GetChamberCenter(isec,ROCcenter);
+    //
     // Convert to global coordinate system
-    //m->Multiply(&center);
+    //
     fGlobalMatrix[isec] = new TGeoHMatrix(*m);
     fGlobalMatrix[isec]->Multiply(&(mchange.Inverse()));
+    TGeoTranslation center("center",-ROCcenter[0],-ROCcenter[1],-ROCcenter[2]);
+    fGlobalMatrix[isec]->Multiply(&center);
+    //
+    //  cluster correction matrix
+    //
+    fClusterMatrix[isec] = new TGeoHMatrix;
+    Double_t sectorAngle = 20.*(isec%18)+10;
+    TGeoHMatrix  rotMatrix;
+    rotMatrix.RotateZ(sectorAngle);
+    if (GetGlobalMatrix(isec)->GetTranslation()[2]>0){
+      //
+      // mirrored system 
+      //
+      TGeoRotation mirrorZ;
+      mirrorZ.SetAngles(90,0,90,90,180,0);
+      fClusterMatrix[isec]->Multiply(&mirrorZ);
+    }
+    TGeoTranslation trans(0,0,GetZLength());
+    fClusterMatrix[isec]->MultiplyLeft(&trans);
+    fClusterMatrix[isec]->MultiplyLeft((GetGlobalMatrix(isec)));       
+    fClusterMatrix[isec]->MultiplyLeft(&(rotMatrix.Inverse()));
   }
   return kTRUE;
 }
@@ -672,14 +696,30 @@ Int_t AliTPCParam::GetSectorIndex(Float_t angle, Int_t row, Float_t z) const
   return sector;
 }
 
-Float_t AliTPCParam::GetChamberCenter(Int_t isec) const
+Float_t AliTPCParam::GetChamberCenter(Int_t isec, Float_t * center) const
 {
   // returns the default radial position
   // of the readout chambers
-  if (isec<fNInnerSector)
-    return (fInnerRadiusLow+fInnerRadiusUp)/2.;
-  else
-    return (fOuterRadiusLow+fOuterRadiusUp)/2.;
+
+  const Float_t kROCcenterIn = 110.2;
+  const Float_t kROCcenterOut = 188.45;
+
+  if (isec<fNInnerSector){
+    if (center){
+      center[0] = kROCcenterIn;
+      center[1] = 0; 
+      center[2] = -5.51; 
+    }
+    return kROCcenterIn;
+  }
+  else{
+    if (center){
+      center[0] = kROCcenterOut;
+      center[1] = 0; 
+      center[2] = -5.61; 
+    }
+    return kROCcenterOut;
+  }
 }
 
 
index 30b6d6590a7e1aca8abbda83853278c779304642..daac13e793eba390770c7810b49909c68f2b4444 100644 (file)
@@ -30,8 +30,10 @@ public:
   Int_t  Transform0to1(Float_t *xyz, Int_t *index) const;
   //trasforamtion from global to global - adjust index[0] sector 
   //return value is equal to sector corresponding to global position
+  void Transform1to2Ideal(Float_t *xyz, Int_t *index) const;
+  //transformation to rotated coordinata - ideal frame 
   void Transform1to2(Float_t *xyz, Int_t *index) const;
-  //transformation to rotated coordinata 
+  //transformation to rotated coordinata   
   void Transform2to1(Float_t *xyz, Int_t *index) const;
   //transformation from rotated coordinata to global coordinata
   void Transform2to2(Float_t *xyz, Int_t *index, Int_t *oindex) const;
@@ -278,7 +280,7 @@ public:
   Float_t GetYInner(Int_t irow) const; // wire length in low sec row
   Float_t GetYOuter(Int_t irow) const; // wire length in up sec row  
   Int_t GetSectorIndex(Float_t angle, Int_t row, Float_t z) const; // get sector index
-  Float_t GetChamberCenter(Int_t isec) const; // get readout chamber positions
+  Float_t GetChamberCenter(Int_t isec, Float_t * center = 0) const; // get readout chamber positions
   TGeoHMatrix *GetTrackingMatrix(Int_t isec) const {
     return fTrackingMatrix[isec];}
   TGeoHMatrix *GetClusterMatrix(Int_t isec) const {
@@ -494,12 +496,13 @@ inline Float_t   AliTPCParam::GetAngle(Int_t isec) const
 }
 
 
-inline void AliTPCParam::Transform1to2(Float_t *xyz, Int_t *index) const
+inline void AliTPCParam::Transform1to2Ideal(Float_t *xyz, Int_t *index) const
 {
   //transformation to rotated coordinates
   //we must have information about sector!
-
   //rotate to given sector
+  // ideal frame
+
   Float_t cos,sin;
   AdjustCosSin(index[1],cos,sin);
   Float_t x1=xyz[0]*cos + xyz[1]*sin;
@@ -511,6 +514,20 @@ inline void AliTPCParam::Transform1to2(Float_t *xyz, Int_t *index) const
 }
 
 
+inline void AliTPCParam::Transform1to2(Float_t *xyz, Int_t *index) const
+{
+  //transformation to rotated coordinates 
+  //we must have information about sector!
+  //rotate to given sector
+  Double_t xyzmaster[3] = {xyz[0],xyz[1],xyz[2]};
+  Double_t xyzlocal[3];  
+  fGlobalMatrix[index[1]]->MasterToLocal(xyzmaster,xyzlocal);
+  xyz[0] = xyzlocal[0];
+  xyz[1] = xyzlocal[1];
+  xyz[2] = xyzlocal[2];
+  index[0]=2;
+}
+