]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSt1GeometryBuilderV2.cxx
New TGeo features allow us to avoid the use of MANY.
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1GeometryBuilderV2.cxx
index fb5f574f858e6bc40cdddc570f202798d77daecd..63ca64d6d5b052e07bb5a32c64da1d730e6813f2 100644 (file)
@@ -40,7 +40,7 @@
 #include <TVirtualMC.h>
 
 #include "AliMpFiles.h"
-#include "AliMpReader.h"
+#include "AliMpSectorReader.h"
 #include "AliMpSector.h"
 #include "AliMpRow.h"
 #include "AliMpVRowSegment.h"
@@ -54,7 +54,7 @@
 #include "AliMUONSt1GeometryBuilderV2.h"
 #include "AliMUONSt1SpecialMotif.h"
 #include "AliMUON.h"
-#include "AliMUONChamber.h"
+#include "AliMUONConstants.h"
 #include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryEnvelopeStore.h"
 
@@ -120,16 +120,14 @@ const Int_t AliMUONSt1GeometryBuilderV2::fgkDaughterCopyNoOffset=1000;
 
 //______________________________________________________________________________
 AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2(AliMUON* muon)
-  : AliMUONVGeometryBuilder("st1V2.dat",
-                            muon->Chamber(0).GetGeometry(), 
-                           muon->Chamber(1).GetGeometry()),
+  : AliMUONVGeometryBuilder(0, 1),
     fMUON(muon)
 {
    // set path to mapping data files
    if (! gSystem->Getenv("MINSTALL")) {    
      TString dirPath = gSystem->Getenv("ALICE_ROOT");
      dirPath += "/MUON/mapping"; 
-     AliMpFiles::Instance()->SetTopPath(dirPath);
+     AliMpFiles::SetTopPath(dirPath);
      gSystem->Setenv("MINSTALL", dirPath.Data());
      //cout << "AliMpFiles top path set to " << dirPath << endl;         
    }
@@ -514,7 +512,7 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
   specialMap.Add(47, (Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01, 0.36)));
 #endif
 
-  AliMpReader reader1(kStation1, kBendingPlane);
+  AliMpSectorReader reader1(kStation1, kBendingPlane);
   AliMpSector* sector1 = reader1.BuildSector();
 
   //Bool_t reflectZ = true;
@@ -550,13 +548,13 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
       // Was: specialMap.Add(47,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.61,-1.18)));
 #endif
 
-  AliMpReader reader2(kStation1, kNonBendingPlane);
+  AliMpSectorReader reader2(kStation1, kNonBendingPlane);
   AliMpSector* sector2 = reader2.BuildSector();
   
   //reflectZ = false;
   reflectZ = true;
-  TVector2 offset = sector2->Offset();
-  where = TVector3(where.X()+offset.X()/10., where.Y()+offset.Y()/10., 0.); 
+  TVector2 offset = sector2->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
@@ -2171,10 +2169,10 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(AliMpSector* sector,SpecialMap spe
       
         // create the cathode part
         sprintf(segName,"%.3dM", segNum);
-        CreatePlaneSegment(segName, seg->Dimensions()/10., seg->GetNofMotifs());
+        CreatePlaneSegment(segName, seg->Dimensions(), seg->GetNofMotifs());
   
-        posX = where.X() + seg->Position().X()/10.;
-        posY = where.Y() + seg->Position().Y()/10.;
+        posX = where.X() + seg->Position().X();
+        posY = where.Y() + seg->Position().Y();
         posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
         gMC->Gspos(segName, 1, QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
 
@@ -2189,8 +2187,8 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(AliMpSector* sector,SpecialMap spe
          if ( sector->GetDirection() == kX) copyNo += fgkDaughterCopyNoOffset;
   
           // Position
-          posX = where.X() + motifPos->Position().X()/10.+fgkOffsetX;
-          posY = where.Y() + motifPos->Position().Y()/10.+fgkOffsetY;
+          posX = where.X() + motifPos->Position().X() + fgkOffsetX;
+          posY = where.Y() + motifPos->Position().Y() + fgkOffsetY;
          posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
 
           gMC->Gspos(fgkDaughterName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
@@ -2233,8 +2231,8 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(AliMpSector* sector,SpecialMap spe
           // place the hole for the motif, wrt the requested rotation angle
           Int_t rot = ( spMot.GetRotAngle()<0.1 ) ? reflZ:rotMat;
 
-          posX = where.X() + motifPos->Position().X()/10.+spMot.GetDelta().X();
-          posY = where.Y() + motifPos->Position().Y()/10.+spMot.GetDelta().Y();
+          posX = where.X() + motifPos->Position().X() + spMot.GetDelta().X();
+          posY = where.Y() + motifPos->Position().Y() + spMot.GetDelta().Y();
           posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
           gMC->Gspos(fgkHoleName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
 
@@ -2514,9 +2512,7 @@ void AliMUONSt1GeometryBuilderV2::CreateGeometry()
   detElemId[3] =  2;  // quadrant IV
   
   // Shift in Z of the middle layer
-  // Double_t deltaZ = 7.5/2.;         
-  Double_t deltaZ = fgkMotherThick1; 
-      // Fix (6) - shift  of the middle layer = half of its thickness      
+  Double_t deltaZ = 7.5/2.;         
 
   // Position of quadrant I wrt to the chamber position
   // TVector3 pos0(-fgkDeltaQuadLHC, -fgkDeltaQuadLHC, deltaZ);
@@ -2580,15 +2576,11 @@ void AliMUONSt1GeometryBuilderV2::SetTransformations()
 // Defines the transformations for the station2 chambers.
 // ---
 
-  AliMUONChamber* iChamber1 = &fMUON->Chamber(0);
-  Double_t zpos1 = - iChamber1->Z(); 
-  iChamber1->GetGeometry()
-    ->SetTranslation(TGeoTranslation(0., 0., zpos1));
+  Double_t zpos1 = - AliMUONConstants::DefaultChamberZ(0); 
+  SetTranslation(0, TGeoTranslation(0., 0., zpos1));
 
-  AliMUONChamber* iChamber2 = &fMUON->Chamber(1);
-  Double_t zpos2 = - iChamber2->Z(); 
-  iChamber2->GetGeometry()
-    ->SetTranslation(TGeoTranslation(0., 0., zpos2));
+  Double_t zpos2 = - AliMUONConstants::DefaultChamberZ(1); 
+  SetTranslation(1, TGeoTranslation(0., 0., zpos2));
 }
 
 //______________________________________________________________________________