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