]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGeometryModule.cxx
Initialisation.
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryModule.cxx
index 3f8fa9516316911b6b1a53c1fa975f022015e51e..01f3c9197f55104bb61655075fa5f4802186ae19 100644 (file)
@@ -14,7 +14,8 @@
  **************************************************************************/
 
 // $Id$
-//
+
+//-----------------------------------------------------------------------------
 // Class AliMUONGeometryModule
 // -----------------------------
 // Class for definition of the detector module parameters
 //  sensitive volumes and detection elements).
 //
 // Author: Ivana Hrivnacova, IPN Orsay
+//-----------------------------------------------------------------------------
+
+#include "AliMUONGeometryModule.h"
+#include "AliMUONGeometryModuleTransformer.h"
+#include "AliMUONGeometryEnvelope.h"
+#include "AliMUONGeometryEnvelopeStore.h"
+#include "AliMUONGeometryDetElement.h" 
+#include "AliMUONStringIntMap.h"       
+
+#include "AliLog.h"    
 
 #include <TVirtualMC.h>
 #include <TGeoMatrix.h>
 #include <TArrayI.h>
 #include <Riostream.h>
 
-#include "AliLog.h"    
-
-#include "AliMUONGeometryModule.h"
-#include "AliMUONGeometryEnvelope.h"
-#include "AliMUONGeometryEnvelopeStore.h"
-#include "AliMUONGeometryDetElement.h" 
-#include "AliMUONGeometryStore.h"      
-#include "AliMUONGeometrySVMap.h"      
-#include "AliMUONGeometryDEIndexing.h"
-
+/// \cond CLASSIMP
 ClassImp(AliMUONGeometryModule)
+/// \endcond
 
 //______________________________________________________________________________
 AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId)
  : TObject(),
    fIsVirtual(true),
-   fModuleId(moduleId),
-   fMotherVolume("ALIC"),
-   fVolume("NONE"),
    fNofSVs(0),
    fSVVolumeIds(0),
-   fTransformation(0),
    fEnvelopes(0),
-   fDEIndexing(0),
-   fDetElements(0),
-   fSVMap(0)
+   fSVMap(0),
+   fTransformer(0)
 {
 /// Standard constructor
 
-  // Chamber transformation
-  fTransformation = new TGeoCombiTrans("");
-
   // Arrays of volumes Ids
   fSVVolumeIds = new TArrayI(20);
 
   // Sensitive volumes map
-  fSVMap = new AliMUONGeometrySVMap(100);
-
-  // Get indexing
-  fDEIndexing = new AliMUONGeometryDEIndexing(fModuleId, 0);
+  fSVMap = new AliMUONStringIntMap();
 
-  // Det elements transformation stores
-  fDetElements = new AliMUONGeometryStore(fDEIndexing);
+  // Geometry parametrisation
+  fTransformer = new AliMUONGeometryModuleTransformer(moduleId);
     
   // Envelope store
-  fEnvelopes = new AliMUONGeometryEnvelopeStore(fDetElements);  
+  fEnvelopes = new AliMUONGeometryEnvelopeStore(
+                             fTransformer->GetDetElementStore());  
 }
 
 
@@ -82,55 +75,24 @@ AliMUONGeometryModule::AliMUONGeometryModule(Int_t moduleId)
 AliMUONGeometryModule::AliMUONGeometryModule()
  : TObject(),
    fIsVirtual(true),
-   fModuleId(0),
-   fMotherVolume(),
-   fVolume(),
    fNofSVs(0),
    fSVVolumeIds(0),
-   fTransformation(0),
    fEnvelopes(0),
-   fDEIndexing(0),
-   fDetElements(0),
-   fSVMap(0)
+   fSVMap(0),
+   fTransformer(0)
 {
 /// Default constructor
 }
 
-
-//______________________________________________________________________________
-AliMUONGeometryModule::AliMUONGeometryModule(const AliMUONGeometryModule& rhs)
-  : TObject(rhs)
-{
-/// Protected copy constructor
-
-  AliFatal("Copy constructor is not implemented.");
-}
-
 //______________________________________________________________________________
 AliMUONGeometryModule::~AliMUONGeometryModule() 
 {
 /// Destructor
 
-  delete fTransformation;
   delete fSVVolumeIds;
   delete fEnvelopes;
-  delete fDEIndexing;
-  delete fDetElements;
   delete fSVMap;
-}
-
-//______________________________________________________________________________
-AliMUONGeometryModule& 
-AliMUONGeometryModule::operator = (const AliMUONGeometryModule& rhs) 
-{
-/// Protected assignement operator
-
-  // check assignement to self
-  if (this == &rhs) return *this;
-
-  AliFatal("Assignment operator is not implemented.");
-    
-  return *this;  
+  delete fTransformer;
 }
 
 //
@@ -155,100 +117,20 @@ Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const
 //
 
 //______________________________________________________________________________
