]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSt1GeometryBuilderV2.cxx
First version of trigger preprocessor (only local and regional masks so far)
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1GeometryBuilderV2.cxx
index 31d0d6dd2d51266511ad83c723c70fcccfc78039..f4a1b52b1b3f8ac88da1bfb187cfc57420604e85 100644 (file)
 
 // $Id$
 //
-// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
-//
+//-----------------------------------------------------------------------------
 // Class AliMUONSt1GeometryBuilderV2
 // ---------------------------------
 // MUON Station1 detailed geometry construction class.
 // (Originally defined in AliMUONv2.cxx - now removed.)
 // Included in AliRoot 2004/01/23
+// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
+//-----------------------------------------------------------------------------
 
 #include "AliMUONSt1GeometryBuilderV2.h"
 #include "AliMUONSt1SpecialMotif.h"
 #include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryEnvelopeStore.h"
 
+#include "AliMpSegmentation.h"
+#include "AliMpDEManager.h"
 #include "AliMpContainers.h"
 #include "AliMpConstants.h"
-#include "AliMpFiles.h"
-#include "AliMpSectorReader.h"
+#include "AliMpCDB.h"
+#include "AliMpSectorSegmentation.h"
 #include "AliMpSector.h"
 #include "AliMpRow.h"
 #include "AliMpVRowSegment.h"
@@ -130,21 +133,10 @@ const Int_t AliMUONSt1GeometryBuilderV2::fgkDaughterCopyNoOffset=1000;
 
 //______________________________________________________________________________
 AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2(AliMUON* muon)
-  : AliMUONVGeometryBuilder(0, 1),
+  : AliMUONVGeometryBuilder(0, 2),
     fMUON(muon)
 {
 /// Standard constructor
-
-   // set path to mapping data files
-   if (! gSystem->Getenv("MINSTALL")) {    
-     TString dirPath = gSystem->Getenv("ALICE_ROOT");
-     dirPath += "/MUON/mapping"; 
-     AliMpFiles::SetTopPath(dirPath);
-     gSystem->Setenv("MINSTALL", dirPath.Data());
-     //cout << "AliMpFiles top path set to " << dirPath << endl;         
-   }
-   //else
-   //  cout << gSystem->Getenv("MINSTALL") << endl;              
 }
  
 //______________________________________________________________________________
@@ -154,15 +146,6 @@ AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2()
 {
 /// Default Constructor
 }
-//______________________________________________________________________________
-AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2(const AliMUONSt1GeometryBuilderV2& rhs)
-  : AliMUONVGeometryBuilder(rhs)
-{
-/// Dummy copy constructor
-
- AliFatal("Copy constructor is not implemented.");
-}
 
 //______________________________________________________________________________
 AliMUONSt1GeometryBuilderV2::~AliMUONSt1GeometryBuilderV2()
@@ -171,20 +154,6 @@ AliMUONSt1GeometryBuilderV2::~AliMUONSt1GeometryBuilderV2()
 }
 
 
-//______________________________________________________________________________
-AliMUONSt1GeometryBuilderV2& 
-AliMUONSt1GeometryBuilderV2::operator = (const AliMUONSt1GeometryBuilderV2& rhs) 
-{
-/// Assignment operator
-
-  // check assignement to self
-  if (this == &rhs) return *this;
-
-  AliFatal("Assignment operator is not implemented.");
-    
-  return *this;  
-}
-
 //
 //  Private methods
 //
@@ -291,9 +260,9 @@ void AliMUONSt1GeometryBuilderV2::CreateInnerLayers()
 
 // Gas Medium
   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099; 
-  //Int_t idArCO2  = idtmed[1108];  // medium 9 (ArCO2 80%) 
+  Int_t idArCO2  = idtmed[1108];  // medium 9 (ArCO2 80%) 
   //Int_t idCopper  = idtmed[1109]; // medium 10 = copper
-  Int_t idArCO2   = idtmed[1124]; // medium 25 (ArCO2 80%) 
+  //Int_t idArCO2   = idtmed[1124]; // medium 25 (ArCO2 80%) 
   Int_t idCopper  = idtmed[1121]; // medium 22 = copper
 
   Float_t par[11];
@@ -522,15 +491,30 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
   specialMap.Add(47, (Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01, 0.36)));
 #endif
 
