]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAlignObj.cxx
fix
[u/mrichter/AliRoot.git] / STEER / AliAlignObj.cxx
index 77471055f47fe5574d7e052b1ee2b1fd7794cd8f..9df415be8d3e703532dff7461a0b5cf92c842b78 100644 (file)
@@ -727,34 +727,34 @@ Bool_t AliAlignObj::SetLocalMatrix(const TGeoMatrix& m)
   }
 
   const char* symname = GetSymName();
-  TGeoPhysicalNode* node;
+  TGeoHMatrix gprime,gprimeinv;
+  TGeoPhysicalNode* pn = 0;
   TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(symname);
-  if(pne){
-    if(!pne->GetPhysicalNode()){
-      node = gGeoManager->MakeAlignablePN(pne);
+  if(pne)
+  {
+    pn = pne->GetPhysicalNode();
+    if(pn){
+      if (pn->IsAligned())
+       AliWarning(Form("Volume %s has been misaligned already!",symname));
+      gprime = *pn->GetMatrix();
     }else{
-      node = pne->GetPhysicalNode();
+      gprime = pne->GetGlobalOrig();
     }
   }else{
     AliWarning(Form("The symbolic volume name %s does not correspond to a physical entry. Using it as volume path!",symname));
-    node = (TGeoPhysicalNode*) gGeoManager->MakePhysicalNode(symname);
-  }
-
-  if (!node) {
-    AliError(Form("Volume name or path %s not valid!",symname));
-    return kFALSE;
+    if(!gGeoManager->cd(symname)) {
+      AliError(Form("Volume name or path %s not valid!",symname));
+      return kFALSE;
+    }
+    gprime = *gGeoManager->GetCurrentMatrix();
   }
-  if (node->IsAligned())
-    AliWarning(Form("Volume %s has been already misaligned!",symname));
 
-  TGeoHMatrix m1;
+  TGeoHMatrix m1; // the TGeoHMatrix copy of the local delta "m"
   const Double_t *tr = m.GetTranslation();
   m1.SetTranslation(tr);
   const Double_t* rot = m.GetRotationMatrix();
   m1.SetRotation(rot);
 
-  TGeoHMatrix align,gprime,gprimeinv;
-  gprime = *node->GetMatrix();
   gprimeinv = gprime.Inverse();
   m1.Multiply(&gprimeinv);
   m1.MultiplyLeft(&gprime);
@@ -846,8 +846,8 @@ Bool_t AliAlignObj::GetLocalMatrix(TGeoHMatrix& m) const
     AliError(Form("Volume name or path %s not valid!",symname));
     return kFALSE;
   }
-  if (node->IsAligned())
-    AliWarning(Form("Volume %s has been already misaligned!",symname));
+//  if (node->IsAligned())
+//    AliWarning(Form("Volume %s has been misaligned already!",symname));
 
   GetMatrix(m);
   TGeoHMatrix gprime,gprimeinv;
@@ -891,7 +891,7 @@ Bool_t AliAlignObj::ApplyToGeometry(Bool_t ovlpcheck)
       return kFALSE;
     }
     if (gGeoManager->GetListOfPhysicalNodes()->FindObject(path)) {
-      AliError(Form("Volume %s has already been misaligned!",path));
+      AliError(Form("Volume %s has been misaligned already!",path));
       return kFALSE;
     }
     node = (TGeoPhysicalNode*) gGeoManager->MakePhysicalNode(path);