LCOV - code coverage report
Current view: top level - MUON/MUONsim - AliMUONSt1GeometryBuilderV2.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 768 851 90.2 %
Date: 2016-06-14 17:26:59 Functions: 26 29 89.7 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : // $Id$
      17             : //
      18             : //-----------------------------------------------------------------------------
      19             : // Class AliMUONSt1GeometryBuilderV2
      20             : // ---------------------------------
      21             : // MUON Station1 detailed geometry construction class.
      22             : // (Originally defined in AliMUONv2.cxx - now removed.)
      23             : // Included in AliRoot 2004/01/23
      24             : // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
      25             : //-----------------------------------------------------------------------------
      26             : 
      27             : #include "AliMUONSt1GeometryBuilderV2.h"
      28             : #include "AliMUONSt1SpecialMotif.h"
      29             : #include "AliMUON.h"
      30             : #include "AliMUONConstants.h"
      31             : #include "AliMUONGeometryModule.h"
      32             : #include "AliMUONGeometryEnvelopeStore.h"
      33             : 
      34             : #include "AliMpSegmentation.h"
      35             : #include "AliMpDEManager.h"
      36             : #include "AliMpConstants.h"
      37             : #include "AliMpCDB.h"
      38             : #include "AliMpSector.h"
      39             : #include "AliMpRow.h"
      40             : #include "AliMpVRowSegment.h"
      41             : #include "AliMpMotifMap.h"
      42             : #include "AliMpMotifPosition.h"
      43             : #include "AliMpPlaneType.h"
      44             : 
      45             : #include "AliRun.h"
      46             : #include "AliMagF.h"
      47             : #include "AliLog.h"
      48             : 
      49             : #include <Riostream.h>
      50             : #include <TClonesArray.h>
      51             : #include <TGeoCompositeShape.h>
      52             : #include <TGeoGlobalMagField.h>
      53             : #include <TGeoManager.h>
      54             : #include <TGeoMatrix.h>
      55             : #include <TGeoTube.h>
      56             : #include <TGeoVolume.h>
      57             : #include <TGeoXtru.h>
      58             : #include <TSystem.h>
      59             : #include <TVector2.h>
      60             : #include <TVector3.h>
      61             : #include <TVirtualMC.h>
      62             : #include <TArrayI.h>
      63             : 
      64             : using std::endl;
      65             : using std::cout;
      66             : /// \cond CLASSIMP
      67          16 : ClassImp(AliMUONSt1GeometryBuilderV2)
      68             : /// \endcond
      69             : 
      70             : // Thickness Constants
      71             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzPadPlane=0.0148/2.;     //Pad plane
      72             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzFoam = 2.503/2.;        //Foam of mechanicalplane
      73             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzFR4 = 0.062/2.;         //FR4 of mechanical plane
      74             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzSnPb = 0.0091/2.;       //Pad/Kapton connection (66 pt)
      75             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzKapton = 0.0122/2.;     //Kapton
      76             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzBergPlastic = 0.3062/2.;//Berg connector
      77             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzBergCopper = 0.1882/2.; //Berg connector
      78             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzDaughter = 0.0156/2.;   //Daughter board
      79             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzGas = 0.42/2.;          //Gas thickness
      80             : 
      81             : // Quadrant Mother volume - TUBS1 - Middle layer of model
      82             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherIR1 = 18.3;
      83             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherOR1 = 105.673;   
      84             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherThick1 = 6.5/2;  
      85             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherPhiL1 = 0.; 
      86             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherPhiU1 = 90.;
      87             : 
      88             : // Quadrant Mother volume - TUBS2 - near and far layers of model
      89             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherIR2 = 20.7;   
      90             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherOR2 = 100.073;   
      91             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherThick2 = 3.0/2; 
      92             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherPhiL2 = 0.; 
      93             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherPhiU2 = 90.;
      94             : 
      95             : // Sensitive copper pads, foam layer, PCB and electronics model parameters
      96             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxHole=1.5/2.;
      97             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyHole=6./2.;
      98             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxBergPlastic=0.74/2.;
      99             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyBergPlastic=5.09/2.;
     100             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxBergCopper=0.25/2.;
     101             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyBergCopper=3.6/2.;
     102             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxKapton=0.8/2.;
     103             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyKapton=5.7/2.;
     104             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxDaughter=2.3/2.;
     105             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyDaughter=6.3/2.;
     106             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkOffsetX=1.46;
     107             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkOffsetY=0.71;
     108             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkDeltaFilleEtamX=1.00;
     109             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkDeltaFilleEtamY=0.051;
     110             : 
     111             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkDeltaQuadLHC=2.6;  // LHC Origin wrt Quadrant Origin
     112             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkFrameOffset=5.2;
     113             :               // Fix (1) of overlap SQN* layers with SQM* ones (was 5.0)
     114             :               
     115             : // Pad planes offsets
     116             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkPadXOffsetBP =  0.50 - 0.63/2; // = 0.185
     117             : const GReal_t AliMUONSt1GeometryBuilderV2::fgkPadYOffsetBP = -0.31 - 0.42/2; // =-0.52
     118             : 
     119             : const char* AliMUONSt1GeometryBuilderV2::fgkHoleName="SCHL";      
     120             : const char* AliMUONSt1GeometryBuilderV2::fgkDaughterName="SCDB";  
     121             : const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantEnvelopeName="SE";
     122             : const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantMLayerName="SQM";
     123             : const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantNLayerName="SQN";
     124             : const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantFLayerName="SQF";
     125             : const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantMFLayerName="SQMF";
     126             : const Int_t AliMUONSt1GeometryBuilderV2::fgkFoamBoxNameOffset=200; 
     127             : const Int_t AliMUONSt1GeometryBuilderV2::fgkFR4BoxNameOffset=400; 
     128             : const Int_t AliMUONSt1GeometryBuilderV2::fgkDaughterCopyNoOffset=1000;
     129             : 
     130             : //______________________________________________________________________________
     131             : AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2(AliMUON* muon)
     132           1 :   : AliMUONVGeometryBuilder(0, 2),
     133           1 :     fMUON(muon)
     134           5 : {
     135             : /// Standard constructor
     136           2 : }
     137             :  
     138             : //______________________________________________________________________________
     139             : AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2()
     140          12 :   : AliMUONVGeometryBuilder(),
     141          12 :     fMUON(0)
     142          60 : {
     143             : /// Default Constructor
     144          24 : }
     145             : 
     146             : //______________________________________________________________________________
     147             : AliMUONSt1GeometryBuilderV2::~AliMUONSt1GeometryBuilderV2()
     148          52 : {
     149             : /// Destructor
     150          52 : }
     151             : 
     152             : 
     153             : //
     154             : //  Private methods
     155             : //
     156             : 
     157             : //______________________________________________________________________________
     158             : TString 
     159             : AliMUONSt1GeometryBuilderV2::QuadrantEnvelopeName(Int_t chamber, Int_t quadrant) const
     160             : { 
     161             : /// Generate unique envelope name from chamber Id and quadrant number
     162             : 
     163          80 :   return Form("%s%d", Form("%s%d",fgkQuadrantEnvelopeName,chamber), quadrant); 
     164             : }
     165             : 
     166             : //______________________________________________________________________________
     167             : void AliMUONSt1GeometryBuilderV2::CreateHole()
     168             : {
     169             : /// Create all the elements found inside a foam hole
     170             : 
     171           2 :   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
     172           1 :   Int_t idAir  = idtmed[1100];      // medium 1
     173             :   //Int_t idCopper  = idtmed[1109]; // medium 10 = copper 
     174           1 :   Int_t idCopper  = idtmed[1121]; // medium 22 = copper 
     175             : 
     176           1 :   GReal_t par[3];
     177             :   GReal_t posX,posY,posZ;
     178             :   
     179           1 :   par[0] = fgkHxHole;
     180           1 :   par[1] = fgkHyHole;
     181           1 :   par[2] = fgkHzFoam;
     182           1 :   TVirtualMC::GetMC()->Gsvolu(fgkHoleName,"BOX",idAir,par,3);
     183             : 
     184           1 :   par[0] = fgkHxKapton;
     185           1 :   par[1] = fgkHyKapton;
     186           1 :   par[2] = fgkHzSnPb;
     187           1 :   TVirtualMC::GetMC()->Gsvolu("SNPB", "BOX", idCopper, par, 3);
     188             :   posX = 0.;
     189             :   posY = 0.;
     190             :   posZ = -fgkHzFoam+fgkHzSnPb;
     191           1 :   TVirtualMC::GetMC()->Gspos("SNPB",1,fgkHoleName, posX, posY, posZ, 0,"ONLY");
     192             : 
     193           1 :   par[0] = fgkHxHole;
     194           1 :   par[1] = fgkHyBergPlastic;
     195           1 :   par[2] = fgkHzKapton;
     196           1 :   TVirtualMC::GetMC()->Gsvolu("SKPT", "BOX", idCopper, par, 3);
     197             :   posX = 0.;
     198             :   posY = 0.;
     199             :   posZ = 0.;
     200           1 :   TVirtualMC::GetMC()->Gspos("SKPT",1,fgkHoleName, posX, posY, posZ, 0,"ONLY");
     201           1 : }
     202             : 
     203             : //______________________________________________________________________________
     204             : void AliMUONSt1GeometryBuilderV2::CreateDaughterBoard()
     205             : {
     206             : /// Create all the elements in a daughter board
     207             : 
     208           2 :   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
     209           1 :   Int_t idAir  = idtmed[1100]; // medium 1
     210             :   //Int_t idCopper  = idtmed[1109]; // medium 10 = copper
     211             :   //Int_t idPlastic  =idtmed[1116]; // medium 17 = Plastic
     212           1 :   Int_t idCopper  = idtmed[1121]; // medium 22 = copper
     213           1 :   Int_t idPlastic  =idtmed[1127]; // medium 28 = Plastic
     214             : 
     215           1 :   GReal_t par[3];
     216             :   GReal_t posX,posY,posZ;
     217             : 
     218           1 :   par[0]=fgkHxDaughter;
     219           1 :   par[1]=fgkHyDaughter;
     220           1 :   par[2]=TotalHzDaughter();
     221           1 :   TVirtualMC::GetMC()->Gsvolu(fgkDaughterName,"BOX",idAir,par,3);
     222             :   
     223           1 :   par[0]=fgkHxBergPlastic;
     224           1 :   par[1]=fgkHyBergPlastic;
     225           1 :   par[2]=fgkHzBergPlastic;
     226           1 :   TVirtualMC::GetMC()->Gsvolu("SBGP","BOX",idPlastic,par,3);
     227             :   posX=0.;
     228             :   posY=0.;
     229           1 :   posZ = -TotalHzDaughter() + fgkHzBergPlastic;
     230           1 :   TVirtualMC::GetMC()->Gspos("SBGP",1,fgkDaughterName,posX,posY,posZ,0,"ONLY");
     231             : 
     232           1 :   par[0]=fgkHxBergCopper;
     233           1 :   par[1]=fgkHyBergCopper;
     234           1 :   par[2]=fgkHzBergCopper;
     235           1 :   TVirtualMC::GetMC()->Gsvolu("SBGC","BOX",idCopper,par,3);
     236             :   posX=0.;
     237             :   posY=0.;
     238             :   posZ=0.;
     239           1 :   TVirtualMC::GetMC()->Gspos("SBGC",1,"SBGP",posX,posY,posZ,0,"ONLY");
     240             : 
     241           1 :   par[0]=fgkHxDaughter;
     242           1 :   par[1]=fgkHyDaughter;
     243           1 :   par[2]=fgkHzDaughter;
     244           1 :   TVirtualMC::GetMC()->Gsvolu("SDGH","BOX",idCopper,par,3);
     245             :   posX=0.;
     246             :   posY=0.;
     247           1 :   posZ = -TotalHzDaughter() + 2.*fgkHzBergPlastic + fgkHzDaughter;
     248           1 :   TVirtualMC::GetMC()->Gspos("SDGH",1,fgkDaughterName,posX,posY,posZ,0,"ONLY");
     249           1 : }
     250             : 
     251             : //______________________________________________________________________________
     252             : void AliMUONSt1GeometryBuilderV2::CreateInnerLayers()
     253             : {
     254             : /// Create the layer of sensitive volumes with gas
     255             : /// and the copper layer.
     256             : /// The shape of the sensitive area is defined as an extruded
     257             : /// solid substracted with tube (to get inner circular shape). 
     258             : 
     259           2 :   TGeoMedium* kMedArCO2  = gGeoManager->GetMedium("MUON_ARG_CO2");
     260           1 :   TGeoMedium* kMedCopper = gGeoManager->GetMedium("MUON_COPPER_II");
     261             : 
     262             :   Double_t rmin = 0.0;
     263             :   Double_t rmax = fgkMotherIR1;
     264             :   Double_t hz   = fgkHzPadPlane + fgkHzGas;
     265           1 :   new TGeoTube("cutTube",rmin, rmax, hz); 
     266             : 
     267             :   Double_t maxXY = 89.0; 
     268             :   Double_t xy1   = 77.33;
     269             :   Double_t xy2   = 48.77;
     270             :   Double_t dxy1  = maxXY - xy1;
     271             :     
     272             :   Int_t nz = 2;
     273             :   Int_t nv = 6;
     274           1 :   Double_t vx[6] = {  0.0,   0.0,   xy2, maxXY, maxXY, dxy1 };
     275           1 :   Double_t vy[6] = { dxy1, maxXY, maxXY,   xy2,   0.0,  0.0 };
     276             : 
     277           1 :   TGeoXtru* xtruS1 = new TGeoXtru(nz);
     278           1 :   xtruS1->SetName("xtruS1");
     279           1 :   xtruS1->DefinePolygon(nv, vx, vy);
     280           1 :   xtruS1->DefineSection(0, -fgkHzGas,  0.0, 0.0, 1.0); 
     281           1 :   xtruS1->DefineSection(1,  fgkHzGas,  0.0, 0.0, 1.0); 
     282           1 :   TGeoCompositeShape* layerS1 = new TGeoCompositeShape("layerS1", "xtruS1-cutTube");
     283           1 :   new TGeoVolume("SA1G", layerS1, kMedArCO2 );
     284             :   
     285           1 :   TGeoXtru* xtruS2 = new TGeoXtru(nz);
     286           1 :   xtruS2->SetName("xtruS2");
     287           1 :   xtruS2->DefinePolygon(nv, vx, vy);
     288           1 :   xtruS2->DefineSection(0, -fgkHzGas,  0.0, 0.0, 1.0); 
     289           1 :   xtruS2->DefineSection(1,  fgkHzGas,  0.0, 0.0, 1.0); 
     290           1 :   TGeoCompositeShape* layerS2 = new TGeoCompositeShape("layerS2", "xtruS2-cutTube");
     291           1 :   new TGeoVolume("SA2G", layerS2, kMedArCO2 );
     292             : 
     293           1 :   TGeoXtru* xtruS3 = new TGeoXtru(nz);
     294           1 :   xtruS3->SetName("xtruS3");
     295           1 :   xtruS3->DefinePolygon(nv, vx, vy);
     296           1 :   xtruS3->DefineSection(0, -fgkHzPadPlane,  0.0, 0.0, 1.0); 
     297           1 :   xtruS3->DefineSection(1,  fgkHzPadPlane,  0.0, 0.0, 1.0); 
     298           1 :   TGeoCompositeShape* layerS3 = new TGeoCompositeShape("layerS3", "xtruS3-cutTube");
     299           1 :   new TGeoVolume("SA1C", layerS3, kMedCopper );
     300           1 : }  
     301             :   
     302             : 
     303             : //______________________________________________________________________________
     304             : void AliMUONSt1GeometryBuilderV2::CreateSpacer0()
     305             : {
     306             : /// The spacer volumes are defined according to the input prepared by Nicole Willis
     307             : /// without any modifications
     308             : ///                                                                       <pre>
     309             : /// No.    Type  Material Center (mm)            Dimensions (mm) (half lengths)
     310             : ///  5     BOX   EPOXY    408.2  430.4 522.41    5.75  1.5   25.5
     311             : ///  5P    BOX   EPOXY    408.2  445.4 522.41    5.75  1.5   25.5
     312             : ///  6     BOX   EPOXY    408.2  437.9 519.76    5.75  15.0   1.0
     313             : ///  6P    BOX   EPOXY    408.2  437.9 525.06    5.75  15.0   1.0
     314             : ///  7     CYL   INOX     408.2  437.9 522.41    r=3.0  hz=20.63
     315             : ///                                                                      </pre>
     316             : 
     317             :   // tracking medias
     318           0 :   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
     319           0 :   Int_t idFrameEpoxy = idtmed[1123]; // medium 24 = Frame Epoxy ME730  // was 20 not 16
     320           0 :   Int_t idInox = idtmed[1128];       // medium 29 Stainless Steel (18%Cr,9%Ni,Fe) // was 21 not 17
     321             : 
     322           0 :   GReal_t par[3];
     323           0 :   par[0] = 0.575;
     324           0 :   par[1] = 0.150;
     325           0 :   par[2] = 2.550;
     326           0 :   TVirtualMC::GetMC()->Gsvolu("Spacer05","BOX",idFrameEpoxy,par,3);
     327             : 
     328           0 :   par[0] = 0.575;
     329           0 :   par[1] = 1.500;
     330           0 :   par[2] = 0.100;
     331           0 :   TVirtualMC::GetMC()->Gsvolu("Spacer06","BOX",idFrameEpoxy,par,3);
     332             : 
     333           0 :   par[0] = 0.000;
     334           0 :   par[1] = 0.300;
     335           0 :   par[2] = 2.063;
     336           0 :   TVirtualMC::GetMC()->Gsvolu("Spacer07","TUBE",idInox,par,3);
     337           0 : }  
     338             : 
     339             : 
     340             : //______________________________________________________________________________
     341             : void AliMUONSt1GeometryBuilderV2::CreateSpacer()
     342             : {
     343             : /// The spacer volumes are defined according to the input prepared by Nicole Willis
     344             : /// with modifications needed to fit into existing geometry.
     345             : ///                                                                       <pre>
     346             : /// No.    Type  Material Center (mm)            Dimensions (mm) (half lengths)
     347             : ///  5     BOX   EPOXY    408.2  430.4 522.41    5.75  1.5   25.5
     348             : ///  5P    BOX   EPOXY    408.2  445.4 522.41    5.75  1.5   25.5
     349             : ///  6     BOX   EPOXY    408.2  437.9 519.76    5.75  15.0   1.0
     350             : ///  6P    BOX   EPOXY    408.2  437.9 525.06    5.75  15.0   1.0
     351             : ///  7     CYL   INOX     408.2  437.9 522.41    r=3.0  hz=20.63
     352             : ///                                                                      </pre>
     353             : /// To fit in existing volumes the volumes 5 and 7 are represented by 2 volumes
     354             : /// with half size in z (5A, &A); the dimensions of the volume 5A were also modified
     355             : /// to avoid overlaps (x made smaller, y larger to abotain the identical volume)   
     356             : 
     357             :   // tracking medias
     358           2 :   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
     359           1 :   Int_t idFrameEpoxy = idtmed[1123]; // medium 24 = Frame Epoxy ME730  // was 20 not 16
     360           1 :   Int_t idInox = idtmed[1128];       // medium 29 Stainless Steel (18%Cr,9%Ni,Fe) // was 21 not 17
     361             : 
     362             :   //GReal_t par[3];
     363             :   //par[0] = 0.575;
     364             :   //par[1] = 0.150;
     365             :   //par[2] = 2.550;
     366             :   //TVirtualMC::GetMC()->Gsvolu("Spacer5","BOX",idFrameEpoxy,par,3);
     367             : 
     368           1 :   GReal_t par[3];
     369           1 :   par[0] = 0.510;
     370           1 :   par[1] = 0.170;
     371           1 :   par[2] = 1.1515;
     372           1 :   TVirtualMC::GetMC()->Gsvolu("Spacer5A","BOX",idFrameEpoxy,par,3);
     373             : 
     374           1 :   par[0] = 0.510;
     375           1 :   par[1] = 1.500;
     376           1 :   par[2] = 0.100;
     377           1 :   TVirtualMC::GetMC()->Gsvolu("Spacer6","BOX",idFrameEpoxy,par,3);
     378             : 
     379             :   //par[0] = 0.000;
     380             :   //par[1] = 0.300;
     381             :   //par[2] = 2.063;
     382             :   //TVirtualMC::GetMC()->Gsvolu("Spacer7","TUBE",idInox,par,3);
     383             : 
     384           1 :   par[0] = 0.000;
     385           1 :   par[1] = 0.300;
     386           1 :   par[2] = 1.0315;
     387           1 :   TVirtualMC::GetMC()->Gsvolu("Spacer7A","TUBE",idInox,par,3);
     388           1 : }  
     389             : 
     390             : //______________________________________________________________________________
     391             : void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
     392             : {
     393             : /// Create the quadrant (bending and non-bending planes)
     394             : /// for the given chamber
     395             : 
     396             :   // CreateQuadrantLayersAsVolumes(chamber);
     397           4 :   CreateQuadrantLayersAsAssemblies(chamber);
     398             : 
     399           2 :   CreateFrame(chamber);
     400             :   
     401           2 :   TExMap specialMap;
     402          10 :   specialMap.Add(76, (Long_t) new AliMUONSt1SpecialMotif(TVector2( 0.1, 0.72), 90.));
     403          10 :   specialMap.Add(75, (Long_t) new AliMUONSt1SpecialMotif(TVector2( 0.7, 0.36)));
     404          10 :   specialMap.Add(47, (Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01, 0.36)));
     405             : 
     406             :   // Load mapping from OCDB
     407           4 :   if ( ! AliMpSegmentation::Instance() ) {
     408           0 :     AliFatal("Mapping has to be loaded first !");
     409             :   }
     410             :        
     411             :   const AliMpSector* kSector1 
     412           6 :     = AliMpSegmentation::Instance()->GetSector(100, AliMpDEManager::GetCathod(100, AliMp::kBendingPlane));
     413           2 :   if ( ! kSector1 ) {
     414           0 :     AliFatal("Could not access sector segmentation !");
     415             :   }
     416             : 
     417             :   //Bool_t reflectZ = true;
     418             :   Bool_t reflectZ = false;
     419             :   //TVector3 where = TVector3(2.5+0.1+0.56+0.001, 2.5+0.1+0.001, 0.);
     420           2 :   TVector3 where = TVector3(fgkDeltaQuadLHC + fgkPadXOffsetBP, 
     421             :                             fgkDeltaQuadLHC + fgkPadYOffsetBP, 0.);
     422           6 :   PlaceSector(kSector1, specialMap, where, reflectZ, chamber);
     423             :   
     424           2 :   Int_t nb = AliMpConstants::ManuMask(AliMp::kNonBendingPlane);
     425           2 :   TExMapIter it(&specialMap);
     426             : #if (defined(ROOT_SVN_REVISION) && ROOT_SVN_REVISION >= 29598) || \
     427             :   (defined(ROOT_VERSION_CODE) && ROOT_VERSION_CODE >= ROOT_VERSION(5,25,02))
     428           2 :   Long64_t key;
     429           2 :   Long64_t value;
     430             : #else
     431             :   Long_t key;
     432             :   Long_t value;
     433             : #endif  
     434             :   
     435          18 :   while ( it.Next(key,value) == kTRUE ) { 
     436          12 :     delete reinterpret_cast<AliMUONSt1SpecialMotif*>(value);
     437             :   }
     438           2 :   specialMap.Delete();
     439          10 :   specialMap.Add(76 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01,0.51),90.));
     440          10 :   specialMap.Add(75 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(2.20,-0.08)));
     441          10 :   specialMap.Add(47 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(2.40,-1.11)));
     442          10 :   specialMap.Add(20 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.2 ,-0.08)));
     443          10 :   specialMap.Add(46 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.92 , 0.17)));
     444          10 :   specialMap.Add(74 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.405, -0.10)));  
     445             :       // Fix (7) - overlap of SQ42 with MCHL (after moving the whole sector
     446             :       // in the true position)   
     447             : 
     448             :   const AliMpSector* kSector2 
     449           4 :     = AliMpSegmentation::Instance()
     450           2 :           ->GetSector(100, AliMpDEManager::GetCathod(100, AliMp::kNonBendingPlane));
     451           2 :   if ( ! kSector2 ) {
     452           0 :     AliFatal("Could not access sector !");
     453             :   }
     454             : 
     455             :   //reflectZ = false;
     456             :   reflectZ = true;
     457           6 :   TVector2 offset = TVector2(kSector2->GetPositionX(), kSector2->GetPositionY());
     458           4 :   where = TVector3(where.X()+offset.X(), where.Y()+offset.Y(), 0.); 
     459             :       // Add the half-pad shift of the non-bending plane wrt bending plane
     460             :       // (The shift is defined in the mapping as sector offset)
     461             :       // Fix (4) - was TVector3(where.X()+0.63/2, ... - now it is -0.63/2
     462           6 :   PlaceSector(kSector2, specialMap, where, reflectZ, chamber);
     463             : 
     464           2 :   it.Reset();
     465          30 :   while ( it.Next(key,value) == kTRUE ) {
     466          24 :     delete reinterpret_cast<AliMUONSt1SpecialMotif*>(value);
     467             :   }
     468           2 :   specialMap.Delete();
     469           2 : }
     470             : 
     471             : //______________________________________________________________________________
     472             : void AliMUONSt1GeometryBuilderV2::CreateFoamBox(
     473             :                                         Int_t segNumber,
     474             :                                         const  TVector2& dimensions)
     475             : {
     476             : /// Create all the elements in the copper plane
     477             : 
     478         336 :   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
     479         168 :   Int_t idAir  = idtmed[1100]; // medium 1
     480             :   //Int_t idFoam = idtmed[1115]; // medium 16 = Foam
     481             :   //Int_t idFR4  = idtmed[1114]; // medium 15 = FR4
     482         168 :   Int_t idFoam = idtmed[1125]; // medium 26 = Foam
     483         168 :   Int_t idFR4  = idtmed[1122]; // medium 23 = FR4
     484             : 
     485             :   // mother volume
     486         168 :   GReal_t par[3];
     487         168 :   par[0] = dimensions.X();
     488         168 :   par[1] = dimensions.Y();
     489         168 :   par[2] = TotalHzPlane();
     490         504 :   TVirtualMC::GetMC()->Gsvolu(PlaneSegmentName(segNumber).Data(),"BOX",idAir,par,3);
     491             :   
     492             :   // foam layer
     493         168 :   par[0] = dimensions.X();
     494         168 :   par[1] = dimensions.Y();
     495         168 :   par[2] = fgkHzFoam;
     496         504 :   TVirtualMC::GetMC()->Gsvolu(FoamBoxName(segNumber).Data(),"BOX",idFoam,par,3);
     497             :   GReal_t posX,posY,posZ;
     498             :   posX=0.;
     499             :   posY=0.;
     500         168 :   posZ = -TotalHzPlane() + fgkHzFoam;
     501         504 :   TVirtualMC::GetMC()->Gspos(FoamBoxName(segNumber).Data(),1, 
     502         336 :              PlaneSegmentName(segNumber).Data(),posX,posY,posZ,0,"ONLY");
     503             : 
     504             :   // mechanical plane FR4 layer
     505         168 :   par[0] = dimensions.X();
     506         168 :   par[1] = dimensions.Y();
     507         168 :   par[2] = fgkHzFR4;
     508         504 :   TVirtualMC::GetMC()->Gsvolu(FR4BoxName(segNumber).Data(),"BOX",idFR4,par,3);
     509             :   posX=0.;
     510             :   posY=0.;
     511         168 :   posZ = -TotalHzPlane()+ 2.*fgkHzFoam + fgkHzFR4;
     512         504 :   TVirtualMC::GetMC()->Gspos(FR4BoxName(segNumber).Data(),1,
     513         336 :              PlaneSegmentName(segNumber).Data(),posX,posY,posZ,0,"ONLY");
     514         168 : }
     515             : 
     516             : //______________________________________________________________________________
     517             : void AliMUONSt1GeometryBuilderV2::CreatePlaneSegment(Int_t segNumber,
     518             :                                     const  TVector2& dimensions,
     519             :                                     Int_t nofHoles)
     520             : {
     521             : /// Create a segment of a plane (this includes a foam layer, 
     522             : /// holes in the foam to feed the kaptons through, kapton connectors
     523             : /// and the mother board.)
     524             :   
     525         336 :   CreateFoamBox(segNumber,dimensions);
     526             :   
     527             :   // Place spacer in the concrete plane segments:
     528             :   // S225 (in S025), S267 (in S067) in chamber1 and S309 (in S109). S351(in S151) 
     529             :   // in chamber2
     530             :   // The segments were found as those which caused overlaps when we placed
     531             :   // the spacer in global coordinates via PlaceSpacer0 
     532             :   //
     533             :   //    <posXYZ   X_Y_Z=" 12.6000;   0.75000;   0.0000"> <volume name="Spacer5A"/>
     534             :   //    <posXYZ   X_Y_Z=" 12.6000;  -0.75000;   0.0000"> <volume name="Spacer5A"/>
     535             :   //    <posXYZ   X_Y_Z=" 12.6000;   0.0000;    1.1515"> <volume name="Spacer6"/>
     536             :   //    <posXYZ   X_Y_Z=" 12.6000;   0.0000;    0.0000"> <volume name="Spacer7A"/>
     537             : 
     538        1506 :   if ( FoamBoxName(segNumber) == "S225" || 
     539         501 :        FoamBoxName(segNumber) == "S267" ||
     540         498 :        FoamBoxName(segNumber) == "S309" ||
     541         330 :        FoamBoxName(segNumber) == "S351"    )  
     542             :   {
     543             :     GReal_t posX =  12.6;
     544             :     GReal_t posY =  0.75;
     545             :     GReal_t posZ = -0.1;
     546          19 :     if ( FoamBoxName(segNumber) == "S267" || 
     547           8 :          FoamBoxName(segNumber) == "S351" ) posY += fgkPadYOffsetBP;    
     548          12 :     TVirtualMC::GetMC()->Gspos("Spacer5A", 1, FoamBoxName(segNumber).Data(), posX, posY, posZ,0, "ONLY");
     549             : 
     550             :     posY = -0.75;
     551          19 :     if ( FoamBoxName(segNumber) == "S267" || 
     552           8 :          FoamBoxName(segNumber) == "S351" ) posY += fgkPadYOffsetBP;    
     553          12 :     TVirtualMC::GetMC()->Gspos("Spacer5A", 2, FoamBoxName(segNumber).Data(), posX, posY, posZ,0, "ONLY");
     554             : 
     555             :     posY = 0.0;
     556             :     posZ = 1.1515;
     557          19 :     if ( FoamBoxName(segNumber) == "S267" || 
     558           8 :          FoamBoxName(segNumber) == "S351" ) posY += fgkPadYOffsetBP;    
     559          12 :     TVirtualMC::GetMC()->Gspos("Spacer6",  1, FoamBoxName(segNumber).Data(), posX, posY, posZ,0, "ONLY");
     560             : 
     561             :     posY = 0.0;
     562             :     posZ = 0.0;
     563          19 :     if ( FoamBoxName(segNumber) == "S267" || 
     564           8 :          FoamBoxName(segNumber) == "S351" ) posY += fgkPadYOffsetBP;    
     565          12 :     TVirtualMC::GetMC()->Gspos("Spacer7A", 1, FoamBoxName(segNumber).Data(), posX, posY, posZ,0, "ONLY");
     566           4 :   }  
     567             : 
     568        2104 :   for (Int_t holeNum=0;holeNum<nofHoles;holeNum++) {
     569         884 :     GReal_t posX = ((2.*holeNum+1.)/nofHoles-1.)*dimensions.X();
     570             :     GReal_t posY = 0.;
     571             :     GReal_t posZ = 0.;
     572             :  
     573        2652 :     TVirtualMC::GetMC()->Gspos(fgkHoleName,holeNum+1,
     574         884 :                FoamBoxName(segNumber).Data(),posX,posY,posZ,0,"ONLY");
     575             :   }
     576         168 : }
     577             : 
     578             : //______________________________________________________________________________
     579             : void AliMUONSt1GeometryBuilderV2::CreateQuadrantLayersAsVolumes(Int_t chamber)
     580             : {
     581             : /// Create the three main layers as real volumes.
     582             : /// Not used anymore.
     583             : 
     584             :   // tracking medias
     585           0 :   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
     586           0 :   Int_t idAir  = idtmed[1100];       // medium 1
     587             : 
     588           0 :   Float_t par[11];
     589             :   Float_t posX,posY,posZ;
     590             : 
     591             : // Quadrant volume TUBS1, positioned at the end
     592           0 :   par[0] = fgkMotherIR1;
     593           0 :   par[1] = fgkMotherOR1; 
     594           0 :   par[2] = fgkMotherThick1;  
     595           0 :   par[3] = fgkMotherPhiL1; 
     596           0 :   par[4] = fgkMotherPhiU1;
     597           0 :   TVirtualMC::GetMC()->Gsvolu(QuadrantMLayerName(chamber),"TUBS",idAir,par,5);
     598             :   // TVirtualMC::GetMC()->Gsvolu(QuadrantMFLayerName(chamber),"TUBS",idAir,par,5);
     599             : 
     600             : // Replace the volume shape with a composite shape
     601             : // with substracted overlap with beam shield (YMOT)
     602             : 
     603           0 :   if ( TVirtualMC::GetMC()->IsRootGeometrySupported() ) { 
     604             : 
     605             :     // Get shape
     606             :     TGeoVolume* mlayer 
     607           0 :       = gGeoManager->FindVolumeFast(QuadrantMLayerName(chamber));
     608           0 :     if ( !mlayer ) {
     609           0 :       AliErrorStream() 
     610           0 :          << "Quadrant volume " << QuadrantMLayerName(chamber) << " not found" 
     611           0 :          << endl;
     612           0 :     }
     613             :     else {
     614           0 :       TGeoShape* quadrant = mlayer->GetShape();
     615           0 :       quadrant->SetName("quadrant");        
     616             : 
     617             :       // Beam shield recess
     618           0 :       par[0] = 0;
     619           0 :       par[1] = 15.4; 
     620           0 :       par[2] = fgkMotherThick1;  
     621           0 :       new TGeoTube("shield_tube", par[0], par[1], par[2]);
     622             :   
     623             :       // Displacement
     624             :       posX = 2.6;
     625             :       posY = 2.6;
     626             :       posZ = 0;
     627             :       TGeoTranslation* displacement 
     628           0 :         = new TGeoTranslation("TR", posX, posY, posZ);
     629           0 :       displacement->RegisterYourself();
     630             : 
     631             :       // Composite shape
     632             :       TGeoShape* composite
     633           0 :       = new TGeoCompositeShape("composite", "quadrant-shield_tube:TR"); 
     634             :       
     635             :       // Reset shape to volume      
     636           0 :       mlayer->SetShape(composite);
     637             :     }
     638             : 
     639             :     TGeoVolume* malayer 
     640           0 :       = gGeoManager->FindVolumeFast(QuadrantMFLayerName(chamber));
     641           0 :     if ( !malayer ) {
     642           0 :       AliErrorStream() 
     643           0 :          << "Quadrant volume " << QuadrantMFLayerName(chamber) << " not found" 
     644           0 :          << endl;
     645           0 :     }
     646             :     else {
     647           0 :       TGeoShape* quadrant = malayer->GetShape();
     648           0 :       quadrant->SetName("quadrant");        
     649             : 
     650             :       // Beam shield recess
     651           0 :       par[0] = 0;
     652           0 :       par[1] = 15.4; 
     653           0 :       par[2] = fgkMotherThick1;  
     654           0 :       new TGeoTube("shield_tube", par[0], par[1], par[2]);
     655             :   
     656             :       // Displacement
     657             :       posX = 2.6;
     658             :       posY = 2.6;
     659             :       posZ = 0;
     660             :       TGeoTranslation* displacement 
     661           0 :         = new TGeoTranslation("TR", posX, posY, posZ);
     662           0 :       displacement->RegisterYourself();
     663             : 
     664             :       // Composite shape
     665             :       TGeoShape* composite
     666           0 :       = new TGeoCompositeShape("composite", "quadrant-shield_tube:TR"); 
     667             :       
     668             :       // Reset shape to volume      
     669           0 :       malayer->SetShape(composite);
     670             :     }
     671           0 :   }  
     672             : 
     673             : // Quadrant volume TUBS2, positioned at the end
     674           0 :   par[0] = fgkMotherIR2;
     675           0 :   par[1] = fgkMotherOR2; 
     676           0 :   par[2] = fgkMotherThick2;  
     677           0 :   par[3] = fgkMotherPhiL2; 
     678           0 :   par[4] = fgkMotherPhiU2;
     679             : 
     680           0 :   TVirtualMC::GetMC()->Gsvolu(QuadrantNLayerName(chamber),"TUBS",idAir,par,5); 
     681           0 :   TVirtualMC::GetMC()->Gsvolu(QuadrantFLayerName(chamber),"TUBS",idAir,par,5); 
     682           0 : }  
     683             : 
     684             : //______________________________________________________________________________
     685             : void AliMUONSt1GeometryBuilderV2::CreateQuadrantLayersAsAssemblies(Int_t chamber)
     686             : {
     687             : /// Create the three main layers as assemblies
     688             : 
     689           8 :   gGeoManager->MakeVolumeAssembly(QuadrantMLayerName(chamber).Data()); 
     690           6 :   gGeoManager->MakeVolumeAssembly(QuadrantMFLayerName(chamber).Data()); 
     691           6 :   gGeoManager->MakeVolumeAssembly(QuadrantNLayerName(chamber).Data()); 
     692           6 :   gGeoManager->MakeVolumeAssembly(QuadrantFLayerName(chamber).Data()); 
     693           2 : }  
     694             : 
     695             : //______________________________________________________________________________
     696             : void AliMUONSt1GeometryBuilderV2::CreateFrame(Int_t chamber)
     697             : {
     698             : /// Create the non-sensitive elements of the frame for the \a chamber
     699             : ///
     700             : /// Model and notation:                                                     \n
     701             : ///                                                                         \n
     702             : /// The Quadrant volume name starts with SQ                                 \n
     703             : /// The volume segments are numbered 00 to XX                               \n
     704             : ///                                                                         \n
     705             : ///                              OutTopFrame                                \n
     706             : ///                               (SQ02-16)                                 \n 
     707             : ///                              ------------                               \n
     708             : ///             OutEdgeFrame   /              |                             \n
     709             : ///             (SQ17-24)     /               |  InVFrame (SQ00-01)         \n 
     710             : ///                          /                |                             \n
     711             : ///                          |                |                             \n 
     712             : ///               OutVFrame  |            _- -                              \n
     713             : ///               (SQ25-39)  |           |   InArcFrame (SQ42-45)           \n
     714             : ///                          |           |                                  \n 
     715             : ///                          -------------                                  \n 
     716             : ///                        InHFrame (SQ40-41)                               \n 
     717             : ///                                                                         \n                         
     718             : ///                                                                         \n
     719             : /// 06 February 2003 - Overlapping volumes resolved.                        \n
     720             : /// One quarter chamber is comprised of three TUBS volumes: SQMx, SQNx, and SQFx,
     721             : /// where SQMx is the Quadrant Middle layer for chamber \a chamber ( posZ in [-3.25,3.25]),
     722             : /// SQNx is the Quadrant Near side layer for chamber \a chamber ( posZ in [-6.25,3-.25) ), and
     723             : /// SQFx is the Quadrant Far side layer for chamber \a chamber ( posZ in (3.25,6.25] ).
     724             : 
     725             :   // TString quadrantMLayerName = QuadrantMLayerName(chamber);
     726             : 
     727           4 :   TString quadrantMLayerName = QuadrantMFLayerName(chamber);
     728           2 :   TString quadrantNLayerName = QuadrantNLayerName(chamber);
     729           2 :   TString quadrantFLayerName = QuadrantFLayerName(chamber);
     730             : 
     731             :   const Float_t kNearFarLHC=2.4;    // Near and Far TUBS Origin wrt LHC Origin
     732             : 
     733             :   // tracking medias
     734           4 :   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
     735             :   
     736             :   //Int_t idAir  = idtmed[1100];       // medium 1
     737             :   //Int_t idFrameEpoxy = idtmed[1115]; // medium 16 = Frame Epoxy ME730
     738             :   //Int_t idInox = idtmed[1116];       // medium 17 Stainless Steel (18%Cr,9%Ni,Fe)
     739             :   //Int_t idFR4 = idtmed[1110];        // medium 11 FR4
     740             :   //Int_t idCopper = idtmed[1109];     // medium 10 Copper
     741             :   //Int_t idAlu = idtmed[1103];        // medium 4 Aluminium
     742           2 :   Int_t idFrameEpoxy = idtmed[1123]; // medium 24 = Frame Epoxy ME730  // was 20 not 16
     743           2 :   Int_t idInox = idtmed[1128];       // medium 29 Stainless Steel (18%Cr,9%Ni,Fe) // was 21 not 17
     744           2 :   Int_t idFR4 = idtmed[1122];        // medium 23 FR4  // was 15 not 11
     745           2 :   Int_t idCopper = idtmed[1121];     // medium 22 Copper
     746           2 :   Int_t idAlu = idtmed[1120];        // medium 21 Aluminium
     747             :   
     748             :   
     749           2 :     TGeoMedium* kMedEpoxy = gGeoManager->GetMedium("MUON_FrameCH$");
     750           2 :     TGeoMedium* kMedInox  = gGeoManager->GetMedium("MUON_Kapton");
     751           2 :     TGeoMedium* kMedAlu   = gGeoManager->GetMedium("MUON_ALU_II$");
     752             : 
     753             : 
     754             : // Rotation Matrices  
     755           2 :       Int_t rot1, rot2, rot3, rot4;    
     756             :       
     757             : //   Rotation matrices  
     758           2 :      fMUON->AliMatrix(rot1,  90.,  90., 90., 180.,  0., 0.); // +90 deg in x-y plane
     759           2 :      fMUON->AliMatrix(rot2,  90.,  45., 90., 135.,  0., 0.); // +45 deg in x-y plane 
     760           2 :      fMUON->AliMatrix(rot3,  90.,  45., 90., 315.,180., 0.); // +45 deg in x-y + rotation 180° around y
     761           2 :      fMUON->AliMatrix(rot4,  90., 315., 90.,  45.,  0., 0.); // -45 deg in x-y plane 
     762             : 
     763             : // ___________________Volume thicknesses________________________
     764             : 
     765             :   const Float_t kHzFrameThickness = 1.59/2.;     //equivalent thickness
     766             :   const Float_t kHzOuterFrameEpoxy = 1.19/2.;    //equivalent thickness
     767             :   const Float_t kHzOuterFrameInox = 0.1/2.;      //equivalent thickness
     768             :   const Float_t kHzFoam = 2.083/2.;              //evaluated elsewhere
     769             :                                                  // CHECK with fgkHzFoam
     770             :   
     771             : // Pertaining to the top outer area 
     772             :   const Float_t kHzTopAnodeSteel1 = 0.185/2.;    //equivalent thickness
     773             :   const Float_t kHzTopAnodeSteel2 = 0.51/2.;     //equivalent thickness  
     774             :   const Float_t kHzAnodeFR4 = 0.08/2.;           //equivalent thickness
     775             :   const Float_t kHzTopEarthFaceCu = 0.364/2.;    //equivalent thickness
     776             :   const Float_t kHzTopEarthProfileCu = 1.1/2.;   //equivalent thickness
     777             :   const Float_t kHzTopPositionerSteel = 1.45/2.; //should really be 2.125/2.; 
     778             :   const Float_t kHzTopGasSupportAl = 0.85/2.;    //equivalent thickness
     779             :   
     780             : // Pertaining to the vertical outer area  
     781             :   const Float_t kHzVerticalCradleAl = 0.8/2.;     //equivalent thickness
     782             :   const Float_t kHzLateralSightAl = 0.975/2.;     //equivalent thickness
     783             :   const Float_t kHzLateralPosnInoxFace = 2.125/2.;//equivalent thickness
     784             :   const Float_t kHzLatPosInoxProfM = 6.4/2.;      //equivalent thickness
     785             :   const Float_t kHzLatPosInoxProfNF = 1.45/2.;    //equivalent thickness
     786             :   const Float_t kHzLateralPosnAl = 0.5/2.;        //equivalent thickness
     787             :   const Float_t kHzVertEarthFaceCu = 0.367/2.;    //equivalent thickness
     788             :   const Float_t kHzVertBarSteel = 0.198/2.;       //equivalent thickness
     789             :   const Float_t kHzVertEarthProfCu = 1.1/2.;      //equivalent thickness
     790             : 
     791             : //_______________Parameter definitions in sequence _________
     792             : 
     793             : // InVFrame parameters
     794             :   const Float_t kHxInVFrame  = 1.85/2.;
     795             :   const Float_t kHyInVFrame  = 73.95/2.;
     796             :   const Float_t kHzInVFrame  = kHzFrameThickness;
     797             : 
     798             : //Flat 7.5mm vertical section
     799             :   const Float_t kHxV1mm  = 0.75/2.;
     800             :   const Float_t kHyV1mm  = 1.85/2.;
     801             :   const Float_t kHzV1mm  = kHzFrameThickness;
     802             : 
     803             : // OuterTopFrame Structure 
     804             : //
     805             : // FRAME
     806             : // The frame is composed of a cuboid and two trapezoids 
     807             : // (TopFrameAnode, TopFrameAnodeA, TopFrameAnodeB). 
     808             : // Each shape is composed of two layers (Epoxy and Inox) and 
     809             : // takes the frame's inner anode circuitry into account in the material budget.
     810             : //
     811             : // ANODE
     812             : // The overhanging anode part is composed froma cuboid and two trapezoids 
     813             : // (TopAnode, TopAnode1, and TopAnode2). These surfaces neglect implanted
     814             : // resistors, but accounts for the major Cu, Pb/Sn, and FR4 material
     815             : // contributions.  
     816             : // The stainless steel anode supports have been included.
     817             : //
     818             : // EARTHING (TopEarthFace, TopEarthProfile)
     819             : // Al GAS SUPPORT (TopGasSupport)
     820             : //  
     821             : // ALIGNMENT (TopPositioner) - Alignment system, three sights per quarter 
     822             : // chamber. This sight is forseen for the alignment of the horizontal level 
     823             : // (parallel to the OY axis of LHC). Its position will be evaluated relative 
     824             : // to a system of sights places on the cradles;
     825             : //
     826             : //---
     827             :   
     828             : //TopFrameAnode parameters - cuboid, 2 layers
     829             :   const Float_t kHxTFA = 34.1433/2.;
     830             :   const Float_t kHyTFA = 7.75/2.;
     831             :   const Float_t kHzTFAE = kHzOuterFrameEpoxy;     // layer 1 thickness
     832             :   const Float_t kHzTFAI = kHzOuterFrameInox;      // layer 3 thickness
     833             :   
     834             : // TopFrameAnode parameters - 2 trapezoids, 2 layers
     835             : // (redefined with TGeoXtru shape)
     836             :   const Float_t kH1FAA = 8.7/2.;
     837             :   const Float_t kTl1FAB = 4.35/2.;
     838             :   const Float_t kTl1FAA = 7.75/2.;
     839             : 
     840             : // TopAnode parameters - cuboid (part 1 of 3 parts)
     841             :   const Float_t kHxTA1 = 16.2/2.;
     842             :   const Float_t kHyTA1 = 3.5/2.;
     843             :   const Float_t kHzTA11 = kHzTopAnodeSteel1;   // layer 1
     844             :   const Float_t kHzTA12 = kHzAnodeFR4;         // layer 2 
     845             : 
     846             : // TopAnode parameters - trapezoid 1 (part 2 of 3 parts)
     847             :   const Float_t kHzTA21 = kHzTopAnodeSteel2;   // layer 1 
     848             :   const Float_t kHzTA22 = kHzAnodeFR4;         // layer 2 
     849             :   const Float_t kTetTA2 = 0.;
     850             :   const Float_t kPhiTA2= 0.;
     851             :   const Float_t kH1TA2 = 7.268/2.;
     852             :   const Float_t kBl1TA2 = 2.03/2.;
     853             :   const Float_t kTl1TA2 = 3.5/2.;
     854             :   const Float_t kAlp1TA2 = 5.78; 
     855             :   const Float_t kH2TA2 = 7.268/2.;
     856             :   const Float_t kBl2TA2 = 2.03/2.;
     857             :   const Float_t kTl2TA2 = 3.5/2.;
     858             :   const Float_t kAlp2TA2 = 5.78;  
     859             : 
     860             : // TopAnode parameters - trapezoid 2 (part 3 of 3 parts)
     861             :   const Float_t kHzTA3 = kHzAnodeFR4;       // layer 1 
     862             :   const Float_t kTetTA3 = 0.;
     863             :   const Float_t kPhiTA3 = 0.;
     864             :   const Float_t kH1TA3 = 7.268/2.;
     865             :   const Float_t kBl1TA3 = 0.;
     866             :   const Float_t kTl1TA3 = 2.03/2.;
     867             :   const Float_t kAlp1TA3 = 7.95; 
     868             :   const Float_t kH2TA3 = 7.268/2.;
     869             :   const Float_t kBl2TA3 = 0.;
     870             :   const Float_t kTl2TA3 = 2.03/2.;
     871             :   const Float_t kAlp2TA3 = 7.95;  
     872             :   
     873             : // TopEarthFace parameters - single trapezoid
     874             :   const Float_t kHzTEF = kHzTopEarthFaceCu;
     875             :   const Float_t kTetTEF = 0.;
     876             :   const Float_t kPhiTEF = 0.;
     877             :   const Float_t kH1TEF = 1.200/2.;
     878             :   const Float_t kBl1TEF = 21.323/2.;
     879             :   const Float_t kTl1TEF = 17.963/2.;
     880             :   const Float_t kAlp1TEF = -54.46; 
     881             :   const Float_t kH2TEF = 1.200/2.;
     882             :   const Float_t kBl2TEF = 21.323/2.;
     883             :   const Float_t kTl2TEF = 17.963/2.;
     884             :   const Float_t kAlp2TEF = -54.46;
     885             : 
     886             : // TopEarthProfile parameters - single trapezoid
     887             :   const Float_t kHzTEP = kHzTopEarthProfileCu;
     888             :   const Float_t kTetTEP = 0.;
     889             :   const Float_t kPhiTEP = 0.;
     890             :   const Float_t kH1TEP = 0.40/2.;
     891             :   const Float_t kBl1TEP = 31.766/2.;
     892             :   const Float_t kTl1TEP = 30.535/2.;
     893             :   const Float_t kAlp1TEP = -56.98; 
     894             :   const Float_t kH2TEP = 0.40/2.;
     895             :   const Float_t kBl2TEP = 31.766/2.;
     896             :   const Float_t kTl2TEP = 30.535/2.;
     897             :   const Float_t kAlp2TEP = -56.98;
     898             : 
     899             : // TopPositioner parameters - single Stainless Steel trapezoid 
     900             :   const Float_t kHzTP = kHzTopPositionerSteel;
     901             :   const Float_t kTetTP = 0.;
     902             :   const Float_t kPhiTP = 0.;
     903             :   const Float_t kH1TP = 3.00/2.;
     904             :   const Float_t kBl1TP = 7.023/2.;
     905             :   const Float_t kTl1TP = 7.314/2.;
     906             :   const Float_t kAlp1TP = 2.78; 
     907             :   const Float_t kH2TP = 3.00/2.;
     908             :   const Float_t kBl2TP = 7.023/2.;
     909             :   const Float_t kTl2TP = 7.314/2.;
     910             :   const Float_t kAlp2TP = 2.78;
     911             : 
     912             : // TopGasSupport parameters - single cuboid 
     913             :   const Float_t kHxTGS  = 8.50/2.;
     914             :   const Float_t kHyTGS  = 3.00/2.;
     915             :   const Float_t kHzTGS  = kHzTopGasSupportAl;
     916             :     
     917             : // OutEdgeFrame parameters - 4 trapezoidal sections, 2 layers of material
     918             : // (redefined with TGeoXtru shape)
     919             : //
     920             :   const Float_t kH1OETF = 7.196/2.;       // common to all 4 trapezoids
     921             :   const Float_t kTl1OETF1 = 3.996/2.;     // Trapezoid 1
     922             :   const Float_t kTl1OETF2 = 3.75/2;       // Trapezoid 2
     923             :   const Float_t kTl1OETF3 = 3.01/2.;      // Trapezoid 3
     924             :   const Float_t kTl1OETF4 = 1.77/2.;      // Trapezoid 4
     925             : 
     926             : 
     927             : // Frame Structure (OutVFrame):
     928             : //
     929             : // OutVFrame and corner (OutVFrame cuboid, OutVFrame trapezoid)
     930             : // EARTHING (VertEarthFaceCu,VertEarthSteel,VertEarthProfCu),
     931             : // DETECTOR POSITIONNING (SuppLateralPositionner, LateralPositionner),
     932             : // CRADLE (VertCradle), and
     933             : // ALIGNMENT (LateralSightSupport, LateralSight) 
     934             : //
     935             : //---
     936             : 
     937             : // OutVFrame parameters - cuboid
     938             :   const Float_t kHxOutVFrame = 1.85/2.;
     939             :   const Float_t kHyOutVFrame = 46.23/2.;
     940             :   const Float_t kHzOutVFrame = kHzFrameThickness;
     941             : 
     942             : // OutVFrame corner parameters - trapezoid
     943             :   const Float_t kHzOCTF = kHzFrameThickness;
     944             :   const Float_t kTetOCTF = 0.;
     945             :   const Float_t kPhiOCTF = 0.;
     946             :   const Float_t kH1OCTF = 1.85/2.;
     947             :   const Float_t kBl1OCTF = 0.;
     948             :   const Float_t kTl1OCTF = 3.66/2.;
     949             :   const Float_t kAlp1OCTF = 44.67; 
     950             :   const Float_t kH2OCTF = 1.85/2.;
     951             :   const Float_t kBl2OCTF = 0.;
     952             :   const Float_t kTl2OCTF = 3.66/2.;
     953             :   const Float_t kAlp2OCTF = 44.67;  
     954             :   
     955             : // VertEarthFaceCu parameters - single trapezoid
     956             :   const Float_t kHzVFC = kHzVertEarthFaceCu;
     957             :   const Float_t kTetVFC = 0.;
     958             :   const Float_t kPhiVFC = 0.;
     959             :   const Float_t kH1VFC = 1.200/2.;
     960             :   const Float_t kBl1VFC = 46.11/2.;
     961             :   const Float_t kTl1VFC = 48.236/2.;
     962             :   const Float_t kAlp1VFC = 41.54; 
     963             :   const Float_t kH2VFC = 1.200/2.;
     964             :   const Float_t kBl2VFC = 46.11/2.;
     965             :   const Float_t kTl2VFC = 48.236/2.;
     966             :   const Float_t kAlp2VFC = 41.54;
     967             :     
     968             : // VertEarthSteel parameters - single trapezoid
     969             :   const Float_t kHzVES = kHzVertBarSteel;
     970             :   const Float_t kTetVES = 0.;
     971             :   const Float_t kPhiVES = 0.;
     972             :   const Float_t kH1VES = 1.200/2.;
     973             :   const Float_t kBl1VES = 30.486/2.;
     974             :   const Float_t kTl1VES = 32.777/2.;
     975             :   const Float_t kAlp1VES = 43.67; 
     976             :   const Float_t kH2VES = 1.200/2.;
     977             :   const Float_t kBl2VES = 30.486/2.;
     978             :   const Float_t kTl2VES = 32.777/2.;
     979             :   const Float_t kAlp2VES = 43.67;
     980             : 
     981             : // VertEarthProfCu parameters - single trapezoid
     982             :   const Float_t kHzVPC = kHzVertEarthProfCu;
     983             :   const Float_t kTetVPC = 0.;
     984             :   const Float_t kPhiVPC = 0.;
     985             :   const Float_t kH1VPC = 0.400/2.;
     986             :   const Float_t kBl1VPC = 29.287/2.;
     987             :   const Float_t kTl1VPC = 30.091/2.;
     988             :   const Float_t kAlp1VPC = 45.14; 
     989             :   const Float_t kH2VPC = 0.400/2.;
     990             :   const Float_t kBl2VPC = 29.287/2.;
     991             :   const Float_t kTl2VPC = 30.091/2.;
     992             :   const Float_t kAlp2VPC = 45.14;
     993             : 
     994             : // SuppLateralPositionner - single cuboid
     995             :   const Float_t kHxSLP  = 2.80/2.;
     996             :   const Float_t kHySLP  = 5.00/2.;
     997             :   const Float_t kHzSLP  = kHzLateralPosnAl;
     998             :   
     999             : // LateralPositionner - squared off U bend, face view
    1000             :   const Float_t kHxLPF  = 5.2/2.;
    1001             :   const Float_t kHyLPF  = 3.0/2.;
    1002             :   const Float_t kHzLPF  = kHzLateralPosnInoxFace;
    1003             :   
    1004             : // LateralPositionner - squared off U bend, profile view
    1005             :   const Float_t kHxLPP  = 0.425/2.;
    1006             :   const Float_t kHyLPP  = 3.0/2.;
    1007             :   const Float_t kHzLPP  = kHzLatPosInoxProfM;  // middle layer
    1008             :   const Float_t kHzLPNF  = kHzLatPosInoxProfNF; // near and far layers
    1009             :            
    1010             : // VertCradle, 3 layers (copies), each composed of 4 trapezoids
    1011             : // (redefined with TGeoXtru shape)
    1012             : //
    1013             :   const Float_t kH1VC1 = 10.25/2.;  // all cradles
    1014             :   const Float_t kBl1VC1 = 3.70/2.;  // VertCradleA
    1015             :   const Float_t kBl1VC2 = 6.266/2.; // VertCradleB
    1016             :   const Float_t kBl1VC3 = 7.75/2.;  // VertCradleC
    1017             : 
    1018             : // VertCradleD
    1019             :   const Float_t kHzVC4 = kHzVerticalCradleAl;
    1020             :   const Float_t kTetVC4 = 0.;
    1021             :   const Float_t kPhiVC4 = 0.;
    1022             :   const Float_t kH1VC4 = 10.27/2.;
    1023             :   const Float_t kBl1VC4 = 8.273/2.;
    1024             :   const Float_t kTl1VC4 = 7.75/2.;
    1025             :   const Float_t kAlp1VC4 = -1.46; 
    1026             :   const Float_t kH2VC4 = 10.27/2.;
    1027             :   const Float_t kBl2VC4 = 8.273/2.;
    1028             :   const Float_t kTl2VC4 = 7.75/2.;
    1029             :   const Float_t kAlp2VC4 = -1.46;
    1030             :  
    1031             : // LateralSightSupport - single trapezoid
    1032             :   const Float_t kHzVSS = kHzLateralSightAl;
    1033             :   const Float_t kTetVSS = 0.;
    1034             :   const Float_t kPhiVSS = 0.;
    1035             :   const Float_t kH1VSS = 5.00/2.;
    1036             :   const Float_t kBl1VSS = 7.747/2;
    1037             :   const Float_t kTl1VSS = 7.188/2.;
    1038             :   const Float_t kAlp1VSS = -3.20; 
    1039             :   const Float_t kH2VSS = 5.00/2.;
    1040             :   const Float_t kBl2VSS = 7.747/2.;
    1041             :   const Float_t kTl2VSS = 7.188/2.;
    1042             :   const Float_t kAlp2VSS = -3.20;  
    1043             :   
    1044             : // LateralSight (reference point) - 3 per quadrant, only 1 programmed for now
    1045             :   const Float_t kVSInRad  = 0.6;
    1046             :   const Float_t kVSOutRad  = 1.3;
    1047             :   const Float_t kVSLen  = kHzFrameThickness; 
    1048             :   
    1049             : //---
    1050             : 
    1051             : // InHFrame parameters
    1052             :   const Float_t kHxInHFrame  = 75.8/2.;
    1053             :   const Float_t kHyInHFrame  = 1.85/2.;
    1054             :   const Float_t kHzInHFrame  = kHzFrameThickness;
    1055             :  
    1056             : //Flat 7.5mm horizontal section
    1057             :   const Float_t kHxH1mm  = 1.85/2.;
    1058             :   const Float_t kHyH1mm  = 0.75/2.;
    1059             :   const Float_t kHzH1mm  = kHzFrameThickness;
    1060             : 
    1061             : //---
    1062             : 
    1063             : // InArcFrame parameters
    1064             :   const Float_t kIAF  = 15.70;
    1065             :   const Float_t kOAF  = 17.55;
    1066             :   const Float_t kHzAF  = kHzFrameThickness;
    1067             :   const Float_t kAFphi1  = 0.0;
    1068             :   const Float_t kAFphi2  = 90.0;
    1069             : 
    1070             : //---
    1071             : 
    1072             : // ScrewsInFrame parameters HEAD
    1073             :   const Float_t kSCRUHMI  = 0.;
    1074             :   const Float_t kSCRUHMA  = 0.690/2.;
    1075             :   const Float_t kSCRUHLE  = 0.4/2.;
    1076             : // ScrewsInFrame parameters MIDDLE
    1077             :   const Float_t kSCRUMMI  = 0.;
    1078             :   const Float_t kSCRUMMA  = 0.39/2.;
    1079             :   const Float_t kSCRUMLE  = kHzFrameThickness;
    1080             : // ScrewsInFrame parameters NUT
    1081             :   const Float_t kSCRUNMI  = 0.;
    1082             :   const Float_t kSCRUNMA  = 0.78/2.;
    1083             :   const Float_t kSCRUNLE  = 0.8/2.;   
    1084             :   
    1085             :        // ___________________Make volumes________________________
    1086             : 
    1087           2 :  Float_t par[11];
    1088             :  Float_t posX,posY,posZ;
    1089             : 
    1090           2 :    if (chamber==1) {   
    1091             :     // InVFrame  
    1092           1 :     par[0] = kHxInVFrame;
    1093           1 :     par[1] = kHyInVFrame;
    1094           1 :     par[2] = kHzInVFrame;
    1095           2 :     TVirtualMC::GetMC()->Gsvolu("SQ00","BOX",idFrameEpoxy,par,3);
    1096             : 
    1097             :     //Flat 1mm vertical section
    1098           1 :     par[0] = kHxV1mm;
    1099           1 :     par[1] = kHyV1mm;
    1100           1 :     par[2] = kHzV1mm;
    1101           2 :     TVirtualMC::GetMC()->Gsvolu("SQ01","BOX",idFrameEpoxy,par,3); 
    1102             :  
    1103             : // OutTopFrame 
    1104             : //
    1105             : // - 3 components (a cuboid and 2 trapezes) and 2 layers (Epoxy/Inox)
    1106             : //
    1107             : //---
    1108             : 
    1109             :     // TopFrameAnode - layer 1 of 2 
    1110           1 :     par[0] = kHxTFA;
    1111           1 :     par[1] = kHyTFA;
    1112           1 :     par[2] = kHzTFAE;
    1113           2 :     TVirtualMC::GetMC()->Gsvolu("SQ02","BOX",idFrameEpoxy,par,3);
    1114             :     
    1115             :     // TopFrameAnode - layer 2 of 2 
    1116           1 :     par[2] = kHzTFAI;
    1117           2 :     TVirtualMC::GetMC()->Gsvolu("SQ03","BOX",idInox,par,3);
    1118             :             
    1119             : 
    1120             :     // Common declarations for TGeoXtru parameters
    1121             :     Double_t dx, dx0, dx1, dx2, dx3; 
    1122             :     Double_t dy, dy1, dy2, dy3, dy4;
    1123           1 :     Double_t vx[16];
    1124           1 :     Double_t vy[16];
    1125             :     Int_t nz;
    1126             :     Int_t nv;
    1127             : 
    1128             :     // SQ04to06 and SQ05to07
    1129             : 
    1130             :     dx  =  2.*kH1FAA; 
    1131             :     dy1 =  2.*kTl1FAA;
    1132             :     dy2 =  2.*kTl1FAB;
    1133             :     
    1134             :     nz =  2;
    1135             :     nv = 5;
    1136           1 :     vx[0]  =   0.0;  vy[0]  =  0.0;
    1137           1 :     vx[1]  =   0.0;  vy[1]  =  dy1;
    1138           1 :     vx[2]  =    dx;  vy[2]  =  dy2;
    1139           1 :     vx[3]  =  2*dx;  vy[3]  =  0.0;
    1140           1 :     vx[4]  =    dx;  vy[4]  =  0.0;
    1141             : 
    1142             :     // Shift center in the middle
    1143          12 :     for ( Int_t i=0; i<nv; i++ ) { 
    1144           5 :       vx[i] -= dx;
    1145           5 :       vy[i] -= 0.5*dy1;
    1146             :     }  
    1147             :   
    1148           2 :     TGeoXtru* xtruS5 = new TGeoXtru(nz);
    1149           1 :     xtruS5->DefinePolygon(nv, vx, vy);
    1150           1 :     xtruS5->DefineSection(0, -kHzOuterFrameEpoxy,  0.0, 0.0, 1.0); 
    1151           1 :     xtruS5->DefineSection(1,  kHzOuterFrameEpoxy,  0.0, 0.0, 1.0); 
    1152           2 :     new TGeoVolume("SQ04toSQ06", xtruS5, kMedEpoxy);
    1153             : 
    1154           2 :     TGeoXtru* xtruS6 = new TGeoXtru(nz);
    1155           1 :     xtruS6->DefinePolygon(nv, vx, vy);
    1156           1 :     xtruS6->DefineSection(0, -kHzOuterFrameInox,  0.0, 0.0, 1.0); 
    1157           1 :     xtruS6->DefineSection(1,  kHzOuterFrameInox,  0.0, 0.0, 1.0); 
    1158           2 :     new TGeoVolume("SQ05toSQ07", xtruS6, kMedInox);
    1159             : 
    1160             : 
    1161             :     // TopAnode1 -  layer 1 of 2
    1162           1 :     par[0] = kHxTA1;
    1163           1 :     par[1] = kHyTA1;
    1164           1 :     par[2] = kHzTA11;    
    1165           2 :     TVirtualMC::GetMC()->Gsvolu("SQ08","BOX",idInox,par,3); 
    1166             :     
    1167             :     // TopAnode1 -  layer 2 of 2
    1168           1 :     par[2] = kHzTA12;    
    1169           2 :     TVirtualMC::GetMC()->Gsvolu("SQ09","BOX",idFR4,par,3); 
    1170             : 
    1171             :     // TopAnode2 -  layer 1 of 2
    1172           1 :     par[0] = kHzTA21;
    1173           1 :     par[1] = kTetTA2;
    1174           1 :     par[2] = kPhiTA2;
    1175           1 :     par[3] = kH1TA2;
    1176           1 :     par[4] = kBl1TA2;
    1177           1 :     par[5] = kTl1TA2;
    1178           1 :     par[6] = kAlp1TA2;
    1179           1 :     par[7] = kH2TA2;
    1180           1 :     par[8] = kBl2TA2;
    1181           1 :     par[9] = kTl2TA2;
    1182           1 :     par[10] = kAlp2TA2;    
    1183           2 :     TVirtualMC::GetMC()->Gsvolu("SQ10","TRAP",idInox,par,11); 
    1184             :  
    1185             :     // TopAnode2 -  layer 2 of 2
    1186           1 :     par[0] = kHzTA22;    
    1187           2 :     TVirtualMC::GetMC()->Gsvolu("SQ11","TRAP",idFR4,par,11);   
    1188             : 
    1189             :     // TopAnode3 -  layer 1 of 1 
    1190           1 :     par[0] = kHzTA3;
    1191           1 :     par[1] = kTetTA3;
    1192           1 :     par[2] = kPhiTA3;
    1193           1 :     par[3] = kH1TA3;
    1194           1 :     par[4] = kBl1TA3;
    1195           1 :     par[5] = kTl1TA3;
    1196           1 :     par[6] = kAlp1TA3;
    1197           1 :     par[7] = kH2TA3;
    1198           1 :     par[8] = kBl2TA3;
    1199           1 :     par[9] = kTl2TA3;
    1200           1 :     par[10] = kAlp2TA3;    
    1201           2 :     TVirtualMC::GetMC()->Gsvolu("SQ12","TRAP",idFR4,par,11); 
    1202             : 
    1203             :     // TopEarthFace 
    1204           1 :     par[0] = kHzTEF;
    1205           1 :     par[1] = kTetTEF;
    1206           1 :     par[2] = kPhiTEF;
    1207           1 :     par[3] = kH1TEF;
    1208           1 :     par[4] = kBl1TEF;
    1209           1 :     par[5] = kTl1TEF;
    1210           1 :     par[6] = kAlp1TEF;
    1211           1 :     par[7] = kH2TEF;
    1212           1 :     par[8] = kBl2TEF;
    1213           1 :     par[9] = kTl2TEF;
    1214           1 :     par[10] = kAlp2TEF;    
    1215           2 :     TVirtualMC::GetMC()->Gsvolu("SQ13","TRAP",idCopper,par,11);   
    1216             : 
    1217             :     // TopEarthProfile 
    1218           1 :     par[0] = kHzTEP;
    1219           1 :     par[1] = kTetTEP;
    1220           1 :     par[2] = kPhiTEP;
    1221           1 :     par[3] = kH1TEP;
    1222           1 :     par[4] = kBl1TEP;
    1223           1 :     par[5] = kTl1TEP;
    1224           1 :     par[6] = kAlp1TEP;
    1225           1 :     par[7] = kH2TEP;
    1226           1 :     par[8] = kBl2TEP;
    1227           1 :     par[9] = kTl2TEP;
    1228           1 :     par[10] = kAlp2TEP;
    1229           2 :     TVirtualMC::GetMC()->Gsvolu("SQ14","TRAP",idCopper,par,11);       
    1230             : 
    1231             :     // TopGasSupport  
    1232           1 :     par[0] = kHxTGS;
    1233           1 :     par[1] = kHyTGS;
    1234           1 :     par[2] = kHzTGS;
    1235           2 :     TVirtualMC::GetMC()->Gsvolu("SQ15","BOX",idAlu,par,3);
    1236             : 
    1237             :     // TopPositioner parameters - single Stainless Steel trapezoid 
    1238           1 :     par[0] = kHzTP;
    1239           1 :     par[1] = kTetTP; 
    1240           1 :     par[2] = kPhiTP;
    1241           1 :     par[3] = kH1TP;
    1242           1 :     par[4] = kBl1TP; 
    1243           1 :     par[5] = kTl1TP; 
    1244           1 :     par[6] = kAlp1TP;
    1245           1 :     par[7] = kH2TP;
    1246           1 :     par[8] = kBl2TP; 
    1247           1 :     par[9] = kTl2TP; 
    1248           1 :     par[10] = kAlp2TP;     
    1249           2 :     TVirtualMC::GetMC()->Gsvolu("SQ16","TRAP",idInox,par,11);       
    1250             : 
    1251             : //
    1252             : // OutEdgeTrapFrame Epoxy = (4 trapezes)*2 copies*2 layers (Epoxy/Inox)
    1253             : // (redefined with TGeoXtru shape )
    1254             : //---
    1255             : 
    1256             :     dx  = 2.*kH1OETF;
    1257             :     dy1 = 2.*kTl1OETF4;
    1258             :     dy2 = 2.*kTl1OETF3; 
    1259             :     dy3 = 2.*kTl1OETF2;
    1260             :     dy4 = 2.*kTl1OETF1;
    1261             :     
    1262             :     nz =  2;
    1263             :     nv = 16;
    1264           1 :     vx[0]  = -4*dx;  vy[0]  = 0.0;
    1265           1 :     vx[1]  = -3*dx;  vy[1]  = dy1;
    1266           1 :     vx[2]  = -2*dx;  vy[2]  = dy2;
    1267           1 :     vx[3]  = -1*dx;  vy[3]  = dy3;
    1268           1 :     vx[4]  =   0.0;  vy[4]  = dy4;
    1269           1 :     vx[5]  =    dx;  vy[5]  = dy3; 
    1270           1 :     vx[6]  =  2*dx;  vy[6]  = dy2;
    1271           1 :     vx[7]  =  3*dx;  vy[7]  = dy1;
    1272           1 :     vx[8]  =  4*dx;  vy[8]  = 0.0;
    1273           1 :     vx[9]  =  3*dx;  vy[9]  = 0.0;
    1274           1 :     vx[10] =  2*dx;  vy[10] = 0.0;
    1275           1 :     vx[11] =    dx;  vy[11] = 0.0;
    1276           1 :     vx[12] =   0.0;  vy[12] = 0.0;
    1277           1 :     vx[13] = -1*dx;  vy[13] = 0.0;
    1278           1 :     vx[14] = -2*dx;  vy[14] = 0.0;
    1279           1 :     vx[15] = -3*dx;  vy[15] = 0.0;
    1280             : 
    1281             :     // Shift center in the middle
    1282          34 :     for ( Int_t i=0; i<nv; i++ ) vy[i] += dy4/2.0;
    1283             :   
    1284           2 :     TGeoXtru* xtruS1 = new TGeoXtru(nz);
    1285           1 :     xtruS1->DefinePolygon(nv, vx, vy);
    1286           1 :     xtruS1->DefineSection(0, -kHzOuterFrameEpoxy,  0.0, 0.0, 1.0); 
    1287           1 :     xtruS1->DefineSection(1,  kHzOuterFrameEpoxy,  0.0, 0.0, 1.0); 
    1288           2 :     new TGeoVolume("SQ17to23", xtruS1, kMedEpoxy );
    1289             : 
    1290           2 :     TGeoXtru* xtruS2 = new TGeoXtru(nz);
    1291           1 :     xtruS2->DefinePolygon(nv, vx, vy);
    1292           1 :     xtruS2->DefineSection(0, -kHzOuterFrameInox,  0.0, 0.0, 1.0); 
    1293           1 :     xtruS2->DefineSection(1,  kHzOuterFrameInox,  0.0, 0.0, 1.0); 
    1294           2 :     new TGeoVolume("SQ18to24", xtruS2, kMedInox );
    1295             : 
    1296             : //
    1297             : // OutEdgeTrapFrame Epoxy = (4 trapezes)*2 copies*2 layers (Epoxy/Inox)
    1298             : //---
    1299             :     // OutVFrame    
    1300           1 :     par[0] = kHxOutVFrame;
    1301           1 :     par[1] = kHyOutVFrame;
    1302           1 :     par[2] = kHzOutVFrame;
    1303           2 :     TVirtualMC::GetMC()->Gsvolu("SQ25","BOX",idFrameEpoxy,par,3);
    1304             :         
    1305             :     // OutVFrame corner  
    1306           1 :     par[0] = kHzOCTF;
    1307           1 :     par[1] = kTetOCTF;
    1308           1 :     par[2] = kPhiOCTF;
    1309           1 :     par[3] = kH1OCTF;
    1310           1 :     par[4] = kBl1OCTF;
    1311           1 :     par[5] = kTl1OCTF;
    1312           1 :     par[6] = kAlp1OCTF;
    1313           1 :     par[7] = kH2OCTF;
    1314           1 :     par[8] = kBl2OCTF;
    1315           1 :     par[9] = kTl2OCTF;
    1316           1 :     par[10] = kAlp2OCTF;    
    1317           2 :     TVirtualMC::GetMC()->Gsvolu("SQ26","TRAP",idFrameEpoxy,par,11);
    1318             :  
    1319             :     // EarthFaceCu trapezoid
    1320           1 :     par[0] = kHzVFC;
    1321           1 :     par[1] = kTetVFC;
    1322           1 :     par[2] = kPhiVFC;
    1323           1 :     par[3] = kH1VFC;
    1324           1 :     par[4] = kBl1VFC;
    1325           1 :     par[5] = kTl1VFC;
    1326           1 :     par[6] = kAlp1VFC;
    1327           1 :     par[7] = kH2VFC;
    1328           1 :     par[8] = kBl2VFC;
    1329           1 :     par[9] = kTl2VFC;
    1330           1 :     par[10] = kAlp2VFC;   
    1331           2 :     TVirtualMC::GetMC()->Gsvolu("SQ27","TRAP",idCopper,par,11);     
    1332             : 
    1333             :     // VertEarthSteel trapezoid
    1334           1 :     par[0] = kHzVES;
    1335           1 :     par[1] = kTetVES;
    1336           1 :     par[2] = kPhiVES;
    1337           1 :     par[3] = kH1VES;
    1338           1 :     par[4] = kBl1VES;
    1339           1 :     par[5] = kTl1VES;
    1340           1 :     par[6] = kAlp1VES;
    1341           1 :     par[7] = kH2VES;
    1342           1 :     par[8] = kBl2VES;
    1343           1 :     par[9] = kTl2VES;
    1344           1 :     par[10] = kAlp2VES;    
    1345           2 :     TVirtualMC::GetMC()->Gsvolu("SQ28","TRAP",idInox,par,11); 
    1346             : 
    1347             :     // VertEarthProfCu trapezoid       
    1348           1 :     par[0] = kHzVPC;
    1349           1 :     par[1] = kTetVPC;
    1350           1 :     par[2] = kPhiVPC;
    1351           1 :     par[3] = kH1VPC;
    1352           1 :     par[4] = kBl1VPC;
    1353           1 :     par[5] = kTl1VPC;
    1354           1 :     par[6] = kAlp1VPC;
    1355           1 :     par[7] = kH2VPC;
    1356           1 :     par[8] = kBl2VPC;
    1357           1 :     par[9] = kTl2VPC;
    1358           1 :     par[10] = kAlp2VPC;
    1359           2 :     TVirtualMC::GetMC()->Gsvolu("SQ29","TRAP",idCopper,par,11);
    1360             : 
    1361             :     // SuppLateralPositionner cuboid    
    1362           1 :     par[0] = kHxSLP;
    1363           1 :     par[1] = kHySLP;
    1364           1 :     par[2] = kHzSLP;
    1365           2 :     TVirtualMC::GetMC()->Gsvolu("SQ30","BOX",idAlu,par,3);
    1366             : 
    1367             :     // LateralPositionerFace
    1368           1 :     par[0] = kHxLPF;
    1369           1 :     par[1] = kHyLPF;
    1370           1 :     par[2] = kHzLPF;
    1371           2 :     TVirtualMC::GetMC()->Gsvolu("SQ31","BOX",idInox,par,3);
    1372             : 
    1373             :     // LateralPositionerProfile
    1374           1 :     par[0] = kHxLPP;
    1375           1 :     par[1] = kHyLPP;
    1376           1 :     par[2] = kHzLPP;
    1377           2 :     TVirtualMC::GetMC()->Gsvolu("SQ32","BOX",idInox,par,3); // middle layer
    1378             :     
    1379           1 :     par[0] = kHxLPP;
    1380           1 :     par[1] = kHyLPP;
    1381           1 :     par[2] = kHzLPNF;
    1382           2 :     TVirtualMC::GetMC()->Gsvolu("SQ33","BOX",idInox,par,3); // near and far layers
    1383             : 
    1384             :     dy  = 2.*kH1VC1;
    1385             :     dx0 = 2.*kBl1VC4;
    1386             :     dx1 = 2.*kBl1VC3;
    1387             :     dx2 = 2.*kBl1VC2; 
    1388             :     dx3 = 2.*kBl1VC1;   
    1389             :     
    1390             :     // VertCradle
    1391             :     // (Trapezoids SQ34 to SQ36 or SQ37 redefined with TGeoXtru shape)
    1392             : 
    1393             :     nz =  2;
    1394             :     nv = 7;
    1395           1 :     vx[0]  =   0.0;  vy[0]  =  0.0;
    1396           1 :     vx[1]  =   0.0;  vy[1]  =   dy;
    1397           1 :     vx[2]  =   0.0;  vy[2]  = 2*dy;
    1398           1 :     vx[3]  =   0.0;  vy[3]  = 3*dy;
    1399           1 :     vx[4]  =   dx3;  vy[4]  = 2*dy;
    1400           1 :     vx[5]  =   dx2;  vy[5]  =   dy; 
    1401           1 :     vx[6]  =   dx1;  vy[6]  =  0.0;
    1402             : 
    1403             :     // Shift center in the middle
    1404          16 :     for ( Int_t i=0; i<nv; i++ ) { 
    1405           7 :       vx[i] -= dx1/2.0;
    1406           7 :       vy[i] -= 1.5*dy;
    1407             :     }  
    1408             :   
    1409           2 :     TGeoXtru* xtruS3 = new TGeoXtru(nz);
    1410           1 :     xtruS3->DefinePolygon(nv, vx, vy);
    1411           1 :     xtruS3->DefineSection(0, -kHzVerticalCradleAl,  0.0, 0.0, 1.0); 
    1412           1 :     xtruS3->DefineSection(1,  kHzVerticalCradleAl,  0.0, 0.0, 1.0); 
    1413           2 :     new TGeoVolume("SQ34to36", xtruS3, kMedAlu);
    1414             : 
    1415             :     // Trapezoids SQ34 to SQ37;
    1416             :     // (keeping the same coordinate system as for SQ34to36)
    1417             : 
    1418             :     nz =  2;
    1419             :     nv = 9;
    1420           1 :     vx[0]  =   0.0;  vy[0]  =-1.0*dy;
    1421           1 :     vx[1]  =   0.0;  vy[1]  =  0.0;
    1422           1 :     vx[2]  =   0.0;  vy[2]  =   dy;
    1423           1 :     vx[3]  =   0.0;  vy[3]  = 2*dy;
    1424           1 :     vx[4]  =   0.0;  vy[4]  = 3*dy;
    1425           1 :     vx[5]  =   dx3;  vy[5]  = 2*dy;
    1426           1 :     vx[6]  =   dx2;  vy[6]  =   dy; 
    1427           1 :     vx[7]  =   dx1;  vy[7]  =  0.0;
    1428           1 :     vx[8]  =   dx0;  vy[8]  =-1.0*dy;
    1429             : 
    1430             :     // Shift center in the middle (of SQ34to36!!)
    1431          20 :     for ( Int_t i=0; i<nv; i++ ) { 
    1432           9 :       vx[i] -= dx1/2.0;
    1433           9 :       vy[i] -= 1.5*dy;
    1434             :     }  
    1435             :   
    1436           2 :     TGeoXtru* xtruS4 = new TGeoXtru(nz);
    1437           1 :     xtruS4->DefinePolygon(nv, vx, vy);
    1438           1 :     xtruS4->DefineSection(0, -kHzVerticalCradleAl,  0.0, 0.0, 1.0); 
    1439           1 :     xtruS4->DefineSection(1,  kHzVerticalCradleAl,  0.0, 0.0, 1.0); 
    1440           2 :     new TGeoVolume("SQ34to37", xtruS4, kMedAlu);
    1441             : 
    1442             :     // VertCradleD - 4th trapezoid
    1443           1 :     par[0] = kHzVC4;
    1444           1 :     par[1] = kTetVC4;
    1445           1 :     par[2] = kPhiVC4;
    1446           1 :     par[3] = kH1VC4;
    1447           1 :     par[4] = kBl1VC4;
    1448           1 :     par[5] = kTl1VC4;
    1449           1 :     par[6] = kAlp1VC4;
    1450           1 :     par[7] = kH2VC4;
    1451           1 :     par[8] = kBl2VC4;
    1452           1 :     par[9] = kTl2VC4;
    1453           1 :     par[10] = kAlp2VC4;    
    1454           2 :     TVirtualMC::GetMC()->Gsvolu("SQ37","TRAP",idAlu,par,11);  
    1455             :           
    1456             :     // LateralSightSupport trapezoid
    1457           1 :     par[0] = kHzVSS;
    1458           1 :     par[1] = kTetVSS;
    1459           1 :     par[2] = kPhiVSS;
    1460           1 :     par[3] = kH1VSS;
    1461           1 :     par[4] = kBl1VSS;
    1462           1 :     par[5] = kTl1VSS;
    1463           1 :     par[6] = kAlp1VSS;
    1464           1 :     par[7] = kH2VSS;
    1465           1 :     par[8] = kBl2VSS;
    1466           1 :     par[9] = kTl2VSS;
    1467           1 :     par[10] = kAlp2VSS;
    1468           2 :     TVirtualMC::GetMC()->Gsvolu("SQ38","TRAP",idAlu,par,11);
    1469             : 
    1470             :     // LateralSight
    1471           1 :     par[0] = kVSInRad;
    1472           1 :     par[1] = kVSOutRad;
    1473           1 :     par[2] = kVSLen;       
    1474           2 :     TVirtualMC::GetMC()->Gsvolu("SQ39","TUBE",idFrameEpoxy,par,3);   
    1475             : 
    1476             : //---
    1477             :     // InHFrame
    1478           1 :     par[0] = kHxInHFrame;
    1479           1 :     par[1] = kHyInHFrame;
    1480           1 :     par[2] = kHzInHFrame;
    1481           2 :     TVirtualMC::GetMC()->Gsvolu("SQ40","BOX",idFrameEpoxy,par,3);
    1482             : 
    1483             :     //Flat 7.5mm horizontal section
    1484           1 :     par[0] = kHxH1mm;
    1485           1 :     par[1] = kHyH1mm;
    1486           1 :     par[2] = kHzH1mm;
    1487           2 :     TVirtualMC::GetMC()->Gsvolu("SQ41","BOX",idFrameEpoxy,par,3);
    1488             : 
    1489             :     // InArcFrame 
    1490           1 :     par[0] = kIAF;
    1491           1 :     par[1] = kOAF; 
    1492           1 :     par[2] = kHzAF;  
    1493           1 :     par[3] = kAFphi1; 
    1494           1 :     par[4] = kAFphi2;
    1495             : 
    1496           2 :     TVirtualMC::GetMC()->Gsvolu("SQ42","TUBS",idFrameEpoxy,par,5);
    1497             : 
    1498             : //---
    1499             :     // ScrewsInFrame - 3 sections in order to avoid overlapping volumes
    1500             :     // Screw Head, in air
    1501           1 :     par[0] = kSCRUHMI;
    1502           1 :     par[1] = kSCRUHMA; 
    1503           1 :     par[2] = kSCRUHLE;  
    1504             : 
    1505           2 :     TVirtualMC::GetMC()->Gsvolu("SQ43","TUBE",idInox,par,3);
    1506             :     
    1507             :     // Middle part, in the Epoxy
    1508           1 :     par[0] = kSCRUMMI;
    1509           1 :     par[1] = kSCRUMMA;
    1510           1 :     par[2] = kSCRUMLE;
    1511           2 :     TVirtualMC::GetMC()->Gsvolu("SQ44","TUBE",idInox,par,3);
    1512             :     
    1513             :     // Screw nut, in air
    1514           1 :     par[0] = kSCRUNMI;
    1515           1 :     par[1] = kSCRUNMA;
    1516           1 :     par[2] = kSCRUNLE;   
    1517           2 :     TVirtualMC::GetMC()->Gsvolu("SQ45","TUBE",idInox,par,3);     
    1518           1 :    }
    1519             :               
    1520             : // __________________Place volumes in the quadrant ____________ 
    1521             :         
    1522             :     // InVFrame  
    1523             :     posX = kHxInVFrame;
    1524             :     posY = 2.0*kHyInHFrame+2.*kHyH1mm+kIAF+kHyInVFrame;        
    1525             :     posZ = 0.;
    1526           6 :     TVirtualMC::GetMC()->Gspos("SQ00",1,quadrantMLayerName,posX, posY, posZ, 0, "ONLY"); 
    1527             : 
    1528             : // keep memory of the mid position. Used for placing screws
    1529             :     const GReal_t kMidVposX = posX;
    1530             :     const GReal_t kMidVposY = posY;
    1531             :     const GReal_t kMidVposZ = posZ;
    1532             : 
    1533             :     //Flat 7.5mm vertical section
    1534             :     posX = 2.0*kHxInVFrame+kHxV1mm;
    1535             :     posY = 2.0*kHyInHFrame+2.*kHyH1mm+kIAF+kHyV1mm;
    1536             :     posZ = 0.;
    1537           6 :     TVirtualMC::GetMC()->Gspos("SQ01",1,quadrantMLayerName,posX, posY, posZ,0, "ONLY"); 
    1538             :     
    1539             :     // TopFrameAnode place 2 layers of TopFrameAnode cuboids  
    1540             :     posX = kHxTFA;
    1541             :     posY = 2.*kHyInHFrame+2.*kHyH1mm+kIAF+2.*kHyInVFrame+kHyTFA;   
    1542             :     posZ = -kHzOuterFrameInox;
    1543           6 :     TVirtualMC::GetMC()->Gspos("SQ02",1,quadrantMLayerName,posX, posY, posZ,0,"ONLY"); 
    1544             :     posZ = kHzOuterFrameEpoxy;
    1545           6 :     TVirtualMC::GetMC()->Gspos("SQ03",1,quadrantMLayerName,posX, posY, posZ,0,"ONLY");
    1546             :     
    1547             :     // TopFrameAnode - place 2 layers of 2 trapezoids 
    1548             :     // (SQ04 - SQ07)
    1549             :     posX += kHxTFA + 2.*kH1FAA;
    1550             :     posZ = -kHzOuterFrameInox; 
    1551           6 :     TVirtualMC::GetMC()->Gspos("SQ04toSQ06",1,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");
    1552             :     posZ = kHzOuterFrameEpoxy;
    1553           6 :     TVirtualMC::GetMC()->Gspos("SQ05toSQ07",1,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");
    1554             : 
    1555             :     // TopAnode1 place 2 layers  
    1556             :     posX = 6.8+fgkDeltaQuadLHC;
    1557             :     posY = 99.85+fgkDeltaQuadLHC;
    1558             :     posZ = -1.*kHzAnodeFR4;
    1559           6 :     TVirtualMC::GetMC()->Gspos("SQ08",1,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");  
    1560             :     posZ = kHzTopAnodeSteel1;
    1561           6 :     TVirtualMC::GetMC()->Gspos("SQ09",1,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");    
    1562             :          
    1563             :     // TopAnode2 place 2 layers
    1564             :     posX = 18.534+fgkDeltaQuadLHC;
    1565             :     posY = 99.482+fgkDeltaQuadLHC; 
    1566             :     posZ = -1.*kHzAnodeFR4;    
    1567             :     // shift up to solve overlap with SQ14
    1568             :     posY += 0.1;
    1569           6 :     TVirtualMC::GetMC()->Gspos("SQ10",1,quadrantMLayerName,posX, posY, posZ, rot1,"ONLY");
    1570             :     posZ = kHzTopAnodeSteel2;    
    1571           6 :     TVirtualMC::GetMC()->Gspos("SQ11",1,quadrantMLayerName,posX, posY, posZ, rot1,"ONLY");       
    1572             :     
    1573             :     // TopAnode3 place 1 layer
    1574             :     posX = 25.804+fgkDeltaQuadLHC;
    1575             :     posY = 98.61+fgkDeltaQuadLHC;
    1576             :     posZ = 0.;    
    1577           6 :     TVirtualMC::GetMC()->Gspos("SQ12",1,quadrantMLayerName,posX, posY, posZ, rot1,"ONLY");  
    1578             :           
    1579             :     // TopEarthFace - 2 copies
    1580             :     posX = 23.122+fgkDeltaQuadLHC;
    1581             :     posY = 96.90+fgkDeltaQuadLHC;
    1582             :     posZ = kHzOuterFrameEpoxy+kHzOuterFrameInox+kHzTopEarthFaceCu;
    1583           6 :     TVirtualMC::GetMC()->Gspos("SQ13",1,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");
    1584             :     posZ = -1.*posZ;
    1585           6 :     TVirtualMC::GetMC()->Gspos("SQ13",2,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");
    1586             : 
    1587             :     // TopEarthProfile 
    1588             :     posX = 14.475+fgkDeltaQuadLHC;
    1589             :     posY = 97.900+fgkDeltaQuadLHC; 
    1590             :     posZ = kHzTopEarthProfileCu;
    1591           6 :     TVirtualMC::GetMC()->Gspos("SQ14",1,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");
    1592             :     posZ = -1.0*posZ;
    1593           6 :     TVirtualMC::GetMC()->Gspos("SQ14",2,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");
    1594             : 
    1595             :     // TopGasSupport - 2 copies                            
    1596             :     posX = 4.9500+fgkDeltaQuadLHC;
    1597             :     posY = 96.200+fgkDeltaQuadLHC;
    1598             :     posZ = kHzOuterFrameEpoxy+kHzOuterFrameInox+kHzTopGasSupportAl;
    1599           6 :     TVirtualMC::GetMC()->Gspos("SQ15",1,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");
    1600             :     posZ = -1.*posZ;
    1601           6 :     TVirtualMC::GetMC()->Gspos("SQ15",2,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");
    1602             :     
    1603             :     // TopPositioner parameters - single Stainless Steel trapezoid - 2 copies
    1604             :     posX = 7.60+fgkDeltaQuadLHC;
    1605             :     posY = 98.98+fgkDeltaQuadLHC;   
    1606             :     posZ = kHzOuterFrameEpoxy+kHzOuterFrameInox+2.*kHzTopGasSupportAl+kHzTopPositionerSteel;
    1607           6 :     TVirtualMC::GetMC()->Gspos("SQ16",1,quadrantMLayerName,posX, posY, posZ, rot1,"ONLY");
    1608             :     posZ = -1.*posZ;
    1609           6 :     TVirtualMC::GetMC()->Gspos("SQ16",2,quadrantMLayerName,posX, posY, posZ, rot1,"ONLY"); 
    1610             : 
    1611             :     // OutEdgeFrame 
    1612             : 
    1613             :     posZ = -1.0*kHzOuterFrameInox;     
    1614             :     //Double_t xCenterAll = 70.6615;
    1615             :     Double_t xCenterAll = 70.500;
    1616             :     Double_t yCenterAll = 70.350;
    1617           6 :     TVirtualMC::GetMC()->Gspos("SQ17to23",1,quadrantMLayerName, xCenterAll, yCenterAll, posZ, rot4,"ONLY");
    1618             :      
    1619             :     posZ = kHzOuterFrameEpoxy;
    1620           6 :     TVirtualMC::GetMC()->Gspos("SQ18to24",1,quadrantMLayerName, xCenterAll, yCenterAll, posZ, rot4,"ONLY");
    1621             :     
    1622             : //---    
    1623             :         
    1624             : // OutVFrame
    1625             :     posX = 2.*kHxInVFrame+kIAF+2.*kHxInHFrame-kHxOutVFrame+2.*kHxV1mm;
    1626             :     posY = 2.*kHyInHFrame+kHyOutVFrame;    
    1627             :     posZ = 0.;              
    1628           6 :     TVirtualMC::GetMC()->Gspos("SQ25",1,quadrantMLayerName,posX, posY, posZ, 0, "ONLY"); 
    1629             : 
    1630             :  // keep memory of the mid position. Used for placing screws
    1631             :     const GReal_t kMidOVposX = posX;
    1632             :     const GReal_t kMidOVposY = posY;
    1633             :     const GReal_t kMidOVposZ = posZ;
    1634             : 
    1635             :     const Float_t kTOPY = posY+kHyOutVFrame;
    1636             :     const Float_t kOUTX = posX;
    1637             : 
    1638             : // OutVFrame corner
    1639             :     posX = kOUTX;
    1640             :     posY = kTOPY+((kBl1OCTF+kTl1OCTF)/2.);
    1641             :     posZ = 0.;     
    1642             :     // shift to solve overlap with SQ17to23 and SQ18to24
    1643             :     posX += 0.02;
    1644           6 :     TVirtualMC::GetMC()->Gspos("SQ26",1,quadrantMLayerName,posX, posY, posZ, rot1,"ONLY"); 
    1645             : 
    1646             : // VertEarthFaceCu - 2 copies
    1647             :     posX = 89.4000+fgkDeltaQuadLHC;
    1648             :     posY = 25.79+fgkDeltaQuadLHC;    
    1649             :     posZ = kHzFrameThickness+2.0*kHzFoam+kHzVertEarthFaceCu;              
    1650           6 :     TVirtualMC::GetMC()->Gspos("SQ27",1,quadrantMLayerName,posX, posY, posZ, rot1, "ONLY"); 
    1651             :     posZ = -1.0*posZ; 
    1652           6 :     TVirtualMC::GetMC()->Gspos("SQ27",2,quadrantMLayerName,posX, posY, posZ, rot1, "ONLY"); 
    1653             :     
    1654             : // VertEarthSteel - 2 copies
    1655             :     posX = 91.00+fgkDeltaQuadLHC;
    1656             :     posY = 30.616+fgkDeltaQuadLHC;    
    1657             :     posZ = kHzFrameThickness+2.0*kHzFoam+kHzVertBarSteel;              
    1658           6 :     TVirtualMC::GetMC()->Gspos("SQ28",1,quadrantMLayerName,posX, posY, posZ, rot1, "ONLY"); 
    1659             :     posZ = -1.0*posZ;              
    1660           6 :     TVirtualMC::GetMC()->Gspos("SQ28",2,quadrantMLayerName,posX, posY, posZ, rot1, "ONLY");
    1661             :  
    1662             : // VertEarthProfCu - 2 copies
    1663             :     posX = 92.000+fgkDeltaQuadLHC;
    1664             :     posY = 29.64+fgkDeltaQuadLHC;    
    1665             :     posZ = kHzFrameThickness;              
    1666           6 :     TVirtualMC::GetMC()->Gspos("SQ29",1,quadrantMLayerName,posX, posY, posZ, rot1, "ONLY"); 
    1667             :     posZ = -1.0*posZ;    
    1668           6 :     TVirtualMC::GetMC()->Gspos("SQ29",2,quadrantMLayerName,posX, posY, posZ, rot1, "ONLY"); 
    1669             : 
    1670             : // SuppLateralPositionner - 2 copies 
    1671             :     posX = 90.2-kNearFarLHC;
    1672             :     posY = 5.00-kNearFarLHC;    
    1673             :     posZ = kHzLateralPosnAl-fgkMotherThick2;             
    1674           6 :     TVirtualMC::GetMC()->Gspos("SQ30",1,quadrantFLayerName,posX, posY, posZ, 0, "ONLY"); 
    1675             :     posZ = -1.0*posZ;            
    1676           6 :     TVirtualMC::GetMC()->Gspos("SQ30",2,quadrantNLayerName,posX, posY, posZ, 0, "ONLY"); 
    1677             : 
    1678             : // LateralPositionner - 2 copies - Face view
    1679             :     posX = 92.175-kNearFarLHC-2.*kHxLPP;
    1680             :     posY = 5.00-kNearFarLHC;   
    1681             :     posZ =2.0*kHzLateralPosnAl+kHzLateralPosnInoxFace-fgkMotherThick2;              
    1682           6 :     TVirtualMC::GetMC()->Gspos("SQ31",1,quadrantFLayerName,posX, posY, posZ, 0, "ONLY"); 
    1683             :     posZ = -1.0*posZ;             
    1684           6 :     TVirtualMC::GetMC()->Gspos("SQ31",2,quadrantNLayerName,posX, posY, posZ, 0, "ONLY"); 
    1685             : 
    1686             : // LateralPositionner -  Profile view   
    1687             :     posX = 92.175+fgkDeltaQuadLHC+kHxLPF-kHxLPP;
    1688             :     posY = 5.00+fgkDeltaQuadLHC;    
    1689             :     posZ = 0.;              
    1690           6 :     TVirtualMC::GetMC()->Gspos("SQ32",1,quadrantMLayerName,posX, posY, posZ, 0, "ONLY"); // middle layer
    1691             : 
    1692             :     posX = 92.175-kNearFarLHC+kHxLPF-kHxLPP; 
    1693             :     posY = 5.0000-kNearFarLHC;    
    1694             :     posZ = fgkMotherThick2-kHzLPNF;              
    1695           6 :     TVirtualMC::GetMC()->Gspos("SQ33",1,quadrantNLayerName,posX, posY, posZ, 0, "ONLY"); // near layer
    1696             :     posZ = -1.*posZ;
    1697           6 :     TVirtualMC::GetMC()->Gspos("SQ33",2,quadrantFLayerName,posX, posY, posZ, 0, "ONLY"); // far layer
    1698             :       
    1699             : 
    1700             : // VertCradle - 3 (or 4 ) trapezoids redefined with TGeoXtru shape
    1701             : 
    1702             :     posX = 97.29+fgkDeltaQuadLHC;
    1703             :     posY = 23.02+fgkDeltaQuadLHC;    
    1704             :     posZ = 0.;          
    1705             :     posX += 1.39311;
    1706           6 :     TVirtualMC::GetMC()->Gspos("SQ34to37",2,quadrantMLayerName,posX, posY, posZ, 0, "ONLY");  
    1707             : 
    1708             :     posX = 97.29-kNearFarLHC;
    1709             :     posY = 23.02-kNearFarLHC;   
    1710             :     posZ = 2.0*kHzLateralSightAl+kHzVerticalCradleAl-fgkMotherThick2;          
    1711             :     posX += 1.39311;
    1712           6 :     TVirtualMC::GetMC()->Gspos("SQ34to36",1,quadrantNLayerName,posX, posY, posZ, 0, "ONLY");
    1713             : 
    1714             :     posZ = -1.0*posZ;              
    1715           6 :     TVirtualMC::GetMC()->Gspos("SQ34to36",3,quadrantFLayerName,posX, posY, posZ, 0, "ONLY");
    1716             : 
    1717             : 
    1718             : // OutVertCradleD  4th Trapeze - 3 copies
    1719             : 
    1720             :     posX = 98.81+fgkDeltaQuadLHC;
    1721             :     posY = 2.52+fgkDeltaQuadLHC;    
    1722             :     posZ = fgkMotherThick1-kHzVerticalCradleAl;                
    1723           6 :     TVirtualMC::GetMC()->Gspos("SQ37",1,quadrantMLayerName,posX, posY, posZ, 0, "ONLY");
    1724             :     posZ = -1.0*posZ;          
    1725           6 :     TVirtualMC::GetMC()->Gspos("SQ37",3,quadrantMLayerName,posX, posY, posZ, 0, "ONLY");          
    1726             :              
    1727             : // LateralSightSupport - 2 copies
    1728             :     posX = 98.33-kNearFarLHC;
    1729             :     posY = 10.00-kNearFarLHC;    
    1730             :     posZ = kHzLateralSightAl-fgkMotherThick2;
    1731             :            // Fix (3) of extrusion SQ38 from SQN1, SQN2, SQF1, SQF2 
    1732             :            // (was posX = 98.53 ...)
    1733           6 :     TVirtualMC::GetMC()->Gspos("SQ38",1,quadrantNLayerName,posX, posY, posZ, 0, "ONLY"); 
    1734             :     posZ = -1.0*posZ;             
    1735           6 :     TVirtualMC::GetMC()->Gspos("SQ38",2,quadrantFLayerName,posX, posY, posZ, 0, "ONLY"); 
    1736             :     
    1737             : // Mire placement
    1738             :     posX = 92.84+fgkDeltaQuadLHC;  
    1739             :     posY = 8.13+fgkDeltaQuadLHC;
    1740             :     posZ = 0.;
    1741           6 :     TVirtualMC::GetMC()->Gspos("SQ39",1,quadrantMLayerName,posX, posY, posZ, 0,"ONLY");    
    1742             : 
    1743             : //---
    1744             : 
    1745             : // InHFrame
    1746             :     posX = 2.0*kHxInVFrame+2.*kHxV1mm+kIAF+kHxInHFrame;
    1747             :     posY = kHyInHFrame;
    1748             :     posZ = 0.;       
    1749           6 :     TVirtualMC::GetMC()->Gspos("SQ40",1,quadrantMLayerName,posX, posY, posZ, 0, "ONLY"); 
    1750             :  
    1751             :  // keep memory of the mid position. Used for placing screws
    1752             :     const GReal_t kMidHposX = posX;
    1753             :     const GReal_t kMidHposY = posY;
    1754             :     const GReal_t kMidHposZ = posZ;
    1755             : 
    1756             : // Flat 7.5mm horizontal section
    1757             :     posX = 2.0*kHxInVFrame+2.*kHxV1mm+kIAF+kHxH1mm;
    1758             :     posY = 2.0*kHyInHFrame+kHyH1mm;
    1759             :     posZ = 0.;
    1760           6 :     TVirtualMC::GetMC()->Gspos("SQ41",1,quadrantMLayerName,posX, posY, posZ,0, "ONLY"); 
    1761             :         
    1762             : // InArcFrame 
    1763             :     posX = 2.0*kHxInVFrame+2.*kHxV1mm;
    1764             :     posY = 2.0*kHyInHFrame+2.*kHyH1mm;
    1765             :     posZ = 0.;    
    1766           6 :     TVirtualMC::GetMC()->Gspos("SQ42",1,quadrantMLayerName,posX, posY, posZ,0, "ONLY"); 
    1767             : 
    1768             : // keep memory of the mid position. Used for placing screws
    1769             :     const GReal_t kMidArcposX = posX;
    1770             :     const GReal_t kMidArcposY = posY;
    1771             :     const GReal_t kMidArcposZ = posZ;
    1772             : 
    1773             : // ScrewsInFrame - in sensitive volume
    1774             : 
    1775           2 :      Float_t scruX[64];
    1776           2 :      Float_t scruY[64]; 
    1777             :          
    1778             : // Screws on IHEpoxyFrame
    1779             : 
    1780             :      const Int_t kNumberOfScrewsIH = 14;    // no. of screws on the IHEpoxyFrame
    1781             :      const Float_t kOffX = 5.;              // inter-screw distance 
    1782             : 
    1783             :      // first screw coordinates 
    1784           2 :      scruX[0] = 21.07;                  
    1785           2 :      scruY[0] = -2.23; 
    1786             :      // other screw coordinates      
    1787          56 :      for (Int_t i = 1;i<kNumberOfScrewsIH;i++){   
    1788          26 :      scruX[i] = scruX[i-1]+kOffX; 
    1789          26 :      scruY[i] = scruY[0];
    1790             :      }    
    1791             :      // Position the volumes on the frames
    1792          60 :      for (Int_t i = 0;i<kNumberOfScrewsIH;i++){
    1793          28 :      posX = fgkDeltaQuadLHC + scruX[i];
    1794          28 :      posY = fgkDeltaQuadLHC + scruY[i];
    1795             :      posZ = 0.;   
    1796          84 :      TVirtualMC::GetMC()->Gspos("SQ43",i+1,quadrantMLayerName,posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");      
    1797          28 :      if (chamber==1)
    1798          28 :        TVirtualMC::GetMC()->Gspos("SQ44",i+1,"SQ40",posX+0.1-kMidHposX, posY+0.1-kMidHposY, posZ-kMidHposZ, 0, "ONLY");
    1799          84 :      TVirtualMC::GetMC()->Gspos("SQ45",i+1,quadrantMLayerName,posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY"); 
    1800             :      }
    1801             :      // special screw coordinates
    1802           2 :      scruX[63] = 16.3;  
    1803           2 :      scruY[63] = -2.23; 
    1804           2 :      posX = fgkDeltaQuadLHC + scruX[63];
    1805             :      posY = fgkDeltaQuadLHC + scruY[63];
    1806             :      posZ = 0.;            
    1807           6 :      TVirtualMC::GetMC()->Gspos("SQ43",64,quadrantMLayerName,posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");
    1808           2 :      if (chamber==1)
    1809           2 :        TVirtualMC::GetMC()->Gspos("SQ44",64,"SQ40",posX+0.1-kMidHposX, posY+0.1-kMidHposY, posZ-kMidHposZ, 0, "ONLY"); 
    1810           6 :      TVirtualMC::GetMC()->Gspos("SQ45",64,quadrantMLayerName,posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY");  
    1811             :      
    1812             : // Screws on the IVEpoxyFrame
    1813             :   
    1814             :     const Int_t kNumberOfScrewsIV = 15;     // no. of screws on the IVEpoxyFrame
    1815             :     const Float_t kOffY = 5.;               // inter-screw distance 
    1816             :     Int_t firstScrew = 58;
    1817             :     Int_t lastScrew = 44;
    1818             :  
    1819             :     // first (special) screw coordinates
    1820           2 :     scruX[firstScrew-1] = -2.23; 
    1821           2 :     scruY[firstScrew-1] = 16.3; 
    1822             :     // second (repetitive) screw coordinates
    1823           2 :     scruX[firstScrew-2] = -2.23; 
    1824           2 :     scruY[firstScrew-2] = 21.07;     
    1825             :     // other screw coordinates      
    1826          56 :     for (Int_t i = firstScrew-3;i>lastScrew-2;i--){   
    1827          26 :     scruX[i] = scruX[firstScrew-2];
    1828          26 :     scruY[i] = scruY[i+1]+kOffY;
    1829             :     }
    1830             :     
    1831          64 :     for (Int_t i = 0;i<kNumberOfScrewsIV;i++){
    1832          30 :     posX = fgkDeltaQuadLHC + scruX[i+lastScrew-1];
    1833          30 :     posY = fgkDeltaQuadLHC + scruY[i+lastScrew-1];
    1834             :     posZ = 0.;       
    1835          90 :     TVirtualMC::GetMC()->Gspos("SQ43",i+lastScrew,quadrantMLayerName,posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");     
    1836          30 :     if (chamber==1)
    1837          30 :       TVirtualMC::GetMC()->Gspos("SQ44",i+lastScrew,"SQ00",posX+0.1-kMidVposX, posY+0.1-kMidVposY, posZ-kMidVposZ, 0, "ONLY"); 
    1838          90 :     TVirtualMC::GetMC()->Gspos("SQ45",i+lastScrew,quadrantMLayerName,posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY");
    1839             :     }    
    1840             :     
    1841             : // Screws on the OVEpoxyFrame
    1842             :   
    1843             :     const Int_t kNumberOfScrewsOV = 10;     // no. of screws on the OVEpoxyFrame
    1844             : 
    1845             :     firstScrew = 15;
    1846             :     lastScrew = 25;
    1847             :  
    1848             :     // first (repetitive) screw coordinates
    1849             :     // notes: 1st screw should be placed in volume 40 (InnerHorizFrame)
    1850           2 :     scruX[firstScrew-1] = 90.9; 
    1851           2 :     scruY[firstScrew-1] = -2.23;  // true value
    1852             :  
    1853             :     // other screw coordinates      
    1854          44 :     for (Int_t i = firstScrew; i<lastScrew; i++ ){   
    1855          20 :     scruX[i] = scruX[firstScrew-1];
    1856          20 :     scruY[i] = scruY[i-1]+kOffY;
    1857             :     }
    1858          40 :     for (Int_t i = 1;i<kNumberOfScrewsOV;i++){
    1859          18 :     posX = fgkDeltaQuadLHC + scruX[i+firstScrew-1];
    1860          18 :     posY = fgkDeltaQuadLHC + scruY[i+firstScrew-1];
    1861             :     posZ = 0.;   
    1862          54 :     TVirtualMC::GetMC()->Gspos("SQ43",i+firstScrew,quadrantMLayerName,posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");     
    1863             :     // ??
    1864          18 :     if (chamber==1)
    1865          18 :       TVirtualMC::GetMC()->Gspos("SQ44",i+firstScrew,"SQ25",posX+0.1-kMidOVposX, posY+0.1-kMidOVposY, posZ-kMidOVposZ, 0, "ONLY"); 
    1866          54 :     TVirtualMC::GetMC()->Gspos("SQ45",i+firstScrew,quadrantMLayerName,posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY"); 
    1867             :     }
    1868             :     // special case for 1st screw, inside the horizontal frame (volume 40)
    1869           2 :     posX = fgkDeltaQuadLHC + scruX[firstScrew-1];
    1870           2 :     posY = fgkDeltaQuadLHC + scruY[firstScrew-1];
    1871             :     posZ = 0.;   
    1872           2 :     if (chamber==1)
    1873           2 :       TVirtualMC::GetMC()->Gspos("SQ44",firstScrew,"SQ40",posX+0.1-kMidHposX, posY+0.1-kMidHposY, posZ-kMidHposZ, 0, "ONLY"); 
    1874             :           
    1875             : // Inner Arc of Frame, screw positions and numbers-1
    1876           2 :    scruX[62] = 16.009; scruY[62]  = 1.401;
    1877           2 :    scruX[61] = 14.564; scruY[61]  = 6.791;
    1878           2 :    scruX[60] = 11.363; scruY[60]  = 11.363;
    1879           2 :    scruX[59] = 6.791 ; scruY[59]  = 14.564;
    1880           2 :    scruX[58] = 1.401 ; scruY[58]  = 16.009;
    1881             :     
    1882          24 :     for (Int_t i = 0;i<5;i++){
    1883          10 :     posX = fgkDeltaQuadLHC + scruX[i+58];
    1884          10 :     posY = fgkDeltaQuadLHC + scruY[i+58];
    1885             :     posZ = 0.;   
    1886          30 :     TVirtualMC::GetMC()->Gspos("SQ43",i+58+1,quadrantMLayerName,posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");    
    1887          10 :     if (chamber==1)
    1888          10 :       TVirtualMC::GetMC()->Gspos("SQ44",i+58+1,"SQ42",posX+0.1-kMidArcposX, posY+0.1-kMidArcposY, posZ-kMidArcposZ, 0, "ONLY");
    1889          30 :     TVirtualMC::GetMC()->Gspos("SQ45",i+58+1,quadrantMLayerName,posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY");
    1890             :     }
    1891           2 : }
    1892             : //______________________________________________________________________________
    1893             : void AliMUONSt1GeometryBuilderV2::PlaceInnerLayers(Int_t chamber)
    1894             : {
    1895             : /// Place the gas and copper layers for the specified chamber.
    1896             : 
    1897             :    GReal_t x  = fgkDeltaQuadLHC;
    1898             :    GReal_t y  = fgkDeltaQuadLHC;
    1899             :    GReal_t zg = 0.0;
    1900             :    GReal_t zc = fgkHzGas + fgkHzPadPlane;
    1901           4 :    Int_t dpos = (chamber-1)*2;
    1902             :  
    1903           4 :    TString name = GasVolumeName("SAG", chamber);
    1904          12 :    TVirtualMC::GetMC()->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,0,"ONLY");
    1905          10 :    TVirtualMC::GetMC()->Gspos("SA1C", 1+dpos, QuadrantMLayerName(chamber),x,y, zc,0,"ONLY");
    1906          10 :    TVirtualMC::GetMC()->Gspos("SA1C", 2+dpos, QuadrantMLayerName(chamber),x,y,-zc,0,"ONLY");
    1907           2 : }
    1908             : 
    1909             : //______________________________________________________________________________
    1910             : void AliMUONSt1GeometryBuilderV2::PlaceSpacer0(Int_t chamber)
    1911             : {
    1912             : /// Place the spacer defined in global positions
    1913             : /// !! This method should be used only to find out the right mother volume
    1914             : /// for the spacer if geometry is changed and the plane segment volumes
    1915             : /// will change their numbering
    1916             : 
    1917             :   // Global position of mother volume for the QuadrantMLayer
    1918             :   // SQM1: (-2.6, -2.6, -522.41)
    1919             :   // SQM2: (-2.6, -2.6, -541.49)
    1920             :   GReal_t mx =  2.6;
    1921             :   GReal_t my = -2.6;
    1922             :   GReal_t mz =  522.41;
    1923             :   
    1924             :   GReal_t x, y, z;
    1925             :   x = 40.82  - mx;
    1926             :   y = 43.04  - my;
    1927             :   z = 522.41 - mz;
    1928           0 :   AliDebugStream(2) << "spacer05 pos1: " << x << ", " << y << ", " << z << endl;
    1929           0 :   TVirtualMC::GetMC()->Gspos("Spacer05", 1, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
    1930             : 
    1931             :   y = 44.54  - my;
    1932           0 :   AliDebugStream(2) << "spacer05 pos2: " << x << ", " << y << ", " << z << endl;
    1933           0 :   TVirtualMC::GetMC()->Gspos("Spacer05", 2, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
    1934             : 
    1935             :   x = 40.82  - mx;
    1936             :   y = 43.79  - my;
    1937             :   z = 519.76 - mz;
    1938           0 :   AliDebugStream(2) << "spacer06 pos1: " << x << ", " << y << ", " << z << endl;
    1939           0 :   TVirtualMC::GetMC()->Gspos("Spacer06", 1, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
    1940             : 
    1941             :   z = 525.06 - mz;
    1942           0 :   AliDebugStream(2) << "spacer06 pos2: " << x << ", " << y << ", " << z << endl;
    1943           0 :   TVirtualMC::GetMC()->Gspos("Spacer06", 2, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
    1944             : 
    1945             :   x = 40.82  - mx;
    1946             :   y = 43.79  - my;
    1947             :   z = 522.41 - mz;
    1948           0 :   AliDebugStream(2) << "spacer07 pos1: " << x << ", " << y << ", " << z << endl;
    1949           0 :   TVirtualMC::GetMC()->Gspos("Spacer07", 1, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
    1950           0 : }
    1951             : 
    1952             : //______________________________________________________________________________
    1953             : void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
    1954             :                             TExMap specialMap, 
    1955             :                             const TVector3& where, Bool_t reflectZ, Int_t chamber)
    1956             : {
    1957             : /// Place all the segments in the mother volume, at the position defined
    1958             : /// by the sector's data.                                                      \n
    1959             : /// The lines with comments COMMENT OUT BEGIN/END indicates blocks
    1960             : /// which can be commented out in order to reduce the number of volumes
    1961             : /// in a sector to the plane segments corresponding to regular motifs only.
    1962             : 
    1963             :   static Int_t segNum=1;
    1964             :   Int_t sgn;
    1965           4 :   Int_t reflZ;
    1966           4 :   Int_t rotMat;
    1967             : 
    1968           4 :   if (!reflectZ) {
    1969             :     sgn= 1;
    1970           2 :     reflZ=0;                                     // no reflection along z... nothing
    1971           2 :     fMUON->AliMatrix(rotMat,  90.,90.,90,180.,0.,0.);   // 90° rotation around z, NO reflection along z
    1972           2 :   } else  {
    1973             :     sgn=-1;
    1974           2 :     fMUON->AliMatrix(reflZ,  90.,0.,90,90.,180.,0.);    // reflection along z
    1975           2 :     fMUON->AliMatrix(rotMat,  90.,90.,90,180.,180.,0.); // 90° rotation around z AND reflection along z
    1976             :   }
    1977             :   
    1978             :   GReal_t posX,posY,posZ;
    1979             :   
    1980           4 :   TArrayI alreadyDone(20);
    1981             :   Int_t nofAlreadyDone = 0;
    1982             : 
    1983         168 :   for (Int_t irow=0;irow<sector->GetNofRows();irow++){ // for each row
    1984          52 :     AliMpRow* row = sector->GetRow(irow);
    1985             : 
    1986             : 
    1987         696 :     for (Int_t iseg=0;iseg<row->GetNofRowSegments();iseg++){ // for each row segment
    1988         180 :       AliMpVRowSegment* seg = row->GetRowSegment(iseg);
    1989             :       
    1990         360 :       Long_t value = specialMap.GetValue(seg->GetMotifPositionId(0));
    1991             : 
    1992         180 :       if ( value == 0 ){ //if this is a normal segment (ie. not part of <specialMap>)
    1993             :       
    1994             :         // create the cathode part
    1995         840 :         CreatePlaneSegment(segNum, TVector2(seg->GetDimensionX(),seg->GetDimensionY()), 
    1996         168 :                            seg->GetNofMotifs());
    1997             :   
    1998         336 :         posX = where.X() + seg->GetPositionX();
    1999         336 :         posY = where.Y() + seg->GetPositionY();
    2000         168 :         posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
    2001         840 :         TVirtualMC::GetMC()->Gspos(PlaneSegmentName(segNum).Data(), 1, 
    2002         504 :                    QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
    2003             : 
    2004             :         // and place all the daughter boards of this segment
    2005             : 
    2006             : // COMMENT OUT BEGIN
    2007        3156 :         for (Int_t motifNum=0;motifNum<seg->GetNofMotifs();motifNum++) {
    2008             : 
    2009             :           // Copy number
    2010         884 :           Int_t motifPosId = seg->GetMotifPositionId(motifNum);
    2011             :           AliMpMotifPosition* motifPos = 
    2012         884 :             sector->GetMotifMap()->FindMotifPosition(motifPosId);
    2013             :           Int_t copyNo = motifPosId;
    2014        1322 :           if ( sector->GetDirection() == AliMp::kX) copyNo += fgkDaughterCopyNoOffset;
    2015             :   
    2016             :           // Position
    2017         884 :           posX = where.X() + motifPos->GetPositionX() + fgkOffsetX;
    2018         884 :           posY = where.Y() + motifPos->GetPositionY() + fgkOffsetY;
    2019         884 :           posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
    2020        4420 :           TVirtualMC::GetMC()->Gspos(fgkDaughterName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
    2021             :         }  
    2022             : // COMMENT OUT END
    2023             : 
    2024         168 :         segNum++;
    2025             :         
    2026         168 :       } else { 
    2027             : 
    2028             : // COMMENT OUT BEGIN
    2029             :         // if this is a special segment 
    2030         102 :         for (Int_t motifNum=0;motifNum<seg->GetNofMotifs();motifNum++) {// for each motif
    2031             : 
    2032          22 :           Int_t motifPosId = seg->GetMotifPositionId(motifNum);
    2033             :           
    2034             :           Bool_t isDone = false;
    2035             :           Int_t i=0;
    2036         176 :           while (i<nofAlreadyDone && !isDone) {
    2037          92 :             if (alreadyDone.At(i) == motifPosId) isDone=true;
    2038          44 :             i++;
    2039             :           }  
    2040          26 :           if (isDone) continue; // don't treat the same motif twice
    2041             : 
    2042          36 :           AliMUONSt1SpecialMotif spMot = *((AliMUONSt1SpecialMotif*)specialMap.GetValue(motifPosId));
    2043         108 :           AliDebugStream(2) << chamber << " processing special motif: " << motifPosId << endl;  
    2044             : 
    2045          18 :           AliMpMotifPosition* motifPos = sector->GetMotifMap()->FindMotifPosition(motifPosId);
    2046             : 
    2047             :           // Copy number
    2048             :           Int_t copyNo = motifPosId;
    2049          30 :           if ( sector->GetDirection() == AliMp::kX) copyNo += fgkDaughterCopyNoOffset;
    2050             : 
    2051             :           // place the hole for the motif, wrt the requested rotation angle
    2052          18 :           Int_t rot = ( spMot.GetRotAngle()<0.1 ) ? reflZ:rotMat;
    2053             : 
    2054          36 :           posX = where.X() + motifPos->GetPositionX() + spMot.GetDelta().X();
    2055          36 :           posY = where.Y() + motifPos->GetPositionY() + spMot.GetDelta().Y();
    2056          18 :           posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
    2057             :           // Shift the hole for special motif 46 to avoid debording into S047
    2058          18 :           if ( copyNo == 2070 ) {
    2059           2 :             posX -= 0.1;
    2060           2 :             posY -= 0.1;
    2061           2 :           }  
    2062          90 :           TVirtualMC::GetMC()->Gspos(fgkHoleName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
    2063             : 
    2064             :           // then place the daughter board for the motif, wrt the requested rotation angle
    2065          18 :           posX = posX+fgkDeltaFilleEtamX;
    2066          18 :           posY = posY+fgkDeltaFilleEtamY;
    2067             :           // Do not shift the daughter board
    2068          18 :           if ( copyNo == 2070 ) {
    2069           2 :             posX += 0.1;
    2070           2 :             posY += 0.1;
    2071           2 :           }  
    2072          18 :           posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
    2073          90 :           TVirtualMC::GetMC()->Gspos(fgkDaughterName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
    2074             : 
    2075          18 :           if (nofAlreadyDone == alreadyDone.GetSize()) 
    2076           0 :              alreadyDone.Set(2*nofAlreadyDone); 
    2077          18 :           alreadyDone.AddAt(motifPosId, nofAlreadyDone++);                
    2078             : 
    2079         108 :           AliDebugStream(2) << chamber << " processed motifPosId: " << motifPosId << endl;
    2080          18 :         }               
    2081             : // COMMENT OUT END
    2082             :  
    2083             :       }// end of special motif case
    2084             :     }
    2085             :   }
    2086           4 : } 
    2087             : 
    2088             : //______________________________________________________________________________
    2089             : TString AliMUONSt1GeometryBuilderV2::GasVolumeName(const TString& name, Int_t chamber) const
    2090             : {
    2091             : /// Insert the chamber number into the name.
    2092             : 
    2093           4 :   TString newString(name);
    2094             :  
    2095           2 :   TString number(""); 
    2096           2 :   number += chamber;
    2097             : 
    2098           2 :   newString.Insert(2, number);
    2099             :   
    2100             :   return newString;
    2101           4 : }
    2102             : 
    2103             : //
    2104             : // public methods
    2105             : //
    2106             : 
    2107             : //______________________________________________________________________________
    2108             : void AliMUONSt1GeometryBuilderV2::CreateMaterials()
    2109             : {
    2110             : /// Define materials specific to station 1
    2111             : 
    2112             : // Materials and medias defined in MUONv1:
    2113             : //
    2114             : //  AliMaterial( 9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
    2115             : //  AliMaterial(10, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
    2116             : //  AliMaterial(15, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
    2117             : //  AliMixture( 19, "Bakelite$", abak, zbak, dbak, -3, wbak);
    2118             : //  AliMixture( 20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
    2119             : //  AliMixture( 21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
    2120             : //  AliMixture( 22, "ArCO2 80%$", ag1, zg1, dg1, 3, wg1);
    2121             : //  AliMixture( 23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
    2122             : //  AliMixture( 24, "ArCO2 GAS$", agas, zgas, dgas, 3, wgas);
    2123             : //  AliMaterial(31, "COPPER$",   63.54,    29.,   8.96,  1.4, 0.);
    2124             : //  AliMixture( 32, "Vetronite$",aglass, zglass, dglass,    5, wglass);
    2125             : //  AliMaterial(33, "Carbon$",   12.01,     6.,  2.265, 18.8, 49.9);
    2126             : //  AliMixture( 34, "Rohacell$", arohac, zrohac, drohac,   -4, wrohac); 
    2127             : 
    2128             : //  AliMedium( 1, "AIR_CH_US         ",  15, 1, iSXFLD, ...
    2129             : //  AliMedium( 4, "ALU_CH_US          ",  9, 0, iSXFLD, ... 
    2130             : //  AliMedium( 5, "ALU_CH_US          ", 10, 0, iSXFLD, ... 
    2131             : //  AliMedium( 6, "AR_CH_US          ",  20, 1, iSXFLD, ... 
    2132             : //  AliMedium( 7, "GAS_CH_TRIGGER    ",  21, 1, iSXFLD, ... 
    2133             : //  AliMedium( 8, "BAKE_CH_TRIGGER   ",  19, 0, iSXFLD, ... 
    2134             : //  AliMedium( 9, "ARG_CO2   ",          22, 1, iSXFLD, ... 
    2135             : //  AliMedium(11, "PCB_COPPER        ",  31, 0, iSXFLD, ... 
    2136             : //  AliMedium(12, "VETRONITE         ",  32, 0, iSXFLD, ... 
    2137             : //  AliMedium(13, "CARBON            ",  33, 0, iSXFLD, ... 
    2138             : //  AliMedium(14, "Rohacell          ",  34, 0, iSXFLD, ... 
    2139             : //  AliMedium(24, "FrameCH$          ",  44, 1, iSXFLD, ...
    2140             : 
    2141             :   //
    2142             :   // --- Define materials for GEANT ---
    2143             :   //
    2144             : 
    2145           2 :   fMUON->AliMaterial(41, "Aluminium II$", 26.98, 13., 2.7, -8.9, 26.1);
    2146             :        // was id: 9
    2147             :        // from PDG and "The Particle Detector BriefBook", Bock and Vasilescu, P.18  
    2148             :         // ??? same but the last but one argument < 0 
    2149             :   //
    2150             :   // --- Define mixtures for GEANT ---
    2151             :   //
    2152             : 
    2153             :  //  //     Ar-CO2 gas II (80%+20%)   
    2154             : //   Float_t ag1[2]   = { 39.95,  44.01};
    2155             : //   Float_t zg1[2]   = { 18., 22.};
    2156             : //   Float_t wg1[2]   = { .8, 0.2};
    2157             : //   Float_t dg1      = .001821;
    2158             : //   fMUON->AliMixture(45, "ArCO2 II 80%$", ag1, zg1, dg1, 2, wg1);  
    2159             : //             // was id: 22
    2160             : //             // use wg1 weighting factors (6th arg > 0)
    2161             : 
    2162             :   // Rohacell 51  II - imide methacrylique
    2163           1 :   Float_t aRohacell51[4] = { 12.01, 1.01, 16.00, 14.01}; 
    2164           1 :   Float_t zRohacell51[4] = { 6., 1., 8., 7.}; 
    2165           1 :   Float_t wRohacell51[4] = { 9., 13., 2., 1.};  
    2166             :   Float_t dRohacell51 = 0.052;
    2167           1 :   fMUON->AliMixture(46, "FOAM$",aRohacell51,zRohacell51,dRohacell51,-4,wRohacell51);  
    2168             :             // was id: 32
    2169             :             // use relative A (molecular) values (6th arg < 0)
    2170             :    
    2171           1 :   Float_t aSnPb[2] = { 118.69, 207.19};
    2172           1 :   Float_t zSnPb[2] = { 50, 82};
    2173           1 :   Float_t wSnPb[2] = { 0.6, 0.4} ;
    2174             :   Float_t dSnPb = 8.926;
    2175           1 :   fMUON->AliMixture(47, "SnPb$", aSnPb,zSnPb,dSnPb,2,wSnPb);
    2176             :             // was id: 35
    2177             :             // use wSnPb weighting factors (6th arg > 0)
    2178             : 
    2179             :   // plastic definition from K5, Freiburg (found on web)
    2180           1 :   Float_t aPlastic[2]={ 1.01, 12.01};
    2181           1 :   Float_t zPlastic[2]={ 1, 6};
    2182           1 :   Float_t wPlastic[2]={ 1, 1};
    2183             :   Float_t denPlastic=1.107;
    2184           1 :   fMUON->AliMixture(48, "Plastic$",aPlastic,zPlastic,denPlastic,-2,wPlastic);
    2185             :             // was id: 33
    2186             :             // use relative A (molecular) values (6th arg < 0)...no other info...
    2187             :  
    2188             :   // Not used, to be removed
    2189             :   //
    2190             :        // was id: 34
    2191             : 
    2192             :   // Inox/Stainless Steel (18%Cr, 9%Ni)
    2193           1 :   Float_t aInox[3] = {55.847, 51.9961, 58.6934};  
    2194           1 :   Float_t zInox[3] = {26., 24., 28.};
    2195           1 :   Float_t wInox[3] = {0.73, 0.18, 0.09}; 
    2196             :   Float_t denInox = 7.930;
    2197           1 :   fMUON->AliMixture(50, "StainlessSteel$",aInox,zInox,denInox,3,wInox);   
    2198             :             // was id: 37
    2199             :             // use wInox weighting factors (6th arg > 0) 
    2200             :             // from CERN note NUFACT Note023, Oct.2000 
    2201             :   //
    2202             :   // End - Not used, to be removed
    2203             : 
    2204             :   //
    2205             :   // --- Define the tracking medias for GEANT ---
    2206             :   // 
    2207             : 
    2208             :   GReal_t epsil  = .001;       // Tracking precision,
    2209             :   //GReal_t stemax = -1.;        // Maximum displacement for multiple scat
    2210             :   GReal_t tmaxfd = -20.;       // Maximum angle due to field deflection
    2211             :   //GReal_t deemax = -.3;        // Maximum fractional energy loss, DLS
    2212             :   GReal_t stmin  = -.8;
    2213           1 :   GReal_t maxStepAlu   = fMUON->GetMaxStepAlu();
    2214           1 :   GReal_t maxDestepAlu = fMUON->GetMaxDestepAlu();
    2215             :   // GReal_t maxStepGas   = fMUON->GetMaxStepGas();
    2216           1 :   Int_t iSXFLD   = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->PrecInteg();
    2217           1 :   Float_t sXMGMX = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
    2218             : 
    2219           2 :   fMUON->AliMedium(21, "ALU_II$",    41, 0, iSXFLD, sXMGMX, 
    2220           1 :                    tmaxfd, maxStepAlu, maxDestepAlu, epsil, stmin);
    2221             : 
    2222             :                    // was med: 20  mat: 36
    2223             :  //  fMUON->AliMedium(25, "ARG_CO2_II", 45, 1, iSXFLD, sXMGMX,
    2224             : //                    tmaxfd, maxStepGas, maxDestepAlu, epsil, stmin);
    2225             : //                 // was med: 9   mat: 22
    2226           1 :   fMUON->AliMedium(26, "FOAM_CH$",   46, 0, iSXFLD, sXMGMX,
    2227             :                    10.0,  0.1, 0.1, 0.1, 0.1, 0, 0) ;
    2228             :                    // was med: 16  mat: 32
    2229           1 :   fMUON->AliMedium(27, "SnPb$",      47, 0, iSXFLD, sXMGMX,  
    2230             :                    10.0, 0.01, 1.0, 0.003, 0.003);
    2231             :                    // was med: 19  mat: 35
    2232           1 :   fMUON->AliMedium(28, "Plastic$",   48, 0, iSXFLD, sXMGMX,
    2233             :                    10.0, 0.01, 1.0, 0.003, 0.003);
    2234             :                    // was med: 17  mat: 33
    2235             : 
    2236             :   // Not used, to be romoved
    2237             :   //
    2238             : 
    2239           1 :   fMUON->AliMedium(30, "InoxBolts$", 50, 1, iSXFLD, sXMGMX, 
    2240             :                    10.0, 0.01, 1.0, 0.003, 0.003);
    2241             :                    // was med: 21  mat: 37
    2242             :   //
    2243             :   // End - Not used, to be removed
    2244           1 : }
    2245             : 
    2246             : //______________________________________________________________________________
    2247             : void AliMUONSt1GeometryBuilderV2::CreateGeometry()
    2248             : {
    2249             : /// Create the detailed GEANT geometry for the dimuon arm station1
    2250             : 
    2251           4 :   AliDebug(1,"Called");
    2252             : 
    2253             :   // Define chamber volumes as virtual
    2254             :   // 
    2255             : 
    2256             :   // Create basic volumes
    2257             :   // 
    2258           1 :   CreateHole();
    2259           1 :   CreateDaughterBoard();
    2260           1 :   CreateInnerLayers();
    2261             :   // CreateSpacer0();
    2262           1 :   CreateSpacer();
    2263             :   
    2264             :   // Create reflexion matrices
    2265             :   //
    2266             : /*
    2267             :   Int_t reflXZ, reflYZ, reflXY;
    2268             :   fMUON->AliMatrix(reflXZ,  90.,  180., 90., 90., 180., 0.);
    2269             :   fMUON->AliMatrix(reflYZ,  90., 0., 90.,-90., 180., 0.);
    2270             :   fMUON->AliMatrix(reflXY,  90., 180., 90., 270., 0., 0.);
    2271             : */
    2272             :   // Define transformations for each quadrant
    2273             :   // In old coordinate system:        In new coordinate system:
    2274             :   // 
    2275             :   // 
    2276             :   //     II. |  I.                   I. |  II. 
    2277             :   //         |                    (101) | (100)
    2278             :   //   _____ | ____               _____ | ____                         
    2279             :   //         |                          |
    2280             :   //    III. |  IV.                 IV. | III.
    2281             :   //                              (102) | (103) 
    2282             :   // 
    2283             : /*
    2284             :   Int_t rotm[4];
    2285             :   rotm[0]=0;       // quadrant I
    2286             :   rotm[1]=reflXZ;  // quadrant II
    2287             :   rotm[2]=reflXY;  // quadrant III
    2288             :   rotm[3]=reflYZ;  // quadrant IV
    2289             : */
    2290           9 :   TGeoRotation rotm[4]; 
    2291           3 :   rotm[0] = TGeoRotation("identity");
    2292           3 :   rotm[1] = TGeoRotation("reflXZ", 90.,  180., 90., 90., 180., 0.);
    2293           3 :   rotm[2] = TGeoRotation("reflXY", 90., 180., 90., 270., 0., 0.);
    2294           3 :   rotm[3] = TGeoRotation("reflYZ", 90., 0., 90.,-90., 180., 0.);
    2295             :   
    2296           9 :   TVector3 scale[4];  
    2297           2 :   scale[0] = TVector3( 1,  1, -1);  // quadrant I
    2298           2 :   scale[1] = TVector3(-1,  1,  1);  // quadrant II
    2299           2 :   scale[2] = TVector3(-1, -1, -1);  // quadrant III
    2300           2 :   scale[3] = TVector3( 1, -1,  1);  // quadrant IV
    2301             :   
    2302           1 :   Int_t  detElemId[4];  
    2303           1 :   detElemId[0] =  1;  // quadrant I
    2304           1 :   detElemId[1] =  0;  // quadrant II
    2305           1 :   detElemId[2] =  3;  // quadrant III
    2306           1 :   detElemId[3] =  2;  // quadrant IV
    2307             :   
    2308             :   // Shift in Z of the middle layer
    2309             :   Double_t deltaZ = 7.5/2.;         
    2310             : 
    2311             :   // Position of quadrant I wrt to the chamber position
    2312             :   // TVector3 pos0(-fgkDeltaQuadLHC, -fgkDeltaQuadLHC, deltaZ);
    2313             : 
    2314             :   // Shift for near/far layers
    2315             :   GReal_t  shiftXY = fgkFrameOffset;
    2316             :   GReal_t  shiftZ  = fgkMotherThick1+fgkMotherThick2;
    2317             : 
    2318             :   // Build two chambers
    2319             :   //
    2320           6 :   for (Int_t ich=1; ich<3; ich++) {
    2321             :   //for (Int_t ich=1; ich<2; ich++) {
    2322             : 
    2323             :     // Create quadrant volume
    2324           2 :     CreateQuadrant(ich);
    2325             : 
    2326             :     // Place gas volumes
    2327           2 :     PlaceInnerLayers(ich);
    2328             :     
    2329             :     // Place the quadrant
    2330          20 :     for (Int_t i=0; i<4; i++) {
    2331             :     //for (Int_t i=1; i<2; i++) {
    2332             :       // DE envelope
    2333             :       GReal_t posx0, posy0, posz0;
    2334           8 :       posx0 = fgkPadXOffsetBP * scale[i].X();
    2335           8 :       posy0 = fgkPadYOffsetBP * scale[i].Y();;
    2336           8 :       posz0 = deltaZ * scale[i].Z();
    2337          24 :       GetEnvelopes(ich-1)
    2338          16 :         ->AddEnvelope(QuadrantEnvelopeName(ich,i), detElemId[i] + ich*100, true,
    2339          16 :                       TGeoTranslation(posx0, posy0, posz0), rotm[i]);
    2340             : 
    2341             :       // Middle layer
    2342             :       GReal_t posx, posy, posz;
    2343             :       posx = -fgkDeltaQuadLHC - fgkPadXOffsetBP;
    2344             :       posy = -fgkDeltaQuadLHC - fgkPadYOffsetBP;
    2345             :       posz = 0.;
    2346          24 :       GetEnvelopes(ich-1)
    2347          16 :         ->AddEnvelopeConstituent(QuadrantMLayerName(ich), QuadrantEnvelopeName(ich,i),
    2348           8 :                      i+1, TGeoTranslation(posx, posy, posz));
    2349          24 :       GetEnvelopes(ich-1)
    2350          16 :         ->AddEnvelopeConstituent(QuadrantMFLayerName(ich), QuadrantEnvelopeName(ich,i),
    2351           8 :                      i+5, TGeoTranslation(posx, posy, posz));
    2352             : 
    2353             :       // Near/far layers
    2354             :       GReal_t  posx2 = posx + shiftXY;;
    2355             :       GReal_t  posy2 = posy + shiftXY;;
    2356             :       GReal_t  posz2 = posz - shiftZ;;
    2357             :       //TVirtualMC::GetMC()->Gspos(QuadrantNLayerName(ich), i+1, "ALIC", posx2, posy2, posz2, rotm[i],"ONLY");
    2358          24 :       GetEnvelopes(ich-1)
    2359          16 :         ->AddEnvelopeConstituent(QuadrantNLayerName(ich), QuadrantEnvelopeName(ich,i),
    2360           8 :                      i+1, TGeoTranslation(posx2, posy2, posz2)); 
    2361             :     
    2362             :       posz2 = posz + shiftZ;      
    2363             :       //TVirtualMC::GetMC()->Gspos(QuadrantFLayerName(ich), i+1, "ALIC", posx2, posy2, posz2, rotm[i],"ONLY");
    2364          24 :       GetEnvelopes(ich-1)
    2365          16 :         ->AddEnvelopeConstituent(QuadrantFLayerName(ich), QuadrantEnvelopeName(ich,i), 
    2366           8 :                      i+1, TGeoTranslation(posx2, posy2, posz2)); 
    2367             : 
    2368             :       // Place spacer in global coordinates in the first non rotated quadrant
    2369             :       // if ( detElemId[i] == 0 ) PlaceSpacer0(ich);
    2370             :                // !! This placement should be used only to find out the right mother volume
    2371             :                // for the spacer if geometry is changed and the plane segment volumes
    2372             :                // will change their numbering
    2373             :                // The call to the method CreateSpacer0(); above haa to be uncommented, too
    2374             :    }
    2375             :  }     
    2376          11 : }
    2377             : 
    2378             : //______________________________________________________________________________
    2379             : void AliMUONSt1GeometryBuilderV2::SetVolumes() 
    2380             : {
    2381             : /// Define the volumes for the station2 chambers.
    2382             : 
    2383           2 :   if (gAlice->GetModule("SHIL")) {
    2384           2 :     SetMotherVolume(0, "YOUT1");
    2385           2 :     SetMotherVolume(1, "YOUT1");
    2386           1 :   }  
    2387             : 
    2388           2 :   SetVolume(0, "SC01", true);
    2389           2 :   SetVolume(1, "SC02", true);
    2390           1 : }
    2391             : 
    2392             : //______________________________________________________________________________
    2393             : void AliMUONSt1GeometryBuilderV2::SetTransformations() 
    2394             : {
    2395             : /// Define the transformations for the station2 chambers.
    2396             : 
    2397           2 :   Double_t zpos1 = - AliMUONConstants::DefaultChamberZ(0); 
    2398           2 :   SetTranslation(0, TGeoTranslation(0., 0., zpos1));
    2399             : 
    2400           1 :   Double_t zpos2 = - AliMUONConstants::DefaultChamberZ(1); 
    2401           2 :   SetTranslation(1, TGeoTranslation(0., 0., zpos2));
    2402           1 : }
    2403             : 
    2404             : //______________________________________________________________________________
    2405             : void AliMUONSt1GeometryBuilderV2::SetSensitiveVolumes()
    2406             : {
    2407             : /// Define the sensitive volumes for station2 chambers.
    2408             : 
    2409           3 :   GetGeometry(0)->SetSensitiveVolume("SA1G");
    2410           2 :   GetGeometry(1)->SetSensitiveVolume("SA2G");
    2411           1 : }
    2412             : 

Generated by: LCOV version 1.11