]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Much faster version of GetOrigGlobalMatrix method. One should avoid using FindObject...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Feb 2007 13:50:04 +0000 (13:50 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 22 Feb 2007 13:50:04 +0000 (13:50 +0000)
STEER/AliAlignObj.cxx

index 88a0a065f32796180faae0a0d547eb14b3b73af5..183e391d520ca54fa781586f95b8f25918964be8 100644 (file)
@@ -811,32 +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()){
 
-    TGeoMatrix *lm = NULL;
     TGeoPhysicalNode *physNode = NULL;
-    if ((physNode = (TGeoPhysicalNode *)gGeoManager->GetListOfPhysicalNodes()->FindObject(nodeStr.Data()))) {
+    next.Reset();
+    TGeoNode *node = gGeoManager->GetCurrentNode();
+    while ((physNode=(TGeoPhysicalNode*)next())) 
+      if (physNode->GetNode() == node) break;
+
+    TGeoMatrix *lm = NULL;
+    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);
-  }
 
-  pathArr->Delete();
-  delete pathArr;
+    m.MultiplyLeft(lm);
+
+    gGeoManager->CdUp();
+  }
 
   return kTRUE;
 }