]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSt1GeometryBuilderV2.cxx
Added commented line for activation the fast raw data decoder.
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1GeometryBuilderV2.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 //-----------------------------------------------------------------------------
19 // Class AliMUONSt1GeometryBuilderV2
20 // ---------------------------------
21 // MUON Station1 detailed geometry construction class.
22 // (Originally defined in AliMUONv2.cxx - now removed.)
23 // Included in AliRoot 2004/01/23
24 // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
25 //-----------------------------------------------------------------------------
26
27 #include "AliMUONSt1GeometryBuilderV2.h"
28 #include "AliMUONSt1SpecialMotif.h"
29 #include "AliMUON.h"
30 #include "AliMUONConstants.h"
31 #include "AliMUONGeometryModule.h"
32 #include "AliMUONGeometryEnvelopeStore.h"
33
34 #include "AliMpSegmentation.h"
35 #include "AliMpDEManager.h"
36 #include "AliMpContainers.h"
37 #include "AliMpConstants.h"
38 #include "AliMpCDB.h"
39 #include "AliMpSectorSegmentation.h"
40 #include "AliMpSector.h"
41 #include "AliMpRow.h"
42 #include "AliMpVRowSegment.h"
43 #include "AliMpMotifMap.h"
44 #include "AliMpMotifPosition.h"
45 #include "AliMpPlaneType.h"
46
47 #include "AliRun.h"
48 #include "AliMagF.h"
49 #include "AliLog.h"
50
51 #include <TVector2.h>
52 #include <TVector3.h>
53 #include <TGeoMatrix.h>
54 #include <TClonesArray.h>
55 #include <Riostream.h>
56 #include <TSystem.h>
57 #include <TVirtualMC.h>
58 #include <TGeoManager.h>
59 #include <TGeoVolume.h>
60 #include <TGeoTube.h>
61 #include <TGeoCompositeShape.h>
62
63 #ifdef WITH_STL
64   #include <vector>
65 #endif
66
67 #ifdef WITH_ROOT
68   #include "TArrayI.h"
69 #endif
70
71 /// \cond CLASSIMP
72 ClassImp(AliMUONSt1GeometryBuilderV2)
73 /// \endcond
74
75 // Thickness Constants
76 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzPadPlane=0.0148/2.;     //Pad plane
77 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzFoam = 2.503/2.;        //Foam of mechanicalplane
78 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzFR4 = 0.062/2.;         //FR4 of mechanical plane
79 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzSnPb = 0.0091/2.;       //Pad/Kapton connection (66 pt)
80 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzKapton = 0.0122/2.;     //Kapton
81 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzBergPlastic = 0.3062/2.;//Berg connector
82 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzBergCopper = 0.1882/2.; //Berg connector
83 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzDaughter = 0.0156/2.;   //Daughter board
84 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHzGas = 0.42/2.;          //Gas thickness
85
86 // Quadrant Mother volume - TUBS1 - Middle layer of model
87 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherIR1 = 18.3;
88 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherOR1 = 105.673;   
89 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherThick1 = 6.5/2;  
90 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherPhiL1 = 0.; 
91 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherPhiU1 = 90.;
92
93 // Quadrant Mother volume - TUBS2 - near and far layers of model
94 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherIR2 = 20.7;   
95 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherOR2 = 100.073;   
96 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherThick2 = 3.0/2; 
97 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherPhiL2 = 0.; 
98 const GReal_t AliMUONSt1GeometryBuilderV2::fgkMotherPhiU2 = 90.;
99
100 // Sensitive copper pads, foam layer, PCB and electronics model parameters
101 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxHole=1.5/2.;
102 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyHole=6./2.;
103 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxBergPlastic=0.74/2.;
104 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyBergPlastic=5.09/2.;
105 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxBergCopper=0.25/2.;
106 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyBergCopper=3.6/2.;
107 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxKapton=0.8/2.;
108 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyKapton=5.7/2.;
109 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHxDaughter=2.3/2.;
110 const GReal_t AliMUONSt1GeometryBuilderV2::fgkHyDaughter=6.3/2.;
111 const GReal_t AliMUONSt1GeometryBuilderV2::fgkOffsetX=1.46;
112 const GReal_t AliMUONSt1GeometryBuilderV2::fgkOffsetY=0.71;
113 const GReal_t AliMUONSt1GeometryBuilderV2::fgkDeltaFilleEtamX=1.46;
114 const GReal_t AliMUONSt1GeometryBuilderV2::fgkDeltaFilleEtamY=0.051;
115
116 const GReal_t AliMUONSt1GeometryBuilderV2::fgkDeltaQuadLHC=2.6;  // LHC Origin wrt Quadrant Origin
117 const GReal_t AliMUONSt1GeometryBuilderV2::fgkFrameOffset=5.2;
118               // Fix (1) of overlap SQN* layers with SQM* ones (was 5.0)
119               
120 // Pad planes offsets
121 const GReal_t AliMUONSt1GeometryBuilderV2::fgkPadXOffsetBP =  0.50 - 0.63/2; // = 0.185
122 const GReal_t AliMUONSt1GeometryBuilderV2::fgkPadYOffsetBP = -0.31 - 0.42/2; // =-0.52
123
124 const char* AliMUONSt1GeometryBuilderV2::fgkHoleName="SCHL";      
125 const char* AliMUONSt1GeometryBuilderV2::fgkDaughterName="SCDB";  
126 const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantEnvelopeName="SE";
127 const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantMLayerName="SQM";
128 const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantNLayerName="SQN";
129 const char* AliMUONSt1GeometryBuilderV2::fgkQuadrantFLayerName="SQF";
130 const Int_t AliMUONSt1GeometryBuilderV2::fgkFoamBoxNameOffset=200; 
131 const Int_t AliMUONSt1GeometryBuilderV2::fgkFR4BoxNameOffset=400; 
132 const Int_t AliMUONSt1GeometryBuilderV2::fgkDaughterCopyNoOffset=1000;
133
134 //______________________________________________________________________________
135 AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2(AliMUON* muon)
136   : AliMUONVGeometryBuilder(0, 2),
137     fMUON(muon)
138 {
139 /// Standard constructor
140 }
141  
142 //______________________________________________________________________________
143 AliMUONSt1GeometryBuilderV2::AliMUONSt1GeometryBuilderV2()
144   : AliMUONVGeometryBuilder(),
145     fMUON(0)
146 {
147 /// Default Constructor
148 }
149
150 //______________________________________________________________________________
151 AliMUONSt1GeometryBuilderV2::~AliMUONSt1GeometryBuilderV2()
152 {
153 /// Destructor
154 }
155
156
157 //
158 //  Private methods
159 //
160
161 //______________________________________________________________________________
162 TString 
163 AliMUONSt1GeometryBuilderV2::QuadrantEnvelopeName(Int_t chamber, Int_t quadrant) const
164
165 /// Generate unique envelope name from chamber Id and quadrant number
166
167   return Form("%s%d", Form("%s%d",fgkQuadrantEnvelopeName,chamber), quadrant); 
168 }
169
170 //______________________________________________________________________________
171 void AliMUONSt1GeometryBuilderV2::CreateHole()
172 {
173 /// Create all the elements found inside a foam hole
174
175   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
176   Int_t idAir  = idtmed[1100];      // medium 1
177   //Int_t idCopper  = idtmed[1109]; // medium 10 = copper 
178   Int_t idCopper  = idtmed[1121]; // medium 22 = copper 
179
180   GReal_t par[3];
181   GReal_t posX,posY,posZ;
182   
183   par[0] = fgkHxHole;
184   par[1] = fgkHyHole;
185   par[2] = fgkHzFoam;
186   gMC->Gsvolu(fgkHoleName,"BOX",idAir,par,3);
187
188   par[0] = fgkHxKapton;
189   par[1] = fgkHyKapton;
190   par[2] = fgkHzSnPb;
191   gMC->Gsvolu("SNPB", "BOX", idCopper, par, 3);
192   posX = 0.;
193   posY = 0.;
194   posZ = -fgkHzFoam+fgkHzSnPb;
195   gMC->Gspos("SNPB",1,fgkHoleName, posX, posY, posZ, 0,"ONLY");
196
197   par[0] = fgkHxHole;
198   par[1] = fgkHyBergPlastic;
199   par[2] = fgkHzKapton;
200   gMC->Gsvolu("SKPT", "BOX", idCopper, par, 3);
201   posX = 0.;
202   posY = 0.;
203   posZ = 0.;
204   gMC->Gspos("SKPT",1,fgkHoleName, posX, posY, posZ, 0,"ONLY");
205 }
206
207 //______________________________________________________________________________
208 void AliMUONSt1GeometryBuilderV2::CreateDaughterBoard()
209 {
210 /// Create all the elements in a daughter board
211
212   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
213   Int_t idAir  = idtmed[1100]; // medium 1
214   //Int_t idCopper  = idtmed[1109]; // medium 10 = copper
215   //Int_t idPlastic  =idtmed[1116]; // medium 17 = Plastic
216   Int_t idCopper  = idtmed[1121]; // medium 22 = copper
217   Int_t idPlastic  =idtmed[1127]; // medium 28 = Plastic
218
219   GReal_t par[3];
220   GReal_t posX,posY,posZ;
221
222   par[0]=fgkHxDaughter;
223   par[1]=fgkHyDaughter;
224   par[2]=TotalHzDaughter();
225   gMC->Gsvolu(fgkDaughterName,"BOX",idAir,par,3);
226   
227   par[0]=fgkHxBergPlastic;
228   par[1]=fgkHyBergPlastic;
229   par[2]=fgkHzBergPlastic;
230   gMC->Gsvolu("SBGP","BOX",idPlastic,par,3);
231   posX=0.;
232   posY=0.;
233   posZ = -TotalHzDaughter() + fgkHzBergPlastic;
234   gMC->Gspos("SBGP",1,fgkDaughterName,posX,posY,posZ,0,"ONLY");
235
236   par[0]=fgkHxBergCopper;
237   par[1]=fgkHyBergCopper;
238   par[2]=fgkHzBergCopper;
239   gMC->Gsvolu("SBGC","BOX",idCopper,par,3);
240   posX=0.;
241   posY=0.;
242   posZ=0.;
243   gMC->Gspos("SBGC",1,"SBGP",posX,posY,posZ,0,"ONLY");
244
245   par[0]=fgkHxDaughter;
246   par[1]=fgkHyDaughter;
247   par[2]=fgkHzDaughter;
248   gMC->Gsvolu("SDGH","BOX",idCopper,par,3);
249   posX=0.;
250   posY=0.;
251   posZ = -TotalHzDaughter() + 2.*fgkHzBergPlastic + fgkHzDaughter;
252   gMC->Gspos("SDGH",1,fgkDaughterName,posX,posY,posZ,0,"ONLY");
253 }
254
255 //______________________________________________________________________________
256 void AliMUONSt1GeometryBuilderV2::CreateInnerLayers()
257 {
258 /// Create the layer of sensitive volumes with gas
259 /// and the copper layer.
260
261 // Gas Medium
262   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099; 
263   Int_t idArCO2  = idtmed[1108];  // medium 9 (ArCO2 80%) 
264   //Int_t idCopper  = idtmed[1109]; // medium 10 = copper
265   //Int_t idArCO2   = idtmed[1124]; // medium 25 (ArCO2 80%) 
266   Int_t idCopper  = idtmed[1121]; // medium 22 = copper
267
268   Float_t par[11];
269
270 //Make gas volume - composed of 11 trapezoids
271 // section 1 of 11
272     par[0] = fgkHzGas;
273     par[1] = 0.;
274     par[2] = 0.;
275     par[3] = 71.33/2.;
276     par[4] = 9.76/2.;
277     par[5] = 48.77/2.;
278     par[6] = 15.3;
279     par[7] = 71.33/2.;
280     par[8] = 9.76/2.;
281     par[9] = 48.77/2.;
282     par[10] = 15.3;        
283
284   gMC->Gsvolu("SA1G", "TRAP", idArCO2, par, 11);
285   gMC->Gsvolu("SA2G", "TRAP", idArCO2, par, 11);
286   
287   par[0] = fgkHzPadPlane;
288   gMC->Gsvolu("SA1C", "TRAP", idCopper,par, 11);
289
290 // section 2 of 11  
291     par[0] = fgkHzGas;
292     par[1] = 0.;
293     par[2] = 0.;
294     par[3] = 79.68/2.;
295     par[4] = 10.4/2.;
296     par[5] = 57.0/2.;
297     par[6] = 0.;  
298     par[7] = 79.68/2.; 
299     par[8] = 10.4/2.;
300     par[9] = 57.0/2.;
301     par[10] = 0.;  
302   gMC->Gsvolu("SB1G", "TRAP", idArCO2, par, 11);  
303   gMC->Gsvolu("SB2G", "TRAP", idArCO2, par, 11);
304
305   par[0] = fgkHzPadPlane;
306   gMC->Gsvolu("SB1C", "TRAP", idCopper,par, 11);
307
308 // section 3 of 11
309     par[0] = fgkHzGas;
310     par[1] = 0.;
311     par[2] = 0.;
312     par[3] = 71.33/2.;
313     par[4] = 48.77/2.;
314     par[5] = 9.73/2.;
315     par[6] = -15.3;
316     par[7] = 71.33/2.;
317     par[8] = 48.77/2.;
318     par[9] = 9.73/2.;
319     par[10] = -15.3;   
320  
321   gMC->Gsvolu("SC1G", "TRAP", idArCO2, par, 11);  
322   gMC->Gsvolu("SC2G", "TRAP", idArCO2, par, 11);
323
324   par[0] = fgkHzPadPlane;
325   gMC->Gsvolu("SC1C", "TRAP", idCopper,par, 11);
326
327 // section 4 of 11
328     par[0] = fgkHzGas;
329     par[1] = 0.;
330     par[2] = 0.;
331     par[3] = 6.00/2.;
332     par[4] = 0.;
333     par[5] = 1.56/2.;
334     par[6] = 7.41; 
335     par[7] = 6.00/2.; 
336     par[8] = 0.;
337     par[9] = 1.56/2.;
338     par[10] = 7.41;    
339   gMC->Gsvolu("SD1G", "TRAP", idArCO2, par, 11);  
340   gMC->Gsvolu("SD2G", "TRAP", idArCO2, par, 11);
341
342   par[0] = fgkHzPadPlane;
343   gMC->Gsvolu("SD1C", "TRAP", idCopper,par, 11);
344
345 // section 5 of 11  
346     par[0] = fgkHzGas;
347     par[1] = 0.;
348     par[2] = 0.;
349     par[3] = 1.516/2.;
350     par[4] = 0.;
351     par[5] = 0.829/2.;
352     par[6] = 15.3;
353     par[7] = 1.516/2.;
354     par[8] = 0.;
355     par[9] = 0.829/2.;
356     par[10] = 15.3;   
357   gMC->Gsvolu("SE1G", "TRAP", idArCO2, par, 11);  
358   gMC->Gsvolu("SE2G", "TRAP", idArCO2, par, 11);
359
360   par[0] = fgkHzPadPlane;
361   gMC->Gsvolu("SE1C", "TRAP", idCopper,par, 11);
362
363 // section 6 of 11
364     par[0] = fgkHzGas;
365     par[1] = 0.;
366     par[2] = 0.;
367     par[3] = 3.92/2.;
368     par[4] = 0.;
369     par[5] = 0.562/2.;
370     par[6] = -4.1;
371     par[7] = 3.92/2.;
372     par[8] = 0.;
373     par[9] = 0.562/2.;
374     par[10] = -4.1;   
375   gMC->Gsvolu("SF1G", "TRAP", idArCO2, par, 11);  
376   gMC->Gsvolu("SF2G", "TRAP", idArCO2, par, 11);
377     
378   par[0] = fgkHzPadPlane;
379   gMC->Gsvolu("SF1C", "TRAP", idCopper,par, 11);
380
381 // section 7 of 11
382     par[0] = fgkHzGas;
383     par[1] = 0.;
384     par[2] = 0.;
385     par[3] = 0.941/2.;
386     par[4] = 0.562/2.;
387     par[5] = 0.;
388     par[6] = -16.6; 
389     par[7] = 0.941/2.;
390     par[8] = 0.562/2.;
391     par[9] = 0.;
392     par[10] =-16.6;    
393   gMC->Gsvolu("SG1G", "TRAP", idArCO2, par, 11);  
394   gMC->Gsvolu("SG2G", "TRAP", idArCO2, par, 11);
395
396   par[0] = fgkHzPadPlane;
397   gMC->Gsvolu("SG1C", "TRAP", idCopper,par, 11);
398
399 // section 8 of 11
400     par[0] = fgkHzGas;
401     par[1] = 0.;
402     par[2] = 0.;
403     par[3] = 3.94/2.;
404     par[4] = 0.57/2.;
405     par[5] = 0.;
406     par[6] = 4.14; 
407     par[7] = 3.94/2.; 
408     par[8] = 0.57/2.;
409     par[9] = 0.;
410     par[10] = 4.14;    
411   gMC->Gsvolu("SH1G", "TRAP", idArCO2, par, 11);  
412   gMC->Gsvolu("SH2G", "TRAP", idArCO2, par, 11);
413
414   par[0] = fgkHzPadPlane;
415   gMC->Gsvolu("SH1C", "TRAP", idCopper,par, 11);
416
417 // section 9 of 11  
418     par[0] = fgkHzGas;
419     par[1] = 0.;
420     par[2] = 0.;
421     par[3] = 0.95/2.;
422     par[4] = 0.;
423     par[5] = 0.57/2;
424     par[6] = 16.7;
425     par[7] = 0.95/2.;
426     par[8] = 0.;
427     par[9] = 0.57/2;
428     par[10] = 16.7;   
429   gMC->Gsvolu("SI1G", "TRAP", idArCO2, par, 11);  
430   gMC->Gsvolu("SI2G", "TRAP", idArCO2, par, 11);
431
432   par[0] = fgkHzPadPlane;
433   gMC->Gsvolu("SI1C", "TRAP", idCopper,par, 11);
434
435 // section 10 of 11
436     par[0] = fgkHzGas;
437     par[1] = 0.;
438     par[2] = 0.;
439     par[3] = 1.49/2.;
440     par[4] = 0.;
441     par[5] = 0.817/2.;
442     par[6] = -15.4;
443     par[7] = 1.49/2.;
444     par[8] = 0.;
445     par[9] = 0.817/2.;
446     par[10] = -15.4;   
447   gMC->Gsvolu("SJ1G", "TRAP", idArCO2, par, 11);  
448   gMC->Gsvolu("SJ2G", "TRAP", idArCO2, par, 11);
449     
450   par[0] = fgkHzPadPlane;
451   gMC->Gsvolu("SJ1C", "TRAP", idCopper,par, 11);
452
453 // section 11 of 11
454     par[0] = fgkHzGas;
455     par[1] = 0.;
456     par[2] = 0.;
457     par[3] = 5.93/2.;
458     par[4] = 0.;
459     par[5] = 1.49/2.;
460     par[6] = -7.16; 
461     par[7] = 5.93/2.;
462     par[8] = 0.;
463     par[9] = 1.49/2.;
464     par[10] = -7.16;    
465   gMC->Gsvolu("SK1G", "TRAP", idArCO2, par, 11);  
466   gMC->Gsvolu("SK2G", "TRAP", idArCO2, par, 11);
467
468   par[0] = fgkHzPadPlane;
469   gMC->Gsvolu("SK1C", "TRAP", idCopper,par, 11);
470 }
471
472 //______________________________________________________________________________
473 void AliMUONSt1GeometryBuilderV2::CreateSpacer0()
474 {
475 /// The spacer volumes are defined according to the input prepared by Nicole Willis
476 /// without any modifications
477 ///                                                                       <pre>
478 /// No.    Type  Material Center (mm)            Dimensions (mm) (half lengths)
479 ///  5     BOX   EPOXY    408.2  430.4 522.41    5.75  1.5   25.5
480 ///  5P    BOX   EPOXY    408.2  445.4 522.41    5.75  1.5   25.5
481 ///  6     BOX   EPOXY    408.2  437.9 519.76    5.75  15.0   1.0
482 ///  6P    BOX   EPOXY    408.2  437.9 525.06    5.75  15.0   1.0
483 ///  7     CYL   INOX     408.2  437.9 522.41    r=3.0  hz=20.63
484
485   // tracking medias
486   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
487   Int_t idFrameEpoxy = idtmed[1123]; // medium 24 = Frame Epoxy ME730  // was 20 not 16
488   Int_t idInox = idtmed[1128];       // medium 29 Stainless Steel (18%Cr,9%Ni,Fe) // was 21 not 17
489
490   GReal_t par[3];
491   par[0] = 0.575;
492   par[1] = 0.150;
493   par[2] = 2.550;
494   gMC->Gsvolu("Spacer05","BOX",idFrameEpoxy,par,3);
495
496   par[0] = 0.575;
497   par[1] = 1.500;
498   par[2] = 0.100;
499   gMC->Gsvolu("Spacer06","BOX",idFrameEpoxy,par,3);
500
501   par[0] = 0.000;
502   par[1] = 0.300;
503   par[2] = 2.063;
504   gMC->Gsvolu("Spacer07","TUBE",idInox,par,3);
505 }  
506
507
508 //______________________________________________________________________________
509 void AliMUONSt1GeometryBuilderV2::CreateSpacer()
510 {
511 /// The spacer volumes are defined according to the input prepared by Nicole Willis
512 /// with modifications needed to fit into existing geometry.
513 ///                                                                       <pre>
514 /// No.    Type  Material Center (mm)            Dimensions (mm) (half lengths)
515 ///  5     BOX   EPOXY    408.2  430.4 522.41    5.75  1.5   25.5
516 ///  5P    BOX   EPOXY    408.2  445.4 522.41    5.75  1.5   25.5
517 ///  6     BOX   EPOXY    408.2  437.9 519.76    5.75  15.0   1.0
518 ///  6P    BOX   EPOXY    408.2  437.9 525.06    5.75  15.0   1.0
519 ///  7     CYL   INOX     408.2  437.9 522.41    r=3.0  hz=20.63
520 ///                                                                      </pre>
521 /// To fit in existing volumes the volumes 5 and 7 are represented by 2 volumes
522 /// with half size in z (5A, &A); the dimensions of the volume 5A were also modified
523 /// to avoid overlaps (x made smaller, y larger to abotain the identical volume)   
524
525   // tracking medias
526   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
527   Int_t idFrameEpoxy = idtmed[1123]; // medium 24 = Frame Epoxy ME730  // was 20 not 16
528   Int_t idInox = idtmed[1128];       // medium 29 Stainless Steel (18%Cr,9%Ni,Fe) // was 21 not 17
529
530   //GReal_t par[3];
531   //par[0] = 0.575;
532   //par[1] = 0.150;
533   //par[2] = 2.550;
534   //gMC->Gsvolu("Spacer5","BOX",idFrameEpoxy,par,3);
535
536   GReal_t par[3];
537   par[0] = 0.510;
538   par[1] = 0.170;
539   par[2] = 1.275;
540   gMC->Gsvolu("Spacer5A","BOX",idFrameEpoxy,par,3);
541
542   par[0] = 0.575;
543   par[1] = 1.500;
544   par[2] = 0.100;
545   gMC->Gsvolu("Spacer6","BOX",idFrameEpoxy,par,3);
546
547   //par[0] = 0.000;
548   //par[1] = 0.300;
549   //par[2] = 2.063;
550   //gMC->Gsvolu("Spacer7","TUBE",idInox,par,3);
551
552   par[0] = 0.000;
553   par[1] = 0.300;
554   par[2] = 1.0315;
555   gMC->Gsvolu("Spacer7A","TUBE",idInox,par,3);
556 }  
557
558 //______________________________________________________________________________
559 void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
560 {
561 /// Create the quadrant (bending and non-bending planes)
562 /// for the given chamber
563
564   CreateFrame(chamber);
565
566 #ifdef WITH_STL
567   SpecialMap specialMap;
568   specialMap[76] = AliMUONSt1SpecialMotif(TVector2( 0.1, 0.84), 90.);
569   specialMap[75] = AliMUONSt1SpecialMotif(TVector2( 0.5, 0.36));
570   specialMap[47] = AliMUONSt1SpecialMotif(TVector2(1.01, 0.36));
571 #endif
572   
573 #ifdef WITH_ROOT
574   SpecialMap specialMap;
575   specialMap.Add(76, (Long_t) new AliMUONSt1SpecialMotif(TVector2( 0.1, 0.84), 90.));
576   specialMap.Add(75, (Long_t) new AliMUONSt1SpecialMotif(TVector2( 0.5, 0.36)));
577   specialMap.Add(47, (Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01, 0.36)));
578 #endif
579
580   // Load mapping from OCDB
581   if ( ! AliMpSegmentation::Instance() ) {
582     AliFatal("Mapping has to be loaded first !");
583   }
584        
585   const AliMpSectorSegmentation* kSegmentation1 
586     = dynamic_cast<const AliMpSectorSegmentation*>(
587         AliMpSegmentation::Instance()
588           ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kBendingPlane))); 
589   if ( ! kSegmentation1 ) {
590     AliFatal("Could not access sector segmentation !");
591   }
592     
593   const AliMpSector* kSector1 = kSegmentation1->GetSector();
594 /*
595   AliMpSectorReader reader1(AliMp::kStation1, AliMp::kBendingPlane);
596   AliMpSector* kSector1 = reader1.BuildSector();
597 */
598   //Bool_t reflectZ = true;
599   Bool_t reflectZ = false;
600   //TVector3 where = TVector3(2.5+0.1+0.56+0.001, 2.5+0.1+0.001, 0.);
601   TVector3 where = TVector3(fgkDeltaQuadLHC + fgkPadXOffsetBP, 
602                             fgkDeltaQuadLHC + fgkPadYOffsetBP, 0.);
603   PlaceSector(kSector1, specialMap, where, reflectZ, chamber);
604   
605 #ifdef WITH_STL
606   specialMap.clear();
607   specialMap[76] = AliMUONSt1SpecialMotif(TVector2(1.01,0.59),90.);
608   specialMap[75] = AliMUONSt1SpecialMotif(TVector2(1.96, 0.17));
609   specialMap[47] = AliMUONSt1SpecialMotif(TVector2(2.18,-0.98));
610   specialMap[20] = AliMUONSt1SpecialMotif(TVector2(0.2 ,-0.08));
611   specialMap[46] = AliMUONSt1SpecialMotif(TVector2(0.2 , 0.25));
612   specialMap[74] = AliMUONSt1SpecialMotif(TVector2(0.28, 0.21));
613       // Fix (7) - overlap of SQ42 with MCHL (after moving the whole sector
614       // in the true position)   
615       // Was: specialMap[47] = AliMUONSt1SpecialMotif(TVector2(1.61,-1.18));
616 #endif
617
618 #ifdef WITH_ROOT
619   Int_t nb = AliMpConstants::ManuMask(AliMp::kNonBendingPlane);
620   TExMapIter it(&specialMap);
621   Long_t key;
622   Long_t value;
623   while ( it.Next(key,value) == kTRUE ) { 
624     delete reinterpret_cast<AliMUONSt1SpecialMotif*>(value);
625   }
626   specialMap.Delete();
627   specialMap.Add(76 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.01,0.59),90.));
628   specialMap.Add(75 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.96, 0.17)));
629   specialMap.Add(47 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(2.18,-0.98)));
630   specialMap.Add(20 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.2 ,-0.08)));
631   specialMap.Add(46 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.2 , 0.25)));
632   specialMap.Add(74 | nb,(Long_t) new AliMUONSt1SpecialMotif(TVector2(0.28, 0.21)));  
633       // Fix (7) - overlap of SQ42 with MCHL (after moving the whole sector
634       // in the true position)   
635       // Was: specialMap.Add(47,(Long_t) new AliMUONSt1SpecialMotif(TVector2(1.61,-1.18)));
636 #endif
637 /*
638   AliMpSectorReader reader2(AliMp::kStation1, AliMp::kNonBendingPlane);
639   AliMpSector* sector2 = reader2.BuildSector();
640 */  
641   const AliMpSectorSegmentation* kSegmentation2 
642     = dynamic_cast<const AliMpSectorSegmentation*>(
643         AliMpSegmentation::Instance()
644           ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kNonBendingPlane))); 
645   if ( ! kSegmentation2 ) {
646     AliFatal("Could not access sector segmentation !");
647   }
648     
649   const AliMpSector* kSector2 = kSegmentation2->GetSector();
650
651   //reflectZ = false;
652   reflectZ = true;
653   TVector2 offset = kSector2->Position();
654   where = TVector3(where.X()+offset.X(), where.Y()+offset.Y(), 0.); 
655       // Add the half-pad shift of the non-bending plane wrt bending plane
656       // (The shift is defined in the mapping as sector offset)
657       // Fix (4) - was TVector3(where.X()+0.63/2, ... - now it is -0.63/2
658   PlaceSector(kSector2, specialMap, where, reflectZ, chamber);
659
660 #ifdef WITH_ROOT
661   it.Reset();
662   while ( it.Next(key,value) == kTRUE ) {
663     delete reinterpret_cast<AliMUONSt1SpecialMotif*>(value);
664   }
665   specialMap.Delete();
666 #endif
667 }
668
669 //______________________________________________________________________________
670 void AliMUONSt1GeometryBuilderV2::CreateFoamBox(
671                                         Int_t segNumber,
672                                         const  TVector2& dimensions)
673 {
674 /// Create all the elements in the copper plane
675
676   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
677   Int_t idAir  = idtmed[1100]; // medium 1
678   //Int_t idFoam = idtmed[1115]; // medium 16 = Foam
679   //Int_t idFR4  = idtmed[1114]; // medium 15 = FR4
680   Int_t idFoam = idtmed[1125]; // medium 26 = Foam
681   Int_t idFR4  = idtmed[1122]; // medium 23 = FR4
682
683   // mother volume
684   GReal_t par[3];
685   par[0] = dimensions.X();
686   par[1] = dimensions.Y();
687   par[2] = TotalHzPlane();
688   gMC->Gsvolu(PlaneSegmentName(segNumber).Data(),"BOX",idAir,par,3);
689   
690   // foam layer
691   par[0] = dimensions.X();
692   par[1] = dimensions.Y();
693   par[2] = fgkHzFoam;
694   gMC->Gsvolu(FoamBoxName(segNumber).Data(),"BOX",idFoam,par,3);
695   GReal_t posX,posY,posZ;
696   posX=0.;
697   posY=0.;
698   posZ = -TotalHzPlane() + fgkHzFoam;
699   gMC->Gspos(FoamBoxName(segNumber).Data(),1, 
700              PlaneSegmentName(segNumber).Data(),posX,posY,posZ,0,"ONLY");
701
702   // mechanical plane FR4 layer
703   par[0] = dimensions.X();
704   par[1] = dimensions.Y();
705   par[2] = fgkHzFR4;
706   gMC->Gsvolu(FR4BoxName(segNumber).Data(),"BOX",idFR4,par,3);
707   posX=0.;
708   posY=0.;
709   posZ = -TotalHzPlane()+ 2.*fgkHzFoam + fgkHzFR4;
710   gMC->Gspos(FR4BoxName(segNumber).Data(),1,
711              PlaneSegmentName(segNumber).Data(),posX,posY,posZ,0,"ONLY");
712 }
713
714 //______________________________________________________________________________
715 void AliMUONSt1GeometryBuilderV2::CreatePlaneSegment(Int_t segNumber,
716                                     const  TVector2& dimensions,
717                                     Int_t nofHoles)
718 {
719 /// Create a segment of a plane (this includes a foam layer, 
720 /// holes in the foam to feed the kaptons through, kapton connectors
721 /// and the mother board.)
722   
723   CreateFoamBox(segNumber,dimensions);
724   
725   // Place spacer in the concrete plane segments:
726   // S225 (in S025), S267 (in S067) in chamber1 and S309 (in S109). S351(in S151) 
727   // in chamber2
728   // The segments were found as those which caused overlaps when we placed
729   // the spacer in global coordinates via PlaceSpacer0 
730   //
731   //    <posXYZ   X_Y_Z=" 12.6000;   0.75000;   0.0000"> <volume name="Spacer5A"/>
732   //    <posXYZ   X_Y_Z=" 12.6000;  -0.75000;   0.0000"> <volume name="Spacer5A"/>
733   //    <posXYZ   X_Y_Z=" 12.6000;   0.0000;    1.1515"> <volume name="Spacer6"/>
734   //    <posXYZ   X_Y_Z=" 12.6000;   0.0000;    0.0000"> <volume name="Spacer7A"/>
735
736   if ( FoamBoxName(segNumber) == "S225" || 
737        FoamBoxName(segNumber) == "S267" ||
738        FoamBoxName(segNumber) == "S309" ||
739        FoamBoxName(segNumber) == "S351"    )  
740   {
741     GReal_t posX = 12.6;
742     GReal_t posY = 0.75;
743     GReal_t posZ = 0.0;
744     gMC->Gspos("Spacer5A", 1, FoamBoxName(segNumber).Data(), posX, posY, posZ,0, "ONLY");
745
746     posY = -0.75;
747     gMC->Gspos("Spacer5A", 2, FoamBoxName(segNumber).Data(), posX, posY, posZ,0, "ONLY");
748
749     posY = 0.0;
750     posZ = 1.1515;
751     if ( FoamBoxName(segNumber) == "S267" || 
752          FoamBoxName(segNumber) == "S351" ) posZ *= -1.0;    
753     gMC->Gspos("Spacer6",  1, FoamBoxName(segNumber).Data(), posX, posY, posZ,0, "ONLY");
754
755     posY = 0.0;
756     posZ = 0.0;
757     gMC->Gspos("Spacer7A", 1, FoamBoxName(segNumber).Data(), posX, posY, posZ,0, "ONLY");
758   }  
759
760   for (Int_t holeNum=0;holeNum<nofHoles;holeNum++) {
761     GReal_t posX = ((2.*holeNum+1.)/nofHoles-1.)*dimensions.X();
762     GReal_t posY = 0.;
763     GReal_t posZ = 0.;
764   
765     gMC->Gspos(fgkHoleName,holeNum+1,
766                FoamBoxName(segNumber).Data(),posX,posY,posZ,0,"ONLY");
767   }
768 }
769
770 //______________________________________________________________________________
771 void AliMUONSt1GeometryBuilderV2::CreateFrame(Int_t chamber)
772 {
773 /// Create the non-sensitive elements of the frame for the \a chamber
774 ///
775 /// Model and notation:                                                     \n
776 ///                                                                         \n
777 /// The Quadrant volume name starts with SQ                                 \n
778 /// The volume segments are numbered 00 to XX                               \n
779 ///                                                                         \n
780 ///                              OutTopFrame                                \n
781 ///                               (SQ02-16)                                 \n 
782 ///                              ------------                               \n
783 ///             OutEdgeFrame   /              |                             \n
784 ///             (SQ17-24)     /               |  InVFrame (SQ00-01)         \n 
785 ///                          /                |                             \n
786 ///                          |                |                             \n 
787 ///               OutVFrame  |            _- -                              \n
788 ///               (SQ25-39)  |           |   InArcFrame (SQ42-45)           \n
789 ///                          |           |                                  \n 
790 ///                          -------------                                  \n 
791 ///                        InHFrame (SQ40-41)                               \n 
792 ///                                                                         \n                         
793 ///                                                                         \n
794 /// 06 February 2003 - Overlapping volumes resolved.                        \n
795 /// One quarter chamber is comprised of three TUBS volumes: SQMx, SQNx, and SQFx,
796 /// where SQMx is the Quadrant Middle layer for chamber \a chamber ( posZ in [-3.25,3.25]),
797 /// SQNx is the Quadrant Near side layer for chamber \a chamber ( posZ in [-6.25,3-.25) ), and
798 /// SQFx is the Quadrant Far side layer for chamber \a chamber ( posZ in (3.25,6.25] ).
799
800   const Float_t kNearFarLHC=2.4;    // Near and Far TUBS Origin wrt LHC Origin
801
802   // tracking medias
803   Int_t* idtmed = fMUON->GetIdtmed()->GetArray()-1099;
804   
805   Int_t idAir  = idtmed[1100];       // medium 1
806   //Int_t idFrameEpoxy = idtmed[1115]; // medium 16 = Frame Epoxy ME730
807   //Int_t idInox = idtmed[1116];       // medium 17 Stainless Steel (18%Cr,9%Ni,Fe)
808   //Int_t idFR4 = idtmed[1110];        // medium 11 FR4
809   //Int_t idCopper = idtmed[1109];     // medium 10 Copper
810   //Int_t idAlu = idtmed[1103];        // medium 4 Aluminium
811   Int_t idFrameEpoxy = idtmed[1123]; // medium 24 = Frame Epoxy ME730  // was 20 not 16
812   Int_t idInox = idtmed[1128];       // medium 29 Stainless Steel (18%Cr,9%Ni,Fe) // was 21 not 17
813   Int_t idFR4 = idtmed[1122];        // medium 23 FR4  // was 15 not 11
814   Int_t idCopper = idtmed[1121];     // medium 22 Copper
815   Int_t idAlu = idtmed[1120];        // medium 21 Aluminium
816   
817   
818 // Rotation Matrices  
819       Int_t rot1, rot2, rot3;    
820       
821 //   Rotation matrices  
822      fMUON->AliMatrix(rot1,  90.,  90., 90., 180.,  0., 0.); // +90 deg in x-y plane
823      fMUON->AliMatrix(rot2,  90.,  45., 90., 135.,  0., 0.); // +45 deg in x-y plane 
824      fMUON->AliMatrix(rot3,  90.,  45., 90., 315.,180., 0.); // +45 deg in x-y + rotation 180° around y
825
826 //   Translation matrices ... NOT USED  
827 //     fMUON->AliMatrix(trans1, 90.,   0., 90.,  90.,   0., 0.); // X-> X; Y -> Y; Z -> Z
828 //     fMUON->AliMatrix(trans2, 90., 180., 90.,  90., 180., 0.); // X->-X; Y -> Y; Z ->-Z
829 //     fMUON->AliMatrix(trans3, 90., 180., 90., 270.,   0., 0.); // X->-X; Y ->-Y; Z -> Z
830 //     fMUON->AliMatrix(trans4, 90.,   0., 90., 270., 180., 0.); // X-> X; Y ->-Y; Z ->-Z
831 //  
832       // ___________________Volume thicknesses________________________
833
834   const Float_t kHzFrameThickness = 1.59/2.;     //equivalent thickness
835   const Float_t kHzOuterFrameEpoxy = 1.19/2.;    //equivalent thickness
836   const Float_t kHzOuterFrameInox = 0.1/2.;      //equivalent thickness
837   const Float_t kHzFoam = 2.083/2.;              //evaluated elsewhere
838                                                  // CHECK with fgkHzFoam
839   
840 // Pertaining to the top outer area 
841   const Float_t kHzTopAnodeSteel1 = 0.185/2.;    //equivalent thickness
842   const Float_t kHzTopAnodeSteel2 = 0.51/2.;     //equivalent thickness  
843   const Float_t kHzAnodeFR4 = 0.08/2.;           //equivalent thickness
844   const Float_t kHzTopEarthFaceCu = 0.364/2.;    //equivalent thickness
845   const Float_t kHzTopEarthProfileCu = 1.1/2.;   //equivalent thickness
846   const Float_t kHzTopPositionerSteel = 1.45/2.; //should really be 2.125/2.; 
847   const Float_t kHzTopGasSupportAl = 0.85/2.;    //equivalent thickness
848   
849 // Pertaining to the vertical outer area  
850   const Float_t kHzVerticalCradleAl = 0.8/2.;     //equivalent thickness
851   const Float_t kHzLateralSightAl = 0.975/2.;     //equivalent thickness
852   const Float_t kHzLateralPosnInoxFace = 2.125/2.;//equivalent thickness
853   const Float_t kHzLatPosInoxProfM = 6.4/2.;      //equivalent thickness
854   const Float_t kHzLatPosInoxProfNF = 1.45/2.;    //equivalent thickness
855   const Float_t kHzLateralPosnAl = 0.5/2.;        //equivalent thickness
856   const Float_t kHzVertEarthFaceCu = 0.367/2.;    //equivalent thickness
857   const Float_t kHzVertBarSteel = 0.198/2.;       //equivalent thickness
858   const Float_t kHzVertEarthProfCu = 1.1/2.;      //equivalent thickness
859
860       //_______________Parameter definitions in sequence _________
861
862 // InVFrame parameters
863   const Float_t kHxInVFrame  = 1.85/2.;
864   const Float_t kHyInVFrame  = 73.95/2.;
865   const Float_t kHzInVFrame  = kHzFrameThickness;
866
867 //Flat 7.5mm vertical section
868   const Float_t kHxV1mm  = 0.75/2.;
869   const Float_t kHyV1mm  = 1.85/2.;
870   const Float_t kHzV1mm  = kHzFrameThickness;
871
872 // OuterTopFrame Structure 
873 //
874 // FRAME
875 // The frame is composed of a cuboid and two trapezoids 
876 // (TopFrameAnode, TopFrameAnodeA, TopFrameAnodeB). 
877 // Each shape is composed of two layers (Epoxy and Inox) and 
878 // takes the frame's inner anode circuitry into account in the material budget.
879 //
880 // ANODE
881 // The overhanging anode part is composed froma cuboid and two trapezoids 
882 // (TopAnode, TopAnode1, and TopAnode2). These surfaces neglect implanted
883 // resistors, but accounts for the major Cu, Pb/Sn, and FR4 material
884 // contributions.  
885 // The stainless steel anode supports have been included.
886 //
887 // EARTHING (TopEarthFace, TopEarthProfile)
888 // Al GAS SUPPORT (TopGasSupport)
889 //  
890 // ALIGNMENT (TopPositioner) - Alignment system, three sights per quarter 
891 // chamber. This sight is forseen for the alignment of the horizontal level 
892 // (parallel to the OY axis of LHC). Its position will be evaluated relative 
893 // to a system of sights places on the cradles;
894 //
895 //---
896   
897 //TopFrameAnode parameters - cuboid, 2 layers
898   const Float_t kHxTFA = 34.1433/2.;
899   const Float_t kHyTFA = 7.75/2.;
900   const Float_t kHzTFAE = kHzOuterFrameEpoxy;     // layer 1 thickness
901   const Float_t kHzTFAI = kHzOuterFrameInox;      // layer 3 thickness
902   
903 // TopFrameAnodeA parameters - trapezoid, 2 layers
904   const Float_t kHzFAAE = kHzOuterFrameEpoxy;     // layer 1 thickness
905   const Float_t kHzFAAI = kHzOuterFrameInox;      // layer 3 thickness
906   const Float_t kTetFAA = 0.;
907   const Float_t kPhiFAA = 0.;
908   const Float_t kH1FAA = 8.7/2.;
909   const Float_t kBl1FAA = 4.35/2.;
910   const Float_t kTl1FAA =  7.75/2.;
911   const Float_t kAlp1FAA = 11.06; 
912   const Float_t kH2FAA = 8.7/2.;
913   const Float_t kBl2FAA = 4.35/2.;
914   const Float_t kTl2FAA = 7.75/2.;
915   const Float_t kAlp2FAA = 11.06;  
916   
917 // TopFrameAnodeB parameters - trapezoid, 2 layers
918   const Float_t kHzFABE = kHzOuterFrameEpoxy;     // layer 1 thickness
919   const Float_t kHzFABI = kHzOuterFrameInox;      // layer 3 thickness
920   const Float_t kTetFAB = 0.;
921   const Float_t kPhiFAB = 0.;
922   const Float_t kH1FAB = 8.70/2.;
923   const Float_t kBl1FAB = 0.;
924   const Float_t kTl1FAB = 4.35/2.;
925   const Float_t kAlp1FAB = 14.03; 
926   const Float_t kH2FAB = 8.70/2.;
927   const Float_t kBl2FAB = 0.;
928   const Float_t kTl2FAB = 4.35/2.;
929   const Float_t kAlp2FAB = 14.03;  
930   
931 // TopAnode parameters - cuboid (part 1 of 3 parts)
932   const Float_t kHxTA1 = 16.2/2.;
933   const Float_t kHyTA1 = 3.5/2.;
934   const Float_t kHzTA11 = kHzTopAnodeSteel1;   // layer 1
935   const Float_t kHzTA12 = kHzAnodeFR4;         // layer 2 
936
937 // TopAnode parameters - trapezoid 1 (part 2 of 3 parts)
938   const Float_t kHzTA21 = kHzTopAnodeSteel2;   // layer 1 
939   const Float_t kHzTA22 = kHzAnodeFR4;         // layer 2 
940   const Float_t kTetTA2 = 0.;
941   const Float_t kPhiTA2= 0.;
942   const Float_t kH1TA2 = 7.268/2.;
943   const Float_t kBl1TA2 = 2.03/2.;
944   const Float_t kTl1TA2 = 3.5/2.;
945   const Float_t kAlp1TA2 = 5.78; 
946   const Float_t kH2TA2 = 7.268/2.;
947   const Float_t kBl2TA2 = 2.03/2.;
948   const Float_t kTl2TA2 = 3.5/2.;
949   const Float_t kAlp2TA2 = 5.78;  
950
951 // TopAnode parameters - trapezoid 2 (part 3 of 3 parts)
952   const Float_t kHzTA3 = kHzAnodeFR4;       // layer 1 
953   const Float_t kTetTA3 = 0.;
954   const Float_t kPhiTA3 = 0.;
955   const Float_t kH1TA3 = 7.268/2.;
956   const Float_t kBl1TA3 = 0.;
957   const Float_t kTl1TA3 = 2.03/2.;
958   const Float_t kAlp1TA3 = 7.95; 
959   const Float_t kH2TA3 = 7.268/2.;
960   const Float_t kBl2TA3 = 0.;
961   const Float_t kTl2TA3 = 2.03/2.;
962   const Float_t kAlp2TA3 = 7.95;  
963   
964 // TopEarthFace parameters - single trapezoid
965   const Float_t kHzTEF = kHzTopEarthFaceCu;
966   const Float_t kTetTEF = 0.;
967   const Float_t kPhiTEF = 0.;
968   const Float_t kH1TEF = 1.200/2.;
969   const Float_t kBl1TEF = 21.323/2.;
970   const Float_t kTl1TEF = 17.963/2.;
971   const Float_t kAlp1TEF = -54.46; 
972   const Float_t kH2TEF = 1.200/2.;
973   const Float_t kBl2TEF = 21.323/2.;
974   const Float_t kTl2TEF = 17.963/2.;
975   const Float_t kAlp2TEF = -54.46;
976
977 // TopEarthProfile parameters - single trapezoid
978   const Float_t kHzTEP = kHzTopEarthProfileCu;
979   const Float_t kTetTEP = 0.;
980   const Float_t kPhiTEP = 0.;
981   const Float_t kH1TEP = 0.40/2.;
982   const Float_t kBl1TEP = 31.766/2.;
983   const Float_t kTl1TEP = 30.535/2.;
984   const Float_t kAlp1TEP = -56.98; 
985   const Float_t kH2TEP = 0.40/2.;
986   const Float_t kBl2TEP = 31.766/2.;
987   const Float_t kTl2TEP = 30.535/2.;
988   const Float_t kAlp2TEP = -56.98;
989
990 // TopPositioner parameters - single Stainless Steel trapezoid 
991   const Float_t kHzTP = kHzTopPositionerSteel;
992   const Float_t kTetTP = 0.;
993   const Float_t kPhiTP = 0.;
994   const Float_t kH1TP = 3.00/2.;
995   const Float_t kBl1TP = 7.023/2.;
996   const Float_t kTl1TP = 7.314/2.;
997   const Float_t kAlp1TP = 2.78; 
998   const Float_t kH2TP = 3.00/2.;
999   const Float_t kBl2TP = 7.023/2.;
1000   const Float_t kTl2TP = 7.314/2.;
1001   const Float_t kAlp2TP = 2.78;
1002
1003 // TopGasSupport parameters - single cuboid 
1004   const Float_t kHxTGS  = 8.50/2.;
1005   const Float_t kHyTGS  = 3.00/2.;
1006   const Float_t kHzTGS  = kHzTopGasSupportAl;
1007     
1008 // OutEdgeFrame parameters - 4 trapezoidal sections, 2 layers of material
1009 //
1010 //---
1011
1012 // Trapezoid 1
1013   const Float_t kHzOETFE = kHzOuterFrameEpoxy;    // layer 1 
1014   const Float_t kHzOETFI = kHzOuterFrameInox;     // layer 3
1015    
1016   const Float_t kTetOETF = 0.;            // common to all 4 trapezoids
1017   const Float_t kPhiOETF = 0.;            // common to all 4 trapezoids
1018
1019   const Float_t kH1OETF = 7.196/2.;       // common to all 4 trapezoids
1020   const Float_t kH2OETF = 7.196/2.;       // common to all 4 trapezoids   
1021   
1022   const Float_t kBl1OETF1 = 3.75/2; 
1023   const Float_t kTl1OETF1 = 3.996/2.;
1024   const Float_t kAlp1OETF1 = 0.98;
1025
1026   const Float_t kBl2OETF1 = 3.75/2;
1027   const Float_t kTl2OETF1 = 3.996/2.;
1028   const Float_t kAlp2OETF1 = 0.98;
1029   
1030 // Trapezoid 2
1031   const Float_t kBl1OETF2 = 3.01/2.;
1032   const Float_t kTl1OETF2 = 3.75/2;
1033   const Float_t kAlp1OETF2 = 2.94;
1034       
1035   const Float_t kBl2OETF2 = 3.01/2.;
1036   const Float_t kTl2OETF2 = 3.75/2;
1037   const Float_t kAlp2OETF2 = 2.94; 
1038  
1039 // Trapezoid 3
1040   //const Float_t kBl1OETF3 = 1.767/2.;
1041   //const Float_t kTl1OETF3 = 3.01/2.;
1042   const Float_t kBl1OETF3 = 1.117/2.;
1043   const Float_t kTl1OETF3 = 2.36/2.;
1044   const Float_t kAlp1OETF3 = 4.94;
1045         // Fix (5) - overlap of SQ21 with 041M and 125M
1046       
1047   //const Float_t kBl2OETF3 = 1.767/2.;
1048   //const Float_t kTl2OETF3 = 3.01/2.; 
1049   const Float_t kBl2OETF3 = 1.117/2.;
1050   const Float_t kTl2OETF3 = 2.36/2.;
1051   const Float_t kAlp2OETF3 = 4.94; 
1052         // Fix (5) - overlap of SQ21 with 041M and 125M
1053   
1054 // Trapezoid 4
1055   const Float_t kBl1OETF4 = 0.;
1056   const Float_t kTl1OETF4 = 1.77/2.;
1057   const Float_t kAlp1OETF4 = 7.01;
1058       
1059   const Float_t kBl2OETF4 = 0.;
1060   const Float_t kTl2OETF4 = 1.77/2.;
1061   const Float_t kAlp2OETF4 =  7.01;   
1062   
1063 // Frame Structure (OutVFrame):
1064 //
1065 // OutVFrame and corner (OutVFrame cuboid, OutVFrame trapezoid)
1066 // EARTHING (VertEarthFaceCu,VertEarthSteel,VertEarthProfCu),
1067 // DETECTOR POSITIONNING (SuppLateralPositionner, LateralPositionner),
1068 // CRADLE (VertCradle), and
1069 // ALIGNMENT (LateralSightSupport, LateralSight) 
1070 //
1071 //---
1072
1073 // OutVFrame parameters - cuboid
1074   const Float_t kHxOutVFrame = 1.85/2.;
1075   const Float_t kHyOutVFrame = 46.23/2.;
1076   const Float_t kHzOutVFrame = kHzFrameThickness;
1077
1078 // OutVFrame corner parameters - trapezoid
1079   const Float_t kHzOCTF = kHzFrameThickness;
1080   const Float_t kTetOCTF = 0.;
1081   const Float_t kPhiOCTF = 0.;
1082   const Float_t kH1OCTF = 1.85/2.;
1083   const Float_t kBl1OCTF = 0.;
1084   const Float_t kTl1OCTF = 3.66/2.;
1085   const Float_t kAlp1OCTF = 44.67; 
1086   const Float_t kH2OCTF = 1.85/2.;
1087   const Float_t kBl2OCTF = 0.;
1088   const Float_t kTl2OCTF = 3.66/2.;
1089   const Float_t kAlp2OCTF = 44.67;  
1090   
1091 // VertEarthFaceCu parameters - single trapezoid
1092   const Float_t kHzVFC = kHzVertEarthFaceCu;
1093   const Float_t kTetVFC = 0.;
1094   const Float_t kPhiVFC = 0.;
1095   const Float_t kH1VFC = 1.200/2.;
1096   const Float_t kBl1VFC = 46.11/2.;
1097   const Float_t kTl1VFC = 48.236/2.;
1098   const Float_t kAlp1VFC = 41.54; 
1099   const Float_t kH2VFC = 1.200/2.;
1100   const Float_t kBl2VFC = 46.11/2.;
1101   const Float_t kTl2VFC = 48.236/2.;
1102   const Float_t kAlp2VFC = 41.54;
1103     
1104 // VertEarthSteel parameters - single trapezoid
1105   const Float_t kHzVES = kHzVertBarSteel;
1106   const Float_t kTetVES = 0.;
1107   const Float_t kPhiVES = 0.;
1108   const Float_t kH1VES = 1.200/2.;
1109   const Float_t kBl1VES = 30.486/2.;
1110   const Float_t kTl1VES = 32.777/2.;
1111   const Float_t kAlp1VES = 43.67; 
1112   const Float_t kH2VES = 1.200/2.;
1113   const Float_t kBl2VES = 30.486/2.;
1114   const Float_t kTl2VES = 32.777/2.;
1115   const Float_t kAlp2VES = 43.67;
1116
1117 // VertEarthProfCu parameters - single trapezoid
1118   const Float_t kHzVPC = kHzVertEarthProfCu;
1119   const Float_t kTetVPC = 0.;
1120   const Float_t kPhiVPC = 0.;
1121   const Float_t kH1VPC = 0.400/2.;
1122   const Float_t kBl1VPC = 29.287/2.;
1123   const Float_t kTl1VPC = 30.091/2.;
1124   const Float_t kAlp1VPC = 45.14; 
1125   const Float_t kH2VPC = 0.400/2.;
1126   const Float_t kBl2VPC = 29.287/2.;
1127   const Float_t kTl2VPC = 30.091/2.;
1128   const Float_t kAlp2VPC = 45.14;
1129
1130 // SuppLateralPositionner - single cuboid
1131   const Float_t kHxSLP  = 2.80/2.;
1132   const Float_t kHySLP  = 5.00/2.;
1133   const Float_t kHzSLP  = kHzLateralPosnAl;
1134   
1135 // LateralPositionner - squared off U bend, face view
1136   const Float_t kHxLPF  = 5.2/2.;
1137   const Float_t kHyLPF  = 3.0/2.;
1138   const Float_t kHzLPF  = kHzLateralPosnInoxFace;
1139   
1140 // LateralPositionner - squared off U bend, profile view
1141   const Float_t kHxLPP  = 0.425/2.;
1142   const Float_t kHyLPP  = 3.0/2.;
1143   const Float_t kHzLPP  = kHzLatPosInoxProfM;  // middle layer
1144   const Float_t kHzLPNF  = kHzLatPosInoxProfNF; // near and far layers
1145            
1146 // VertCradle, 3 layers (copies), each composed of 4 trapezoids
1147 // VertCradleA
1148   const Float_t kHzVC1 = kHzVerticalCradleAl;
1149   const Float_t kTetVC1 = 0.;
1150   const Float_t kPhiVC1 = 0.;
1151   const Float_t kH1VC1 = 10.25/2.;
1152   const Float_t kBl1VC1 = 3.70/2.;
1153   const Float_t kTl1VC1 = 0.;
1154   const Float_t kAlp1VC1 = -10.23; 
1155   const Float_t kH2VC1 = 10.25/2.;
1156   const Float_t kBl2VC1 = 3.70/2.;
1157   const Float_t kTl2VC1 = 0.;
1158   const Float_t kAlp2VC1 = -10.23;
1159         
1160 // VertCradleB
1161   const Float_t kHzVC2 = kHzVerticalCradleAl;
1162   const Float_t kTetVC2 = 0.;
1163   const Float_t kPhiVC2 = 0.;
1164   const Float_t kH1VC2 = 10.25/2.;
1165   const Float_t kBl1VC2 = 6.266/2.;
1166   const Float_t kTl1VC2 = 3.70/2.;
1167   const Float_t kAlp1VC2 = -7.13; 
1168   const Float_t kH2VC2 = 10.25/2.;
1169   const Float_t kBl2VC2 = 6.266/2.;
1170   const Float_t kTl2VC2 = 3.70/2.;
1171   const Float_t kAlp2VC2 = -7.13;
1172   
1173 // VertCradleC
1174   const Float_t kHzVC3 = kHzVerticalCradleAl;
1175   const Float_t kTetVC3 = 0.;
1176   const Float_t kPhiVC3 = 0.;
1177   const Float_t kH1VC3 = 10.25/2.;
1178   const Float_t kBl1VC3 = 7.75/2.;
1179   const Float_t kTl1VC3 = 6.266/2.;
1180   const Float_t kAlp1VC3 = -4.14; 
1181   const Float_t kH2VC3 = 10.25/2.;
1182   const Float_t kBl2VC3 = 7.75/2.;
1183   const Float_t kTl2VC3 = 6.266/2.;
1184   const Float_t kAlp2VC3 = -4.14;
1185
1186 // VertCradleD
1187   const Float_t kHzVC4 = kHzVerticalCradleAl;
1188   const Float_t kTetVC4 = 0.;
1189   const Float_t kPhiVC4 = 0.;
1190   const Float_t kH1VC4 = 10.27/2.;
1191   const Float_t kBl1VC4 = 8.273/2.;
1192   const Float_t kTl1VC4 = 7.75/2.;
1193   const Float_t kAlp1VC4 = -1.46; 
1194   const Float_t kH2VC4 = 10.27/2.;
1195   const Float_t kBl2VC4 = 8.273/2.;
1196   const Float_t kTl2VC4 = 7.75/2.;
1197   const Float_t kAlp2VC4 = -1.46;
1198   
1199 // LateralSightSupport - single trapezoid
1200   const Float_t kHzVSS = kHzLateralSightAl;
1201   const Float_t kTetVSS = 0.;
1202   const Float_t kPhiVSS = 0.;
1203   const Float_t kH1VSS = 5.00/2.;
1204   const Float_t kBl1VSS = 7.747/2;
1205   const Float_t kTl1VSS = 7.188/2.;
1206   const Float_t kAlp1VSS = -3.20; 
1207   const Float_t kH2VSS = 5.00/2.;
1208   const Float_t kBl2VSS = 7.747/2.;
1209   const Float_t kTl2VSS = 7.188/2.;
1210   const Float_t kAlp2VSS = -3.20;  
1211   
1212 // LateralSight (reference point) - 3 per quadrant, only 1 programmed for now
1213   const Float_t kVSInRad  = 0.6;
1214   const Float_t kVSOutRad  = 1.3;
1215   const Float_t kVSLen  = kHzFrameThickness; 
1216   
1217 //---
1218
1219 // InHFrame parameters
1220   const Float_t kHxInHFrame  = 75.8/2.;
1221   const Float_t kHyInHFrame  = 1.85/2.;
1222   const Float_t kHzInHFrame  = kHzFrameThickness;
1223  
1224 //Flat 7.5mm horizontal section
1225   const Float_t kHxH1mm  = 1.85/2.;
1226   const Float_t kHyH1mm  = 0.75/2.;
1227   const Float_t kHzH1mm  = kHzFrameThickness;
1228
1229 //---
1230
1231 // InArcFrame parameters
1232   const Float_t kIAF  = 15.70;
1233   const Float_t kOAF  = 17.55;
1234   const Float_t kHzAF  = kHzFrameThickness;
1235   const Float_t kAFphi1  = 0.0;
1236   const Float_t kAFphi2  = 90.0;
1237
1238 //---
1239
1240 // ScrewsInFrame parameters HEAD
1241   const Float_t kSCRUHMI  = 0.;
1242   const Float_t kSCRUHMA  = 0.690/2.;
1243   const Float_t kSCRUHLE  = 0.4/2.;
1244 // ScrewsInFrame parameters MIDDLE
1245   const Float_t kSCRUMMI  = 0.;
1246   const Float_t kSCRUMMA  = 0.39/2.;
1247   const Float_t kSCRUMLE  = kHzFrameThickness;
1248 // ScrewsInFrame parameters NUT
1249   const Float_t kSCRUNMI  = 0.;
1250   const Float_t kSCRUNMA  = 0.78/2.;
1251   const Float_t kSCRUNLE  = 0.8/2.;   
1252   
1253        // ___________________Make volumes________________________
1254
1255  Float_t par[11];
1256  Float_t posX,posY,posZ;
1257
1258 // Quadrant volume TUBS1, positioned at the end
1259   par[0] = fgkMotherIR1;
1260   par[1] = fgkMotherOR1; 
1261   par[2] = fgkMotherThick1;  
1262   par[3] = fgkMotherPhiL1; 
1263   par[4] = fgkMotherPhiU1;
1264   gMC->Gsvolu(QuadrantMLayerName(chamber),"TUBS",idAir,par,5);
1265
1266 // Replace the volume shape with a composite shape
1267 // with substracted overlap with beam shield (YMOT)
1268
1269   if ( gMC->IsRootGeometrySupported() ) { 
1270
1271     // Get shape
1272     TGeoVolume* mlayer 
1273       = gGeoManager->FindVolumeFast(QuadrantMLayerName(chamber));
1274     if ( !mlayer ) {
1275       AliErrorStream() 
1276          << "Quadrant volume " << QuadrantMLayerName(chamber) << " not found" 
1277          << endl;
1278     }
1279     else {
1280       TGeoShape* quadrant = mlayer->GetShape();
1281       quadrant->SetName("quadrant");     
1282
1283       // Beam shield recess
1284       par[0] = 0;
1285       par[1] = 15.4; 
1286       par[2] = fgkMotherThick1;  
1287       new TGeoTube("shield_tube", par[0], par[1], par[2]);
1288   
1289       // Displacement
1290       posX = 2.6;
1291       posY = 2.6;
1292       posZ = 0;
1293       TGeoTranslation* displacement 
1294         = new TGeoTranslation("TR", posX, posY, posZ);
1295       displacement->RegisterYourself();
1296
1297       // Composite shape
1298       TGeoShape* composite
1299       = new TGeoCompositeShape("composite", "quadrant-shield_tube:TR"); 
1300       
1301       // Reset shape to volume      
1302       mlayer->SetShape(composite);
1303     }
1304   }    
1305
1306 // Quadrant volume TUBS2, positioned at the end
1307   par[0] = fgkMotherIR2;
1308   par[1] = fgkMotherOR2; 
1309   par[2] = fgkMotherThick2;  
1310   par[3] = fgkMotherPhiL2; 
1311   par[4] = fgkMotherPhiU2;
1312
1313   gMC->Gsvolu(QuadrantNLayerName(chamber),"TUBS",idAir,par,5); 
1314   gMC->Gsvolu(QuadrantFLayerName(chamber),"TUBS",idAir,par,5); 
1315
1316    if (chamber==1) {   
1317     // InVFrame  
1318     par[0] = kHxInVFrame;
1319     par[1] = kHyInVFrame;
1320     par[2] = kHzInVFrame;
1321     gMC->Gsvolu("SQ00","BOX",idFrameEpoxy,par,3);
1322
1323     //Flat 1mm vertical section
1324     par[0] = kHxV1mm;
1325     par[1] = kHyV1mm;
1326     par[2] = kHzV1mm;
1327     gMC->Gsvolu("SQ01","BOX",idFrameEpoxy,par,3); 
1328  
1329 // OutTopFrame 
1330 //
1331 // - 3 components (a cuboid and 2 trapezes) and 2 layers (Epoxy/Inox)
1332 //
1333 //---
1334
1335     // TopFrameAnode - layer 1 of 2 
1336     par[0] = kHxTFA;
1337     par[1] = kHyTFA;
1338     par[2] = kHzTFAE;
1339     gMC->Gsvolu("SQ02","BOX",idFrameEpoxy,par,3);
1340     
1341     // TopFrameAnode - layer 2 of 2 
1342     par[2] = kHzTFAI;
1343     gMC->Gsvolu("SQ03","BOX",idInox,par,3);
1344             
1345     // TopFrameAnodeA - layer 1 of 2  
1346     par[0] = kHzFAAE;
1347     par[1] = kTetFAA;
1348     par[2] = kPhiFAA;
1349     par[3] = kH1FAA;
1350     par[4] = kBl1FAA;
1351     par[5] = kTl1FAA;
1352     par[6] = kAlp1FAA;
1353     par[7] = kH2FAA;
1354     par[8] = kBl2FAA;
1355     par[9] = kTl2FAA;
1356     par[10] = kAlp2FAA;    
1357     gMC->Gsvolu("SQ04","TRAP",idFrameEpoxy,par,11);    
1358
1359     // TopFrameAnodeA - layer 2 of 2
1360     par[0] = kHzFAAI;    
1361     gMC->Gsvolu("SQ05","TRAP",idInox,par,11); 
1362       
1363     // TopFrameAnodeB - layer 1 of 2
1364     par[0] = kHzFABE;
1365     par[1] = kTetFAB;
1366     par[2] = kPhiFAB;
1367     par[3] = kH1FAB;
1368     par[4] = kBl1FAB;
1369     par[5] = kTl1FAB;
1370     par[6] = kAlp1FAB;
1371     par[7] = kH2FAB;
1372     par[8] = kBl2FAB;
1373     par[9] = kTl2FAB;
1374     par[10] = kAlp2FAB;
1375     gMC->Gsvolu("SQ06","TRAP",idFrameEpoxy,par,11);     
1376
1377     // OutTopTrapFrameB - layer 2 of 2
1378     par[0] = kHzFABI;   
1379     gMC->Gsvolu("SQ07","TRAP",idInox,par,11);
1380
1381     // TopAnode1 -  layer 1 of 2
1382     par[0] = kHxTA1;
1383     par[1] = kHyTA1;
1384     par[2] = kHzTA11;    
1385     gMC->Gsvolu("SQ08","BOX",idInox,par,3); 
1386     
1387     // TopAnode1 -  layer 2 of 2
1388     par[2] = kHzTA12;    
1389     gMC->Gsvolu("SQ09","BOX",idFR4,par,11); 
1390
1391     // TopAnode2 -  layer 1 of 2
1392     par[0] = kHzTA21;
1393     par[1] = kTetTA2;
1394     par[2] = kPhiTA2;
1395     par[3] = kH1TA2;
1396     par[4] = kBl1TA2;
1397     par[5] = kTl1TA2;
1398     par[6] = kAlp1TA2;
1399     par[7] = kH2TA2;
1400     par[8] = kBl2TA2;
1401     par[9] = kTl2TA2;
1402     par[10] = kAlp2TA2;    
1403     gMC->Gsvolu("SQ10","TRAP",idInox,par,11); 
1404  
1405     // TopAnode2 -  layer 2 of 2
1406     par[0] = kHzTA22;    
1407     gMC->Gsvolu("SQ11","TRAP",idFR4,par,11);   
1408
1409     // TopAnode3 -  layer 1 of 1 
1410     par[0] = kHzTA3;
1411     par[1] = kTetTA3;
1412     par[2] = kPhiTA3;
1413     par[3] = kH1TA3;
1414     par[4] = kBl1TA3;
1415     par[5] = kTl1TA3;
1416     par[6] = kAlp1TA3;
1417     par[7] = kH2TA3;
1418     par[8] = kBl2TA3;
1419     par[9] = kTl2TA3;
1420     par[10] = kAlp2TA3;    
1421     gMC->Gsvolu("SQ12","TRAP",idFR4,par,11); 
1422
1423     // TopEarthFace 
1424     par[0] = kHzTEF;
1425     par[1] = kTetTEF;
1426     par[2] = kPhiTEF;
1427     par[3] = kH1TEF;
1428     par[4] = kBl1TEF;
1429     par[5] = kTl1TEF;
1430     par[6] = kAlp1TEF;
1431     par[7] = kH2TEF;
1432     par[8] = kBl2TEF;
1433     par[9] = kTl2TEF;
1434     par[10] = kAlp2TEF;    
1435     gMC->Gsvolu("SQ13","TRAP",idCopper,par,11);   
1436
1437     // TopEarthProfile 
1438     par[0] = kHzTEP;
1439     par[1] = kTetTEP;
1440     par[2] = kPhiTEP;
1441     par[3] = kH1TEP;
1442     par[4] = kBl1TEP;
1443     par[5] = kTl1TEP;
1444     par[6] = kAlp1TEP;
1445     par[7] = kH2TEP;
1446     par[8] = kBl2TEP;
1447     par[9] = kTl2TEP;
1448     par[10] = kAlp2TEP;
1449     gMC->Gsvolu("SQ14","TRAP",idCopper,par,11);       
1450
1451     // TopGasSupport  
1452     par[0] = kHxTGS;
1453     par[1] = kHyTGS;
1454     par[2] = kHzTGS;
1455     gMC->Gsvolu("SQ15","BOX",idAlu,par,3);
1456
1457     // TopPositioner parameters - single Stainless Steel trapezoid 
1458     par[0] = kHzTP;
1459     par[1] = kTetTP; 
1460     par[2] = kPhiTP;
1461     par[3] = kH1TP;
1462     par[4] = kBl1TP; 
1463     par[5] = kTl1TP; 
1464     par[6] = kAlp1TP;
1465     par[7] = kH2TP;
1466     par[8] = kBl2TP; 
1467     par[9] = kTl2TP; 
1468     par[10] = kAlp2TP;     
1469     gMC->Gsvolu("SQ16","TRAP",idInox,par,11);       
1470
1471 //
1472 // OutEdgeTrapFrame Epoxy = (4 trapezes)*2 copies*2 layers (Epoxy/Inox)
1473 //
1474 //---
1475     // Trapezoid 1 - 2 layers
1476     par[1] = kTetOETF;
1477     par[2] = kPhiOETF;
1478     par[3] = kH1OETF;
1479     par[4] = kBl1OETF1;
1480     par[5] = kTl1OETF1;
1481     par[6] = kAlp1OETF1;
1482     par[7] = kH2OETF;
1483     par[8] = kBl2OETF1;
1484     par[9] = kTl2OETF1;
1485     par[10] = kAlp2OETF1; 
1486            
1487     par[0] = kHzOETFE;             
1488     gMC->Gsvolu("SQ17","TRAP",idFrameEpoxy,par,11); 
1489     par[0] = kHzOETFI;
1490     gMC->Gsvolu("SQ18","TRAP",idInox,par,11);
1491     
1492     // Trapezoid 2 - 2 layers
1493     par[4] = kBl1OETF2;
1494     par[5] = kTl1OETF2;
1495     par[6] = kAlp1OETF2;
1496
1497     par[8] = kBl2OETF2;
1498     par[9] = kTl2OETF2;
1499     par[10] = kAlp2OETF2; 
1500     
1501     par[0] = kHzOETFE;    
1502     gMC->Gsvolu("SQ19","TRAP",idFrameEpoxy,par,11);    
1503     par[0] = kHzOETFI;    
1504     gMC->Gsvolu("SQ20","TRAP",idInox,par,11);     
1505     
1506     // Trapezoid 3 - 2 layers
1507     par[4] = kBl1OETF3;
1508     par[5] = kTl1OETF3;
1509     par[6] = kAlp1OETF3;
1510
1511     par[8] = kBl2OETF3;
1512     par[9] = kTl2OETF3;
1513     par[10] = kAlp2OETF3; 
1514  
1515     par[0] = kHzOETFE;    
1516     gMC->Gsvolu("SQ21","TRAP",idFrameEpoxy,par,11);   
1517     par[0] = kHzOETFI;    
1518     gMC->Gsvolu("SQ22","TRAP",idInox,par,11);     
1519     
1520     // Trapezoid 4 - 2 layers
1521
1522     par[4] = kBl1OETF4;
1523     par[5] = kTl1OETF4;
1524     par[6] = kAlp1OETF4;
1525
1526     par[8] = kBl2OETF4;
1527     par[9] = kTl2OETF4;
1528     par[10] = kAlp2OETF4;  
1529    
1530     par[0] = kHzOETFE;    
1531     gMC->Gsvolu("SQ23","TRAP",idFrameEpoxy,par,11);    
1532     par[0] = kHzOETFI;    
1533     gMC->Gsvolu("SQ24","TRAP",idInox,par,11);     
1534              
1535 //---
1536     // OutVFrame    
1537     par[0] = kHxOutVFrame;
1538     par[1] = kHyOutVFrame;
1539     par[2] = kHzOutVFrame;
1540     gMC->Gsvolu("SQ25","BOX",idFrameEpoxy,par,3);
1541         
1542     // OutVFrame corner  
1543     par[0] = kHzOCTF;
1544     par[1] = kTetOCTF;
1545     par[2] = kPhiOCTF;
1546     par[3] = kH1OCTF;
1547     par[4] = kBl1OCTF;
1548     par[5] = kTl1OCTF;
1549     par[6] = kAlp1OCTF;
1550     par[7] = kH2OCTF;
1551     par[8] = kBl2OCTF;
1552     par[9] = kTl2OCTF;
1553     par[10] = kAlp2OCTF;    
1554     gMC->Gsvolu("SQ26","TRAP",idFrameEpoxy,par,11);
1555  
1556     // EarthFaceCu trapezoid
1557     par[0] = kHzVFC;
1558     par[1] = kTetVFC;
1559     par[2] = kPhiVFC;
1560     par[3] = kH1VFC;
1561     par[4] = kBl1VFC;
1562     par[5] = kTl1VFC;
1563     par[6] = kAlp1VFC;
1564     par[7] = kH2VFC;
1565     par[8] = kBl2VFC;
1566     par[9] = kTl2VFC;
1567     par[10] = kAlp2VFC;   
1568     gMC->Gsvolu("SQ27","TRAP",idCopper,par,11);     
1569
1570     // VertEarthSteel trapezoid
1571     par[0] = kHzVES;
1572     par[1] = kTetVES;
1573     par[2] = kPhiVES;
1574     par[3] = kH1VES;
1575     par[4] = kBl1VES;
1576     par[5] = kTl1VES;
1577     par[6] = kAlp1VES;
1578     par[7] = kH2VES;
1579     par[8] = kBl2VES;
1580     par[9] = kTl2VES;
1581     par[10] = kAlp2VES;    
1582     gMC->Gsvolu("SQ28","TRAP",idInox,par,11); 
1583
1584     // VertEarthProfCu trapezoid       
1585     par[0] = kHzVPC;
1586     par[1] = kTetVPC;
1587     par[2] = kPhiVPC;
1588     par[3] = kH1VPC;
1589     par[4] = kBl1VPC;
1590     par[5] = kTl1VPC;
1591     par[6] = kAlp1VPC;
1592     par[7] = kH2VPC;
1593     par[8] = kBl2VPC;
1594     par[9] = kTl2VPC;
1595     par[10] = kAlp2VPC;
1596     gMC->Gsvolu("SQ29","TRAP",idCopper,par,11);
1597
1598     // SuppLateralPositionner cuboid    
1599     par[0] = kHxSLP;
1600     par[1] = kHySLP;
1601     par[2] = kHzSLP;
1602     gMC->Gsvolu("SQ30","BOX",idAlu,par,3);
1603
1604     // LateralPositionerFace
1605     par[0] = kHxLPF;
1606     par[1] = kHyLPF;
1607     par[2] = kHzLPF;
1608     gMC->Gsvolu("SQ31","BOX",idInox,par,3);
1609
1610     // LateralPositionerProfile
1611     par[0] = kHxLPP;
1612     par[1] = kHyLPP;
1613     par[2] = kHzLPP;
1614     gMC->Gsvolu("SQ32","BOX",idInox,par,3); // middle layer
1615     
1616     par[0] = kHxLPP;
1617     par[1] = kHyLPP;
1618     par[2] = kHzLPNF;
1619     gMC->Gsvolu("SQ33","BOX",idInox,par,3); // near and far layers
1620
1621     // VertCradleA - 1st trapezoid
1622     par[0] = kHzVC1;
1623     par[1] = kTetVC1;
1624     par[2] = kPhiVC1;
1625     par[3] = kH1VC1;
1626     par[4] = kBl1VC1;
1627     par[5] = kTl1VC1;
1628     par[6] = kAlp1VC1;
1629     par[7] = kH2VC1;
1630     par[8] = kBl2VC1;
1631     par[9] = kTl2VC1;
1632     par[10] = kAlp2VC1;
1633     gMC->Gsvolu("SQ34","TRAP",idAlu,par,11); 
1634     
1635     // VertCradleB - 2nd trapezoid
1636     par[0] = kHzVC2;
1637     par[1] = kTetVC2;
1638     par[2] = kPhiVC2;
1639     par[3] = kH1VC2;
1640     par[4] = kBl1VC2;
1641     par[5] = kTl1VC2;
1642     par[6] = kAlp1VC2;
1643     par[7] = kH2VC2;
1644     par[8] = kBl2VC2;
1645     par[9] = kTl2VC2;
1646     par[10] = kAlp2VC2;
1647     gMC->Gsvolu("SQ35","TRAP",idAlu,par,11);  
1648        
1649     // VertCradleC - 3rd trapezoid
1650     par[0] = kHzVC3;
1651     par[1] = kTetVC3;
1652     par[2] = kPhiVC3;
1653     par[3] = kH1VC3;
1654     par[4] = kBl1VC3;
1655     par[5] = kTl1VC3;
1656     par[6] = kAlp1VC3;
1657     par[7] = kH2VC3;
1658     par[8] = kBl2VC3;
1659     par[9] = kTl2VC3;
1660     par[10] = kAlp2VC3;    
1661     gMC->Gsvolu("SQ36","TRAP",idAlu,par,11);  
1662
1663     // VertCradleD - 4th trapezoid
1664     par[0] = kHzVC4;
1665     par[1] = kTetVC4;
1666     par[2] = kPhiVC4;
1667     par[3] = kH1VC4;
1668     par[4] = kBl1VC4;
1669     par[5] = kTl1VC4;
1670     par[6] = kAlp1VC4;
1671     par[7] = kH2VC4;
1672     par[8] = kBl2VC4;
1673     par[9] = kTl2VC4;
1674     par[10] = kAlp2VC4;    
1675     gMC->Gsvolu("SQ37","TRAP",idAlu,par,11);  
1676           
1677     // LateralSightSupport trapezoid
1678     par[0] = kHzVSS;
1679     par[1] = kTetVSS;
1680     par[2] = kPhiVSS;
1681     par[3] = kH1VSS;
1682     par[4] = kBl1VSS;
1683     par[5] = kTl1VSS;
1684     par[6] = kAlp1VSS;
1685     par[7] = kH2VSS;
1686     par[8] = kBl2VSS;
1687     par[9] = kTl2VSS;
1688     par[10] = kAlp2VSS;
1689     gMC->Gsvolu("SQ38","TRAP",idAlu,par,11);
1690
1691     // LateralSight
1692     par[0] = kVSInRad;
1693     par[1] = kVSOutRad;
1694     par[2] = kVSLen;       
1695     gMC->Gsvolu("SQ39","TUBE",idFrameEpoxy,par,3);   
1696
1697 //---
1698     // InHFrame
1699     par[0] = kHxInHFrame;
1700     par[1] = kHyInHFrame;
1701     par[2] = kHzInHFrame;
1702     gMC->Gsvolu("SQ40","BOX",idFrameEpoxy,par,3);
1703
1704     //Flat 7.5mm horizontal section
1705     par[0] = kHxH1mm;
1706     par[1] = kHyH1mm;
1707     par[2] = kHzH1mm;
1708     gMC->Gsvolu("SQ41","BOX",idFrameEpoxy,par,3);
1709
1710     // InArcFrame 
1711     par[0] = kIAF;
1712     par[1] = kOAF; 
1713     par[2] = kHzAF;  
1714     par[3] = kAFphi1; 
1715     par[4] = kAFphi2;
1716
1717     gMC->Gsvolu("SQ42","TUBS",idFrameEpoxy,par,5);
1718
1719 //---
1720     // ScrewsInFrame - 3 sections in order to avoid overlapping volumes
1721     // Screw Head, in air
1722     par[0] = kSCRUHMI;
1723     par[1] = kSCRUHMA; 
1724     par[2] = kSCRUHLE;  
1725
1726     gMC->Gsvolu("SQ43","TUBE",idInox,par,3);
1727     
1728     // Middle part, in the Epoxy
1729     par[0] = kSCRUMMI;
1730     par[1] = kSCRUMMA;
1731     par[2] = kSCRUMLE;
1732     gMC->Gsvolu("SQ44","TUBE",idInox,par,3);
1733     
1734     // Screw nut, in air
1735     par[0] = kSCRUNMI;
1736     par[1] = kSCRUNMA;
1737     par[2] = kSCRUNLE;   
1738     gMC->Gsvolu("SQ45","TUBE",idInox,par,3);     
1739    }
1740               
1741 // __________________Place volumes in the quadrant ____________ 
1742         
1743     // InVFrame  
1744     posX = kHxInVFrame;
1745     posY = 2.0*kHyInHFrame+2.*kHyH1mm+kIAF+kHyInVFrame;        
1746     posZ = 0.;
1747     gMC->Gspos("SQ00",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1748
1749 // keep memory of the mid position. Used for placing screws
1750     const GReal_t kMidVposX = posX;
1751     const GReal_t kMidVposY = posY;
1752     const GReal_t kMidVposZ = posZ;
1753
1754     //Flat 7.5mm vertical section
1755     posX = 2.0*kHxInVFrame+kHxV1mm;
1756     posY = 2.0*kHyInHFrame+2.*kHyH1mm+kIAF+kHyV1mm;
1757     posZ = 0.;
1758     gMC->Gspos("SQ01",1,QuadrantMLayerName(chamber),posX, posY, posZ,0, "ONLY"); 
1759     
1760     // TopFrameAnode place 2 layers of TopFrameAnode cuboids  
1761     posX = kHxTFA;
1762     posY = 2.*kHyInHFrame+2.*kHyH1mm+kIAF+2.*kHyInVFrame+kHyTFA;   
1763     posZ = kHzOuterFrameInox;
1764     gMC->Gspos("SQ02",1,QuadrantMLayerName(chamber),posX, posY, posZ,0,"ONLY"); 
1765     posZ = posZ+kHzOuterFrameInox;
1766     gMC->Gspos("SQ03",1,QuadrantMLayerName(chamber),posX, posY, posZ,0,"ONLY");
1767     
1768     // place 2 layers of TopFrameAnodeA trapezoids 
1769     posX = 35.8932+fgkDeltaQuadLHC;
1770     posY = 92.6745+fgkDeltaQuadLHC;
1771     posZ = kHzOuterFrameInox; 
1772     gMC->Gspos("SQ04",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1773     posZ = posZ+kHzOuterFrameInox;
1774     gMC->Gspos("SQ05",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1775     
1776     // place 2 layers of TopFrameAnodeB trapezoids 
1777     posX = 44.593+fgkDeltaQuadLHC;
1778     posY = 90.737+fgkDeltaQuadLHC;
1779     posZ = kHzOuterFrameInox; 
1780     gMC->Gspos("SQ06",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1781     posZ = posZ+kHzOuterFrameInox;
1782     gMC->Gspos("SQ07",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");    
1783
1784     // TopAnode1 place 2 layers  
1785     posX = 6.8+fgkDeltaQuadLHC;
1786     posY = 99.85+fgkDeltaQuadLHC;
1787     posZ = -1.*kHzAnodeFR4;
1788     gMC->Gspos("SQ08",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");  
1789     posZ = posZ+kHzTopAnodeSteel1;
1790     gMC->Gspos("SQ09",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");    
1791          
1792     // TopAnode2 place 2 layers
1793     posX = 18.534+fgkDeltaQuadLHC;
1794     posY = 99.482+fgkDeltaQuadLHC; 
1795     posZ = -1.*kHzAnodeFR4;    
1796     gMC->Gspos("SQ10",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1797     posZ = posZ+kHzTopAnodeSteel2;    
1798     gMC->Gspos("SQ11",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");       
1799     
1800     // TopAnode3 place 1 layer
1801     posX = 25.80+fgkDeltaQuadLHC;
1802     posY = 98.61+fgkDeltaQuadLHC;
1803     posZ = 0.;    
1804     gMC->Gspos("SQ12",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");  
1805           
1806     // TopEarthFace - 2 copies
1807     posX = 23.122+fgkDeltaQuadLHC;
1808     posY = 96.90+fgkDeltaQuadLHC;
1809     posZ = kHzOuterFrameEpoxy+kHzOuterFrameInox+kHzTopEarthFaceCu;
1810     gMC->Gspos("SQ13",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1811     posZ = -1.*posZ;
1812     gMC->Gspos("SQ13",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1813
1814     // TopEarthProfile 
1815     posX = 14.475+fgkDeltaQuadLHC;
1816     posY = 97.900+fgkDeltaQuadLHC; 
1817     posZ = kHzTopEarthProfileCu;
1818     gMC->Gspos("SQ14",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1819     posZ = -1.0*posZ;
1820     gMC->Gspos("SQ14",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1821
1822     // TopGasSupport - 2 copies                            
1823     posX = 4.9500+fgkDeltaQuadLHC;
1824     posY = 96.200+fgkDeltaQuadLHC;
1825     posZ = kHzOuterFrameEpoxy+kHzOuterFrameInox+kHzTopGasSupportAl;
1826     gMC->Gspos("SQ15",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1827     posZ = -1.*posZ;
1828     gMC->Gspos("SQ15",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");
1829     
1830     // TopPositioner parameters - single Stainless Steel trapezoid - 2 copies
1831     posX = 7.60+fgkDeltaQuadLHC;
1832     posY = 98.98+fgkDeltaQuadLHC;   
1833     posZ = kHzOuterFrameEpoxy+kHzOuterFrameInox+2.*kHzTopGasSupportAl+kHzTopPositionerSteel;
1834     gMC->Gspos("SQ16",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY");
1835     posZ = -1.*posZ;
1836     gMC->Gspos("SQ16",2,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY"); 
1837
1838     // OutEdgeFrame 
1839     Float_t xCenter[8]; 
1840     Float_t yCenter[8];
1841     
1842     xCenter[0] = 73.201 + fgkDeltaQuadLHC;
1843     xCenter[1] = 78.124 + fgkDeltaQuadLHC; 
1844     //xCenter[2] = 82.862 + fgkDeltaQuadLHC;
1845     xCenter[2] = 83.102 + fgkDeltaQuadLHC;
1846     xCenter[3] = 87.418 + fgkDeltaQuadLHC; 
1847         // Fix (5) - overlap of SQ21 with 041M and 125M
1848     
1849     yCenter[0] = 68.122 + fgkDeltaQuadLHC;
1850     yCenter[1] = 62.860 + fgkDeltaQuadLHC;   
1851     //yCenter[2] = 57.420 + fgkDeltaQuadLHC;
1852     yCenter[2] = 57.660 + fgkDeltaQuadLHC;
1853     yCenter[3] = 51.800 + fgkDeltaQuadLHC; 
1854         // Fix (5) - overlap of SQ21 with 041M and 125M
1855       
1856     xCenter[4] = 68.122 + fgkDeltaQuadLHC;
1857     xCenter[5] = 62.860 + fgkDeltaQuadLHC; 
1858     xCenter[6] = 57.420 + fgkDeltaQuadLHC;
1859     xCenter[7] = 51.800 + fgkDeltaQuadLHC; 
1860     
1861     yCenter[4] = 73.210 + fgkDeltaQuadLHC;
1862     yCenter[5] = 78.124 + fgkDeltaQuadLHC; 
1863     yCenter[6] = 82.862 + fgkDeltaQuadLHC;
1864     yCenter[7] = 87.418 + fgkDeltaQuadLHC; 
1865       
1866     posZ = -1.0*kHzOuterFrameInox;     
1867     gMC->Gspos("SQ17",1,QuadrantMLayerName(chamber), xCenter[0], yCenter[0], posZ, rot2,"ONLY");
1868     gMC->Gspos("SQ17",2,QuadrantMLayerName(chamber), xCenter[4], yCenter[4], posZ, rot3,"ONLY");
1869
1870     gMC->Gspos("SQ19",1,QuadrantMLayerName(chamber), xCenter[1], yCenter[1], posZ, rot2,"ONLY");   
1871     gMC->Gspos("SQ19",2,QuadrantMLayerName(chamber), xCenter[5], yCenter[5], posZ, rot3,"ONLY");
1872
1873     gMC->Gspos("SQ21",1,QuadrantMLayerName(chamber), xCenter[2], yCenter[2], posZ, rot2,"ONLY");
1874     gMC->Gspos("SQ21",2,QuadrantMLayerName(chamber), xCenter[6], yCenter[6], posZ, rot3,"ONLY");
1875     
1876     gMC->Gspos("SQ23",1,QuadrantMLayerName(chamber), xCenter[3], yCenter[3], posZ, rot2,"ONLY");
1877     gMC->Gspos("SQ23",2,QuadrantMLayerName(chamber), xCenter[7], yCenter[7], posZ, rot3,"ONLY");
1878      
1879     posZ = posZ+kHzOuterFrameEpoxy;
1880    
1881     gMC->Gspos("SQ18",1,QuadrantMLayerName(chamber), xCenter[0], yCenter[0], posZ, rot2,"ONLY");
1882     gMC->Gspos("SQ18",2,QuadrantMLayerName(chamber), xCenter[4], yCenter[4], posZ, rot3,"ONLY");
1883     
1884     gMC->Gspos("SQ20",1,QuadrantMLayerName(chamber), xCenter[1], yCenter[1], posZ, rot2,"ONLY");   
1885     gMC->Gspos("SQ20",2,QuadrantMLayerName(chamber), xCenter[5], yCenter[5], posZ, rot3,"ONLY");
1886
1887     gMC->Gspos("SQ22",1,QuadrantMLayerName(chamber), xCenter[2], yCenter[2], posZ, rot2,"ONLY");
1888     gMC->Gspos("SQ22",2,QuadrantMLayerName(chamber), xCenter[6], yCenter[6], posZ, rot3,"ONLY");
1889        
1890     gMC->Gspos("SQ24",1,QuadrantMLayerName(chamber), xCenter[3], yCenter[3], posZ, rot2,"ONLY");
1891     gMC->Gspos("SQ24",2,QuadrantMLayerName(chamber), xCenter[7], yCenter[7], posZ, rot3,"ONLY");  
1892
1893 //---    
1894         
1895 // OutVFrame
1896     posX = 2.*kHxInVFrame+kIAF+2.*kHxInHFrame-kHxOutVFrame+2.*kHxV1mm;
1897     posY = 2.*kHyInHFrame+kHyOutVFrame;    
1898     posZ = 0.;              
1899     gMC->Gspos("SQ25",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1900
1901  // keep memory of the mid position. Used for placing screws
1902     const GReal_t kMidOVposX = posX;
1903     const GReal_t kMidOVposY = posY;
1904     const GReal_t kMidOVposZ = posZ;
1905
1906     const Float_t kTOPY = posY+kHyOutVFrame;
1907     const Float_t kOUTX = posX;
1908
1909 // OutVFrame corner
1910     posX = kOUTX;
1911     posY = kTOPY+((kBl1OCTF+kTl1OCTF)/2.);
1912     posZ = 0.;     
1913     gMC->Gspos("SQ26",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1,"ONLY"); 
1914
1915 // VertEarthFaceCu - 2 copies
1916     posX = 89.4000+fgkDeltaQuadLHC;
1917     posY = 25.79+fgkDeltaQuadLHC;    
1918     posZ = kHzFrameThickness+2.0*kHzFoam+kHzVertEarthFaceCu;              
1919     gMC->Gspos("SQ27",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1920     posZ = -1.0*posZ; 
1921     gMC->Gspos("SQ27",2,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1922     
1923 // VertEarthSteel - 2 copies
1924     posX = 91.00+fgkDeltaQuadLHC;
1925     posY = 30.616+fgkDeltaQuadLHC;    
1926     posZ = kHzFrameThickness+2.0*kHzFoam+kHzVertBarSteel;              
1927     gMC->Gspos("SQ28",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1928     posZ = -1.0*posZ;              
1929     gMC->Gspos("SQ28",2,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY");
1930  
1931 // VertEarthProfCu - 2 copies
1932     posX = 92.000+fgkDeltaQuadLHC;
1933     posY = 29.64+fgkDeltaQuadLHC;    
1934     posZ = kHzFrameThickness;              
1935     gMC->Gspos("SQ29",1,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1936     posZ = -1.0*posZ;    
1937     gMC->Gspos("SQ29",2,QuadrantMLayerName(chamber),posX, posY, posZ, rot1, "ONLY"); 
1938
1939 // SuppLateralPositionner - 2 copies 
1940     posX = 90.2-kNearFarLHC;
1941     posY = 5.00-kNearFarLHC;    
1942     posZ = kHzLateralPosnAl-fgkMotherThick2;             
1943     gMC->Gspos("SQ30",1,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1944     posZ = -1.0*posZ;            
1945     gMC->Gspos("SQ30",2,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1946
1947 // LateralPositionner - 2 copies - Face view
1948     posX = 92.175-kNearFarLHC-2.*kHxLPP;
1949     posY = 5.00-kNearFarLHC;   
1950     posZ =2.0*kHzLateralPosnAl+kHzLateralPosnInoxFace-fgkMotherThick2;              
1951     gMC->Gspos("SQ31",1,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1952     posZ = -1.0*posZ;             
1953     gMC->Gspos("SQ31",2,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
1954
1955 // LateralPositionner -  Profile view   
1956     posX = 92.175+fgkDeltaQuadLHC+kHxLPF-kHxLPP;
1957     posY = 5.00+fgkDeltaQuadLHC;    
1958     posZ = 0.;              
1959     gMC->Gspos("SQ32",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY"); // middle layer
1960
1961     posX = 92.175-kNearFarLHC+kHxLPF-kHxLPP; 
1962     posY = 5.0000-kNearFarLHC;    
1963     posZ = fgkMotherThick2-kHzLPNF;              
1964     gMC->Gspos("SQ33",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY"); // near layer
1965     posZ = -1.*posZ;
1966     gMC->Gspos("SQ33",2,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY"); // far layer
1967       
1968 // VertCradleA  1st Trapezoid - 3 copies
1969     posX = 95.73+fgkDeltaQuadLHC;
1970     posY = 33.26+fgkDeltaQuadLHC; 
1971     posZ = 0.;              
1972     gMC->Gspos("SQ34",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");  
1973
1974     posX = 95.73-kNearFarLHC;
1975     posY = 33.26-kNearFarLHC;
1976     posZ = 2.0*kHzLateralSightAl+kHzVerticalCradleAl-fgkMotherThick2;               
1977     gMC->Gspos("SQ34",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1978     posZ = -1.0*posZ;              
1979     gMC->Gspos("SQ34",3,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1980
1981 // VertCradleB  2nd Trapezoid - 3 copies
1982     posX = 97.29+fgkDeltaQuadLHC;
1983     posY = 23.02+fgkDeltaQuadLHC;    
1984     posZ = 0.;              
1985     gMC->Gspos("SQ35",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1986
1987     posX = 97.29-kNearFarLHC;
1988     posY = 23.02-kNearFarLHC;   
1989     posZ = 2.0*kHzLateralSightAl+kHzVerticalCradleAl-fgkMotherThick2;          
1990     gMC->Gspos("SQ35",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY");    
1991     posZ = -1.0*posZ;          
1992     gMC->Gspos("SQ35",3,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1993
1994 // OutVertCradleC  3rd Trapeze - 3 copies
1995     posX = 98.31+fgkDeltaQuadLHC;
1996     posY = 12.77+fgkDeltaQuadLHC;  
1997     posZ = 0.;              
1998     gMC->Gspos("SQ36",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");
1999
2000     posX = 98.05-kNearFarLHC;
2001     posY = 12.77-kNearFarLHC;        
2002     posZ = 2.0*kHzLateralSightAl+kHzVerticalCradleAl-fgkMotherThick2;         
2003            // Fix (2) of extrusion SQ36 from SQN1, SQN2, SQF1, SQF2 
2004            // (was posX = 98.31 ...)
2005     gMC->Gspos("SQ36",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY");       
2006     posZ = -1.0*posZ;
2007     gMC->Gspos("SQ36",3,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY");  
2008
2009 // OutVertCradleD  4th Trapeze - 3 copies
2010     posX = 98.81+fgkDeltaQuadLHC;
2011     posY = 2.52+fgkDeltaQuadLHC;    
2012     posZ = 0.;              
2013     gMC->Gspos("SQ37",2,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");
2014    
2015     posZ = fgkMotherThick1-kHzVerticalCradleAl;                
2016     gMC->Gspos("SQ37",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");
2017     posZ = -1.0*posZ;          
2018     gMC->Gspos("SQ37",3,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY");          
2019              
2020 // LateralSightSupport - 2 copies
2021     posX = 98.33-kNearFarLHC;
2022     posY = 10.00-kNearFarLHC;    
2023     posZ = kHzLateralSightAl-fgkMotherThick2;
2024            // Fix (3) of extrusion SQ38 from SQN1, SQN2, SQF1, SQF2 
2025            // (was posX = 98.53 ...)
2026     gMC->Gspos("SQ38",1,QuadrantNLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
2027     posZ = -1.0*posZ;             
2028     gMC->Gspos("SQ38",2,QuadrantFLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
2029     
2030 // Mire placement
2031     posX = 92.84+fgkDeltaQuadLHC;  
2032     posY = 8.13+fgkDeltaQuadLHC;
2033     posZ = 0.;
2034     gMC->Gspos("SQ39",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0,"ONLY");    
2035
2036 //---
2037
2038 // InHFrame
2039     posX = 2.0*kHxInVFrame+2.*kHxV1mm+kIAF+kHxInHFrame;
2040     posY = kHyInHFrame;
2041     posZ = 0.;       
2042     gMC->Gspos("SQ40",1,QuadrantMLayerName(chamber),posX, posY, posZ, 0, "ONLY"); 
2043  
2044  // keep memory of the mid position. Used for placing screws
2045     const GReal_t kMidHposX = posX;
2046     const GReal_t kMidHposY = posY;
2047     const GReal_t kMidHposZ = posZ;
2048
2049 // Flat 7.5mm horizontal section
2050     posX = 2.0*kHxInVFrame+2.*kHxV1mm+kIAF+kHxH1mm;
2051     posY = 2.0*kHyInHFrame+kHyH1mm;
2052     posZ = 0.;
2053     gMC->Gspos("SQ41",1,QuadrantMLayerName(chamber),posX, posY, posZ,0, "ONLY"); 
2054         
2055 // InArcFrame 
2056     posX = 2.0*kHxInVFrame+2.*kHxV1mm;
2057     posY = 2.0*kHyInHFrame+2.*kHyH1mm;
2058     posZ = 0.;    
2059     gMC->Gspos("SQ42",1,QuadrantMLayerName(chamber),posX, posY, posZ,0, "ONLY"); 
2060
2061 // keep memory of the mid position. Used for placing screws
2062     const GReal_t kMidArcposX = posX;
2063     const GReal_t kMidArcposY = posY;
2064     const GReal_t kMidArcposZ = posZ;
2065
2066 // ScrewsInFrame - in sensitive volume
2067
2068      Float_t scruX[64];
2069      Float_t scruY[64]; 
2070          
2071 // Screws on IHEpoxyFrame
2072
2073      const Int_t kNumberOfScrewsIH = 14;    // no. of screws on the IHEpoxyFrame
2074      const Float_t kOffX = 5.;              // inter-screw distance 
2075
2076      // first screw coordinates 
2077      scruX[0] = 21.07;                  
2078      scruY[0] = -2.23; 
2079      // other screw coordinates      
2080      for (Int_t i = 1;i<kNumberOfScrewsIH;i++){   
2081      scruX[i] = scruX[i-1]+kOffX; 
2082      scruY[i] = scruY[0];
2083      }    
2084      // Position the volumes on the frames
2085      for (Int_t i = 0;i<kNumberOfScrewsIH;i++){
2086      posX = fgkDeltaQuadLHC + scruX[i];
2087      posY = fgkDeltaQuadLHC + scruY[i];
2088      posZ = 0.;   
2089      gMC->Gspos("SQ43",i+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");      
2090      if (chamber==1)
2091        gMC->Gspos("SQ44",i+1,"SQ40",posX+0.1-kMidHposX, posY+0.1-kMidHposY, posZ-kMidHposZ, 0, "ONLY");
2092      gMC->Gspos("SQ45",i+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY"); 
2093      }
2094      // special screw coordinates
2095      scruX[63] = 16.3;  
2096      scruY[63] = -2.23; 
2097      posX = fgkDeltaQuadLHC + scruX[63];
2098      posY = fgkDeltaQuadLHC + scruY[63];
2099      posZ = 0.;            
2100      gMC->Gspos("SQ43",64,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");
2101      if (chamber==1)
2102        gMC->Gspos("SQ44",64,"SQ40",posX+0.1-kMidHposX, posY+0.1-kMidHposY, posZ-kMidHposZ, 0, "ONLY"); 
2103      gMC->Gspos("SQ45",64,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY");  
2104      
2105 // Screws on the IVEpoxyFrame
2106   
2107     const Int_t kNumberOfScrewsIV = 15;     // no. of screws on the IVEpoxyFrame
2108     const Float_t kOffY = 5.;               // inter-screw distance 
2109     Int_t firstScrew = 58;
2110     Int_t lastScrew = 44;
2111  
2112     // first (special) screw coordinates
2113     scruX[firstScrew-1] = -2.23; 
2114     scruY[firstScrew-1] = 16.3; 
2115     // second (repetitive) screw coordinates
2116     scruX[firstScrew-2] = -2.23; 
2117     scruY[firstScrew-2] = 21.07;     
2118     // other screw coordinates      
2119     for (Int_t i = firstScrew-3;i>lastScrew-2;i--){   
2120     scruX[i] = scruX[firstScrew-2];
2121     scruY[i] = scruY[i+1]+kOffY;
2122     }
2123     
2124     for (Int_t i = 0;i<kNumberOfScrewsIV;i++){
2125     posX = fgkDeltaQuadLHC + scruX[i+lastScrew-1];
2126     posY = fgkDeltaQuadLHC + scruY[i+lastScrew-1];
2127     posZ = 0.;       
2128     gMC->Gspos("SQ43",i+lastScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");     
2129     if (chamber==1)
2130       gMC->Gspos("SQ44",i+lastScrew,"SQ00",posX+0.1-kMidVposX, posY+0.1-kMidVposY, posZ-kMidVposZ, 0, "ONLY"); 
2131     gMC->Gspos("SQ45",i+lastScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY");
2132     }    
2133     
2134 // Screws on the OVEpoxyFrame
2135   
2136     const Int_t kNumberOfScrewsOV = 10;     // no. of screws on the OVEpoxyFrame
2137
2138     firstScrew = 15;
2139     lastScrew = 25;
2140  
2141     // first (repetitive) screw coordinates
2142     // notes: 1st screw should be placed in volume 40 (InnerHorizFrame)
2143     scruX[firstScrew-1] = 90.9; 
2144     scruY[firstScrew-1] = -2.23;  // true value
2145  
2146     // other screw coordinates      
2147     for (Int_t i = firstScrew; i<lastScrew; i++ ){   
2148     scruX[i] = scruX[firstScrew-1];
2149     scruY[i] = scruY[i-1]+kOffY;
2150     }
2151     for (Int_t i = 1;i<kNumberOfScrewsOV;i++){
2152     posX = fgkDeltaQuadLHC + scruX[i+firstScrew-1];
2153     posY = fgkDeltaQuadLHC + scruY[i+firstScrew-1];
2154     posZ = 0.;   
2155     gMC->Gspos("SQ43",i+firstScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");     
2156     // ??
2157     if (chamber==1)
2158       gMC->Gspos("SQ44",i+firstScrew,"SQ25",posX+0.1-kMidOVposX, posY+0.1-kMidOVposY, posZ-kMidOVposZ, 0, "ONLY"); 
2159     gMC->Gspos("SQ45",i+firstScrew,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY"); 
2160     }
2161     // special case for 1st screw, inside the horizontal frame (volume 40)
2162     posX = fgkDeltaQuadLHC + scruX[firstScrew-1];
2163     posY = fgkDeltaQuadLHC + scruY[firstScrew-1];
2164     posZ = 0.;   
2165     if (chamber==1)
2166       gMC->Gspos("SQ44",firstScrew,"SQ40",posX+0.1-kMidHposX, posY+0.1-kMidHposY, posZ-kMidHposZ, 0, "ONLY"); 
2167           
2168 // Inner Arc of Frame, screw positions and numbers-1
2169    scruX[62] = 16.009; scruY[62]  = 1.401;
2170    scruX[61] = 14.564; scruY[61]  = 6.791;
2171    scruX[60] = 11.363; scruY[60]  = 11.363;
2172    scruX[59] = 6.791 ; scruY[59]  = 14.564;
2173    scruX[58] = 1.401 ; scruY[58]  = 16.009;
2174     
2175     for (Int_t i = 0;i<5;i++){
2176     posX = fgkDeltaQuadLHC + scruX[i+58];
2177     posY = fgkDeltaQuadLHC + scruY[i+58];
2178     posZ = 0.;   
2179     gMC->Gspos("SQ43",i+58+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ-kHzInHFrame-kSCRUHLE, 0, "ONLY");    
2180     if (chamber==1)
2181       gMC->Gspos("SQ44",i+58+1,"SQ42",posX+0.1-kMidArcposX, posY+0.1-kMidArcposY, posZ-kMidArcposZ, 0, "ONLY");
2182     gMC->Gspos("SQ45",i+58+1,QuadrantMLayerName(chamber),posX+0.1, posY+0.1, posZ+kHzInHFrame+kSCRUNLE, 0, "ONLY");
2183     }
2184 }
2185
2186 //______________________________________________________________________________
2187 void AliMUONSt1GeometryBuilderV2::PlaceInnerLayers(Int_t chamber)
2188 {
2189 /// Place the gas and copper layers for the specified chamber.
2190
2191 // Rotation Matrices 
2192   Int_t rot1, rot2, rot3, rot4;   
2193
2194   fMUON->AliMatrix(rot1,  90., 315., 90.,  45., 0., 0.); // -45 deg
2195   fMUON->AliMatrix(rot2,  90.,  90., 90., 180., 0., 0.); //  90 deg
2196   fMUON->AliMatrix(rot3,  90., 270., 90.,   0., 0., 0.); // -90 deg 
2197   fMUON->AliMatrix(rot4,  90.,  45., 90., 135., 0., 0.); //  deg 
2198
2199   GReal_t x;
2200   GReal_t y;
2201   GReal_t zg = 0.;
2202   GReal_t zc = fgkHzGas + fgkHzPadPlane;
2203   Int_t dpos = (chamber-1)*2;
2204   TString name;
2205   
2206   x = 14.53 + fgkDeltaQuadLHC;
2207   y = 53.34 + fgkDeltaQuadLHC;
2208   name = GasVolumeName("SAG", chamber);
2209   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,0,"ONLY");
2210   gMC->Gspos("SA1C", 1+dpos, QuadrantMLayerName(chamber),x,y, zc,0,"ONLY");
2211   gMC->Gspos("SA1C", 2+dpos, QuadrantMLayerName(chamber),x,y,-zc,0,"ONLY");
2212
2213   x = 40.67 + fgkDeltaQuadLHC;
2214   y = 40.66 + fgkDeltaQuadLHC;    
2215   name = GasVolumeName("SBG", chamber);
2216   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot1,"ONLY"); 
2217   gMC->Gspos("SB1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot1,"ONLY");
2218   gMC->Gspos("SB1C", 2+dpos, QuadrantMLayerName(chamber),x,y,-zc,rot1,"ONLY");
2219
2220   x = 53.34 + fgkDeltaQuadLHC;
2221   y = 14.52 + fgkDeltaQuadLHC; 
2222   name = GasVolumeName("SCG", chamber);
2223   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot2,"ONLY");
2224   gMC->Gspos("SC1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot2,"ONLY");
2225   gMC->Gspos("SC1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot2,"ONLY");
2226
2227   x = 5.83 + fgkDeltaQuadLHC;
2228   y = 17.29 + fgkDeltaQuadLHC;
2229   name = GasVolumeName("SDG", chamber);
2230   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot3,"ONLY");
2231   gMC->Gspos("SD1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot3,"ONLY");
2232   gMC->Gspos("SD1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot3,"ONLY");
2233
2234   x = 9.04 + fgkDeltaQuadLHC;
2235   y = 16.91 + fgkDeltaQuadLHC; 
2236   name = GasVolumeName("SEG", chamber);
2237   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,0,"ONLY");
2238   gMC->Gspos("SE1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,0,"ONLY");
2239   gMC->Gspos("SE1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,0,"ONLY");
2240
2241   x = 10.12 + fgkDeltaQuadLHC;
2242   y = 14.67 + fgkDeltaQuadLHC;  
2243   name = GasVolumeName("SFG", chamber);
2244   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot4,"ONLY");   
2245   gMC->Gspos("SF1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot4,"ONLY");
2246   gMC->Gspos("SF1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot4,"ONLY");
2247
2248   x = 8.2042 + fgkDeltaQuadLHC;
2249   y = 16.19 + fgkDeltaQuadLHC;
2250   name = GasVolumeName("SGG", chamber);
2251   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot4,"ONLY");
2252   gMC->Gspos("SG1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot4,"ONLY");
2253   gMC->Gspos("SG1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot4,"ONLY");
2254
2255   x = 14.68 + fgkDeltaQuadLHC;
2256   y = 10.10 + fgkDeltaQuadLHC;
2257   name = GasVolumeName("SHG", chamber);
2258   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot4,"ONLY");
2259   gMC->Gspos("SH1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot4,"ONLY");
2260   gMC->Gspos("SH1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot4,"ONLY");
2261
2262   x = 16.21 + fgkDeltaQuadLHC;
2263   y = 8.17 + fgkDeltaQuadLHC;
2264   name = GasVolumeName("SIG", chamber);
2265   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot4,"ONLY");
2266   gMC->Gspos("SI1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot4,"ONLY");
2267   gMC->Gspos("SI1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot4,"ONLY");
2268
2269   x = 16.92 + fgkDeltaQuadLHC;
2270   y = 9.02 + fgkDeltaQuadLHC;
2271   name = GasVolumeName("SJG", chamber);
2272   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,rot3,"ONLY");
2273   gMC->Gspos("SJ1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,rot3,"ONLY");
2274   gMC->Gspos("SJ1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,rot3,"ONLY");
2275
2276   x =  17.30 + fgkDeltaQuadLHC;
2277   y =  5.85 + fgkDeltaQuadLHC;
2278   name = GasVolumeName("SKG", chamber);
2279   gMC->Gspos(name,1,QuadrantMLayerName(chamber),x,y,zg,0,"ONLY");
2280   gMC->Gspos("SK1C", 1+dpos ,QuadrantMLayerName(chamber),x,y, zc,0,"ONLY");
2281   gMC->Gspos("SK1C", 2+dpos ,QuadrantMLayerName(chamber),x,y,-zc,0,"ONLY");
2282 }
2283
2284
2285 //______________________________________________________________________________
2286 void AliMUONSt1GeometryBuilderV2::PlaceSpacer0(Int_t chamber)
2287 {
2288 /// Place the spacer defined in global positions
2289 /// !! This method should be used only to find out the right mother volume
2290 /// for the spacer if geometry is changed and the plane segment volumes
2291 /// will change their numbering
2292
2293   // Global position of mother volume for the QuadrantMLayer
2294   // SQM1: (-2.6, -2.6, -522.41)
2295   // SQM2: (-2.6, -2.6, -541.49)
2296   GReal_t mx =  2.6;
2297   GReal_t my = -2.6;
2298   GReal_t mz =  522.41;
2299   
2300   GReal_t x, y, z;
2301   x = 40.82  - mx;
2302   y = 43.04  - my;
2303   z = 522.41 - mz;
2304   cout << "spacer05 pos1: " << x << ", " << y << ", " << z << endl;
2305   gMC->Gspos("Spacer05", 1, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
2306
2307   y = 44.54  - my;
2308   cout << "spacer05 pos2: " << x << ", " << y << ", " << z << endl;
2309   gMC->Gspos("Spacer05", 2, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
2310
2311   x = 40.82  - mx;
2312   y = 43.79  - my;
2313   z = 519.76 - mz;
2314   cout << "spacer06 pos1: " << x << ", " << y << ", " << z << endl;
2315   gMC->Gspos("Spacer06", 1, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
2316
2317   z = 525.06 - mz;
2318   cout << "spacer06 pos2: " << x << ", " << y << ", " << z << endl;
2319   gMC->Gspos("Spacer06", 2, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
2320
2321   x = 40.82  - mx;
2322   y = 43.79  - my;
2323   z = 522.41 - mz;
2324   cout << "spacer07 pos1: " << x << ", " << y << ", " << z << endl;
2325   gMC->Gspos("Spacer07", 1, QuadrantMLayerName(chamber), x, y, z, 0, "ONLY");
2326 }
2327
2328 //______________________________________________________________________________
2329 void AliMUONSt1GeometryBuilderV2::PlaceSector(const AliMpSector* sector,
2330                             SpecialMap specialMap, 
2331                             const TVector3& where, Bool_t reflectZ, Int_t chamber)
2332 {
2333 /// Place all the segments in the mother volume, at the position defined
2334 /// by the sector's data.
2335
2336 /// \cond SKIP
2337
2338   static Int_t segNum=1;
2339   Int_t sgn;
2340   Int_t reflZ;
2341   Int_t rotMat;
2342
2343   if (!reflectZ) {
2344     sgn= 1;
2345     reflZ=0;                                     // no reflection along z... nothing
2346     fMUON->AliMatrix(rotMat,  90.,90.,90,180.,0.,0.);   // 90° rotation around z, NO reflection along z
2347   } else  {
2348     sgn=-1;
2349     fMUON->AliMatrix(reflZ,  90.,0.,90,90.,180.,0.);    // reflection along z
2350     fMUON->AliMatrix(rotMat,  90.,90.,90,180.,180.,0.); // 90° rotation around z AND reflection along z
2351   }
2352   
2353   GReal_t posX,posY,posZ;
2354   
2355 #ifdef WITH_STL  
2356   vector<Int_t> alreadyDone;
2357 #endif
2358
2359 #ifdef WITH_ROOT  
2360   TArrayI alreadyDone(20);
2361   Int_t nofAlreadyDone = 0;
2362 #endif  
2363
2364   for (Int_t irow=0;irow<sector->GetNofRows();irow++){ // for each row
2365     AliMpRow* row = sector->GetRow(irow);
2366
2367
2368     for (Int_t iseg=0;iseg<row->GetNofRowSegments();iseg++){ // for each row segment
2369       AliMpVRowSegment* seg = row->GetRowSegment(iseg);
2370       
2371 #ifdef WITH_STL 
2372       SpecialMap::iterator iter 
2373         = specialMap.find(seg->GetMotifPositionId(0));
2374
2375       if ( iter == specialMap.end()){ //if this is a normal segment (ie. not part of <specialMap>)
2376 #endif  
2377       
2378 #ifdef WITH_ROOT  
2379       Long_t value = specialMap.GetValue(seg->GetMotifPositionId(0));
2380
2381       if ( value == 0 ){ //if this is a normal segment (ie. not part of <specialMap>)
2382 #endif  
2383       
2384         // create the cathode part
2385         CreatePlaneSegment(segNum, seg->Dimensions(), seg->GetNofMotifs());
2386   
2387         posX = where.X() + seg->Position().X();
2388         posY = where.Y() + seg->Position().Y();
2389         posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
2390         gMC->Gspos(PlaneSegmentName(segNum).Data(), 1, 
2391                    QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
2392
2393         // and place all the daughter boards of this segment
2394         for (Int_t motifNum=0;motifNum<seg->GetNofMotifs();motifNum++) {
2395
2396           // Copy number
2397           Int_t motifPosId = seg->GetMotifPositionId(motifNum);
2398           AliMpMotifPosition* motifPos = 
2399             sector->GetMotifMap()->FindMotifPosition(motifPosId);
2400           Int_t copyNo = motifPosId;
2401           if ( sector->GetDirection() == AliMp::kX) copyNo += fgkDaughterCopyNoOffset;
2402   
2403           // Position
2404           posX = where.X() + motifPos->Position().X() + fgkOffsetX;
2405           posY = where.Y() + motifPos->Position().Y() + fgkOffsetY;
2406           posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
2407
2408           gMC->Gspos(fgkDaughterName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, reflZ, "ONLY");
2409         }  
2410         segNum++;
2411         
2412       } else { 
2413
2414         // if this is a special segment 
2415         for (Int_t motifNum=0;motifNum<seg->GetNofMotifs();motifNum++) {// for each motif
2416
2417           Int_t motifPosId = seg->GetMotifPositionId(motifNum);
2418           
2419 #ifdef WITH_STL
2420           if (find(alreadyDone.begin(),alreadyDone.end(),motifPosId)
2421               != alreadyDone.end()) continue; // don't treat the same motif twice
2422
2423           AliMUONSt1SpecialMotif spMot = specialMap[motifPosId];
2424 #endif
2425 #ifdef WITH_ROOT
2426           Bool_t isDone = false;
2427           Int_t i=0;
2428           while (i<nofAlreadyDone && !isDone) {
2429             if (alreadyDone.At(i) == motifPosId) isDone=true;
2430             i++;
2431           }  
2432           if (isDone) continue; // don't treat the same motif twice
2433
2434           AliMUONSt1SpecialMotif spMot = *((AliMUONSt1SpecialMotif*)specialMap.GetValue(motifPosId));
2435 #endif
2436           // check
2437           // cout << chamber << " processing special motif: " << motifPosId << endl;  
2438
2439           AliMpMotifPosition* motifPos = sector->GetMotifMap()->FindMotifPosition(motifPosId);
2440
2441           // Copy number
2442           Int_t copyNo = motifPosId;
2443           if ( sector->GetDirection() == AliMp::kX) copyNo += fgkDaughterCopyNoOffset;
2444
2445           // place the hole for the motif, wrt the requested rotation angle
2446           Int_t rot = ( spMot.GetRotAngle()<0.1 ) ? reflZ:rotMat;
2447
2448           posX = where.X() + motifPos->Position().X() + spMot.GetDelta().X();
2449           posY = where.Y() + motifPos->Position().Y() + spMot.GetDelta().Y();
2450           posZ = where.Z() + sgn * (TotalHzPlane() + fgkHzGas + 2.*fgkHzPadPlane);
2451           gMC->Gspos(fgkHoleName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
2452
2453           // then place the daughter board for the motif, wrt the requested rotation angle
2454           posX = posX+fgkDeltaFilleEtamX;
2455           posY = posY+fgkDeltaFilleEtamY;
2456           posZ = where.Z() + sgn * (fgkMotherThick1 - TotalHzDaughter()); 
2457           gMC->Gspos(fgkDaughterName, copyNo, QuadrantMLayerName(chamber), posX, posY, posZ, rot, "ONLY");
2458
2459 #ifdef WITH_STL
2460           alreadyDone.push_back(motifPosId);// mark this motif as done
2461 #endif
2462 #ifdef WITH_ROOT
2463           if (nofAlreadyDone == alreadyDone.GetSize()) 
2464              alreadyDone.Set(2*nofAlreadyDone); 
2465           alreadyDone.AddAt(motifPosId, nofAlreadyDone++);                
2466 #endif
2467           // check
2468           // cout << chamber << " processed motifPosId: " << motifPosId << endl;
2469         }               
2470       }// end of special motif case
2471     }
2472   }
2473 /// \endcond
2474
2475
2476 //______________________________________________________________________________
2477 TString AliMUONSt1GeometryBuilderV2::GasVolumeName(const TString& name, Int_t chamber) const
2478 {
2479 /// Insert the chamber number into the name.
2480
2481   TString newString(name);
2482  
2483   TString number(""); 
2484   number += chamber;
2485
2486   newString.Insert(2, number);
2487   
2488   return newString;
2489 }
2490
2491 //
2492 // public methods
2493 //
2494
2495 //______________________________________________________________________________
2496 void AliMUONSt1GeometryBuilderV2::CreateMaterials()
2497 {
2498 /// Define materials specific to station 1
2499
2500 // Materials and medias defined in MUONv1:
2501 //
2502 //  AliMaterial( 9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
2503 //  AliMaterial(10, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
2504 //  AliMaterial(15, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
2505 //  AliMixture( 19, "Bakelite$", abak, zbak, dbak, -3, wbak);
2506 //  AliMixture( 20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
2507 //  AliMixture( 21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
2508 //  AliMixture( 22, "ArCO2 80%$", ag1, zg1, dg1, 3, wg1);
2509 //  AliMixture( 23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
2510 //  AliMixture( 24, "ArCO2 GAS$", agas, zgas, dgas, 3, wgas);
2511 //  AliMaterial(31, "COPPER$",   63.54,    29.,   8.96,  1.4, 0.);
2512 //  AliMixture( 32, "Vetronite$",aglass, zglass, dglass,    5, wglass);
2513 //  AliMaterial(33, "Carbon$",   12.01,     6.,  2.265, 18.8, 49.9);
2514 //  AliMixture( 34, "Rohacell$", arohac, zrohac, drohac,   -4, wrohac); 
2515
2516 //  AliMedium( 1, "AIR_CH_US         ",  15, 1, iSXFLD, ...
2517 //  AliMedium( 4, "ALU_CH_US          ",  9, 0, iSXFLD, ... 
2518 //  AliMedium( 5, "ALU_CH_US          ", 10, 0, iSXFLD, ... 
2519 //  AliMedium( 6, "AR_CH_US          ",  20, 1, iSXFLD, ... 
2520 //  AliMedium( 7, "GAS_CH_TRIGGER    ",  21, 1, iSXFLD, ... 
2521 //  AliMedium( 8, "BAKE_CH_TRIGGER   ",  19, 0, iSXFLD, ... 
2522 //  AliMedium( 9, "ARG_CO2   ",          22, 1, iSXFLD, ... 
2523 //  AliMedium(11, "PCB_COPPER        ",  31, 0, iSXFLD, ... 
2524 //  AliMedium(12, "VETRONITE         ",  32, 0, iSXFLD, ... 
2525 //  AliMedium(13, "CARBON            ",  33, 0, iSXFLD, ... 
2526 //  AliMedium(14, "Rohacell          ",  34, 0, iSXFLD, ... 
2527 //  AliMedium(24, "FrameCH$          ",  44, 1, iSXFLD, ...
2528
2529   //
2530   // --- Define materials for GEANT ---
2531   //
2532
2533   fMUON->AliMaterial(41, "Aluminium II$", 26.98, 13., 2.7, -8.9, 26.1);
2534        // was id: 9
2535        // from PDG and "The Particle Detector BriefBook", Bock and Vasilescu, P.18  
2536         // ??? same but the last but one argument < 0 
2537   //
2538   // --- Define mixtures for GEANT ---
2539   //
2540
2541  //  //     Ar-CO2 gas II (80%+20%)   
2542 //   Float_t ag1[2]   = { 39.95,  44.01};
2543 //   Float_t zg1[2]   = { 18., 22.};
2544 //   Float_t wg1[2]   = { .8, 0.2};
2545 //   Float_t dg1      = .001821;
2546 //   fMUON->AliMixture(45, "ArCO2 II 80%$", ag1, zg1, dg1, 2, wg1);  
2547 //             // was id: 22
2548 //             // use wg1 weighting factors (6th arg > 0)
2549
2550   // Rohacell 51  II - imide methacrylique
2551   Float_t aRohacell51[4] = { 12.01, 1.01, 16.00, 14.01}; 
2552   Float_t zRohacell51[4] = { 6., 1., 8., 7.}; 
2553   Float_t wRohacell51[4] = { 9., 13., 2., 1.};  
2554   Float_t dRohacell51 = 0.052;
2555   fMUON->AliMixture(46, "FOAM$",aRohacell51,zRohacell51,dRohacell51,-4,wRohacell51);  
2556             // was id: 32
2557             // use relative A (molecular) values (6th arg < 0)
2558    
2559   Float_t aSnPb[2] = { 118.69, 207.19};
2560   Float_t zSnPb[2] = { 50, 82};
2561   Float_t wSnPb[2] = { 0.6, 0.4} ;
2562   Float_t dSnPb = 8.926;
2563   fMUON->AliMixture(47, "SnPb$", aSnPb,zSnPb,dSnPb,2,wSnPb);
2564             // was id: 35
2565             // use wSnPb weighting factors (6th arg > 0)
2566
2567   // plastic definition from K5, Freiburg (found on web)
2568   Float_t aPlastic[2]={ 1.01, 12.01};
2569   Float_t zPlastic[2]={ 1, 6};
2570   Float_t wPlastic[2]={ 1, 1};
2571   Float_t denPlastic=1.107;
2572   fMUON->AliMixture(48, "Plastic$",aPlastic,zPlastic,denPlastic,-2,wPlastic);
2573             // was id: 33
2574             // use relative A (molecular) values (6th arg < 0)...no other info...
2575  
2576   // Not used, to be removed
2577   //
2578        // was id: 34
2579
2580   // Inox/Stainless Steel (18%Cr, 9%Ni)
2581   Float_t aInox[3] = {55.847, 51.9961, 58.6934};  
2582   Float_t zInox[3] = {26., 24., 28.};
2583   Float_t wInox[3] = {0.73, 0.18, 0.09}; 
2584   Float_t denInox = 7.930;
2585   fMUON->AliMixture(50, "StainlessSteel$",aInox,zInox,denInox,3,wInox);   
2586             // was id: 37
2587             // use wInox weighting factors (6th arg > 0) 
2588             // from CERN note NUFACT Note023, Oct.2000 
2589   //
2590   // End - Not used, to be removed
2591
2592   //
2593   // --- Define the tracking medias for GEANT ---
2594   // 
2595
2596   GReal_t epsil  = .001;       // Tracking precision,
2597   //GReal_t stemax = -1.;        // Maximum displacement for multiple scat
2598   GReal_t tmaxfd = -20.;       // Maximum angle due to field deflection
2599   //GReal_t deemax = -.3;        // Maximum fractional energy loss, DLS
2600   GReal_t stmin  = -.8;
2601   GReal_t maxStepAlu   = fMUON->GetMaxStepAlu();
2602   GReal_t maxDestepAlu = fMUON->GetMaxDestepAlu();
2603   // GReal_t maxStepGas   = fMUON->GetMaxStepGas();
2604   Int_t iSXFLD   = gAlice->Field()->PrecInteg();
2605   Float_t sXMGMX = gAlice->Field()->Max();
2606
2607   fMUON->AliMedium(21, "ALU_II$",    41, 0, iSXFLD, sXMGMX, 
2608                    tmaxfd, maxStepAlu, maxDestepAlu, epsil, stmin);
2609
2610                    // was med: 20  mat: 36
2611  //  fMUON->AliMedium(25, "ARG_CO2_II", 45, 1, iSXFLD, sXMGMX,
2612 //                    tmaxfd, maxStepGas, maxDestepAlu, epsil, stmin);
2613 //                 // was med: 9   mat: 22
2614   fMUON->AliMedium(26, "FOAM_CH$",   46, 0, iSXFLD, sXMGMX,
2615                    10.0,  0.1, 0.1, 0.1, 0.1, 0, 0) ;
2616                    // was med: 16  mat: 32
2617   fMUON->AliMedium(27, "SnPb$",      47, 0, iSXFLD, sXMGMX,  
2618                    10.0, 0.01, 1.0, 0.003, 0.003);
2619                    // was med: 19  mat: 35
2620   fMUON->AliMedium(28, "Plastic$",   48, 0, iSXFLD, sXMGMX,
2621                    10.0, 0.01, 1.0, 0.003, 0.003);
2622                    // was med: 17  mat: 33
2623
2624   // Not used, to be romoved
2625   //
2626
2627   fMUON->AliMedium(30, "InoxBolts$", 50, 1, iSXFLD, sXMGMX, 
2628                    10.0, 0.01, 1.0, 0.003, 0.003);
2629                    // was med: 21  mat: 37
2630   //
2631   // End - Not used, to be removed
2632 }
2633
2634 //______________________________________________________________________________
2635 void AliMUONSt1GeometryBuilderV2::CreateGeometry()
2636 {
2637 /// Create the detailed GEANT geometry for the dimuon arm station1
2638
2639   AliDebug(1,"Called");
2640
2641   // Define chamber volumes as virtual
2642   // 
2643
2644   // Create basic volumes
2645   // 
2646   CreateHole();
2647   CreateDaughterBoard();
2648   CreateInnerLayers();
2649   // CreateSpacer0();
2650   CreateSpacer();
2651   
2652   // Create reflexion matrices
2653   //
2654 /*
2655   Int_t reflXZ, reflYZ, reflXY;
2656   fMUON->AliMatrix(reflXZ,  90.,  180., 90., 90., 180., 0.);
2657   fMUON->AliMatrix(reflYZ,  90., 0., 90.,-90., 180., 0.);
2658   fMUON->AliMatrix(reflXY,  90., 180., 90., 270., 0., 0.);
2659 */
2660   // Define transformations for each quadrant
2661   // In old coordinate system:        In new coordinate system:
2662   // 
2663   // 
2664   //     II. |  I.                   I. |  II. 
2665   //         |                    (101) | (100)
2666   //   _____ | ____               _____ | ____                         
2667   //         |                          |
2668   //    III. |  IV.                 IV. | III.
2669   //                              (102) | (103) 
2670   // 
2671 /*
2672   Int_t rotm[4];
2673   rotm[0]=0;       // quadrant I
2674   rotm[1]=reflXZ;  // quadrant II
2675   rotm[2]=reflXY;  // quadrant III
2676   rotm[3]=reflYZ;  // quadrant IV
2677 */
2678   TGeoRotation rotm[4]; 
2679   rotm[0] = TGeoRotation("identity");
2680   rotm[1] = TGeoRotation("reflXZ", 90.,  180., 90., 90., 180., 0.);
2681   rotm[2] = TGeoRotation("reflXY", 90., 180., 90., 270., 0., 0.);
2682   rotm[3] = TGeoRotation("reflYZ", 90., 0., 90.,-90., 180., 0.);
2683   
2684   TVector3 scale[4];  
2685   scale[0] = TVector3( 1,  1,  1);  // quadrant I
2686   scale[1] = TVector3(-1,  1, -1);  // quadrant II
2687   scale[2] = TVector3(-1, -1,  1);  // quadrant III
2688   scale[3] = TVector3( 1, -1, -1);  // quadrant IV
2689   
2690   Int_t  detElemId[4];  
2691   detElemId[0] =  1;  // quadrant I
2692   detElemId[1] =  0;  // quadrant II
2693   detElemId[2] =  3;  // quadrant III
2694   detElemId[3] =  2;  // quadrant IV
2695   
2696   // Shift in Z of the middle layer
2697   Double_t deltaZ = 7.5/2.;         
2698
2699   // Position of quadrant I wrt to the chamber position
2700   // TVector3 pos0(-fgkDeltaQuadLHC, -fgkDeltaQuadLHC, deltaZ);
2701
2702   // Shift for near/far layers
2703   GReal_t  shiftXY = fgkFrameOffset;
2704   GReal_t  shiftZ  = fgkMotherThick1+fgkMotherThick2;
2705
2706   // Build two chambers
2707   //
2708   for (Int_t ich=1; ich<3; ich++) {
2709
2710     // Create quadrant volume
2711     CreateQuadrant(ich);
2712
2713     // Place gas volumes
2714     PlaceInnerLayers(ich);
2715     
2716     // Place the quadrant
2717     for (Int_t i=0; i<4; i++) {
2718
2719       // DE envelope
2720       GReal_t posx0, posy0, posz0;
2721       posx0 = fgkPadXOffsetBP * scale[i].X();
2722       posy0 = fgkPadYOffsetBP * scale[i].Y();;
2723       posz0 = deltaZ * scale[i].Z();
2724       GetEnvelopes(ich-1)
2725         ->AddEnvelope(QuadrantEnvelopeName(ich,i), detElemId[i] + ich*100, true,
2726                       TGeoTranslation(posx0, posy0, posz0), rotm[i]);
2727
2728       // Middle layer
2729       GReal_t posx, posy, posz;
2730       posx = -fgkDeltaQuadLHC - fgkPadXOffsetBP;
2731       posy = -fgkDeltaQuadLHC - fgkPadYOffsetBP;
2732       posz = 0.;
2733       GetEnvelopes(ich-1)
2734         ->AddEnvelopeConstituent(QuadrantMLayerName(ich), QuadrantEnvelopeName(ich,i),
2735                      i+1, TGeoTranslation(posx, posy, posz));
2736
2737       // Near/far layers
2738       GReal_t  posx2 = posx + shiftXY;;
2739       GReal_t  posy2 = posy + shiftXY;;
2740       GReal_t  posz2 = posz - shiftZ;;
2741       //gMC->Gspos(QuadrantNLayerName(ich), i+1, "ALIC", posx2, posy2, posz2, rotm[i],"ONLY");
2742       GetEnvelopes(ich-1)
2743         ->AddEnvelopeConstituent(QuadrantNLayerName(ich), QuadrantEnvelopeName(ich,i),
2744                      i+1, TGeoTranslation(posx2, posy2, posz2)); 
2745     
2746       posz2 = posz + shiftZ;      
2747       //gMC->Gspos(QuadrantFLayerName(ich), i+1, "ALIC", posx2, posy2, posz2, rotm[i],"ONLY");
2748       GetEnvelopes(ich-1)
2749         ->AddEnvelopeConstituent(QuadrantFLayerName(ich), QuadrantEnvelopeName(ich,i), 
2750                      i+1, TGeoTranslation(posx2, posy2, posz2)); 
2751     
2752       // Place spacer in global coordinates in the first non rotated quadrant
2753       // if ( detElemId[i] == 0 ) PlaceSpacer0(ich);
2754                // !! This placement should be used only to find out the right mother volume
2755                // for the spacer if geometry is changed and the plane segment volumes
2756                // will change their numbering
2757                // The call to the method CreateSpacer0(); above haa to be uncommented, too
2758    }
2759  }     
2760 }
2761
2762 //______________________________________________________________________________
2763 void AliMUONSt1GeometryBuilderV2::SetTransformations() 
2764 {
2765 /// Define the transformations for the station2 chambers.
2766
2767   if (gAlice->GetModule("SHIL")) {
2768     SetMotherVolume(0, "YOUT1");
2769     SetMotherVolume(1, "YOUT1");
2770   }  
2771
2772   SetVolume(0, "SC01", true);
2773   SetVolume(1, "SC02", true);
2774
2775   Double_t zpos1 = - AliMUONConstants::DefaultChamberZ(0); 
2776   SetTranslation(0, TGeoTranslation(0., 0., zpos1));
2777
2778   Double_t zpos2 = - AliMUONConstants::DefaultChamberZ(1); 
2779   SetTranslation(1, TGeoTranslation(0., 0., zpos2));
2780 }
2781
2782 //______________________________________________________________________________
2783 void AliMUONSt1GeometryBuilderV2::SetSensitiveVolumes()
2784 {
2785 /// Define the sensitive volumes for station2 chambers.
2786
2787   GetGeometry(0)->SetSensitiveVolume("SA1G");
2788   GetGeometry(0)->SetSensitiveVolume("SB1G");
2789   GetGeometry(0)->SetSensitiveVolume("SC1G");
2790   GetGeometry(0)->SetSensitiveVolume("SD1G");
2791   GetGeometry(0)->SetSensitiveVolume("SE1G");
2792   GetGeometry(0)->SetSensitiveVolume("SF1G");
2793   GetGeometry(0)->SetSensitiveVolume("SG1G");
2794   GetGeometry(0)->SetSensitiveVolume("SH1G");
2795   GetGeometry(0)->SetSensitiveVolume("SI1G");
2796   GetGeometry(0)->SetSensitiveVolume("SJ1G");
2797   GetGeometry(0)->SetSensitiveVolume("SK1G");
2798     
2799   GetGeometry(1)->SetSensitiveVolume("SA2G");
2800   GetGeometry(1)->SetSensitiveVolume("SB2G");
2801   GetGeometry(1)->SetSensitiveVolume("SC2G");
2802   GetGeometry(1)->SetSensitiveVolume("SD2G");
2803   GetGeometry(1)->SetSensitiveVolume("SE2G");
2804   GetGeometry(1)->SetSensitiveVolume("SF2G");
2805   GetGeometry(1)->SetSensitiveVolume("SG2G");
2806   GetGeometry(1)->SetSensitiveVolume("SH2G");
2807   GetGeometry(1)->SetSensitiveVolume("SI2G");
2808   GetGeometry(1)->SetSensitiveVolume("SJ2G");
2809   GetGeometry(1)->SetSensitiveVolume("SK2G");
2810 }
2811