]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAlignObj.cxx
Bug fix
[u/mrichter/AliRoot.git] / STEER / AliAlignObj.cxx
index cc3cd17a457706f3083144d3f0407ccd9767f4f9..183e391d520ca54fa781586f95b8f25918964be8 100644 (file)
@@ -21,6 +21,8 @@
 //  From it two derived concrete representation of alignment object class
 //  (AliAlignObjAngles, AliAlignObjMatrix) are derived in separate files.
 //-----------------------------------------------------------------
+
+#include <TClass.h>
 #include <TGeoManager.h>
 #include <TGeoPhysicalNode.h>
 #include <TMath.h>
@@ -666,10 +668,10 @@ Bool_t AliAlignObj::ApplyToGeometry()
     path = pne->GetTitle();
     node = gGeoManager->MakeAlignablePN(pne);
   }else{
-    AliWarning(Form("The symbolic volume name %s does not correspond to a physical entry. Using it as a volume path!",symname));
+    AliDebug(1,Form("The symbolic volume name %s does not correspond to a physical entry. Using it as a volume path!",symname));
     path=symname;
     if (!gGeoManager->CheckPath(path)) {
-      AliError(Form("Volume path %s not valid!",path));
+      AliDebug(1,Form("Volume path %s not valid!",path));
       return kFALSE;
     }
     if (gGeoManager->GetListOfPhysicalNodes()->FindObject(path)) {
@@ -809,31 +811,30 @@ Bool_t AliAlignObj::GetOrigGlobalMatrix(const char *symname, TGeoHMatrix &m)
     return kFALSE;
   }
 
-  TString pathStr = path;
-  TObjArray *pathArr = pathStr.Tokenize('/');
-  TIter iter(pathArr);
-  TString nodeStr = "";
   m.Clear();
 
-  TObjString *str = NULL;
-  while((str = (TObjString*) iter.Next())){
-    nodeStr.Append("/");
-    nodeStr.Append(str->String());
+  TIter next(gGeoManager->GetListOfPhysicalNodes());
+  gGeoManager->cd(path);
+
+  while(gGeoManager->GetLevel()){
+
+    TGeoPhysicalNode *physNode = NULL;
+    next.Reset();
+    TGeoNode *node = gGeoManager->GetCurrentNode();
+    while ((physNode=(TGeoPhysicalNode*)next())) 
+      if (physNode->GetNode() == node) break;
 
     TGeoMatrix *lm = NULL;
-    if (TGeoPhysicalNode *physNode = (TGeoPhysicalNode *)gGeoManager->GetListOfPhysicalNodes()->FindObject(nodeStr.Data())) {
+    if (physNode) {
         lm = physNode->GetOriginalMatrix();
-       if (!lm) lm = physNode->GetNode()->GetMatrix();
-    }
-    else {
-      gGeoManager->cd(nodeStr.Data());
-      TGeoNode *node = gGeoManager->GetCurrentNode();
+       if (!lm) lm = node->GetMatrix();
+    } else
       lm = node->GetMatrix();
-    }
-    m.Multiply(lm);
-  }
 
-  delete pathArr;
+    m.MultiplyLeft(lm);
+
+    gGeoManager->CdUp();
+  }
 
   return kTRUE;
 }
@@ -1135,7 +1136,6 @@ void AliAlignObj::InitSymNames()
   /*********************      HMPID layer   ***********************/
   {
     TString str = "/HMPID/Chamber";
-    TString symname;
 
     for (modnum=0; modnum < 7; modnum++) {
       symname = str;