]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONv2.cxx
d782b933ade1d49cae3cc2e0572b7ee02d398e69
[u/mrichter/AliRoot.git] / MUON / AliMUONv2.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 // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
19 //
20 // Class AliMUONv2
21 // ---------------
22 // Inherits from AliMUONv1 but with a more detailed
23 // geometrical description of station 1 
24
25 #include <algorithm>
26 #include <string>
27
28 #include <TVector2.h>
29 #include <TClonesArray.h>
30 #include <TLorentzVector.h>
31 #include <TArrayI.h>
32 #include <Riostream.h>
33 #include <TSystem.h>
34 #include <TVirtualMC.h>
35
36 #include "AliMpFiles.h"
37 #include "AliMpReader.h"
38 #include "AliMpSector.h"
39 #include "AliMpRow.h"
40 #include "AliMpVRowSegment.h"
41 #include "AliMpMotifMap.h"
42 #include "AliMpMotifPosition.h"
43
44 #include "AliMUONv2.h"
45 #include "AliMUONConstants.h"
46 #include "AliMUONHit.h"
47 #include "AliRun.h"
48 #include "AliMagF.h"
49 #include "AliConst.h" 
50 #include "AliMUONChamber.h"
51
52 ClassImp(AliMUONv2)
53
54 // Thickness Constants
55 const GReal_t AliMUONv2::fgkHzPadPlane=0.0148/2.;     //Pad plane
56 const GReal_t AliMUONv2::fgkHzFoam = 2.083/2.;        //Foam of mechanicalplane
57 const GReal_t AliMUONv2::fgkHzFR4 = 0.0031/2.;        //FR4 of mechanical plane
58 const GReal_t AliMUONv2::fgkHzSnPb = 0.0091/2.;       //Pad/Kapton connection (66 pt)
59 const GReal_t AliMUONv2::fgkHzKapton = 0.0122/2.;     //Kapton
60 const GReal_t AliMUONv2::fgkHzBergPlastic = 0.3062/2.;//Berg connector
61 const GReal_t AliMUONv2::fgkHzBergCopper = 0.1882/2.; //Berg connector
62 const GReal_t AliMUONv2::fgkHzDaughter = 0.0156/2.;   //Daughter board
63 const GReal_t AliMUONv2::fgkHzGas = 0.2/2.;           //Gas thickness
64
65 // Quadrant Mother volume - TUBS1 - Middle layer of model
66 const GReal_t AliMUONv2::fgkMotherIR1 = 18.3;
67 const GReal_t AliMUONv2::fgkMotherOR1 = 105.673;   
68 const GReal_t AliMUONv2::fgkMotherThick1 = 6.5/2;  
69 const GReal_t AliMUONv2::fgkMotherPhiL1 = 0.; 
70 const GReal_t AliMUONv2::fgkMotherPhiU1 = 90.;
71
72 // Quadrant Mother volume - TUBS2 - near and far layers of model
73 const GReal_t AliMUONv2::fgkMotherIR2 = 20.7;   
74 const GReal_t AliMUONv2::fgkMotherOR2 = 100.073;   
75 const GReal_t AliMUONv2::fgkMotherThick2 = 3.0/2; 
76 const GReal_t AliMUONv2::fgkMotherPhiL2 = 0.; 
77 const GReal_t AliMUONv2::fgkMotherPhiU2 = 90.;
78
79 // Sensitive copper pads, foam layer, PCB and electronics model parameters
80 const GReal_t AliMUONv2::fgkHxHole=1.5/2.;
81 const GReal_t AliMUONv2::fgkHyHole=6./2.;
82 const GReal_t AliMUONv2::fgkHxBergPlastic=0.74/2.;
83 const GReal_t AliMUONv2::fgkHyBergPlastic=5.09/2.;
84 const GReal_t AliMUONv2::fgkHxBergCopper=0.25/2.;
85 const GReal_t AliMUONv2::fgkHyBergCopper=3.6/2.;
86 const GReal_t AliMUONv2::fgkHxKapton=0.8/2.;
87 const GReal_t AliMUONv2::fgkHyKapton=5.7/2.;
88 const GReal_t AliMUONv2::fgkHxDaughter=2.3/2.;
89 const GReal_t AliMUONv2::fgkHyDaughter=6.3/2.;
90 const GReal_t AliMUONv2::fgkOffsetX=1.46;
91 const GReal_t AliMUONv2::fgkOffsetY=0.71;
92 const GReal_t AliMUONv2::fgkDeltaFilleEtamX=1.46;
93 const GReal_t AliMUONv2::fgkDeltaFilleEtamY=0.051;
94
95 const GReal_t AliMUONv2::fgkDeltaQuadLHC=2.6;  // LHC Origin wrt Quadrant Origin
96 const GReal_t AliMUONv2::fgkFrameOffset=5.0;  
97
98 const char* AliMUONv2::fgkHoleName="MCHL";      
99 const char* AliMUONv2::fgkDaughterName="MCDB";  
100 const char  AliMUONv2::fgkFoamLayerSuffix='F';  // prefix for automatic volume naming
101 const char* AliMUONv2::fgkQuadrantMLayerName="SQM";
102 const char* AliMUONv2::fgkQuadrantNLayerName="SQN";
103 const char* AliMUONv2::fgkQuadrantFLayerName="SQF";
104
105 //______________________________________________________________________________
106 AliMUONv2::AliMUONv2()
107   : AliMUONv1()
108 {
109 // Default Constructor
110 // --
111    fChamberV2[0] = 0;
112    fChamberV2[1] = 0;
113    
114    // keep secondaries
115    SetIshunt(0);
116  
117    // set path to mapping data files
118    if (! gSystem->Getenv("MINSTALL")) {    
119      TString dirPath = gSystem->Getenv("ALICE_ROOT");
120      dirPath += "/MUON/mapping"; 
121      AliMpFiles::Instance()->SetTopPath(dirPath);
122      gSystem->Setenv("MINSTALL", dirPath.Data());
123      //cout << "AliMpFiles top path set to " << dirPath << endl;          
124    }
125    //else
126    //  cout << gSystem->Getenv("MINSTALL") << endl;       
127 }
128  
129 //______________________________________________________________________________
130 AliMUONv2::AliMUONv2(const char *name, const char *title)
131   : AliMUONv1(name,title)
132 {
133    fChamberV2[0] = 0;
134    fChamberV2[1] = 0;
135    
136    // keep secondaries
137    SetIshunt(0);
138    
139    // set path to mapping data files
140    if (! gSystem->Getenv("MINSTALL")) {    
141      TString dirPath = gSystem->Getenv("ALICE_ROOT");
142      dirPath += "/MUON/mapping"; 
143      AliMpFiles::Instance()->SetTopPath(dirPath);
144      gSystem->Setenv("MINSTALL", dirPath.Data());
145      //cout << "AliMpFiles top path set to " << dirPath << endl;          
146    }
147    //else
148    //  cout << gSystem->Getenv("MINSTALL") << endl;               
149 }
150  
151 //______________________________________________________________________________
152 AliMUONv2::AliMUONv2(const AliMUONv2& rMUON):AliMUONv1(rMUON)
153 {
154 // Dummy copy constructor
155 }
156
157 //______________________________________________________________________________
158 AliMUONv2::~AliMUONv2()
159 {
160 // Destructor
161 }
162
163 //
164 //  Private methods
165 //
166
167 //______________________________________________________________________________
168 void AliMUONv2::CreateHole()
169 {
170 // Create all the elements found inside a foam hole
171 // --
172   Int_t* idtmed = fIdtmed->GetArray()-1099;
173   Int_t idAir  = idtmed[1100];    // medium 1
174   Int_t idCopper  = idtmed[1109]; // medium 10 = copper
175
176   GReal_t par[3];
177   GReal_t posX,posY,posZ;
178   
179   par[0] = fgkHxHole;
180   par[1] = fgkHyHole;
181   par[2] = fgkHzFoam;
182   gMC->Gsvolu(fgkHoleName,"BOX",idAir,par,3);
183
184   par[0] = fgkHxKapton;
185   par[1] = fgkHyKapton;
186   par[2] = fgkHzSnPb;
187   gMC->Gsvolu("SNPB", "BOX", idCopper, par, 3);
188   posX = 0.;
189   posY = 0.;
190   posZ = -fgkHzFoam+fgkHzSnPb;
191   gMC->Gspos("SNPB",1,fgkHoleName, posX, posY, posZ, 0,"ONLY");
192
193   par[0] = fgkHxHole;
194   par[1] = fgkHyBergPlastic;
195   par[2] = fgkHzKapton;
196   gMC->Gsvolu("KAPT", "BOX", idCopper, par, 3);
197   posX = 0.;
198   posY = 0.;
199   posZ = 0.;
200   gMC->Gspos("KAPT",1,fgkHoleName, posX, posY, posZ, 0,"ONLY");
201 }
202
203 //______________________________________________________________________________
204 void AliMUONv2::CreateDaughterBoard()
205 {
206 // Create all the elements in a daughter board
207 // --
208   Int_t* idtmed = fIdtmed->GetArray()-1099;
209   Int_t idAir  = idtmed[1100]; // medium 1
210   Int_t idCopper  = idtmed[1109]; // medium 10 = copper
211   Int_t idPlastic  =idtmed[1116]; // medium 17 = Plastic
212
213   GReal_t par[3];
214   GReal_t posX,posY,posZ;
215
216   par[0]=fgkHxDaughter;
217   par[1]=fgkHyDaughter;
218   par[2]=TotalHzDaughter();
219   gMC->Gsvolu(fgkDaughterName,"BOX",idAir,par,3);
220   
221   par[0]=fgkHxBergPlastic;
222   par[1]=fgkHyBergPlastic;
223   par[2]=fgkHzBergPlastic;
224   gMC->Gsvolu("BRGP","BOX",idPlastic,par,3);
225   posX=0.;
226   posY=0.;
227   posZ = -TotalHzDaughter() + fgkHzBergPlastic;
228   gMC->Gspos("BRGP",1,fgkDaughterName,posX,posY,posZ,0,"ONLY");
229
230   par[0]=fgkHxBergCopper;
231   par[1]=fgkHyBergCopper;
232   par[2]=fgkHzBergCopper;
233   gMC->Gsvolu("BRGC","BOX",idCopper,par,3);
234   posX=0.;
235   posY=0.;
236   posZ=0.;
237   gMC->Gspos("BRGC",1,"BRGP",posX,posY,posZ,0,"ONLY");
238
239   par[0]=fgkHxDaughter;
240   par[1]=fgkHyDaughter;
241   par[2]=fgkHzDaughter;
242   gMC->Gsvolu("DGHT","BOX",idCopper,par,3);
243   posX=0.;
244   posY=0.;
245   posZ = -TotalHzDaughter() + 2.*fgkHzBergPlastic + fgkHzDaughter;
246   gMC->Gspos("DGHT",1,fgkDaughterName,posX,posY,posZ,0,"ONLY");
247 }
248
249 //______________________________________________________________________________
250 void AliMUONv2::CreateInnerLayers()
251 {
252 // Create the layer of sensitive volumes with gas
253 // and the copper layer.
254 // --
255
256 // Gas Medium
257   Int_t* idtmed = fIdtmed->GetArray()-1099; 
258   Int_t idArCO2  = idtmed[1108];  // medium 9 (ArCO2 80%) 
259   Int_t idCopper  = idtmed[1109]; // medium 10 = copper
260
261   Float_t par[11];
262
263 //Make gas volume - composed of 11 trapezoids
264 // section 1 of 11
265     par[0] = fgkHzGas;
266     par[1] = 0.;
267     par[2] = 0.;
268     par[3] = 71.33/2.;
269     par[4] = 9.76/2.;
270     par[5] = 48.77/2.;
271     par[6] = 15.3;
272     par[7] = 71.33/2.;
273     par[8] = 9.76/2.;
274     par[9] = 48.77/2.;
275     par[10] = 15.3;        
276
277   gMC->Gsvolu("SA1G", "TRAP", idArCO2, par, 11);
278   gMC->Gsvolu("SA2G", "TRAP", idArCO2, par, 11);
279   
280   par[0] = fgkHzPadPlane;
281   gMC->Gsvolu("SA1C", "TRAP", idCopper,par, 11);
282
283 // section 2 of 11  
284     par[0] = fgkHzGas;
285     par[1] = 0.;
286     par[2] = 0.;
287     par[3] = 79.68/2.;
288     par[4] = 10.4/2.;
289     par[5] = 57.0/2.;
290     par[6] = 0.;  
291     par[7] = 79.68/2.; 
292     par[8] = 10.4/2.;
293     par[9] = 57.0/2.;
294     par[10] = 0.;  
295   gMC->Gsvolu("SB1G", "TRAP", idArCO2, par, 11);  
296   gMC->Gsvolu("SB2G", "TRAP", idArCO2, par, 11);
297
298   par[0] = fgkHzPadPlane;
299   gMC->Gsvolu("SB1C", "TRAP", idCopper,par, 11);
300
301 // section 3 of 11
302     par[0] = fgkHzGas;
303     par[1] = 0.;
304     par[2] = 0.;
305     par[3] = 71.33/2.;
306     par[4] = 48.77/2.;
307     par[5] = 9.73/2.;
308     par[6] = -15.3;
309     par[7] = 71.33/2.;
310     par[8] = 48.77/2.;
311     par[9] = 9.73/2.;
312     par[10] = -15.3;   
313  
314   gMC->Gsvolu("SC1G", "TRAP", idArCO2, par, 11);  
315   gMC->Gsvolu("SC2G", "TRAP", idArCO2, par, 11);
316
317   par[0] = fgkHzPadPlane;
318   gMC->Gsvolu("SC1C", "TRAP", idCopper,par, 11);
319
320 // section 4 of 11
321     par[0] = fgkHzGas;
322     par[1] = 0.;
323     par[2] = 0.;
324     par[3] = 6.00/2.;
325     par[4] = 0.;
326     par[5] = 1.56/2.;
327     par[6] = 7.41; 
328     par[7] = 6.00/2.; 
329     par[8] = 0.;
330     par[9] = 1.56/2.;
331     par[10] = 7.41;    
332   gMC->Gsvolu("SD1G", "TRAP", idArCO2, par, 11);  
333   gMC->Gsvolu("SD2G", "TRAP", idArCO2, par, 11);
334
335   par[0] = fgkHzPadPlane;
336   gMC->Gsvolu("SD1C", "TRAP", idCopper,par, 11);
337
338 // section 5 of 11  
339     par[0] = fgkHzGas;
340     par[1] = 0.;
341     par[2] = 0.;
342     par[3] = 1.516/2.;
343     par[4] = 0.;
344     par[5] = 0.829/2.;
345     par[6] = 15.3;
346     par[7] = 1.516/2.;
347     par[8] = 0.;
348     par[9] = 0.829/2.;
349     par[10] = 15.3;   
350   gMC->Gsvolu("SE1G", "TRAP", idArCO2, par, 11);  
351   gMC->Gsvolu("SE2G", "TRAP", idArCO2, par, 11);
352
353   par[0] = fgkHzPadPlane;
354   gMC->Gsvolu("SE1C", "TRAP", idCopper,par, 11);
355
356 // section 6 of 11
357     par[0] = fgkHzGas;
358     par[1] = 0.;
359     par[2] = 0.;
360     par[3] = 3.92/2.;
361     par[4] = 0.;
362     par[5] = 0.562/2.;
363     par[6] = -4.1;
364     par[7] = 3.92/2.;
365     par[8] = 0.;
366     par[9] = 0.562/2.;
367     par[10] = -4.1;   
368   gMC->Gsvolu("SF1G", "TRAP", idArCO2, par, 11);  
369   gMC->Gsvolu("SF2G", "TRAP", idArCO2, par, 11);
370     
371   par[0] = fgkHzPadPlane;
372   gMC->Gsvolu("SF1C", "TRAP", idCopper,par, 11);
373
374 // section 7 of 11
375     par[0] = fgkHzGas;
376     par[1] = 0.;
377     par[2] = 0.;
378     par[3] = 0.941/2.;
379     par[4] = 0.562/2.;
380     par[5] = 0.;
381     par[6] = -16.6; 
382     par[7] = 0.941/2.;
383     par[8] = 0.562/2.;
384     par[9] = 0.;
385     par[10] =-16.6;    
386   gMC->Gsvolu("SG1G", "TRAP", idArCO2, par, 11);  
387   gMC->Gsvolu("SG2G", "TRAP", idArCO2, par, 11);
388
389   par[0] = fgkHzPadPlane;
390   gMC->Gsvolu("SG1C", "TRAP", idCopper,par, 11);
391
392 // section 8 of 11
393     par[0] = fgkHzGas;
394     par[1] = 0.;
395     par[2] = 0.;
396     par[3] = 3.94/2.;
397     par[4] = 0.57/2.;
398     par[5] = 0.;
399     par[6] = 4.14; 
400     par[7] = 3.94/2.; 
401     par[8] = 0.57/2.;
402     par[9] = 0.;
403     par[10] = 4.14;    
404   gMC->Gsvolu("SH1G", "TRAP", idArCO2, par, 11);  
405   gMC->Gsvolu("SH2G", "TRAP", idArCO2, par, 11);
406
407   par[0] = fgkHzPadPlane;
408   gMC->Gsvolu("SH1C", "TRAP", idCopper,par, 11);
409
410 // section 9 of 11  
411     par[0] = fgkHzGas;
412     par[1] = 0.;
413     par[2] = 0.;
414     par[3] = 0.95/2.;
415     par[4] = 0.;
416     par[5] = 0.57/2;
417     par[6] = 16.7;
418     par[7] = 0.95/2.;
419     par[8] = 0.;
420     par[9] = 0.57/2;
421     par[10] = 16.7;   
422   gMC->Gsvolu("SI1G", "TRAP", idArCO2, par, 11);  
423   gMC->Gsvolu("SI2G", "TRAP", idArCO2, par, 11);
424
425   par[0] = fgkHzPadPlane;
426   gMC->Gsvolu("SI1C", "TRAP", idCopper,par, 11);
427
428 // section 10 of 11
429     par[0] = fgkHzGas;
430     par[1] = 0.;
431     par[2] = 0.;
432     par[3] = 1.49/2.;
433     par[4] = 0.;
434     par[5] = 0.817/2.;
435     par[6] = -15.4;
436     par[7] = 1.49/2.;
437     par[8] = 0.;
438     par[9] = 0.817/2.;
439     par[10] = -15.4;   
440   gMC->Gsvolu("SJ1G", "TRAP", idArCO2, par, 11);  
441   gMC->Gsvolu("SJ2G", "TRAP", idArCO2, par, 11);
442     
443   par[0] = fgkHzPadPlane;
444   gMC->Gsvolu("SJ1C", "TRAP", idCopper,par, 11);
445
446 // section 11 of 11
447     par[0] = fgkHzGas;
448     par[1] = 0.;
449     par[2] = 0.;
450     par[3] = 5.93/2.;
451     par[4] = 0.;
452     par[5] = 1.49/2.;
453     par[6] = -7.16; 
454     par[7] = 5.93/2.;
455     par[8] = 0.;
456     par[9] = 1.49/2.;
457     par[10] = -7.16;    
458   gMC->Gsvolu("SK1G", "TRAP", idArCO2, par, 11);  
459   gMC->Gsvolu("SK2G", "TRAP", idArCO2, par, 11);
460
461   par[0] = fgkHzPadPlane;
462   gMC->Gsvolu("SK1C", "TRAP", idCopper,par, 11);
463 }
464
465 //______________________________________________________________________________
466 void AliMUONv2::CreateQuadrant(Int_t chamber)
467 {
468 // create the quadrant (bending and non-bending planes)
469 // for the given chamber
470 // --
471
472   CreateFrame(chamber);
473
474   TSpecialMap specialMap;
475   specialMap[1001] = AliMUONSt1SpecialMotif(TVector2( 0.1, 0.84), 90.);
476   specialMap[1002] = AliMUONSt1SpecialMotif(TVector2( 0.5, 0.36));
477   specialMap[1003] = AliMUONSt1SpecialMotif(TVector2(1.01, 0.36));
478   AliMpReader reader1(kStation1, kBendingPlane);
479   AliMpSector* sector1 = reader1.BuildSector();
480
481   Bool_t reflectZ = true;
482   TVector3 where = TVector3(2.5+0.1+0.56+0.001, 2.5+0.1+0.001, 0.);
483   PlaceSector(sector1, specialMap, where, reflectZ, chamber);
484   
485   specialMap.clear();
486   specialMap[4001] = AliMUONSt1SpecialMotif(TVector2(1.01,0.59),90.);
487   specialMap[4002] = AliMUONSt1SpecialMotif(TVector2(1.96, 0.17));
488   specialMap[4003] = AliMUONSt1SpecialMotif(TVector2(1.61,-1.18));
489   specialMap[4004] = AliMUONSt1SpecialMotif(TVector2(0.2 ,-0.08));
490   specialMap[4005] = AliMUONSt1SpecialMotif(TVector2(0.2 , 0.25));
491   specialMap[4006] = AliMUONSt1SpecialMotif(TVector2(0.28, 0.21));
492   AliMpReader reader2(kStation1, kNonBendingPlane);
493   AliMpSector* sector2 = reader2.BuildSector();
494
495   reflectZ = false;
496   where = TVector3(where.X()+0.63/2.,where.Y()+0.42/2., 0.); //add a half pad shift
497   PlaceSector(sector2, specialMap, where, reflectZ, chamber);
498 }
499
500 //______________________________________________________________________________
501 void AliMUONv2::CreateFoamBox(const char* name,const  TVector2& dimensions)
502 {
503 // create all the elements in the copper plane
504 // --
505
506   Int_t* idtmed = fIdtmed->GetArray()-1099;
507   Int_t idAir  = idtmed[1100]; // medium 1
508   Int_t idFoam = idtmed[1115]; // medium 16 = Foam
509   Int_t idFR4  = idtmed[1114]; // medium 15 = FR4
510
511   // mother volume
512   GReal_t par[3];
513   par[0] = dimensions.X();
514   par[1] = dimensions.Y();
515   par[2] = TotalHzPlane();
516   gMC->Gsvolu(name,"BOX",idAir,par,3);
517   
518   // foam layer
519   GReal_t posX,posY,posZ;
520   char eName[5];
521   strcpy(eName,name);
522   eName[3]=fgkFoamLayerSuffix;
523   par[0] = dimensions.X();
524   par[1] = dimensions.Y();
525   par[2] = fgkHzFoam;
526   gMC->Gsvolu(eName,"BOX",idFoam,par,3);
527   posX=0.;
528   posY=0.;
529   posZ = -TotalHzPlane() + fgkHzFoam;
530   gMC->Gspos(eName,1,name,posX,posY,posZ,0,"ONLY");
531
532   // mechanical plane FR4 layer
533   eName[3]='R';
534   par[0] = dimensions.X();
535   par[1] = dimensions.Y();
536   par[2] = fgkHzFR4;
537   gMC->Gsvolu(eName,"BOX",idFR4,par,3);
538   posX=0.;
539   posY=0.;
540   posZ = -TotalHzPlane()+ 2.*fgkHzFoam + fgkHzFR4;
541   gMC->Gspos(eName,1,name,posX,posY,posZ,0,"ONLY");
542 }
543
544 //______________________________________________________________________________
545 void AliMUONv2::CreatePlaneSegment(const char* name,const  TVector2& dimensions,
546                                    Int_t nofHoles)
547 {
548 // Create a segment of a plane (this includes a foam layer, 
549 // holes in the foam to feed the kaptons through, kapton connectors
550 // and the mother board.)
551 // --
552   
553   CreateFoamBox(name,dimensions);
554
555   char eName[5];
556   strcpy(eName,name);
557   eName[3]=fgkFoamLayerSuffix;
558   
559   for (Int_t holeNum=0;holeNum<nofHoles;holeNum++) {
560     GReal_t posX = ((2.*holeNum+1.)/nofHoles-1.)*dimensions.X();
561     GReal_t posY = 0.;
562     GReal_t posZ = 0.;
563   
564     gMC->Gspos(fgkHoleName,holeNum+1,eName,posX,posY,posZ,0,"ONLY");
565   }
566 }
567
568 //______________________________________________________________________________
569 void AliMUONv2::CreateFrame(Int_t chamber)
570 {
571 // Create the non-sensitive elements of the frame for the  <chamber>
572 //
573 // 
574 // Model and notation:
575 //
576 // The Quadrant volume name starts with SQ
577 // The volume segments are numbered 00 to XX.
578 //
579 //                              OutTopFrame
580 //                               (SQ02-16) 
581 //                              ------------  
582 //             OutEdgeFrame   /              |
583 //             (SQ17-24)     /               |  InVFrame (SQ00-01) 
584 //                          /                |
585 //                          |                |   
586 //               OutVFrame  |            _- - 
587 //               (SQ25-39)  |           |   InArcFrame (SQ42-45)
588 //                          |           |
589 //                          -------------
590 //                        InHFrame (SQ40-41)
591 //                          
592 //
593 // 06 February 2003 - Overlapping volumes resolved.
594 // One quarter chamber is comprised of three TUBS volumes: SQMx, SQNx, and SQFx,
595 // where SQMx is the Quadrant Middle layer for chamber <x> ( posZ in [-3.25,3.25]),
596 // SQNx is the Quadrant Near side layer for chamber <x> ( posZ in [-6.25,3-.25) ), and
597 // SQFx is the Quadrant Far side layer for chamber <x> ( posZ in (3.25,6.25] ).
598 //---
599
600 const Float_t fgkNearFarLHC=2.4;    // Near and Far TUBS Origin wrt LHC Origin
601
602   // tracking medias
603   Int_t* idtmed = fIdtmed->GetArray()-1099;
604   
605   Int_t idAir  = idtmed[1100];       // medium 1
606   Int_t idFrameEpoxy = idtmed[1115]; // medium 16 = Frame Epoxy ME730
607   Int_t idInox = idtmed[1116];       // medium 17 Stainless Steel (18%Cr,9%Ni,Fe)
608   Int_t idFR4 = idtmed[1110];        // medium 11 FR4
609   Int_t idCopper = idtmed[1109];     // medium 10 Copper
610   Int_t idAlu = idtmed[1103];        // medium 4 Aluminium
611   
612   
613 // Rotation Matrices  
614       Int_t rot1, rot2, rot3;    
615       
616 //   Rotation matrices  
617      AliMatrix(rot1,  90.,  90., 90., 180.,  0., 0.); // +90 deg in x-y plane
618      AliMatrix(rot2,  90.,  45., 90., 135.,  0., 0.); // +45 deg in x-y plane 
619      AliMatrix(rot3,  90.,  45., 90., 315.,180., 0.); // +45 deg in x-y + rotation 180° around y
620
621 //   Translation matrices ... NOT USED  
622 //     AliMatrix(trans1, 90.,   0., 90.,  90.,   0., 0.); // X-> X; Y -> Y; Z -> Z
623 //     AliMatrix(trans2, 90., 180., 90.,  90., 180., 0.); // X->-X; Y -> Y; Z ->-Z
624 //     AliMatrix(trans3, 90., 180., 90., 270.,   0., 0.); // X->-X; Y ->-Y; Z -> Z
625 //     AliMatrix(trans4, 90.,   0., 90., 270., 180., 0.); // X-> X; Y ->-Y; Z ->-Z
626 //  
627       // ___________________Volume thicknesses________________________
628
629   const Float_t hzFrameThickness = 1.59/2.;     //equivalent thickness
630   const Float_t hzOuterFrameEpoxy = 1.19/2.;    //equivalent thickness
631   const Float_t hzOuterFrameInox = 0.1/2.;      //equivalent thickness
632   const Float_t hzFoam = 2.083/2.;              //evaluated elsewhere
633   
634 // Pertaining to the top outer area 
635   const Float_t hzTopAnodeSteel1 = 0.185/2.;    //equivalent thickness
636   const Float_t hzTopAnodeSteel2 = 0.51/2.;     //equivalent thickness  
637   const Float_t hzAnodeFR4 = 0.08/2.;           //equivalent thickness
638   const Float_t hzTopEarthFaceCu = 0.364/2.;    //equivalent thickness
639   const Float_t hzTopEarthProfileCu = 1.1/2.;   //equivalent thickness
640   const Float_t hzTopPositionerSteel = 1.45/2.; //should really be 2.125/2.; 
641   const Float_t hzTopGasSupportAl = 0.85/2.;    //equivalent thickness
642   
643 // Pertaining to the vertical outer area  
644   const Float_t hzVerticalCradleAl = 0.8/2.;     //equivalent thickness
645   const Float_t hzLateralSightAl = 0.975/2.;     //equivalent thickness
646   const Float_t hzLateralPosnInoxFace = 2.125/2.;//equivalent thickness
647   const Float_t hzLatPosInoxProfM = 6.4/2.;      //equivalent thickness
648   const Float_t hzLatPosInoxProfNF = 1.45/2.;    //equivalent thickness
649   const Float_t hzLateralPosnAl = 0.5/2.;        //equivalent thickness
650   const Float_t hzVertEarthFaceCu = 0.367/2.;    //equivalent thickness
651   const Float_t hzVertBarSteel = 0.198/2.;       //equivalent thickness
652   const Float_t hzVertEarthProfCu = 1.1/2.;      //equivalent thickness
653
654       //_______________Parameter definitions in sequence _________
655
656 // InVFrame parameters
657   const Float_t hxInVFrame  = 1.85/2.;
658   const Float_t hyInVFrame  = 73.95/2.;
659   const Float_t hzInVFrame  = hzFrameThickness;
660
661 //Flat 7.5mm vertical section
662   const Float_t hxV1mm  = 0.75/2.;
663   const Float_t hyV1mm  = 1.85/2.;
664   const Float_t hzV1mm  = hzFrameThickness;
665
666 // OuterTopFrame Structure 
667 //
668 // FRAME
669 // The frame is composed of a cuboid and two trapezoids 
670 // (TopFrameAnode, TopFrameAnodeA, TopFrameAnodeB). 
671 // Each shape is composed of two layers (Epoxy and Inox) and 
672 // takes the frame's inner anode circuitry into account in the material budget.
673 //
674 // ANODE
675 // The overhanging anode part is composed froma cuboid and two trapezoids 
676 // (TopAnode, TopAnode1, and TopAnode2). These surfaces neglect implanted
677 // resistors, but accounts for the major Cu, Pb/Sn, and FR4 material
678 // contributions.  
679 // The stainless steel anode supports have been included.
680 //
681 // EARTHING (TopEarthFace, TopEarthProfile)
682 // Al GAS SUPPORT (TopGasSupport)
683 //  
684 // ALIGNMENT (TopPositioner) - Alignment system, three sights per quarter 
685 // chamber. This sight is forseen for the alignment of the horizontal level 
686 // (parallel to the OY axis of LHC). Its position will be evaluated relative 
687 // to a system of sights places on the cradles;
688 //
689 //---
690   
691 //TopFrameAnode parameters - cuboid, 2 layers
692   const Float_t hxTFA = 34.1433/2.;
693   const Float_t hyTFA = 7.75/2.;
694   const Float_t hzTFAE = hzOuterFrameEpoxy;     // layer 1 thickness
695   const Float_t hzTFAI = hzOuterFrameInox;      // layer 3 thickness
696   
697 // TopFrameAnodeA parameters - trapezoid, 2 layers
698   const Float_t hzFAAE = hzOuterFrameEpoxy;     // layer 1 thickness
699   const Float_t hzFAAI = hzOuterFrameInox;      // layer 3 thickness
700   const Float_t tetFAA = 0.;
701   const Float_t phiFAA = 0.;
702   const Float_t h1FAA = 8.7/2.;
703   const Float_t bl1FAA = 4.35/2.;
704   const Float_t tl1FAA =  7.75/2.;
705   const Float_t alp1FAA = 11.06; 
706   const Float_t h2FAA = 8.7/2.;
707   const Float_t bl2FAA = 4.35/2.;
708   const Float_t tl2FAA = 7.75/2.;
709   const Float_t alp2FAA = 11.06;  
710   
711 // TopFrameAnodeB parameters - trapezoid, 2 layers
712   const Float_t hzFABE = hzOuterFrameEpoxy;     // layer 1 thickness
713   const Float_t hzFABI = hzOuterFrameInox;      // layer 3 thickness
714   const Float_t tetFAB = 0.;
715   const Float_t phiFAB = 0.;
716   const Float_t h1FAB = 8.70/2.;
717   const Float_t bl1FAB = 0.;
718   const Float_t tl1FAB = 4.35/2.;
719   const Float_t alp1FAB = 14.03; 
720   const Float_t h2FAB = 8.70/2.;
721   const Float_t bl2FAB = 0.;
722   const Float_t tl2FAB = 4.35/2.;
723   const Float_t alp2FAB = 14.03;  
724   
725 // TopAnode parameters - cuboid (part 1 of 3 parts)
726   const Float_t hxTA1 = 16.2/2.;
727   const Float_t hyTA1 = 3.5/2.;
728   const Float_t hzTA11 = hzTopAnodeSteel1;   // layer 1
729   const Float_t hzTA12 = hzAnodeFR4;         // layer 2 
730
731 // TopAnode parameters - trapezoid 1 (part 2 of 3 parts)
732   const Float_t hzTA21 = hzTopAnodeSteel2;   // layer 1 
733   const Float_t hzTA22 = hzAnodeFR4;         // layer 2 
734   const Float_t tetTA2 = 0.;
735   const Float_t phiTA2= 0.;
736   const Float_t h1TA2 = 7.268/2.;
737   const Float_t bl1TA2 = 2.03/2.;
738   const Float_t tl1TA2 = 3.5/2.;
739   const Float_t alp1TA2 = 5.78; 
740   const Float_t h2TA2 = 7.268/2.;
741   const Float_t bl2TA2 = 2.03/2.;
742   const Float_t tl2TA2 = 3.5/2.;
743   const Float_t alp2TA2 = 5.78;  
744
745 // TopAnode parameters - trapezoid 2 (part 3 of 3 parts)
746   const Float_t hzTA3 = hzAnodeFR4;       // layer 1 
747   const Float_t tetTA3 = 0.;
748   const Float_t phiTA3 = 0.;
749   const Float_t h1TA3 = 7.268/2.;
750   const Float_t bl1TA3 = 0.;
751   const Float_t tl1TA3 = 2.03/2.;
752   const Float_t alp1TA3 = 7.95; 
753   const Float_t h2TA3 = 7.268/2.;
754   const Float_t bl2TA3 = 0.;
755   const Float_t tl2TA3 = 2.03/2.;
756   const Float_t alp2TA3 = 7.95;  
757   
758 // TopEarthFace parameters - single trapezoid
759   const Float_t hzTEF = hzTopEarthFaceCu;
760   const Float_t tetTEF = 0.;
761   const Float_t phiTEF = 0.;
762   const Float_t h1TEF = 1.200/2.;
763   const Float_t bl1TEF = 21.323/2.;
764   const Float_t tl1TEF = 17.963/2.;
765   const Float_t alp1TEF = -54.46; 
766   const Float_t h2TEF = 1.200/2.;
767   const Float_t bl2TEF = 21.323/2.;
768   const Float_t tl2TEF = 17.963/2.;
769   const Float_t alp2TEF = -54.46;
770
771 // TopEarthProfile parameters - single trapezoid
772   const Float_t hzTEP = hzTopEarthProfileCu;
773   const Float_t tetTEP = 0.;
774   const Float_t phiTEP = 0.;
775   const Float_t h1TEP = 0.40/2.;
776   const Float_t bl1TEP = 31.766/2.;
777   const Float_t tl1TEP = 30.535/2.;
778   const Float_t alp1TEP = -56.98; 
779   const Float_t h2TEP = 0.40/2.;
780   const Float_t bl2TEP = 31.766/2.;
781   const Float_t tl2TEP = 30.535/2.;
782   const Float_t alp2TEP = -56.98;
783
784 // TopPositioner parameters - single Stainless Steel trapezoid 
785   const Float_t hzTP = hzTopPositionerSteel;
786   const Float_t tetTP = 0.;
787   const Float_t phiTP = 0.;
788   const Float_t h1TP = 3.00/2.;
789   const Float_t bl1TP = 7.023/2.;
790   const Float_t tl1TP = 7.314/2.;
791   const Float_t alp1TP = 2.78; 
792   const Float_t h2TP = 3.00/2.;
793   const Float_t bl2TP = 7.023/2.;
794   const Float_t tl2TP = 7.314/2.;
795   const Float_t alp2TP = 2.78;
796
797 // TopGasSupport parameters - single cuboid 
798   const Float_t hxTGS  = 8.50/2.;
799   const Float_t hyTGS  = 3.00/2.;
800   const Float_t hzTGS  = hzTopGasSupportAl;
801     
802 // OutEdgeFrame parameters - 4 trapezoidal sections, 2 layers of material
803 //
804 //---
805
806 // Trapezoid 1
807   const Float_t hzOETFE = hzOuterFrameEpoxy;    // layer 1 
808   const Float_t hzOETFI = hzOuterFrameInox;     // layer 3
809    
810   const Float_t tetOETF = 0.;            // common to all 4 trapezoids
811   const Float_t phiOETF = 0.;            // common to all 4 trapezoids
812
813   const Float_t h1OETF = 7.196/2.;       // common to all 4 trapezoids
814   const Float_t h2OETF = 7.196/2.;       // common to all 4 trapezoids   
815   
816   const Float_t bl1OETF1 = 3.75/2; 
817   const Float_t tl1OETF1 = 3.996/2.;
818   const Float_t alp1OETF1 = 0.98;
819
820   const Float_t bl2OETF1 = 3.75/2;
821   const Float_t tl2OETF1 = 3.996/2.;
822   const Float_t alp2OETF1 = 0.98;
823   
824 // Trapezoid 2
825   const Float_t bl1OETF2 = 3.01/2.;
826   const Float_t tl1OETF2 = 3.75/2;
827   const Float_t alp1OETF2 = 2.94;
828       
829   const Float_t bl2OETF2 = 3.01/2.;
830   const Float_t tl2OETF2 = 3.75/2;
831   const Float_t alp2OETF2 = 2.94; 
832  
833 // Trapezoid 3
834   const Float_t bl1OETF3 = 1.767/2.;
835   const Float_t tl1OETF3 = 3.01/2.;
836   const Float_t alp1OETF3 = 4.94;
837       
838   const Float_t bl2OETF3 = 1.767/2.;
839   const Float_t tl2OETF3 = 3.01/2.; 
840   const Float_t alp2OETF3 = 4.94; 
841   
842 // Trapezoid 4
843   const Float_t bl1OETF4 = 0.;
844   const Float_t tl1OETF4 = 1.77/2.;
845   const Float_t alp1OETF4 = 7.01;
846       
847   const Float_t bl2OETF4 = 0.;
848   const Float_t tl2OETF4 = 1.77/2.;
849   const Float_t alp2OETF4 =  7.01;   
850   
851 // Frame Structure (OutVFrame):
852 //
853 // OutVFrame and corner (OutVFrame cuboid, OutVFrame trapezoid)
854 // EARTHING (VertEarthFaceCu,VertEarthSteel,VertEarthProfCu),
855 // DETECTOR POSITIONNING (SuppLateralPositionner, LateralPositionner),
856 // CRADLE (VertCradle), and
857 // ALIGNMENT (LateralSightSupport, LateralSight) 
858 //
859 //---
860
861 // OutVFrame parameters - cuboid
862   const Float_t hxOutVFrame = 1.85/2.;
863   const Float_t hyOutVFrame = 46.23/2.;
864   const Float_t hzOutVFrame = hzFrameThickness;
865
866 // OutVFrame corner parameters - trapezoid
867   const Float_t hzOCTF = hzFrameThickness;
868   const Float_t tetOCTF = 0.;
869   const Float_t phiOCTF = 0.;
870   const Float_t h1OCTF = 1.85/2.;
871   const Float_t bl1OCTF = 0.;
872   const Float_t tl1OCTF = 3.66/2.;
873   const Float_t alp1OCTF = 44.67; 
874   const Float_t h2OCTF = 1.85/2.;
875   const Float_t bl2OCTF = 0.;
876   const Float_t tl2OCTF = 3.66/2.;
877   const Float_t alp2OCTF = 44.67;  
878   
879 // VertEarthFaceCu parameters - single trapezoid
880   const Float_t hzVFC = hzVertEarthFaceCu;
881   const Float_t tetVFC = 0.;
882   const Float_t phiVFC = 0.;
883   const Float_t h1VFC = 1.200/2.;
884   const Float_t bl1VFC = 46.11/2.;
885   const Float_t tl1VFC = 48.236/2.;
886   const Float_t alp1VFC = 41.54; 
887   const Float_t h2VFC = 1.200/2.;
888   const Float_t bl2VFC = 46.11/2.;
889   const Float_t tl2VFC = 48.236/2.;
890   const Float_t alp2VFC = 41.54;
891     
892 // VertEarthSteel parameters - single trapezoid
893   const Float_t hzVES = hzVertBarSteel;
894   const Float_t tetVES = 0.;
895   const Float_t phiVES = 0.;
896   const Float_t h1VES = 1.200/2.;
897   const Float_t bl1VES = 30.486/2.;
898   const Float_t tl1VES = 32.777/2.;
899   const Float_t alp1VES = 43.67; 
900   const Float_t h2VES = 1.200/2.;
901   const Float_t bl2VES = 30.486/2.;
902   const Float_t tl2VES = 32.777/2.;
903   const Float_t alp2VES = 43.67;
904
905 // VertEarthProfCu parameters - single trapezoid
906   const Float_t hzVPC = hzVertEarthProfCu;
907   const Float_t tetVPC = 0.;
908   const Float_t phiVPC = 0.;
909   const Float_t h1VPC = 0.400/2.;
910   const Float_t bl1VPC = 29.287/2.;
911   const Float_t tl1VPC = 30.091/2.;
912   const Float_t alp1VPC = 45.14; 
913   const Float_t h2VPC = 0.400/2.;
914   const Float_t bl2VPC = 29.287/2.;
915   const Float_t tl2VPC = 30.091/2.;
916   const Float_t alp2VPC = 45.14;
917
918 // SuppLateralPositionner - single cuboid
919   const Float_t hxSLP  = 2.80/2.;
920   const Float_t hySLP  = 5.00/2.;
921   const Float_t hzSLP  = hzLateralPosnAl;
922   
923 // LateralPositionner - squared off U bend, face view
924   const Float_t hxLPF  = 5.2/2.;
925   const Float_t hyLPF  = 3.0/2.;
926   const Float_t hzLPF  = hzLateralPosnInoxFace;
927   
928 // LateralPositionner - squared off U bend, profile view
929   const Float_t hxLPP  = 0.425/2.;
930   const Float_t hyLPP  = 3.0/2.;
931   const Float_t hzLPP  = hzLatPosInoxProfM;  // middle layer
932   const Float_t hzLPNF  = hzLatPosInoxProfNF; // near and far layers
933            
934 // VertCradle, 3 layers (copies), each composed of 4 trapezoids
935 // VertCradleA
936   const Float_t hzVC1 = hzVerticalCradleAl;
937   const Float_t tetVC1 = 0.;
938   const Float_t phiVC1 = 0.;
939   const Float_t h1VC1 = 10.25/2.;
940   const Float_t bl1VC1 = 3.70/2.;
941   const Float_t tl1VC1 = 0.;
942   const Float_t alp1VC1 = -10.23; 
943   const Float_t h2VC1 = 10.25/2.;
944   const Float_t bl2VC1 = 3.70/2.;
945   const Float_t tl2VC1 = 0.;
946   const Float_t alp2VC1 = -10.23;
947         
948 // VertCradleB
949   const Float_t hzVC2 = hzVerticalCradleAl;
950   const Float_t tetVC2 = 0.;
951   const Float_t phiVC2 = 0.;
952   const Float_t h1VC2 = 10.25/2.;
953   const Float_t bl1VC2 = 6.266/2.;
954   const Float_t tl1VC2 = 3.70/2.;
955   const Float_t alp1VC2 = -7.13; 
956   const Float_t h2VC2 = 10.25/2.;
957   const Float_t bl2VC2 = 6.266/2.;
958   const Float_t tl2VC2 = 3.70/2.;
959   const Float_t alp2VC2 = -7.13;
960   
961 // VertCradleC
962   const Float_t hzVC3 = hzVerticalCradleAl;
963   const Float_t tetVC3 = 0.;
964   const Float_t phiVC3 = 0.;
965   const Float_t h1VC3 = 10.25/2.;
966   const Float_t bl1VC3 = 7.75/2.;
967   const Float_t tl1VC3 = 6.266/2.;
968   const Float_t alp1VC3 = -4.14; 
969   const Float_t h2VC3 = 10.25/2.;
970   const Float_t bl2VC3 = 7.75/2.;
971   const Float_t tl2VC3 = 6.266/2.;
972   const Float_t alp2VC3 = -4.14;
973
974 // VertCradleD
975   const Float_t hzVC4 = hzVerticalCradleAl;
976   const Float_t tetVC4 = 0.;
977   const Float_t phiVC4 = 0.;
978   const Float_t h1VC4 = 10.27/2.;
979   const Float_t bl1VC4 = 8.273/2.;
980   const Float_t tl1VC4 = 7.75/2.;
981   const Float_t alp1VC4 = -1.46; 
982   const Float_t h2VC4 = 10.27/2.;
983   const Float_t bl2VC4 = 8.273/2.;
984   const Float_t tl2VC4 = 7.75/2.;
985   const Float_t alp2VC4 = -1.46;
986   
987 // LateralSightSupport - single trapezoid
988   const Float_t hzVSS = hzLateralSightAl;
989   const Float_t tetVSS = 0.;
990   const Float_t phiVSS = 0.;
991   const Float_t h1VSS = 5.00/2.;
992   const Float_t bl1VSS = 7.747/2;
993   const Float_t tl1VSS = 7.188/2.;
994   const Float_t alp1VSS = -3.20; 
995   const Float_t h2VSS = 5.00/2.;
996   const Float_t bl2VSS = 7.747/2.;
997   const Float_t tl2VSS = 7.188/2.;
998   const Float_t alp2VSS = -3.20;  
999   
1000 // LateralSight (reference point) - 3 per quadrant, only 1 programmed for now
1001   const Float_t VSInRad  = 0.6;
1002   const Float_t VSOutRad  = 1.3;
1003   const Float_t VSLen  = hzFrameThickness; 
1004   
1005 //---
1006
1007 // InHFrame parameters
1008   const Float_t hxInHFrame  = 75.8/2.;
1009   const Float_t hyInHFrame  = 1.85/2.;
1010   const Float_t hzInHFrame  = hzFrameThickness;
1011  
1012 //Flat 7.5mm horizontal section
1013   const Float_t hxH1mm  = 1.85/2.;
1014   const Float_t hyH1mm  = 0.75/2.;
1015   const Float_t hzH1mm  = hzFrameThickness;
1016
1017 //---
1018
1019 // InArcFrame parameters
1020   const Float_t IAF  = 15.70;
1021   const Float_t OAF  = 17.55;
1022   const Float_t hzAF  = hzFrameThickness;
1023   const Float_t AFphi1  = 0.0;
1024   const Float_t AFphi2  = 90.0;
1025
1026 //---
1027
1028 // ScrewsInFrame parameters HEAD
1029   const Float_t SCRUHMI  = 0.;
1030   const Float_t SCRUHMA  = 0.690/2.;
1031   const Float_t SCRUHLE  = 0.4/2.;
1032 // ScrewsInFrame parameters MIDDLE
1033   const Float_t SCRUMMI  = 0.;
1034   const Float_t SCRUMMA  = 0.39/2.;
1035   const Float_t SCRUMLE  = hzFrameThickness;
1036 // ScrewsInFrame parameters NUT
1037   const Float_t SCRUNMI  = 0.;
1038   const Float_t SCRUNMA  = 0.78/2.;
1039   const Float_t SCRUNLE  = 0.8/2.;   
1040   
1041        // ___________________Make volumes________________________
1042
1043  Float_t par[11];
1044  Float_t posX,posY,posZ;
1045
1046 // Quadrant volume TUBS1, positioned at the end
1047   par[0] = fgkMotherIR1;
1048   par[1] = fgkMotherOR1; 
1049   par[2] = fgkMotherThick1;  
1050   par[3] = fgkMotherPhiL1; 
1051   par[4] = fgkMotherPhiU1;
1052   gMC->Gsvolu(QuadrantMLayerName(chamber),"TUBS",idAir,par,5);
1053
1054 // Quadrant volume TUBS2, positioned at the end
1055   par[0] = fgkMotherIR2;
1056   par[1] = fgkMotherOR2; 
1057   par[2] = fgkMotherThick2;  
1058   par[3] = fgkMotherPhiL2; 
1059   par[4] = fgkMotherPhiU2;
1060
1061   gMC->Gsvolu(QuadrantNLayerName(chamber),"TUBS",idAir,par,5); 
1062   gMC->Gsvolu(QuadrantFLayerName(chamber),"TUBS",idAir,par,5); 
1063
1064    if (chamber==1) {   
1065     // InVFrame  
1066     par[0] = hxInVFrame;
1067     par[1] = hyInVFrame;
1068     par[2] = hzInVFrame;
1069     gMC->Gsvolu("SQ00","BOX",idFrameEpoxy,par,3);
1070
1071     //Flat 1mm vertical section
1072     par[0] = hxV1mm;
1073     par[1] = hyV1mm;
1074     par[2] = hzV1mm;
1075     gMC->Gsvolu("SQ01","BOX",idFrameEpoxy,par,3); 
1076  
1077 // OutTopFrame 
1078 //
1079 // - 3 components (a cuboid and 2 trapezes) and 2 layers (Epoxy/Inox)
1080 //
1081 //---
1082
1083     // TopFrameAnode - layer 1 of 2 
1084     par[0] = hxTFA;
1085     par[1] = hyTFA;
1086     par[2] = hzTFAE;
1087     gMC->Gsvolu("SQ02","BOX",idFrameEpoxy,par,3);
1088     
1089     // TopFrameAnode - layer 2 of 2 
1090     par[2] = hzTFAI;
1091     gMC->Gsvolu("SQ03","BOX",idInox,par,3);
1092             
1093     // TopFrameAnodeA - layer 1 of 2  
1094     par[0] = hzFAAE;
1095     par[1] = tetFAA;
1096     par[2] = phiFAA;
1097     par[3] = h1FAA;
1098     par[4] = bl1FAA;
1099     par[5] = tl1FAA;
1100     par[6] = alp1FAA;
1101     par[7] = h2FAA;
1102     par[8] = bl2FAA;
1103     par[9] = tl2FAA;
1104     par[10] = alp2FAA;    
1105     gMC->Gsvolu("SQ04","TRAP",idFrameEpoxy,par,11);    
1106
1107     // TopFrameAnodeA - layer 2 of 2
1108     par[0] = hzFAAI;    
1109     gMC->Gsvolu("SQ05","TRAP",idInox,par,11); 
1110       
1111     // TopFrameAnodeB - layer 1 of 2
1112     par[0] = hzFABE;
1113     par[1] = tetFAB;
1114     par[2] = phiFAB;
1115     par[3] = h1FAB;
1116     par[4] = bl1FAB;
1117     par[5] = tl1FAB;
1118     par[6] = alp1FAB;
1119     par[7] = h2FAB;
1120     par[8] = bl2FAB;
1121     par[9] = tl2FAB;
1122     par[10] = alp2FAB;
1123     gMC->Gsvolu("SQ06","TRAP",idFrameEpoxy,par,11);     
1124
1125     // OutTopTrapFrameB - layer 2 of 2
1126     par[0] = hzFABI;   
1127     gMC->Gsvolu("SQ07","TRAP",idInox,par,11);
1128
1129     // TopAnode1 -  layer 1 of 2
1130     par[0] = hxTA1;
1131     par[1] = hyTA1;
1132     par[2] = hzTA11;    
1133     gMC->Gsvolu("SQ08","BOX",idInox,par,3); 
1134     
1135     // TopAnode1 -  layer 2 of 2
1136     par[2] = hzTA12;    
1137     gMC->Gsvolu("SQ09","BOX",idFR4,par,11); 
1138
1139     // TopAnode2 -  layer 1 of 2
1140     par[0] = hzTA21;
1141     par[1] = tetTA2;
1142     par[2] = phiTA2;
1143     par[3] = h1TA2;
1144     par[4] = bl1TA2;
1145     par[5] = tl1TA2;
1146     par[6] = alp1TA2;
1147     par[7] = h2TA2;
1148     par[8] = bl2TA2;
1149     par[9] = tl2TA2;
1150     par[10] = alp2TA2;    
1151     gMC->Gsvolu("SQ10","TRAP",idInox,par,11); 
1152  
1153     // TopAnode2 -  layer 2 of 2
1154     par[0] = hzTA22;    
1155     gMC->Gsvolu("SQ11","TRAP",idFR4,par,11);   
1156
1157     // TopAnode3 -  layer 1 of 1 
1158     par[0] = hzTA3;
1159     par[1] = tetTA3;
1160     par[2] = phiTA3;
1161     par[3] = h1TA3;
1162     par[4] = bl1TA3;
1163     par[5] = tl1TA3;
1164     par[6] = alp1TA3;
1165     par[7] = h2TA3;
1166     par[8] = bl2TA3;
1167     par[9] = tl2TA3;
1168     par[10] = alp2TA3;    
1169     gMC->Gsvolu("SQ12","TRAP",idFR4,par,11); 
1170
1171     // TopEarthFace 
1172     par[0] = hzTEF;
1173     par[1] = tetTEF;
1174     par[2] = phiTEF;
1175     par[3] = h1TEF;
1176     par[4] = bl1TEF;
1177     par[5] = tl1TEF;
1178     par[6] = alp1TEF;
1179     par[7] = h2TEF;
1180     par[8] = bl2TEF;
1181     par[9] = tl2TEF;
1182     par[10] = alp2TEF;    
1183     gMC->Gsvolu("SQ13","TRAP",idCopper,par,11);   
1184
1185     // TopEarthProfile 
1186     par[0] = hzTEP;
1187     par[1] = tetTEP;
1188     par[2] = phiTEP;
1189     par[3] = h1TEP;
1190     par[4] = bl1TEP;
1191     par[5] = tl1TEP;
1192     par[6] = alp1TEP;
1193     par[7] = h2TEP;
1194     par[8] = bl2TEP;
1195     par[9] = tl2TEP;
1196     par[10] = alp2TEP;
1197     gMC->Gsvolu("SQ14","TRAP",idCopper,par,11);       
1198
1199     // TopGasSupport  
1200     par[0] = hxTGS;
1201     par[1] = hyTGS;
1202     par[2] = hzTGS;
1203     gMC->Gsvolu("SQ15","BOX",idAlu,par,3);
1204
1205     // TopPositioner parameters - single Stainless Steel trapezoid 
1206     par[0] = hzTP;
1207     par[1] = tetTP; 
1208     par[2] = phiTP;
1209     par[3] = h1TP;
1210     par[4] = bl1TP; 
1211     par[5] = tl1TP; 
1212     par[6] = alp1TP;
1213     par[7] = h2TP;
1214     par[8] = bl2TP; 
1215     par[9] = tl2TP; 
1216     par[10] = alp2TP;     
1217     gMC->Gsvolu("SQ16","TRAP",idInox,par,11);       
1218
1219 //
1220 // OutEdgeTrapFrame Epoxy = (4 trapezes)*2 copies*2 layers (Epoxy/Inox)
1221 //
1222 //---
1223     // Trapezoid 1 - 2 layers
1224     par[1] = tetOETF;
1225     par[2] = phiOETF;
1226     par[3] = h1OETF;
1227     par[4] = bl1OETF1;
1228     par[5] = tl1OETF1;
1229     par[6] = alp1OETF1;
1230     par[7] = h2OETF;
1231     par[8] = bl2OETF1;
1232     par[9] = tl2OETF1;
1233     par[10] = alp2OETF1; 
1234            
1235     par[0] = hzOETFE;             
1236     gMC->Gsvolu("SQ17","TRAP",idFrameEpoxy,par,11); 
1237     par[0] = hzOETFI;
1238     gMC->Gsvolu("SQ18","TRAP",idInox,par,11);
1239     
1240     // Trapezoid 2 - 2 layers
1241     par[4] = bl1OETF2;
1242     par[5] = tl1OETF2;
1243     par[6] = alp1OETF2;
1244
1245     par[8] = bl2OETF2;
1246     par[9] = tl2OETF2;
1247     par[10] = alp2OETF2; 
1248     
1249     par[0] = hzOETFE;    
1250     gMC->Gsvolu("SQ19","TRAP",idFrameEpoxy,par,11);    
1251     par[0] = hzOETFI;    
1252     gMC->Gsvolu("SQ20","TRAP",idInox,par,11);     
1253     
1254     // Trapezoid 3 - 2 layers
1255     par[4] = bl1OETF3;
1256     par[5] = tl1OETF3;
1257     par[6] = alp1OETF3;
1258
1259     par[8] = bl2OETF3;
1260     par[9] = tl2OETF3;
1261     par[10] = alp2OETF3; 
1262  
1263     par[0] = hzOETFE;    
1264     gMC->Gsvolu("SQ21","TRAP",idFrameEpoxy,par,11);   
1265     par[0] = hzOETFI;    
1266     gMC->Gsvolu("SQ22","TRAP",idInox,par,11);     
1267     
1268     // Trapezoid 4 - 2 layers
1269
1270     par[4] = bl1OETF4;
1271     par[5] = tl1OETF4;
1272     par[6] = alp1OETF4;
1273
1274     par[8] = bl2OETF4;
1275     par[9] = tl2OETF4;
1276     par[10] = alp2OETF4;  
1277    
1278     par[0] = hzOETFE;    
1279     gMC->Gsvolu("SQ23","TRAP",idFrameEpoxy,par,11);    
1280     par[0] = hzOETFI;    
1281     gMC->Gsvolu("SQ24","TRAP",idInox,par,11);     
1282              
1283 //---
1284     // OutVFrame    
1285     par[0] = hxOutVFrame;
1286     par[1] = hyOutVFrame;
1287     par[2] = hzOutVFrame;
1288     gMC->Gsvolu("SQ25","BOX",idFrameEpoxy,par,3);
1289     
1290     // OutVFrame corner  
1291     par[0] = hzOCTF;
1292     par[1] = tetOCTF;
1293     par[2] = phiOCTF;
1294     par[3] = h1OCTF;
1295     par[4] = bl1OCTF;
1296     par[5] = tl1OCTF;
1297     par[6] = alp1OCTF;
1298     par[7] = h2OCTF;
1299     par[8] = bl2OCTF;
1300     par[9] = tl2OCTF;
1301     par[10] = alp2OCTF;    
1302     gMC->Gsvolu("SQ26","TRAP",idFrameEpoxy,par,11);
1303  
1304     // EarthFaceCu trapezoid
1305     par[0] = hzVFC;
1306     par[1] = tetVFC;
1307     par[2] = phiVFC;
1308     par[3] = h1VFC;
1309     par[4] = bl1VFC;
1310     par[5] = tl1VFC;
1311     par[6] = alp1VFC;
1312     par[7] = h2VFC;
1313     par[8] = bl2VFC;
1314     par[9] = tl2VFC;
1315     par[10] = alp2VFC;   
1316     gMC->Gsvolu("SQ27","TRAP",idCopper,par,11);     
1317
1318     // VertEarthSteel trapezoid
1319     par[0] = hzVES;
1320     par[1] = tetVES;
1321     par[2] = phiVES;
1322     par[3] = h1VES;
1323     par[4] = bl1VES;
1324     par[5] = tl1VES;
1325     par[6] = alp1VES;
1326     par[7] = h2VES;
1327     par[8] = bl2VES;
1328     par[9] = tl2VES;
1329     par[10] = alp2VES;    
1330     gMC->Gsvolu("SQ28","TRAP",idInox,par,11); 
1331
1332     // VertEarthProfCu trapezoid       
1333     par[0] = hzVPC;
1334     par[1] = tetVPC;
1335     par[2] = phiVPC;
1336     par[3] = h1VPC;
1337     par[4] = bl1VPC;
1338     par[5] = tl1VPC;
1339     par[6] = alp1VPC;
1340     par[7] = h2VPC;
1341     par[8] = bl2VPC;
1342     par[9] = tl2VPC;
1343     par[10] = alp2VPC;
1344     gMC->Gsvolu("SQ29","TRAP",idCopper,par,11);
1345
1346     // SuppLateralPositionner cuboid    
1347     par[0] = hxSLP;
1348     par[1] = hySLP;
1349     par[2] = hzSLP;
1350     gMC->Gsvolu("SQ30","BOX",idAlu,par,3);
1351
1352     // LateralPositionerFace
1353     par[0] = hxLPF;
1354     par[1] = hyLPF;
1355     par[2] = hzLPF;
1356     gMC->Gsvolu("SQ31","BOX",idInox,par,3);
1357
1358     // LateralPositionerProfile
1359     par[0] = hxLPP;
1360     par[1] = hyLPP;
1361     par[2] = hzLPP;
1362     gMC->Gsvolu("SQ32","BOX",idInox,par,3); // middle layer
1363     
1364     par[0] = hxLPP;
1365     par[1] = hyLPP;
1366     par[2] = hzLPNF;
1367     gMC->Gsvolu("SQ33","BOX",idInox,par,3); // near and far layers
1368
1369     // VertCradleA - 1st trapezoid
1370     par[0] = hzVC1;
1371     par[1] = tetVC1;
1372     par[2] = phiVC1;
1373     par[3] = h1VC1;
1374     par[4] = bl1VC1;
1375     par[5] = tl1VC1;
1376     par[6] = alp1VC1;
1377     par[7] = h2VC1;
1378     par[8] = bl2VC1;
1379     par[9] = tl2VC1;
1380     par[10] = alp2VC1;
1381     gMC->Gsvolu("SQ34","TRAP",idAlu,par,11); 
1382     
1383     // VertCradleB - 2nd trapezoid
1384     par[0] = hzVC2;
1385     par[1] = tetVC2;
1386     par[2] = phiVC2;
1387     par[3] = h1VC2;
1388     par[4] = bl1VC2;
1389     par[5] = tl1VC2;
1390     par[6] = alp1VC2;
1391     par[7] = h2VC2;
1392     par[8] = bl2VC2;
1393     par[9] = tl2VC2;
1394     par[10] = alp2VC2;
1395     gMC->Gsvolu("SQ35","TRAP",idAlu,par,11);  
1396        
1397     // VertCradleC - 3rd trapezoid
1398     par[0] = hzVC3;
1399     par[1] = tetVC3;
1400     par[2] = phiVC3;
1401     par[3] = h1VC3;
1402     par[4] = bl1VC3;
1403     par[5] = tl1VC3;
1404     par[6] = alp1VC3;
1405     par[7] = h2VC3;
1406     par[8] = bl2VC3;
1407     par[9] = tl2VC3;
1408     par[10] = alp2VC3;    
1409     gMC->Gsvolu("SQ36","TRAP",idAlu,par,11);  
1410
1411     // VertCradleD - 4th trapezoid
1412     par[0] = hzVC4;
1413     par[1] = tetVC4;
1414     par[2] = phiVC4;
1415     par[3] = h1VC4;
1416     par[4] = bl1VC4;
1417     par[5] = tl1VC4;
1418     par[6] = alp1VC4;
1419     par[7] = h2VC4;
1420     par[8] = bl2VC4;
1421     par[9] = tl2VC4;
1422     par[10] = alp2VC4;    
1423     gMC->Gsvolu("SQ37","TRAP",idAlu,par,11);  
1424           
1425     // LateralSightSupport trapezoid
1426     par[0] = hzVSS;
1427     par[1] = tetVSS;
1428     par[2] = phiVSS;
1429     par[3] = h1VSS;
1430     par[4] = bl1VSS;
1431     par[5] = tl1VSS;
1432     par[6] = alp1VSS;
1433     par[7] = h2VSS;
1434     par[8] = bl2VSS;
1435     par[9] = tl2VSS;
1436     par[10] = alp2VSS;
1437     gMC->Gsvolu("SQ38","TRAP",idAlu,par,11);
1438
1439     // LateralSight
1440     par[0] = VSInRad;
1441     par[1] = VSOutRad;
1442     par[2] = VSLen;       
1443     gMC->Gsvolu("SQ39","TUBE",idFrameEpoxy,par,3);   
1444
1445 //---
1446     // InHFrame
1447     par[0] = hxInHFrame;
1448     par[1] = hyInHFrame;
1449     par[2] = hzInHFrame;
1450     gMC->Gsvolu("SQ40","BOX",idFrameEpoxy,par,3);
1451
1452     //Flat 7.5mm horizontal section
1453     par[0] = hxH1mm;
1454     par[1] = hyH1mm;
1455     par[2] = hzH1mm;
1456     gMC->Gsvolu("SQ41","BOX",idFrameEpoxy,par,3);
1457
1458     // InArcFrame 
1459     par[0] = IAF;
1460     par[1] = OAF; 
1461     par[2] = hzAF;  
1462     par[3] = AFphi1; 
1463     par[4] = AFphi2;
1464
1465     gMC->Gsvolu("SQ42","TUBS",idFrameEpoxy,par,5);
1466
1467 //---
1468     // ScrewsInFrame - 3 sections in order to avoid overlapping volumes
1469     // Screw Head, in air
1470     par[0] = SCRUHMI;
1471     par[1] = SCRUHMA; 
1472     par[2] = SCRUHLE;  
1473
1474     gMC->Gsvolu("SQ43","TUBE",idInox,par,3);
1475     
1476     // Middle part, in the Epoxy
1477     par[0] = SCRUMMI;
1478     par[1] = SCRUMMA;
1479     par[2] = SCRUMLE;
1480     gMC->Gsvolu("SQ44","TUBE",idInox,par,3);
1481     
1482     // Screw nut, in air
1483     par[0] = SCRUNMI;
1484     par[1] = SCRUNMA;
1485     par[2] = SCRUNLE;   
1486     gMC->Gsvolu("SQ45","TUBE",idInox,par,3);     
1487    }
1488               
1489 // __________________Place volumes in the quadrant ____________ 
1490         
1491     // InVFrame  
1492     posX = hxInVFrame;
1493     posY = 2.0*hyInHFrame+2.*hyH1mm+IAF+hyInVFrame;        
1494     posZ = 0.;
1495     gMC->Gspos("SQ00",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1496
1497     //Flat 7.5mm vertical section
1498     posX = 2.0*hxInVFrame+hxV1mm;
1499     posY = 2.0*hyInHFrame+2.*hyH1mm+IAF+hyV1mm;
1500     posZ = 0.;
1501     gMC->Gspos("SQ01",1,QuadrantMLayerName(chamber),posX, posY, posZ,0, "ONLY"); 
1502     
1503     // TopFrameAnode place 2 layers of TopFrameAnode cuboids  
1504     posX = hxTFA;
1505     posY = 2.*hyInHFrame+2.*hyH1mm+IAF+2.*hyInVFrame+hyTFA;   
1506     posZ = hzOuterFrameInox;
1507     gMC->Gspos("SQ02",1,QuadrantMLayerName(chamber),posX, posY, posZ,0,"ONLY"); 
1508     posZ = posZ+hzOuterFrameInox;
1509     gMC->Gspos("SQ03",1,QuadrantMLayerName(chamber),posX, posY, posZ,0,"ONLY");
1510     
1511     // place 2 layers of TopFrameAnodeA trapezoids 
1512     posX = 35.8932+fgkDeltaQuadLHC;
1513     posY = 92.6745+fgkDeltaQuadLHC;
1514     posZ = hzOuterFrameInox; 
1515     gMC->Gspos("SQ04",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1516     posZ = posZ+hzOuterFrameInox;
1517     gMC->Gspos("SQ05",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1518     
1519     // place 2 layers of TopFrameAnodeB trapezoids 
1520     posX = 44.593+fgkDeltaQuadLHC;
1521     posY = 90.737+fgkDeltaQuadLHC;
1522     posZ = hzOuterFrameInox; 
1523     gMC->Gspos("SQ06",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1524     posZ = posZ+hzOuterFrameInox;
1525     gMC->Gspos("SQ07",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");    
1526
1527     // TopAnode1 place 2 layers  
1528     posX = 6.8+fgkDeltaQuadLHC;
1529     posY = 99.85+fgkDeltaQuadLHC;
1530     posZ = -1.*hzAnodeFR4;
1531     gMC->Gspos("SQ08",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");  
1532     posZ = posZ+hzTopAnodeSteel1;
1533     gMC->Gspos("SQ09",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");    
1534          
1535     // TopAnode2 place 2 layers
1536     posX = 18.534+fgkDeltaQuadLHC;
1537     posY = 99.482+fgkDeltaQuadLHC; 
1538     posZ = -1.*hzAnodeFR4;    
1539     gMC->Gspos("SQ10",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1540     posZ = posZ+hzTopAnodeSteel2;    
1541     gMC->Gspos("SQ11",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");       
1542     
1543     // TopAnode3 place 1 layer
1544     posX = 25.80+fgkDeltaQuadLHC;
1545     posY = 98.61+fgkDeltaQuadLHC;
1546     posZ = 0.;    
1547     gMC->Gspos("SQ12",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");  
1548           
1549     // TopEarthFace - 2 copies
1550     posX = 23.122+fgkDeltaQuadLHC;
1551     posY = 96.90+fgkDeltaQuadLHC;
1552     posZ = hzOuterFrameEpoxy+hzOuterFrameInox+hzTopEarthFaceCu;
1553     gMC->Gspos("SQ13",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1554     posZ = -1.*posZ;
1555     gMC->Gspos("SQ13",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1556
1557     // TopEarthProfile 
1558     posX = 14.475+fgkDeltaQuadLHC;
1559     posY = 97.900+fgkDeltaQuadLHC; 
1560     posZ = hzTopEarthProfileCu;
1561     gMC->Gspos("SQ14",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1562     posZ = -1.0*posZ;
1563     gMC->Gspos("SQ14",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1564
1565     // TopGasSupport - 2 copies                            
1566     posX = 4.9500+fgkDeltaQuadLHC;
1567     posY = 96.200+fgkDeltaQuadLHC;
1568     posZ = hzOuterFrameEpoxy+hzOuterFrameInox+hzTopGasSupportAl;
1569     gMC->Gspos("SQ15",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1570     posZ = -1.*posZ;
1571     gMC->Gspos("SQ15",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1572     
1573     // TopPositioner parameters - single Stainless Steel trapezoid - 2 copies
1574     posX = 7.60+fgkDeltaQuadLHC;
1575     posY = 98.98+fgkDeltaQuadLHC;   
1576     posZ = hzOuterFrameEpoxy+hzOuterFrameInox+2.*hzTopGasSupportAl+hzTopPositionerSteel;
1577     gMC->Gspos("SQ16",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1578     posZ = -1.*posZ;
1579     gMC->Gspos("SQ16",2,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY"); 
1580
1581     // OutEdgeFrame 
1582     Float_t XCenter[8]; 
1583     Float_t YCenter[8];
1584     
1585     XCenter[0] = 73.201 + fgkDeltaQuadLHC;
1586     XCenter[1] = 78.124 + fgkDeltaQuadLHC; 
1587     XCenter[2] = 82.862 + fgkDeltaQuadLHC;
1588     XCenter[3] = 87.418 + fgkDeltaQuadLHC; 
1589     
1590     YCenter[0] = 68.122 + fgkDeltaQuadLHC;
1591     YCenter[1] = 62.860 + fgkDeltaQuadLHC;   
1592     YCenter[2] = 57.420 + fgkDeltaQuadLHC;
1593     YCenter[3] = 51.800 + fgkDeltaQuadLHC; 
1594       
1595     XCenter[4] = 68.122 + fgkDeltaQuadLHC;
1596     XCenter[5] = 62.860 + fgkDeltaQuadLHC; 
1597     XCenter[6] = 57.420 + fgkDeltaQuadLHC;
1598     XCenter[7] = 51.800 + fgkDeltaQuadLHC; 
1599     
1600     YCenter[4] = 73.210 + fgkDeltaQuadLHC;
1601     YCenter[5] = 78.124 + fgkDeltaQuadLHC; 
1602     YCenter[6] = 82.862 + fgkDeltaQuadLHC;
1603     YCenter[7] = 87.418 + fgkDeltaQuadLHC; 
1604       
1605     posZ = -1.0*hzOuterFrameInox;     
1606     gMC->Gspos("SQ17",1,QuadrantMLayerName(chamber), XCenter[0], YCenter[0], posZ, rot2,"ONLY");
1607     gMC->Gspos("SQ17",2,QuadrantMLayerName(chamber), XCenter[4], YCenter[4], posZ, rot3,"ONLY");
1608
1609     gMC->Gspos("SQ19",1,QuadrantMLayerName(chamber), XCenter[1], YCenter[1], posZ, rot2,"ONLY");   
1610     gMC->Gspos("SQ19",2,QuadrantMLayerName(chamber), XCenter[5], YCenter[5], posZ, rot3,"ONLY");
1611
1612     gMC->Gspos("SQ21",1,QuadrantMLayerName(chamber), XCenter[2], YCenter[2], posZ, rot2,"ONLY");
1613     gMC->Gspos("SQ21",2,QuadrantMLayerName(chamber), XCenter[6], YCenter[6], posZ, rot3,"ONLY");
1614     
1615     gMC->Gspos("SQ23",1,QuadrantMLayerName(chamber), XCenter[3], YCenter[3], posZ, rot2,"ONLY");
1616     gMC->Gspos("SQ23",2,QuadrantMLayerName(chamber), XCenter[7], YCenter[7], posZ, rot3,"ONLY");
1617      
1618     posZ = posZ+hzOuterFrameEpoxy;
1619    
1620     gMC->Gspos("SQ18",1,QuadrantMLayerName(chamber), XCenter[0], YCenter[0], posZ, rot2,"ONLY");
1621     gMC->Gspos("SQ18",2,QuadrantMLayerName(chamber), XCenter[4], YCenter[4], posZ, rot3,"ONLY");
1622     
1623     gMC->Gspos("SQ20",1,QuadrantMLayerName(chamber), XCenter[1], YCenter[1], posZ, rot2,"ONLY");   
1624     gMC->Gspos("SQ20",2,QuadrantMLayerName(chamber), XCenter[5], YCenter[5], posZ, rot3,"ONLY");
1625
1626     gMC->Gspos("SQ22",1,QuadrantMLayerName(chamber), XCenter[2], YCenter[2], posZ, rot2,"ONLY");
1627     gMC->Gspos("SQ22",2,QuadrantMLayerName(chamber), XCenter[6], YCenter[6], posZ, rot3,"ONLY");
1628        
1629     gMC->Gspos("SQ24",1,QuadrantMLayerName(chamber), XCenter[3], YCenter[3], posZ, rot2,"ONLY");
1630     gMC->Gspos("SQ24",2,QuadrantMLayerName(chamber), XCenter[7], YCenter[7], posZ, rot3,"ONLY");  
1631
1632 //---    
1633         
1634 // OutVFrame
1635     posX = 2.*hxInVFrame+IAF+2.*hxInHFrame-hxOutVFrame+2.*hxV1mm;
1636     posY = 2.*hyInHFrame+hyOutVFrame;    
1637     posZ = 0.;              
1638     gMC->Gspos("SQ25",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1639
1640     const Float_t TOPY = posY+hyOutVFrame;
1641     const Float_t OUTX = posX;
1642
1643 // OutVFrame corner
1644     posX = OUTX;
1645     posY = TOPY+((bl1OCTF+tl1OCTF)/2.);
1646     posZ = 0.;     
1647     gMC->Gspos("SQ26",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY"); 
1648
1649 // VertEarthFaceCu - 2 copies
1650     posX = 89.4000+fgkDeltaQuadLHC;
1651     posY = 25.79+fgkDeltaQuadLHC;    
1652     posZ = hzFrameThickness+2.0*hzFoam+hzVertEarthFaceCu;              
1653     gMC->Gspos("SQ27",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1654     posZ = -1.0*posZ; 
1655     gMC->Gspos("SQ27",2,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1656     
1657 // VertEarthSteel - 2 copies
1658     posX = 91.00+fgkDeltaQuadLHC;
1659     posY = 30.616+fgkDeltaQuadLHC;    
1660     posZ = hzFrameThickness+2.0*hzFoam+hzVertBarSteel;              
1661     gMC->Gspos("SQ28",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1662     posZ = -1.0*posZ;              
1663     gMC->Gspos("SQ28",2,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY");
1664  
1665 // VertEarthProfCu - 2 copies
1666     posX = 92.000+fgkDeltaQuadLHC;
1667     posY = 29.64+fgkDeltaQuadLHC;    
1668     posZ = hzFrameThickness;              
1669     gMC->Gspos("SQ29",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1670     posZ = -1.0*posZ;    
1671     gMC->Gspos("SQ29",2,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1672
1673 // SuppLateralPositionner - 2 copies 
1674     posX = 90.2-fgkNearFarLHC;
1675     posY = 5.00-fgkNearFarLHC;    
1676     posZ = hzLateralPosnAl-fgkMotherThick2;             
1677     gMC->Gspos("SQ30",1,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1678     posZ = -1.0*posZ;            
1679     gMC->Gspos("SQ30",2,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1680
1681 // LateralPositionner - 2 copies - Face view
1682     posX = 92.175-fgkNearFarLHC-2.*hxLPP;
1683     posY = 5.00-fgkNearFarLHC;   
1684     posZ =2.0*hzLateralPosnAl+hzLateralPosnInoxFace-fgkMotherThick2;              
1685     gMC->Gspos("SQ31",1,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1686     posZ = -1.0*posZ;             
1687     gMC->Gspos("SQ31",2,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1688
1689 // LateralPositionner -  Profile view   
1690     posX = 92.175+fgkDeltaQuadLHC+hxLPF-hxLPP;
1691     posY = 5.00+fgkDeltaQuadLHC;    
1692     posZ = 0.;              
1693     gMC->Gspos("SQ32",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY"); // middle layer
1694
1695     posX = 92.175-fgkNearFarLHC+hxLPF-hxLPP; 
1696     posY = 5.0000-fgkNearFarLHC;    
1697     posZ = fgkMotherThick2-hzLPNF;              
1698     gMC->Gspos("SQ33",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY"); // near layer
1699     posZ = -1.*posZ;
1700     gMC->Gspos("SQ33",2,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY"); // far layer
1701       
1702 // VertCradleA  1st Trapezoid - 3 copies
1703     posX = 95.73+fgkDeltaQuadLHC;
1704     posY = 33.26+fgkDeltaQuadLHC; 
1705     posZ = 0.;              
1706     gMC->Gspos("SQ34",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");  
1707
1708     posX = 95.73-fgkNearFarLHC;
1709     posY = 33.26-fgkNearFarLHC;
1710     posZ = 2.0*hzLateralSightAl+hzVerticalCradleAl-fgkMotherThick2;               
1711     gMC->Gspos("SQ34",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1712     posZ = -1.0*posZ;              
1713     gMC->Gspos("SQ34",3,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1714
1715 // VertCradleB  2nd Trapezoid - 3 copies
1716     posX = 97.29+fgkDeltaQuadLHC;
1717     posY = 23.02+fgkDeltaQuadLHC;    
1718     posZ = 0.;              
1719     gMC->Gspos("SQ35",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1720
1721     posX = 97.29-fgkNearFarLHC;
1722     posY = 23.02-fgkNearFarLHC;   
1723     posZ = 2.0*hzLateralSightAl+hzVerticalCradleAl-fgkMotherThick2;          
1724     gMC->Gspos("SQ35",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY");    
1725     posZ = -1.0*posZ;          
1726     gMC->Gspos("SQ35",3,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1727
1728 // OutVertCradleC  3rd Trapeze - 3 copies
1729     posX = 98.31+fgkDeltaQuadLHC;
1730     posY = 12.77+fgkDeltaQuadLHC;  
1731     posZ = 0.;              
1732     gMC->Gspos("SQ36",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1733
1734     posX = 98.31-fgkNearFarLHC;
1735     posY = 12.77-fgkNearFarLHC;        
1736
1737     posZ = 2.0*hzLateralSightAl+hzVerticalCradleAl-fgkMotherThick2;         
1738     gMC->Gspos("SQ36",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY");       
1739     posZ = -1.0*posZ;
1740     gMC->Gspos("SQ36",3,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY");  
1741
1742 // OutVertCradleD  4th Trapeze - 3 copies
1743     posX = 98.81+fgkDeltaQuadLHC;
1744     posY = 2.52+fgkDeltaQuadLHC;    
1745     posZ = 0.;              
1746     gMC->Gspos("SQ37",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1747    
1748     posZ = fgkMotherThick1-hzVerticalCradleAl;                
1749     gMC->Gspos("SQ37",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1750     posZ = -1.0*posZ;          
1751     gMC->Gspos("SQ37",3,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");          
1752              
1753 // LateralSightSupport - 2 copies
1754     posX = 98.53-fgkNearFarLHC;
1755     posY = 10.00-fgkNearFarLHC;    
1756     posZ = hzLateralSightAl-fgkMotherThick2;
1757     gMC->Gspos("SQ38",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1758     posZ = -1.0*posZ;             
1759     gMC->Gspos("SQ38",2,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1760     
1761 // Mire placement
1762     posX = 92.84+fgkDeltaQuadLHC;  
1763     posY = 8.13+fgkDeltaQuadLHC;
1764     posZ = 0.;
1765     gMC->Gspos("SQ39",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");    
1766
1767 //---
1768
1769 // InHFrame
1770     posX = 2.0*hxInVFrame+2.*hxV1mm+IAF+hxInHFrame;
1771     posY = hyInHFrame;
1772     posZ = 0.;       
1773     gMC->Gspos("SQ40",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1774  
1775 // Flat 7.5mm horizontal section
1776     posX = 2.0*hxInVFrame+2.*hxV1mm+IAF+hxH1mm;
1777     posY = 2.0*hyInHFrame+hyH1mm;
1778     posZ = 0.;
1779     gMC->Gspos("SQ41",1,QuadrantMLayerName(chamber),posX, posY, posZ,0, "ONLY"); 
1780         
1781 // InArcFrame 
1782     posX = 2.0*hxInVFrame+2.*hxV1mm;
1783     posY = 2.0*hyInHFrame+2.*hyH1mm;
1784     posZ = 0.;    
1785     gMC->Gspos("SQ42",1,QuadrantMLayerName(chamber),posX, posY, posZ,0, "ONLY"); 
1786
1787 // ScrewsInFrame - in sensitive volume
1788
1789      Float_t scruX[64];
1790      Float_t scruY[64]; 
1791          
1792 // Screws on IHEpoxyFrame
1793
1794      const Int_t NumberOfScrewsIH = 14;    // no. of screws on the IHEpoxyFrame
1795      const Float_t offX = 5.;              // inter-screw distance 
1796
1797      // first screw coordinates 
1798      scruX[0] = 21.07;                  
1799      scruY[0] = -2.23; 
1800      // other screw coordinates      
1801      for (Int_t i = 1;i<NumberOfScrewsIH;i++){   
1802      scruX[i] = scruX[i-1]+offX; 
1803      scruY[i] = scruY[0];
1804      }    
1805      // Position the volumes on the frames
1806      for (Int_t i = 0;i<NumberOfScrewsIH;i++){
1807      posX = fgkDeltaQuadLHC + scruX[i];
1808      posY = fgkDeltaQuadLHC + scruY[i];
1809      posZ = 0.;   
1810      gMC->Gspos("SQ43",i+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-hzInHFrame-SCRUHLE, 0, "ONLY");      
1811      gMC->Gspos("SQ44",i+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ, 0, "ONLY");
1812      gMC->Gspos("SQ45",i+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+hzInHFrame+SCRUNLE, 0, "ONLY"); 
1813      }
1814      // special screw coordinates
1815      scruX[63] = 16.3;  
1816      scruY[63] = -2.23; 
1817      posX = fgkDeltaQuadLHC + scruX[63];
1818      posY = fgkDeltaQuadLHC + scruY[63];
1819      posZ = 0.;            
1820      gMC->Gspos("SQ43",64,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-hzInHFrame-SCRUHLE, 0, "ONLY");
1821      gMC->Gspos("SQ44",64,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ, 0, "ONLY"); 
1822      gMC->Gspos("SQ45",64,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+hzInHFrame+SCRUNLE, 0, "ONLY");  
1823      
1824 // Screws on the IVEpoxyFrame
1825   
1826     const Int_t NumberOfScrewsIV = 15;     // no. of screws on the IVEpoxyFrame
1827     const Float_t offY = 5.;               // inter-screw distance 
1828     Int_t FirstScrew = 58;
1829     Int_t LastScrew = 44;
1830  
1831     // first (special) screw coordinates
1832     scruX[FirstScrew-1] = -2.23; 
1833     scruY[FirstScrew-1] = 16.3; 
1834     // second (repetitive) screw coordinates
1835     scruX[FirstScrew-2] = -2.23; 
1836     scruY[FirstScrew-2] = 21.07;     
1837     // other screw coordinates      
1838     for (Int_t i = FirstScrew-3;i>LastScrew-2;i--){   
1839     scruX[i] = scruX[FirstScrew-2];
1840     scruY[i] = scruY[i+1]+offY;
1841     }
1842     
1843     for (Int_t i = 0;i<NumberOfScrewsIV;i++){
1844     posX = fgkDeltaQuadLHC + scruX[i+LastScrew-1];
1845     posY = fgkDeltaQuadLHC + scruY[i+LastScrew-1];
1846     posZ = 0.;       
1847     gMC->Gspos("SQ43",i+LastScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-hzInHFrame-SCRUHLE, 0, "ONLY");     
1848     gMC->Gspos("SQ44",i+LastScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ, 0, "ONLY"); 
1849     gMC->Gspos("SQ45",i+LastScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+hzInHFrame+SCRUNLE, 0, "ONLY");
1850     }    
1851     
1852 // Screws on the OVEpoxyFrame
1853   
1854     const Int_t NumberOfScrewsOV = 10;     // no. of screws on the OVEpoxyFrame
1855
1856     FirstScrew = 15;
1857     LastScrew = 25;
1858  
1859     // first (repetitive) screw coordinates
1860     scruX[FirstScrew-1] = 90.9; 
1861     scruY[FirstScrew-1] = -2.23;  // true value
1862  
1863     // other screw coordinates      
1864     for (Int_t i = FirstScrew; i<LastScrew; i++ ){   
1865     scruX[i] = scruX[FirstScrew-1];
1866     scruY[i] = scruY[i-1]+offY;
1867     }
1868     for (Int_t i = 0;i<NumberOfScrewsOV;i++){
1869     posX = fgkDeltaQuadLHC + scruX[i+FirstScrew-1];
1870     posY = fgkDeltaQuadLHC + scruY[i+FirstScrew-1];
1871     posZ = 0.;   
1872     gMC->Gspos("SQ43",i+FirstScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-hzInHFrame-SCRUHLE, 0, "ONLY");     
1873     gMC->Gspos("SQ44",i+FirstScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ, 0, "ONLY"); 
1874     gMC->Gspos("SQ45",i+FirstScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+hzInHFrame+SCRUNLE, 0, "ONLY"); 
1875     }
1876       
1877 // Inner Arc of Frame, screw positions and numbers-1
1878    scruX[62] = 16.009; scruY[62]  = 1.401;
1879    scruX[61] = 14.564; scruY[61]  = 6.791;
1880    scruX[60] = 11.363; scruY[60]  = 11.363;
1881    scruX[59] = 6.791 ; scruY[59]  = 14.564;
1882    scruX[58] = 1.401 ; scruY[58]  = 16.009;
1883     
1884     for (Int_t i = 0;i<5;i++){
1885     posX = fgkDeltaQuadLHC + scruX[i+58];
1886     posY = fgkDeltaQuadLHC + scruY[i+58];
1887     posZ = 0.;   
1888     gMC->Gspos("SQ43",i+58+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-hzInHFrame-SCRUHLE, 0, "ONLY");    
1889     gMC->Gspos("SQ44",i+58+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ, 0, "ONLY");
1890     gMC->Gspos("SQ45",i+58+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+hzInHFrame+SCRUNLE, 0, "ONLY");
1891     }
1892 }
1893
1894 //______________________________________________________________________________
1895 void AliMUONv2::PlaceInnerLayers(Int_t chamber)
1896 {
1897 // Place the gas and copper layers for the specified chamber.
1898 // --
1899
1900 // Rotation Matrices 
1901   Int_t rot1, rot2, rot3, rot4;   
1902
1903   AliMatrix(rot1,  90., 315., 90.,  45., 0., 0.); // -45 deg
1904   AliMatrix(rot2,  90.,  90., 90., 180., 0., 0.); //  90 deg
1905   AliMatrix(rot3,  90., 270., 90.,   0., 0., 0.); // -90 deg 
1906   AliMatrix(rot4,  90.,  45., 90., 135., 0., 0.); //  deg 
1907
1908   GReal_t x;
1909   GReal_t y;
1910   GReal_t zg = 0.;
1911   GReal_t zc = fgkHzGas + fgkHzPadPlane;
1912   Int_t dpos = (chamber-1)*2;
1913   TString name;
1914   
1915   x = 14.53 + fgkDeltaQuadLHC;
1916   y = 53.34 + fgkDeltaQuadLHC;
1917   name = GasVolumeName("SAG", chamber);
1918   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,0,"ONLY");
1919   gMC->Gspos("SA1C", 1+dpos, QuadrantMLayerName(chamber),x,y, zc,0,"ONLY");
1920   gMC->Gspos("SA1C", 2+dpos, QuadrantMLayerName(chamber),x,y,-zc,0,"ONLY");
1921
1922   x = 40.67 + fgkDeltaQuadLHC;
1923   y = 40.66 + fgkDeltaQuadLHC;    
1924   name = GasVolumeName("SBG", chamber);
1925   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot1,"ONLY"); 
1926   gMC->Gspos("SB1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot1,"ONLY");
1927   gMC->Gspos("SB1C", 2+dpos, QuadrantMLayerName(chamber),x,y,-zc,rot1,"ONLY");
1928
1929   x = 53.34 + fgkDeltaQuadLHC;
1930   y = 14.52 + fgkDeltaQuadLHC; 
1931   name = GasVolumeName("SCG", chamber);
1932   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot2,"ONLY");
1933   gMC->Gspos("SC1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot2,"ONLY");
1934   gMC->Gspos("SC1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot2,"ONLY");
1935
1936   x = 5.83 + fgkDeltaQuadLHC;
1937   y = 17.29 + fgkDeltaQuadLHC;
1938   name = GasVolumeName("SDG", chamber);
1939   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot3,"ONLY");
1940   gMC->Gspos("SD1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot3,"ONLY");
1941   gMC->Gspos("SD1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot3,"ONLY");
1942
1943   x = 9.04 + fgkDeltaQuadLHC;
1944   y = 16.91 + fgkDeltaQuadLHC; 
1945   name = GasVolumeName("SEG", chamber);
1946   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,0,"ONLY");
1947   gMC->Gspos("SE1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,0,"ONLY");
1948   gMC->Gspos("SE1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,0,"ONLY");
1949
1950   x = 10.12 + fgkDeltaQuadLHC;
1951   y = 14.67 + fgkDeltaQuadLHC;  
1952   name = GasVolumeName("SFG", chamber);
1953   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot4,"ONLY");   
1954   gMC->Gspos("SF1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot4,"ONLY");
1955   gMC->Gspos("SF1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot4,"ONLY");
1956
1957   x = 8.2042 + fgkDeltaQuadLHC;
1958   y = 16.19 + fgkDeltaQuadLHC;
1959   name = GasVolumeName("SGG", chamber);
1960   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot4,"ONLY");
1961   gMC->Gspos("SG1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot4,"ONLY");
1962   gMC->Gspos("SG1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot4,"ONLY");
1963
1964   x = 14.68 + fgkDeltaQuadLHC;
1965   y = 10.10 + fgkDeltaQuadLHC;
1966   name = GasVolumeName("SHG", chamber);
1967   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot4,"ONLY");
1968   gMC->Gspos("SH1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot4,"ONLY");
1969   gMC->Gspos("SH1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot4,"ONLY");
1970
1971   x = 16.21 + fgkDeltaQuadLHC;
1972   y = 8.17 + fgkDeltaQuadLHC;
1973   name = GasVolumeName("SIG", chamber);
1974   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot4,"ONLY");
1975   gMC->Gspos("SI1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot4,"ONLY");
1976   gMC->Gspos("SI1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot4,"ONLY");
1977
1978   x = 16.92 + fgkDeltaQuadLHC;
1979   y = 9.02 + fgkDeltaQuadLHC;
1980   name = GasVolumeName("SJG", chamber);
1981   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot3,"ONLY");
1982   gMC->Gspos("SJ1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot3,"ONLY");
1983   gMC->Gspos("SJ1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot3,"ONLY");
1984
1985   x =  17.30 + fgkDeltaQuadLHC;
1986   y =  5.85 + fgkDeltaQuadLHC;
1987   name = GasVolumeName("SKG", chamber);
1988   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,0,"ONLY");
1989   gMC->Gspos("SK1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,0,"ONLY");
1990   gMC->Gspos("SK1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,0,"ONLY");
1991 }
1992
1993 //______________________________________________________________________________
1994 void AliMUONv2::PlaceSector(AliMpSector* sector,TSpecialMap specialMap, 
1995                             const TVector3& where, Bool_t reflectZ, Int_t chamber)
1996 {
1997 // Place all the segments in the mother volume, at the position defined
1998 // by the sector's data.
1999 // --
2000
2001   static Int_t segNum=1;
2002   Int_t sgn;
2003   Int_t reflZ;
2004   Int_t rotMat;
2005
2006   if (!reflectZ) {
2007     sgn= 1;
2008     reflZ=0;                                     // no reflection along z... nothing
2009     AliMatrix(rotMat,  90.,90.,90,180.,0.,0.);   // 90° rotation around z, NO reflection along z
2010   } else  {
2011     sgn=-1;
2012     AliMatrix(reflZ,  90.,0.,90,90.,180.,0.);    // reflection along z
2013     AliMatrix(rotMat,  90.,90.,90,180.,180.,0.); // 90° rotation around z AND reflection along z
2014   }
2015   
2016   GReal_t posX,posY,posZ;
2017   
2018   IntVector already_done;
2019   for (Int_t irow=0;irow<sector->GetNofRows();irow++){ // for each row
2020     AliMpRow* row = sector->GetRow(irow);
2021
2022
2023     for (Int_t iseg=0;iseg<row->GetNofRowSegments();iseg++){ // for each row segment
2024       AliMpVRowSegment* seg = row->GetRowSegment(iseg);
2025       char segName[5];
2026       
2027       TSpecialMap::iterator iter 
2028         = specialMap.find(seg->GetMotifPositionId(0));
2029
2030       if ( iter == specialMap.end()){ //if this is a normal segment (ie. not part of <specialMap>)
2031       
2032         // create the cathode part
2033         sprintf(segName,"%.3dM", segNum);
2034         CreatePlaneSegment(segName, seg->Dimensions()/10., seg->GetNofMotifs());
2035   
2036         posX = where.X() + seg->Position().X()/10.;
2037         posY = where.Y() + seg->Position().Y()/10.;
2038         posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
2039         gMC->Gspos(segName, 1, QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
2040
2041         // and place all the daughter boards of this segment
2042         for (Int_t motifNum=0;motifNum<seg->GetNofMotifs();motifNum++) {
2043           Int_t motifPosId = seg->GetMotifPositionId(motifNum);
2044           AliMpMotifPosition* motifPos = 
2045             sector->GetMotifMap()->FindMotifPosition(motifPosId);
2046   
2047           posX = where.X() + motifPos->Position().X()/10.+fgkOffsetX;
2048           posY = where.Y() + motifPos->Position().Y()/10.+fgkOffsetY;
2049           posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
2050           gMC->Gspos(fgkDaughterName, motifPosId, QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
2051         }  
2052         segNum++;
2053         
2054       } else { 
2055
2056         // if this is a special segment 
2057         for (Int_t motifNum=0;motifNum<seg->GetNofMotifs();motifNum++) {// for each motif
2058
2059           Int_t motifPosId = seg->GetMotifPositionId(motifNum);
2060           
2061           if (find(already_done.begin(),already_done.end(),motifPosId)
2062               != already_done.end()) continue; // don't treat the same motif twice
2063           
2064           AliMUONSt1SpecialMotif spMot = specialMap[motifPosId];
2065           AliMpMotifPosition* motifPos = sector->GetMotifMap()->FindMotifPosition(motifPosId);
2066
2067           // place the hole for the motif, wrt the requested rotation angle
2068           Int_t rot = ( spMot.GetRotAngle()<0.1 ) ? reflZ:rotMat;
2069
2070           posX = where.X() + motifPos->Position().X()/10.+spMot.GetDelta().X();
2071           posY = where.Y() + motifPos->Position().Y()/10.+spMot.GetDelta().Y();
2072           posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
2073           gMC->Gspos(fgkHoleName, motifPosId, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
2074
2075           // then place the daughter board for the motif, wrt the requested rotation angle
2076           posX = posX+fgkDeltaFilleEtamX;
2077           posY = posY+fgkDeltaFilleEtamY;
2078           posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
2079           gMC->Gspos(fgkDaughterName, motifPosId, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
2080
2081           already_done.push_back(motifPosId);// mark this motif as done
2082         }               
2083       }// end of special motif case
2084     }
2085   }
2086
2087
2088 //______________________________________________________________________________
2089 TString AliMUONv2::GasVolumeName(const TString& name, Int_t chamber) const
2090 {
2091 // Inserts the chamber number into the name.
2092 // ---
2093
2094   TString newString(name);
2095  
2096   TString number(""); 
2097   number += chamber;
2098
2099   newString.Insert(2, number);
2100   
2101   return newString;
2102 }
2103
2104 //______________________________________________________________________________
2105 Bool_t AliMUONv2::IsInChamber(Int_t ich, Int_t volGid) const
2106 {
2107 // True if volume <volGid> is part of the sensitive 
2108 // volumes of chamber <ich> 
2109 // ---
2110   for (Int_t i = 0; i < fChamberV2[ich]->GetSize(); i++) {
2111       if (fChamberV2[ich]->At(i) == volGid) return kTRUE;
2112   }
2113   return kFALSE;
2114 }
2115
2116 //
2117 // protected methods
2118 //
2119
2120 //______________________________________________________________________________
2121 Int_t  AliMUONv2::GetChamberId(Int_t volId) const
2122 {
2123 // Check if the volume with specified  volId is a sensitive volume (gas) 
2124 // of some chamber and returns the chamber number;
2125 // if not sensitive volume - return 0.
2126 // ---
2127
2128   for (Int_t i = 1; i <=2; i++) 
2129      if (IsInChamber(i-1,volId)) return i;
2130   
2131   for (Int_t i = 3; i <= AliMUONConstants::NCh(); i++)
2132     if (volId==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) return i;
2133
2134   return 0;
2135 }
2136
2137 //
2138 // public methods
2139 //
2140
2141 //______________________________________________________________________________
2142 void AliMUONv2::CreateMaterials()
2143 {
2144 // --- Define the various mixtures for GEANT ---
2145   
2146   //     Ar-CO2 gas (80%+20%)
2147   Float_t ag1[2]   = { 39.95,44.01};
2148   Float_t zg1[2]   = { 18.,22.};
2149   Float_t dg1      = .001821;
2150   Float_t wg1[2]   = { .8,0.2};
2151   // use wg1 weighting factors (6th arg > 0)
2152   AliMixture(22, "ArCO2 80%$", ag1, zg1, dg1, 2, wg1);  
2153   
2154   // Ar-buthane-freon gas -- trigger chambers 
2155   Float_t atr1[4]  = { 39.95,12.01,1.01,19. };
2156   Float_t ztr1[4]  = { 18.,6.,1.,9. };
2157   Float_t wtr1[4]  = { .56,.1262857,.2857143,.028 };
2158   Float_t dtr1     = .002599;
2159   AliMixture(23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
2160
2161   // Rohacell 51  - imide methacrylique
2162   Float_t aRohacell51[4] = {12.01,1.01,16.00,14.01}; 
2163   Float_t zRohacell51[4] = {6.,1.,8.,7.}; 
2164   Float_t dRohacell51 = 0.052;
2165   Float_t wRohacell51[4] = {9.,13.,2.,1.};  
2166   // use relative A (molecular) values (6th arg < 0)
2167   AliMixture(32, "FOAM$",aRohacell51,zRohacell51,dRohacell51,-4,wRohacell51);  
2168    
2169   Float_t aSnPb[2] = {118.69,207.19};
2170   Float_t zSnPb[2] = {50,82};
2171   Float_t dSnPb = 8.926;
2172   Float_t wSnPb[2] = {0.6, 0.4} ;
2173   // use wSnPb weighting factors (6th arg > 0)
2174   AliMixture(35, "SnPb$", aSnPb,zSnPb,dSnPb,2,wSnPb);
2175
2176   // plastic definition from K5, Freiburg (found on web)
2177   Float_t aPlastic[2]={1.01,12.01};
2178   Float_t zPlastic[2]={1,6};
2179   Float_t denPlastic=1.107;
2180   Float_t wPlastic[2]={1,1};
2181   // use relative A (molecular) values (6th arg < 0)...no other info...
2182   AliMixture( 33, "Plastic$",aPlastic,zPlastic,denPlastic,-2,wPlastic);
2183  
2184   // from CERN note NUFACT Note023, Oct.2000 
2185   // Inox/Stainless Steel (18%Cr, 9%Ni)
2186   Float_t aInox[3] = {55.847,51.9961,58.6934};  
2187   Float_t zInox[3] = {26.,24.,28.};
2188   Float_t denInox = 7.930;
2189   Float_t wInox[3] = {0.73,0.18,0.09}; 
2190   // use wInox weighting factors (6th arg > 0) 
2191   AliMixture(37, "StainlessSteel$",aInox,zInox,denInox,3,wInox);   
2192
2193   // bakelite 
2194   Float_t abak[3] = {12.01 , 1.01 , 16.};
2195   Float_t zbak[3] = {6.     , 1.   , 8.};
2196   Float_t wbak[3] = {6.     , 6.   , 1.}; 
2197   Float_t dbak = 1.4;
2198   AliMixture(19, "Bakelite$", abak, zbak, dbak, -3, wbak);
2199   
2200   // Ar-Isobutane gas (80%+20%) 
2201   Float_t ag[3]    = { 39.95,12.01,1.01 };
2202   Float_t zg[3]    = { 18.,6.,1. };
2203   Float_t wg[3]    = { .8,.057,.143 };
2204   Float_t dg       = .0019596;
2205   AliMixture(20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
2206
2207   //     Ar-Isobutane-Forane-SF6 gas (49%+7%+40%+4%) -- trigger 
2208   Float_t atrig[5] = { 39.95,12.01,1.01,19.,32.066 };
2209   Float_t ztrig[5] = { 18.,6.,1.,9.,16. };
2210   Float_t wtrig[5] = { .49,1.08,1.5,1.84,0.04 };
2211   Float_t dtrig    = .0031463;
2212   AliMixture(21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
2213       
2214 // --- Define the various AliMaterials for GEANT ---
2215   // from PDG and "The Particle Detector BriefBook", Bock and Vasilescu, P.18  
2216   AliMaterial( 9, "Aluminium$", 26.98, 13., 2.7, -8.9, 26.1);
2217   AliMaterial(10, "Aluminium$", 26.98, 13., 2.7, -8.9, 26.1);
2218   AliMaterial(15, "air$", 14.61, 7.3, .001205, -30423.24, 67500);
2219   AliMaterial(30, "Copper$", 63.546,29.,8.96,-1.43,9.6);
2220   AliMaterial(31, "FR4$", 17.749, 8.875, 1.7, -19.4, 999.);    // from DPG
2221   AliMaterial(34, "Kapton$", 12.01,6,1.42,-28.6,999);          // from DPG
2222  // Density of FrameEpoxy only from manufacturer's specifications
2223  // Frame composite epoxy , X0 in g/cm**2 (guestimation!)
2224   AliMaterial(36, "FrameEpoxy",12.24,6.0,1.85,-19.14,999);// use 16.75cm
2225   
2226 // --- Define the tracking medias (AliMediums) for GEANT ---
2227   GReal_t epsil  = .001;       // Tracking precision,
2228   GReal_t stemax = -1.;        // Maximum displacement for multiple scat
2229   GReal_t tmaxfd = -20.;       // Maximum angle due to field deflection
2230   GReal_t deemax = -.3;        // Maximum fractional energy loss, DLS
2231   GReal_t stmin  = -.8;
2232   GReal_t maxStepAlu = 0.001;  // from AliMUON.cxx
2233   GReal_t maxDestepAlu = -1.;  // from AliMUON.cxx
2234   GReal_t maxStepGas=0.01;     // from AliMUON.cxx
2235
2236   Int_t iSXFLD   = gAlice->Field()->Integ();
2237   Float_t sXMGMX = gAlice->Field()->Max();
2238
2239   AliMedium(1, "AIR_CH_US$", 15, 1, iSXFLD, sXMGMX, tmaxfd,
2240             stemax, deemax, epsil, stmin);
2241   AliMedium(4, "ALU_CH_US$", 9, 0, iSXFLD, sXMGMX, tmaxfd,
2242             maxStepAlu, maxDestepAlu, epsil, stmin);
2243   AliMedium(5, "ALU_CH_US$", 10, 0, iSXFLD, sXMGMX, tmaxfd,
2244             maxStepAlu,maxDestepAlu, epsil, stmin);  
2245   AliMedium(6, "AR_CH_US          ", 20, 1, iSXFLD, sXMGMX, 
2246               tmaxfd, fMaxStepGas,fMaxDestepGas, epsil, stmin);
2247               
2248   //    Ar-Isobuthane-Forane-SF6 gas 
2249   AliMedium(7, "GAS_CH_TRIGGER    ", 21, 1, iSXFLD, sXMGMX, 
2250                tmaxfd, stemax, deemax, epsil, stmin);
2251   AliMedium(8, "BAKE_CH_TRIGGER   ", 19, 0, iSXFLD, sXMGMX, 
2252                tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
2253
2254   AliMedium(9, "ArCO2 80%$", 22, 1, iSXFLD, sXMGMX, tmaxfd, maxStepGas,
2255               maxDestepAlu, epsil, stmin);
2256   AliMedium(10, "COPPER_CH$", 30, 0, iSXFLD, sXMGMX, tmaxfd,
2257               maxStepAlu, maxDestepAlu, epsil, stmin);
2258   AliMedium(11, "PCB_COPPER        ", 31, 0, iSXFLD, sXMGMX, tmaxfd, 
2259                 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
2260   AliMedium(12, "VETRONITE         ", 32, 0, iSXFLD, sXMGMX, tmaxfd, 
2261                 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
2262   AliMedium(13, "CARBON            ", 33, 0, iSXFLD, sXMGMX, tmaxfd, 
2263                 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
2264   AliMedium(14, "Rohacell          ", 34, 0, iSXFLD, sXMGMX, tmaxfd, 
2265               fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
2266   AliMedium(15, "FR4_CH$",  31, 0,iSXFLD, sXMGMX, 10., .01,.1, .003, .003);
2267   AliMedium(16, "FOAM_CH$", 32, 0,
2268               iSXFLD, sXMGMX, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
2269   AliMedium(17, "Plastic$", 33, 0,iSXFLD, sXMGMX,  10., .01, 1., .003, .003);
2270   AliMedium(18, "Kapton$", 34, 0,iSXFLD, sXMGMX,  10., .01, 1., .003, .003);
2271   AliMedium(19, "SnPb$", 35, 0,iSXFLD, sXMGMX,  10., .01,  1., .003, .003);
2272   AliMedium(20, "FrameCH$", 36, 1,iSXFLD, sXMGMX,  10., .001, 0.001, .001, .001);
2273   AliMedium(21, "InoxBolts$", 37,1,iSXFLD, sXMGMX,  10., .01, 1., .003, .003);
2274
2275 // store the parameters
2276   Float_t a, z, dens, absl;
2277   char matName[5];
2278   AliGetMaterial(30,matName,a,z,dens,fRadlCopper,absl);
2279   AliGetMaterial(31,matName,a,z,dens,fRadlFR4,absl);
2280   AliGetMaterial(32,matName,a,z,dens,fRadlFoam,absl);
2281 }
2282
2283 //______________________________________________________________________________
2284 void AliMUONv2::CreateGeometry()
2285 {
2286 // Create the GEANT geometry for the dimuon arm.
2287 // Use the parent's method for stations 2, 3, 4 and 5.
2288 // Use the detailed code for the first station.
2289 // --
2290   cout << "AliMUONv2::CreateGeometry()" << endl;
2291   cout << "_________________________________________" << endl;
2292
2293   // Create basic volumes
2294   // 
2295   CreateHole();
2296   CreateDaughterBoard();
2297   CreateInnerLayers();
2298   
2299   // Create reflexion matrices
2300   //
2301   Int_t reflXZ, reflYZ, reflXY;
2302   AliMatrix(reflXZ,  90.,  180., 90., 90., 180., 0.);
2303   AliMatrix(reflYZ,  90., 0., 90.,-90., 180., 0.);
2304   AliMatrix(reflXY,  90., 180., 90., 270., 0., 0.);
2305
2306   // Define transformations for each quadrant
2307   // 
2308   //     II. |  I.
2309   //   _____ | ____
2310   //         |
2311   //    III. |  IV.
2312   // 
2313   Int_t rotm[4];
2314   rotm[0]=0;       // quadrant I
2315   rotm[1]=reflXZ;  // quadrant II
2316   rotm[2]=reflXY;  // quadrant III
2317   rotm[3]=reflYZ;  // quadrant IV
2318   
2319   TVector3 scale[4];  
2320   scale[0] = TVector3( 1,  1,  1);  // quadrant I
2321   scale[1] = TVector3(-1,  1, -1);  // quadrant II
2322   scale[2] = TVector3(-1, -1,  1);  // quadrant III
2323   scale[3] = TVector3( 1, -1, -1);  // quadrant IV
2324   
2325   // Shift in Z of the middle layer
2326   Double_t deltaZ = 6.5/2.;         
2327
2328   // Position of quadrant I wrt to the chamber position
2329   TVector3 pos0(-fgkDeltaQuadLHC, -fgkDeltaQuadLHC, deltaZ);
2330
2331   // Shift for near/far layers
2332   GReal_t  shiftXY = fgkFrameOffset;
2333   GReal_t  shiftZ  = fgkMotherThick1+fgkMotherThick2;
2334
2335   // Build two chambers
2336   //
2337   for (Int_t ich=1; ich<3; ich++) {
2338
2339     // Create quadrant volume
2340     CreateQuadrant(ich);
2341
2342     // Place gas volumes
2343     PlaceInnerLayers(ich);
2344     
2345     // Place the quadrant
2346     for (Int_t i=0; i<4; i++) {
2347
2348       // Middle layer
2349       GReal_t posx = pos0.X() * scale[i].X();
2350       GReal_t posy = pos0.Y() * scale[i].Y();
2351       GReal_t posz = pos0.Z() * scale[i].Z() + AliMUONConstants::DefaultChamberZ(ich-1);
2352       gMC->Gspos(QuadrantMLayerName(ich), i+1, "ALIC", posx, posy, posz, rotm[i], "ONLY");
2353
2354       // Near/far layers
2355       Real_t  posx2 = posx + shiftXY * scale[i].X();
2356       Real_t  posy2 = posy + shiftXY * scale[i].Y();
2357       Real_t  posz2 = posz - scale[i].Z()*shiftZ;
2358       gMC->Gspos(QuadrantNLayerName(ich), i+1, "ALIC", posx2, posy2, posz2, rotm[i],"ONLY");
2359     
2360       posz2 = posz + scale[i].Z()*shiftZ;
2361       gMC->Gspos(QuadrantFLayerName(ich), i+1, "ALIC", posx2, posy2, posz2, rotm[i],"ONLY");
2362    }
2363  }     
2364
2365   static Int_t stations[5]={0,1,1,1,1};
2366   fStations=stations;
2367   AliMUONv1::CreateGeometry();
2368 }
2369
2370 //______________________________________________________________________________
2371 void AliMUONv2::Init() 
2372 {
2373    // Initialize Station 1 Tracking Chambers
2374  
2375    //
2376    // Set the chamber (sensitive region) GEANT identifier
2377     fChamberV2[0] = new TArrayI(11);             // Chamber 1 sensitive volume Id array
2378     fChamberV2[1] = new TArrayI(11);             // Chamber 2 sensitive volume Id array
2379
2380     AddChamberGid(0,gMC->VolId("SA1G"),0);
2381     AddChamberGid(0,gMC->VolId("SB1G"),1);
2382     AddChamberGid(0,gMC->VolId("SC1G"),2);
2383     AddChamberGid(0,gMC->VolId("SD1G"),3);
2384     AddChamberGid(0,gMC->VolId("SE1G"),4);
2385     AddChamberGid(0,gMC->VolId("SF1G"),5);
2386     AddChamberGid(0,gMC->VolId("SG1G"),6);
2387     AddChamberGid(0,gMC->VolId("SH1G"),7);
2388     AddChamberGid(0,gMC->VolId("SI1G"),8);
2389     AddChamberGid(0,gMC->VolId("SJ1G"),9);
2390     AddChamberGid(0,gMC->VolId("SK1G"),10);
2391
2392     
2393     AddChamberGid(1,gMC->VolId("SA2G"),0);
2394     AddChamberGid(1,gMC->VolId("SB2G"),1);
2395     AddChamberGid(1,gMC->VolId("SC2G"),2);
2396     AddChamberGid(1,gMC->VolId("SD2G"),3);
2397     AddChamberGid(1,gMC->VolId("SE2G"),4);
2398     AddChamberGid(1,gMC->VolId("SF2G"),5);
2399     AddChamberGid(1,gMC->VolId("SG2G"),6);
2400     AddChamberGid(1,gMC->VolId("SH2G"),7);
2401     AddChamberGid(1,gMC->VolId("SI2G"),8);
2402     AddChamberGid(1,gMC->VolId("SJ2G"),9);
2403     AddChamberGid(1,gMC->VolId("SK2G"),10);
2404
2405   Int_t i;
2406 // now do the other stations as in AliMUONv1
2407    for (i=0; i<AliMUONConstants::NCh(); i++) {
2408        ( (AliMUONChamber*) (*fChambers)[i])->Init();
2409    }
2410    
2411    //
2412    // Set the chamber (sensitive region) GEANT identifier
2413    ((AliMUONChamber*)(*fChambers)[0])->SetGid(-1);  // joker
2414    ((AliMUONChamber*)(*fChambers)[1])->SetGid(-1);  // joker
2415
2416    ((AliMUONChamber*)(*fChambers)[2])->SetGid(gMC->VolId("S03G"));
2417    ((AliMUONChamber*)(*fChambers)[3])->SetGid(gMC->VolId("S04G"));
2418
2419    ((AliMUONChamber*)(*fChambers)[4])->SetGid(gMC->VolId("S05G"));
2420    ((AliMUONChamber*)(*fChambers)[5])->SetGid(gMC->VolId("S06G"));
2421
2422    ((AliMUONChamber*)(*fChambers)[6])->SetGid(gMC->VolId("S07G"));
2423    ((AliMUONChamber*)(*fChambers)[7])->SetGid(gMC->VolId("S08G"));
2424
2425    ((AliMUONChamber*)(*fChambers)[8])->SetGid(gMC->VolId("S09G"));
2426    ((AliMUONChamber*)(*fChambers)[9])->SetGid(gMC->VolId("S10G"));
2427
2428    ((AliMUONChamber*)(*fChambers)[10])->SetGid(gMC->VolId("SG1A"));
2429    ((AliMUONChamber*)(*fChambers)[11])->SetGid(gMC->VolId("SG2A"));
2430    ((AliMUONChamber*)(*fChambers)[12])->SetGid(gMC->VolId("SG3A"));
2431    ((AliMUONChamber*)(*fChambers)[13])->SetGid(gMC->VolId("SG4A"));
2432
2433 }
2434