]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONVGeometryBuilder.cxx
ConsistencyCheck() rewritten.
[u/mrichter/AliRoot.git] / MUON / AliMUONVGeometryBuilder.cxx
index 6103d28f8ca341c59dbf0d3015276556339bd350..9a4d3ddd37c439c441bcd690cb94cc91bd296785 100644 (file)
  **************************************************************************/
 
 // $Id$
-//
+
+//-----------------------------------------------------------------------------
 // Class AliMUONVGeometryBuilder
 // -----------------------------
 // Abstract base class for geometry construction per geometry module(s).
 // Author: Ivana Hrivnacova, IPN Orsay
 // 23/01/2004
+//-----------------------------------------------------------------------------
 
 #include "AliMUONVGeometryBuilder.h"
 #include "AliMUONGeometryModule.h"
@@ -147,12 +149,11 @@ void AliMUONVGeometryBuilder::MapSV(const TString& path0,
     // Get the name of the last volume in the path
     Ssiz_t npos1 = path0.Last('/')+1; 
     Ssiz_t npos2 = path0.Last('_');
-    TString volName(path0(npos1, npos2-npos1));  
+    TString volName0(path0(npos1, npos2-npos1));  
     
     // Check if it is sensitive volume
-    Int_t moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
     AliMUONGeometryModule* geometry = GetGeometry(moduleId);
-    if (  geometry->IsSensitiveVolume(volName) &&
+    if (  geometry->IsSensitiveVolume(volName0) &&
         ! svMap->Get(path0) ) {
       //cout << ".. adding to the map  " 
       //     <<  path0 << "  "  << detElemId << endl;
@@ -349,12 +350,14 @@ void  AliMUONVGeometryBuilder::SetReferenceFrame(
   }          
 }
 
-
 //______________________________________________________________________________
-void  AliMUONVGeometryBuilder::CreateDetElements() const
+void  AliMUONVGeometryBuilder::UpdateDetElements(Bool_t create) const
 {
-/// Create detection elements and fill their global and
-/// local transformations from geometry.
+/// Create or update detection elements:
+/// - if parameter create is true: detection elements are
+/// created and their global and local transformations are filled from geometry.
+/// - otherwise: only the volume path is passed from geometry
+/// to detection elements
 
   for (Int_t i=0; i<fGeometryModules->GetEntriesFast(); i++) {
     AliMUONGeometryModule* geometry 
@@ -380,29 +383,39 @@ void  AliMUONVGeometryBuilder::CreateDetElements() const
       TString volPath = geometry->GetVolumePath();
       volPath += ComposePath(envelope->GetName(), envelope->GetCopyNo());
 
-      // Create detection element 
-      AliMUONGeometryDetElement* detElement
-        = new AliMUONGeometryDetElement(detElemId, volPath);
-      detElements->Add(detElemId, detElement);
+      if ( create ) {
+        // Create detection element 
+        AliMUONGeometryDetElement* detElement
+          = new AliMUONGeometryDetElement(detElemId, volPath);
+        detElements->Add(detElemId, detElement);
       
-      // Compose  local transformation
-      const TGeoCombiTrans* transform = envelope->GetTransformation(); 
-      // Apply frame transform
-      TGeoHMatrix localTransform = ConvertDETransform(*transform);
-      detElement->SetLocalTransformation(localTransform);
-
-      // Compose global transformation
-      TGeoHMatrix globalTransform 
-       = AliMUONGeometryBuilder::Multiply( 
+        // Compose  local transformation
+        const TGeoCombiTrans* transform = envelope->GetTransformation(); 
+        // Apply frame transform
+        TGeoHMatrix localTransform = ConvertDETransform(*transform);
+        detElement->SetLocalTransformation(localTransform);
+
+        // Compose global transformation
+        TGeoHMatrix globalTransform 
+         = AliMUONGeometryBuilder::Multiply( 
                    (*geometry->GetTransformer()->GetTransformation()),
                     localTransform );
                    ;
-      // Set the global transformation to detection element
-      detElement->SetGlobalTransformation(globalTransform);
-      
-    }  
+        // Set the global transformation to detection element
+        detElement->SetGlobalTransformation(globalTransform);
+      }
+      else {
+        // Get existing det elements
+        AliMUONGeometryDetElement* detElement
+          = (AliMUONGeometryDetElement*)detElements->GetValue(detElemId);
+          
+        // Set volume path  
+        detElement->SetVolumePath(volPath); 
+      }
+    }    
   }
 }
+
 //_____ _________________________________________________________________________
 void  AliMUONVGeometryBuilder::RebuildSVMaps(Bool_t withEnvelopes) const
 {