-  AliMpSectorReader reader1(kStation1, kBendingPlane);
-  AliMpSector* sector1 = reader1.BuildSector();
-
+  // Load mapping from OCDB
+  if ( ! AliMpSegmentation::Instance() ) {
+    AliFatal("Mapping has to be loaded first !");
+  }
+       
+  const AliMpSectorSegmentation* kSegmentation1 
+    = dynamic_cast<const AliMpSectorSegmentation*>(
+        AliMpSegmentation::Instance()
+          ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kBendingPlane))); 
+  if ( ! kSegmentation1 ) {
+    AliFatal("Could not access sector segmentation !");
+  }
+    
+  const AliMpSector* kSector1 = kSegmentation1->GetSector();
+/*
+  AliMpSectorReader reader1(AliMp::kStation1, AliMp::kBendingPlane);
+  AliMpSector* kSector1 = reader1.BuildSector();
+*/
   //Bool_t reflectZ = true;
   Bool_t reflectZ = false;
   //TVector3 where = TVector3(2.5+0.1+0.56+0.001, 2.5+0.1+0.001, 0.);
   TVector3 where = TVector3(fgkDeltaQuadLHC + fgkPadXOffsetBP, 
                             fgkDeltaQuadLHC + fgkPadYOffsetBP, 0.);
-  PlaceSector(sector1, specialMap, where, reflectZ, chamber);
+  PlaceSector(kSector1, specialMap, where, reflectZ, chamber);
   
 #ifdef WITH_STL
   specialMap.clear();
@@ -546,7 +530,7 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
 #endif
 
 #ifdef WITH_ROOT
-  Int_t nb = AliMpConstants::ManuMask(kNonBendingPlane);
+  Int_t nb = AliMpConstants::ManuMask(AliMp::kNonBendingPlane);
   specialMap.Delete();
   specialMap.Add(76 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01,0.59),90.));
   specialMap.Add(75 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.96, 0.17)));
@@ -558,18 +542,28 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
       // in the true position)   
       // Was: specialMap.Add(47,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.61,-1.18)));
 #endif
-
-  AliMpSectorReader reader2(kStation1, kNonBendingPlane);
+/*
+  AliMpSectorReader reader2(AliMp::kStation1, AliMp::kNonBendingPlane);
   AliMpSector* sector2 = reader2.BuildSector();
-  
+*/  
+  const AliMpSectorSegmentation* kSegmentation2 
+    = dynamic_cast<const AliMpSectorSegmentation*>(
+        AliMpSegmentation::Instance()
+          ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kNonBendingPlane))); 
+  if ( ! kSegmentation2 ) {
+    AliFatal("Could not access sector segmentation !");
+  }
+    
+  const AliMpSector* kSector2 = kSegmentation2->GetSector();
+
   //reflectZ = false;
   reflectZ = true;
-  TVector2 offset = sector2->Position();
+  TVector2 offset = kSector2->Position();
   where = TVector3(where.X()+offset.X(), where.Y()+offset.Y(), 0.); 
       // Add the half-pad shift of the non-bending plane wrt bending plane
       // (The shift is defined in the mapping as sector offset)
       // Fix (4) - was TVector3(where.X()+0.63/2, ... - now it is -0.63/2
-  PlaceSector(sector2, specialMap, where, reflectZ, chamber);
+  PlaceSector(kSector2, specialMap, where, reflectZ, chamber);
 
 #ifdef WITH_ROOT
   specialMap.Delete();
@@ -1141,8 +1135,7 @@ void AliMUONSt1GeometryBuilderV2::CreateFrame(Int_t chamber)
 // Replace the volume shape with a composite shape
 // with substracted overlap with beam shield (YMOT)
 
