]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Corrected GetLevel method using the volume paths instead of symbolic names (R.Grosso)
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Sep 2006 14:10:31 +0000 (14:10 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Sep 2006 14:10:31 +0000 (14:10 +0000)
STEER/AliAlignObj.cxx

index 2b3c6bf3bc4adfb099d7c3cac6e7a0fd4da360bc..7ca7f2aff974161f2068970ccf29264e0da03ad5 100644 (file)
@@ -171,12 +171,26 @@ Bool_t AliAlignObj::GetPars(Double_t tr[], Double_t angles[]) const
 //_____________________________________________________________________________
 Int_t AliAlignObj::GetLevel() const
 {
-  // Return the geometry level of
-  // the alignable volume to which
-  // the alignment object is associated
-  TString symname = fVolPath;
-  if(symname[0]!='/') symname.Prepend('/');
-  return symname.CountChar('/');
+  // Return the geometry level of the alignable volume to which
+  // the alignment object is associated; this is the number of
+  // slashes in the corresponding volume path
+  //
+  if(!gGeoManager){
+    AliWarning("gGeoManager doesn't exist or it is still opened: unable to return meaningful level value.");
+    return (-1);
+  }
+  const char* symname = GetSymName();
+  const char* path;
+  TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(symname);
+  if(pne){
+    path = pne->GetTitle();
+  }else{
+    path = symname;
+  }
+
+  TString path_str = path;
+  if(path_str[0]!='/') path_str.Prepend('/');
+  return path_str.CountChar('/');
 }
 
 //_____________________________________________________________________________