]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSt1GeometryBuilderV2.cxx
Updated for new numbering of motif positions in mapping.
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1GeometryBuilderV2.cxx
index c177550389b34f6f851cae3881226f9c969fff6b..b19e6ad28e6daa901f99d78f034c98baa09a02fb 100644 (file)
 #include "AliMpMotifMap.h"
 #include "AliMpMotifPosition.h"
 
+#include "AliRun.h"
+#include "AliMagF.h"
+#include "AliLog.h"
+
 #include "AliMUONSt1GeometryBuilderV2.h"
 #include "AliMUONSt1SpecialMotif.h"
 #include "AliMUON.h"
 #include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
+#include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryEnvelopeStore.h"
-#include "AliRun.h"
-#include "AliMagF.h"
 
 ClassImp(AliMUONSt1GeometryBuilderV2)
 
@@ -108,11 +110,13 @@ const char  AliMUONSt1GeometryBuilderV2::fgkFoamLayerSuffix='F';  // prefix for
 const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantMLayerName="SQM";
 const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantNLayerName="SQN";
 const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantFLayerName="SQF";
+const Int_t AliMUONSt1GeometryBuilderV2::fgkDaughterCopyNoOffset=1000;
 
 //______________________________________________________________________________
 AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2(AliMUON* muon)
   : AliMUONVGeometryBuilder("st1V2.dat",
-                            &muon->Chamber(0), &muon->Chamber(1)),
+                            muon->Chamber(0).GetGeometry(), 
+                           muon->Chamber(1).GetGeometry()),
     fMUON(muon)
 {
    // set path to mapping data files
@@ -142,8 +146,7 @@ AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2(const AliMUONSt1Geometr
 {
 // Dummy copy constructor
 
- Fatal("Copy constructor", 
-        "Copy constructor is not implemented.");
+ AliFatal("Copy constructor is not implemented.");
 }
 
 //______________________________________________________________________________
@@ -160,8 +163,7 @@ AliMUONSt1GeometryBuilderV2::operator = (const AliMUONSt1GeometryBuilderV2& rhs)
   // check assignement to self
   if (this == &rhs) return *this;
 
-  Fatal("operator=", 
-        "Assignment operator is not implemented.");
+  AliFatal("Assignment operator is not implemented.");
     
   return *this;  
 }
@@ -484,16 +486,16 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
 
 #ifdef ST1_WITH_STL
   SpecialMap specialMap;
-  specialMap[1001] = AliMUONSt1SpecialMotif(TVector2( 0.1, 0.84), 90.);
-  specialMap[1002] = AliMUONSt1SpecialMotif(TVector2( 0.5, 0.36));
-  specialMap[1003] = AliMUONSt1SpecialMotif(TVector2(1.01, 0.36));
+  specialMap[76] = AliMUONSt1SpecialMotif(TVector2( 0.1, 0.84), 90.);
+  specialMap[75] = AliMUONSt1SpecialMotif(TVector2( 0.5, 0.36));
+  specialMap[47] = AliMUONSt1SpecialMotif(TVector2(1.01, 0.36));
 #endif
   
 #ifdef ST1_WITH_ROOT
   SpecialMap specialMap;
-  specialMap.Add(1001, (Long_t) new AliMUONSt1SpecialMotif(TVector2( 0.1, 0.84), 90.));
-  specialMap.Add(1002, (Long_t) new AliMUONSt1SpecialMotif(TVector2( 0.5, 0.36)));
-  specialMap.Add(1003, (Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01, 0.36)));
+  specialMap.Add(76, (Long_t) new AliMUONSt1SpecialMotif(TVector2( 0.1, 0.84), 90.));
+  specialMap.Add(75, (Long_t) new AliMUONSt1SpecialMotif(TVector2( 0.5, 0.36)));
+  specialMap.Add(47, (Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01, 0.36)));
 #endif
 
   AliMpReader reader1(kStation1, kBendingPlane);
