8cca7a4cba5b33dbea9c4b00fa1e520144288a90
[u/mrichter/AliRoot.git] / MUON / AliMUONvTemp.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 purpeateose. It is      *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 */
19
20 /////////////////////////////////////////////////////////
21 //  Manager and hits classes for set:MUON version 0    //
22 /////////////////////////////////////////////////////////
23
24 #include <TLorentzVector.h> 
25 #include "AliMUONvTemp.h"
26 #include "AliRun.h"
27 #include "AliMC.h"
28 #include "AliMUONChamber.h"
29 #include "AliMUONResponseV0.h"
30 #include "AliMUONResponseTrigger.h"
31 #include "AliMUONSegmentationV0.h"
32 #include "AliMUONSegmentationV01.h"
33 #include "AliMUONSegmentationV02.h"
34 #include "AliMUONSegmentationV04.h"
35 #include "AliMUONSegmentationV05.h"
36 #include "AliMUONSegmentationSlat.h"
37 #include "AliMUONSegmentationSlatN.h"
38 #include "AliMUONSegmentationTrigger.h"
39 #include "AliMUONSegmentationTriggerX.h"
40 #include "AliMUONSegmentationTriggerY.h"
41 #include "AliMUONConstants.h"
42
43 ClassImp(AliMUONvTemp)
44 AliMUONvTemp::AliMUONvTemp(const char *name, const char *title)
45        : AliMUONv1(name,title)
46 {
47
48     SetIshunt(1);
49     SetMaxStepGas(0.1);
50     SetMaxStepAlu(0.1);
51 //
52 // Version 0
53 //
54 // First define the number of planes that are segmented (1 or 2) by a call
55 // to SetNsec. 
56 // Then chose for each chamber (chamber plane) the segmentation 
57 // and response model.
58 // They should be equal for the two chambers of each station. In a future
59 // version this will be enforced.
60 //
61 //  
62     Int_t chamber;
63     // Default response: 5 mm of gas
64     AliMUONResponseV0* response0 = new AliMUONResponseV0;
65     response0->SetSqrtKx3AndDeriveKx2Kx4(0.7131); // sqrt(0.5085)
66     response0->SetSqrtKy3AndDeriveKy2Ky4(0.7642); // sqrt(0.5840)
67     response0->SetPitch(0.25); // anode-cathode distance
68     response0->SetSigmaIntegration(10.);
69     response0->SetChargeSlope(50);
70     response0->SetChargeSpread(0.18, 0.18);
71     response0->SetMaxAdc(4096);
72     response0->SetZeroSuppression(6);
73     
74     // Response for 4 mm of gas (station 1)
75     // automatic consistency with width of sensitive medium in CreateGeometry ????
76     AliMUONResponseV0* responseSt1 = new AliMUONResponseV0;
77     // Mathieson parameters from L.Kharmandarian's thesis, page 190
78     responseSt1->SetSqrtKx3AndDeriveKx2Kx4(0.7000); // sqrt(0.4900)
79     responseSt1->SetSqrtKy3AndDeriveKy2Ky4(0.7550); // sqrt(0.5700)
80     responseSt1->SetPitch(0.20); // anode-cathode distance
81     responseSt1->SetSigmaIntegration(10.);
82     // ChargeSlope larger to compensate for the smaller anode-cathode distance
83     // and keep the same most probable ADC channel for mip's
84     responseSt1->SetChargeSlope(62.5); 
85     // assumed proportionality to anode-cathode distance for ChargeSpread
86     responseSt1->SetChargeSpread(0.144, 0.144);
87     responseSt1->SetMaxAdc(4096);
88     responseSt1->SetZeroSuppression(6);
89     
90 //--------------------------------------------------------
91 // Configuration for Chamber TC1/2  (Station 1) ----------           
92 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93     Float_t rseg1[4]={17.5, 55.2, 71.3, 95.5};
94     Int_t   nseg1[4]={4, 4, 2, 1};
95 //
96     chamber=1;
97 //^^^^^^^^^
98     SetNsec(chamber-1,2);
99 //
100     AliMUONSegmentationV01 *seg11=new AliMUONSegmentationV01(4);
101     
102     seg11->SetSegRadii(rseg1);
103     seg11->SetPadSize(2.4, 0.4); // smaller pad size
104     seg11->SetDAnod(0.20); // smaller distance between anode wires
105     seg11->SetPadDivision(nseg1);
106     
107     SetSegmentationModel(chamber-1, 1, seg11);
108 //
109     AliMUONSegmentationV02 *seg12=new AliMUONSegmentationV02(4);
110     seg12->SetSegRadii(rseg1); 
111     seg12->SetPadSize(0.6, 1.6); // smaller pad size
112     seg12->SetDAnod(0.20); // smaller distance between anode wires
113     seg12->SetPadDivision(nseg1);
114
115     SetSegmentationModel(chamber-1, 2, seg12);
116
117     SetResponseModel(chamber-1, responseSt1); // special response           
118     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
119     
120     chamber=2;
121 //^^^^^^^^^
122 //
123     SetNsec(chamber-1,2);
124 //
125     AliMUONSegmentationV01 *seg21=new AliMUONSegmentationV01(4);
126     seg21->SetSegRadii(rseg1);
127     seg21->SetPadSize(2.4, 0.4); // smaller pad size
128     seg21->SetDAnod(0.20); // smaller distance between anode wires
129     seg21->SetPadDivision(nseg1);
130     SetSegmentationModel(chamber-1, 1, seg21);
131 //
132     AliMUONSegmentationV02 *seg22=new AliMUONSegmentationV02(4);
133     seg22->SetSegRadii(rseg1); 
134     seg22->SetPadSize(0.6, 1.6); // smaller pad size
135     seg22->SetDAnod(0.20); // smaller distance between anode wires
136     seg22->SetPadDivision(nseg1);
137     SetSegmentationModel(chamber-1, 2, seg22);
138     
139     SetResponseModel(chamber-1, responseSt1); // special response
140     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
141             
142 //
143 //--------------------------------------------------------
144 // Configuration for Chamber TC3/4 (Station 2) -----------
145 ///^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146     Float_t rseg2[4]={23.5, 47.1, 87.7, 122.5};
147     Int_t   nseg2[4]={4, 4, 2, 1};
148 //
149     chamber=3;
150 //^^^^^^^^^
151     SetNsec(chamber-1,2);
152 //
153     AliMUONSegmentationV01 *seg31=new AliMUONSegmentationV01(4);
154     seg31->SetSegRadii(rseg2);
155     seg31->SetPadSize(3.0, 0.5);
156     seg31->SetDAnod(3.0/3./4);
157     seg31->SetPadDivision(nseg2);
158     SetSegmentationModel(chamber-1, 1, seg31);
159 //
160     AliMUONSegmentationV02 *seg32=new AliMUONSegmentationV02(4);
161     seg32->SetSegRadii(rseg2); 
162     seg32->SetPadSize(0.75, 2.0);
163     seg32->SetPadDivision(nseg2);
164     seg32->SetDAnod(3.0/3./4);
165     
166     SetSegmentationModel(chamber-1, 2, seg32);
167     
168     SetResponseModel(chamber-1, response0);         
169     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
170     
171     chamber=4;
172 //^^^^^^^^^
173 //
174     SetNsec(chamber-1,2);
175 //
176     AliMUONSegmentationV01 *seg41=new AliMUONSegmentationV01(4);
177     seg41->SetSegRadii(rseg2);
178     seg41->SetPadSize(3.0, 0.5);
179     seg41->SetDAnod(3.0/3./4);
180     seg41->SetPadDivision(nseg2);
181     SetSegmentationModel(chamber-1, 1, seg41);
182 //
183     AliMUONSegmentationV02 *seg42=new AliMUONSegmentationV02(4);
184     seg42->SetSegRadii(rseg2); 
185     seg42->SetPadSize(0.75, 2.0);
186     seg42->SetPadDivision(nseg2);
187     seg42->SetDAnod(3.0/3./4);
188     
189     SetSegmentationModel(chamber-1, 2, seg42);
190     
191     SetResponseModel(chamber-1, response0);         
192     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
193     
194     
195 //--------------------------------------------------------
196 // Configuration for Chamber TC5/6  (Station 3) ----------          
197 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
198     Int_t   nseg3[3]={4, 4, 2};
199     Int_t   npcb5[28] = {0,0,1,0,
200                          0,1,1,0,
201                          0,2,1,0,
202                          0,1,1,0, 
203                          0,2,1,0, 
204                          0,1,1,0, 
205                          0,0,1,0};
206     
207     Float_t shift = 1.5/2.;
208     Float_t xpos5[7]    = {2., 2., 2., 34., 2., 2., 2.};
209     Float_t ypos5       = -(20.+3.*(40.-2.*shift));
210
211     chamber=5;
212     SetNsec(chamber-1,2);
213     AliMUONSegmentationSlat *seg51=new AliMUONSegmentationSlat(4);
214     seg51->SetNSlats(7); 
215     seg51->SetShift(shift);  
216     seg51->SetNPCBperSector(npcb5); 
217     seg51->SetSlatXPositions(xpos5);
218     seg51->SetSlatYPosition(ypos5);
219     seg51->SetPadSize(10.,0.5);
220     seg51->SetDAnod(0.25);
221     seg51->SetPadDivision(nseg3);
222     SetSegmentationModel(chamber-1, 1, seg51);
223     
224     AliMUONSegmentationSlatN *seg52=new AliMUONSegmentationSlatN(4);
225     seg52->SetNSlats(7); 
226     seg52->SetShift(shift);  
227     seg52->SetNPCBperSector(npcb5); 
228     seg52->SetSlatXPositions(xpos5);
229     seg52->SetSlatYPosition(ypos5);
230     seg52->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
231     seg52->SetDAnod(0.25);
232     seg52->SetPadDivision(nseg3);
233     SetSegmentationModel(chamber-1, 2, seg52);
234     SetResponseModel(chamber-1, response0);         
235     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
236     
237     chamber=6;
238     SetNsec(chamber-1,2);
239     AliMUONSegmentationSlat *seg61=new AliMUONSegmentationSlat(4);
240     seg61->SetNSlats(7); 
241     seg61->SetShift(shift);  
242     seg61->SetNPCBperSector(npcb5); 
243     seg61->SetSlatXPositions(xpos5);
244     seg61->SetSlatYPosition(ypos5);
245     seg61->SetPadSize(10.,0.5);
246     seg61->SetDAnod(0.25);
247     seg61->SetPadDivision(nseg3);
248     SetSegmentationModel(chamber-1, 1, seg61);
249     
250     AliMUONSegmentationSlatN *seg62=new AliMUONSegmentationSlatN(4);
251     seg62->SetNSlats(7); 
252     seg62->SetShift(shift);  
253     seg62->SetNPCBperSector(npcb5); 
254     seg62->SetSlatXPositions(xpos5);
255     seg62->SetSlatYPosition(ypos5);
256     seg62->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
257     seg62->SetDAnod(0.25);
258     seg62->SetPadDivision(nseg3);
259     SetSegmentationModel(chamber-1, 2, seg62);
260     SetResponseModel(chamber-1, response0);         
261     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
262     
263 //--------------------------------------------------------
264 // Configuration for Chamber TC7/8  (Station 4) ----------           
265 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
266     
267     Int_t   nseg4[4]={4, 4, 2, 1};
268     
269     chamber=7;
270 //^^^^^^^^^
271     
272     SetNsec(chamber-1,2);
273 //
274     AliMUONSegmentationSlat *seg71=new AliMUONSegmentationSlat(4);
275     Int_t npcb7[44] = {0,0,0,3,
276                        0,0,2,2,
277                        0,0,3,2,
278                        0,2,2,1,
279                        0,2,2,1,
280                        0,1,2,1, 
281                        0,2,2,1, 
282                        0,2,2,1, 
283                        0,0,3,2, 
284                        0,0,2,2, 
285                        0,0,0,3};
286     Float_t xpos7[11]   = {2., 2., 2., 2., 2., 39.5, 2., 2., 2., 2., 2.};
287     Float_t ypos7       = -(20.+5.*(40.-2.*shift));
288     
289     seg71->SetNSlats(11);  
290     seg71->SetShift(shift);  
291     seg71->SetNPCBperSector(npcb7); 
292     seg71->SetSlatXPositions(xpos7);
293     seg71->SetSlatYPosition(ypos7);
294     
295     seg71->SetPadSize(10.,0.5);
296     seg71->SetDAnod(0.25);
297     seg71->SetPadDivision(nseg4);
298     SetSegmentationModel(chamber-1, 1, seg71);
299     
300     AliMUONSegmentationSlatN *seg72=new AliMUONSegmentationSlatN(4);
301     
302     SetSegmentationModel(chamber-1, 2, seg72);
303     seg72->SetNSlats(11);  
304     seg72->SetShift(shift);   
305     seg72->SetNPCBperSector(npcb7); 
306     seg72->SetSlatXPositions(xpos7);
307     seg72->SetSlatYPosition(ypos7);
308     seg72->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
309     seg72->SetDAnod(0.25);
310     seg72->SetPadDivision(nseg4);
311     
312     SetResponseModel(chamber-1, response0);         
313     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
314     
315     chamber=8;
316 //^^^^^^^^^
317     SetNsec(chamber-1,2);
318 //
319     AliMUONSegmentationSlat *seg81=new AliMUONSegmentationSlat(4);
320     
321     seg81->SetNSlats(11);  
322     seg81->SetShift(shift);  
323     seg81->SetNPCBperSector(npcb7); 
324     seg81->SetSlatXPositions(xpos7);
325     seg81->SetSlatYPosition(ypos7);
326     seg81->SetPadSize(10.,0.5);
327     seg81->SetDAnod(0.25);
328     seg81->SetPadDivision(nseg4);
329     SetSegmentationModel(chamber-1, 1, seg81);
330
331     AliMUONSegmentationSlat *seg82=new AliMUONSegmentationSlatN(4);
332
333     SetSegmentationModel(chamber-1, 2, seg82);
334     seg82->SetNSlats(11);  
335     seg82->SetShift(shift);  
336     seg82->SetNPCBperSector(npcb7); 
337     seg82->SetSlatXPositions(xpos7);
338     seg82->SetSlatYPosition(ypos7);
339     seg82->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
340     seg82->SetDAnod(0.25);
341     seg82->SetPadDivision(nseg4);
342     
343     SetResponseModel(chamber-1, response0);         
344     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
345     
346
347 //--------------------------------------------------------
348 // Configuration for Chamber TC9/10  (Station 5) ---------           
349 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
350     chamber=9;
351 //^^^^^^^^^
352
353     SetNsec(chamber-1,2);
354 //
355     AliMUONSegmentationSlat *seg91=new AliMUONSegmentationSlat(4);
356     Int_t   npcb9[52] = {0,0,0,3,
357                          0,0,0,4,
358                          0,0,2,3,
359                          0,0,3,3,
360                          0,2,2,2,
361                          0,2,2,2,
362                          0,1,2,2, 
363                          0,2,2,2, 
364                          0,2,2,2, 
365                          0,0,3,3, 
366                          0,0,2,3, 
367                          0,0,0,4, 
368                          0,0,0,3};   
369     Float_t xpos9[13]   = {2., 2., 2., 2., 2., 2., 39.5, 2., 2., 2., 2., 2., 2.};
370     Float_t ypos9       = -(20.+6.*(40.-2.*shift));
371     
372     seg91->SetNSlats(13);  
373     seg91->SetShift(shift);  
374     seg91->SetNPCBperSector(npcb9); 
375     seg91->SetSlatXPositions(xpos9);
376     seg91->SetSlatYPosition(ypos9);
377     seg91->SetPadSize(10.,0.5);
378     seg91->SetDAnod(0.25);
379     seg91->SetPadDivision(nseg4);
380     SetSegmentationModel(chamber-1, 1, seg91);
381     
382     AliMUONSegmentationSlatN *seg92=new AliMUONSegmentationSlatN(4);
383     
384     SetSegmentationModel(chamber-1, 2, seg92);
385     seg92->SetNSlats(13);  
386     seg92->SetShift(shift);   
387     seg92->SetNPCBperSector(npcb9); 
388     seg92->SetSlatXPositions(xpos9);
389     seg92->SetSlatYPosition(ypos9);
390     seg92->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
391     seg92->SetDAnod(0.25);
392     seg92->SetPadDivision(nseg4);
393     
394     SetResponseModel(chamber-1, response0);         
395     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
396     
397     chamber=10;
398 //^^^^^^^^^
399     SetNsec(chamber-1,2);
400 //
401     AliMUONSegmentationSlat *seg101=new AliMUONSegmentationSlat(4);
402     
403     seg101->SetNSlats(13);  
404     seg101->SetShift(shift);  
405     seg101->SetNPCBperSector(npcb9); 
406     seg101->SetSlatXPositions(xpos9);
407     seg101->SetSlatYPosition(ypos9);
408     seg101->SetPadSize(10.,0.5);
409     seg101->SetDAnod(0.25);
410     seg101->SetPadDivision(nseg4);
411     SetSegmentationModel(chamber-1, 1, seg101);
412     
413     AliMUONSegmentationSlatN *seg102=new AliMUONSegmentationSlatN(4);
414     
415     SetSegmentationModel(chamber-1, 2, seg102);
416     seg102->SetNSlats(13);  
417     seg102->SetShift(shift);   
418     seg102->SetNPCBperSector(npcb9); 
419     seg102->SetSlatXPositions(xpos9);
420     seg102->SetSlatYPosition(ypos9);
421     seg102->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
422     seg102->SetDAnod(0.25);
423     seg102->SetPadDivision(nseg4);
424     
425     SetResponseModel(chamber-1, response0);         
426     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
427     
428 //--------------------------------------------------------
429 // Configuration for Trigger Stations -------------------- 
430 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
431 // Cluster-size off
432     AliMUONResponseTrigger* responseTrigger0 =  new AliMUONResponseTrigger;
433 // Cluster-size on  
434 // AliMUONResponseTriggerV1* responseTrigger0 =  new AliMUONResponseTriggerV1;
435     
436     chamber=11;
437     SetNsec(chamber-1,2);
438     AliMUONSegmentationTriggerX *seg111=new AliMUONSegmentationTriggerX;
439     SetSegmentationModel(chamber-1, 1, seg111);
440     AliMUONSegmentationTriggerY *seg112=new AliMUONSegmentationTriggerY;
441     SetSegmentationModel(chamber-1, 2, seg112);
442     
443     SetResponseModel(chamber-1, responseTrigger0);      
444     Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
445     
446  
447     chamber=12;
448     SetNsec(chamber-1,2);
449     AliMUONSegmentationTriggerX *seg121=new AliMUONSegmentationTriggerX;
450     SetSegmentationModel(chamber-1, 1, seg121);
451     AliMUONSegmentationTriggerY *seg122=new AliMUONSegmentationTriggerY;
452     SetSegmentationModel(chamber-1, 2, seg122);
453     
454     SetResponseModel(chamber-1, responseTrigger0);
455     Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
456     
457     chamber=13;
458     SetNsec(chamber-1,2);
459     AliMUONSegmentationTriggerX *seg131=new AliMUONSegmentationTriggerX;
460     SetSegmentationModel(chamber-1, 1, seg131);
461     AliMUONSegmentationTriggerY *seg132=new AliMUONSegmentationTriggerY;
462     SetSegmentationModel(chamber-1, 2, seg132);
463     SetResponseModel(chamber-1, responseTrigger0);      
464     Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
465     
466     chamber=14;
467     SetNsec(chamber-1,2);
468     AliMUONSegmentationTriggerX *seg141=new AliMUONSegmentationTriggerX;
469     SetSegmentationModel(chamber-1, 1, seg141);
470     AliMUONSegmentationTriggerY *seg142=new AliMUONSegmentationTriggerY;
471     SetSegmentationModel(chamber-1, 2, seg142);
472     
473     SetResponseModel(chamber-1, responseTrigger0); 
474     Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
475     
476 }
477 //___________________________________________
478 void AliMUONvTemp::CreateGeometry()
479 {
480 //
481 //   Note: all chambers have the same structure, which could be 
482 //   easily parameterised. This was intentionally not done in order
483 //   to give a starting point for the implementation of the actual 
484 //   design of each station. 
485   Int_t *idtmed = fIdtmed->GetArray()-1099;
486
487 //   Distance between Stations
488 //
489      Float_t bpar[3];
490      Float_t tpar[3];
491 //      Float_t pgpar[10];
492      Float_t zpos1, zpos2, zfpos;
493      // Outer excess and inner recess for mother volume radius
494      // with respect to ROuter and RInner
495      Float_t dframep=.001; // Value for station 3 should be 6 ...
496      // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
497 //      Float_t dframep1=.001;
498      Float_t dframep1 = 11.0;
499 //      Bool_t frameCrosses=kFALSE;     
500      Bool_t frameCrosses=kTRUE;     
501      
502 //      Float_t dframez=0.9;
503      // Half of the total thickness of frame crosses (including DAlu)
504      // for each chamber in stations 1 and 2:
505      // 3% of X0 of composite material,
506      // but taken as Aluminium here, with same thickness in number of X0
507      Float_t dframez = 3. * 8.9 / 100;
508 //      Float_t dr;
509      Float_t dstation;
510
511 //
512 //   Rotation matrices in the x-y plane  
513      Int_t idrotm[1199];
514 //   phi=   0 deg
515      AliMatrix(idrotm[1100],  90.,   0., 90.,  90., 0., 0.);
516 //   phi=  90 deg
517      AliMatrix(idrotm[1101],  90.,  90., 90., 180., 0., 0.);
518 //   phi= 180 deg
519      AliMatrix(idrotm[1102],  90., 180., 90., 270., 0., 0.);
520 //   phi= 270 deg
521      AliMatrix(idrotm[1103],  90., 270., 90.,   0., 0., 0.);
522 //
523      Float_t phi=2*TMath::Pi()/12/2;
524
525 //
526 //   pointer to the current chamber
527 //   pointer to the current chamber
528      Int_t idAlu1=idtmed[1103]; // medium 4
529      Int_t idAlu2=idtmed[1104]; // medium 5
530 //     Int_t idAlu1=idtmed[1100];
531 //     Int_t idAlu2=idtmed[1100];
532      Int_t idAir=idtmed[1100]; // medium 1
533 //      Int_t idGas=idtmed[1105]; // medium 6 = Ar-isoC4H10 gas
534      Int_t idGas=idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
535      
536
537      AliMUONChamber *iChamber, *iChamber1, *iChamber2;
538      Int_t stations[5] = {1, 1, 1, 1, 1};
539      
540      if (stations[0]) {
541          
542 //********************************************************************
543 //                            Station 1                             **
544 //********************************************************************
545 //  CONCENTRIC
546      // indices 1 and 2 for first and second chambers in the station
547      // iChamber (first chamber) kept for other quanties than Z,
548      // assumed to be the same in both chambers
549      iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[0];
550      iChamber2 =(AliMUONChamber*) (*fChambers)[1];
551      zpos1=iChamber1->Z(); 
552      zpos2=iChamber2->Z();
553      dstation = zpos2 - zpos1;
554      // DGas decreased from standard one (0.5)
555      iChamber->SetDGas(0.4); iChamber2->SetDGas(0.4);
556      // DAlu increased from standard one (3% of X0),
557      // because more electronics with smaller pads
558      iChamber->SetDAlu(3.5 * 8.9 / 100.); iChamber2->SetDAlu(3.5 * 8.9 / 100.);
559      zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
560      
561 //
562 //   Mother volume
563      tpar[0] = iChamber->RInner()-dframep; 
564      tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
565      tpar[2] = dstation/8;
566
567      gMC->Gsvolu("C01M", "TUBE", idAir, tpar, 3);
568      gMC->Gsvolu("C02M", "TUBE", idAir, tpar, 3);
569      gMC->Gspos("C01M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
570      gMC->Gspos("C02M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");     
571 // // Aluminium frames
572 // // Outer frames
573 //      pgpar[0] = 360/12/2;
574 //      pgpar[1] = 360.;
575 //      pgpar[2] = 12.;
576 //      pgpar[3] =   2;
577 //      pgpar[4] = -dframez/2;
578 //      pgpar[5] = iChamber->ROuter();
579 //      pgpar[6] = pgpar[5]+dframep1;
580 //      pgpar[7] = +dframez/2;
581 //      pgpar[8] = pgpar[5];
582 //      pgpar[9] = pgpar[6];
583 //      gMC->Gsvolu("C01O", "PGON", idAlu1, pgpar, 10);
584 //      gMC->Gsvolu("C02O", "PGON", idAlu1, pgpar, 10);
585 //      gMC->Gspos("C01O",1,"C01M", 0.,0.,-zfpos,  0,"ONLY");
586 //      gMC->Gspos("C01O",2,"C01M", 0.,0.,+zfpos,  0,"ONLY");
587 //      gMC->Gspos("C02O",1,"C02M", 0.,0.,-zfpos,  0,"ONLY");
588 //      gMC->Gspos("C02O",2,"C02M", 0.,0.,+zfpos,  0,"ONLY");
589 // //
590 // // Inner frame
591 //      tpar[0]= iChamber->RInner()-dframep1;
592 //      tpar[1]= iChamber->RInner();
593 //      tpar[2]= dframez/2;
594 //      gMC->Gsvolu("C01I", "TUBE", idAlu1, tpar, 3);
595 //      gMC->Gsvolu("C02I", "TUBE", idAlu1, tpar, 3);
596
597 //      gMC->Gspos("C01I",1,"C01M", 0.,0.,-zfpos,  0,"ONLY");
598 //      gMC->Gspos("C01I",2,"C01M", 0.,0.,+zfpos,  0,"ONLY");
599 //      gMC->Gspos("C02I",1,"C02M", 0.,0.,-zfpos,  0,"ONLY");
600 //      gMC->Gspos("C02I",2,"C02M", 0.,0.,+zfpos,  0,"ONLY");
601 //
602 // Frame Crosses
603      if (frameCrosses) {
604          // outside gas
605          // security for inside mother volume
606          bpar[0] = (iChamber->ROuter() - iChamber->RInner())
607            * TMath::Cos(TMath::ASin(dframep1 /
608                                    (iChamber->ROuter() - iChamber->RInner())))
609            / 2.0;
610          bpar[1] = dframep1/2;
611          // total thickness will be (4 * bpar[2]) for each chamber,
612          // which has to be equal to (2 * dframez) - DAlu
613          bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
614          gMC->Gsvolu("C01B", "BOX", idAlu1, bpar, 3);
615          gMC->Gsvolu("C02B", "BOX", idAlu1, bpar, 3);
616          
617          gMC->Gspos("C01B",1,"C01M", +iChamber->RInner()+bpar[0] , 0,-zfpos, 
618                     idrotm[1100],"ONLY");
619          gMC->Gspos("C01B",2,"C01M", -iChamber->RInner()-bpar[0] , 0,-zfpos, 
620                     idrotm[1100],"ONLY");
621          gMC->Gspos("C01B",3,"C01M", 0, +iChamber->RInner()+bpar[0] ,-zfpos, 
622                     idrotm[1101],"ONLY");
623          gMC->Gspos("C01B",4,"C01M", 0, -iChamber->RInner()-bpar[0] ,-zfpos, 
624                     idrotm[1101],"ONLY");
625          gMC->Gspos("C01B",5,"C01M", +iChamber->RInner()+bpar[0] , 0,+zfpos, 
626                     idrotm[1100],"ONLY");
627          gMC->Gspos("C01B",6,"C01M", -iChamber->RInner()-bpar[0] , 0,+zfpos, 
628                     idrotm[1100],"ONLY");
629          gMC->Gspos("C01B",7,"C01M", 0, +iChamber->RInner()+bpar[0] ,+zfpos, 
630                     idrotm[1101],"ONLY");
631          gMC->Gspos("C01B",8,"C01M", 0, -iChamber->RInner()-bpar[0] ,+zfpos, 
632                     idrotm[1101],"ONLY");
633          
634          gMC->Gspos("C02B",1,"C02M", +iChamber->RInner()+bpar[0] , 0,-zfpos, 
635                     idrotm[1100],"ONLY");
636          gMC->Gspos("C02B",2,"C02M", -iChamber->RInner()-bpar[0] , 0,-zfpos, 
637                     idrotm[1100],"ONLY");
638          gMC->Gspos("C02B",3,"C02M", 0, +iChamber->RInner()+bpar[0] ,-zfpos, 
639                     idrotm[1101],"ONLY");
640          gMC->Gspos("C02B",4,"C02M", 0, -iChamber->RInner()-bpar[0] ,-zfpos, 
641                     idrotm[1101],"ONLY");
642          gMC->Gspos("C02B",5,"C02M", +iChamber->RInner()+bpar[0] , 0,+zfpos, 
643                     idrotm[1100],"ONLY");
644          gMC->Gspos("C02B",6,"C02M", -iChamber->RInner()-bpar[0] , 0,+zfpos, 
645                     idrotm[1100],"ONLY");
646          gMC->Gspos("C02B",7,"C02M", 0, +iChamber->RInner()+bpar[0] ,+zfpos, 
647                     idrotm[1101],"ONLY");
648          gMC->Gspos("C02B",8,"C02M", 0, -iChamber->RInner()-bpar[0] ,+zfpos, 
649                     idrotm[1101],"ONLY");
650      }
651 //
652 //   Chamber Material represented by Alu sheet
653      tpar[0]= iChamber->RInner();
654      tpar[1]= iChamber->ROuter();
655      tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
656      gMC->Gsvolu("C01A", "TUBE",  idAlu2, tpar, 3);
657      gMC->Gsvolu("C02A", "TUBE",idAlu2, tpar, 3);
658      gMC->Gspos("C01A", 1, "C01M", 0., 0., 0.,  0, "ONLY");
659      gMC->Gspos("C02A", 1, "C02M", 0., 0., 0.,  0, "ONLY");
660 //     
661 //   Sensitive volumes
662      // tpar[2] = iChamber->DGas();
663      tpar[2] = iChamber->DGas()/2;
664      gMC->Gsvolu("C01G", "TUBE", idGas, tpar, 3);
665      gMC->Gsvolu("C02G", "TUBE", idGas, tpar, 3);
666      gMC->Gspos("C01G", 1, "C01A", 0., 0., 0.,  0, "ONLY");
667      gMC->Gspos("C02G", 1, "C02A", 0., 0., 0.,  0, "ONLY");
668 //
669 // Frame Crosses to be placed inside gas
670      // NONE: chambers are sensitive everywhere
671 //      if (frameCrosses) {
672
673 //       dr = (iChamber->ROuter() - iChamber->RInner());
674 //       bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
675 //       bpar[1] = dframep1/2;
676 //       bpar[2] = iChamber->DGas()/2;
677 //       gMC->Gsvolu("C01F", "BOX", idAlu1, bpar, 3);
678 //       gMC->Gsvolu("C02F", "BOX", idAlu1, bpar, 3);
679          
680 //       gMC->Gspos("C01F",1,"C01G", +iChamber->RInner()+bpar[0] , 0, 0, 
681 //                  idrotm[1100],"ONLY");
682 //       gMC->Gspos("C01F",2,"C01G", -iChamber->RInner()-bpar[0] , 0, 0, 
683 //                  idrotm[1100],"ONLY");
684 //       gMC->Gspos("C01F",3,"C01G", 0, +iChamber->RInner()+bpar[0] , 0, 
685 //                  idrotm[1101],"ONLY");
686 //       gMC->Gspos("C01F",4,"C01G", 0, -iChamber->RInner()-bpar[0] , 0, 
687 //                  idrotm[1101],"ONLY");
688          
689 //       gMC->Gspos("C02F",1,"C02G", +iChamber->RInner()+bpar[0] , 0, 0, 
690 //                  idrotm[1100],"ONLY");
691 //       gMC->Gspos("C02F",2,"C02G", -iChamber->RInner()-bpar[0] , 0, 0, 
692 //                  idrotm[1100],"ONLY");
693 //       gMC->Gspos("C02F",3,"C02G", 0, +iChamber->RInner()+bpar[0] , 0, 
694 //                  idrotm[1101],"ONLY");
695 //       gMC->Gspos("C02F",4,"C02G", 0, -iChamber->RInner()-bpar[0] , 0, 
696 //                  idrotm[1101],"ONLY");
697 //      }
698      }
699      if (stations[1]) {
700          
701 //********************************************************************
702 //                            Station 2                             **
703 //********************************************************************
704      // indices 1 and 2 for first and second chambers in the station
705      // iChamber (first chamber) kept for other quanties than Z,
706      // assumed to be the same in both chambers
707      iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[2];
708      iChamber2 =(AliMUONChamber*) (*fChambers)[3];
709      zpos1=iChamber1->Z(); 
710      zpos2=iChamber2->Z();
711      dstation = zpos2 - zpos1;
712      // DGas and DAlu not changed from standard values
713      zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
714      
715 //
716 //   Mother volume
717      tpar[0] = iChamber->RInner()-dframep; 
718      tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
719      tpar[2] = dstation/10;
720
721      gMC->Gsvolu("C03M", "TUBE", idAir, tpar, 3);
722      gMC->Gsvolu("C04M", "TUBE", idAir, tpar, 3);
723      gMC->Gspos("C03M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
724      gMC->Gspos("C04M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
725
726 // // Aluminium frames
727 // // Outer frames
728 //      pgpar[0] = 360/12/2;
729 //      pgpar[1] = 360.;
730 //      pgpar[2] = 12.;
731 //      pgpar[3] =   2;
732 //      pgpar[4] = -dframez/2;
733 //      pgpar[5] = iChamber->ROuter();
734 //      pgpar[6] = pgpar[5]+dframep;
735 //      pgpar[7] = +dframez/2;
736 //      pgpar[8] = pgpar[5];
737 //      pgpar[9] = pgpar[6];
738 //      gMC->Gsvolu("C03O", "PGON", idAlu1, pgpar, 10);
739 //      gMC->Gsvolu("C04O", "PGON", idAlu1, pgpar, 10);
740 //      gMC->Gspos("C03O",1,"C03M", 0.,0.,-zfpos,  0,"ONLY");
741 //      gMC->Gspos("C03O",2,"C03M", 0.,0.,+zfpos,  0,"ONLY");
742 //      gMC->Gspos("C04O",1,"C04M", 0.,0.,-zfpos,  0,"ONLY");
743 //      gMC->Gspos("C04O",2,"C04M", 0.,0.,+zfpos,  0,"ONLY");
744 // //
745 // // Inner frame
746 //      tpar[0]= iChamber->RInner()-dframep;
747 //      tpar[1]= iChamber->RInner();
748 //      tpar[2]= dframez/2;
749 //      gMC->Gsvolu("C03I", "TUBE", idAlu1, tpar, 3);
750 //      gMC->Gsvolu("C04I", "TUBE", idAlu1, tpar, 3);
751
752 //      gMC->Gspos("C03I",1,"C03M", 0.,0.,-zfpos,  0,"ONLY");
753 //      gMC->Gspos("C03I",2,"C03M", 0.,0.,+zfpos,  0,"ONLY");
754 //      gMC->Gspos("C04I",1,"C04M", 0.,0.,-zfpos,  0,"ONLY");
755 //      gMC->Gspos("C04I",2,"C04M", 0.,0.,+zfpos,  0,"ONLY");
756 //
757 // Frame Crosses
758      if (frameCrosses) {
759          // outside gas
760          // security for inside mother volume
761          bpar[0] = (iChamber->ROuter() - iChamber->RInner())
762            * TMath::Cos(TMath::ASin(dframep1 /
763                                    (iChamber->ROuter() - iChamber->RInner())))
764            / 2.0;
765          bpar[1] = dframep1/2;
766          // total thickness will be (4 * bpar[2]) for each chamber,
767          // which has to be equal to (2 * dframez) - DAlu
768          bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
769          gMC->Gsvolu("C03B", "BOX", idAlu1, bpar, 3);
770          gMC->Gsvolu("C04B", "BOX", idAlu1, bpar, 3);
771          
772          gMC->Gspos("C03B",1,"C03M", +iChamber->RInner()+bpar[0] , 0,-zfpos, 
773                     idrotm[1100],"ONLY");
774          gMC->Gspos("C03B",2,"C03M", -iChamber->RInner()-bpar[0] , 0,-zfpos, 
775                     idrotm[1100],"ONLY");
776          gMC->Gspos("C03B",3,"C03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos, 
777                     idrotm[1101],"ONLY");
778          gMC->Gspos("C03B",4,"C03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos, 
779                     idrotm[1101],"ONLY");
780          gMC->Gspos("C03B",5,"C03M", +iChamber->RInner()+bpar[0] , 0,+zfpos, 
781                     idrotm[1100],"ONLY");
782          gMC->Gspos("C03B",6,"C03M", -iChamber->RInner()-bpar[0] , 0,+zfpos, 
783                     idrotm[1100],"ONLY");
784          gMC->Gspos("C03B",7,"C03M", 0, +iChamber->RInner()+bpar[0] ,+zfpos, 
785                     idrotm[1101],"ONLY");
786          gMC->Gspos("C03B",8,"C03M", 0, -iChamber->RInner()-bpar[0] ,+zfpos, 
787                     idrotm[1101],"ONLY");
788          
789          gMC->Gspos("C04B",1,"C04M", +iChamber->RInner()+bpar[0] , 0,-zfpos, 
790                     idrotm[1100],"ONLY");
791          gMC->Gspos("C04B",2,"C04M", -iChamber->RInner()-bpar[0] , 0,-zfpos, 
792                     idrotm[1100],"ONLY");
793          gMC->Gspos("C04B",3,"C04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos, 
794                     idrotm[1101],"ONLY");
795          gMC->Gspos("C04B",4,"C04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos, 
796                     idrotm[1101],"ONLY");
797          gMC->Gspos("C04B",5,"C04M", +iChamber->RInner()+bpar[0] , 0,+zfpos, 
798                     idrotm[1100],"ONLY");
799          gMC->Gspos("C04B",6,"C04M", -iChamber->RInner()-bpar[0] , 0,+zfpos, 
800                     idrotm[1100],"ONLY");
801          gMC->Gspos("C04B",7,"C04M", 0, +iChamber->RInner()+bpar[0] ,+zfpos, 
802                     idrotm[1101],"ONLY");
803          gMC->Gspos("C04B",8,"C04M", 0, -iChamber->RInner()-bpar[0] ,+zfpos, 
804                     idrotm[1101],"ONLY");
805      }
806 //
807 //   Chamber Material represented by Alu sheet
808      tpar[0]= iChamber->RInner();
809      tpar[1]= iChamber->ROuter();
810      tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
811      gMC->Gsvolu("C03A", "TUBE", idAlu2, tpar, 3);
812      gMC->Gsvolu("C04A", "TUBE", idAlu2, tpar, 3);
813      gMC->Gspos("C03A", 1, "C03M", 0., 0., 0.,  0, "ONLY");
814      gMC->Gspos("C04A", 1, "C04M", 0., 0., 0.,  0, "ONLY");
815 //     
816 //   Sensitive volumes
817      // tpar[2] = iChamber->DGas();
818      tpar[2] = iChamber->DGas()/2;
819      gMC->Gsvolu("C03G", "TUBE", idGas, tpar, 3);
820      gMC->Gsvolu("C04G", "TUBE", idGas, tpar, 3);
821      gMC->Gspos("C03G", 1, "C03A", 0., 0., 0.,  0, "ONLY");
822      gMC->Gspos("C04G", 1, "C04A", 0., 0., 0.,  0, "ONLY");
823 //
824 // Frame Crosses to be placed inside gas 
825      // NONE: chambers are sensitive everywhere
826 //      if (frameCrosses) {
827
828 //       dr = (iChamber->ROuter() - iChamber->RInner());
829 //       bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
830 //       bpar[1] = dframep1/2;
831 //       bpar[2] = iChamber->DGas()/2;
832 //       gMC->Gsvolu("C03F", "BOX", idAlu1, bpar, 3);
833 //       gMC->Gsvolu("C04F", "BOX", idAlu1, bpar, 3);
834          
835 //       gMC->Gspos("C03F",1,"C03G", +iChamber->RInner()+bpar[0] , 0, 0, 
836 //                  idrotm[1100],"ONLY");
837 //       gMC->Gspos("C03F",2,"C03G", -iChamber->RInner()-bpar[0] , 0, 0, 
838 //                  idrotm[1100],"ONLY");
839 //       gMC->Gspos("C03F",3,"C03G", 0, +iChamber->RInner()+bpar[0] , 0, 
840 //                  idrotm[1101],"ONLY");
841 //       gMC->Gspos("C03F",4,"C03G", 0, -iChamber->RInner()-bpar[0] , 0, 
842 //                  idrotm[1101],"ONLY");
843          
844 //       gMC->Gspos("C04F",1,"C04G", +iChamber->RInner()+bpar[0] , 0, 0, 
845 //                  idrotm[1100],"ONLY");
846 //       gMC->Gspos("C04F",2,"C04G", -iChamber->RInner()-bpar[0] , 0, 0, 
847 //                  idrotm[1100],"ONLY");
848 //       gMC->Gspos("C04F",3,"C04G", 0, +iChamber->RInner()+bpar[0] , 0, 
849 //                  idrotm[1101],"ONLY");
850 //       gMC->Gspos("C04F",4,"C04G", 0, -iChamber->RInner()-bpar[0] , 0, 
851 //                  idrotm[1101],"ONLY");
852 //      }
853      }
854      // define the id of tracking media:
855      Int_t idCopper = idtmed[1110];
856      Int_t idGlass  = idtmed[1111];
857      Int_t idCarbon = idtmed[1112];
858      Int_t idRoha   = idtmed[1113];
859
860       // sensitive area: 40*40 cm**2
861      const Float_t sensLength = 40.; 
862      const Float_t sensHeight = 40.; 
863      const Float_t sensWidth  = 0.5; // according to TDR fig 2.120 
864      const Int_t sensMaterial = idGas;
865      const Float_t yOverlap   = 1.5; 
866
867      // PCB dimensions in cm; width: 30 mum copper   
868      const Float_t pcbLength  = sensLength; 
869      const Float_t pcbHeight  = 60.; 
870      const Float_t pcbWidth   = 0.003;   
871      const Int_t pcbMaterial  = idCopper;
872
873      // Insulating material: 200 mum glass fiber glued to pcb  
874      const Float_t insuLength = pcbLength; 
875      const Float_t insuHeight = pcbHeight; 
876      const Float_t insuWidth  = 0.020;   
877      const Int_t insuMaterial = idGlass;
878
879      // Carbon fiber panels: 200mum carbon/epoxy skin   
880      const Float_t panelLength = sensLength; 
881      const Float_t panelHeight = sensHeight; 
882      const Float_t panelWidth  = 0.020;      
883      const Int_t panelMaterial = idCarbon;
884
885      // rohacell between the two carbon panels   
886      const Float_t rohaLength = sensLength; 
887      const Float_t rohaHeight = sensHeight; 
888      const Float_t rohaWidth  = 0.5;
889      const Int_t rohaMaterial = idRoha;
890
891      // Frame around the slat: 2 sticks along length,2 along height  
892      // H: the horizontal ones 
893      const Float_t hFrameLength = pcbLength; 
894      const Float_t hFrameHeight = 1.5; 
895      const Float_t hFrameWidth  = sensWidth; 
896      const Int_t hFrameMaterial = idGlass;
897
898      // V: the vertical ones 
899      const Float_t vFrameLength = 4.0; 
900      const Float_t vFrameHeight = sensHeight + hFrameHeight; 
901      const Float_t vFrameWidth  = sensWidth;
902      const Int_t vFrameMaterial = idGlass;
903
904      // B: the horizontal border filled with rohacell 
905      const Float_t bFrameLength = hFrameLength; 
906      const Float_t bFrameHeight = (pcbHeight - sensHeight)/2. - hFrameHeight; 
907      const Float_t bFrameWidth  = hFrameWidth;
908      const Int_t bFrameMaterial = idRoha;
909
910      // NULOC: 30 mum copper + 200 mum vetronite (same radiation length as 14mum copper)
911      const Float_t nulocLength = 2.5; 
912      const Float_t nulocHeight = 7.5; 
913      const Float_t nulocWidth  = 0.0030 + 0.0014; // equivalent copper width of vetronite; 
914      const Int_t   nulocMaterial = idCopper;
915
916      const Float_t slatHeight = pcbHeight; 
917      const Float_t slatWidth = sensWidth + 2.*(pcbWidth + insuWidth + 
918                                                2.* panelWidth + rohaWidth);
919      const Int_t slatMaterial = idAir;
920      const Float_t dSlatLength = vFrameLength; // border on left and right 
921
922      Float_t spar[3];  
923      Int_t i, j;
924
925      // the panel volume contains the rohacell
926
927      Float_t twidth = 2 * panelWidth + rohaWidth; 
928      Float_t panelpar[3] = { panelLength/2., panelHeight/2., twidth/2. }; 
929      Float_t rohapar[3] = { rohaLength/2., rohaHeight/2., rohaWidth/2. }; 
930
931      // insulating material contains PCB-> gas-> 2 borders filled with rohacell
932
933      twidth = 2*(insuWidth + pcbWidth) + sensWidth;  
934      Float_t insupar[3] = { insuLength/2., insuHeight/2., twidth/2. }; 
935      twidth -= 2 * insuWidth; 
936      Float_t pcbpar[3] = { pcbLength/2., pcbHeight/2., twidth/2. }; 
937      Float_t senspar[3] = { sensLength/2., sensHeight/2., sensWidth/2. }; 
938      Float_t theight = 2*hFrameHeight + sensHeight;
939      Float_t hFramepar[3]={hFrameLength/2., theight/2., hFrameWidth/2.}; 
940      Float_t bFramepar[3]={bFrameLength/2., bFrameHeight/2., bFrameWidth/2.}; 
941      Float_t vFramepar[3]={vFrameLength/2., vFrameHeight/2., vFrameWidth/2.}; 
942      Float_t nulocpar[3]={nulocLength/2., nulocHeight/2., nulocWidth/2.}; 
943      Float_t xx;
944      Float_t xxmax = (bFrameLength - nulocLength)/2.; 
945      Int_t index=0;
946      
947      if (stations[2]) {
948          
949 //********************************************************************
950 //                            Station 3                             **
951 //********************************************************************
952      // indices 1 and 2 for first and second chambers in the station
953      // iChamber (first chamber) kept for other quanties than Z,
954      // assumed to be the same in both chambers
955      iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[4];
956      iChamber2 =(AliMUONChamber*) (*fChambers)[5];
957      zpos1=iChamber1->Z(); 
958      zpos2=iChamber2->Z();
959      dstation = zpos2 - zpos1;
960
961 //      zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
962 //
963 //   Mother volume
964 //     tpar[0] = iChamber->RInner()-vFrameLength; 
965      tpar[0] = 30.; 
966 //     tpar[1] = (iChamber->ROuter()+dframep)*TMath::Sqrt(2.);
967      tpar[1] = 160.;
968      tpar[2] = dstation/4;
969      gMC->Gsvolu("C05M", "TUBE", idAir, tpar, 3);
970      gMC->Gsvolu("C06M", "TUBE", idAir, tpar, 3);
971      gMC->Gspos("C05M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
972      gMC->Gspos("C06M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
973  
974      // volumes for slat geometry (xx=5,..,10 chamber id): 
975      // Sxx0 Sxx1 Sxx2 Sxx3  -->   Slat Mother volumes 
976      // SxxG                          -->   Sensitive volume (gas)
977      // SxxP                          -->   PCB (copper) 
978      // SxxI                          -->   Insulator (vetronite) 
979      // SxxC                          -->   Carbon panel 
980      // SxxR                          -->   Rohacell
981      // SxxH, SxxV                    -->   Horizontal and Vertical frames (vetronite)
982
983      // slat dimensions: slat is a MOTHER volume!!! made of air
984
985      const Int_t nSlats3 = 4;  // number of slats per quadrant
986      const Int_t nPCB3[nSlats3] = {2, 2, 2, 1}; // n PCB per slat
987      const Float_t xpos3[nSlats3] = {32., 40., 0., 0.};
988      Float_t slatLength3[nSlats3]; 
989
990      // create and position the slat (mother) volumes 
991
992      char volNam5[5];
993      char volNam6[5];
994      Float_t xSlat3;
995
996      for (i = 0; i<nSlats3; i++){
997        slatLength3[i] = pcbLength * nPCB3[i] + 2. * dSlatLength; 
998        xSlat3 = slatLength3[i]/2. - vFrameLength/2. + xpos3[i]; 
999        if (i==1) slatLength3[i] -=  2. *dSlatLength; // frame out in PCB with circular border 
1000        Float_t ySlat31 =  sensHeight * i - yOverlap * i; 
1001        Float_t ySlat32 = -sensHeight * i + yOverlap * i; 
1002        spar[0] = slatLength3[i]/2.; 
1003        spar[1] = slatHeight/2.;
1004        spar[2] = slatWidth/2. * 1.01; 
1005        Float_t dzCh3=spar[2] * 1.01;
1006        // zSlat to be checked (odd downstream or upstream?)
1007        Float_t zSlat = (i%2 ==0)? spar[2] : -spar[2]; 
1008        sprintf(volNam5,"S05%d",i);
1009        gMC->Gsvolu(volNam5,"BOX",slatMaterial,spar,3);
1010        gMC->Gspos(volNam5, i*4+1,"C05M", xSlat3, ySlat31, zSlat+2.*dzCh3, 0, "ONLY");
1011        gMC->Gspos(volNam5, i*4+2,"C05M",-xSlat3, ySlat31, zSlat-2.*dzCh3, 0, "ONLY");
1012        
1013        if (i>0) { 
1014          gMC->Gspos(volNam5, i*4+3,"C05M", xSlat3, ySlat32, zSlat+2.*dzCh3, 0, "ONLY");
1015          gMC->Gspos(volNam5, i*4+4,"C05M",-xSlat3, ySlat32, zSlat-2.*dzCh3, 0, "ONLY");
1016        }
1017
1018        sprintf(volNam6,"S06%d",i);
1019        gMC->Gsvolu(volNam6,"BOX",slatMaterial,spar,3);
1020        gMC->Gspos(volNam6, i*4+1,"C06M", xSlat3, ySlat31, zSlat+2.*dzCh3, 0, "ONLY");
1021        gMC->Gspos(volNam6, i*4+2,"C06M",-xSlat3, ySlat31, zSlat-2.*dzCh3, 0, "ONLY");
1022        if (i>0) { 
1023          gMC->Gspos(volNam6, i*4+3,"C06M", xSlat3, ySlat32, zSlat+2.*dzCh3, 0, "ONLY");
1024          gMC->Gspos(volNam6, i*4+4,"C06M",-xSlat3, ySlat32, zSlat-2.*dzCh3, 0, "ONLY");
1025        }
1026      }
1027
1028      // create the panel volume 
1029  
1030      gMC->Gsvolu("S05C","BOX",panelMaterial,panelpar,3);
1031      gMC->Gsvolu("S06C","BOX",panelMaterial,panelpar,3);
1032
1033      // create the rohacell volume 
1034
1035      gMC->Gsvolu("S05R","BOX",rohaMaterial,rohapar,3);
1036      gMC->Gsvolu("S06R","BOX",rohaMaterial,rohapar,3);
1037
1038      // create the insulating material volume 
1039
1040      gMC->Gsvolu("S05I","BOX",insuMaterial,insupar,3);
1041      gMC->Gsvolu("S06I","BOX",insuMaterial,insupar,3);
1042
1043      // create the PCB volume 
1044
1045      gMC->Gsvolu("S05P","BOX",pcbMaterial,pcbpar,3);
1046      gMC->Gsvolu("S06P","BOX",pcbMaterial,pcbpar,3);
1047  
1048      // create the sensitive volumes,
1049      gMC->Gsvolu("S05G","BOX",sensMaterial,0,0);
1050      gMC->Gsvolu("S06G","BOX",sensMaterial,0,0);
1051
1052
1053      // create the vertical frame volume 
1054
1055      gMC->Gsvolu("S05V","BOX",vFrameMaterial,vFramepar,3);
1056      gMC->Gsvolu("S06V","BOX",vFrameMaterial,vFramepar,3);
1057
1058      // create the horizontal frame volume 
1059
1060      gMC->Gsvolu("S05H","BOX",hFrameMaterial,hFramepar,3);
1061      gMC->Gsvolu("S06H","BOX",hFrameMaterial,hFramepar,3);
1062
1063      // create the horizontal border volume 
1064
1065      gMC->Gsvolu("S05B","BOX",bFrameMaterial,bFramepar,3);
1066      gMC->Gsvolu("S06B","BOX",bFrameMaterial,bFramepar,3);
1067
1068      index=0; 
1069      for (i = 0; i<nSlats3; i++){
1070        sprintf(volNam5,"S05%d",i);
1071        sprintf(volNam6,"S06%d",i);
1072        Float_t xvFrame  = (slatLength3[i] - vFrameLength)/2.;
1073        // position the vertical frames 
1074        if (i!=1) { 
1075          gMC->Gspos("S05V",2*i-1,volNam5, xvFrame, 0., 0. , 0, "ONLY");
1076          gMC->Gspos("S05V",2*i  ,volNam5,-xvFrame, 0., 0. , 0, "ONLY");
1077          gMC->Gspos("S06V",2*i-1,volNam6, xvFrame, 0., 0. , 0, "ONLY");
1078          gMC->Gspos("S06V",2*i  ,volNam6,-xvFrame, 0., 0. , 0, "ONLY");
1079        }       
1080        // position the panels and the insulating material 
1081        for (j=0; j<nPCB3[i]; j++){
1082          index++;
1083          Float_t xx = sensLength * (-nPCB3[i]/2.+j+.5); 
1084          
1085          Float_t zPanel = spar[2] - panelpar[2]; 
1086          gMC->Gspos("S05C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
1087          gMC->Gspos("S05C",2*index  ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
1088          gMC->Gspos("S06C",2*index-1,volNam6, xx, 0., zPanel , 0, "ONLY");
1089          gMC->Gspos("S06C",2*index  ,volNam6, xx, 0.,-zPanel , 0, "ONLY");
1090
1091          gMC->Gspos("S05I",index,volNam5, xx, 0., 0 , 0, "ONLY");
1092          gMC->Gspos("S06I",index,volNam6, xx, 0., 0 , 0, "ONLY");
1093        } 
1094      }
1095
1096      // position the rohacell volume inside the panel volume
1097      gMC->Gspos("S05R",1,"S05C",0.,0.,0.,0,"ONLY"); 
1098      gMC->Gspos("S06R",1,"S06C",0.,0.,0.,0,"ONLY"); 
1099
1100      // position the PCB volume inside the insulating material volume
1101      gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY"); 
1102      gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY"); 
1103      // position the horizontal frame volume inside the PCB volume
1104      gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY"); 
1105      gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY"); 
1106      // position the sensitive volume inside the horizontal frame volume
1107      gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3); 
1108      gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3); 
1109      // position the border volumes inside the PCB volume
1110      Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.; 
1111      gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY"); 
1112      gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY"); 
1113      gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY"); 
1114      gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY"); 
1115
1116      // create the NULOC volume and position it in the horizontal frame
1117
1118      gMC->Gsvolu("S05N","BOX",nulocMaterial,nulocpar,3);
1119      gMC->Gsvolu("S06N","BOX",nulocMaterial,nulocpar,3);
1120      index = 0;
1121      for (xx = -xxmax; xx<=xxmax; xx+=3*nulocLength) { 
1122        index++; 
1123        gMC->Gspos("S05N",2*index-1,"S05B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1124        gMC->Gspos("S05N",2*index  ,"S05B", xx, 0., bFrameWidth/4., 0, "ONLY");
1125        gMC->Gspos("S06N",2*index-1,"S06B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1126        gMC->Gspos("S06N",2*index  ,"S06B", xx, 0., bFrameWidth/4., 0, "ONLY");
1127      }
1128      
1129      // position the volumes approximating the circular section of the pipe
1130      Float_t yoffs = sensHeight/2. - yOverlap; 
1131      Float_t epsilon = 0.001; 
1132      Int_t ndiv=6;
1133      Float_t divpar[3];
1134      Double_t dydiv= sensHeight/ndiv;
1135      Double_t ydiv = yoffs -dydiv - yOverlap/2.;
1136      Int_t imax=0; 
1137      //     for (Int_t islat=0; islat<nSlats3; islat++) imax += nPCB3[islat]; 
1138      imax = 1; 
1139      Float_t rmin = 35.; 
1140      Float_t z1 = -spar[2], z2=2*spar[2]*1.01; 
1141      for (Int_t idiv=0;idiv<ndiv; idiv++){ 
1142        ydiv+= dydiv;
1143        Float_t xdiv = 0.; 
1144        if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1145        divpar[0] = (pcbLength-xdiv)/2.; 
1146        divpar[1] = dydiv/2. - epsilon;
1147        divpar[2] = sensWidth/2.; 
1148        Float_t xvol=(pcbLength+xdiv)/2.+1.999;
1149        Float_t yvol=ydiv + dydiv/2.; 
1150        gMC->Gsposp("S05G",imax+4*idiv+1,"C05M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1151        gMC->Gsposp("S06G",imax+4*idiv+1,"C06M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1152        gMC->Gsposp("S05G",imax+4*idiv+2,"C05M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1153        gMC->Gsposp("S06G",imax+4*idiv+2,"C06M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1154        gMC->Gsposp("S05G",imax+4*idiv+3,"C05M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1155        gMC->Gsposp("S06G",imax+4*idiv+3,"C06M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1156        gMC->Gsposp("S05G",imax+4*idiv+4,"C05M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1157        gMC->Gsposp("S06G",imax+4*idiv+4,"C06M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1158      }
1159      }
1160      
1161
1162  if (stations[3]) {
1163
1164 //********************************************************************
1165 //                            Station 4                             **
1166 //********************************************************************
1167      // indices 1 and 2 for first and second chambers in the station
1168      // iChamber (first chamber) kept for other quanties than Z,
1169      // assumed to be the same in both chambers
1170      iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[6];
1171      iChamber2 =(AliMUONChamber*) (*fChambers)[7];
1172      zpos1=iChamber1->Z(); 
1173      zpos2=iChamber2->Z();
1174      dstation = zpos2 - zpos1;
1175 //      zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
1176      
1177 //
1178 //   Mother volume
1179      tpar[0] = 37.5-vFrameLength/2.-0.1; 
1180      tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
1181      tpar[2] = 3.252;
1182
1183      gMC->Gsvolu("C07M", "TUBE", idAir, tpar, 3);
1184      gMC->Gsvolu("C08M", "TUBE", idAir, tpar, 3);
1185      gMC->Gspos("C07M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
1186      gMC->Gspos("C08M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
1187      
1188
1189      const Int_t nSlats4 = 6;  // number of slats per quadrant
1190      const Int_t nPCB4[nSlats4] = {4,4,5,5,4,3}; // n PCB per slat
1191      const Float_t xpos4[nSlats4] = {37.5, 40., 0., 0., 0., 0.};
1192      Float_t slatLength4[nSlats4];     
1193
1194      // create and position the slat (mother) volumes 
1195
1196      char volNam7[5];
1197      char volNam8[5];
1198      Float_t xSlat4;
1199      Float_t ySlat4;
1200
1201      for (i = 0; i<nSlats4; i++){
1202        slatLength4[i] = pcbLength * nPCB4[i] + 2. * dSlatLength; 
1203        xSlat4 = slatLength4[i]/2. - vFrameLength/2. + xpos4[i]; 
1204        if (i==1) slatLength4[i] -=  2. *dSlatLength; // frame out in PCB with circular border 
1205        ySlat4 =  sensHeight * i - yOverlap *i;
1206        
1207        spar[0] = slatLength4[i]/2.; 
1208        spar[1] = slatHeight/2.;
1209        spar[2] = slatWidth/2.*1.01; 
1210        Float_t dzCh4=spar[2]*1.01;
1211        // zSlat to be checked (odd downstream or upstream?)
1212        Float_t zSlat = (i%2 ==0)? spar[2] : -spar[2]; 
1213        sprintf(volNam7,"S07%d",i);
1214        gMC->Gsvolu(volNam7,"BOX",slatMaterial,spar,3);
1215        gMC->Gspos(volNam7, i*4+1,"C07M", xSlat4, ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
1216        gMC->Gspos(volNam7, i*4+2,"C07M",-xSlat4, ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
1217        if (i>0) { 
1218          gMC->Gspos(volNam7, i*4+3,"C07M", xSlat4,-ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
1219          gMC->Gspos(volNam7, i*4+4,"C07M",-xSlat4,-ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
1220        }
1221        sprintf(volNam8,"S08%d",i);
1222        gMC->Gsvolu(volNam8,"BOX",slatMaterial,spar,3);
1223        gMC->Gspos(volNam8, i*4+1,"C08M", xSlat4, ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
1224        gMC->Gspos(volNam8, i*4+2,"C08M",-xSlat4, ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
1225        if (i>0) { 
1226          gMC->Gspos(volNam8, i*4+3,"C08M", xSlat4,-ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
1227          gMC->Gspos(volNam8, i*4+4,"C08M",-xSlat4,-ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
1228        }
1229      }
1230      
1231
1232      // create the panel volume 
1233  
1234      gMC->Gsvolu("S07C","BOX",panelMaterial,panelpar,3);
1235      gMC->Gsvolu("S08C","BOX",panelMaterial,panelpar,3);
1236
1237      // create the rohacell volume 
1238
1239      gMC->Gsvolu("S07R","BOX",rohaMaterial,rohapar,3);
1240      gMC->Gsvolu("S08R","BOX",rohaMaterial,rohapar,3);
1241
1242      // create the insulating material volume 
1243
1244      gMC->Gsvolu("S07I","BOX",insuMaterial,insupar,3);
1245      gMC->Gsvolu("S08I","BOX",insuMaterial,insupar,3);
1246
1247      // create the PCB volume 
1248
1249      gMC->Gsvolu("S07P","BOX",pcbMaterial,pcbpar,3);
1250      gMC->Gsvolu("S08P","BOX",pcbMaterial,pcbpar,3);
1251  
1252      // create the sensitive volumes,
1253
1254      gMC->Gsvolu("S07G","BOX",sensMaterial,0,0);
1255      gMC->Gsvolu("S08G","BOX",sensMaterial,0,0);
1256
1257      // create the vertical frame volume 
1258
1259      gMC->Gsvolu("S07V","BOX",vFrameMaterial,vFramepar,3);
1260      gMC->Gsvolu("S08V","BOX",vFrameMaterial,vFramepar,3);
1261
1262      // create the horizontal frame volume 
1263
1264      gMC->Gsvolu("S07H","BOX",hFrameMaterial,hFramepar,3);
1265      gMC->Gsvolu("S08H","BOX",hFrameMaterial,hFramepar,3);
1266
1267      // create the horizontal border volume 
1268
1269      gMC->Gsvolu("S07B","BOX",bFrameMaterial,bFramepar,3);
1270      gMC->Gsvolu("S08B","BOX",bFrameMaterial,bFramepar,3);
1271
1272      index=0; 
1273      for (i = 0; i<nSlats4; i++){
1274        sprintf(volNam7,"S07%d",i);
1275        sprintf(volNam8,"S08%d",i);
1276        Float_t xvFrame  = (slatLength4[i] - vFrameLength)/2.;
1277        // position the vertical frames 
1278        if (i!=1) { 
1279          gMC->Gspos("S07V",2*i-1,volNam7, xvFrame, 0., 0. , 0, "ONLY");
1280          gMC->Gspos("S07V",2*i  ,volNam7,-xvFrame, 0., 0. , 0, "ONLY");
1281          gMC->Gspos("S08V",2*i-1,volNam8, xvFrame, 0., 0. , 0, "ONLY");
1282          gMC->Gspos("S08V",2*i  ,volNam8,-xvFrame, 0., 0. , 0, "ONLY");
1283        }
1284        // position the panels and the insulating material 
1285        for (j=0; j<nPCB4[i]; j++){
1286          index++;
1287          Float_t xx = sensLength * (-nPCB4[i]/2.+j+.5); 
1288
1289          Float_t zPanel = spar[2] - panelpar[2]; 
1290          gMC->Gspos("S07C",2*index-1,volNam7, xx, 0., zPanel , 0, "ONLY");
1291          gMC->Gspos("S07C",2*index  ,volNam7, xx, 0.,-zPanel , 0, "ONLY");
1292          gMC->Gspos("S08C",2*index-1,volNam8, xx, 0., zPanel , 0, "ONLY");
1293          gMC->Gspos("S08C",2*index  ,volNam8, xx, 0.,-zPanel , 0, "ONLY");
1294
1295          gMC->Gspos("S07I",index,volNam7, xx, 0., 0 , 0, "ONLY");
1296          gMC->Gspos("S08I",index,volNam8, xx, 0., 0 , 0, "ONLY");
1297        } 
1298      }
1299
1300      // position the rohacell volume inside the panel volume
1301      gMC->Gspos("S07R",1,"S07C",0.,0.,0.,0,"ONLY"); 
1302      gMC->Gspos("S08R",1,"S08C",0.,0.,0.,0,"ONLY"); 
1303
1304      // position the PCB volume inside the insulating material volume
1305      gMC->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY"); 
1306      gMC->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY"); 
1307      // position the horizontal frame volume inside the PCB volume
1308      gMC->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY"); 
1309      gMC->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY"); 
1310      // position the sensitive volume inside the horizontal frame volume
1311      gMC->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3); 
1312      gMC->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3); 
1313      // position the border volumes inside the PCB volume
1314      Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.; 
1315      gMC->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY"); 
1316      gMC->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY"); 
1317      gMC->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY"); 
1318      gMC->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY"); 
1319
1320      // create the NULOC volume and position it in the horizontal frame
1321
1322      gMC->Gsvolu("S07N","BOX",nulocMaterial,nulocpar,3);
1323      gMC->Gsvolu("S08N","BOX",nulocMaterial,nulocpar,3);
1324      index = 0;
1325      for (xx = -xxmax; xx<=xxmax; xx+=3*nulocLength) { 
1326        index++; 
1327        gMC->Gspos("S07N",2*index-1,"S07B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1328        gMC->Gspos("S07N",2*index  ,"S07B", xx, 0., bFrameWidth/4., 0, "ONLY");
1329        gMC->Gspos("S08N",2*index-1,"S08B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1330        gMC->Gspos("S08N",2*index  ,"S08B", xx, 0., bFrameWidth/4., 0, "ONLY");
1331      }
1332
1333      // position the volumes approximating the circular section of the pipe
1334      Float_t yoffs = sensHeight/2. - yOverlap/2.; 
1335      Float_t epsilon = 0.001; 
1336      Int_t ndiv=6;
1337      Float_t divpar[3];
1338      Double_t dydiv= sensHeight/ndiv;
1339      Double_t ydiv = yoffs -dydiv - yOverlap/2.;
1340      Int_t imax=0; 
1341      //     for (Int_t islat=0; islat<nSlats3; islat++) imax += nPCB3[islat]; 
1342      imax = 1; 
1343      Float_t rmin = 40.; 
1344      Float_t z1 = -spar[2], z2=2*spar[2]*1.01; 
1345      for (Int_t idiv=0;idiv<ndiv; idiv++){ 
1346        ydiv+= dydiv;
1347        Float_t xdiv = 0.; 
1348        if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1349        divpar[0] = (pcbLength-xdiv)/2.; 
1350        divpar[1] = dydiv/2. - epsilon;
1351        divpar[2] = sensWidth/2.; 
1352        Float_t xvol=(pcbLength+xdiv)/2.+1.999;
1353        Float_t yvol=ydiv + dydiv/2.;
1354        gMC->Gsposp("S07G",imax+4*idiv+1,"C07M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1355        gMC->Gsposp("S08G",imax+4*idiv+1,"C08M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1356        gMC->Gsposp("S07G",imax+4*idiv+2,"C07M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1357        gMC->Gsposp("S08G",imax+4*idiv+2,"C08M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1358        gMC->Gsposp("S07G",imax+4*idiv+3,"C07M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1359        gMC->Gsposp("S08G",imax+4*idiv+3,"C08M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1360        gMC->Gsposp("S07G",imax+4*idiv+4,"C07M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1361        gMC->Gsposp("S08G",imax+4*idiv+4,"C08M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1362      }
1363
1364  }
1365
1366  if (stations[4]) {
1367      
1368
1369 //********************************************************************
1370 //                            Station 5                             **
1371 //********************************************************************
1372      // indices 1 and 2 for first and second chambers in the station
1373      // iChamber (first chamber) kept for other quanties than Z,
1374      // assumed to be the same in both chambers
1375      iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[8];
1376      iChamber2 =(AliMUONChamber*) (*fChambers)[9];
1377      zpos1=iChamber1->Z(); 
1378      zpos2=iChamber2->Z();
1379      dstation = zpos2 - zpos1;
1380 //      zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
1381      
1382 //
1383 //   Mother volume
1384      tpar[0] = 37.5-vFrameLength/2.-0.1; 
1385      tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
1386      tpar[2] = dstation/5.;
1387
1388      gMC->Gsvolu("C09M", "TUBE", idAir, tpar, 3);
1389      gMC->Gsvolu("C10M", "TUBE", idAir, tpar, 3);
1390      gMC->Gspos("C09M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
1391      gMC->Gspos("C10M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
1392
1393
1394      const Int_t nSlats5 = 7;  // number of slats per quadrant
1395      const Int_t nPCB5[nSlats5] = {5,5,6,6,5,4,3}; // n PCB per slat
1396      const Float_t xpos5[nSlats5] = {37.5, 40., 0., 0., 0., 0., 0.};
1397      Float_t slatLength5[nSlats5]; 
1398      char volNam9[5];
1399      char volNam10[5];
1400      Float_t xSlat5;
1401      Float_t ySlat5;
1402
1403      for (i = 0; i<nSlats5; i++){
1404        slatLength5[i] = pcbLength * nPCB5[i] + 2. * dSlatLength; 
1405        xSlat5 = slatLength5[i]/2. - vFrameLength/2. +xpos5[i]; 
1406        if (i==1) slatLength5[i] -=  2. *dSlatLength; // frame out in PCB with circular border 
1407        ySlat5 = sensHeight * i - yOverlap * i; 
1408        spar[0] = slatLength5[i]/2.; 
1409        spar[1] = slatHeight/2.;
1410        spar[2] = slatWidth/2. * 1.01; 
1411        Float_t dzCh5=spar[2]*1.01;
1412        // zSlat to be checked (odd downstream or upstream?)
1413        Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2]; 
1414        sprintf(volNam9,"S09%d",i);
1415        gMC->Gsvolu(volNam9,"BOX",slatMaterial,spar,3);
1416        gMC->Gspos(volNam9, i*4+1,"C09M", xSlat5, ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1417        gMC->Gspos(volNam9, i*4+2,"C09M",-xSlat5, ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
1418        if (i>0) { 
1419            gMC->Gspos(volNam9, i*4+3,"C09M", xSlat5,-ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1420            gMC->Gspos(volNam9, i*4+4,"C09M",-xSlat5,-ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
1421        }
1422        sprintf(volNam10,"S10%d",i);
1423        gMC->Gsvolu(volNam10,"BOX",slatMaterial,spar,3);
1424        gMC->Gspos(volNam10, i*4+1,"C10M", xSlat5, ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1425        gMC->Gspos(volNam10, i*4+2,"C10M",-xSlat5, ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
1426        if (i>0) { 
1427            gMC->Gspos(volNam10, i*4+3,"C10M", xSlat5,-ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1428            gMC->Gspos(volNam10, i*4+4,"C10M",-xSlat5,-ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
1429        }
1430      }
1431
1432      // create the panel volume 
1433  
1434      gMC->Gsvolu("S09C","BOX",panelMaterial,panelpar,3);
1435      gMC->Gsvolu("S10C","BOX",panelMaterial,panelpar,3);
1436
1437      // create the rohacell volume 
1438
1439      gMC->Gsvolu("S09R","BOX",rohaMaterial,rohapar,3);
1440      gMC->Gsvolu("S10R","BOX",rohaMaterial,rohapar,3);
1441
1442      // create the insulating material volume 
1443
1444      gMC->Gsvolu("S09I","BOX",insuMaterial,insupar,3);
1445      gMC->Gsvolu("S10I","BOX",insuMaterial,insupar,3);
1446
1447      // create the PCB volume 
1448
1449      gMC->Gsvolu("S09P","BOX",pcbMaterial,pcbpar,3);
1450      gMC->Gsvolu("S10P","BOX",pcbMaterial,pcbpar,3);
1451  
1452      // create the sensitive volumes,
1453
1454      gMC->Gsvolu("S09G","BOX",sensMaterial,0,0);
1455      gMC->Gsvolu("S10G","BOX",sensMaterial,0,0);
1456
1457      // create the vertical frame volume 
1458
1459      gMC->Gsvolu("S09V","BOX",vFrameMaterial,vFramepar,3);
1460      gMC->Gsvolu("S10V","BOX",vFrameMaterial,vFramepar,3);
1461
1462      // create the horizontal frame volume 
1463
1464      gMC->Gsvolu("S09H","BOX",hFrameMaterial,hFramepar,3);
1465      gMC->Gsvolu("S10H","BOX",hFrameMaterial,hFramepar,3);
1466
1467      // create the horizontal border volume 
1468
1469      gMC->Gsvolu("S09B","BOX",bFrameMaterial,bFramepar,3);
1470      gMC->Gsvolu("S10B","BOX",bFrameMaterial,bFramepar,3);
1471
1472      index=0; 
1473      for (i = 0; i<nSlats5; i++){
1474        sprintf(volNam9,"S09%d",i);
1475        sprintf(volNam10,"S10%d",i);
1476        Float_t xvFrame  = (slatLength5[i] - vFrameLength)/2.;
1477        // position the vertical frames 
1478        if (i!=1) { 
1479          gMC->Gspos("S09V",2*i-1,volNam9, xvFrame, 0., 0. , 0, "ONLY");
1480          gMC->Gspos("S09V",2*i  ,volNam9,-xvFrame, 0., 0. , 0, "ONLY");
1481          gMC->Gspos("S10V",2*i-1,volNam10, xvFrame, 0., 0. , 0, "ONLY");
1482          gMC->Gspos("S10V",2*i  ,volNam10,-xvFrame, 0., 0. , 0, "ONLY");
1483        }
1484        
1485        // position the panels and the insulating material 
1486        for (j=0; j<nPCB5[i]; j++){
1487          index++;
1488          Float_t xx = sensLength * (-nPCB5[i]/2.+j+.5); 
1489
1490          Float_t zPanel = spar[2] - panelpar[2]; 
1491          gMC->Gspos("S09C",2*index-1,volNam9, xx, 0., zPanel , 0, "ONLY");
1492          gMC->Gspos("S09C",2*index  ,volNam9, xx, 0.,-zPanel , 0, "ONLY");
1493          gMC->Gspos("S10C",2*index-1,volNam10, xx, 0., zPanel , 0, "ONLY");
1494          gMC->Gspos("S10C",2*index  ,volNam10, xx, 0.,-zPanel , 0, "ONLY");
1495
1496          gMC->Gspos("S09I",index,volNam9, xx, 0., 0 , 0, "ONLY");
1497          gMC->Gspos("S10I",index,volNam10, xx, 0., 0 , 0, "ONLY");
1498        } 
1499      }
1500
1501      // position the rohacell volume inside the panel volume
1502      gMC->Gspos("S09R",1,"S09C",0.,0.,0.,0,"ONLY"); 
1503      gMC->Gspos("S10R",1,"S10C",0.,0.,0.,0,"ONLY"); 
1504
1505      // position the PCB volume inside the insulating material volume
1506      gMC->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY"); 
1507      gMC->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY"); 
1508      // position the horizontal frame volume inside the PCB volume
1509      gMC->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY"); 
1510      gMC->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY"); 
1511      // position the sensitive volume inside the horizontal frame volume
1512      gMC->Gsposp("S09G",1,"S09H",0.,0.,0.,0,"ONLY",senspar,3); 
1513      gMC->Gsposp("S10G",1,"S10H",0.,0.,0.,0,"ONLY",senspar,3); 
1514      // position the border volumes inside the PCB volume
1515      Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.; 
1516      gMC->Gspos("S09B",1,"S09P",0., yborder,0.,0,"ONLY"); 
1517      gMC->Gspos("S09B",2,"S09P",0.,-yborder,0.,0,"ONLY"); 
1518      gMC->Gspos("S10B",1,"S10P",0., yborder,0.,0,"ONLY"); 
1519      gMC->Gspos("S10B",2,"S10P",0.,-yborder,0.,0,"ONLY"); 
1520
1521      // create the NULOC volume and position it in the horizontal frame
1522
1523      gMC->Gsvolu("S09N","BOX",nulocMaterial,nulocpar,3);
1524      gMC->Gsvolu("S10N","BOX",nulocMaterial,nulocpar,3);
1525      index = 0;
1526      for (xx = -xxmax; xx<=xxmax; xx+=3*nulocLength) { 
1527        index++; 
1528        gMC->Gspos("S09N",2*index-1,"S09B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1529        gMC->Gspos("S09N",2*index  ,"S09B", xx, 0., bFrameWidth/4., 0, "ONLY");
1530        gMC->Gspos("S10N",2*index-1,"S10B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1531        gMC->Gspos("S10N",2*index  ,"S10B", xx, 0., bFrameWidth/4., 0, "ONLY");
1532      }
1533      // position the volumes approximating the circular section of the pipe
1534      Float_t yoffs = sensHeight/2. - yOverlap/2.; 
1535      Float_t epsilon = 0.001; 
1536      Int_t ndiv=6;
1537      Float_t divpar[3];
1538      Double_t dydiv= sensHeight/ndiv;
1539      Double_t ydiv = yoffs -dydiv - yOverlap/2.;
1540      Int_t imax=0; 
1541      //     for (Int_t islat=0; islat<nSlats3; islat++) imax += nPCB3[islat]; 
1542      imax = 1; 
1543      Float_t rmin = 40.; 
1544      Float_t z1 = spar[2], z2=2*spar[2]*1.01; 
1545      for (Int_t idiv=0;idiv<ndiv; idiv++){ 
1546        ydiv+= dydiv;
1547        Float_t xdiv = 0.; 
1548        if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1549        divpar[0] = (pcbLength-xdiv)/2.; 
1550        divpar[1] = dydiv/2. - epsilon;
1551        divpar[2] = sensWidth/2.; 
1552        Float_t xvol=(pcbLength+xdiv)/2. + 1.999;
1553        Float_t yvol=ydiv + dydiv/2.;
1554        gMC->Gsposp("S09G",imax+4*idiv+1,"C09M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1555        gMC->Gsposp("S10G",imax+4*idiv+1,"C10M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1556        gMC->Gsposp("S09G",imax+4*idiv+2,"C09M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1557        gMC->Gsposp("S10G",imax+4*idiv+2,"C10M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1558        gMC->Gsposp("S09G",imax+4*idiv+3,"C09M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1559        gMC->Gsposp("S10G",imax+4*idiv+3,"C10M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1560        gMC->Gsposp("S09G",imax+4*idiv+4,"C09M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1561        gMC->Gsposp("S10G",imax+4*idiv+4,"C10M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1562      }
1563
1564  }
1565  
1566
1567 ///////////////////////////////////////
1568 // GEOMETRY FOR THE TRIGGER CHAMBERS //
1569 ///////////////////////////////////////
1570
1571 // 03/00 P. Dupieux : introduce a slighly more realistic  
1572 //                    geom. of the trigger readout planes with
1573 //                    2 Zpos per trigger plane (alternate
1574 //                    between left and right of the trigger)  
1575
1576 //  Parameters of the Trigger Chambers
1577
1578                 
1579      const Float_t kXMC1MIN=34.;       
1580      const Float_t kXMC1MED=51.;                                
1581      const Float_t kXMC1MAX=272.;                               
1582      const Float_t kYMC1MIN=34.;                              
1583      const Float_t kYMC1MAX=51.;                              
1584      const Float_t kRMIN1=50.;
1585      const Float_t kRMAX1=62.;
1586      const Float_t kRMIN2=50.;
1587      const Float_t kRMAX2=66.;
1588
1589 //   zposition of the middle of the gas gap in mother vol 
1590      const Float_t kZMCm=-3.6;
1591      const Float_t kZMCp=+3.6;
1592
1593
1594 // TRIGGER STATION 1 - TRIGGER STATION 1 - TRIGGER STATION 1
1595
1596      // iChamber 1 and 2 for first and second chambers in the station
1597      // iChamber (first chamber) kept for other quanties than Z,
1598      // assumed to be the same in both chambers
1599      iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[10];
1600      iChamber2 =(AliMUONChamber*) (*fChambers)[11]; 
1601
1602      // 03/00 
1603      // zpos1 and zpos2 are now the middle of the first and second
1604      // plane of station 1 : 
1605      // zpos1=(16075+15995)/2=16035 mm, thick/2=40 mm
1606      // zpos2=(16225+16145)/2=16185 mm, thick/2=40 mm
1607      //
1608      // zpos1m=15999 mm , zpos1p=16071 mm (middles of gas gaps)
1609      // zpos2m=16149 mm , zpos2p=16221 mm (middles of gas gaps)
1610      // rem : the total thickness accounts for 1 mm of al on both 
1611      // side of the RPCs (see zpos1 and zpos2), as previously
1612
1613      zpos1=iChamber1->Z();
1614      zpos2=iChamber2->Z();
1615
1616
1617 // Mother volume definition     
1618      tpar[0] = iChamber->RInner(); 
1619      tpar[1] = iChamber->ROuter();
1620      tpar[2] = 4.0;    
1621      gMC->Gsvolu("CM11", "TUBE", idAir, tpar, 3);
1622      gMC->Gsvolu("CM12", "TUBE", idAir, tpar, 3);
1623      
1624 // Definition of the flange between the beam shielding and the RPC 
1625      tpar[0]= kRMIN1;
1626      tpar[1]= kRMAX1;
1627      tpar[2]= 4.0;
1628    
1629      gMC->Gsvolu("CF1A", "TUBE", idAlu1, tpar, 3);     //Al
1630      gMC->Gspos("CF1A", 1, "CM11", 0., 0., 0., 0, "MANY");
1631      gMC->Gspos("CF1A", 2, "CM12", 0., 0., 0., 0, "MANY");
1632
1633
1634 // FIRST PLANE OF STATION 1
1635
1636 //   ratios of zpos1m/zpos1p and inverse for first plane
1637      Float_t zmp=(zpos1-3.6)/(zpos1+3.6);
1638      Float_t zpm=1./zmp;
1639    
1640
1641 // Definition of prototype for chambers in the first plane     
1642           
1643      tpar[0]= 0.;
1644      tpar[1]= 0.;
1645      tpar[2]= 0.;
1646           
1647      gMC->Gsvolu("CC1A", "BOX ", idAlu1, tpar, 0);           //Al    
1648      gMC->Gsvolu("CB1A", "BOX ", idtmed[1107], tpar, 0);     //Bakelite 
1649      gMC->Gsvolu("CG1A", "BOX ", idtmed[1106], tpar, 0);     //Gas streamer
1650
1651 // chamber type A
1652      tpar[0] = -1.;
1653      tpar[1] = -1.;
1654      
1655      const Float_t kXMC1A=kXMC1MED+(kXMC1MAX-kXMC1MED)/2.;
1656      const Float_t kYMC1Am=0.;
1657      const Float_t kYMC1Ap=0.;
1658           
1659      tpar[2] = 0.1;    
1660      gMC->Gsposp("CG1A", 1, "CB1A", 0., 0., 0., 0, "ONLY",tpar,3);
1661      tpar[2] = 0.3;
1662      gMC->Gsposp("CB1A", 1, "CC1A", 0., 0., 0., 0, "ONLY",tpar,3);
1663
1664      tpar[2] = 0.4;
1665      tpar[0] = (kXMC1MAX-kXMC1MED)/2.;
1666      tpar[1] = kYMC1MIN;
1667
1668      gMC->Gsposp("CC1A", 1, "CM11",kXMC1A,kYMC1Am,kZMCm, 0, "ONLY", tpar, 3);
1669      gMC->Gsposp("CC1A", 2, "CM11",-kXMC1A,kYMC1Ap,kZMCp, 0, "ONLY", tpar, 3);
1670      
1671 //  chamber type B    
1672      Float_t tpar1save=tpar[1];
1673      Float_t y1msave=kYMC1Am;
1674      Float_t y1psave=kYMC1Ap;
1675  
1676      tpar[0] = (kXMC1MAX-kXMC1MIN)/2.;
1677      tpar[1] = (kYMC1MAX-kYMC1MIN)/2.;
1678      
1679      const Float_t kXMC1B=kXMC1MIN+tpar[0];
1680      const Float_t kYMC1Bp=(y1msave+tpar1save)*zpm+tpar[1];
1681      const Float_t kYMC1Bm=(y1psave+tpar1save)*zmp+tpar[1];
1682
1683      gMC->Gsposp("CC1A", 3, "CM11",kXMC1B,kYMC1Bp,kZMCp, 0, "ONLY", tpar, 3);
1684      gMC->Gsposp("CC1A", 4, "CM11",-kXMC1B,kYMC1Bm,kZMCm, 0, "ONLY", tpar, 3);
1685      gMC->Gsposp("CC1A", 5, "CM11",kXMC1B,-kYMC1Bp,kZMCp, 0, "ONLY", tpar, 3);
1686      gMC->Gsposp("CC1A", 6, "CM11",-kXMC1B,-kYMC1Bm,kZMCm, 0, "ONLY", tpar, 3);
1687      
1688 //  chamber type C  (end of type B !!)      
1689      tpar1save=tpar[1];
1690      y1msave=kYMC1Bm;
1691      y1psave=kYMC1Bp;
1692
1693      tpar[0] = kXMC1MAX/2;
1694      tpar[1] = kYMC1MAX/2;
1695      
1696      const Float_t kXMC1C=tpar[0];
1697 // warning : same Z than type B
1698      const Float_t kYMC1Cp=(y1psave+tpar1save)*1.+tpar[1];
1699      const Float_t kYMC1Cm=(y1msave+tpar1save)*1.+tpar[1];
1700      
1701      gMC->Gsposp("CC1A", 7, "CM11",kXMC1C,kYMC1Cp,kZMCp, 0, "ONLY", tpar, 3);
1702      gMC->Gsposp("CC1A", 8, "CM11",-kXMC1C,kYMC1Cm,kZMCm, 0, "ONLY", tpar, 3);
1703      gMC->Gsposp("CC1A", 9, "CM11",kXMC1C,-kYMC1Cp,kZMCp, 0, "ONLY", tpar, 3);
1704      gMC->Gsposp("CC1A", 10, "CM11",-kXMC1C,-kYMC1Cm,kZMCm, 0, "ONLY", tpar, 3);
1705      
1706 //  chamber type D, E and F (same size)        
1707      tpar1save=tpar[1];
1708      y1msave=kYMC1Cm;
1709      y1psave=kYMC1Cp;
1710
1711      tpar[0] = kXMC1MAX/2.;
1712      tpar[1] = kYMC1MIN;
1713      
1714      const Float_t kXMC1D=tpar[0];
1715      const Float_t kYMC1Dp=(y1msave+tpar1save)*zpm+tpar[1];
1716      const Float_t kYMC1Dm=(y1psave+tpar1save)*zmp+tpar[1];
1717      
1718      gMC->Gsposp("CC1A", 11, "CM11",kXMC1D,kYMC1Dm,kZMCm, 0, "ONLY", tpar, 3);
1719      gMC->Gsposp("CC1A", 12, "CM11",-kXMC1D,kYMC1Dp,kZMCp, 0, "ONLY", tpar, 3);
1720      gMC->Gsposp("CC1A", 13, "CM11",kXMC1D,-kYMC1Dm,kZMCm, 0, "ONLY", tpar, 3);
1721      gMC->Gsposp("CC1A", 14, "CM11",-kXMC1D,-kYMC1Dp,kZMCp, 0, "ONLY", tpar, 3);
1722
1723
1724      tpar1save=tpar[1];
1725      y1msave=kYMC1Dm;
1726      y1psave=kYMC1Dp;
1727      const Float_t kYMC1Ep=(y1msave+tpar1save)*zpm+tpar[1];
1728      const Float_t kYMC1Em=(y1psave+tpar1save)*zmp+tpar[1];
1729      
1730      gMC->Gsposp("CC1A", 15, "CM11",kXMC1D,kYMC1Ep,kZMCp, 0, "ONLY", tpar, 3);
1731      gMC->Gsposp("CC1A", 16, "CM11",-kXMC1D,kYMC1Em,kZMCm, 0, "ONLY", tpar, 3);
1732      gMC->Gsposp("CC1A", 17, "CM11",kXMC1D,-kYMC1Ep,kZMCp, 0, "ONLY", tpar, 3);
1733      gMC->Gsposp("CC1A", 18, "CM11",-kXMC1D,-kYMC1Em,kZMCm, 0, "ONLY", tpar, 3);
1734
1735      tpar1save=tpar[1];
1736      y1msave=kYMC1Em;
1737      y1psave=kYMC1Ep;
1738      const Float_t kYMC1Fp=(y1msave+tpar1save)*zpm+tpar[1];
1739      const Float_t kYMC1Fm=(y1psave+tpar1save)*zmp+tpar[1];
1740     
1741      gMC->Gsposp("CC1A", 19, "CM11",kXMC1D,kYMC1Fm,kZMCm, 0, "ONLY", tpar, 3);
1742      gMC->Gsposp("CC1A", 20, "CM11",-kXMC1D,kYMC1Fp,kZMCp, 0, "ONLY", tpar, 3);
1743      gMC->Gsposp("CC1A", 21, "CM11",kXMC1D,-kYMC1Fm,kZMCm, 0, "ONLY", tpar, 3);
1744      gMC->Gsposp("CC1A", 22, "CM11",-kXMC1D,-kYMC1Fp,kZMCp, 0, "ONLY", tpar, 3);
1745
1746 // Positioning first plane in ALICE     
1747      gMC->Gspos("CM11", 1, "ALIC", 0., 0., zpos1, 0, "ONLY");
1748
1749 // End of geometry definition for the first plane of station 1
1750
1751
1752
1753 // SECOND PLANE OF STATION 1 : proj ratio = zpos2/zpos1
1754
1755      const Float_t kZ12=zpos2/zpos1;
1756       
1757 // Definition of prototype for chambers in the second plane of station 1    
1758           
1759      tpar[0]= 0.;
1760      tpar[1]= 0.;
1761      tpar[2]= 0.;
1762           
1763      gMC->Gsvolu("CC2A", "BOX ", idAlu1, tpar, 0);           //Al    
1764      gMC->Gsvolu("CB2A", "BOX ", idtmed[1107], tpar, 0);     //Bakelite 
1765      gMC->Gsvolu("CG2A", "BOX ", idtmed[1106], tpar, 0);     //Gas streamer
1766
1767 // chamber type A
1768      tpar[0] = -1.;
1769      tpar[1] = -1.;
1770      
1771      const Float_t kXMC2A=kXMC1A*kZ12;
1772      const Float_t kYMC2Am=0.;
1773      const Float_t kYMC2Ap=0.;
1774           
1775      tpar[2] = 0.1;    
1776      gMC->Gsposp("CG2A", 1, "CB2A", 0., 0., 0., 0, "ONLY",tpar,3);
1777      tpar[2] = 0.3;
1778      gMC->Gsposp("CB2A", 1, "CC2A", 0., 0., 0., 0, "ONLY",tpar,3);
1779
1780      tpar[2] = 0.4;
1781      tpar[0] = ((kXMC1MAX-kXMC1MED)/2.)*kZ12;
1782      tpar[1] = kYMC1MIN*kZ12;
1783
1784      gMC->Gsposp("CC2A", 1, "CM12",kXMC2A,kYMC2Am,kZMCm, 0, "ONLY", tpar, 3);
1785      gMC->Gsposp("CC2A", 2, "CM12",-kXMC2A,kYMC2Ap,kZMCp, 0, "ONLY", tpar, 3);
1786      
1787
1788 //  chamber type B    
1789
1790      tpar[0] = ((kXMC1MAX-kXMC1MIN)/2.)*kZ12;
1791      tpar[1] = ((kYMC1MAX-kYMC1MIN)/2.)*kZ12;
1792      
1793      const Float_t kXMC2B=kXMC1B*kZ12;
1794      const Float_t kYMC2Bp=kYMC1Bp*kZ12;
1795      const Float_t kYMC2Bm=kYMC1Bm*kZ12;
1796      gMC->Gsposp("CC2A", 3, "CM12",kXMC2B,kYMC2Bp,kZMCp, 0, "ONLY", tpar, 3);
1797      gMC->Gsposp("CC2A", 4, "CM12",-kXMC2B,kYMC2Bm,kZMCm, 0, "ONLY", tpar, 3);
1798      gMC->Gsposp("CC2A", 5, "CM12",kXMC2B,-kYMC2Bp,kZMCp, 0, "ONLY", tpar, 3);
1799      gMC->Gsposp("CC2A", 6, "CM12",-kXMC2B,-kYMC2Bm,kZMCm, 0, "ONLY", tpar, 3);
1800
1801      
1802 //  chamber type C   (end of type B !!)     
1803
1804      tpar[0] = (kXMC1MAX/2)*kZ12;
1805      tpar[1] = (kYMC1MAX/2)*kZ12;
1806      
1807      const Float_t kXMC2C=kXMC1C*kZ12;
1808      const Float_t kYMC2Cp=kYMC1Cp*kZ12;
1809      const Float_t kYMC2Cm=kYMC1Cm*kZ12;     
1810      gMC->Gsposp("CC2A", 7, "CM12",kXMC2C,kYMC2Cp,kZMCp, 0, "ONLY", tpar, 3);
1811      gMC->Gsposp("CC2A", 8, "CM12",-kXMC2C,kYMC2Cm,kZMCm, 0, "ONLY", tpar, 3);
1812      gMC->Gsposp("CC2A", 9, "CM12",kXMC2C,-kYMC2Cp,kZMCp, 0, "ONLY", tpar, 3);
1813      gMC->Gsposp("CC2A", 10, "CM12",-kXMC2C,-kYMC2Cm,kZMCm, 0, "ONLY", tpar, 3);
1814      
1815 //  chamber type D, E and F (same size)        
1816
1817      tpar[0] = (kXMC1MAX/2.)*kZ12;
1818      tpar[1] = kYMC1MIN*kZ12;
1819      
1820      const Float_t kXMC2D=kXMC1D*kZ12;
1821      const Float_t kYMC2Dp=kYMC1Dp*kZ12;
1822      const Float_t kYMC2Dm=kYMC1Dm*kZ12;     
1823      gMC->Gsposp("CC2A", 11, "CM12",kXMC2D,kYMC2Dm,kZMCm, 0, "ONLY", tpar, 3);
1824      gMC->Gsposp("CC2A", 12, "CM12",-kXMC2D,kYMC2Dp,kZMCp, 0, "ONLY", tpar, 3);
1825      gMC->Gsposp("CC2A", 13, "CM12",kXMC2D,-kYMC2Dm,kZMCm, 0, "ONLY", tpar, 3);
1826      gMC->Gsposp("CC2A", 14, "CM12",-kXMC2D,-kYMC2Dp,kZMCp, 0, "ONLY", tpar, 3);
1827
1828      const Float_t kYMC2Ep=kYMC1Ep*kZ12;
1829      const Float_t kYMC2Em=kYMC1Em*kZ12;
1830      gMC->Gsposp("CC2A", 15, "CM12",kXMC2D,kYMC2Ep,kZMCp, 0, "ONLY", tpar, 3);
1831      gMC->Gsposp("CC2A", 16, "CM12",-kXMC2D,kYMC2Em,kZMCm, 0, "ONLY", tpar, 3);
1832      gMC->Gsposp("CC2A", 17, "CM12",kXMC2D,-kYMC2Ep,kZMCp, 0, "ONLY", tpar, 3);
1833      gMC->Gsposp("CC2A", 18, "CM12",-kXMC2D,-kYMC2Em,kZMCm, 0, "ONLY", tpar, 3);
1834
1835
1836      const Float_t kYMC2Fp=kYMC1Fp*kZ12;
1837      const Float_t kYMC2Fm=kYMC1Fm*kZ12;
1838      gMC->Gsposp("CC2A", 19, "CM12",kXMC2D,kYMC2Fm,kZMCm, 0, "ONLY", tpar, 3);
1839      gMC->Gsposp("CC2A", 20, "CM12",-kXMC2D,kYMC2Fp,kZMCp, 0, "ONLY", tpar, 3);
1840      gMC->Gsposp("CC2A", 21, "CM12",kXMC2D,-kYMC2Fm,kZMCm, 0, "ONLY", tpar, 3);
1841      gMC->Gsposp("CC2A", 22, "CM12",-kXMC2D,-kYMC2Fp,kZMCp, 0, "ONLY", tpar, 3);
1842
1843 // Positioning second plane of station 1 in ALICE     
1844      
1845      gMC->Gspos("CM12", 1, "ALIC", 0., 0., zpos2, 0, "ONLY");
1846
1847 // End of geometry definition for the second plane of station 1
1848
1849
1850
1851 // TRIGGER STATION 2 - TRIGGER STATION 2 - TRIGGER STATION 2    
1852
1853      // 03/00 
1854      // zpos3 and zpos4 are now the middle of the first and second
1855      // plane of station 2 : 
1856      // zpos3=(17075+16995)/2=17035 mm, thick/2=40 mm
1857      // zpos4=(17225+17145)/2=17185 mm, thick/2=40 mm
1858      //
1859      // zpos3m=16999 mm , zpos3p=17071 mm (middles of gas gaps)
1860      // zpos4m=17149 mm , zpos4p=17221 mm (middles of gas gaps)
1861      // rem : the total thickness accounts for 1 mm of al on both 
1862      // side of the RPCs (see zpos3 and zpos4), as previously
1863      iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[12];
1864      iChamber2 =(AliMUONChamber*) (*fChambers)[13];
1865      Float_t zpos3=iChamber1->Z();
1866      Float_t zpos4=iChamber2->Z();
1867
1868
1869 // Mother volume definition     
1870      tpar[0] = iChamber->RInner(); 
1871      tpar[1] = iChamber->ROuter();
1872      tpar[2] = 4.0;    
1873  
1874      gMC->Gsvolu("CM21", "TUBE", idAir, tpar, 3);
1875      gMC->Gsvolu("CM22", "TUBE", idAir, tpar, 3);
1876      
1877 // Definition of the flange between the beam shielding and the RPC 
1878 //  ???? interface shielding
1879
1880      tpar[0]= kRMIN2;
1881      tpar[1]= kRMAX2;
1882      tpar[2]= 4.0;
1883    
1884      gMC->Gsvolu("CF2A", "TUBE", idAlu1, tpar, 3);            //Al
1885      gMC->Gspos("CF2A", 1, "CM21", 0., 0., 0., 0, "MANY");
1886      gMC->Gspos("CF2A", 2, "CM22", 0., 0., 0., 0, "MANY");
1887     
1888
1889
1890 // FIRST PLANE OF STATION 2 : proj ratio = zpos3/zpos1
1891
1892      const Float_t kZ13=zpos3/zpos1; 
1893
1894 // Definition of prototype for chambers in the first plane of station 2       
1895      tpar[0]= 0.;
1896      tpar[1]= 0.;
1897      tpar[2]= 0.;
1898           
1899      gMC->Gsvolu("CC3A", "BOX ", idAlu1, tpar, 0);           //Al  
1900      gMC->Gsvolu("CB3A", "BOX ", idtmed[1107], tpar, 0);     //Bakelite 
1901      gMC->Gsvolu("CG3A", "BOX ", idtmed[1106], tpar, 0);     //Gas streamer
1902
1903
1904 // chamber type A
1905      tpar[0] = -1.;
1906      tpar[1] = -1.;
1907      
1908      const Float_t kXMC3A=kXMC1A*kZ13;
1909      const Float_t kYMC3Am=0.;
1910      const Float_t kYMC3Ap=0.;
1911           
1912      tpar[2] = 0.1;    
1913      gMC->Gsposp("CG3A", 1, "CB3A", 0., 0., 0., 0, "ONLY",tpar,3);
1914      tpar[2] = 0.3;
1915      gMC->Gsposp("CB3A", 1, "CC3A", 0., 0., 0., 0, "ONLY",tpar,3);
1916
1917      tpar[2] = 0.4;
1918      tpar[0] = ((kXMC1MAX-kXMC1MED)/2.)*kZ13;
1919      tpar[1] = kYMC1MIN*kZ13;
1920      gMC->Gsposp("CC3A", 1, "CM21",kXMC3A,kYMC3Am,kZMCm, 0, "ONLY", tpar, 3);
1921      gMC->Gsposp("CC3A", 2, "CM21",-kXMC3A,kYMC3Ap,kZMCp, 0, "ONLY", tpar, 3);
1922
1923      
1924 //  chamber type B    
1925      tpar[0] = ((kXMC1MAX-kXMC1MIN)/2.)*kZ13;
1926      tpar[1] = ((kYMC1MAX-kYMC1MIN)/2.)*kZ13;
1927      
1928      const Float_t kXMC3B=kXMC1B*kZ13;
1929      const Float_t kYMC3Bp=kYMC1Bp*kZ13;
1930      const Float_t kYMC3Bm=kYMC1Bm*kZ13;
1931      gMC->Gsposp("CC3A", 3, "CM21",kXMC3B,kYMC3Bp,kZMCp, 0, "ONLY", tpar, 3);
1932      gMC->Gsposp("CC3A", 4, "CM21",-kXMC3B,kYMC3Bm,kZMCm, 0, "ONLY", tpar, 3);
1933      gMC->Gsposp("CC3A", 5, "CM21",kXMC3B,-kYMC3Bp,kZMCp, 0, "ONLY", tpar, 3);
1934      gMC->Gsposp("CC3A", 6, "CM21",-kXMC3B,-kYMC3Bm,kZMCm, 0, "ONLY", tpar, 3);
1935
1936      
1937 //  chamber type C  (end of type B !!)      
1938      tpar[0] = (kXMC1MAX/2)*kZ13;
1939      tpar[1] = (kYMC1MAX/2)*kZ13;
1940      
1941      const Float_t kXMC3C=kXMC1C*kZ13;
1942      const Float_t kYMC3Cp=kYMC1Cp*kZ13;
1943      const Float_t kYMC3Cm=kYMC1Cm*kZ13;     
1944      gMC->Gsposp("CC3A", 7, "CM21",kXMC3C,kYMC3Cp,kZMCp, 0, "ONLY", tpar, 3);
1945      gMC->Gsposp("CC3A", 8, "CM21",-kXMC3C,kYMC3Cm,kZMCm, 0, "ONLY", tpar, 3);
1946      gMC->Gsposp("CC3A", 9, "CM21",kXMC3C,-kYMC3Cp,kZMCp, 0, "ONLY", tpar, 3);
1947      gMC->Gsposp("CC3A", 10, "CM21",-kXMC3C,-kYMC3Cm,kZMCm, 0, "ONLY", tpar, 3);
1948      
1949
1950 //  chamber type D, E and F (same size)         
1951
1952      tpar[0] = (kXMC1MAX/2.)*kZ13;
1953      tpar[1] = kYMC1MIN*kZ13;
1954      
1955      const Float_t kXMC3D=kXMC1D*kZ13;
1956      const Float_t kYMC3Dp=kYMC1Dp*kZ13;
1957      const Float_t kYMC3Dm=kYMC1Dm*kZ13;          
1958      gMC->Gsposp("CC3A", 11, "CM21",kXMC3D,kYMC3Dm,kZMCm, 0, "ONLY", tpar, 3);
1959      gMC->Gsposp("CC3A", 12, "CM21",-kXMC3D,kYMC3Dp,kZMCp, 0, "ONLY", tpar, 3);
1960      gMC->Gsposp("CC3A", 13, "CM21",kXMC3D,-kYMC3Dm,kZMCm, 0, "ONLY", tpar, 3);
1961      gMC->Gsposp("CC3A", 14, "CM21",-kXMC3D,-kYMC3Dp,kZMCp, 0, "ONLY", tpar, 3);
1962
1963      const Float_t kYMC3Ep=kYMC1Ep*kZ13;
1964      const Float_t kYMC3Em=kYMC1Em*kZ13;
1965      gMC->Gsposp("CC3A", 15, "CM21",kXMC3D,kYMC3Ep,kZMCp, 0, "ONLY", tpar, 3);
1966      gMC->Gsposp("CC3A", 16, "CM21",-kXMC3D,kYMC3Em,kZMCm, 0, "ONLY", tpar, 3);
1967      gMC->Gsposp("CC3A", 17, "CM21",kXMC3D,-kYMC3Ep,kZMCp, 0, "ONLY", tpar, 3);
1968      gMC->Gsposp("CC3A", 18, "CM21",-kXMC3D,-kYMC3Em,kZMCm, 0, "ONLY", tpar, 3);
1969
1970      const Float_t kYMC3Fp=kYMC1Fp*kZ13;
1971      const Float_t kYMC3Fm=kYMC1Fm*kZ13;
1972      gMC->Gsposp("CC3A", 19, "CM21",kXMC3D,kYMC3Fm,kZMCm, 0, "ONLY", tpar, 3);
1973      gMC->Gsposp("CC3A", 20, "CM21",-kXMC3D,kYMC3Fp,kZMCp, 0, "ONLY", tpar, 3);
1974      gMC->Gsposp("CC3A", 21, "CM21",kXMC3D,-kYMC3Fm,kZMCm, 0, "ONLY", tpar, 3);
1975      gMC->Gsposp("CC3A", 22, "CM21",-kXMC3D,-kYMC3Fp,kZMCp, 0, "ONLY", tpar, 3);
1976        
1977
1978 // Positioning first plane of station 2 in ALICE
1979      
1980      gMC->Gspos("CM21", 1, "ALIC", 0., 0., zpos3, 0, "ONLY");
1981
1982 // End of geometry definition for the first plane of station 2
1983
1984
1985
1986
1987 // SECOND PLANE OF STATION 2 : proj ratio = zpos4/zpos1
1988
1989      const Float_t kZ14=zpos4/zpos1;
1990      
1991 // Definition of prototype for chambers in the second plane of station 2    
1992           
1993      tpar[0]= 0.;
1994      tpar[1]= 0.;
1995      tpar[2]= 0.;
1996           
1997      gMC->Gsvolu("CC4A", "BOX ", idAlu1, tpar, 0);           //Al      
1998      gMC->Gsvolu("CB4A", "BOX ", idtmed[1107], tpar, 0);     //Bakelite 
1999      gMC->Gsvolu("CG4A", "BOX ", idtmed[1106], tpar, 0);     //Gas streamer
2000
2001 // chamber type A
2002      tpar[0] = -1.;
2003      tpar[1] = -1.;
2004      
2005      const Float_t kXMC4A=kXMC1A*kZ14;
2006      const Float_t kYMC4Am=0.;
2007      const Float_t kYMC4Ap=0.;
2008           
2009      tpar[2] = 0.1;    
2010      gMC->Gsposp("CG4A", 1, "CB4A", 0., 0., 0., 0, "ONLY",tpar,3);
2011      tpar[2] = 0.3;
2012      gMC->Gsposp("CB4A", 1, "CC4A", 0., 0., 0., 0, "ONLY",tpar,3);
2013
2014      tpar[2] = 0.4;
2015      tpar[0] = ((kXMC1MAX-kXMC1MED)/2.)*kZ14;
2016      tpar[1] = kYMC1MIN*kZ14;
2017      gMC->Gsposp("CC4A", 1, "CM22",kXMC4A,kYMC4Am,kZMCm, 0, "ONLY", tpar, 3);
2018      gMC->Gsposp("CC4A", 2, "CM22",-kXMC4A,kYMC4Ap,kZMCp, 0, "ONLY", tpar, 3);
2019      
2020
2021 //  chamber type B    
2022      tpar[0] = ((kXMC1MAX-kXMC1MIN)/2.)*kZ14;
2023      tpar[1] = ((kYMC1MAX-kYMC1MIN)/2.)*kZ14;
2024      
2025      const Float_t kXMC4B=kXMC1B*kZ14;
2026      const Float_t kYMC4Bp=kYMC1Bp*kZ14;
2027      const Float_t kYMC4Bm=kYMC1Bm*kZ14;
2028      gMC->Gsposp("CC4A", 3, "CM22",kXMC4B,kYMC4Bp,kZMCp, 0, "ONLY", tpar, 3);
2029      gMC->Gsposp("CC4A", 4, "CM22",-kXMC4B,kYMC4Bm,kZMCm, 0, "ONLY", tpar, 3);
2030      gMC->Gsposp("CC4A", 5, "CM22",kXMC4B,-kYMC4Bp,kZMCp, 0, "ONLY", tpar, 3);
2031      gMC->Gsposp("CC4A", 6, "CM22",-kXMC4B,-kYMC4Bm,kZMCm, 0, "ONLY", tpar, 3);
2032
2033      
2034 //  chamber type C   (end of type B !!)      
2035      tpar[0] =(kXMC1MAX/2)*kZ14;
2036      tpar[1] =  (kYMC1MAX/2)*kZ14;
2037      
2038      const Float_t kXMC4C=kXMC1C*kZ14;
2039      const Float_t kYMC4Cp=kYMC1Cp*kZ14;
2040      const Float_t kYMC4Cm=kYMC1Cm*kZ14;     
2041      gMC->Gsposp("CC4A", 7, "CM22",kXMC4C,kYMC4Cp,kZMCp, 0, "ONLY", tpar, 3);
2042      gMC->Gsposp("CC4A", 8, "CM22",-kXMC4C,kYMC4Cm,kZMCm, 0, "ONLY", tpar, 3);
2043      gMC->Gsposp("CC4A", 9, "CM22",kXMC4C,-kYMC4Cp,kZMCp, 0, "ONLY", tpar, 3);
2044      gMC->Gsposp("CC4A", 10, "CM22",-kXMC4C,-kYMC4Cm,kZMCm, 0, "ONLY", tpar, 3);
2045
2046      
2047 //  chamber type D, E and F (same size)      
2048      tpar[0] = (kXMC1MAX/2.)*kZ14;
2049      tpar[1] =  kYMC1MIN*kZ14;
2050      
2051      const Float_t kXMC4D=kXMC1D*kZ14;
2052      const Float_t kYMC4Dp=kYMC1Dp*kZ14;
2053      const Float_t kYMC4Dm=kYMC1Dm*kZ14;          
2054      gMC->Gsposp("CC4A", 11, "CM22",kXMC4D,kYMC4Dm,kZMCm, 0, "ONLY", tpar, 3);
2055      gMC->Gsposp("CC4A", 12, "CM22",-kXMC4D,kYMC4Dp,kZMCp, 0, "ONLY", tpar, 3);
2056      gMC->Gsposp("CC4A", 13, "CM22",kXMC4D,-kYMC4Dm,kZMCm, 0, "ONLY", tpar, 3);
2057      gMC->Gsposp("CC4A", 14, "CM22",-kXMC4D,-kYMC4Dp,kZMCp, 0, "ONLY", tpar, 3);
2058
2059      const Float_t kYMC4Ep=kYMC1Ep*kZ14;
2060      const Float_t kYMC4Em=kYMC1Em*kZ14;          
2061      gMC->Gsposp("CC4A", 15, "CM22",kXMC4D,kYMC4Ep,kZMCp, 0, "ONLY", tpar, 3);
2062      gMC->Gsposp("CC4A", 16, "CM22",-kXMC4D,kYMC4Em,kZMCm, 0, "ONLY", tpar, 3);
2063      gMC->Gsposp("CC4A", 17, "CM22",kXMC4D,-kYMC4Ep,kZMCp, 0, "ONLY", tpar, 3);
2064      gMC->Gsposp("CC4A", 18, "CM22",-kXMC4D,-kYMC4Em,kZMCm, 0, "ONLY", tpar, 3);
2065
2066      const Float_t kYMC4Fp=kYMC1Fp*kZ14;
2067      const Float_t kYMC4Fm=kYMC1Fm*kZ14;          
2068      gMC->Gsposp("CC4A", 19, "CM22",kXMC4D,kYMC4Fm,kZMCm, 0, "ONLY", tpar, 3);
2069      gMC->Gsposp("CC4A", 20, "CM22",-kXMC4D,kYMC4Fp,kZMCp, 0, "ONLY", tpar, 3);
2070      gMC->Gsposp("CC4A", 21, "CM22",kXMC4D,-kYMC4Fm,kZMCm, 0, "ONLY", tpar, 3);
2071      gMC->Gsposp("CC4A", 22, "CM22",-kXMC4D,-kYMC4Fp,kZMCp, 0, "ONLY", tpar, 3);
2072      
2073
2074 // Positioning second plane of station 2 in ALICE
2075      
2076      gMC->Gspos("CM22", 1, "ALIC", 0., 0., zpos4, 0, "ONLY");
2077
2078 // End of geometry definition for the second plane of station 2
2079
2080 // End of trigger geometry definition
2081
2082 }