]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGeometryEnvelopeStore.cxx
Additional protection in case of negative indexes. More investigation is needed
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryEnvelopeStore.cxx
index 63664707e2ee279c86a4cc300b4f8f6aeb2eaa4a..023b3dc9f96c4c468c48ed5f8595181389fb6e90 100644 (file)
  **************************************************************************/
 
 // $Id$
-//
+
+// ----------------------------------
 // Class AliMUONGeometryEnvelopeStore
 // ----------------------------------
 // Class for definititon of the temporary volume envelopes
 // used in geometry construction
-//
 // Author: Ivana Hrivnacova, IPN Orsay
 
 #include <TVirtualMC.h>
@@ -32,7 +32,7 @@
 #include "AliMUONGeometryEnvelope.h"
 #include "AliMUONGeometryDetElement.h"
 #include "AliMUONGeometryStore.h"
-#include "AliMUONConstants.h"
+#include "AliMUONGeometryBuilder.h"
 #include "AliLog.h"
 
 ClassImp(AliMUONGeometryEnvelopeStore)
@@ -43,6 +43,7 @@ AliMUONGeometryEnvelopeStore::AliMUONGeometryEnvelopeStore(
  : TObject(),
    fEnvelopes(0),
    fDetElements(detElements),
+   fReferenceFrame(),
    fDebug(false),
    fAlign(false)
 {
@@ -57,6 +58,7 @@ AliMUONGeometryEnvelopeStore::AliMUONGeometryEnvelopeStore()
  : TObject(),
    fEnvelopes(0),
    fDetElements(0),
+   fReferenceFrame(),
    fDebug(false),
    fAlign(false)
 {
@@ -102,6 +104,20 @@ AliMUONGeometryEnvelopeStore::operator = (const AliMUONGeometryEnvelopeStore& rh
 // private methods
 //
 
+//______________________________________________________________________________
+TGeoHMatrix 
+AliMUONGeometryEnvelopeStore::ConvertDETransform(const TGeoHMatrix& transform) const
+{
+// Convert transformation into the reference frame
+
+  if ( fReferenceFrame.IsIdentity() )
+    return transform;
+  else  {
+    return AliMUONGeometryBuilder::Multiply( fReferenceFrame.Inverse(),
+                                            transform );  
+  }                        
+}
+
 //______________________________________________________________________________
 AliMUONGeometryEnvelope* 
 AliMUONGeometryEnvelopeStore::FindEnvelope(const TString& name) const
@@ -136,7 +152,12 @@ Bool_t AliMUONGeometryEnvelopeStore::AlignEnvelope(
     return false;
   };
 
-  envelope->SetTransform(*(detElement->GetLocalTransformation()));
+  // Apply frame transform
+  TGeoHMatrix newTransform 
+    = ConvertDETransform(*(detElement->GetLocalTransformation()));
+
+  envelope->SetTransform(newTransform);
+  
   return true;
 }