]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGeometryBuilder.cxx
Restoring raw data fit from version of 29-Aug-2004
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryBuilder.cxx
index b7e351bd9b58b20f39c856d52ded2993eb61160e..2cfd668a431e99b25d62cae87c79187822afbfc2 100644 (file)
@@ -34,6 +34,8 @@
 #include "AliMUONGeometryConstituent.h"        
 #include "AliModule.h"
 #include "AliLog.h"
+#include "AliRun.h"
+
 
 ClassImp(AliMUONGeometryBuilder)
  
@@ -107,10 +109,11 @@ void AliMUONGeometryBuilder::PlaceVolume(const TString& name, const TString& mNa
 // ---
 
   // Do not apply global transformation 
-  // if mother volume != ALIC
+  // if mother volume was already placed in 
+  // the new system of coordinates (that is MUON in negative Z)
   // (as it is applied on the mother volume)
   TGeoHMatrix transform(matrix);
-  if (mName != TString("ALIC"))
+  if (mName == TString("DDIP"))
     transform = fGlobalTransformation.Inverse() * transform;
      
   // Decompose transformation
@@ -190,14 +193,7 @@ void AliMUONGeometryBuilder::FillGlobalTransformations(
       TGeoHMatrix total 
        = fGlobalTransformation *
          (*geometry->GetTransformation()) * 
-          fGlobalTransformation.Inverse() *
          (*localTransform);
-                 // !! The local detection element frame is 
-                 // defined wrt the new ALICE coordinate system:
-                 // TGL = Tglobal * Tchamber * Tde
-                 //     =  Tglobal * Tchamber * Tglobal.inv  *  Tglobal * Tde
-                 //     = (Tglobal * Tchamber * Tglobal.inv) * (Tglobal * Tde)
-                 //     = Ttotal * Tde'
          
       // Convert TGeoHMatrix to TGeoCombiTrans
       TGeoCombiTrans globalTransform(localTransform->GetName());
@@ -249,11 +245,21 @@ void AliMUONGeometryBuilder::CreateGeometry()
       builder->SetTransformations();
     } 
 
-    // Place envelopes
+    // Place module volumes and envelopes
     //
     for (Int_t j=0; j<builder->NofGeometries(); j++) {
 
       AliMUONGeometryModule* geometry = builder->Geometry(j);
+      
+      // Place the module volume
+      if ( !geometry->IsVirtual() ) {
+          TGeoHMatrix total 
+           = fGlobalTransformation * 
+             (*geometry->GetTransformation());
+             
+          PlaceVolume(geometry->GetVolume(), geometry->GetMotherVolume(),
+                     1, total, 0, 0, "ONLY");
+      }                      
   
       // Loop over envelopes
       const TObjArray* kEnvelopes = geometry->GetEnvelopeStore()->GetEnvelopes();
@@ -287,12 +293,20 @@ void AliMUONGeometryBuilder::CreateGeometry()
           //           Tglobal * Tch * Tenv
 
           // Compound chamber transformation with the envelope one
-          TGeoHMatrix total 
-           = fGlobalTransformation * 
-             (*geometry->GetTransformation()) * 
-             (*kEnvTrans);
-          PlaceVolume(env->GetName(), geometry->GetMotherVolume(),
-                     env->GetCopyNo(), total, 0, 0, only);
+          if (geometry->IsVirtual()) {
+             TGeoHMatrix total 
+              = fGlobalTransformation * 
+                (*geometry->GetTransformation()) * 
+                (*kEnvTrans);
+             PlaceVolume(env->GetName(), geometry->GetMotherVolume(),
+                        env->GetCopyNo(), total, 0, 0, only);
+          }
+         else {
+             TGeoHMatrix total 
+              = (*kEnvTrans);
+             PlaceVolume(env->GetName(), geometry->GetVolume(),
+                        env->GetCopyNo(), total, 0, 0, only);
+          }                     
         }
 
         if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
@@ -306,15 +320,26 @@ void AliMUONGeometryBuilder::CreateGeometry()
               = (AliMUONGeometryConstituent*)env->GetConstituents()->At(l);
  
             // Compound chamber transformation with the envelope one + the constituent one
-            TGeoHMatrix total 
-             = fGlobalTransformation *
-               (*geometry->GetTransformation()) * 
-               (*kEnvTrans) * 
-               (*constituent->GetTransformation());
-
-            PlaceVolume(constituent->GetName(), geometry->GetMotherVolume(),
-                       constituent->GetCopyNo(), total,
-                        constituent->GetNpar(), constituent->GetParam(), only);
+            if (geometry->IsVirtual()) {
+              TGeoHMatrix total 
+               = fGlobalTransformation *
+                 (*geometry->GetTransformation()) * 
+                 (*kEnvTrans) * 
+                 (*constituent->GetTransformation());
+
+              PlaceVolume(constituent->GetName(), geometry->GetMotherVolume(),
+                         constituent->GetCopyNo(), total,
+                          constituent->GetNpar(), constituent->GetParam(), only);
+            }
+           else {                        
+              TGeoHMatrix total 
+               = (*kEnvTrans) * 
+                 (*constituent->GetTransformation());
+
+              PlaceVolume(constituent->GetName(), geometry->GetVolume(),
+                         constituent->GetCopyNo(), total,
+                          constituent->GetNpar(), constituent->GetParam(), only);
+            }                    
           }
         }
       } // end of loop over envelopes
@@ -354,9 +379,16 @@ void AliMUONGeometryBuilder::InitGeometry()
     AliMUONVGeometryBuilder* builder
       = (AliMUONVGeometryBuilder*)fGeometryBuilders->At(i);
 
+    // Read alignement data if geometry is read from Root file
+    if (gAlice->IsRootGeometry()) {
+      fAlign = true;
+      builder->ReadTransformations();
+    }
+
     // Set sesitive volumes with each builder
     builder->SetSensitiveVolumes();
     
+
     // Read sensitive volume map from a file
     builder->ReadSVMap();
     if (!fAlign)  builder->FillTransformations();