]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGeometryDetElement.cxx
Fix for savannah bug report 87728 (Laurent) + fix invalid read found with valgrind...
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryDetElement.cxx
index c7d77364958c2f6b3352e10514d838bb7c6a8ed2..a423554783bb201f5f0643ea95036cff0fc64a5d 100644 (file)
 ClassImp(AliMUONGeometryDetElement)
 /// \endcond
 
-const TString AliMUONGeometryDetElement::fgkDENamePrefix = "DE";
+//
+// static methods
+//
+
+//______________________________________________________________________________
+const TString& AliMUONGeometryDetElement::GetDENamePrefix()
+{
+  ///< Geometry DE name prefix
+  static const TString kDENamePrefix = "DE";
+  return kDENamePrefix;
+}  
 
 //______________________________________________________________________________
 TString AliMUONGeometryDetElement::GetDEName(Int_t detElemId)
 {
 /// Return the module name for given moduleId
 
-  TString deName(fgkDENamePrefix);
+  TString deName(GetDENamePrefix());
   deName += detElemId;
   return deName;
 }   
@@ -243,14 +253,17 @@ void  AliMUONGeometryDetElement::Local2Global(
 
 //______________________________________________________________________________
 void AliMUONGeometryDetElement::SetLocalTransformation(
-                                                const TGeoHMatrix& transform)
+                                                const TGeoHMatrix& transform, 
+                                                Bool_t warn)
 { 
 /// Set local transformation;
 /// give warning if the global transformation is already defined.
  
-  if (fLocalTransformation) {
+  if ( fLocalTransformation ) {
     delete fLocalTransformation;
-    AliWarning("Local transformation already defined was deleted.");
+    if ( warn ) {
+      AliWarning("Local transformation already defined was deleted.");
+    }  
   }  
 
   fLocalTransformation = new TGeoHMatrix(transform);
@@ -258,14 +271,17 @@ void AliMUONGeometryDetElement::SetLocalTransformation(
                                              
 //______________________________________________________________________________
 void AliMUONGeometryDetElement::SetGlobalTransformation(
-                                                const TGeoHMatrix& transform)
+                                                const TGeoHMatrix& transform,
+                                                Bool_t warn)
 { 
 /// Set global transformation;
 /// give warning if the global transformation is already defined.
  
   if (fGlobalTransformation) {
     delete fGlobalTransformation;
-    AliWarning("Global transformation already defined was deleted.");
+    if ( warn ) {
+      AliWarning("Global transformation already defined was deleted.");
+    }  
   }  
 
   fGlobalTransformation = new TGeoHMatrix(transform);