LCOV - code coverage report
Current view: top level - STRUCT - AliSHILv3.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 461 470 98.1 %
Date: 2016-06-14 17:26:59 Functions: 9 9 100.0 %

          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             : // The small angle absorber SAA (beam shield)
      20             : // Author: A.Morsch
      21             : // andreas.morsch@cern.ch
      22             : //-------------------------------------------------------------------------
      23             : 
      24             : #include <TVirtualMC.h>
      25             : #include <TArrayI.h>
      26             : #include <TGeoVolume.h>
      27             : #include <TGeoTube.h>
      28             : #include <TGeoManager.h>
      29             : #include <TGeoMatrix.h>
      30             : #include <TGeoCompositeShape.h>
      31             : #include <TGeoBBox.h>
      32             : #include <TGeoPgon.h>
      33             : #include <TGeoCone.h>
      34             : 
      35             : #include "AliSHILv3.h"
      36             : #include "AliConst.h"
      37             : #include "AliLog.h"
      38             : 
      39          12 : ClassImp(AliSHILv3)
      40             :  
      41             : //_____________________________________________________________________________
      42          12 : AliSHILv3::AliSHILv3()
      43          60 : {
      44             :   //
      45             :   // Default constructor for muon shield
      46             :   //
      47          24 : }
      48             :  
      49             : //_____________________________________________________________________________
      50             : AliSHILv3::AliSHILv3(const char *name, const char *title)
      51           1 :   : AliSHIL(name,title)
      52           5 : {
      53             :   //
      54             :   // Standard constructor for muon shield
      55             :   //
      56           2 : }
      57             :  
      58             : //_____________________________________________________________________________
      59             : void AliSHILv3::CreateGeometry()
      60             : {
      61             : //
      62             : // The geometry of the small angle absorber "Beam Shield"
      63             : //
      64             :     Float_t dz, dr, z, rmax;
      65             : //
      66             : // The top volume
      67             : //
      68           2 :     TGeoVolume* top = gGeoManager->GetVolume("ALIC");
      69             : //  Rotations
      70           1 :     TGeoRotation* rot000 = new TGeoRotation("rot000",  90.,   0., 90.,  90., 0., 0.);
      71           1 :     TGeoRotation* rot090 = new TGeoRotation("rot090",  90.,  90., 90., 180., 0., 0.);
      72           1 :     TGeoRotation* rot180 = new TGeoRotation("rot180",  90., 180., 90., 270., 0., 0.);
      73           1 :     TGeoRotation* rot270 = new TGeoRotation("rot270",  90., 270., 90.,   0., 0., 0.);
      74             :     Float_t alhc = 0.794;
      75           1 :     TGeoRotation* rotxzlhc   = new TGeoRotation("rotxzlhc", 0.,  -alhc, 0.);
      76           1 :     TGeoRotation* rotlhc     = new TGeoRotation("rotlhc",   0.,   alhc, 0.);
      77             : 
      78             : //
      79             : // Media
      80             : //
      81           1 :     TGeoMedium* kMedNiW     = gGeoManager->GetMedium("SHIL_Ni/W0");
      82           1 :     TGeoMedium* kMedNiWsh   = gGeoManager->GetMedium("SHIL_Ni/W3");
      83             : //
      84           1 :     TGeoMedium* kMedSteel   = gGeoManager->GetMedium("SHIL_ST_C0");
      85           1 :     TGeoMedium* kMedSteelSh = gGeoManager->GetMedium("SHIL_ST_C3");
      86             : //
      87           1 :     TGeoMedium* kMedAir     = gGeoManager->GetMedium("SHIL_AIR_C0");
      88           1 :     TGeoMedium* kMedAirMu   = gGeoManager->GetMedium("SHIL_AIR_MUON");
      89             : //
      90           1 :     TGeoMedium* kMedPb      = gGeoManager->GetMedium("SHIL_PB_C0");
      91           1 :     TGeoMedium* kMedPbSh    = gGeoManager->GetMedium("SHIL_PB_C2");
      92             : //
      93           1 :     TGeoMedium* kMedConcSh  = gGeoManager->GetMedium("SHIL_CC_C2");
      94             : //
      95           1 :     TGeoMedium* kMedCastiron   = gGeoManager->GetMedium("SHIL_CAST_IRON0");
      96           1 :     TGeoMedium* kMedCastironSh = gGeoManager->GetMedium("SHIL_CAST_IRON2");
      97             : //
      98           1 :     const Float_t kDegRad = TMath::Pi() / 180.;
      99           1 :     const Float_t kAngle02   = TMath::Tan( 2.00   * kDegRad);   
     100           1 :     const Float_t kAngle0071 = TMath::Tan( 0.71   * kDegRad);   
     101             : 
     102             : 
     103             : ///////////////////////////////////
     104             : //    FA Tungsten Tail           //
     105             : //    Drawing ALIP2A__0049       //
     106             : //    Drawing ALIP2A__0111       //
     107             : ///////////////////////////////////
     108             : //
     109             : //    The tail as built is shorter than in drawing ALIP2A__0049. 
     110             : //    The CDD data base has to be updated !
     111             : //
     112             : //    Inner radius at the entrance of the flange
     113             :       Float_t rInFaWTail1  = 13.98/2.;
     114             : //    Outer radius at the entrance of the flange
     115             :       Float_t rOuFaWTail1  = 52.00/2.;
     116             : //    Outer radius at the end of the section inside the FA
     117             :       Float_t rOuFaWTail2  = 35.27/2.;
     118             : //    Length of the Flange section inside the FA
     119             :       Float_t dzFaWTail1   =  6.00;
     120             : //    Length of the Flange section ouside the FA
     121             :       Float_t dzFaWTail2   = 12.70;
     122             : //    Inner radius at the end of the section inside the FA 
     123           1 :       Float_t rInFaWTail2  = rInFaWTail1 +  dzFaWTail1 * kAngle0071;
     124             : //    Inner radius at the end of the flange
     125           1 :       Float_t rInFaWTail3  = rInFaWTail2 +  dzFaWTail2 * kAngle0071;
     126             : //    Outer radius at the end of the flange
     127           1 :       Float_t rOuFaWTail3  = rOuFaWTail2 +  dzFaWTail2 * kAngle02;
     128             : //    Outer radius of the recess for station 1
     129             :       Float_t rOuFaWTailR  = 30.8/2.;
     130             : //    Length of the recess
     131             :       Float_t dzFaWTailR   = 36.00;
     132             : //    Inner radiues at the end of the recess      
     133           1 :       Float_t rInFaWTail4  =  rInFaWTail3 +  dzFaWTailR * kAngle0071;
     134             : //    Outer radius at the end of the recess      
     135           1 :       Float_t rOuFaWTail4  =  rOuFaWTail3 +  dzFaWTailR * kAngle02;
     136             : //    Inner radius of the straight section
     137             :       Float_t rInFaWTailS  = 22.30/2.;
     138             : //    Length of the bulge
     139             :       Float_t dzFaWTailB   = 13.0;
     140             : //    Outer radius at the end of the bulge
     141           1 :       Float_t rOuFaWTailB  =  rOuFaWTail4 +  dzFaWTailB * kAngle02;
     142             : //    Outer radius at the end of the tail 
     143             :       Float_t rOuFaWTailE  = 31.6/2.;
     144             : //    Total length of the tail
     145             :       const Float_t dzFaWTail    = 70.7;
     146             : 
     147           1 :       TGeoPcon* shFaWTail = new TGeoPcon(0., 360., 10);
     148             :       z    = 0.;
     149             : //    Flange section inside FA
     150           1 :       shFaWTail->DefineSection(0,  z, rInFaWTail1, rOuFaWTail1);
     151             :       z += dzFaWTail1;
     152           1 :       shFaWTail->DefineSection(1,  z, rInFaWTail2, rOuFaWTail1);      
     153           1 :       shFaWTail->DefineSection(2,  z, rInFaWTail2, rOuFaWTail2);      
     154             : //    Flange section outside FA
     155             :       z +=  dzFaWTail2;
     156           1 :       shFaWTail->DefineSection(3,  z, rInFaWTail3, rOuFaWTail3);      
     157           1 :       shFaWTail->DefineSection(4,  z, rInFaWTail3, rOuFaWTailR);
     158             : //    Recess Station 1
     159             :       z +=  dzFaWTailR;
     160           1 :       shFaWTail->DefineSection(5,  z, rInFaWTail4, rOuFaWTailR); 
     161           1 :       shFaWTail->DefineSection(6,  z, rInFaWTailS, rOuFaWTail4);
     162             : //    Bulge
     163             :       z += dzFaWTailB;
     164           1 :       shFaWTail->DefineSection(7,  z, rInFaWTailS, rOuFaWTailB);
     165           1 :       shFaWTail->DefineSection(8,  z, rInFaWTailS, rOuFaWTailE);
     166             : //    End
     167             :       z =  dzFaWTail;
     168           1 :       shFaWTail->DefineSection(9,  z, rInFaWTailS, rOuFaWTailE);
     169             :       
     170           1 :       TGeoVolume* voFaWTail = new TGeoVolume("YFaWTail", shFaWTail, kMedNiW);
     171             : //
     172             : //    Define an inner region with higher transport cuts
     173           1 :       TGeoPcon* shFaWTailI = new TGeoPcon(0., 360., 4);
     174             :       z  = 0.;
     175             :       dr = 3.5;
     176           1 :       shFaWTailI->DefineSection(0, z, rInFaWTail1,  rInFaWTail1 + dr);
     177             :       z += (dzFaWTail1 + dzFaWTail2 +  dzFaWTailR);
     178           1 :       shFaWTailI->DefineSection(1, z, rInFaWTail4,  rInFaWTail4 + dr);
     179           1 :       shFaWTailI->DefineSection(2, z, rInFaWTailS,  rInFaWTailS + dr);
     180             :       z = dzFaWTail;
     181           1 :       shFaWTailI->DefineSection(3, z, rInFaWTailS,  rInFaWTailS + dr);
     182           1 :       TGeoVolume* voFaWTailI = new TGeoVolume("YFaWTailI", shFaWTailI, kMedNiWsh);
     183           1 :       voFaWTail->AddNode(voFaWTailI, 1, gGeoIdentity);
     184             :       
     185             : ///////////////////////////////////
     186             : //                               //
     187             : // Recess Station 1              //
     188             : // Drawing ALIP2A__0260          //
     189             : ///////////////////////////////////
     190             : 
     191             : ///////////////////////////////////
     192             : //    FA W-Ring 2                //
     193             : //    Drawing ALIP2A__0220       //
     194             : ///////////////////////////////////
     195             :       const Float_t kFaWring2Rinner  = 15.41;
     196             :       const Float_t kFaWring2Router  = 18.40;
     197             :       const Float_t kFaWring2HWidth  =  3.75;
     198             :       const Float_t kFaWring2Cutoffx =  3.35;
     199             :       const Float_t kFaWring2Cutoffy =  3.35;
     200           1 :       TGeoTubeSeg* shFaWring2a  = new TGeoTubeSeg(kFaWring2Rinner, kFaWring2Router, kFaWring2HWidth, 0., 90.);
     201           1 :       shFaWring2a->SetName("shFaWring2a");
     202           1 :       TGeoBBox* shFaWring2b  = new TGeoBBox(kFaWring2Router / 2., kFaWring2Router / 2., kFaWring2HWidth);
     203           1 :       shFaWring2b->SetName("shFaWring2b");
     204             :       TGeoTranslation* trFaWring2b 
     205           1 :           = new TGeoTranslation("trFaWring2b", kFaWring2Router / 2. + kFaWring2Cutoffx, kFaWring2Router / 2. + kFaWring2Cutoffy, 0.);
     206           1 :       trFaWring2b->RegisterYourself();
     207           1 :       TGeoCompositeShape*  shFaWring2 = new TGeoCompositeShape("shFaWring2", "(shFaWring2a)*(shFaWring2b:trFaWring2b)");
     208           1 :       TGeoVolume* voFaWring2    = new TGeoVolume("YFA_WRING2", shFaWring2, kMedNiW);
     209             : 
     210             : ///////////////////////////////////
     211             : //    FA W-Ring 3                //
     212             : //    Drawing ALIP2A__0219       //
     213             : ///////////////////////////////////
     214             :       const Float_t kFaWring3Rinner  = 15.41;
     215             :       const Float_t kFaWring3Router  = 18.40;
     216             :       const Float_t kFaWring3HWidth  =  3.75;
     217             :       const Float_t kFaWring3Cutoffx =  3.35;
     218             :       const Float_t kFaWring3Cutoffy =  3.35;
     219           1 :       TGeoTubeSeg* shFaWring3a  = new TGeoTubeSeg(kFaWring3Rinner, kFaWring3Router, kFaWring3HWidth, 0., 90.);
     220           1 :       shFaWring3a->SetName("shFaWring3a");
     221           1 :       TGeoBBox* shFaWring3b  = new TGeoBBox(kFaWring3Router / 2., kFaWring3Router / 2., kFaWring3HWidth);
     222           1 :       shFaWring3b->SetName("shFaWring3b");
     223             :       TGeoTranslation* trFaWring3b 
     224           1 :           = new TGeoTranslation("trFaWring3b", kFaWring3Router / 2. + kFaWring3Cutoffx, kFaWring3Router / 2. + kFaWring3Cutoffy, 0.);
     225           1 :       trFaWring3b->RegisterYourself();
     226           1 :       TGeoCompositeShape*  shFaWring3 = new TGeoCompositeShape("shFaWring3", "(shFaWring3a)*(shFaWring3b:trFaWring3b)");
     227           1 :       TGeoVolume* voFaWring3    = new TGeoVolume("YFA_WRING3", shFaWring3, kMedNiW);
     228             : 
     229             : ///////////////////////////////////
     230             : //    FA W-Ring 5                //
     231             : //    Drawing ALIP2A__0221       //
     232             : ///////////////////////////////////
     233             :       const Float_t kFaWring5Rinner = 15.41;
     234             :       const Float_t kFaWring5Router = 18.67;
     235             :       const Float_t kFaWring5HWidth =  1.08;
     236           3 :       TGeoVolume* voFaWring5    = new TGeoVolume("YFA_WRING5", new TGeoTube(kFaWring5Rinner, kFaWring5Router, kFaWring5HWidth), kMedNiW);
     237             : 
     238             : //
     239             : // Position the rings in the assembly 
     240             : //      
     241           1 :       TGeoVolumeAssembly* asFaExtraShield = new TGeoVolumeAssembly("YCRE");
     242             : // Distance between rings
     243             :       const Float_t kFaDWrings = 1.92;
     244             : //
     245             :       dz = 0.;
     246             :       
     247             :       dz +=  kFaWring2HWidth;
     248           2 :       asFaExtraShield->AddNode(voFaWring2,    1, new TGeoCombiTrans(0., 0., dz, rot180));
     249           2 :       asFaExtraShield->AddNode(voFaWring2,    2, new TGeoCombiTrans(0., 0., dz, rot000));
     250             :       dz +=   kFaWring2HWidth;
     251             :       dz +=   kFaDWrings;
     252             :       dz +=   kFaWring3HWidth;
     253           2 :       asFaExtraShield->AddNode(voFaWring3,    1, new TGeoCombiTrans(0., 0., dz, rot090));
     254           2 :       asFaExtraShield->AddNode(voFaWring3,    2, new TGeoCombiTrans(0., 0., dz, rot270));
     255             :       dz +=   kFaWring3HWidth;   
     256             :       dz +=   kFaWring5HWidth;   
     257           2 :       asFaExtraShield->AddNode(voFaWring5,    1, new TGeoTranslation(0., 0., dz));
     258             :       dz +=   kFaWring5HWidth;   
     259             :       dz +=   kFaWring3HWidth;   
     260           2 :       asFaExtraShield->AddNode(voFaWring3,    3, new TGeoCombiTrans(0., 0., dz, rot180));
     261           2 :       asFaExtraShield->AddNode(voFaWring3,    4, new TGeoCombiTrans(0., 0., dz, rot000));
     262             :       dz +=   kFaWring3HWidth;   
     263             :       dz +=   kFaDWrings;
     264             :       dz +=   kFaWring2HWidth;
     265           2 :       asFaExtraShield->AddNode(voFaWring2,    3, new TGeoCombiTrans(0., 0., dz, rot090));
     266           2 :       asFaExtraShield->AddNode(voFaWring2,    4, new TGeoCombiTrans(0., 0., dz, rot270));
     267             :       dz +=   kFaWring2HWidth;
     268             : 
     269             :       
     270             : ///////////////////////////////////////
     271             : //                SAA1               //
     272             : ///////////////////////////////////////
     273             : 
     274             : 
     275             : ///////////////////////////////////////
     276             : //          FA/SAA1  W Joint         //
     277             : //          Drawing ALIP2A__0060     //
     278             : ///////////////////////////////////////
     279             : 
     280             : // Length of flange FA side      
     281             :       Float_t dzFaSaa1F1  =  2.8;
     282             : // Inner radius of flange FA side
     283             :       Float_t rInFaSaa1F1 = 32.0/2.;
     284             : // Outer radius of flange FA side
     285             :       Float_t rOuFaSaa1F1 = 39.5/2.;
     286             : // Length of first straight section
     287             :       Float_t dzFaSaa1S1  = 18.5 - dzFaSaa1F1;
     288             : // Inner radius of first straight section
     289             :       Float_t rInFaSaa1S1 = 22.3/2.;
     290             : // Length of 45 deg transition region
     291             :       Float_t  dzFaSaa1T1 =  2.2;
     292             : // Inner radius of second straight section
     293             :       Float_t rInFaSaa1S2 = 17.9/2.;
     294             : // Length of second straight section
     295             :       Float_t dzFaSaa1S2  = 10.1;
     296             : // Length of flange SAA1 side      
     297             : //    Float_t dzFaSaa1F2  =  4.0;
     298             : // Inner radius of flange FA side
     299             :       Float_t rInFaSaa1F2 = 25.2/2.;
     300             : // Length of joint
     301             :       const Float_t dzFaSaa1    = 34.8;
     302             : // Outer Radius at the end of the joint
     303             :       Float_t rOuFaSaa1E  = 41.93/2.;
     304             :       
     305             :       
     306           1 :       TGeoPcon* shFaSaa1 = new TGeoPcon(0., 360., 8);
     307             :       z = 0;
     308             : // Flange FA side      
     309           1 :       shFaSaa1->DefineSection( 0, z, rInFaSaa1F1, rOuFaSaa1F1 - 0.01);
     310             :       z += dzFaSaa1F1;
     311           1 :       shFaSaa1->DefineSection( 1, z, rInFaSaa1F1, 40.0);
     312           1 :       shFaSaa1->DefineSection( 2, z, rInFaSaa1S1, 40.0);
     313             : // First straight section
     314             :       z += dzFaSaa1S1;
     315           1 :       shFaSaa1->DefineSection( 3, z, rInFaSaa1S1, 40.0);
     316             : // 45 deg transition region
     317             :       z += dzFaSaa1T1;
     318           1 :       shFaSaa1->DefineSection( 4, z, rInFaSaa1S2, 40.0);
     319             : // Second straight section
     320             :       z += dzFaSaa1S2;
     321           1 :       shFaSaa1->DefineSection( 5, z, rInFaSaa1S2, 40.0);
     322           1 :       shFaSaa1->DefineSection( 6, z, rInFaSaa1F2, 40.0);
     323             : // Flange SAA1 side
     324             :       z = dzFaSaa1;
     325           1 :       shFaSaa1->DefineSection( 7, z, rInFaSaa1F2, rOuFaSaa1E - 0.01);
     326             : 
     327             : // Outer 2 deg line
     328          14 :       for (Int_t i  = 1; i < 7; i++) {
     329           6 :           Double_t zp   = shFaSaa1->GetZ(i);
     330           6 :           Double_t r1   = shFaSaa1->GetRmin(i);       
     331           6 :           Double_t r2 = 39.5/2. + zp * TMath::Tan(2. * kDegRad) - 0.01;
     332           6 :           shFaSaa1->DefineSection(i, zp, r1, r2);
     333             :       }
     334           1 :       TGeoVolume* voFaSaa1 = new TGeoVolume("YFASAA1", shFaSaa1, kMedNiWsh);
     335             : //
     336             : // Outer region with lower transport cuts
     337           1 :       TGeoCone* shFaSaa1O   = new TGeoCone(dzFaSaa1/2., rOuFaSaa1F1 - 3.5, rOuFaSaa1F1 - 0.01, rOuFaSaa1E - 3.5, rOuFaSaa1E - 0.01);
     338           1 :       TGeoVolume* voFaSaa1O = new TGeoVolume("YFASAA1O", shFaSaa1O, kMedNiW);
     339           2 :       voFaSaa1->AddNode(voFaSaa1O, 1, new TGeoTranslation(0., 0., dzFaSaa1/2.));
     340             :       
     341             : 
     342             : ///////////////////////////////////
     343             : //    SAA1 Steel Envelope        //
     344             : //    Drawing ALIP2A__0039       //
     345             : ///////////////////////////////////
     346             :       
     347             :       Float_t rOut;      // Outer radius
     348             : // Thickness of the steel envelope
     349             :       Float_t dSt = 4.;
     350             : // 4 Section
     351             : // z-positions
     352             :       Float_t zSaa1StEnv[5] = {111.2, 113.7, 229.3, 195.0};
     353             : // Radii
     354             : // 1
     355             :       Float_t rOuSaa1StEnv1 = 40.4/2.;
     356             :       Float_t rInSaa1StEnv1 = rOuSaa1StEnv1 - dSt - 0.05;
     357             : // 2  
     358             :       Float_t rInSaa1StEnv2 = 41.7/2.;
     359           1 :       Float_t rOuSaa1StEnv2 = rInSaa1StEnv2 + dSt / TMath::Cos(2.0 * kDegRad) - 0.05;
     360             : // 3         
     361             :       Float_t rOuSaa1StEnv3 = 57.6/2.; 
     362             :       Float_t rInSaa1StEnv3 = rOuSaa1StEnv3 - dSt + 0.05;
     363             : // 4
     364             :       Float_t rInSaa1StEnv4 = 63.4/2.;
     365           1 :       Float_t rOuSaa1StEnv4 = rInSaa1StEnv4 + dSt / TMath::Cos(1.6 * kDegRad) - 0.05;
     366             : // end         
     367             :       Float_t rInSaa1StEnv5 = 74.28/2.;
     368           1 :       Float_t rOuSaa1StEnv5 = rInSaa1StEnv5 + dSt / TMath::Cos(1.6 * kDegRad) - 0.05;
     369             : // Relative starting position
     370             :       Float_t zSaa1StEnvS = 3.;
     371             :       
     372           1 :       TGeoPcon* shSaa1StEnv  = new TGeoPcon(0., 360., 11);
     373             : // 1st Section
     374             :       z = zSaa1StEnvS;
     375           1 :       shSaa1StEnv->DefineSection( 0, z, rInSaa1StEnv1, rOuSaa1StEnv1);
     376             :       z += (zSaa1StEnv[0] - dSt);
     377           1 :       shSaa1StEnv->DefineSection( 1, z, rInSaa1StEnv1, rOuSaa1StEnv1);
     378             : // 1 - 2
     379           1 :       shSaa1StEnv->DefineSection( 2, z, rInSaa1StEnv1, rOuSaa1StEnv2);
     380             :       z +=  dSt;
     381           1 :       shSaa1StEnv->DefineSection( 3, z, rInSaa1StEnv1, rOuSaa1StEnv2);      
     382             : // 2nd Section
     383           1 :       shSaa1StEnv->DefineSection( 4, z, rInSaa1StEnv2, rOuSaa1StEnv2);      
     384             :       z += zSaa1StEnv[1];
     385           1 :       shSaa1StEnv->DefineSection( 5, z, rInSaa1StEnv3, rOuSaa1StEnv3);      
     386             : // 3rd Section  
     387             :       z += (zSaa1StEnv[2] - dSt);
     388           1 :       shSaa1StEnv->DefineSection( 6, z, rInSaa1StEnv3, rOuSaa1StEnv3);      
     389             : // 3 - 4
     390           1 :       shSaa1StEnv->DefineSection( 7, z, rInSaa1StEnv3, rOuSaa1StEnv4);
     391             :       z += dSt;
     392           1 :       shSaa1StEnv->DefineSection( 8, z, rInSaa1StEnv3, rOuSaa1StEnv4);
     393             : // 4th Section
     394           1 :       shSaa1StEnv->DefineSection( 9, z, rInSaa1StEnv4, rOuSaa1StEnv4);
     395             :       z += zSaa1StEnv[3];
     396           1 :       shSaa1StEnv->DefineSection(10, z, rInSaa1StEnv5, rOuSaa1StEnv5);      
     397           1 :       TGeoVolume* voSaa1StEnv  =  new TGeoVolume("YSAA1_SteelEnvelope", shSaa1StEnv, kMedSteel);
     398             : 
     399             : 
     400             :       
     401             :  
     402             : 
     403             : ///////////////////////////////////
     404             : //    SAA1 W-Pipe                //
     405             : //    Drawing ALIP2A__0059       //
     406             : ///////////////////////////////////
     407             : //
     408             : //    Flange FA side
     409             : //    Length of first section      
     410             :       Float_t dzSaa1WPipeF1  = 0.9;
     411             : //    Outer radius 
     412             :       Float_t rOuSaa1WPipeF1 = 24.5/2.;
     413             : //    Inner Radius
     414             :       Float_t rInSaa1WPipeF1 = 22.0/2.;
     415             : //    Length of second section
     416             :       Float_t dzSaa1WPipeF11 =  2.1;
     417             : //    Inner Radius
     418             :       Float_t rInSaa1WPipeF11 = 18.5/2.;
     419             : //
     420             : //    Central tube 
     421             : //    Length 
     422             :       Float_t dzSaa1WPipeC = 111.2;
     423             : //    Inner Radius at the end
     424             :       Float_t rInSaa1WPipeC = 22.0/2.;
     425             : //    Outer Radius
     426             :       Float_t rOuSaa1WPipeC = 31.9/2.;
     427             : //
     428             : //    Flange SAA2 Side
     429             : //    Length
     430             :       Float_t dzSaa1WPipeF2  = 6.0;
     431             : //    Outer radius 
     432             :       Float_t rOuSaa1WPipeF2 = 41.56/2.;
     433             : 
     434             : //
     435           1 :       TGeoPcon* shSaa1WPipe  = new TGeoPcon(0., 360., 8);
     436             :       z = 0.;
     437             : // Flange FA side first section
     438           1 :       shSaa1WPipe->DefineSection( 0, z, rInSaa1WPipeF1 , rOuSaa1WPipeF1);
     439             :       z += dzSaa1WPipeF1;
     440           1 :       shSaa1WPipe->DefineSection( 1, z, rInSaa1WPipeF1 , rOuSaa1WPipeF1);
     441             : // Flange FA side second section
     442           1 :       shSaa1WPipe->DefineSection( 2, z, rInSaa1WPipeF11, rOuSaa1WPipeF1);
     443             :       z += dzSaa1WPipeF11;
     444           1 :       shSaa1WPipe->DefineSection( 3, z, rInSaa1WPipeF11, rOuSaa1WPipeF1);
     445             : // Central Section
     446           1 :       shSaa1WPipe->DefineSection( 4, z, rInSaa1WPipeF11, rOuSaa1WPipeC);
     447             :       z += dzSaa1WPipeC;
     448           1 :       shSaa1WPipe->DefineSection( 5, z, rInSaa1WPipeC,   rOuSaa1WPipeC);
     449             : // Flange SAA2 side
     450           1 :       shSaa1WPipe->DefineSection( 6, z, rInSaa1WPipeC,   rOuSaa1WPipeF2);
     451             :       z +=  dzSaa1WPipeF2;
     452           1 :       shSaa1WPipe->DefineSection( 7, z, rInSaa1WPipeC,   rOuSaa1WPipeF2);
     453             : 
     454           1 :       TGeoVolume* voSaa1WPipe  =  new TGeoVolume("YSAA1_WPipe", shSaa1WPipe, kMedNiW);
     455             : //
     456             : // Inner region with higher transport cuts
     457           1 :       TGeoTube*   shSaa1WPipeI = new TGeoTube(rInSaa1WPipeC, rOuSaa1WPipeC, dzSaa1WPipeC/2.);
     458           1 :       TGeoVolume* voSaa1WPipeI =  new TGeoVolume("YSAA1_WPipeI", shSaa1WPipeI, kMedNiWsh);
     459           2 :       voSaa1WPipe->AddNode(voSaa1WPipeI, 1, new TGeoTranslation(0., 0., dzSaa1WPipeF1 + dzSaa1WPipeF11 + dzSaa1WPipeC/2));
     460             :       
     461             : 
     462             : ///////////////////////////////////
     463             : //    SAA1 Pb Components         //
     464             : //    Drawing ALIP2A__0078       //
     465             : ///////////////////////////////////
     466             : //
     467             : //    Inner angle
     468           1 :       Float_t tanAlpha = TMath::Tan(1.69    / 2. * kDegRad);
     469           1 :       Float_t tanBeta  = TMath::Tan(3.20    / 2. * kDegRad);    
     470             : // 
     471             : //    1st Section 2deg opening cone
     472             : //    Length 
     473             :       Float_t dzSaa1PbComp1 = 100.23;
     474             : //    Inner radius at entrance
     475             :       Float_t rInSaa1PbComp1 = 22.0/2.; // It's 21 cm diameter in the drawing. Is this a typo ??!!
     476             : //    Outer radius at entrance
     477             :       Float_t rOuSaa1PbComp1 = 42.0/2.;
     478             : //
     479             : //    2nd Section: Straight Section
     480             : //    Length 
     481             :       Float_t dzSaa1PbComp2  = 236.77;
     482             : //    Inner radius
     483           1 :       Float_t rInSaa1PbComp2 = rInSaa1PbComp1 + dzSaa1PbComp1 * tanAlpha;
     484             : //    Outer radius
     485             :       Float_t rOuSaa1PbComp2 = 49.0/2.;
     486             : //
     487             : //    3rd Section: 1.6deg opening cone until bellow
     488             : //    Length 
     489             :       Float_t dzSaa1PbComp3 = 175.6;
     490             : //    Inner radius        
     491           1 :       Float_t  rInSaa1PbComp3 = rInSaa1PbComp2 + dzSaa1PbComp2 * tanAlpha;
     492             : //    Outer radius
     493             :       Float_t rOuSaa1PbComp3 = 62.8/2.;
     494             : //   
     495             : //   4th Section: Bellow region
     496             :       Float_t dzSaa1PbComp4  = 26.4;
     497             : //    Inner radius        
     498             :       Float_t  rInSaa1PbComp4 = 37.1/2.;
     499             :       Float_t  rInSaa1PbCompB = 43.0/2.;
     500             : //    Outer radius
     501           1 :       Float_t rOuSaa1PbComp4  = rOuSaa1PbComp3 +  dzSaa1PbComp3 * tanBeta;
     502             : //
     503             : //   5th Section: Flange SAA2 side
     504             : //   1st detail 
     505             :       Float_t dzSaa1PbCompF1  = 4.;
     506             :       Float_t rOuSaa1PbCompF1 = 74.1/2.;
     507             : //   2nd detail       
     508             :       Float_t dzSaa1PbCompF2  = 3.;
     509             :       Float_t rOuSaa1PbCompF2 = 66.0/2.;
     510             :       Float_t rOuSaa1PbCompF3 = 58.0/2.;
     511             :       
     512             : 
     513           1 :       TGeoPcon* shSaa1PbComp  = new TGeoPcon(0., 360., 11);
     514             :       z = 120.2;
     515             : // 2 deg opening cone
     516           1 :       shSaa1PbComp->DefineSection( 0, z, rInSaa1PbComp1, rOuSaa1PbComp1);
     517             :       z += dzSaa1PbComp1;
     518           1 :       shSaa1PbComp->DefineSection( 1, z, rInSaa1PbComp2, rOuSaa1PbComp2);
     519             : // Straight section
     520             :       z += dzSaa1PbComp2;
     521           1 :       shSaa1PbComp->DefineSection( 2, z, rInSaa1PbComp3, rOuSaa1PbComp2);
     522             : // 1.6 deg opening cone
     523           1 :       shSaa1PbComp->DefineSection( 3, z, rInSaa1PbComp3, rOuSaa1PbComp3);
     524             :       z += dzSaa1PbComp3;
     525           1 :       shSaa1PbComp->DefineSection( 4, z, rInSaa1PbComp4, rOuSaa1PbComp4);
     526             : // Bellow region until outer flange
     527           1 :       shSaa1PbComp->DefineSection( 5, z, rInSaa1PbCompB, rOuSaa1PbComp4);
     528             :       z += (dzSaa1PbComp4 - dzSaa1PbCompF1 -  dzSaa1PbCompF2);
     529           1 :       shSaa1PbComp->DefineSection( 6, z, rInSaa1PbCompB, rOuSaa1PbCompF1);
     530           1 :       shSaa1PbComp->DefineSection( 7, z, rInSaa1PbCompB, rOuSaa1PbCompF2);
     531             : // Flange first step
     532             :       z +=  dzSaa1PbCompF1;
     533           1 :       shSaa1PbComp->DefineSection( 8, z, rInSaa1PbCompB, rOuSaa1PbCompF2);
     534           1 :       shSaa1PbComp->DefineSection( 9, z, rInSaa1PbCompB, rOuSaa1PbCompF3);
     535             : // Flange second step
     536             :       z +=  dzSaa1PbCompF2;
     537           1 :       shSaa1PbComp->DefineSection( 10, z, rInSaa1PbCompB, rOuSaa1PbCompF3);
     538             : 
     539           1 :       TGeoVolume* voSaa1PbComp  =  new TGeoVolume("YSAA1_PbComp", shSaa1PbComp, kMedPb);
     540             : //
     541             : // Inner region with higher transport cuts
     542           1 :       TGeoPcon*   shSaa1PbCompI = MakeShapeFromTemplate(shSaa1PbComp, 0., -3.);
     543           1 :       TGeoVolume* voSaa1PbCompI =  new TGeoVolume("YSAA1_PbCompI", shSaa1PbCompI, kMedPbSh);
     544           1 :       voSaa1PbComp->AddNode(voSaa1PbCompI, 1, gGeoIdentity);
     545             :       
     546             : ///////////////////////////////////
     547             : //    SAA1 W-Cone                //
     548             : //    Drawing ALIP2A__0058       //
     549             : ///////////////////////////////////
     550             :       // Length of the Cone
     551             :       Float_t dzSaa1WCone = 52.9;
     552             :       // Inner and outer radii
     553             :       Float_t rInSaa1WCone1 = 20.4;
     554             :       Float_t rOuSaa1WCone1 = rInSaa1WCone1 + 0.97;
     555             :       Float_t rOuSaa1WCone2 = rInSaa1WCone1 + 2.80;
     556             :       // relative z-position 
     557             :       Float_t zSaa1WCone    = 9.3;
     558             :       
     559             :       
     560           1 :       TGeoPcon* shSaa1WCone  = new TGeoPcon(0., 360., 2);
     561             :       z = zSaa1WCone;
     562           1 :       shSaa1WCone->DefineSection( 0, z, rInSaa1WCone1, rOuSaa1WCone1);
     563             :       z += dzSaa1WCone;
     564           1 :       shSaa1WCone->DefineSection( 1, z, rInSaa1WCone1, rOuSaa1WCone2);
     565           1 :       TGeoVolume* voSaa1WCone  =  new TGeoVolume("YSAA1_WCone", shSaa1WCone, kMedNiW);
     566             : 
     567             : ///////////////////////////////////
     568             : //    SAA1 Steel-Ring            //
     569             : //    Drawing ALIP2A__0040       //
     570             : ///////////////////////////////////
     571             : //
     572             : //    Length of the ring
     573             :       Float_t dzSaa1StRing = 4.;
     574             : //    Inner and outer radius
     575             :       Float_t rInSaa1String = 33.0;
     576             :       Float_t rOuSaa1String = 41.1;      
     577             : //    Relative z-position
     578             :       Float_t zSaa1StRing   = 652.2;
     579           1 :       TGeoPcon* shSaa1StRing  = new TGeoPcon(0., 360., 2);
     580             :       z = zSaa1StRing;
     581           1 :       shSaa1StRing->DefineSection( 0, z, rInSaa1String, rOuSaa1String);
     582             :       z += dzSaa1StRing;
     583           1 :       shSaa1StRing->DefineSection( 1, z, rInSaa1String, rOuSaa1String);
     584           1 :       TGeoVolume* voSaa1StRing  =  new TGeoVolume("YSAA1_StRing", shSaa1StRing, kMedSteel);
     585             : 
     586             : ///////////////////////////////////
     587             : //    SAA1 Inner Tube            //
     588             : //    Drawing ALIP2A__0082       //
     589             : ///////////////////////////////////
     590             : //
     591             : // Length of saa2:               659.2 cm
     592             : // Length of inner tube:         631.9 cm
     593             : // Lenth of bellow cavern:        27.3 cm    
     594             : // Radius at entrance 18.5/2,  d = 0.3
     595             : // Radius at exit     37.1/2,  d = 0.3 
     596             : //
     597             :       Float_t dzSaa1InnerTube     = 631.9/2.;  // Half length of the tube  
     598             :       Float_t rInSaa1InnerTube    =  18.2/2.;  // Radius at entrance
     599             :       Float_t rOuSaa1InnerTube    =  36.8/2.;  // Radius at exit
     600             :       Float_t dSaa1InnerTube      =   0.2   ;  // Thickness      
     601           2 :       TGeoVolume* voSaa1InnerTube = new TGeoVolume("YSAA1_InnerTube", 
     602           3 :                                                    new TGeoCone(dzSaa1InnerTube, 
     603             :                                                                 rInSaa1InnerTube - dSaa1InnerTube, rInSaa1InnerTube,
     604             :                                                                 rOuSaa1InnerTube - dSaa1InnerTube, rOuSaa1InnerTube),
     605             :                                                    kMedSteelSh);
     606             : 
     607             : ///////////////////////////////////
     608             : //    SAA1 Outer Shape           //
     609             : //    Drawing ALIP2A__0107       //
     610             : ///////////////////////////////////
     611             :       // Total length 
     612             :       const Float_t dzSaa1 = 659.2;
     613             :       //
     614           1 :       TGeoPcon* shSaa1M  = new TGeoPcon(0., 360., 20);
     615             :       Float_t kSec = 0.2; // security distance to avoid trivial extrusions
     616             :       Float_t rmin = rInSaa1InnerTube - dSaa1InnerTube - kSec;
     617             :       rmax = rOuSaa1InnerTube - dSaa1InnerTube - kSec;
     618             :       z = 0.;
     619           1 :       shSaa1M->DefineSection( 0, z, rmin, rOuSaa1WPipeF1);
     620             :       z += dzSaa1WPipeF1;
     621           1 :       shSaa1M->DefineSection( 1, z, rmin, rOuSaa1WPipeF1);
     622           1 :       shSaa1M->DefineSection( 2, z, 0.,   rOuSaa1WPipeF1);
     623             :       z += dzSaa1WPipeF11;
     624           1 :       shSaa1M->DefineSection( 3, z, 0.,   rOuSaa1WPipeF1);
     625           1 :       shSaa1M->DefineSection( 4, z, 0.,   rOuSaa1StEnv1);
     626             :       z = zSaa1WCone;
     627           1 :       shSaa1M->DefineSection( 5, z, 0.,   rOuSaa1StEnv1);
     628           1 :       shSaa1M->DefineSection( 6, z, 0.,   rOuSaa1WCone1);
     629             :       z += dzSaa1WCone;
     630           1 :       shSaa1M->DefineSection( 7, z, 0.,   rOuSaa1WCone2);
     631           1 :       shSaa1M->DefineSection( 8, z, 0.,   rOuSaa1StEnv1);
     632             :       z =  zSaa1StEnv[0] - dSt + zSaa1StEnvS;
     633           1 :       shSaa1M->DefineSection( 9, z, 0.,   rOuSaa1StEnv1);
     634           1 :       shSaa1M->DefineSection(10, z, 0.,   rOuSaa1StEnv2);
     635             :       z +=  (zSaa1StEnv[1] + dSt);
     636           1 :       shSaa1M->DefineSection(11, z, 0.,   rOuSaa1StEnv3);
     637             :       z +=  (zSaa1StEnv[2] - dSt);
     638           1 :       shSaa1M->DefineSection(12, z, 0.,   rOuSaa1StEnv3);
     639           1 :       shSaa1M->DefineSection(13, z, 0.,   rOuSaa1StEnv4);
     640             : 
     641             :       z += (zSaa1StEnv[3] - dSt +  dzSaa1PbCompF1 + dzSaa1PbCompF2 - dzSaa1PbComp4);
     642           1 :       Float_t rmaxSaa1 = shSaa1M->GetRmax(13) + (z - shSaa1M->GetZ(13)) * TMath::Tan(1.6 * kDegRad);
     643             : 
     644           1 :       shSaa1M->DefineSection(14, z, 0.,    rmaxSaa1);
     645           1 :       shSaa1M->DefineSection(15, z, rmax,  rmaxSaa1);
     646             :       z = zSaa1StRing;     
     647           1 :       shSaa1M->DefineSection(16, z, rmax + 0.4, rOuSaa1String);
     648             :       z += dzSaa1PbCompF1;
     649           1 :       shSaa1M->DefineSection(17, z, rmax + 0.4, rOuSaa1String);
     650           1 :       shSaa1M->DefineSection(18, z, rmax + 0.4, rOuSaa1PbCompF3);
     651             :       z += dzSaa1PbCompF2;
     652           1 :       shSaa1M->DefineSection(19, z, rmax + 0.4, rOuSaa1PbCompF3);
     653             : 
     654             : //
     655             : //    Inner 1.69deg line
     656          28 :       for (Int_t i  = 2; i < 15; i++) {
     657          13 :           Double_t zp = shSaa1M->GetZ(i);
     658          13 :           Double_t r2 = shSaa1M->GetRmax(i);  
     659          13 :           Double_t r1 = rmin + (zp - 0.9) * TMath::Tan(1.686 / 2. * kDegRad) - kSec;
     660          13 :           shSaa1M->DefineSection(i, zp, r1, r2);
     661             :       }
     662             : 
     663           1 :       TGeoVolume* voSaa1M  =  new TGeoVolume("YSAA1M", shSaa1M, kMedAir);
     664           1 :       voSaa1M->SetVisibility(0);
     665             :       
     666             : 
     667             : ///////////////////////////////////
     668             : //                               //
     669             : // Recess Station 2              //
     670             : // Drawing ALIP2A__0260          //
     671             : ///////////////////////////////////
     672             : ///////////////////////////////////
     673             : //    SAA1 W-Ring 1              //
     674             : //    Drawing ALIP2A__0217       //
     675             : ///////////////////////////////////
     676             :       Float_t saa1Wring1Width  =  5.85;
     677           1 :       TGeoPcon* shSaa1Wring1    = new TGeoPcon(0., 360., 2);
     678           1 :       shSaa1Wring1->DefineSection(0, 0.00           , 20.31, 23.175);
     679           1 :       shSaa1Wring1->DefineSection(1, saa1Wring1Width, 20.31, 23.400);
     680           1 :       TGeoVolume* voSaa1Wring1  =  new TGeoVolume("YSAA1_WRING1", shSaa1Wring1, kMedNiW);
     681             : 
     682             : ///////////////////////////////////
     683             : //    SAA1 W-Ring 2              //
     684             : //    Drawing ALIP2A__0055       //
     685             : ///////////////////////////////////
     686             :       Float_t saa1Wring2Rinner  = 20.31;
     687             :       Float_t saa1Wring2Router  = 23.40;
     688             :       Float_t saa1Wring2HWidth  =  3.75;
     689             :       Float_t saa1Wring2Cutoffx =  4.9;
     690             :       Float_t saa1Wring2Cutoffy =  4.9;
     691           1 :       TGeoTubeSeg* shSaa1Wring2a  = new TGeoTubeSeg(saa1Wring2Rinner, saa1Wring2Router, saa1Wring2HWidth, 0., 90.);
     692           1 :       shSaa1Wring2a->SetName("shSaa1Wring2a");
     693           1 :       TGeoBBox* shSaa1Wring2b  = new TGeoBBox(saa1Wring2Router / 2., saa1Wring2Router / 2., saa1Wring2HWidth);
     694           1 :       shSaa1Wring2b->SetName("shSaa1Wring2b");
     695             :       TGeoTranslation* trSaa1Wring2b 
     696           1 :           = new TGeoTranslation("trSaa1Wring2b", saa1Wring2Router / 2. + saa1Wring2Cutoffx, saa1Wring2Router / 2. + saa1Wring2Cutoffy, 0.);
     697           1 :       trSaa1Wring2b->RegisterYourself();
     698           1 :       TGeoCompositeShape*  shSaa1Wring2 = new TGeoCompositeShape("shSaa1Wring2", "(shSaa1Wring2a)*(shSaa1Wring2b:trSaa1Wring2b)");
     699           1 :       TGeoVolume* voSaa1Wring2 = new TGeoVolume("YSAA1_WRING2", shSaa1Wring2, kMedNiW);
     700             : 
     701             : ///////////////////////////////////
     702             : //    SAA1 W-Ring 3              //
     703             : //    Drawing ALIP2A__0216       //
     704             : ///////////////////////////////////
     705             : 
     706             :       Float_t saa1Wring3Rinner  = 20.31;
     707             :       Float_t saa1Wring3Router  = 23.40;
     708             :       Float_t saa1Wring3HWidth  =  3.75;
     709             :       Float_t saa1Wring3Cutoffx =  4.50;
     710             :       Float_t saa1Wring3Cutoffy =  4.50;
     711           1 :       TGeoTubeSeg* shSaa1Wring3a  = new TGeoTubeSeg(saa1Wring3Rinner, saa1Wring3Router, saa1Wring3HWidth, 0., 90.);
     712           1 :       shSaa1Wring3a->SetName("shSaa1Wring3a");
     713           1 :       TGeoBBox* shSaa1Wring3b  = new TGeoBBox(saa1Wring3Router / 2., saa1Wring3Router / 2., saa1Wring3HWidth);
     714           1 :       shSaa1Wring3b->SetName("shSaa1Wring3b");
     715             :       TGeoTranslation* trSaa1Wring3b 
     716           1 :           = new TGeoTranslation("trSaa1Wring3b", saa1Wring3Router / 2. + saa1Wring3Cutoffx, saa1Wring3Router / 2. + saa1Wring3Cutoffy, 0.);
     717           1 :       trSaa1Wring3b->RegisterYourself();
     718           1 :       TGeoCompositeShape*  shSaa1Wring3 = new TGeoCompositeShape("shSaa1Wring3", "(shSaa1Wring3a)*(shSaa1Wring3b:trSaa1Wring3b)");
     719           1 :       TGeoVolume* voSaa1Wring3 = new TGeoVolume("YSAA1_WRING3", shSaa1Wring3, kMedNiW);
     720             : 
     721             : ///////////////////////////////////
     722             : //    SAA1 W-Ring 4              //
     723             : //    Drawing ALIP2A__0215       //
     724             : ///////////////////////////////////
     725             :       Float_t saa1Wring4Width  =  5.85;
     726           1 :       TGeoPcon* shSaa1Wring4  = new TGeoPcon(0., 360., 5);
     727           1 :       shSaa1Wring4->DefineSection(0, 0.00, 20.31, 23.40);
     728           1 :       shSaa1Wring4->DefineSection(1, 1.00, 20.31, 23.40);
     729           1 :       shSaa1Wring4->DefineSection(2, 1.00, 20.31, 24.50);      
     730           1 :       shSaa1Wring4->DefineSection(3, 4.85, 20.31, 24.80);
     731           1 :       shSaa1Wring4->DefineSection(4, 5.85, 24.10, 24.80);
     732           1 :       TGeoVolume* voSaa1Wring4  =  new TGeoVolume("YSAA1_WRING4", shSaa1Wring4, kMedNiW);
     733             : 
     734             : ///////////////////////////////////
     735             : //    SAA1 W-Ring 5              //
     736             : //    Drawing ALIP2A__0218       //
     737             : ///////////////////////////////////
     738             :       Float_t saa1Wring5Rinner = 20.31;
     739             :       Float_t saa1Wring5Router = 23.40;
     740             :       Float_t saa1Wring5HWidth =  0.85;
     741           2 :       TGeoVolume* voSaa1Wring5    = new TGeoVolume("YSAA1_WRING5", 
     742           3 :                                                    new TGeoTube(saa1Wring5Rinner, saa1Wring5Router, saa1Wring5HWidth), kMedNiW);
     743             : //
     744             : // Position the rings in the assembly 
     745             : //      
     746           1 :       TGeoVolumeAssembly* asSaa1ExtraShield = new TGeoVolumeAssembly("YSAA1ExtraShield");
     747             : // Distance between rings
     748             :       Float_t saa1DWrings = 2.3;
     749             : //
     750           1 :       dz = - (saa1Wring1Width + 6. * saa1Wring2HWidth + 2. * saa1Wring3HWidth + saa1Wring4Width + 2. * saa1Wring5HWidth + 2. * saa1DWrings) / 2.;
     751           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring1,    1, new TGeoTranslation(0., 0., dz));
     752           1 :       dz +=   saa1Wring1Width;
     753           1 :       dz +=   saa1Wring2HWidth;   
     754           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring2,    1, new TGeoCombiTrans(0., 0., dz, rot000));
     755           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring2,    2, new TGeoCombiTrans(0., 0., dz, rot180));
     756           1 :       dz +=   saa1Wring2HWidth;   
     757           1 :       dz +=   saa1DWrings;
     758           1 :       dz +=   saa1Wring2HWidth;   
     759           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring2,    3, new TGeoCombiTrans(0., 0., dz, rot090));
     760           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring2,    4, new TGeoCombiTrans(0., 0., dz, rot270));
     761           1 :       dz +=   saa1Wring2HWidth;   
     762           1 :       dz +=   saa1Wring5HWidth;   
     763           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring5,    1, new TGeoTranslation(0., 0., dz));
     764           1 :       dz +=   saa1Wring5HWidth;   
     765           1 :       dz +=   saa1Wring2HWidth;   
     766           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring2,    5, new TGeoCombiTrans(0., 0., dz, rot000));
     767           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring2,    6, new TGeoCombiTrans(0., 0., dz, rot180));
     768           1 :       dz +=   saa1Wring2HWidth;   
     769           1 :       dz +=   saa1DWrings;
     770           1 :       dz +=   saa1Wring3HWidth;   
     771           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring3,    1, new TGeoCombiTrans(0., 0., dz, rot090));
     772           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring3,    2, new TGeoCombiTrans(0., 0., dz, rot270));
     773           1 :       dz +=   saa1Wring3HWidth;   
     774           2 :       asSaa1ExtraShield->AddNode(voSaa1Wring4,    1, new TGeoTranslation(0., 0., dz));
     775             :       dz +=   saa1Wring4Width;   
     776             :       const Float_t saa1ExtraShieldL = 48;
     777             : //
     778             : // Assemble SAA1
     779           1 :       voSaa1M->AddNode(voSaa1StEnv,     1, gGeoIdentity);
     780           1 :       voSaa1M->AddNode(voSaa1WPipe,     1, gGeoIdentity);
     781           1 :       voSaa1M->AddNode(voSaa1PbComp,    1, gGeoIdentity);
     782           1 :       voSaa1M->AddNode(voSaa1WCone,     1, gGeoIdentity);
     783           1 :       voSaa1M->AddNode(voSaa1StRing,    1, gGeoIdentity);
     784           2 :       voSaa1M->AddNode(voSaa1InnerTube, 1, new TGeoTranslation(0., 0., dzSaa1InnerTube + 0.9));                    
     785           1 :       TGeoVolumeAssembly* voSaa1 = new TGeoVolumeAssembly("YSAA1");
     786           1 :       voSaa1->AddNode(voSaa1M, 1, gGeoIdentity);
     787             :       
     788             : ///////////////////////////////////////
     789             : //          SAA1/SAA2  Pb Joint      //
     790             : //          Drawing ALIP2A__0081     //
     791             : ///////////////////////////////////////
     792             : //
     793             : // Outer radius
     794             :       Float_t rOuSaa1Saa2      = 70.0/2.;
     795             : // Flange SAA1 side
     796             :       Float_t dzSaa1Saa2F1     =  3.;
     797             :       Float_t rInSaa1Saa2F1    = 58.5/2.;
     798             : // 1st Central Section
     799             :       Float_t dzSaa1Saa2C1     = 19.3;
     800             :       Float_t rInSaa1Saa2C1    = 42.8/2.;
     801             : // Transition Region
     802             :       Float_t dzSaa1Saa2T      =  3.3;
     803             : // 1st Central Section
     804             :       Float_t dzSaa1Saa2C2     =  6.2;
     805             :       Float_t rInSaa1Saa2C2    = 36.2/2.;
     806             : // Flange SAA2 side
     807             :       Float_t dzSaa1Saa2F2     =  3.1;
     808             :       Float_t rInSaa1Saa2F2    = 54.1/2.;
     809             : // Total length
     810             :       const Float_t dzSaa1Saa2       = 34.9;
     811             :       
     812             :       
     813           1 :       TGeoPcon* shSaa1Saa2Pb = new TGeoPcon(0., 360., 8);
     814             :       z = 0.;
     815             : // Flange SAA1 side
     816           1 :       shSaa1Saa2Pb->DefineSection( 0,  z, rInSaa1Saa2F1, rOuSaa1Saa2);
     817             :       z += dzSaa1Saa2F1;
     818           1 :       shSaa1Saa2Pb->DefineSection( 1,  z, rInSaa1Saa2F1, rOuSaa1Saa2);
     819           1 :       shSaa1Saa2Pb->DefineSection( 2,  z, rInSaa1Saa2C1, rOuSaa1Saa2);
     820             : // Central region 1
     821             :       z +=  dzSaa1Saa2C1;
     822           1 :       shSaa1Saa2Pb->DefineSection( 3,  z, rInSaa1Saa2C1, rOuSaa1Saa2);
     823             : // 45 deg transition
     824             :       z += dzSaa1Saa2T;
     825           1 :       shSaa1Saa2Pb->DefineSection( 4, z, rInSaa1Saa2C2, rOuSaa1Saa2);
     826             :       z += dzSaa1Saa2C2;
     827           1 :       shSaa1Saa2Pb->DefineSection( 5, z, rInSaa1Saa2C2, rOuSaa1Saa2);
     828           1 :       shSaa1Saa2Pb->DefineSection( 6, z, rInSaa1Saa2F2, rOuSaa1Saa2);
     829             :       z += dzSaa1Saa2F2;
     830           1 :       shSaa1Saa2Pb->DefineSection( 7, z, rInSaa1Saa2F2, rOuSaa1Saa2);
     831           1 :       TGeoVolume* voSaa1Saa2Pb = new TGeoVolume("YSAA1SAA2Pb", shSaa1Saa2Pb, kMedPb);
     832             : //
     833             : //    Mother volume and outer steel envelope
     834             :       Float_t rOuSaa1Saa2Steel = 36.9;
     835             :       
     836           1 :       TGeoPcon* shSaa1Saa2 = MakeShapeFromTemplate(shSaa1Saa2Pb, 0., rOuSaa1Saa2Steel-rOuSaa1Saa2);
     837           1 :       TGeoVolume* voSaa1Saa2 = new TGeoVolume("YSAA1SAA2", shSaa1Saa2, kMedSteel);
     838           1 :       voSaa1Saa2->AddNode(voSaa1Saa2Pb, 1, gGeoIdentity);
     839             : //
     840             : //    Inner region with higher transport cuts
     841             : //
     842           1 :       TGeoPcon*   shSaa1Saa2I = MakeShapeFromTemplate(shSaa1Saa2Pb, 0., -3.);
     843           1 :       TGeoVolume* voSaa1Saa2I = new TGeoVolume("YSAA1_SAA2I", shSaa1Saa2I, kMedPbSh);
     844           1 :       voSaa1Saa2Pb->AddNode(voSaa1Saa2I, 1, gGeoIdentity);
     845             :       
     846             : 
     847             : 
     848             : ///////////////////////////////////////
     849             : //                SAA2               //
     850             : ///////////////////////////////////////
     851             : 
     852             :       
     853             : ///////////////////////////////////
     854             : //    SAA2 Steel Envelope        //
     855             : //    Drawing ALIP2A__0041       //
     856             : ///////////////////////////////////
     857             :       dSt = 4.;  // Thickness of steel envelope
     858             :       // Length of the first section
     859             :       Float_t dzSaa2StEnv1  = 163.15;
     860             :       Float_t rInSaa2StEnv1 = 65.8/2.;
     861             :       // Length of the second section
     862             :       Float_t dzSaa2StEnv2  = 340.35 - 4.;
     863             :       Float_t rInSaa2StEnv2 = 87.2/2.;
     864             :       // Rel. starting position 
     865             :       Float_t zSaa2StEnv = 3.;
     866             :       
     867           1 :       TGeoPcon* shSaa2StEnv  = new TGeoPcon(0., 360., 6);
     868             :       // First Section
     869             :       z = zSaa2StEnv;
     870           1 :       shSaa2StEnv->DefineSection( 0, z, rInSaa2StEnv1, rInSaa2StEnv1 + dSt);
     871             :       z += dzSaa2StEnv1;
     872           1 :       shSaa2StEnv->DefineSection( 1, z, rInSaa2StEnv1, rInSaa2StEnv1 + dSt);
     873             :       // Transition region
     874           1 :       shSaa2StEnv->DefineSection( 2, z, rInSaa2StEnv1, rInSaa2StEnv2 + dSt);           
     875             :       z += dSt;
     876           1 :       shSaa2StEnv->DefineSection( 3, z, rInSaa2StEnv1, rInSaa2StEnv2 + dSt);          
     877             :       // Second section
     878           1 :       shSaa2StEnv->DefineSection( 4, z, rInSaa2StEnv2, rInSaa2StEnv2 + dSt);           
     879             :       z += dzSaa2StEnv2;
     880           1 :       shSaa2StEnv->DefineSection( 5, z, rInSaa2StEnv2, rInSaa2StEnv2 + dSt);           
     881             : 
     882           1 :       TGeoVolume* voSaa2StEnv  =  new TGeoVolume("YSAA2_SteelEnvelope", shSaa2StEnv, kMedSteel);
     883             : 
     884             : 
     885             : ///////////////////////////////////
     886             : //    SAA2 Pb Ring               //
     887             : //    Drawing ALIP2A__0080       //
     888             : //    Drawing ALIP2A__0111       //
     889             : ///////////////////////////////////
     890             : //
     891             : // Rel. position in z
     892             :       Float_t zSaa2PbRing    = 35.25;  
     893             : // Length
     894             :       Float_t dzSaa2PbRing   = 65.90;  
     895             : // Inner radius
     896             :       Float_t rInSaa2PbRing  = 37.00;
     897             : // Outer radius at front
     898             :       Float_t rOuSaa2PbRingF = 42.74;
     899             : // Outer Rradius at rear
     900             :       Float_t rOuSaa2PbRingR = 44.58;      
     901             :       
     902           1 :       TGeoPcon* shSaa2PbRing  = new TGeoPcon(0., 360., 2);
     903             :       z = zSaa2PbRing;
     904           1 :       shSaa2PbRing->DefineSection(0, z, rInSaa2PbRing, rOuSaa2PbRingF);
     905             :       z += dzSaa2PbRing;
     906           1 :       shSaa2PbRing->DefineSection(1, z, rInSaa2PbRing, rOuSaa2PbRingR);
     907             : 
     908           1 :       TGeoVolume* voSaa2PbRing  =  new TGeoVolume("YSAA2_PbRing", shSaa2PbRing, kMedPb);
     909             : 
     910             : 
     911             : ///////////////////////////////////
     912             : //    SAA2 Pb Components         //
     913             : //    Drawing ALIP2A__0079       //
     914             : ///////////////////////////////////
     915           1 :       tanAlpha = TMath::Tan(1.89 / 2. * kDegRad);
     916           1 :       TGeoPcon* shSaa2PbComp  = new TGeoPcon(0., 360., 16);
     917             :       // Total length 
     918             :       const Float_t dzSaa2PbComp    = 512.;
     919             :       // Length of 1st bellow recess
     920             :       Float_t dzSaa2PbCompB1  =  24.;
     921             :       // Length of 2nd bellow recess
     922             :       Float_t dzSaa2PbCompB2   = 27.;
     923             :       // Flange on the SAA1 side Detail A
     924             :       // 1st Step
     925             :       Float_t dzSaa2PbCompA1  =   1.5;
     926             :       Float_t rInSaa2PbCompA1 =  43.0/2.;
     927             :       Float_t rOuSaa2PbCompA1 =  53.0/2.;
     928             :       // 2nd Step
     929             :       Float_t dzSaa2PbCompA2  =   1.5;
     930             :       Float_t rInSaa2PbCompA2 =  36.8/2.;
     931             :       Float_t rOuSaa2PbCompA2 =  rOuSaa2PbCompA1;
     932             :       // Straight section
     933             :       Float_t dzSaa2PbCompA3  =  21.0;
     934             :       Float_t rInSaa2PbCompA3 =  rInSaa2PbCompA2;
     935             :       Float_t rOuSaa2PbCompA3 =  65.2/2.;
     936             :       //
     937             :       // 1st Section (outer straight, inner 1.89/2. deg opening cone)
     938             :       // Length
     939             :       Float_t dzSaa2PbComp1   = 146.15;
     940             :       // Inner radius at the end 
     941           1 :       Float_t rInSaa2PbComp1  = rInSaa2PbCompA3 + dzSaa2PbComp1 * tanAlpha;
     942             :       // Outer radius
     943             :       Float_t rOuSaa2PbComp1  = rOuSaa2PbCompA3;
     944             :       //
     945             :       // 2nd Section (outer straight, inner 1.89/2. deg opening cone)
     946             :       // Length 
     947             :       Float_t dzSaa2PbComp2   = (dzSaa2PbComp - dzSaa2PbComp1 - dzSaa2PbCompB1 - dzSaa2PbCompB2);
     948             :       // Inner radius at the end 
     949           1 :       Float_t rInSaa2PbComp2  = rInSaa2PbComp1 + dzSaa2PbComp2 * tanAlpha;
     950             :       // Outer radius
     951             :       Float_t rOuSaa2PbComp2  = 86.6/2.;
     952             :       //
     953             :       // Flange on the SAA3 side (Detail E)
     954             :       //
     955             :       // Straight Section
     956             :       // Length  dzSaa2PbCompB2 - 8.8 = 27 - 8.8 = 18.2
     957             :       Float_t dzSaa2PbCompE1  =  18.2;
     958             :       Float_t rInSaa2PbCompE1 =  52.0/2.;
     959             :       Float_t rOuSaa2PbCompE1 =  86.6/2.;
     960             :       // 45 deg transition
     961             :       Float_t dzSaa2PbCompE2  =   2.7;
     962             :       // 1st Step
     963             :       Float_t dzSaa2PbCompE3  =   0.6;
     964             :       Float_t rInSaa2PbCompE3 =  52.0/2.+ dzSaa2PbCompE2;
     965             :       Float_t rOuSaa2PbCompE3 =  83.0/2.;
     966             :       // 2nd Step
     967             :       Float_t dzSaa2PbCompE4  =   4.0;
     968             :       Float_t rOuSaa2PbCompE4 =  61.6/2.;
     969             :       // end
     970             :       Float_t dzSaa2PbCompE5  =   1.5;
     971             : 
     972             : 
     973             :       //
     974             :       // Flange on SAA1 side (Detail A)
     975             :       z = 0.;
     976             :       // 1st Step
     977           1 :       shSaa2PbComp->DefineSection(  0,  z, rInSaa2PbCompA1, rOuSaa2PbCompA1);
     978             :       z += dzSaa2PbCompA1;
     979           1 :       shSaa2PbComp->DefineSection(  1,  z, rInSaa2PbCompA1, rOuSaa2PbCompA1);
     980           1 :       shSaa2PbComp->DefineSection(  2,  z, rInSaa2PbCompA2, rOuSaa2PbCompA2);
     981             :       // 2nd Step
     982             :       z += dzSaa2PbCompA2;
     983           1 :       shSaa2PbComp->DefineSection(  3,  z, rInSaa2PbCompA2, rOuSaa2PbCompA2);
     984           1 :       shSaa2PbComp->DefineSection(  4,  z, rInSaa2PbCompA3, rOuSaa2PbCompA3);
     985             :       // straight section
     986             :       z += dzSaa2PbCompA3;
     987           1 :       shSaa2PbComp->DefineSection(  5,  z, rInSaa2PbCompA3, rOuSaa2PbCompA3);
     988             :       //
     989             :       // Section 1
     990             :       z += dzSaa2PbComp1;
     991           1 :       shSaa2PbComp->DefineSection(  6,  z, rInSaa2PbComp1, rOuSaa2PbComp1);
     992           1 :       shSaa2PbComp->DefineSection(  7,  z, rInSaa2PbComp1, rOuSaa2PbComp2);
     993             :       //
     994             :       // Section 2
     995             :       z += dzSaa2PbComp2;
     996           1 :       shSaa2PbComp->DefineSection(  8,  z, rInSaa2PbComp2, rOuSaa2PbComp2);
     997             :       //
     998             :       // Flange SAA3 side (Detail E)
     999             :       z += dzSaa2PbCompE1;
    1000           1 :       shSaa2PbComp->DefineSection(  9,  z, rInSaa2PbCompE1, rOuSaa2PbCompE1);
    1001             :       // 45 deg transition
    1002             :       z += dzSaa2PbCompE2;
    1003           1 :       shSaa2PbComp->DefineSection( 10,  z, rInSaa2PbCompE3, rOuSaa2PbCompE1);
    1004             :       // 1st step
    1005             :       z += dzSaa2PbCompE3;
    1006           1 :       shSaa2PbComp->DefineSection( 11,  z, rInSaa2PbCompE3, rOuSaa2PbCompE1);
    1007           1 :       shSaa2PbComp->DefineSection( 12,  z, rInSaa2PbCompE3, rOuSaa2PbCompE3);
    1008             :       // 2nd step
    1009             :       z += dzSaa2PbCompE4;
    1010           1 :       shSaa2PbComp->DefineSection( 13,  z, rInSaa2PbCompE3, rOuSaa2PbCompE3);
    1011           1 :       shSaa2PbComp->DefineSection( 14,  z, rInSaa2PbCompE3, rOuSaa2PbCompE4);
    1012             :       // end
    1013             :       z += dzSaa2PbCompE5;
    1014           1 :       shSaa2PbComp->DefineSection( 15,  z, rInSaa2PbCompE3, rOuSaa2PbCompE4);
    1015             : 
    1016           1 :       TGeoVolume* voSaa2PbComp  =  new TGeoVolume("YSAA2_PbComp", shSaa2PbComp, kMedPbSh);
    1017             : 
    1018             : 
    1019             : ///////////////////////////////////
    1020             : //    SAA2 Inner Tube            //
    1021             : //    Drawing ALIP2A__0083       //
    1022             : ///////////////////////////////////
    1023             : //
    1024             : //
    1025             : //
    1026             : // Length of saa2:               512.0 cm
    1027             : // Length of inner tube:         501.7 cm 
    1028             : // Lenth of bellow recess:        10.3 cm   ( 1.5 + 8.8) 
    1029             : // Radius at entrance 36.8/2,  d = 0.1
    1030             : // Radius at exit     52.0/2,  d = 0.1 
    1031             : //
    1032             :       const Float_t kSaa2InnerTubeL     =  501.7;    // Length of the tube  
    1033             :       const Float_t kSaa2InnerTubeRmin  =  36.6/2.;  // Radius at entrance
    1034             :       const Float_t kSaa2InnerTubeRmax  =  51.8/2.;  // Radius at exit
    1035             :       const Float_t kSaa2InnerTubeD     =   0.2   ;  // Thickness     
    1036           1 :       TGeoPcon*   shSaa2InnerTube = new TGeoPcon(0., 360., 4);
    1037             :       z = 0.;
    1038           1 :       shSaa2InnerTube->DefineSection( 0, z, kSaa2InnerTubeRmin - kSaa2InnerTubeD, kSaa2InnerTubeRmin);
    1039             :       z += dzSaa2PbCompA2 + dzSaa2PbCompA3;
    1040           1 :       shSaa2InnerTube->DefineSection( 1, z, kSaa2InnerTubeRmin - kSaa2InnerTubeD, kSaa2InnerTubeRmin);
    1041             :       z =  kSaa2InnerTubeL - dzSaa2PbCompE1;
    1042           1 :       shSaa2InnerTube->DefineSection( 2, z, kSaa2InnerTubeRmax - kSaa2InnerTubeD, kSaa2InnerTubeRmax);
    1043             :       z =  kSaa2InnerTubeL;
    1044           1 :       shSaa2InnerTube->DefineSection( 3, z, kSaa2InnerTubeRmax - kSaa2InnerTubeD, kSaa2InnerTubeRmax);
    1045           1 :       TGeoVolume* voSaa2InnerTube = new TGeoVolume("YSAA2_InnerTube", shSaa2InnerTube, kMedSteelSh);
    1046             :       
    1047             : ///////////////////////////////////
    1048             : //    SAA2 Steel Ring            //
    1049             : //    Drawing ALIP2A__0042       //
    1050             : ///////////////////////////////////
    1051             :       //  HalfWidth
    1052             :       Float_t dzSaa2SteelRing = 2.;
    1053           1 :       TGeoTube*   shSaa2SteelRing  = new TGeoTube(41.6, 47.6, dzSaa2SteelRing);
    1054           1 :       TGeoVolume* voSaa2SteelRing  = new TGeoVolume("YSAA2_SteelRing", shSaa2SteelRing, kMedSteel);
    1055             : 
    1056             : ///////////////////////////////////
    1057             : //    SAA2 Outer Shape           //
    1058             : //    Drawing ALIP2A__0108       //
    1059             : ///////////////////////////////////
    1060             : 
    1061           1 :       TGeoPcon* shSaa2  = new TGeoPcon(0., 360., 16);
    1062             :       kSec = 0.02; // security distance to avoid trivial extrusions
    1063             :       rmin = kSaa2InnerTubeRmin - kSaa2InnerTubeD - kSec;
    1064             :       rmax = kSaa2InnerTubeRmax - kSaa2InnerTubeD - kSec;
    1065             :       // Flange SAA1 side
    1066             :       z = 0.;
    1067           1 :       shSaa2->DefineSection( 0, z, rmin           , rOuSaa2PbCompA1);
    1068             :       z += dzSaa2PbCompA1 + dzSaa2PbCompA2;
    1069           1 :       shSaa2->DefineSection( 1, z, rmin           , rOuSaa2PbCompA1);
    1070           1 :       shSaa2->DefineSection( 2, z, rmin           , rInSaa2StEnv1 + dSt);
    1071             :       z += dzSaa2PbCompA3;
    1072           1 :       shSaa2->DefineSection( 3, z, rmin           , rInSaa2StEnv1 + dSt);
    1073             :       z = zSaa2PbRing;
    1074           1 :       shSaa2->DefineSection( 4, z, 0.             , rInSaa2StEnv1 + dSt);
    1075           1 :       shSaa2->DefineSection( 5, z, 0.             , rOuSaa2PbRingF);
    1076             :       z += dzSaa2PbRing;
    1077           1 :       shSaa2->DefineSection( 6, z, 0.             , rOuSaa2PbRingR);
    1078           1 :       shSaa2->DefineSection( 7, z, 0.             , rInSaa2StEnv1 + dSt);
    1079             :       z = dzSaa2PbCompA1 + dzSaa2PbCompA2 + dzSaa2StEnv1;
    1080           1 :       shSaa2->DefineSection( 8, z, 0.             , rInSaa2StEnv1 + dSt);
    1081           1 :       shSaa2->DefineSection( 9, z, 0.             , rInSaa2StEnv2 + dSt);
    1082             :       z = dzSaa2PbComp - dzSaa2PbCompB2;
    1083           1 :       shSaa2->DefineSection(10, z, rmax           , rInSaa2StEnv2 + dSt);
    1084             :       z += dzSaa2PbCompE1;
    1085           1 :       shSaa2->DefineSection(11, z, rmax           , rInSaa2StEnv2 + dSt);
    1086             :       z += dzSaa2PbCompE2;
    1087           1 :       shSaa2->DefineSection(12, z, rInSaa2PbCompE3, rInSaa2StEnv2 + dSt);
    1088             :       z += (dzSaa2PbCompE3 + dzSaa2PbCompE4);
    1089           1 :       shSaa2->DefineSection(13, z, rInSaa2PbCompE3, rInSaa2StEnv2 + dSt);
    1090           1 :       shSaa2->DefineSection(14, z, rInSaa2PbCompE3, rOuSaa2PbCompE4);
    1091             :       z += dzSaa2PbCompE5;
    1092           1 :       shSaa2->DefineSection(15, z, rInSaa2PbCompE3, rOuSaa2PbCompE4);
    1093             : 
    1094           1 :       TGeoVolume* voSaa2  =  new TGeoVolume("YSAA2", shSaa2, kMedAir);
    1095           1 :       voSaa2->SetVisibility(0);
    1096             : // Inner 1.89/2 deg line
    1097             :       Double_t zref   = dzSaa2PbCompA1 + dzSaa2PbCompA2 + dzSaa2PbCompA3;
    1098          14 :       for (Int_t i  = 4; i < 10; i++) {
    1099           6 :           Double_t zp = shSaa2->GetZ(i);
    1100           6 :           Double_t r2 = shSaa2->GetRmax(i);   
    1101           6 :           Double_t r1 = rmin + (zp -  zref) * TMath::Tan(1.89 / 2. * kDegRad) - kSec;
    1102           6 :           shSaa2->DefineSection(i, zp, r1, r2);
    1103             :       }
    1104             : 
    1105             : //
    1106             : //    Assemble SAA2
    1107           1 :       voSaa2->AddNode(voSaa2StEnv,     1, gGeoIdentity);
    1108           1 :       voSaa2->AddNode(voSaa2PbRing,    1, gGeoIdentity);
    1109           1 :       voSaa2->AddNode(voSaa2PbComp,    1, gGeoIdentity);
    1110           2 :       voSaa2->AddNode(voSaa2InnerTube, 1, new TGeoTranslation(0., 0., dzSaa2PbCompA1));
    1111             :       z = (dzSaa2PbComp - dzSaa2PbCompE4 - dzSaa2PbCompE5) + dzSaa2SteelRing;
    1112           2 :       voSaa2->AddNode(voSaa2SteelRing, 1, new TGeoTranslation(0., 0., z));
    1113             : 
    1114             : 
    1115             : ///////////////////////////////////////
    1116             : //                SAA3               //
    1117             : ///////////////////////////////////////
    1118             : //
    1119             : //
    1120             : //  This is a study performed by S. Maridor
    1121             : //  The SAA3 has not yet been designed !!!!!!!!
    1122             : //
    1123             : ///////////////////////////////////
    1124             : //    SAA3 Outer Shape           //
    1125             : //    Drawing ALIP2A__0288       //
    1126             : ///////////////////////////////////
    1127           1 :       TGeoVolumeAssembly* voSaa3  = new TGeoVolumeAssembly("YSAA3");
    1128             : ///////////////////////////////////
    1129             : //    SAA3 Concrete cone         //
    1130             : //    Drawing ALIP2A__0284       //
    1131             : ///////////////////////////////////
    1132             : //    Block
    1133           1 :       TGeoBBox* shSaa3CCBlockO   = new TGeoBBox(80./2., 80./2., 80./2.);  // modified by ernesto.calvo@pucp.edu.pe
    1134           1 :       shSaa3CCBlockO->SetName("Saa3CCBlockO");
    1135             : 
    1136           1 :       TGeoPcon* shSaa3InnerRegion  = new TGeoPcon(0., 360., 4);
    1137             :       // + 10.0 cm // ecv
    1138           1 :       shSaa3InnerRegion->DefineSection( 0, -50.0, 0., 27.1);
    1139           1 :       shSaa3InnerRegion->DefineSection( 1, -13.0, 0., 27.1);
    1140           1 :       shSaa3InnerRegion->DefineSection( 2,  39.1, 0., 12.3);
    1141           1 :       shSaa3InnerRegion->DefineSection( 3,  80.0, 0., 12.3);
    1142           1 :       shSaa3InnerRegion->SetName("Saa3InnerRegion");
    1143             : 
    1144           1 :       TGeoCompositeShape* shSaa3CCBlock = new TGeoCompositeShape("Saa3CCBlock", "Saa3CCBlockO-Saa3InnerRegion");
    1145           1 :       TGeoVolume* voSaa3CCBlock         = new TGeoVolume("YSAA3CCBlock", shSaa3CCBlock, kMedConcSh);     
    1146             : 
    1147             :       
    1148           1 :       voSaa3->AddNode(voSaa3CCBlock, 1, gGeoIdentity);
    1149             :       
    1150             : //    Plate 1: 240 cm x 80 cm x  80 cm (x 2)
    1151           2 :       TGeoVolume* voSaa3SteelPlate1  =  new TGeoVolume("YSAA3SteelPlate1", 
    1152           3 :                                                        new TGeoBBox(240./2., 80./2.,  80./2.),
    1153             :                                                        kMedSteelSh);
    1154           2 :       TGeoVolume* voSaa3SteelPlate11 =  new TGeoVolume("YSAA3SteelPlate11", 
    1155           3 :                                                        new TGeoBBox(240./2., 80./2., 10./2.),
    1156             :                                                        kMedSteel);
    1157           1 :       voSaa3SteelPlate11->SetVisContainers(kTRUE);
    1158           1 :       voSaa3SteelPlate1 ->SetVisibility(kTRUE);
    1159           2 :       voSaa3SteelPlate1->AddNode(voSaa3SteelPlate11, 1, new TGeoTranslation(0., 0., -35.));
    1160           2 :       voSaa3->AddNode(voSaa3SteelPlate1, 1, new TGeoTranslation(0., +80., 0.));
    1161           2 :       voSaa3->AddNode(voSaa3SteelPlate1, 2, new TGeoTranslation(0., -80., 0.));
    1162             : 
    1163             : 
    1164             : //    Plate 2:  80 cm x 80 cm x  80 cm (x 2)
    1165           2 :       TGeoVolume* voSaa3SteelPlate2  =  new TGeoVolume("YSAA3SteelPlate2", 
    1166           3 :                                                        new TGeoBBox( 80./2., 80./2.,  80./2.),
    1167             :                                                        kMedSteelSh);
    1168           2 :       TGeoVolume* voSaa3SteelPlate21 =  new TGeoVolume("YSAA3SteelPlate21", 
    1169           3 :                                                        new TGeoBBox( 80./2., 80./2., 10./2.),
    1170             :                                                        kMedSteel);
    1171           2 :       voSaa3SteelPlate2->AddNode(voSaa3SteelPlate21, 1, new TGeoTranslation(0., 0., -35.));
    1172           2 :       voSaa3->AddNode(voSaa3SteelPlate2, 1, new TGeoTranslation(+80, 0., 0.));
    1173           2 :       voSaa3->AddNode(voSaa3SteelPlate2, 2, new TGeoTranslation(-80, 0., 0.));
    1174             : 
    1175             : 
    1176             : 
    1177             : 
    1178             : ///////////////////////////////////
    1179             : //    Muon Filter                //
    1180             : //    Drawing ALIP2A__0105       //
    1181             : ///////////////////////////////////
    1182             :       // Half Length 
    1183             :       const Float_t dzMuonFilter = 60.;
    1184             :       
    1185           1 :       TGeoBBox*   shMuonFilterO  = new TGeoBBox(550./2., 620./2., dzMuonFilter);
    1186           1 :       shMuonFilterO->SetName("FilterO");
    1187           1 :       TGeoCombiTrans* trFilter = new TGeoCombiTrans("trFilter", 0., -dzMuonFilter * TMath::Tan(alhc * kDegrad), 0., rotlhc);
    1188           1 :       trFilter->RegisterYourself();
    1189           1 :       TGeoTube*   shMuonFilterI  = new TGeoTube(0., 48.8, dzMuonFilter + 20.);
    1190           1 :       shMuonFilterI->SetName("FilterI");
    1191           1 :       TGeoCompositeShape* shMuonFilter = new TGeoCompositeShape("MuonFilter", "FilterO-FilterI:trFilter");
    1192             :       //
    1193             :       // !!!!! Needs to be inclined
    1194           1 :       TGeoVolume* voMuonFilter = new TGeoVolume("YMuonFilter", shMuonFilter, kMedCastiron);
    1195             : 
    1196             :       // Inner part with higher transport cuts
    1197             :       Float_t dzMuonFilterH = 50.;
    1198           1 :       TGeoBBox*   shMuonFilterOH  = new TGeoBBox(550./2., 620./2., dzMuonFilterH);
    1199           1 :       shMuonFilterOH->SetName("FilterOH");
    1200           1 :       TGeoTube*   shMuonFilterIH  = new TGeoTube(0., 50., dzMuonFilterH + 5.);
    1201           1 :       shMuonFilterIH->SetName("FilterIH");
    1202           1 :       TGeoCompositeShape* shMuonFilterH = new TGeoCompositeShape("MuonFilterH", "FilterOH-FilterIH:trFilter");
    1203           1 :       TGeoVolume* voMuonFilterH = new TGeoVolume("YMuonFilterH", shMuonFilterH, kMedCastironSh);
    1204           1 :       voMuonFilter->AddNode(voMuonFilterH, 1, gGeoIdentity);
    1205             :       
    1206             : //  
    1207           1 :       TGeoVolumeAssembly* voSaa  = new TGeoVolumeAssembly("YSAA");
    1208             : //
    1209             : //    Starting position of the FA Flange/Tail 
    1210             :       const Float_t ziFaWTail   = 499.0;
    1211             : //    End of the FA Flange/Tail
    1212             :       const Float_t zoFaWTail   = ziFaWTail + dzFaWTail;
    1213             : //    Starting position of the FA/SAA1 Joint (2.8 cm overlap with tail)
    1214             :       const Float_t ozFaSaa1    = 2.8;
    1215             :       const Float_t ziFaSaa1    = zoFaWTail - ozFaSaa1;
    1216             : //    End of the FA/SAA1 Joint
    1217             :       const Float_t zoFaSaa1    = ziFaSaa1 +  dzFaSaa1;
    1218             : //    Starting position of SAA1 (2.0 cm overlap with joint)     
    1219             :       const Float_t ozSaa1      = 2.;
    1220             :       const Float_t ziSaa1      = zoFaSaa1 - ozSaa1;
    1221             : //    End of SAA1
    1222             :       const Float_t zoSaa1      = ziSaa1 + dzSaa1;
    1223             : //    Starting position of SAA1/SAA2 Joint (1.95 cm overlap with SAA1)
    1224             :       const Float_t ziSaa1Saa2  = zoSaa1 - 1.95;
    1225             : //    End of SAA1/SAA2 Joint
    1226             :       const Float_t zoSaa1Saa2  = ziSaa1Saa2 + dzSaa1Saa2;
    1227             : //    Starting position of SAA2 (3.1 cm overlap with the joint)
    1228             :       const Float_t ziSaa2      = zoSaa1Saa2 - 3.1;
    1229             : //    End of SAA2
    1230             :       const Float_t zoSaa2      = ziSaa2 + dzSaa2PbComp;
    1231             : //    Position of SAA3
    1232             :       const Float_t zcSaa3      = zoSaa2 + 40.; // ecv (put the CC block 5cm closer to the Wall)  // <--cancell that!! (cancelled)
    1233             : //    Position of the Muon Filter
    1234             :       const Float_t zcFilter    = 1465.9 + dzMuonFilter;
    1235             : 
    1236           2 :       voSaa->AddNode(voFaWTail,    1, new TGeoTranslation(0., 0., ziFaWTail));
    1237           2 :       voSaa->AddNode(voFaSaa1,     1, new TGeoTranslation(0., 0., ziFaSaa1));
    1238           2 :       voSaa->AddNode(voSaa1 ,      1, new TGeoTranslation(0., 0., ziSaa1));
    1239           2 :       voSaa->AddNode(voSaa1Saa2,   1, new TGeoTranslation(0., 0., ziSaa1Saa2 - 0.1));
    1240           2 :       voSaa->AddNode(voSaa2 ,      1, new TGeoTranslation(0., 0., ziSaa2));
    1241             : 
    1242             : //
    1243             : //    Add Saa3 to Saa and Saa to top volume
    1244             : //
    1245           2 :       voSaa->AddNode(voSaa3,       1, new TGeoTranslation(0., 0., zcSaa3));
    1246             :       
    1247             : 
    1248           1 :       TGeoRotation* rotxz  = new TGeoRotation("rotxz",   90.,   0., 90.,  90., 180., 0.);
    1249           2 :       top->AddNode(voSaa, 1, new TGeoCombiTrans(0., 0., 0., rotxz));
    1250             : 
    1251             : 
    1252             : 
    1253             : //
    1254             : //  Mother volume for muon stations 1+2 and shielding material placed between the quadrants
    1255             : //
    1256             :       // Position of the dipole
    1257             :       Float_t ziDipole = 741.;
    1258             :       
    1259           1 :       TGeoPcon* shYOUT1 = new TGeoPcon(0., 360., 24);
    1260             :       Float_t eps = 1.e-2;
    1261             :       // FA Tail Section
    1262          18 :       for (Int_t iz =  1; iz < 9; iz++) {
    1263           8 :           z = shFaWTail->GetZ(iz+1);
    1264           9 :           if (iz == 8) z -= ozFaSaa1;
    1265           8 :           shYOUT1->DefineSection(iz-1, z + ziFaWTail, shFaWTail->GetRmax(iz+1) + eps, 150.);
    1266             :       }
    1267             :       // FA-SAA1 Joint
    1268           1 :       z = shYOUT1->GetZ(7);
    1269             :       
    1270          18 :       for (Int_t iz =  9; iz < 17; iz++) 
    1271           8 :           shYOUT1->DefineSection(iz-1, z + shFaSaa1->GetZ(iz-9), shFaSaa1->GetRmax(iz-9) + eps, 150.);
    1272             : 
    1273           1 :       z = shYOUT1->GetZ(15) - ozSaa1;
    1274             :       // SAA1  - Dipole
    1275          16 :       for (Int_t iz = 17; iz < 24; iz++) 
    1276           7 :           shYOUT1->DefineSection(iz-1, z + shSaa1M->GetZ(iz-13), shSaa1M->GetRmax(iz-13) + eps, 150.); 
    1277             :       // Distance between dipole and start of SAA1 2deg opening cone
    1278             :       dz   = ziDipole - (zSaa1StEnv[0] - dSt + zSaa1StEnvS + ziSaa1);
    1279           1 :       rOut = rOuSaa1StEnv2 + dz * TMath::Tan(2. * kDegRad);
    1280             :       
    1281           1 :       shYOUT1->DefineSection(23, ziDipole, rOut + eps, 150.);
    1282             : 
    1283           1 :       InvertPcon(shYOUT1);
    1284           1 :       TGeoVolume* voYOUT1 = new TGeoVolume("YOUT1", shYOUT1, kMedAirMu);
    1285           1 :       voYOUT1->SetVisibility(0);
    1286             : 
    1287           2 :       voYOUT1->AddNode(asSaa1ExtraShield, 1, new TGeoCombiTrans(0., 0., - (100.7 + 62.2 + saa1ExtraShieldL / 2. + ziFaWTail), rotxz));
    1288           2 :       voYOUT1->AddNode(asFaExtraShield,   1, new TGeoCombiTrans(0., 0., - (16.41 - 1.46 + kFaWring2HWidth + ziFaWTail), rotxz));
    1289           1 :       top->AddNode(voYOUT1, 1, gGeoIdentity);
    1290             : //
    1291             : //  Mother volume for muon stations 4+5 and trigger stations.
    1292             : //
    1293             :       Float_t zoDipole = 1249.;
    1294             :       
    1295           1 :       TGeoPcon* shYOUT21 = new TGeoPcon(0., 360., 14);
    1296             :       z =  zoDipole;
    1297           1 :       shYOUT21->DefineSection(0, z,             rOuSaa1String,       375.);
    1298             : //    Start of SAA1-SAA2
    1299             :       z = ziSaa1Saa2;
    1300           1 :       shYOUT21->DefineSection(1, z,             rOuSaa1String,       375.);
    1301           1 :       shYOUT21->DefineSection(2, z,             rOuSaa1Saa2Steel,    375.);
    1302             : //    End of SAA1-SAA2
    1303             :       z = ziSaa2;
    1304           1 :       shYOUT21->DefineSection(3, z,             rOuSaa1Saa2Steel,    375.);
    1305             : //    SAA2
    1306           1 :       shYOUT21->DefineSection( 4, z,            rInSaa2StEnv1 + dSt, 375.);
    1307             :       z = ziSaa2 + zSaa2PbRing;
    1308           1 :       shYOUT21->DefineSection( 5, z,            rInSaa2StEnv1 + dSt, 375.);
    1309             : //    Pb Cone
    1310           1 :       shYOUT21->DefineSection( 6, z,            rOuSaa2PbRingF,      375.);
    1311           1 :       rmin = rOuSaa2PbRingF + (1380. - z) * TMath::Tan(1.6 * kDegRad);
    1312           1 :       shYOUT21->DefineSection( 7, 1380., rmin, 375.);
    1313           1 :       shYOUT21->DefineSection( 8, 1380., rmin, 375.);
    1314             :       z = ziSaa2 + zSaa2PbRing + dzSaa2PbRing;
    1315           1 :       shYOUT21->DefineSection( 9, z,            rOuSaa2PbRingR,      375.);
    1316             : //    Straight Sections
    1317           1 :       shYOUT21->DefineSection(10, z,            rInSaa2StEnv1 + dSt, 460.);
    1318             :       z = ziSaa2 + dzSaa2StEnv1;
    1319           1 :       shYOUT21->DefineSection(11, z,            rInSaa2StEnv1 + dSt, 460.);
    1320           1 :       shYOUT21->DefineSection(12, z,            rInSaa2StEnv2 + dSt, 460.);
    1321             :       z += dzSaa2StEnv2;
    1322           1 :       shYOUT21->DefineSection(13, z,            rInSaa2StEnv2 + dSt, 460.);
    1323             :             
    1324           1 :       InvertPcon(shYOUT21);
    1325           1 :       shYOUT21->SetName("shYOUT21");
    1326             : 
    1327           1 :       TGeoBBox* shYOUT22 = new TGeoBBox(460. , 200., 65. - 1.5);
    1328           1 :       shYOUT22->SetName("shYOUT22");
    1329             :       
    1330           1 :       TGeoTranslation* tYOUT22 = new TGeoTranslation(0., -310. - 200., -zcFilter);
    1331           1 :       tYOUT22->SetName("tYOUT22");
    1332           1 :       tYOUT22->RegisterYourself();
    1333             :       
    1334             : 
    1335           1 :       TGeoCompositeShape* shYOUT2 = new TGeoCompositeShape("shYOUT2", "shYOUT21-shYOUT22:tYOUT22");
    1336             :       
    1337           1 :       TGeoVolume* voYOUT2 = new TGeoVolume("YOUT2", shYOUT2, kMedAirMu);
    1338           1 :       voYOUT2->SetVisibility(1);
    1339           2 :       voYOUT2->AddNode(voMuonFilter, 1, new TGeoCombiTrans(0., dzMuonFilter * TMath::Tan(alhc * kDegrad), -zcFilter, rotxzlhc));
    1340           1 :       top->AddNode(voYOUT2, 1, gGeoIdentity);
    1341           1 : }
    1342             : 
    1343             : void AliSHILv3::Init()
    1344             : {
    1345             :   //
    1346             :   // Initialise the muon shield after it has been built
    1347             :   //
    1348             :   Int_t i;
    1349             :   //
    1350           2 :   if(AliLog::GetGlobalDebugLevel()>0) {
    1351           0 :     printf("\n%s: ",ClassName());
    1352           0 :     for(i=0;i<35;i++) printf("*");
    1353           0 :     printf(" SHILv3_INIT ");
    1354           0 :     for(i=0;i<35;i++) printf("*");
    1355           0 :     printf("\n%s: ",ClassName());
    1356             :     //
    1357             :     // Here the SHIL initialisation code (if any!)
    1358           0 :     for(i=0;i<80;i++) printf("*");
    1359           0 :     printf("\n");
    1360           0 :   }
    1361           1 : }
    1362             : 
    1363             : void AliSHILv3::InvertPcon(TGeoPcon* pcon)
    1364             : {
    1365             : //
    1366             : //  z -> -z
    1367             : // 
    1368           4 :     Int_t nz = pcon->GetNz();
    1369           2 :     Double_t* z    = new Double_t[nz];
    1370           2 :     Double_t* rmin = new Double_t[nz];
    1371           2 :     Double_t* rmax = new Double_t[nz];
    1372             : 
    1373           2 :     Double_t*  z0    = pcon->GetZ();
    1374           2 :     Double_t*  rmin0 = pcon->GetRmin();
    1375           2 :     Double_t*  rmax0 = pcon->GetRmax();
    1376             :     
    1377          80 :     for (Int_t i = 0; i < nz; i++) {
    1378          38 :         z[i] = z0[i];
    1379          38 :         rmin[i] = rmin0[i];
    1380          38 :         rmax[i] = rmax0[i];     
    1381             :     }
    1382             :     
    1383          80 :     for (Int_t i = 0; i < nz; i++) {
    1384          38 :         Int_t j = nz - i - 1;
    1385          38 :         pcon->DefineSection(i, - z[j], rmin[j], rmax[j]);
    1386             :     }
    1387             :     
    1388           4 :     delete[] z;
    1389           4 :     delete[] rmin;
    1390           4 :     delete[] rmax;
    1391           2 : }
    1392             : 
    1393             : TGeoPcon* AliSHILv3::MakeShapeFromTemplate(const TGeoPcon* pcon, Float_t drMin, Float_t drMax)
    1394             : {
    1395             :     // 
    1396             :     // Returns new shape based on a template changing
    1397             :     // the inner radii by drMin and the outer radii by drMax.
    1398             :     //
    1399           6 :     Int_t nz = pcon->GetNz();
    1400           3 :     TGeoPcon* cpcon = new TGeoPcon(0., 360., nz);
    1401          60 :     for (Int_t i = 0; i < nz; i++) 
    1402          27 :         cpcon->DefineSection(i, pcon->GetZ(i), pcon->GetRmin(i) + drMin, pcon->GetRmax(i) + drMax);
    1403           3 :     return cpcon;
    1404           0 : }
    1405             : 
    1406             : 

Generated by: LCOV version 1.11