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