]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGeometryModule.cxx
- Adding check and flagging for HG present
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryModule.cxx
index f367f2ee2b990f968cbd3866c56b56a48bbca566..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(),
-   fModuleId(moduleId),
-   fMotherVolume("ALIC"),
+   fIsVirtual(true),
    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("");
+/// Standard constructor
 
   // Arrays of volumes Ids
   fSVVolumeIds = new TArrayI(20);
 
   // Sensitive volumes map
-  fSVMap = new AliMUONGeometrySVMap(100);
+  fSVMap = new AliMUONStringIntMap();
 
-  // Get indexing
-  fDEIndexing = new AliMUONGeometryDEIndexing(fModuleId, 0);
-
-  // 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());  
 }
 
 
 //______________________________________________________________________________
 AliMUONGeometryModule::AliMUONGeometryModule()
  : TObject(),
-   fModuleId(0),
-   fMotherVolume(),
+   fIsVirtual(true),
    fNofSVs(0),
    fSVVolumeIds(0),
-   fTransformation(0),
    fEnvelopes(0),
-   fDEIndexing(0),
-   fDetElements(0),
-   fSVMap(0)
+   fSVMap(0),
+   fTransformer(0)
 {
-// Default constructor
+/// Default constructor
 }
 
-
 //______________________________________________________________________________
-AliMUONGeometryModule::AliMUONGeometryModule(const AliMUONGeometryModule& rhs)
-  : TObject(rhs)
+AliMUONGeometryModule::~AliMUONGeometryModule() 
 {
-  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) 
-{
-  // check assignement to self
-  if (this == &rhs) return *this;
-
-  AliFatal("Assignment operator is not implemented.");
-    
-  return *this;  
+  delete fTransformer;
 }
 
 //
@@ -131,9 +102,9 @@ AliMUONGeometryModule::operator = (const AliMUONGeometryModule& rhs)
 //______________________________________________________________________________
 Int_t AliMUONGeometryModule::GetSVIndex(Int_t svVolId) const
 {
-// Returns the index of the volume specified by volId
-// if it is present in the list of sensitive volumes 
-// (or -1 if not present).
+/// Return the index of the volume specified by volId
+/// if it is present in the list of sensitive volumes 
+/// (or -1 if not present).
  
   for (Int_t i=0; i<fNofSVs; i++) {
       if (fSVVolumeIds->At(i) == svVolId) return i;
@@ -146,103 +117,26 @@ 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
+void  AliMUONGeometryModule::SetTransformation(const TGeoCombiTrans& transform)
 {
-// Transforms 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
-{
-// Transforms 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
-{
-// Transforms 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);  
-}
+/// Set the module position wrt world.
 
-//______________________________________________________________________________
-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
-{
-// Transforms 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::SetTranslation(const TGeoTranslation& translation)
-{
-// Sets the module position wrt world.
-// ---
-
-  fTransformation
-    ->SetTranslation(const_cast<Double_t*>(translation.GetTranslation()));
+  fTransformer->SetTransformation(transform);
 }  
 
 //______________________________________________________________________________
-void  AliMUONGeometryModule::SetRotation(const TGeoRotation& rotation)
-{
-// Sets 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)
 {
-// Adds the volume specified by volId to the list of sensitive
-// volumes
-// ---
+/// Add the volume specified by volId to the list of sensitive
+/// volumes
   
   // Resize TArrayI if needed
   if (fSVVolumeIds->GetSize() == fNofSVs) fSVVolumeIds->Set(2*fNofSVs);
@@ -253,9 +147,8 @@ void  AliMUONGeometryModule::SetSensitiveVolume(Int_t svVolId)
 //______________________________________________________________________________
 void  AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
 {
-// Adds the volume specified by volName to the list of sensitive
-// volumes
-// ---
+/// Add the volume specified by volName to the list of sensitive
+/// volumes
 
   SetSensitiveVolume(gMC->VolId(volName));
 }      
@@ -263,8 +156,7 @@ void  AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
 //______________________________________________________________________________
 void  AliMUONGeometryModule::SetAlign(Bool_t align)
 {
-// Sets alignement option to enevelope store.
-// ---
+/// Set alignement option to envelope store.
   
   fEnvelopes->SetAlign(align);
 }  
@@ -273,23 +165,21 @@ void  AliMUONGeometryModule::SetAlign(Bool_t align)
 AliMUONGeometryDetElement* 
 AliMUONGeometryModule::FindBySensitiveVolume(const TString& sensVolume) const
 {
-// Finds 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);
 }  
 
 //______________________________________________________________________________
 Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const
 {
-// Checks if the volume specified by volId is present in the list
-// of sensitive volumes.
-// ---
+/// Check if the volume specified by volId is present in the list
+/// of sensitive volumes.
 
   for (Int_t i=0; i<fNofSVs; i++) {
       if (fSVVolumeIds->At(i) == volId) return kTRUE;
@@ -300,51 +190,8 @@ Bool_t AliMUONGeometryModule::IsSensitiveVolume(Int_t volId) const
 //______________________________________________________________________________
 Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
 {
-// Checks if the volume specified by volName  is present in the list
-// of sensitive volumes.
-// ---
+/// Check if the volume specified by volName  is present in the list
+/// of sensitive volumes.
 
   return IsSensitiveVolume(gMC->VolId(volName));
 }
-
-//______________________________________________________________________________
-AliMUONGeometryDetElement*
-AliMUONGeometryModule::GetDetElement(Int_t detElemId) const
-{
-// Returns thethe detection element specified by detElemId.
-// Gives 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;
-}
-
-/*                               
-//______________________________________________________________________________
-Int_t  AliMUONGeometryModule::GetNofDetElements() const
-{
-// Returns the number of detection elements
-// ---
-
-  return fDEIndexing->GetNofDetElements();
-}   
-
-//______________________________________________________________________________
-Int_t  AliMUONGeometryModule::GetDetElemId(Int_t i) const
-{
-// Returns the i-th detection element id
-// ---
-
-  return fDEIndexing->GetDetElementId(i);
-}   
-*/