-void  AliMUONGeometryModule::Global2Local(Int_t detElemId,
-                                  Float_t xg, Float_t yg, Float_t zg, 
-                                  Float_t& xl, Float_t& yl, Float_t& zl) const
-{
-/// Transform point from the global reference frame (ALIC)
-/// to the local reference frame of the detection element specified
-/// by detElemId.
-
-  // Get detection element
-  AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
-  if (!detElement) return;
-   
-  // Transform point
-  detElement->Global2Local(xg, yg, zg, xl, yl, zl);
-}
-                                 
-//______________________________________________________________________________
-void  AliMUONGeometryModule::Global2Local(Int_t detElemId,
-                                  Double_t xg, Double_t yg, Double_t zg, 
-                                  Double_t& xl, Double_t& yl, Double_t& zl) const
-{
-/// Transform point from the global reference frame (ALIC)
-/// to the local reference frame of the detection element specified
-/// by detElemId.
-
-   // Get detection element
-   AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
-   if (!detElement) return;
-   
-   // Transform point
-   detElement->Global2Local(xg, yg, zg, xl, yl, zl);
-}
-                                 
-//______________________________________________________________________________
-void  AliMUONGeometryModule::Local2Global(Int_t detElemId,
-                 Float_t xl, Float_t yl, Float_t zl, 
-                 Float_t& xg, Float_t& yg, Float_t& zg) const
-{
-/// Transform point from the local reference frame of the detection element 
-/// specified by detElemId to the global reference frame (ALIC).
-
-  // Get detection element
-  AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
-  if (!detElement) return;
-   
-   // Transform point
-  detElement->Local2Global(xl, yl, zl, xg, yg, zg);  
-}
-
-//______________________________________________________________________________
-void  AliMUONGeometryModule::Local2Global(Int_t detElemId,
-                 Double_t xl, Double_t yl, Double_t zl, 
-                 Double_t& xg, Double_t& yg, Double_t& zg) const
-{
-/// Transform point from the local reference frame of the detection element 
-/// specified by detElemId to the global reference frame (ALIC).
-
-   // Get detection element
-   AliMUONGeometryDetElement* detElement = GetDetElement(detElemId);
-   if (!detElement) return;
-   
-   // Transform point
-   detElement->Local2Global(xl, yl, zl, xg, yg, zg); 
-}
-
-//______________________________________________________________________________
-void AliMUONGeometryModule::SetVolume(const TString& volumeName)
-{ 
-/// Set the concrete volume associated with this module.
-/// The module in not virtual in this case
-
-  fVolume = volumeName;
-  fIsVirtual = false;
-}
-
-//______________________________________________________________________________
-void  AliMUONGeometryModule::SetTranslation(const TGeoTranslation& translation)
+void  AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform)
 {
 /// Set the module position wrt world.
 
-  fTransformation
-    ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
+  fTransformer->SetTransformation(transform);
 }  
 
 //______________________________________________________________________________
-void  AliMUONGeometryModule::SetRotation(const TGeoRotation& rotation)
-{
-/// Set the module rotation wrt ALIC.
-
-  TGeoRotation* rot = new TGeoRotation();
-  rot->SetMatrix(const_cast<Double_t*>(rotation.GetRotationMatrix()));
+void AliMUONGeometryModule::SetVolumePath(const TString& volumePath)
+{ 
+/// Set the volume path to transformer
 
-  fTransformation->SetRotation(rot);
-}  
+  fTransformer->SetVolumePath(volumePath);
+}
 
 //______________________________________________________________________________
 void  AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId)
@@ -274,7 +156,7 @@ void  AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
 //______________________________________________________________________________
 void  AliMUONGeometryModule::SetAlign(Bool_t align)
 {
-/// Set alignement option to enevelope store.
+/// Set alignement option to envelope store.
   
   fEnvelopes->SetAlign(align);
 }  
@@ -283,14 +165,14 @@ void  AliMUONGeometryModule::SetAlign(Bool_t align)
 AliMUONGeometryDetElement* 
 AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const
 {
-/// Find TGeoCombiTrans for the detector element Id specified by aligned volume 
+/// Find detection element which the sensitive volume specified by name belongs to
 
-  Int_t detElemId = fSVMap->GetDetElemId(sensVolume);
+  Int_t detElemId = fSVMap->Get(sensVolume);
 
   if (!detElemId) return 0; 
         // The specified sensitive volume is not in the map   
   
-  return (AliMUONGeometryDetElement*)fDetElements->Get(detElemId);
+  return fTransformer->GetDetElement(detElemId);
 }  
 
 //______________________________________________________________________________
@@ -313,24 +195,3 @@ Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
 
   return IsSensitiveVolume(gMC->VolId(volName));
 }
-
-//______________________________________________________________________________
-AliMUONGeometryDetElement*
-AliMUONGeometryModule::GetDetElement(Int_t detElemId) const
-{
-/// Return the detection element specified by detElemId.
-/// Give error if detection element is not defined.
-
-   // Get detection element
-   AliMUONGeometryDetElement* detElement
-     = (AliMUONGeometryDetElement*) fDetElements->Get(detElemId);
-
-   if (!detElement) {
-     AliErrorStream() 
-       << "Detection element " << detElemId
-       << " not found in module " << fModuleId << endl;
-     return 0;
-   }  
-
-   return detElement;
-}