]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGeometryBuilder.cxx
Added TRD hits.
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryBuilder.cxx
index f667ad848c09c33b6ee072599aec3e7274dccbbc..fb02b36a03f88f8ea7e7f635fada766465787a2e 100644 (file)
 
 // $Id$
 //
+// ----------------------------
 // Class AliMUONGeometryBuilder
 // ----------------------------
 // Manager class for geometry construction via geometry builders.
-//
 // Author: Ivana Hrivnacova, IPN Orsay
 
 #include "AliMUONGeometryBuilder.h"
 #include "AliMUONGeometryEnvelope.h"   
 #include "AliMUONGeometryEnvelopeStore.h"
 #include "AliMUONGeometryDetElement.h"
-#include "AliMUONGeometryStore.h"
 #include "AliMUONGeometryConstituent.h"
 
+#include "AliMpDEManager.h"
+
 #include "AliModule.h"
 #include "AliLog.h"
 #include "AliRun.h"
@@ -41,9 +42,6 @@
 #include <TVirtualMC.h>
 #include <TGeoManager.h>
 
-
-ClassImp(AliMUONGeometryBuilder)
-
 // static data members
  
 const TString  AliMUONGeometryBuilder::fgkDefaultVolPathsFileName = "volpath.dat";   
@@ -51,6 +49,10 @@ const TString  AliMUONGeometryBuilder::fgkDefaultTransformFileName = "transform.
 const TString  AliMUONGeometryBuilder::fgkDefaultSVMapFileName = "svmap.dat";    
 const TString  AliMUONGeometryBuilder::fgkOutFileNameExtension = ".out";    
 
+/// \cond CLASSIMP
+ClassImp(AliMUONGeometryBuilder)
+/// \endcond
+
 // static functions
 
 //______________________________________________________________________________
@@ -149,15 +151,6 @@ AliMUONGeometryBuilder::AliMUONGeometryBuilder()
 /// Default constructor
 } 
 
-//______________________________________________________________________________
-AliMUONGeometryBuilder::AliMUONGeometryBuilder(const AliMUONGeometryBuilder& right) 
-  : TObject(right) 
-{  
-/// Copy constructor (not implemented)
-
-  AliFatal("Copy constructor not provided.");
-}
-
 //______________________________________________________________________________
 AliMUONGeometryBuilder::~AliMUONGeometryBuilder()
 {
@@ -167,20 +160,6 @@ AliMUONGeometryBuilder::~AliMUONGeometryBuilder()
   delete fGeometry;
 }
 
-//______________________________________________________________________________
-AliMUONGeometryBuilder& 
-AliMUONGeometryBuilder::operator=(const AliMUONGeometryBuilder& right)
-{
-/// Assignement operator (not implemented)
-
-  // check assignement to self
-  if (this == &right) return *this;
-
-  AliFatal("Assignement operator not provided.");
-    
-  return *this;  
-}    
-
 //
 // private functions
 //
@@ -245,7 +224,7 @@ void AliMUONGeometryBuilder::PlaceVolume(const TString& name, const TString& mNa
     fModule->AliMatrix(krot, theta1, phi1, theta2, phi2, theta3, phi3);
   }    
        
-  // Place the volume in ALIC
+  // Place the volume
   if (npar == 0)
     gMC->Gspos(name, copyNo, mName, xyz[0], xyz[1], xyz[2] , krot, only);
   else 
@@ -303,6 +282,20 @@ void AliMUONGeometryBuilder::CreateGeometryWithTGeo()
         AliMUONGeometryEnvelope* env 
          = (AliMUONGeometryEnvelope*)kEnvelopes->At(k);
          
+       // Check consistency of detElemId and module Id
+       if ( env->GetUniqueID() > 0 && 
+            AliMpDEManager::GetGeomModuleId(env->GetUniqueID()) 
+            != geometry->GetModuleId() ) {
+            
+         AliErrorStream() 
+           << "Detection element " << env->GetUniqueID() 
+           << " is being placed in geometry module " << geometry->GetModuleId()
+           << " but should go in " 
+           << AliMpDEManager::GetGeomModuleId(env->GetUniqueID())
+           <<  endl;
+         AliFatal("Inconsistent IDs");
+       }          
+         
         const TGeoCombiTrans* kEnvTrans = env->GetTransformation();
         const char* only = "ONLY";
         if (env->IsMANY()) only = "MANY";
@@ -352,7 +345,7 @@ void AliMUONGeometryBuilder::CreateGeometryWithTGeo()
 void AliMUONGeometryBuilder::CreateGeometryWithoutTGeo()
 {
 /// Construct geometry using geometry builders.
-/// Virtual modules/enevlopes are not placed
+/// Virtual modules/envelopes are not placed
 
   if (fAlign) {
     // Read transformations from ASCII data file  
@@ -400,6 +393,20 @@ void AliMUONGeometryBuilder::CreateGeometryWithoutTGeo()
         AliMUONGeometryEnvelope* env 
          = (AliMUONGeometryEnvelope*)kEnvelopes->At(k);
          
+       // Check consistency of detElemId and module Id
+       if ( env->GetUniqueID() > 0 && 
+            AliMpDEManager::GetGeomModuleId(env->GetUniqueID()) 
+            != geometry->GetModuleId() ) {
+            
+         AliErrorStream() 
+           << "Detection element " << env->GetUniqueID() 
+           << " is being placed in geometry module " << geometry->GetModuleId()
+           << " but should go in " 
+           << AliMpDEManager::GetGeomModuleId(env->GetUniqueID())
+           <<  endl;
+         AliFatal("Inconsistent IDs");
+       }          
+         
         const TGeoCombiTrans* kEnvTrans = env->GetTransformation();
         const char* only = "ONLY";
         if (env->IsMANY()) only = "MANY";
@@ -422,7 +429,7 @@ void AliMUONGeometryBuilder::CreateGeometryWithoutTGeo()
 
         if (!env->IsVirtual() && env->GetConstituents()->GetEntriesFast() == 0 ) {
           // non virtual envelope + nof constituents = 0 
-          //        => place envelope in ALICE by composed transformation:
+          //        => place envelope by composed transformation:
           //           Tch * [Tglobal] * Tenv
 
           // Compound chamber transformation with the envelope one
@@ -446,7 +453,7 @@ void AliMUONGeometryBuilder::CreateGeometryWithoutTGeo()
         if (env->IsVirtual() && env->GetConstituents()->GetEntriesFast() > 0 ) {
           // virtual envelope + nof constituents > 0 
           //         => do not place envelope and place constituents
-          //            in ALICE by composed transformation:
+          //            by composed transformation:
           //            Tch * [Tglobal] * Tenv * Tconst   
 
           for  (Int_t l=0; l<env->GetConstituents()->GetEntriesFast(); l++) {
@@ -562,7 +569,7 @@ void AliMUONGeometryBuilder::InitGeometry(const TString& svmapFileName)
 
   // Read sensitive volume map from a file
   fGeometry->ReadSVMap(svmapFileName);
-      
+
   // Set the chamber (sensitive region) GEANT identifier
   //
   for (Int_t i=0; i<fGeometryBuilders->GetEntriesFast(); i++) {
@@ -625,7 +632,7 @@ void AliMUONGeometryBuilder::SetAlign(Bool_t align)
 //_____________________________________________________________________________
 void AliMUONGeometryBuilder::SetAlign(const TString& fileName, Bool_t align)
 { 
-/// Set the option for alignement
+/// Set the option for alignement and the transformations file name
 
   fTransformFileName = fileName;
   fAlign = align;