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