@@ -505,22 +507,22 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
   
 #ifdef ST1_WITH_STL
   specialMap.clear();
-  specialMap[4001] = AliMUONSt1SpecialMotif(TVector2(1.01,0.59),90.);
-  specialMap[4002] = AliMUONSt1SpecialMotif(TVector2(1.96, 0.17));
-  specialMap[4003] = AliMUONSt1SpecialMotif(TVector2(1.61,-1.18));
-  specialMap[4004] = AliMUONSt1SpecialMotif(TVector2(0.2 ,-0.08));
-  specialMap[4005] = AliMUONSt1SpecialMotif(TVector2(0.2 , 0.25));
-  specialMap[4006] = AliMUONSt1SpecialMotif(TVector2(0.28, 0.21));
+  specialMap[76] = AliMUONSt1SpecialMotif(TVector2(1.01,0.59),90.);
+  specialMap[75] = AliMUONSt1SpecialMotif(TVector2(1.96, 0.17));
+  specialMap[47] = AliMUONSt1SpecialMotif(TVector2(1.61,-1.18));
+  specialMap[20] = AliMUONSt1SpecialMotif(TVector2(0.2 ,-0.08));
+  specialMap[46] = AliMUONSt1SpecialMotif(TVector2(0.2 , 0.25));
+  specialMap[74] = AliMUONSt1SpecialMotif(TVector2(0.28, 0.21));
 #endif
 
 #ifdef ST1_WITH_ROOT
   specialMap.Delete();
-  specialMap.Add(4001,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01,0.59),90.));
-  specialMap.Add(4002,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.96, 0.17)));
-  specialMap.Add(4003,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.61,-1.18)));
-  specialMap.Add(4004,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.2 ,-0.08)));
-  specialMap.Add(4005,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.2 , 0.25)));
-  specialMap.Add(4006,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.28, 0.21)));
+  specialMap.Add(76,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01,0.59),90.));
+  specialMap.Add(75,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.96, 0.17)));
+  specialMap.Add(47,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.61,-1.18)));
+  specialMap.Add(20,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.2 ,-0.08)));
+  specialMap.Add(46,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.2 , 0.25)));
+  specialMap.Add(74,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.28, 0.21)));
 #endif
 
   AliMpReader reader2(kStation1, kNonBendingPlane);
