]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSlatGeometryBuilder.cxx
switch to activate ResponseTriggerV1 from Config
[u/mrichter/AliRoot.git] / MUON / AliMUONSlatGeometryBuilder.cxx
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 // Class AliMUONSlatGeometryBuilder
19 // -------------------------------
20 // Abstract base class for geometry construction per chamber.
21 //
22
23
24
25 // This Builder is designed according to the enveloppe methode. The basic idea is to be able to allow moves 
26 // of the slats on the support panels. 
27 // Those moves can be described with a simple set of parameters. The next step should be now to describe all 
28 // the slats and their places by a unique 
29 // class, which would make the SlatBuilder far more compact since now only three parameters can define a slat 
30 // and its position, like:
31 //   * Bool_t rounded_shape_slat
32 //   * Float_t slat_length
33 //   * Float_t slat_number or Float_t slat_position
34
35 #include <TVirtualMC.h>
36 #include <TGeoMatrix.h>
37 #include <Riostream.h>
38
39 #include "AliRun.h"
40 #include "AliLog.h"
41
42 #include "AliMUONSlatGeometryBuilder.h"
43 #include "AliMUON.h"
44 #include "AliMUONConstants.h"
45 #include "AliMUONGeometryModule.h"
46 #include "AliMUONGeometryEnvelopeStore.h"
47 #include "AliMUONConstants.h"
48
49 /// \cond CLASSIMP
50 ClassImp(AliMUONSlatGeometryBuilder)
51 /// \endcond
52
53 //______________________________________________________________________________
54 AliMUONSlatGeometryBuilder::AliMUONSlatGeometryBuilder(AliMUON* muon)
55  : AliMUONVGeometryBuilder(4, 5, 6, 7, 8, 9),
56    fMUON(muon)
57 {
58 // Standard constructor
59
60 }
61
62 //______________________________________________________________________________
63 AliMUONSlatGeometryBuilder::AliMUONSlatGeometryBuilder() 
64  : AliMUONVGeometryBuilder(),
65    fMUON(0)
66 {
67 // Default constructor
68 }
69
70 //______________________________________________________________________________
71 AliMUONSlatGeometryBuilder::~AliMUONSlatGeometryBuilder() {
72 //
73 }
74
75 //
76 // public methods
77 //
78
79 //______________________________________________________________________________
80 void AliMUONSlatGeometryBuilder::CreateGeometry()
81 {
82   // CreateGeometry is the method containing all the informations concerning Stations 345 geometry.
83   // It includes description and placements of support panels and slats.
84   // The code comes directly from what was written in AliMUONv1.cxx before, with modifications concerning 
85   // the use of Enveloppe method to place the Geant volumes.
86   // Now, few changes would allow the creation of a Slat methode where slat could be described by few parameters, 
87   // and this builder would then be dedicated only to the
88   // placements of the slats. Those modifications could shorten the Station 345 geometry by a non-negligeable factor...
89  
90   Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
91
92   Float_t angle;
93   Float_t *dum=0;
94
95   // define the id of tracking media:
96   Int_t idAir    = idtmed[1100]; // medium 1
97   Int_t idGas    = idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
98   Int_t idCopper = idtmed[1110];
99   Int_t idG10    = idtmed[1111];
100   Int_t idCarbon = idtmed[1112];
101   Int_t idRoha   = idtmed[1113];
102   Int_t idNomex  = idtmed[1114]; // honey comb
103   Int_t idNoryl  = idtmed[1115]; 
104   Int_t idNomexB = idtmed[1116]; // bulk material 
105
106   // sensitive area: 40*40 cm**2
107   const Float_t kSensLength = 40.; 
108   const Float_t kSensHeight = 40.; 
109   const Float_t kSensWidth  = AliMUONConstants::Pitch()*2;// 0.5 cm, according to TDR fig 2.120 
110   const Int_t kSensMaterial = idGas;
111   //     const Float_t kYoverlap   = 1.5; 
112
113   // PCB dimensions in cm; width: 30 mum copper   
114   const Float_t kPcbLength  = kSensLength; 
115   const Float_t kPcbHeight  = 58.; // updated Ch. Finck 
116   const Float_t kPcbWidth   = 0.003; 
117   const Int_t kPcbMaterial  = idCopper;
118
119   // Insulating material: 220 mum G10 fiber  glued to pcb  
120   const Float_t kInsuLength = kPcbLength; 
121   const Float_t kInsuHeight = kPcbHeight; 
122   const Float_t kInsuWidth  = 0.022;  // updated Ch. Finck 
123   const Int_t kInsuMaterial = idG10;
124
125   // Carbon fiber panels: 200mum carbon/epoxy skin   
126   const Float_t kCarbonWidth  = 0.020;      
127   const Int_t kCarbonMaterial = idCarbon;
128
129   // Nomex (honey comb) between the two panel carbon skins    
130   const Float_t kNomexLength = kSensLength; 
131   const Float_t kNomexHeight = kSensHeight; 
132   const Float_t kNomexWidth  = 0.8; // updated Ch. Finck 
133   const Int_t kNomexMaterial = idNomex;
134  
135   // Bulk Nomex under panel sandwich Ch. Finck    
136   const Float_t kNomexBWidth  = 0.025; 
137   const Int_t kNomexBMaterial = idNomexB;
138
139   // Panel sandwich 0.02 carbon*2 + 0.8 nomex     
140   const Float_t kPanelLength = kSensLength; 
141   const Float_t kPanelHeight = kSensHeight; 
142   const Float_t kPanelWidth  = 2 * kCarbonWidth + kNomexWidth;
143
144   // Frame along the rounded (spacers) slats 
145   const Float_t kRframeHeight = 2.00; 
146
147   // spacer around the slat: 2 sticks along length,2 along height  
148   // H: the horizontal ones 
149   const Float_t kHframeLength = kPcbLength; 
150   const Float_t kHframeHeight = 1.95; // updated Ch. Finck 
151   const Float_t kHframeWidth  = kSensWidth; 
152   const Int_t kHframeMaterial = idNoryl;
153
154   // V: the vertical ones; vertical spacers 
155   const Float_t kVframeLength = 2.5; 
156   const Float_t kVframeHeight = kSensHeight + kHframeHeight; 
157   const Float_t kVframeWidth  = kSensWidth;
158   const Int_t kVframeMaterial = idNoryl;
159
160   // B: the horizontal border filled with rohacell: ok Ch. Finck
161   const Float_t kBframeLength = kHframeLength; 
162   const Float_t kBframeHeight = (kPcbHeight - kSensHeight)/2. - kHframeHeight; 
163   const Float_t kBframeWidth  = kHframeWidth;
164   const Int_t kBframeMaterial = idRoha;
165
166   // NULOC: 30 mum copper + 200 mum vetronite (same radiation length as 14mum copper) for electronics
167   const Float_t kNulocLength   = 2.5; 
168   const Float_t kNulocHeight   = kBframeHeight;
169   const Float_t kNulocWidth    = 0.0030 + 0.0014; // equivalent copper width of vetronite; 
170   const Int_t   kNulocMaterial = idCopper;
171
172   // Slat parameters
173   const Float_t kSlatHeight = kPcbHeight; 
174   const Float_t kSlatWidth  = kSensWidth + 2.*(kPcbWidth + kInsuWidth + kPanelWidth 
175                                                + kNomexBWidth); //replaced rohacell with Nomex Ch. Finck 
176   // const Int_t   kSlatMaterial = idAir;
177   const Float_t kDslatLength  = -1.25; // position of the slat respect to the beam plane (half vertical spacer) Ch. Finck
178   Float_t zSlat               = AliMUONConstants::DzSlat();// implemented Ch. Finck
179   Float_t dzCh                = AliMUONConstants::DzCh();
180
181   Float_t spar[3];  
182   Int_t i, j;
183   Int_t detElemId;
184
185   // the panel volume contains the nomex
186   Float_t panelpar[3] = { kPanelLength/2., kPanelHeight/2., kPanelWidth/2. }; 
187   Float_t nomexpar[3] = { kNomexLength/2., kNomexHeight/2., kNomexWidth/2. }; 
188   Float_t twidth =  kPanelWidth +  kNomexBWidth; 
189   Float_t nomexbpar[3] = {kNomexLength/2., kNomexHeight/2.,twidth/2. };// bulk nomex 
190
191   // insulating material contains PCB-> gas   
192   twidth = 2*(kInsuWidth + kPcbWidth) + kSensWidth ; 
193   Float_t insupar[3] = {kInsuLength/2., kInsuHeight/2., twidth/2. }; 
194   twidth -= 2 * kInsuWidth; 
195   Float_t pcbpar[3]  = {kPcbLength/2., kPcbHeight/2., twidth/2. }; 
196   Float_t senspar[3] = {kSensLength/2., kSensHeight/2., kSensWidth/2. }; 
197   Float_t theight    = 2 * kHframeHeight + kSensHeight;
198   Float_t hFramepar[3] = {kHframeLength/2., theight/2., kHframeWidth/2.}; 
199   Float_t bFramepar[3] = {kBframeLength/2., kBframeHeight/2., kBframeWidth/2.}; 
200   Float_t vFramepar[3] = {kVframeLength/2., kVframeHeight/2., kVframeWidth/2.};
201   Float_t nulocpar[3]  = {kNulocLength/2.,  kNulocHeight/2.,  kNulocWidth/2.}; 
202
203   Float_t xx;
204   Float_t xxmax = (kBframeLength - kNulocLength)/2.; 
205   Int_t index=0;
206       
207   AliMUONChamber *iChamber, *iChamber1, *iChamber2;
208
209   Int_t* fStations = new Int_t[5];
210   for (Int_t i=0; i<5; i++) fStations[i] = 1;
211   fStations[2] = 1;
212      
213   if (fStations[2])
214     {
215       //********************************************************************
216       //                            Station 3                             **
217       //********************************************************************
218       // indices 1 and 2 for first and second chambers in the station
219       // iChamber (first chamber) kept for other quanties than Z,
220       // assumed to be the same in both chambers
221
222       iChamber = &fMUON->Chamber(4);
223       iChamber1 = iChamber;
224       iChamber2 = &fMUON->Chamber(5);
225      
226       //GetGeometry(4)->SetDebug(kTRUE);
227       //GetGeometry(5)->SetDebug(kTRUE);
228  
229       if (!gAlice->GetModule("DIPO")) {
230         // Mother volume for each chamber in st3 are only defined if Dipole volue is there.
231         // Outer excess and inner recess for mother volume radius
232         // with respect to ROuter and RInner
233         Float_t dMotherInner = AliMUONConstants::Rmin(2)-kRframeHeight; 
234         Float_t dMotherOutner= AliMUONConstants::Rmax(2)+kVframeLength + 37.0; 
235         // Additional 37 cm gap is needed to wrap the corners of the slats sin Rmax represent the maximum active radius of the chamber with 2pi phi acceptance 
236         Float_t tpar[3];
237         Double_t dstation =  ( (-AliMUONConstants::DefaultChamberZ(5)) -
238                                (-AliMUONConstants::DefaultChamberZ(4)) ) /2.1;
239         tpar[0] = dMotherInner; 
240         tpar[1] = dMotherOutner;
241         tpar[2] = dstation;
242         gMC->Gsvolu("CH05", "TUBE", idAir, tpar, 3);
243         gMC->Gsvolu("CH06", "TUBE", idAir, tpar, 3);
244       }
245       // volumes for slat geometry (xx=5,..,10 chamber id): 
246       // Sxx0 Sxx1 Sxx2 Sxx3  -->   Slat Mother volumes 
247       // SxxG                          -->   Sensitive volume (gas)
248       // SxxP                          -->   PCB (copper) 
249       // SxxI                          -->   Insulator (G10) 
250       // SxxC                          -->   Carbon panel 
251       // SxxN                          -->   Nomex comb
252       // SxxX                          -->   Nomex bulk
253       // SxxH, SxxV                    -->   Horizontal and Vertical frames (Noryl)
254       // SB5x                          -->   Volumes for the 35 cm long PCB
255       // slat dimensions: slat is a MOTHER volume!!! made of air
256
257       // only for chamber 5: slat 1 has a PCB shorter by 5cm!
258
259       Float_t tlength = 35.;
260       Float_t panelpar2[3]  = { tlength/2., panelpar[1],  panelpar[2]}; 
261       Float_t nomexpar2[3]  = { tlength/2., nomexpar[1],  nomexpar[2]}; 
262       Float_t nomexbpar2[3] = { tlength/2., nomexbpar[1],  nomexbpar[2]}; 
263       Float_t insupar2[3]   = { tlength/2., insupar[1],   insupar[2]}; 
264       Float_t pcbpar2[3]    = { tlength/2., pcbpar[1],    pcbpar[2]}; 
265       Float_t senspar2[3]   = { tlength/2., senspar[1],   senspar[2]}; 
266       Float_t hFramepar2[3] = { tlength/2., hFramepar[1], hFramepar[2]}; 
267       Float_t bFramepar2[3] = { tlength/2., bFramepar[1], bFramepar[2]}; 
268       Float_t *dum=0;
269       Float_t pcbDLength3   = (kPcbLength - tlength);
270
271       const Int_t   kNslats3         = 5;  // number of slats per quadrant
272       const Int_t   kNPCB3[kNslats3] = {4, 4, 4, 3, 2}; // n PCB per slat
273       const Float_t kXpos3[kNslats3] = {0., 0., 0., 0., 0.};//{31., 0., 0., 0., 0.};
274       const Float_t kYpos3[kNslats3] = {0, 37.8, 37.7, 37.3, 33.7};
275       Float_t slatLength3[kNslats3]; 
276
277       // create and position the slat (mother) volumes 
278
279       char idSlatCh5[5];
280       char idSlatCh6[5];
281       Float_t xSlat3;
282       Float_t ySlat3 = 0;
283       Float_t angle = 0.;
284       Float_t spar2[3];
285       for (i = 0; i < kNslats3; i++){
286
287         slatLength3[i] = kPcbLength * kNPCB3[i] + 2.* kVframeLength; 
288         xSlat3 = slatLength3[i]/2. +  kDslatLength + kXpos3[i]; 
289         ySlat3 += kYpos3[i];
290
291         spar[0] = slatLength3[i]/2.; 
292         spar[1] = kSlatHeight/2.;
293         spar[2] = kSlatWidth/2.; 
294         // take away 5 cm from the first slat in chamber 5
295         if (i == 0 || i == 1 || i == 2) { // 1 pcb is shortened by 5cm
296           spar2[0] = spar[0] - pcbDLength3/2.;
297         } else {
298           spar2[0] = spar[0];
299         }
300         spar2[1] = spar[1];
301         spar2[2] = spar[2]; 
302         Float_t dzCh3 = dzCh; 
303         Float_t zSlat3 = (i%2 ==0)? -zSlat : zSlat; // seems not that zSlat3 = zSlat4 & 5 refering to plan PQ7EN345-6 ?
304
305         sprintf(idSlatCh5,"LA%d",i+kNslats3-1);
306         //gMC->Gsvolu(idSlatCh5,"BOX",kSlatMaterial,spar2,3);
307         detElemId = 509 - (i + kNslats3-1-4);
308         GetEnvelopes(4)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(xSlat3, ySlat3, -zSlat3 + dzCh3),
309                                      TGeoRotation("rot1",90,angle,90,90+angle,0,0) );
310
311         sprintf(idSlatCh5,"LA%d",3*kNslats3-2+i);
312         //gMC->Gsvolu(idSlatCh5,"BOX",kSlatMaterial,spar2,3);
313         detElemId = 500 + (i + kNslats3-1-4);
314         GetEnvelopes(4)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(-xSlat3, ySlat3, zSlat3 - dzCh3),
315                                      TGeoRotation("rot2",90,180+angle,90,90+angle,180,0) );
316
317         if (i > 0) { 
318           sprintf(idSlatCh5,"LA%d",kNslats3-1-i);
319           // gMC->Gsvolu(idSlatCh5,"BOX",kSlatMaterial,spar2,3);
320           detElemId = 509 + (i + kNslats3-1-4);
321           GetEnvelopes(4)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(xSlat3, -ySlat3, -zSlat3 + dzCh3), 
322                                        TGeoRotation("rot3",90,angle,90,270+angle,180,0) );
323
324           sprintf(idSlatCh5,"LA%d",3*kNslats3-2-i);
325           // gMC->Gsvolu(idSlatCh5,"BOX",kSlatMaterial,spar2,3);
326           detElemId = 518 - (i + kNslats3-1-4);
327           GetEnvelopes(4)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(-xSlat3, -ySlat3, zSlat3 - dzCh3),
328                                        TGeoRotation("rot4",90,180+angle,90,270+angle,0,0) );
329         }
330
331         sprintf(idSlatCh6,"LB%d",kNslats3-1+i);  
332         // gMC->Gsvolu(idSlatCh6,"BOX",kSlatMaterial,spar,3);
333         detElemId = 609 - (i  + kNslats3-1-4);
334         GetEnvelopes(5)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(xSlat3, ySlat3, -zSlat3 + dzCh3),
335                                      TGeoRotation("rot5",90,angle,90,90+angle,0,0) );
336         sprintf(idSlatCh6,"LB%d",3*kNslats3-2+i);
337         // gMC->Gsvolu(idSlatCh6,"BOX",kSlatMaterial,spar,3);
338         detElemId = 600 + (i + kNslats3-1-4);
339         GetEnvelopes(5)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(-xSlat3, ySlat3, zSlat3 - dzCh3),
340                                      TGeoRotation("rot6",90,180+angle,90,90+angle,180,0) );
341
342         if (i > 0) { 
343           sprintf(idSlatCh6,"LB%d",kNslats3-1-i);
344           //gMC->Gsvolu(idSlatCh6,"BOX",kSlatMaterial,spar,3);
345           detElemId = 609 + (i + kNslats3-1-4);
346           GetEnvelopes(5)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(xSlat3, -ySlat3, -zSlat3 + dzCh3),
347                                        TGeoRotation("rot7",90,angle,90,270+angle,180,0) );
348
349           sprintf(idSlatCh6,"LB%d",3*kNslats3-2-i);
350           //gMC->Gsvolu(idSlatCh6,"BOX",kSlatMaterial,spar,3);
351           detElemId = 618 - (i + kNslats3-1-4);
352           GetEnvelopes(5)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(-xSlat3, -ySlat3, zSlat3 - dzCh3),
353                                        TGeoRotation("rot8",90,180+angle,90,270+angle,0,0) );
354         }
355       }
356      
357       // create the panel volume 
358  
359       gMC->Gsvolu("S05C","BOX",kCarbonMaterial,panelpar,3);
360       gMC->Gsvolu("SB5C","BOX",kCarbonMaterial,panelpar2,3);
361       gMC->Gsvolu("S06C","BOX",kCarbonMaterial,panelpar,3);
362  
363       // create the nomex volume (honey comb)
364
365       gMC->Gsvolu("S05N","BOX",kNomexMaterial,nomexpar,3);
366       gMC->Gsvolu("SB5N","BOX",kNomexMaterial,nomexpar2,3);
367       gMC->Gsvolu("S06N","BOX",kNomexMaterial,nomexpar,3);
368  
369       // create the nomex volume (bulk)
370
371       gMC->Gsvolu("S05X","BOX",kNomexBMaterial,nomexbpar,3);
372       gMC->Gsvolu("SB5X","BOX",kNomexBMaterial,nomexbpar2,3);
373       gMC->Gsvolu("S06X","BOX",kNomexBMaterial,nomexbpar,3);
374
375       // create the insulating material volume 
376
377       gMC->Gsvolu("S05I","BOX",kInsuMaterial,insupar,3);
378       gMC->Gsvolu("SB5I","BOX",kInsuMaterial,insupar2,3);
379       gMC->Gsvolu("S06I","BOX",kInsuMaterial,insupar,3);
380  
381       // create the PCB volume 
382
383       gMC->Gsvolu("S05P","BOX",kPcbMaterial,pcbpar,3);
384       gMC->Gsvolu("SB5P","BOX",kPcbMaterial,pcbpar2,3);
385       gMC->Gsvolu("S06P","BOX",kPcbMaterial,pcbpar,3);
386  
387       // create the sensitive volumes,
388
389       gMC->Gsvolu("S05G","BOX",kSensMaterial,dum,0);
390       gMC->Gsvolu("S06G","BOX",kSensMaterial,dum,0);
391
392       // create the vertical frame volume 
393
394       gMC->Gsvolu("S05V","BOX",kVframeMaterial,vFramepar,3);
395       gMC->Gsvolu("S06V","BOX",kVframeMaterial,vFramepar,3);
396
397       // create the horizontal frame volume 
398
399       gMC->Gsvolu("S05H","BOX",kHframeMaterial,hFramepar,3);
400       gMC->Gsvolu("SB5H","BOX",kHframeMaterial,hFramepar2,3);
401       gMC->Gsvolu("S06H","BOX",kHframeMaterial,hFramepar,3);
402  
403       // create the horizontal border volume 
404
405       gMC->Gsvolu("S05B","BOX",kBframeMaterial,bFramepar,3);
406       gMC->Gsvolu("SB5B","BOX",kBframeMaterial,bFramepar2,3);
407       gMC->Gsvolu("S06B","BOX",kBframeMaterial,bFramepar,3);
408  
409       index = 0; 
410       for (i = 0; i<kNslats3; i++){
411         for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
412
413           if (i == 0 && quadrant == 2) continue;
414           if (i == 0 && quadrant == 4) continue;
415
416           sprintf(idSlatCh5,"LA%d",ConvertSlatNum(i,quadrant,kNslats3-1));
417           sprintf(idSlatCh6,"LB%d",ConvertSlatNum(i,quadrant,kNslats3-1));
418           Float_t xvFrame  = (slatLength3[i] - kVframeLength)/2.;
419           Float_t xvFrame2  = xvFrame;
420
421           if (i == 0 || i == 1 || i == 2) xvFrame2 -= pcbDLength3/2.;
422
423           // position the vertical frames 
424           if ( i > 2) { 
425             GetEnvelopes(4)->AddEnvelopeConstituent("S05V", idSlatCh5, 
426                                                     (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
427             GetEnvelopes(4)->AddEnvelopeConstituent("S05V", idSlatCh5, 
428                                                     (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
429             GetEnvelopes(5)->AddEnvelopeConstituent("S06V", idSlatCh6, 
430                                                     (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
431             GetEnvelopes(5)->AddEnvelopeConstituent("S06V", idSlatCh6, 
432                                                     (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));   
433           } 
434
435           if (i == 2) {
436             GetEnvelopes(4)->AddEnvelopeConstituent("S05V", idSlatCh5, 
437                                                     (2*i-1)*10+quadrant,TGeoTranslation(xvFrame2,0.,0.));
438             GetEnvelopes(4)->AddEnvelopeConstituent("S05V", idSlatCh5, 
439                                                     (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
440             GetEnvelopes(5)->AddEnvelopeConstituent("S06V", idSlatCh6, 
441                                                     (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
442             GetEnvelopes(5)->AddEnvelopeConstituent("S06V", idSlatCh6, 
443                                                     (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
444           }
445
446           if (i == 0 || i == 1) { // no rounded spacer for the moment (Ch. Finck)
447             GetEnvelopes(4)->AddEnvelopeConstituent("S05V", idSlatCh5, 
448                                                     (2*i-1)*10+quadrant,TGeoTranslation(xvFrame2,0.,0.));
449             GetEnvelopes(5)->AddEnvelopeConstituent("S06V", idSlatCh6, 
450                                                     (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
451           }
452
453           // position the panels and the insulating material 
454           for (j = 0; j < kNPCB3[i]; j++){
455             if (i == 1 && j == 0) continue;
456             if (i == 0 && j == 0) continue;
457             index++;
458             Float_t xx = kSensLength * (-kNPCB3[i]/2. + j + 0.5); 
459             Float_t xx2 = xx - pcbDLength3/2.; 
460          
461             Float_t zPanel = spar[2] - nomexbpar[2]; 
462
463             if ( (i == 0 || i == 1 || i == 2) && j == kNPCB3[i]-1) { // 1 pcb is shortened by 5cm 
464               GetEnvelopes(4)->AddEnvelopeConstituent("SB5X", idSlatCh5, 2*index-1,TGeoTranslation(xx2,0.,zPanel));
465               GetEnvelopes(4)->AddEnvelopeConstituent("SB5X", idSlatCh5, 2*index,TGeoTranslation(xx2,0.,-zPanel));
466               GetEnvelopes(4)->AddEnvelopeConstituent("SB5I", idSlatCh5, index,TGeoTranslation(xx2,0.,0.));
467             } else {
468               GetEnvelopes(4)->AddEnvelopeConstituent("S05X", idSlatCh5, 2*index-1,TGeoTranslation(xx,0.,zPanel));
469               GetEnvelopes(4)->AddEnvelopeConstituent("S05X", idSlatCh5, 2*index,TGeoTranslation(xx,0.,-zPanel));
470               GetEnvelopes(4)->AddEnvelopeConstituent("S05I", idSlatCh5, index,TGeoTranslation(xx,0.,0.));
471             }
472             GetEnvelopes(5)->AddEnvelopeConstituent("S06X", idSlatCh6, 2*index-1,TGeoTranslation(xx,0.,zPanel));
473             GetEnvelopes(5)->AddEnvelopeConstituent("S06X", idSlatCh6, 2*index,TGeoTranslation(xx,0.,-zPanel));
474             GetEnvelopes(5)->AddEnvelopeConstituent("S06I", idSlatCh6, index,TGeoTranslation(xx,0.,0.));
475  
476           } 
477         }
478       }
479
480       // position the nomex volume inside the panel volume
481       gMC->Gspos("S05N",1,"S05C",0.,0.,0.,0,"ONLY"); 
482       gMC->Gspos("SB5N",1,"SB5C",0.,0.,0.,0,"ONLY"); 
483       gMC->Gspos("S06N",1,"S06C",0.,0.,0.,0,"ONLY"); 
484   
485       // position panel volume inside the bulk nomex material volume
486       gMC->Gspos("S05C",1,"S05X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
487       gMC->Gspos("SB5C",1,"SB5X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
488       gMC->Gspos("S06C",1,"S06X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
489
490       // position the PCB volume inside the insulating material volume
491       gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY"); 
492       gMC->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY"); 
493       gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY"); 
494   
495       // position the horizontal frame volume inside the PCB volume
496       gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY"); 
497       gMC->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY"); 
498       gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY"); 
499   
500       // position the sensitive volume inside the horizontal frame volume
501       gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3); 
502       gMC->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3); 
503       gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3); 
504   
505  
506       // position the border volumes inside the PCB volume
507       Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.; 
508       gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY"); 
509       gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY"); 
510       gMC->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY"); 
511       gMC->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY"); 
512
513       gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY"); 
514       gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY"); 
515   
516       // create the NULOC volume and position it in the horizontal frame
517       gMC->Gsvolu("S05E","BOX",kNulocMaterial,nulocpar,3);
518       gMC->Gsvolu("S06E","BOX",kNulocMaterial,nulocpar,3);
519       index = 0;
520       Float_t xxmax2 = xxmax - pcbDLength3/2.;
521       for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) { 
522         index++; 
523         gMC->Gspos("S05E",2*index-1,"S05B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
524         gMC->Gspos("S05E",2*index  ,"S05B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
525         gMC->Gspos("S06E",2*index-1,"S06B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
526         gMC->Gspos("S06E",2*index  ,"S06B", xx, 0., kBframeWidth/2.-  kNulocWidth/2, 0, "ONLY");
527         if (xx > -xxmax2 && xx< xxmax2) {
528           gMC->Gspos("S05E",2*index-1,"SB5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
529           gMC->Gspos("S05E",2*index  ,"SB5B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
530         }
531       }
532
533       // position the volumes approximating the circular section of the pipe
534       Float_t epsilon = 0.001; 
535       Int_t ndiv = 6;
536       Int_t imax = 1;
537       Double_t divpar[3];
538       Double_t dydiv = kSensHeight/ndiv;
539       Double_t ydiv  = (kSensHeight - dydiv)/2.;
540       Double_t rmin  = AliMUONConstants::Rmin(2);// Same radius for both chamber in St3
541       Double_t xdiv  = 0.;
542       Float_t xvol;
543       Float_t yvol;
544
545       for (Int_t idiv = 0; idiv < ndiv; idiv++){ 
546         ydiv += dydiv;
547         xdiv = 0.; 
548         if (ydiv < rmin) xdiv = rmin * TMath::Sin( TMath::ACos((ydiv-dydiv/2.)/rmin) );
549         divpar[0] = (kPcbLength - xdiv)/2.; 
550         divpar[1] = dydiv/2. - epsilon;
551         divpar[2] = kSensWidth/2.; 
552         xvol = (kPcbLength + xdiv)/2.;
553         yvol = ydiv; 
554
555         // Volumes close to the beam pipe for slat i=1 so 4 slats per chamber
556         for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
557           sprintf(idSlatCh5,"LA%d",ConvertSlatNum(1,quadrant,kNslats3-1));
558           sprintf(idSlatCh6,"LB%d",ConvertSlatNum(1,quadrant,kNslats3-1));
559
560           GetEnvelopes(4)->AddEnvelopeConstituentParam("S05G", idSlatCh5, quadrant*100+imax+4*idiv+1,
561                                                        TGeoTranslation(xvol-(kPcbLength * kNPCB3[1]/2.),yvol-kPcbLength,0.),3,divpar);
562
563           GetEnvelopes(5)->AddEnvelopeConstituentParam("S06G", idSlatCh6,  quadrant*100+imax+4*idiv+1,
564                                                        TGeoTranslation(xvol-(kPcbLength * kNPCB3[1]/2.),yvol-kPcbLength,0.),3,divpar);
565         }
566       }
567
568       // Volumes close to the beam pipe for slat i=0 so 2 slats per chamber (central slat for station 3)
569       //      Gines Martinez, Subatech sep 04
570       // 9 box volumes are used to define the PCB closed to the beam pipe of the slat 122000SR1 of chamber 5 and 6 of St3
571       // Accordingly to plan PQ-LAT-SR1 of CEA-DSM-DAPNIA-SIS/BE ph HARDY 8-Oct-2002
572       // Rmin = 31.5 cm
573       rmin = AliMUONConstants::Rmin(2); // Same radius for both chamber in St3
574       ndiv  = 9; 
575       dydiv = kSensHeight/ndiv;           // Vertical size of the box volume approximating the rounded PCB
576       ydiv  = -kSensHeight/2 + dydiv/2.;   // Initializing vertical position of the volume from bottom
577       xdiv  = 0.;                         // Initializing horizontal position of the box volumes
578
579       for (Int_t idiv = 0; idiv < ndiv; idiv++){ 
580         xdiv = TMath::Abs( rmin * TMath::Sin( TMath::ACos(ydiv/rmin) ) );
581         divpar[0] = (kPcbLength - xdiv)/2.; // Dimension of the box volume
582         divpar[1] = dydiv/2. - epsilon;
583         divpar[2] = kSensWidth/2.; 
584         xvol = (kPcbLength + xdiv)/2.; //2D traslition for positionning of box volume
585         yvol =  ydiv;
586         Int_t side;
587         for (side = 1; side <= 2; side++) {
588           sprintf(idSlatCh5,"LA%d",4);     
589           sprintf(idSlatCh6,"LB%d",4);
590           if(side == 2) {
591             sprintf(idSlatCh5,"LA%d",13);          
592             sprintf(idSlatCh6,"LB%d",13);
593           }        
594           GetEnvelopes(4)->AddEnvelopeConstituentParam("S05G", idSlatCh5,500+side*100+imax+4*idiv+1,
595                                                        TGeoTranslation(xvol-(kPcbLength * kNPCB3[0]/2.),yvol,0.),3,divpar);
596
597           GetEnvelopes(5)->AddEnvelopeConstituentParam("S06G", idSlatCh6,500+side*100+imax+4*idiv+1,
598                                                        TGeoTranslation(xvol-(kPcbLength * kNPCB3[0]/2.),yvol,0.),3,divpar);
599         }
600         ydiv += dydiv; // Going from bottom to top
601       }
602       // cout << "Geometry for Station 3...... done" << endl;   
603     }
604     
605   if (fStations[3]) {
606
607
608     // //********************************************************************
609     // //                            Station 4                             **
610     // //********************************************************************
611     //      // indices 1 and 2 for first and second chambers in the station
612     //      // iChamber (first chamber) kept for other quanties than Z,
613     //      // assumed to be the same in both chambers
614     //      corrected geometry (JP. Cussonneau, Ch. Finck)
615  
616     iChamber = &fMUON->Chamber(6);
617     iChamber1 = iChamber;
618     iChamber2 = &fMUON->Chamber(7);
619
620     const Int_t   kNslats4          = 7;  // number of slats per quadrant
621     const Int_t   kNPCB4[kNslats4]  = {5, 6, 5, 5, 4, 3, 2}; // n PCB per slat
622     const Float_t kXpos4[kNslats4]  = {38.2, 0., 0., 0., 0., 0., 0.};
623     const Float_t kYpos41[kNslats4] = {0., 38.2, 34.40, 36.60, 29.3, 37.0, 28.6};
624     const Float_t kYpos42[kNslats4] = {0., 38.2, 37.85, 37.55, 29.4, 37.0, 28.6};
625
626     Float_t slatLength4[kNslats4];     
627
628
629     // Mother volume for each chamber
630     // Outer excess and inner recess for mother volume radius
631     // with respect to ROuter and RInner
632     Float_t dMotherInner =  AliMUONConstants::Rmin(3)-kRframeHeight; 
633     // Additional 40 cm gap is needed to wrap the corners of the slats since Rmax represent the maximum active radius of the chamber with 2pi phi acceptance 
634     Float_t dMotherOutner= AliMUONConstants::Rmax(3)+kVframeLength + 40.0;
635     Float_t tpar[3];
636     Double_t dstation =  ( (-AliMUONConstants::DefaultChamberZ(7)) - 
637                            (-AliMUONConstants::DefaultChamberZ(6)) ) /2.2;
638     tpar[0] = dMotherInner; 
639     tpar[1] = dMotherOutner;
640     tpar[2] = dstation;
641     gMC->Gsvolu("CH07", "TUBE", idAir, tpar, 3);
642     gMC->Gsvolu("CH08", "TUBE", idAir, tpar, 3);
643     
644     // create and position the slat (mother) volumes 
645
646     char idSlatCh7[5];
647     char idSlatCh8[5];
648     Float_t xSlat4;
649     Float_t ySlat41 = 0;
650     Float_t ySlat42 = 0;
651
652     angle = 0.;
653
654     for (i = 0; i<kNslats4; i++){
655       slatLength4[i] = kPcbLength * kNPCB4[i] + 2. * kVframeLength; 
656       xSlat4 = slatLength4[i]/2. + kDslatLength + kXpos4[i]; 
657       ySlat41 += kYpos41[i];
658       ySlat42 += kYpos42[i];
659
660       spar[0] = slatLength4[i]/2.; 
661       spar[1] = kSlatHeight/2.;
662       spar[2] = kSlatWidth/2.; 
663       Float_t dzCh4 = dzCh;
664       Float_t zSlat4 = (i%2 ==0)? -zSlat : zSlat; 
665
666       sprintf(idSlatCh7,"LC%d",kNslats4-1+i);
667       //gMC->Gsvolu(idSlatCh7,"BOX",kSlatMaterial,spar,3);
668       detElemId = 713 - (i + kNslats4-1-6);
669       GetEnvelopes(6)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(xSlat4, ySlat41, -zSlat4 + dzCh4),
670                                    TGeoRotation("rot1",90,angle,90,90+angle,0,0) );
671
672       sprintf(idSlatCh7,"LC%d",3*kNslats4-2+i);
673       //gMC->Gsvolu(idSlatCh7,"BOX",kSlatMaterial,spar,3);
674       detElemId = 700 + (i + kNslats4-1-6);
675       GetEnvelopes(6)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(-xSlat4, ySlat41, zSlat4 - dzCh4),
676                                    TGeoRotation("rot2",90,180+angle,90,90+angle,180,0) );
677  
678       if (i > 0) { 
679         sprintf(idSlatCh7,"LC%d",kNslats4-1-i);
680         //gMC->Gsvolu(idSlatCh7,"BOX",kSlatMaterial,spar,3);
681         detElemId = 713 + (i + kNslats4-1-6);
682         GetEnvelopes(6)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(xSlat4, -ySlat41, -zSlat4 + dzCh4),
683                                      TGeoRotation("rot3",90,angle,90,270+angle,180,0) );
684
685         sprintf(idSlatCh7,"LC%d",3*kNslats4-2-i);
686         detElemId = 726 - (i + kNslats4-1-6);
687         //gMC->Gsvolu(idSlatCh7,"BOX",kSlatMaterial,spar,3);
688         GetEnvelopes(6)->AddEnvelope(idSlatCh7, detElemId, true, 
689                                      TGeoTranslation(-xSlat4, -ySlat41, zSlat4 - dzCh4),
690                                      TGeoRotation("rot4",90,180+angle,90,270+angle,0,0) );
691       }
692
693       sprintf(idSlatCh8,"LD%d",kNslats4-1+i);
694       //gMC->Gsvolu(idSlatCh8,"BOX",kSlatMaterial,spar,3);
695       detElemId = 813 - (i + kNslats4-1-6);
696       GetEnvelopes(7)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(xSlat4, ySlat42, -zSlat4 + dzCh4),
697                                    TGeoRotation("rot5",90,angle,90,90+angle,0,0) );
698
699       sprintf(idSlatCh8,"LD%d",3*kNslats4-2+i);
700       detElemId = 800 + (i + kNslats4-1-6);
701       //gMC->Gsvolu(idSlatCh8,"BOX",kSlatMaterial,spar,3);
702       GetEnvelopes(7)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(-xSlat4, ySlat42, zSlat4 - dzCh4),
703                                    TGeoRotation("rot6",90,180+angle,90,90+angle,180,0) );
704       if (i > 0) { 
705         sprintf(idSlatCh8,"LD%d",kNslats4-1-i);
706         detElemId = 813 + (i + kNslats4-1-6);
707         //gMC->Gsvolu(idSlatCh8,"BOX",kSlatMaterial,spar,3);
708         GetEnvelopes(7)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(xSlat4, -ySlat42, -zSlat4 + dzCh4),
709                                      TGeoRotation("rot7",90,angle,90,270+angle,180,0) );
710         sprintf(idSlatCh8,"LD%d",3*kNslats4-2-i);
711         detElemId = 826 - (i + kNslats4-1-6);
712         //gMC->Gsvolu(idSlatCh8,"BOX",kSlatMaterial,spar,3);
713         GetEnvelopes(7)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(-xSlat4, -ySlat42, zSlat4 - dzCh4),
714                                      TGeoRotation("rot8",90,180+angle,90,270+angle,0,0) );
715       }
716     }
717      
718     // create the panel volume 
719  
720     gMC->Gsvolu("S07C","BOX",kCarbonMaterial,panelpar,3);
721     gMC->Gsvolu("S08C","BOX",kCarbonMaterial,panelpar,3);
722
723     // create the nomex volume 
724
725     gMC->Gsvolu("S07N","BOX",kNomexMaterial,nomexpar,3);
726     gMC->Gsvolu("S08N","BOX",kNomexMaterial,nomexpar,3);
727
728
729     // create the nomex volume (bulk)
730
731     gMC->Gsvolu("S07X","BOX",kNomexBMaterial,nomexbpar,3);
732     gMC->Gsvolu("S08X","BOX",kNomexBMaterial,nomexbpar,3);
733
734     // create the insulating material volume 
735
736     gMC->Gsvolu("S07I","BOX",kInsuMaterial,insupar,3);
737     gMC->Gsvolu("S08I","BOX",kInsuMaterial,insupar,3);
738
739     // create the PCB volume 
740
741     gMC->Gsvolu("S07P","BOX",kPcbMaterial,pcbpar,3);
742     gMC->Gsvolu("S08P","BOX",kPcbMaterial,pcbpar,3);
743  
744     // create the sensitive volumes,
745
746     gMC->Gsvolu("S07G","BOX",kSensMaterial,dum,0);
747     gMC->Gsvolu("S08G","BOX",kSensMaterial,dum,0);
748
749     // create the vertical frame volume 
750
751     gMC->Gsvolu("S07V","BOX",kVframeMaterial,vFramepar,3);
752     gMC->Gsvolu("S08V","BOX",kVframeMaterial,vFramepar,3);
753
754     // create the horizontal frame volume 
755
756     gMC->Gsvolu("S07H","BOX",kHframeMaterial,hFramepar,3);
757     gMC->Gsvolu("S08H","BOX",kHframeMaterial,hFramepar,3);
758
759     // create the horizontal border volume 
760
761     gMC->Gsvolu("S07B","BOX",kBframeMaterial,bFramepar,3);
762     gMC->Gsvolu("S08B","BOX",kBframeMaterial,bFramepar,3);
763
764     index = 0; 
765     for (i = 0; i < kNslats4; i++){
766       for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
767
768         if (i == 0 && quadrant == 2) continue;
769         if (i == 0 && quadrant == 4) continue;
770
771         sprintf(idSlatCh7,"LC%d",ConvertSlatNum(i,quadrant,kNslats4-1));
772         sprintf(idSlatCh8,"LD%d",ConvertSlatNum(i,quadrant,kNslats4-1));
773         Float_t xvFrame  = (slatLength4[i] - kVframeLength)/2.;
774
775         // position the vertical frames 
776         if (i != 1) { 
777           GetEnvelopes(6)->AddEnvelopeConstituent("S07V", idSlatCh7, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
778           GetEnvelopes(6)->AddEnvelopeConstituent("S07V", idSlatCh7, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
779           GetEnvelopes(7)->AddEnvelopeConstituent("S08V", idSlatCh8, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
780           GetEnvelopes(7)->AddEnvelopeConstituent("S08V", idSlatCh8, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
781         } else { // no rounded spacer yet
782           GetEnvelopes(6)->AddEnvelopeConstituent("S07V", idSlatCh7, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
783           // GetEnvelopes(6)->AddEnvelopeConstituent("S07V", idSlatCh7, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
784           GetEnvelopes(7)->AddEnvelopeConstituent("S08V", idSlatCh8, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
785           // GetEnvelopes(7)->AddEnvelopeConstituent("S08V", idSlatCh8, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
786         }
787         // position the panels and the insulating material 
788         for (j = 0; j < kNPCB4[i]; j++){
789           if (i == 1 && j == 0) continue;
790           index++;
791           Float_t xx = kSensLength * (-kNPCB4[i]/2.+j+.5); 
792
793           Float_t zPanel = spar[2] - nomexbpar[2]; 
794           GetEnvelopes(6)->AddEnvelopeConstituent("S07X", idSlatCh7, 2*index-1,TGeoTranslation(xx,0.,zPanel));
795           GetEnvelopes(6)->AddEnvelopeConstituent("S07X", idSlatCh7, 2*index,TGeoTranslation(xx,0.,-zPanel));
796           GetEnvelopes(6)->AddEnvelopeConstituent("S07I", idSlatCh7, index,TGeoTranslation(xx,0.,0.));
797           GetEnvelopes(7)->AddEnvelopeConstituent("S08X", idSlatCh8, 2*index-1,TGeoTranslation(xx,0.,zPanel));
798           GetEnvelopes(7)->AddEnvelopeConstituent("S08X", idSlatCh8, 2*index,TGeoTranslation(xx,0.,-zPanel));
799           GetEnvelopes(7)->AddEnvelopeConstituent("S08I", idSlatCh8, index,TGeoTranslation(xx,0.,0.));
800         }
801       } 
802     }
803
804     // position the nomex volume inside the panel volume
805     gMC->Gspos("S07N",1,"S07C",0.,0.,0.,0,"ONLY"); 
806     gMC->Gspos("S08N",1,"S08C",0.,0.,0.,0,"ONLY"); 
807
808     // position panel volume inside the bulk nomex material volume
809     gMC->Gspos("S07C",1,"S07X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
810     gMC->Gspos("S08C",1,"S08X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
811
812     // position the PCB volume inside the insulating material volume
813     gMC->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY"); 
814     gMC->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY"); 
815
816     // position the horizontal frame volume inside the PCB volume
817     gMC->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY"); 
818     gMC->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY"); 
819
820     // position the sensitive volume inside the horizontal frame volume
821     gMC->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3); 
822     gMC->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3); 
823
824     // position the border volumes inside the PCB volume
825     Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.; 
826     gMC->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY"); 
827     gMC->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY"); 
828     gMC->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY"); 
829     gMC->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY"); 
830
831     // create the NULOC volume and position it in the horizontal frame
832
833     gMC->Gsvolu("S07E","BOX",kNulocMaterial,nulocpar,3);
834     gMC->Gsvolu("S08E","BOX",kNulocMaterial,nulocpar,3);
835     index = 0;
836     for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) { 
837       index++; 
838       gMC->Gspos("S07E",2*index-1,"S07B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
839       gMC->Gspos("S07E",2*index  ,"S07B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
840       gMC->Gspos("S08E",2*index-1,"S08B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
841       gMC->Gspos("S08E",2*index  ,"S08B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
842     }
843
844     // position the volumes approximating the circular section of the pipe
845
846     Float_t epsilon = 0.001; 
847     Int_t ndiv = 10;
848     Int_t imax = 1; 
849     Double_t divpar[3];
850     Double_t dydiv = kSensHeight/ndiv;
851     Double_t ydiv  = (kSensHeight - dydiv)/2.;
852     Float_t rmin   = AliMUONConstants::Rmin(3); // Same radius for both chamber of St4
853     Float_t xdiv   = 0.; 
854     Float_t xvol;
855     Float_t yvol;
856
857     for (Int_t idiv = 0; idiv < ndiv; idiv++){ 
858       ydiv += dydiv;
859       xdiv = 0.; 
860       if (ydiv < rmin) xdiv = rmin * TMath::Sin( TMath::ACos((ydiv-dydiv/2.)/rmin) );
861       divpar[0] = (kPcbLength - xdiv)/2.; 
862       divpar[1] = dydiv/2. - epsilon;
863       divpar[2] = kSensWidth/2.; 
864       xvol = (kPcbLength + xdiv)/2.;
865       yvol = ydiv ;
866        
867       for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
868         sprintf(idSlatCh7,"LC%d",ConvertSlatNum(1,quadrant,kNslats4-1));
869         sprintf(idSlatCh8,"LD%d",ConvertSlatNum(1,quadrant,kNslats4-1));
870          
871         GetEnvelopes(6)->AddEnvelopeConstituentParam("S07G",idSlatCh7, quadrant*100+imax+4*idiv+1,
872                                                      TGeoTranslation(xvol-kPcbLength * kNPCB4[1]/2.,yvol-kPcbLength,0.),3,divpar);
873          
874         GetEnvelopes(7)->AddEnvelopeConstituentParam("S08G", idSlatCh8, quadrant*100+imax+4*idiv+1,
875                                                      TGeoTranslation(xvol-kPcbLength * kNPCB4[1]/2.,yvol-kPcbLength,0.),3,divpar);
876       }
877     }
878     // cout << "Geometry for Station 4...... done" << endl;
879
880   }
881     
882   if (fStations[4]) {
883       
884
885     // //********************************************************************
886     // //                            Station 5                             **
887     // //********************************************************************
888     //      // indices 1 and 2 for first and second chambers in the station
889     //      // iChamber (first chamber) kept for other quanties than Z,
890     //      // assumed to be the same in both chambers
891     //      corrected geometry (JP. Cussonneau, Ch. Finck)
892
893     iChamber = &fMUON->Chamber(8);
894     iChamber1 = iChamber;
895     iChamber2 = &fMUON->Chamber(9);
896  
897     const Int_t   kNslats5         = 7;  // number of slats per quadrant
898     const Int_t   kNPCB5[kNslats5] = {5, 6, 6, 6, 5, 4, 3}; // n PCB per slat
899     const Float_t kXpos5[kNslats5] = {38.2, 0., 0., 0., 0., 0., 0.};
900     const Float_t kYpos5[kNslats5] = {0., 38.2, 37.9, 37.6, 37.3, 37.05, 36.75};
901     Float_t slatLength5[kNslats5]; 
902
903     // Mother volume for each chamber
904     // Outer excess and inner recess for mother volume radius
905     // with respect to ROuter and RInner
906     Float_t dMotherInner =  AliMUONConstants::Rmin(4)-kRframeHeight; 
907     // Additional 40 cm gap is needed to wrap the corners of the slats since Rmax represent the maximum active radius of the chamber with 2pi phi acceptance 
908     Float_t dMotherOutner= AliMUONConstants::Rmax(4)+kVframeLength + 40.0;
909     Float_t tpar[3];
910     Double_t dstation =  ( (-AliMUONConstants::DefaultChamberZ(9)) - 
911                            (-AliMUONConstants::DefaultChamberZ(8)) ) /2.3;
912     tpar[0] = dMotherInner; 
913     tpar[1] = dMotherOutner;
914     tpar[2] = dstation;
915     gMC->Gsvolu("CH09", "TUBE", idAir, tpar, 3);
916     gMC->Gsvolu("CH10", "TUBE", idAir, tpar, 3);
917
918     // create and position the slat (mother) volumes 
919
920     char idSlatCh9[5];
921     char idSlatCh10[5];
922     Float_t xSlat5;
923     Float_t ySlat5 = 0;
924     angle = 0.;
925
926     for (i = 0; i < kNslats5; i++){
927
928       slatLength5[i] = kPcbLength * kNPCB5[i] + 2.* kVframeLength; 
929       xSlat5 = slatLength5[i]/2. + kDslatLength + kXpos5[i]; 
930       ySlat5 += kYpos5[i];
931
932       spar[0] = slatLength5[i]/2.; 
933       spar[1] = kSlatHeight/2.;
934       spar[2] = kSlatWidth/2.; 
935
936       Float_t dzCh5  = dzCh;
937       Float_t zSlat5 = (i%2 ==0)? -zSlat : zSlat; 
938
939       sprintf(idSlatCh9,"LE%d",kNslats5-1+i);
940       detElemId = 913 - (i + kNslats5-1-6);
941       //gMC->Gsvolu(idSlatCh9,"BOX",kSlatMaterial,spar,3);
942       GetEnvelopes(8)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(xSlat5, ySlat5, -zSlat5 + dzCh5),
943                                    TGeoRotation("rot1",90,angle,90,90+angle,0,0) );
944
945       sprintf(idSlatCh9,"LE%d",3*kNslats5-2+i);
946       detElemId = 900 + (i + kNslats5-1-6);
947       //gMC->Gsvolu(idSlatCh9,"BOX",kSlatMaterial,spar,3);
948       GetEnvelopes(8)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(-xSlat5, ySlat5, zSlat5 - dzCh5),
949                                    TGeoRotation("rot2",90,180+angle,90,90+angle,180,0) );
950  
951       if (i > 0) { 
952         sprintf(idSlatCh9,"LE%d",kNslats5-1-i);
953         detElemId = 913 + (i + kNslats5-1-6);
954         //gMC->Gsvolu(idSlatCh9,"BOX",kSlatMaterial,spar,3);
955         GetEnvelopes(8)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(xSlat5, -ySlat5, -zSlat5 + dzCh5),
956                                      TGeoRotation("rot3",90,angle,90,270+angle,180,0) );
957
958         sprintf(idSlatCh9,"LE%d",3*kNslats5-2-i);
959         detElemId = 926 - (i + kNslats5-1-6);
960         //gMC->Gsvolu(idSlatCh9,"BOX",kSlatMaterial,spar,3);
961         GetEnvelopes(8)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(-xSlat5, -ySlat5, zSlat5 - dzCh5),
962                                      TGeoRotation("rot4",90,180+angle,90,270+angle,0,0)  );
963       }
964
965       sprintf(idSlatCh10,"LF%d",kNslats5-1+i);
966       detElemId = 1013 - (i + kNslats5-1-6);
967       //gMC->Gsvolu(idSlatCh10,"BOX",kSlatMaterial,spar,3);
968       GetEnvelopes(9)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(xSlat5, ySlat5, -zSlat5 + dzCh5),
969                                    TGeoRotation("rot5",90,angle,90,90+angle,0,0) );
970
971       sprintf(idSlatCh10,"LF%d",3*kNslats5-2+i);
972       detElemId = 1000 + (i + kNslats5-1-6);
973       //gMC->Gsvolu(idSlatCh10,"BOX",kSlatMaterial,spar,3);
974       GetEnvelopes(9)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(-xSlat5, ySlat5, zSlat5 - dzCh5),
975                                    TGeoRotation("rot6",90,180+angle,90,90+angle,180,0) );
976
977       if (i > 0) { 
978         sprintf(idSlatCh10,"LF%d",kNslats5-1-i);
979         detElemId = 1013 + (i + kNslats5-1-6);
980         //gMC->Gsvolu(idSlatCh10,"BOX",kSlatMaterial,spar,3);
981         GetEnvelopes(9)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(xSlat5, -ySlat5, -zSlat5 + dzCh5),
982                                      TGeoRotation("rot7",90,angle,90,270+angle,180,0) );
983         sprintf(idSlatCh10,"LF%d",3*kNslats5-2-i);
984         detElemId = 1026 - (i + kNslats5-1-6);
985         //gMC->Gsvolu(idSlatCh10,"BOX",kSlatMaterial,spar,3);
986         GetEnvelopes(9)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(-xSlat5, -ySlat5, zSlat5 - dzCh5),
987                                      TGeoRotation("rot8",90,180+angle,90,270+angle,0,0) );
988       }
989     }
990
991     // create the panel volume 
992  
993     gMC->Gsvolu("S09C","BOX",kCarbonMaterial,panelpar,3);
994     gMC->Gsvolu("S10C","BOX",kCarbonMaterial,panelpar,3);
995
996     // create the nomex volume 
997
998     gMC->Gsvolu("S09N","BOX",kNomexMaterial,nomexpar,3);
999     gMC->Gsvolu("S10N","BOX",kNomexMaterial,nomexpar,3);
1000
1001
1002     // create the nomex volume (bulk)
1003
1004     gMC->Gsvolu("S09X","BOX",kNomexBMaterial,nomexbpar,3);
1005     gMC->Gsvolu("S10X","BOX",kNomexBMaterial,nomexbpar,3);
1006
1007     // create the insulating material volume 
1008
1009     gMC->Gsvolu("S09I","BOX",kInsuMaterial,insupar,3);
1010     gMC->Gsvolu("S10I","BOX",kInsuMaterial,insupar,3);
1011
1012     // create the PCB volume 
1013
1014     gMC->Gsvolu("S09P","BOX",kPcbMaterial,pcbpar,3);
1015     gMC->Gsvolu("S10P","BOX",kPcbMaterial,pcbpar,3);
1016  
1017     // create the sensitive volumes,
1018
1019     gMC->Gsvolu("S09G","BOX",kSensMaterial,dum,0);
1020     gMC->Gsvolu("S10G","BOX",kSensMaterial,dum,0);
1021
1022     // create the vertical frame volume 
1023
1024     gMC->Gsvolu("S09V","BOX",kVframeMaterial,vFramepar,3);
1025     gMC->Gsvolu("S10V","BOX",kVframeMaterial,vFramepar,3);
1026
1027     // create the horizontal frame volume 
1028
1029     gMC->Gsvolu("S09H","BOX",kHframeMaterial,hFramepar,3);
1030     gMC->Gsvolu("S10H","BOX",kHframeMaterial,hFramepar,3);
1031
1032     // create the horizontal border volume 
1033
1034     gMC->Gsvolu("S09B","BOX",kBframeMaterial,bFramepar,3);
1035     gMC->Gsvolu("S10B","BOX",kBframeMaterial,bFramepar,3);
1036
1037     index = 0; 
1038     for (i = 0; i < kNslats5; i++){
1039       for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
1040
1041         if (i == 0 && quadrant == 2) continue;
1042         if (i == 0 && quadrant == 4) continue;
1043
1044         sprintf(idSlatCh9,"LE%d",ConvertSlatNum(i,quadrant,kNslats5-1));
1045         sprintf(idSlatCh10,"LF%d",ConvertSlatNum(i,quadrant,kNslats5-1));
1046         Float_t xvFrame  = (slatLength5[i] - kVframeLength)/2.; // ok
1047
1048         // position the vertical frames (spacers)
1049         if (i != 1) { 
1050           GetEnvelopes(8)->AddEnvelopeConstituent("S09V", idSlatCh9, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
1051           GetEnvelopes(8)->AddEnvelopeConstituent("S09V", idSlatCh9, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
1052           GetEnvelopes(9)->AddEnvelopeConstituent("S10V", idSlatCh10, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
1053           GetEnvelopes(9)->AddEnvelopeConstituent("S10V", idSlatCh10, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
1054         } else {  // no rounded spacer yet
1055           GetEnvelopes(8)->AddEnvelopeConstituent("S09V", idSlatCh9, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
1056           //       GetEnvelopes(8)->AddEnvelopeConstituent("S09V", idSlatCh9, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
1057           GetEnvelopes(9)->AddEnvelopeConstituent("S10V", idSlatCh10, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
1058           //       GetEnvelopes(9)->AddEnvelopeConstituent("S10V", idSlatCh10, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
1059         }
1060
1061         // position the panels and the insulating material 
1062         for (j = 0; j < kNPCB5[i]; j++){
1063           if (i == 1 && j == 0) continue;
1064           index++;
1065           Float_t xx = kSensLength * (-kNPCB5[i]/2.+j+.5); 
1066
1067           Float_t zPanel = spar[2] - nomexbpar[2]; 
1068           GetEnvelopes(8)->AddEnvelopeConstituent("S09X", idSlatCh9, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1069           GetEnvelopes(8)->AddEnvelopeConstituent("S09X", idSlatCh9, 2*index,TGeoTranslation(xx,0.,-zPanel));
1070           GetEnvelopes(8)->AddEnvelopeConstituent("S09I", idSlatCh9, index,TGeoTranslation(xx,0.,0.));
1071
1072           GetEnvelopes(9)->AddEnvelopeConstituent("S10X", idSlatCh10, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1073           GetEnvelopes(9)->AddEnvelopeConstituent("S10X", idSlatCh10, 2*index,TGeoTranslation(xx,0.,-zPanel));
1074           GetEnvelopes(9)->AddEnvelopeConstituent("S10I", idSlatCh10, index,TGeoTranslation(xx,0.,0.));
1075         }
1076       } 
1077     }
1078
1079     // position the nomex volume inside the panel volume
1080     gMC->Gspos("S09N",1,"S09C",0.,0.,0.,0,"ONLY"); 
1081     gMC->Gspos("S10N",1,"S10C",0.,0.,0.,0,"ONLY"); 
1082
1083     // position panel  volume inside the bulk nomex material volume
1084     gMC->Gspos("S09C",1,"S09X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
1085     gMC->Gspos("S10C",1,"S10X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
1086
1087     // position the PCB volume inside the insulating material volume
1088     gMC->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY"); 
1089     gMC->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY"); 
1090
1091     // position the horizontal frame volume inside the PCB volume
1092     gMC->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY"); 
1093     gMC->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY"); 
1094
1095     // position the sensitive volume inside the horizontal frame volume
1096     gMC->Gsposp("S09G",1,"S09H",0.,0.,0.,0,"ONLY",senspar,3); 
1097     gMC->Gsposp("S10G",1,"S10H",0.,0.,0.,0,"ONLY",senspar,3); 
1098
1099     // position the border volumes inside the PCB volume
1100     Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.; 
1101     gMC->Gspos("S09B",1,"S09P",0., yborder,0.,0,"ONLY"); 
1102     gMC->Gspos("S09B",2,"S09P",0.,-yborder,0.,0,"ONLY"); 
1103     gMC->Gspos("S10B",1,"S10P",0., yborder,0.,0,"ONLY"); 
1104     gMC->Gspos("S10B",2,"S10P",0.,-yborder,0.,0,"ONLY"); 
1105
1106     //      // create the NULOC volume and position it in the horizontal frame
1107
1108     gMC->Gsvolu("S09E","BOX",kNulocMaterial,nulocpar,3);
1109     gMC->Gsvolu("S10E","BOX",kNulocMaterial,nulocpar,3);
1110     index = 0;
1111     for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) { 
1112       index++; 
1113       gMC->Gspos("S09E",2*index-1,"S09B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
1114       gMC->Gspos("S09E",2*index  ,"S09B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
1115       gMC->Gspos("S10E",2*index-1,"S10B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
1116       gMC->Gspos("S10E",2*index  ,"S10B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
1117     }
1118
1119
1120     // position the volumes approximating the circular section of the pipe
1121     Float_t epsilon = 0.001; 
1122     Int_t ndiv = 10;
1123     Int_t imax = 1; 
1124     Double_t divpar[3];
1125     Double_t dydiv = kSensHeight/ndiv;
1126     Double_t ydiv  = (kSensHeight - dydiv)/2.;
1127     Float_t rmin   = AliMUONConstants::Rmin(4);
1128     Float_t xdiv   = 0.; 
1129     Float_t xvol;
1130     Float_t yvol; 
1131
1132     for (Int_t idiv = 0; idiv < ndiv; idiv++){ 
1133       ydiv += dydiv;
1134       xdiv = 0.; 
1135       if (ydiv < rmin) xdiv = rmin * TMath::Sin( TMath::ACos((ydiv-dydiv/2.)/rmin) );
1136       divpar[0] = (kPcbLength - xdiv)/2.; 
1137       divpar[1] = dydiv/2. - epsilon;
1138       divpar[2] = kSensWidth/2.; 
1139       xvol = (kPcbLength + xdiv)/2.;
1140       yvol = ydiv;
1141
1142       for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
1143         sprintf(idSlatCh9,"LE%d",ConvertSlatNum(1,quadrant,kNslats5-1));
1144         sprintf(idSlatCh10,"LF%d",ConvertSlatNum(1,quadrant,kNslats5-1));
1145
1146         GetEnvelopes(8)->AddEnvelopeConstituentParam("S09G", idSlatCh9, quadrant*100+imax+4*idiv+1,
1147                                                      TGeoTranslation(xvol-kPcbLength * kNPCB5[1]/2.,yvol-kPcbLength,0.),3,divpar);
1148         GetEnvelopes(9)->AddEnvelopeConstituentParam("S10G", idSlatCh10,  quadrant*100+imax+4*idiv+1,
1149                                                      TGeoTranslation(xvol-kPcbLength * kNPCB5[1]/2.,yvol-kPcbLength,0.),3,divpar);
1150       }
1151     }
1152     // cout << "Geometry for Station 5...... done" << endl;
1153
1154   }
1155 }
1156
1157
1158 //______________________________________________________________________________
1159 void AliMUONSlatGeometryBuilder::SetTransformations()
1160 {
1161 // Defines the transformations for the station345 chambers.
1162 // ---
1163
1164   if (gAlice->GetModule("DIPO")) {
1165     // if DIPO is preset, the whole station will be placed in DDIP volume
1166     SetMotherVolume(4, "DDIP");
1167     SetMotherVolume(5, "DDIP");
1168     SetVolume(4, "CH05", true);
1169     SetVolume(5, "CH06", true);
1170   }     
1171   else {
1172     SetVolume(4, "CH05");
1173     SetVolume(5, "CH06");
1174   } 
1175    
1176   if (gAlice->GetModule("SHIL")) {
1177     SetMotherVolume(6, "YOUT2");
1178     SetMotherVolume(7, "YOUT2");
1179     SetMotherVolume(8, "YOUT2");
1180     SetMotherVolume(9, "YOUT2");
1181   }  
1182
1183   SetVolume(6, "CH07");
1184   SetVolume(7, "CH08");
1185   SetVolume(8, "CH09");
1186   SetVolume(9, "CH10");
1187
1188 // Stations 345 are not perpendicular to the beam axis
1189 // See AliMUONConstants class
1190   TGeoRotation st345inclination("rot99");
1191   st345inclination.RotateX(AliMUONConstants::St345Inclination());
1192   
1193   Double_t zpos1= - AliMUONConstants::DefaultChamberZ(4); 
1194   SetTransformation(4, TGeoTranslation(0., 0., zpos1), st345inclination);
1195
1196   zpos1= - AliMUONConstants::DefaultChamberZ(5); 
1197   SetTransformation(5, TGeoTranslation(0., 0., zpos1), st345inclination);
1198
1199   zpos1 = - AliMUONConstants::DefaultChamberZ(6); 
1200   SetTransformation(6, TGeoTranslation(0., 0., zpos1), st345inclination);
1201
1202   zpos1 = - AliMUONConstants::DefaultChamberZ(7); 
1203   SetTransformation(7, TGeoTranslation(0., 0., zpos1), st345inclination );
1204
1205   zpos1 = - AliMUONConstants::DefaultChamberZ(8); 
1206   SetTransformation(8, TGeoTranslation(0., 0., zpos1), st345inclination);
1207
1208   zpos1 = - AliMUONConstants::DefaultChamberZ(9); 
1209   SetTransformation(9, TGeoTranslation(0., 0., zpos1), st345inclination);
1210
1211 }
1212
1213 //______________________________________________________________________________
1214 void AliMUONSlatGeometryBuilder::SetSensitiveVolumes()
1215 {
1216 // Defines the sensitive volumes for slat stations chambers.
1217 // ---
1218
1219   GetGeometry(4)->SetSensitiveVolume("S05G");
1220   GetGeometry(5)->SetSensitiveVolume("S06G");
1221   GetGeometry(6)->SetSensitiveVolume("S07G");
1222   GetGeometry(7)->SetSensitiveVolume("S08G");
1223   GetGeometry(8)->SetSensitiveVolume("S09G");
1224   GetGeometry(9)->SetSensitiveVolume("S10G");
1225 }
1226
1227 //______________________________________________________________________________
1228 Int_t  AliMUONSlatGeometryBuilder::ConvertSlatNum(Int_t numslat, Int_t quadnum, Int_t fspq) const
1229 {
1230 // On-line function establishing the correspondance between numslat (the slat number on a particular quadrant (numslat->0....4 for St3))
1231 // and slatnum (the slat number on the whole panel (slatnum->1...18 for St3)
1232   numslat += 1;
1233   if (quadnum==2 || quadnum==3) 
1234     numslat += fspq;
1235   else
1236     numslat = fspq + 2-numslat;
1237   numslat -= 1;
1238               
1239   if (quadnum==3 || quadnum==4) numslat += 2*fspq+1;
1240
1241   return numslat;
1242 }