-  if ( gMC->IsRootGeometrySupported() &&
-       TString(gMC->ClassName()) != "TGeant4") { 
+  if ( gMC->IsRootGeometrySupported() ) { 
 
     // Get shape
     TGeoVolume* mlayer 
@@ -2158,7 +2151,8 @@ void AliMUONSt1GeometryBuilderV2::PlaceInnerLayers(Int_t chamber)
 }
 
 //______________________________________________________________________________
-void AliMUONSt1GeometryBuilderV2::PlaceSector(AliMpSector* sector,SpecialMap specialMap, 
+void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
+                            SpecialMap specialMap, 
                             const TVector3& where, Bool_t reflectZ, Int_t chamber)
 {
 /// Place all the segments in the mother volume, at the position defined
@@ -2229,7 +2223,7 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(AliMpSector* sector,SpecialMap spe
           AliMpMotifPosition* motifPos = 
             sector->GetMotifMap()->FindMotifPosition(motifPosId);
          Int_t copyNo = motifPosId;
-         if ( sector->GetDirection() == kX) copyNo += fgkDaughterCopyNoOffset;
+         if ( sector->GetDirection() == AliMp::kX) copyNo += fgkDaughterCopyNoOffset;
   
           // Position
           posX = where.X() + motifPos->Position().X() + fgkOffsetX;
@@ -2271,7 +2265,7 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(AliMpSector* sector,SpecialMap spe
 
           // Copy number
          Int_t copyNo = motifPosId;
-         if ( sector->GetDirection() == kX) copyNo += fgkDaughterCopyNoOffset;
+         if ( sector->GetDirection() == AliMp::kX) copyNo += fgkDaughterCopyNoOffset;
 
           // place the hole for the motif, wrt the requested rotation angle
           Int_t rot = ( spMot.GetRotAngle()<0.1 ) ? reflZ:rotMat;
@@ -2355,6 +2349,7 @@ void AliMUONSt1GeometryBuilderV2::CreateMaterials()
 //  AliMedium(12, "VETRONITE         ",  32, 0, iSXFLD, ... 
 //  AliMedium(13, "CARBON            ",  33, 0, iSXFLD, ... 
 //  AliMedium(14, "Rohacell          ",  34, 0, iSXFLD, ... 
+//  AliMedium(24, "FrameCH$          ",  44, 1, iSXFLD, ...
 
   //
   // --- Define materials for GEANT ---
@@ -2368,14 +2363,14 @@ void AliMUONSt1GeometryBuilderV2::CreateMaterials()
   // --- Define mixtures for GEANT ---
   //
 
-  //     Ar-CO2 gas II (80%+20%)
-  Float_t ag1[2]   = { 39.95,  44.01};
-  Float_t zg1[2]   = { 18., 22.};
-  Float_t wg1[2]   = { .8, 0.2};
-  Float_t dg1      = .001821;
-  fMUON->AliMixture(45, "ArCO2 II 80%$", ag1, zg1, dg1, 2, wg1);  
-            // was id: 22
-            // use wg1 weighting factors (6th arg > 0)
+ //  //     Ar-CO2 gas II (80%+20%)   
+//   Float_t ag1[2]   = { 39.95,  44.01};
+//   Float_t zg1[2]   = { 18., 22.};
+//   Float_t wg1[2]   = { .8, 0.2};
+//   Float_t dg1      = .001821;
+//   fMUON->AliMixture(45, "ArCO2 II 80%$", ag1, zg1, dg1, 2, wg1);  
+//             // was id: 22
+//             // use wg1 weighting factors (6th arg > 0)
 
   // Rohacell 51  II - imide methacrylique
   Float_t aRohacell51[4] = { 12.01, 1.01, 16.00, 14.01}; 
@@ -2430,20 +2425,17 @@ void AliMUONSt1GeometryBuilderV2::CreateMaterials()
   GReal_t stmin  = -.8;
   GReal_t maxStepAlu   = fMUON->GetMaxStepAlu();
   GReal_t maxDestepAlu = fMUON->GetMaxDestepAlu();
-  GReal_t maxStepGas   = fMUON->GetMaxStepGas();
+  // GReal_t maxStepGas   = fMUON->GetMaxStepGas();
   Int_t iSXFLD   = gAlice->Field()->PrecInteg();
   Float_t sXMGMX = gAlice->Field()->Max();
 
   fMUON->AliMedium(21, "ALU_II$",    41, 0, iSXFLD, sXMGMX, 
                    tmaxfd, maxStepAlu, maxDestepAlu, epsil, stmin);
 
-                  // was med: 15  mat: 31 
-  fMUON->AliMedium(24, "FrameCH$",   44, 1, iSXFLD, sXMGMX, 
-                   10.0, 0.001, 0.001, 0.001, 0.001);
                   // was med: 20  mat: 36
-  fMUON->AliMedium(25, "ARG_CO2_II", 45, 1, iSXFLD, sXMGMX,
-                   tmaxfd, maxStepGas, maxDestepAlu, epsil, stmin);
-                  // was med: 9   mat: 22
//  fMUON->AliMedium(25, "ARG_CO2_II", 45, 1, iSXFLD, sXMGMX,
+//                    tmaxfd, maxStepGas, maxDestepAlu, epsil, stmin);
+//                // was med: 9   mat: 22
   fMUON->AliMedium(26, "FOAM_CH$",   46, 0, iSXFLD, sXMGMX,
                    10.0,  0.1, 0.1, 0.1, 0.1, 0, 0) ;
                   // was med: 16  mat: 32