]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fix in taking into account alignment in simulation:
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Mar 2009 15:20:55 +0000 (15:20 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Mar 2009 15:20:55 +0000 (15:20 +0000)
Adding AliMUONv1::UpdateInternalGeometry(), which updates
the transformations in AliMUONGeometryTransformer after applying mis-alignment
by framework and so the right transformations are then used in response.
(Javier, Ivana)

MUON/AliMUONGeometryBuilder.cxx
MUON/AliMUONGeometryBuilder.h
MUON/AliMUONGeometryDetElement.cxx
MUON/AliMUONGeometryDetElement.h
MUON/AliMUONGeometryTransformer.cxx
MUON/AliMUONGeometryTransformer.h
MUON/AliMUONv1.cxx
MUON/AliMUONv1.h

index c17062c7effc9a11adfc404015bb3e0423941454..aea1e7060426f61f0c1c59d85cbcb3f17d5a1b51 100644 (file)
@@ -592,6 +592,15 @@ void AliMUONGeometryBuilder::InitGeometry(const TString& svmapFileName)
   }  
 }
 
+//________________________________________________________________
+void AliMUONGeometryBuilder::UpdateInternalGeometry()
+{
+/// Update geometry after applying mis-alignment:
+/// reload transformations in geometry builder.
+
+  fGeometry->GetTransformer()->LoadTransformations();
+}
+
 //______________________________________________________________________________
 void AliMUONGeometryBuilder::WriteSVMaps(const TString& fileName, 
                                          Bool_t rebuild, Bool_t writeEnvelopes)
index a6b8a8c8f3280b01d07fd73dc62914bc273cb0db..88c1b8ae5204bae4e1145771cdf69177f3ccd9c6 100644 (file)
@@ -44,6 +44,7 @@ class AliMUONGeometryBuilder : public TObject
 
     void  InitGeometry();
     void  InitGeometry(const TString& svmapFileName);
+    void  UpdateInternalGeometry();
 
     void  WriteSVMaps();
     void  WriteSVMaps(const TString& fileName, 
index c7d77364958c2f6b3352e10514d838bb7c6a8ed2..be6b5b09c524747498e747d086a273bdeeeabb54 100644 (file)
@@ -243,14 +243,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 +261,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);
index 22040cbcb9187ec394a1c594c1d93687868186d6..768e6638834694a2ca7c5de40ba3e6af5a6a7bbd 100644 (file)
@@ -47,8 +47,8 @@ class AliMUONGeometryDetElement : public TObject
     void PrintGlobalTransform() const;
 
     // set methods
-    void SetLocalTransformation(const TGeoHMatrix& transform);
-    void SetGlobalTransformation(const TGeoHMatrix& transform);
+    void SetLocalTransformation(const TGeoHMatrix& transform, Bool_t warn = true);
+    void SetGlobalTransformation(const TGeoHMatrix& transform, Bool_t warn = true);
     void SetVolumePath(const TString& volumePath);
     
     // get methods
index 03eaa3b3d78aef8d87efa5c1687975246a69a6f3..6d34e730bd7c9d13337f8f8e80cf1a4073961c69 100644 (file)
@@ -426,61 +426,6 @@ AliMUONGeometryTransformer::ReadTransformations(const TString& fileName)
   return true;
 }
 
-//______________________________________________________________________________
-Bool_t  
-AliMUONGeometryTransformer::LoadTransformations()
-{
-/// Load transformations for defined modules and detection elements
-/// using AliGeomManager
-
-  if ( ! AliGeomManager::GetGeometry() ) {
-    AliFatal("Geometry has to be laoded in AliGeomManager first.");
-    return false;
-  }   
-
-  for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
-    AliMUONGeometryModuleTransformer* moduleTransformer 
-      = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
-
-    // Module symbolic name
-    TString symname = GetModuleSymName(moduleTransformer->GetModuleId());
-    
-    // Set matrix from physical node
-    TGeoHMatrix* matrix = AliGeomManager::GetMatrix(symname);
-    if ( ! matrix ) {
-      AliErrorStream() << "Geometry module matrix not found." << endl;
-      return false;
-    }  
-    moduleTransformer->SetTransformation(*matrix);
-    
-    // Loop over detection elements
-    AliMpExMap* detElements = moduleTransformer->GetDetElementStore();    
-    TIter next(detElements->CreateIterator());    
-    AliMUONGeometryDetElement* detElement;
-    
-    while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
-    {
-      // Det element  symbolic name
-      TString symnameDE = GetDESymName(detElement->GetId());
-    
-      // Set global matrix from physical node
-      TGeoHMatrix* globalMatrix = AliGeomManager::GetMatrix(symnameDE);
-      if ( ! globalMatrix ) {
-        AliErrorStream() << "Detection element matrix not found." << endl;
-        return false;
-      }  
-      detElement->SetGlobalTransformation(*globalMatrix);
-
-      // Set local matrix
-      TGeoHMatrix localMatrix = 
-        AliMUONGeometryBuilder::Multiply(
-          (*matrix).Inverse(), (*globalMatrix) );
-      detElement->SetLocalTransformation(localMatrix);
-    }  
-  } 
-  return true;    
-}  
-
 //______________________________________________________________________________
 void AliMUONGeometryTransformer::WriteTransform(ofstream& out,
                                    const TGeoMatrix* transform) const