@@ -2135,14 +2137,20 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(AliMpSector* sector,SpecialMap spe
 
         // and place all the daughter boards of this segment
         for (Int_t motifNum=0;motifNum<seg->GetNofMotifs();motifNum++) {
+
+         // Copy number
           Int_t motifPosId = seg->GetMotifPositionId(motifNum);
           AliMpMotifPosition* motifPos = 
             sector->GetMotifMap()->FindMotifPosition(motifPosId);
+         Int_t copyNo = motifPosId;
+         if ( sector->GetDirection() == kX) copyNo += fgkDaughterCopyNoOffset;
   
+          // Position
           posX = where.X() + motifPos->Position().X()/10.+fgkOffsetX;
           posY = where.Y() + motifPos->Position().Y()/10.+fgkOffsetY;
          posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
-          gMC->Gspos(fgkDaughterName, motifPosId, QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
+
+          gMC->Gspos(fgkDaughterName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
         }  
         segNum++;
        
@@ -2175,19 +2183,23 @@ void AliMUONSt1GeometryBuilderV2::PlaceSector(AliMpSector* sector,SpecialMap spe
 
           AliMpMotifPosition* motifPos = sector->GetMotifMap()->FindMotifPosition(motifPosId);
 
+          // Copy number
+         Int_t copyNo = motifPosId;
+         if ( sector->GetDirection() == kX) copyNo += fgkDaughterCopyNoOffset;
+
           // 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();
           posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
-          gMC->Gspos(fgkHoleName, motifPosId, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
+          gMC->Gspos(fgkHoleName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
 
           // then place the daughter board for the motif, wrt the requested rotation angle
           posX = posX+fgkDeltaFilleEtamX;
           posY = posY+fgkDeltaFilleEtamY;
          posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
-          gMC->Gspos(fgkDaughterName, motifPosId, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
+          gMC->Gspos(fgkDaughterName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
 
 #ifdef ST1_WITH_STL
           alreadyDone.push_back(motifPosId);// mark this motif as done
@@ -2301,18 +2313,6 @@ void AliMUONSt1GeometryBuilderV2::CreateMaterials()
        // was id: 9
        // from PDG and "The Particle Detector BriefBook", Bock and Vasilescu, P.18  
         // ??? same but the last but one argument < 0 
-  
-  fMUON->AliMaterial(42, "Copper$", 63.546,29.,8.96,-1.43,9.6);
-       // was id: 30
-
-  fMUON->AliMaterial(43, "FR4$", 17.749, 8.875, 1.7, -19.4, 999.);    // from DPG
-       // was id: 31
-
-  fMUON->AliMaterial(44, "FrameEpoxy",12.24,6.0,1.85,-19.14,999);// use 16.75cm
-        // was id: 36
-        // Density of FrameEpoxy only from manufacturer's specifications
-        // Frame composite epoxy , X0 in g/cm**2 (guestimation!)
-  
   //
   // --- Define mixtures for GEANT ---
   //
@@ -2354,7 +2354,6 @@ void AliMUONSt1GeometryBuilderV2::CreateMaterials()
  
   // Not used, to be removed
   //
-  fMUON->AliMaterial(49, "Kapton$", 12.01,6,1.42,-28.6,999);          // from DPG
        // was id: 34
 
   // Inox/Stainless Steel (18%Cr, 9%Ni)
@@ -2386,12 +2385,7 @@ void AliMUONSt1GeometryBuilderV2::CreateMaterials()
 
   fMUON->AliMedium(21, "ALU_II$",    41, 0, iSXFLD, sXMGMX, 
                    tmaxfd, maxStepAlu, maxDestepAlu, epsil, stmin);
-                  // was med: 4  mat: 9
-  fMUON->AliMedium(22, "COPPER_II$", 42, 0, iSXFLD, sXMGMX, 
-                   tmaxfd, maxStepAlu, maxDestepAlu, epsil, stmin);
-                  // was med: 10  mat: 30
-  fMUON->AliMedium(23, "FR4_CH$",    43, 0, iSXFLD, sXMGMX, 
-                   10.0, 0.01, 0.1, 0.003, 0.003);
+
                   // was med: 15  mat: 31 
   fMUON->AliMedium(24, "FrameCH$",   44, 1, iSXFLD, sXMGMX, 
                    10.0, 0.001, 0.001, 0.001, 0.001);
@@ -2411,9 +2405,7 @@ void AliMUONSt1GeometryBuilderV2::CreateMaterials()
 
   // Not used, to be romoved
   //
-  fMUON->AliMedium(29, "Kapton$",    49, 0, iSXFLD, sXMGMX,  
-                   10.0, 0.01, 1.0, 0.003, 0.003);
-                  // was med: 18  mat: 34 
+
   fMUON->AliMedium(30, "InoxBolts$", 50, 1, iSXFLD, sXMGMX, 
                    10.0, 0.01, 1.0, 0.003, 0.003);
                   // was med: 21  mat: 37
@@ -2444,11 +2436,15 @@ void AliMUONSt1GeometryBuilderV2::CreateGeometry()
   fMUON->AliMatrix(reflXY,  90., 180., 90., 270., 0., 0.);
 */
   // Define transformations for each quadrant
+  // In old coordinate system:        In new coordinate system:
+  // 
   // 
-  //     II. |  I.
-  //   _____ | ____
-  //         |
-  //    III. |  IV.
+  //     II. |  I.                   I. |  II. 
+  //         |                    (151) | (100)
+  //   _____ | ____               _____ | ____                         
+  //         |                          |
+  //    III. |  IV.                 IV. | III.
+  //                              (150) | (101) 
   // 
 /*
   Int_t rotm[4];
@@ -2470,10 +2466,10 @@ void AliMUONSt1GeometryBuilderV2::CreateGeometry()
   scale[3] = TVector3( 1, -1, -1);  // quadrant IV
   
   Int_t  detElemId[4];  
-  detElemId[0] =  0;  // quadrant I
-  detElemId[1] = 51;  // quadrant II
-  detElemId[2] = 50;  // quadrant III
-  detElemId[3] =  1;  // quadrant IV
+  detElemId[0] = 51;  // quadrant I
+  detElemId[1] =  0;  // quadrant II
+  detElemId[2] =  1;  // quadrant III
+  detElemId[3] = 50;  // quadrant IV
   
   // Shift in Z of the middle layer
   Double_t deltaZ = 6.5/2.;         
@@ -2531,12 +2527,12 @@ void AliMUONSt1GeometryBuilderV2::SetTransformations()
 // Defines the transformations for the station2 chambers.
 // ---
 
-  AliMUONChamber* iChamber1 = GetChamber(0);
+  AliMUONChamber* iChamber1 = &fMUON->Chamber(0);
   Double_t zpos1 = - iChamber1->Z(); 
   iChamber1->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos1));
 
-  AliMUONChamber* iChamber2 = GetChamber(1);
+  AliMUONChamber* iChamber2 = &fMUON->Chamber(1);
   Double_t zpos2 = - iChamber2->Z(); 
   iChamber2->GetGeometry()
     ->SetTranslation(TGeoTranslation(0., 0., zpos2));
@@ -2548,28 +2544,28 @@ void AliMUONSt1GeometryBuilderV2::SetSensitiveVolumes()
 // Defines the sensitive volumes for station2 chambers.
 // ---
 
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SA1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SB1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SC1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SD1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SE1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SF1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SG1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SH1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SI1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SJ1G");
-  GetChamber(0)->GetGeometry()->SetSensitiveVolume("SK1G");
+  GetGeometry(0)->SetSensitiveVolume("SA1G");
+  GetGeometry(0)->SetSensitiveVolume("SB1G");
+  GetGeometry(0)->SetSensitiveVolume("SC1G");
+  GetGeometry(0)->SetSensitiveVolume("SD1G");
+  GetGeometry(0)->SetSensitiveVolume("SE1G");
+  GetGeometry(0)->SetSensitiveVolume("SF1G");
+  GetGeometry(0)->SetSensitiveVolume("SG1G");
+  GetGeometry(0)->SetSensitiveVolume("SH1G");
+  GetGeometry(0)->SetSensitiveVolume("SI1G");
+  GetGeometry(0)->SetSensitiveVolume("SJ1G");
+  GetGeometry(0)->SetSensitiveVolume("SK1G");
     
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SA2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SB2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SC2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SD2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SE2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SF2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SG2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SH2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SI2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SJ2G");
-  GetChamber(1)->GetGeometry()->SetSensitiveVolume("SK2G");
+  GetGeometry(1)->SetSensitiveVolume("SA2G");
+  GetGeometry(1)->SetSensitiveVolume("SB2G");
+  GetGeometry(1)->SetSensitiveVolume("SC2G");
+  GetGeometry(1)->SetSensitiveVolume("SD2G");
+  GetGeometry(1)->SetSensitiveVolume("SE2G");
+  GetGeometry(1)->SetSensitiveVolume("SF2G");
+  GetGeometry(1)->SetSensitiveVolume("SG2G");
+  GetGeometry(1)->SetSensitiveVolume("SH2G");
+  GetGeometry(1)->SetSensitiveVolume("SI2G");
+  GetGeometry(1)->SetSensitiveVolume("SJ2G");
+  GetGeometry(1)->SetSensitiveVolume("SK2G");
 }