@@ -580,6 +525,61 @@ TString AliMUONGeometryTransformer::GetDESymName(Int_t detElemId) const
 // public functions
 //
 
+//______________________________________________________________________________
+Bool_t  
+AliMUONGeometryTransformer::LoadTransformations()
+{
+/// Load transformations for defined modules and detection elements
+/// using AliGeomManager
+
+  if ( ! AliGeomManager::GetGeometry() ) {
+    AliFatal("Geometry has to be laoded in AliGeomManager first.");
+    return false;
+  }   
+
+  for (Int_t i=0; i<fModuleTransformers->GetEntriesFast(); i++) {
+    AliMUONGeometryModuleTransformer* moduleTransformer 
+      = (AliMUONGeometryModuleTransformer*)fModuleTransformers->At(i);
+
+    // Module symbolic name
+    TString symname = GetModuleSymName(moduleTransformer->GetModuleId());
+    
+    // Set matrix from physical node
+    TGeoHMatrix* matrix = AliGeomManager::GetMatrix(symname);
+    if ( ! matrix ) {
+      AliErrorStream() << "Geometry module matrix not found." << endl;
+      return false;
+    }  
+    moduleTransformer->SetTransformation(*matrix);
+    
+    // Loop over detection elements
+    AliMpExMap* detElements = moduleTransformer->GetDetElementStore();    
+    TIter next(detElements->CreateIterator());    
+    AliMUONGeometryDetElement* detElement;
+    
+    while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
+    {
+      // Det element  symbolic name
+      TString symnameDE = GetDESymName(detElement->GetId());
+    
+      // Set global matrix from physical node
+      TGeoHMatrix* globalMatrix = AliGeomManager::GetMatrix(symnameDE);
+      if ( ! globalMatrix ) {
+        AliErrorStream() << "Detection element matrix not found." << endl;
+        return false;
+      }  
+      detElement->SetGlobalTransformation(*globalMatrix, false);
+
+      // Set local matrix
+      TGeoHMatrix localMatrix = 
+        AliMUONGeometryBuilder::Multiply(
+          (*matrix).Inverse(), (*globalMatrix) );
+      detElement->SetLocalTransformation(localMatrix, false);
+    }  
+  } 
+  return true;    
+}  
+
 //______________________________________________________________________________
 Bool_t  
 AliMUONGeometryTransformer::LoadGeometryData(const TString& fileName)
index 14a4f4871dd85421bb4ae55e1da6f78eb2e20040..0626839e51d967355584c96278c2d4fe64f98078 100644 (file)
@@ -52,6 +52,7 @@ class AliMUONGeometryTransformer : public TObject
 
     // IO
     //
+    Bool_t  LoadTransformations(); 
     Bool_t  LoadGeometryData(const TString& fileName);
     Bool_t  LoadGeometryData();
 
@@ -128,7 +129,6 @@ class AliMUONGeometryTransformer : public TObject
     TString ReadModuleTransforms(ifstream& in);
     TString ReadDetElemTransforms(ifstream& in);
     Bool_t  ReadTransformations(const TString& fileName);
-    Bool_t  LoadTransformations(); 
 
     void    WriteTransform(ofstream& out, const TGeoMatrix* transform) const;
     void    WriteModuleTransforms(ofstream& out) const;
index fb0dde761f947a1ebe54ef7d45432013f9c2d433..2a63d117030a767e6b64a60c54881708a7ea6d71 100644 (file)
@@ -169,6 +169,14 @@ void AliMUONv1::CreateMaterials()
   fGeometryBuilder->CreateMaterials();
 }
 
+//________________________________________________________________
+void AliMUONv1::UpdateInternalGeometry()
+{
+/// Update geometry after applying mis-alignment
+
+  fGeometryBuilder->UpdateInternalGeometry();
+}
+
 //________________________________________________________________
 void AliMUONv1::AddAlignableVolumes() const
 {
index 0538b0ad6fef9969f4bde385ba40ec6f9a3311b5..94ac7f7489ed47d6ec3edfe39937bfc783214a9b 100644 (file)
@@ -29,6 +29,7 @@ class AliMUONv1 : public AliMUON
    virtual  ~AliMUONv1();
    virtual void   CreateGeometry();
    virtual void   CreateMaterials();
+   virtual void   UpdateInternalGeometry();
    virtual void   AddAlignableVolumes() const;
    virtual void   Init();