6a67834332503d9875462217816372a1152e96ac
[u/mrichter/AliRoot.git] / MUON / AliMUONSt2GeometryBuilderV2.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17 //
18 // Class AliMUONSt2GeometryBuilderV2
19 // -------------------------------
20 // MUON Station2 coarse geometry construction class.
21 //********************************************************************
22 // Author: SANJOY PAL ,Prof. SUKALYAN CHATTOPADHAYAY  [SINP, KOLKATA]
23 //         &  Dr.SHAKEEL AHMAD (AMU), INDIA
24 //********************************************************************
25
26
27 #include <TVirtualMC.h>
28 #include <TGeoMatrix.h>
29 #include <Riostream.h>
30
31 #include "AliRun.h"
32 #include "AliLog.h"
33
34 #include "AliMUONSt2GeometryBuilderV2.h"
35 #include "AliMUON.h"
36 #include "AliMUONChamber.h"
37 #include "AliMUONGeometryModule.h"
38 #include "AliMUONGeometryEnvelopeStore.h"
39 #include "AliMUONConstants.h"
40
41 #define PI 3.14159
42 ClassImp(AliMUONSt2GeometryBuilderV2)
43
44 //______________________________________________________________________________
45 AliMUONSt2GeometryBuilderV2::AliMUONSt2GeometryBuilderV2(AliMUON* muon)
46  : AliMUONVGeometryBuilder("st2V2.dat",
47                            muon->Chamber(2).GetGeometry(),
48                            muon->Chamber(3).GetGeometry()),
49    fMUON(muon)
50 {
51 // Standard constructor
52
53 }
54
55 //______________________________________________________________________________
56 AliMUONSt2GeometryBuilderV2::AliMUONSt2GeometryBuilderV2()
57  : AliMUONVGeometryBuilder(),
58    fMUON(0)
59 {
60 // Default constructor
61 }
62
63
64 //______________________________________________________________________________
65 AliMUONSt2GeometryBuilderV2::AliMUONSt2GeometryBuilderV2(const AliMUONSt2GeometryBuilderV2& rhs)
66   : AliMUONVGeometryBuilder(rhs)
67 {
68 // Protected copy constructor
69
70   AliFatal("Copy constructor is not implemented.");
71 }
72
73 //______________________________________________________________________________
74 AliMUONSt2GeometryBuilderV2::~AliMUONSt2GeometryBuilderV2() {
75 //
76 }
77
78 //______________________________________________________________________________
79 AliMUONSt2GeometryBuilderV2&
80 AliMUONSt2GeometryBuilderV2::operator = (const AliMUONSt2GeometryBuilderV2& rhs)
81 {
82 // Protected assignement operator
83
84   // check assignement to self
85   if (this == &rhs) return *this;
86
87   AliFatal("Assignment operator is not implemented.");
88
89   return *this;
90 }
91
92 //
93 // public methods
94 //
95
96 //______________________________________________________________________________
97 void AliMUONSt2GeometryBuilderV2::CreateGeometry()
98 {
99 // From AliMUONv1::CreateGeometry()
100
101 //
102 //********************************************************************
103 //                            Station 2                             **
104 //********************************************************************
105      // indices 1 and 2 for first and second chambers in the station
106      // iChamber (first chamber) kept for other quanties than Z,
107      // assumed to be the same in both chambers
108
109 //     AliMUONChamber* iChamber = &fMUON->Chamber(2);
110 //     AliMUONChamber* iChamber1 = iChamber;
111 //     AliMUONChamber* iChamber2 = &fMUON->Chamber(3);
112
113
114      // Get tracking medias Ids
115      Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
116      Int_t idAir  = idtmed[1100]; // medium 1
117      Int_t idGas  = idtmed[1108]; // medium Ar-CO2 gas (80%+20%)
118      Int_t idPCB  = idtmed[1122]; // medium FR4
119      Int_t idCU   = idtmed[1110]; // medium copper
120      Int_t idRoha = idtmed[1113]; // medium roha cell
121      Int_t idPGF30= idtmed[1123]; // medium for Frame Eq.to Bakelite
122      Int_t idScru = idtmed[1128]; // screw material - Stainless Steel(18%Cr,9%Ni,Fe)
123
124
125      Int_t irot1, irot2, irot3, irot4, irot5, irot6;
126
127      fMUON->AliMatrix(irot1,  90.,  13., 90., 103.,  0., 0.);  //+13deg in x-y Plane
128      fMUON->AliMatrix(irot2,  90.,  34., 90., 124.,  0., 0.); // +34deg in x-y plane
129      fMUON->AliMatrix(irot3,  90.,  56., 90., 146.,  0., 0.); // +56 deg in x-y plane
130      fMUON->AliMatrix(irot4,  90.,  76., 90., 166.,  0., 0.); // +76 deg in x-y plane
131      fMUON->AliMatrix(irot5,  90.,  90., 90., 180.,  0., 0.); // +90 deg in x-y plane
132      fMUON->AliMatrix(irot6,  90., 22.5, 90., 112.5, 0., 0.); //22.5 deg in x-y Plane
133
134 /*########################################################################################
135     Create volume for one Quadrant connsist two plane
136 ##########################################################################################*/
137      Float_t tpar1[5];
138      tpar1[0] = 20.6;
139      tpar1[1] = 122.0;
140      tpar1[2] = 6.55555/2;
141      tpar1[3] = -10.0;
142      tpar1[4] = 100.0;
143
144
145      gMC->Gsvolu("SQM3","TUBS", idAir, tpar1, 5);
146      gMC->Gsvolu("SQM4","TUBS", idAir, tpar1, 5);
147
148
149
150 //==================================================================================
151 //                                 Plane - 1       L is used for one Plane while
152 //                                                   R for the other
153 //==================================================================================
154
155 //Thickness of variour parts
156        Float_t zcbb  = 0.04;       //cathode pcb
157        Float_t zcu   = 0.004;      // eff. cu in cathode pcb
158        Float_t zRoha = 2.5;        // Rhocell
159        Float_t zmeb = 0.08;      //Mech. exit board
160        Float_t zcu2 = 0.02;     //Effective electronic exit board
161     //Z-positions of various parts--- in Plane-1
162
163        Float_t zpos_cbb = 0.25;   // 2.5 mm => gap between anode & chatode plane
164        Float_t zpos_cu = zcbb;
165        Float_t zpos_Roha  = zcu;
166        Float_t zpos_meb = zmeb;
167        Float_t zpos_cu2 = zcu2;
168
169        Float_t zpos_cbb_bar = zpos_cbb + zcbb/2.;  //for segment 0 & 6
170        Float_t zpos_cubar = zcbb/2. + zcu/2.;
171        Float_t zpos_Roha_bar = zcu/2. + zRoha/2.;
172        Float_t zpos_meb_bar =  zRoha/2. + zmeb/2.;
173        Float_t zpos_eeb_bar = zmeb/2. + zcu2/2.;
174
175
176  //Cathode PCB + Copper sheet + Rohacell + mech exit board + eff. electronic exit board
177
178  //Segment-0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179        Float_t bpar_h[3];
180        bpar_h[0] = 95.5/2.;
181        bpar_h[1] = 1.6/2.;
182        bpar_h[2] = zcbb/2.;
183        gMC->Gsvolu("CB0L", "BOX", idPCB, bpar_h, 3);
184
185        bpar_h[2] = zcu/2.;     //Thickness of Copper sheet
186        gMC->Gsvolu("CU0L", "BOX", idCU, bpar_h, 3);
187
188        bpar_h[2] = zRoha/2.;     //Thickness of Roha cell
189        gMC->Gsvolu("RH0L", "BOX", idRoha, bpar_h, 3);
190
191        bpar_h[0] = (100.6/2)-(0.9/2);
192        bpar_h[1] = 2.8/2.;
193        bpar_h[2] = zmeb/2;
194        gMC->Gsvolu("MB0L", "BOX", idPCB, bpar_h, 3);
195
196        bpar_h[2] = zcu2/2;
197        gMC->Gsvolu("EB0L", "BOX", idCU, bpar_h, 3);
198
199  //Segment-1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200         Float_t pgpar[10];
201         pgpar[0] = 0.;
202         pgpar[1] = 13.;
203         pgpar[2] = 1.;
204         pgpar[3] = 2.;
205         pgpar[4] = 0.;
206         pgpar[5] = 22.5;
207         pgpar[6] = 120.2;
208         pgpar[7] = pgpar[4] + zcbb;
209         pgpar[8] = pgpar[5];
210         pgpar[9] = pgpar[6];
211         gMC->Gsvolu("CB1L", "PGON", idPCB, pgpar, 10);
212
213         pgpar[7] = pgpar[4] + zcu;  // Thickness of copper-sheet
214         gMC->Gsvolu("CU1L", "PGON", idCU, pgpar, 10);
215
216         pgpar[7] = pgpar[4] + zRoha;  // Thickness of Roha cell
217         gMC->Gsvolu("RH1L", "PGON", idRoha, pgpar, 10);
218
219         pgpar[5] = 21.5; // radius of inner rib
220         pgpar[6] = 121.2;
221         pgpar[7] = pgpar[4] + zmeb;
222         pgpar[8] = pgpar[5];
223         pgpar[9] = pgpar[6];
224         gMC->Gsvolu("MB1L", "PGON", idPCB, pgpar, 10);
225
226         pgpar[7] = pgpar[4] + zcu2;
227         gMC->Gsvolu("EB1L", "PGON", idCU, pgpar, 10);
228
229 //Segment-2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230         pgpar[0] = 0.;
231         pgpar[1] = 21.;
232         pgpar[2] = 1.;
233         pgpar[3] = 2.;
234         pgpar[4] = 0.;
235         pgpar[5] = 22.5;
236         pgpar[6] = 121.5;
237         pgpar[7] = pgpar[4] +zcbb;
238         pgpar[8] = pgpar[5];
239         pgpar[9] = pgpar[6];
240         gMC->Gsvolu("CB2L", "PGON", idPCB, pgpar, 10);
241
242         pgpar[7] = pgpar[4] + zcu;  // Thickness of copper-sheet
243         gMC->Gsvolu("CU2L", "PGON", idCU, pgpar, 10);
244
245         pgpar[7] = pgpar[4] + zRoha;  // Thickness of Roha cell
246         gMC->Gsvolu("RH2L", "PGON", idRoha, pgpar, 10);
247
248         pgpar[5] = 21.5; // radius of inner rib
249         pgpar[6] = 122.5;
250         pgpar[7] = pgpar[4] + zmeb;
251         pgpar[8] = pgpar[5];
252         pgpar[9] = pgpar[6];
253         gMC->Gsvolu("MB2L", "PGON", idPCB, pgpar, 10);
254
255         pgpar[7] = pgpar[4] + zcu2;
256         gMC->Gsvolu("EB2L", "PGON", idCU, pgpar, 10);
257
258 //Segment-3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259         pgpar[0] = 0.;
260         pgpar[1] = 22.;
261         pgpar[2] = 1.;
262         pgpar[3] = 2.;
263         pgpar[4] = 0.;
264         pgpar[5] = 22.5;
265         pgpar[6] = 119.9;
266         pgpar[7] = pgpar[4] + zcbb;
267         pgpar[8] = pgpar[5];
268         pgpar[9] = pgpar[6];
269         gMC->Gsvolu("CB3L", "PGON", idPCB, pgpar, 10);
270
271         pgpar[7] = pgpar[4] + zcu;  // Thickness of copper-sheet
272         gMC->Gsvolu("CU3L", "PGON", idCU, pgpar, 10);
273
274         pgpar[7] = pgpar[4] + zRoha;  // Thickness of Roha cell
275         gMC->Gsvolu("RH3L", "PGON", idRoha, pgpar, 10);
276
277         pgpar[5] = 21.5; // radius of inner rib
278         pgpar[6] = 120.9;
279         pgpar[7] = pgpar[4] + zmeb;
280         pgpar[8] = pgpar[5];
281         pgpar[9] = pgpar[6];
282         gMC->Gsvolu("MB3L", "PGON", idPCB, pgpar, 10);
283
284         pgpar[7] = pgpar[4] + zcu2;
285         gMC->Gsvolu("EB3L", "PGON", idCU, pgpar, 10);
286
287 //Segment-4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
288         pgpar[0] = 0.;
289         pgpar[1] = 20.;
290         pgpar[2] = 1.;
291         pgpar[3] = 2.;
292         pgpar[4] = 0.;
293         pgpar[5] = 22.5;
294         pgpar[6] = 119.9;
295         pgpar[7] = pgpar[4] + zcbb;
296         pgpar[8] = pgpar[5];
297         pgpar[9] = pgpar[6];
298         gMC->Gsvolu("CB4L", "PGON", idPCB, pgpar, 10);
299
300         pgpar[7] = pgpar[4] + zcu;  // Thickness of copper-sheet
301         gMC->Gsvolu("CU4L", "PGON", idCU, pgpar, 10);
302
303         pgpar[7] = pgpar[4] + zRoha;  // Thickness of Roha cell
304         gMC->Gsvolu("RH4L", "PGON", idRoha, pgpar, 10);
305
306         pgpar[5] = 21.5; // radius of inner rib
307         pgpar[6] = 120.9;
308         pgpar[7] = pgpar[4] + zmeb;
309         pgpar[8] = pgpar[5];
310         pgpar[9] = pgpar[6];
311         gMC->Gsvolu("MB4L", "PGON", idPCB, pgpar, 10);
312
313         pgpar[7] = pgpar[4] + zcu2;
314         gMC->Gsvolu("EB4L", "PGON", idCU, pgpar, 10);
315
316 //Segment-5 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317         pgpar[0] = 0.;
318         pgpar[1] = 14.;
319         pgpar[2] = 1.;
320         pgpar[3] = 2.;
321         pgpar[4] = 0.;
322         pgpar[5] = 22.5;
323         pgpar[6] = 117.5;
324         pgpar[7] = pgpar[4] + zcbb;
325         pgpar[8] = pgpar[5];
326         pgpar[9] = pgpar[6];
327         gMC->Gsvolu("CB5L", "PGON", idPCB, pgpar, 10);
328
329         pgpar[7] = pgpar[4] + zcu;  // Thickness of copper-sheet
330         gMC->Gsvolu("CU5L", "PGON", idCU, pgpar, 10);
331
332         pgpar[7] = pgpar[4] + zRoha;  // Thickness of Roha cell
333         gMC->Gsvolu("RH5L", "PGON", idRoha, pgpar, 10);
334
335         pgpar[5] = 21.5;// radius of inner rib
336         pgpar[6] = 118.5;
337         pgpar[7] = pgpar[4] + zmeb;
338         pgpar[8] = pgpar[5];
339         pgpar[9] = pgpar[6];
340         gMC->Gsvolu("MB5L", "PGON", idPCB, pgpar, 10);
341
342         pgpar[7] = pgpar[4] + zcu2;
343         gMC->Gsvolu("EB5L", "PGON", idCU, pgpar, 10);
344
345 //Segment-6 - vertical box ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346
347         Float_t bpar_v[3];
348
349         bpar_v[0] = 1.6/2.;
350         bpar_v[1] = 95.5/2.;
351         bpar_v[2] = zcbb/2.;
352         gMC->Gsvolu("CB6L", "BOX", idPCB, bpar_v, 3);
353
354         bpar_v[2] = zcu/2.;
355         gMC->Gsvolu("CU6L", "BOX", idCU, bpar_v, 3);
356
357         bpar_v[2] = zRoha/2.;
358         gMC->Gsvolu("RH6L", "BOX", idRoha, bpar_v, 3);
359
360         bpar_v[0] = 2.8/2.;
361         bpar_v[1] = (97.9/2)-(0.9/2.);
362         bpar_v[2] = zmeb/2;
363         gMC->Gsvolu("MB6L", "BOX", idPCB, bpar_v, 3);
364
365         bpar_v[2] = zcu2/2;
366         gMC->Gsvolu("EB6L", "BOX", idCU, bpar_v, 3);
367
368 //...........................................................................................
369 //Positioning of Electronic exit board
370      gMC->Gspos("EB0L",1, "MB0L", 0.,0.,zpos_eeb_bar,0, "only");
371      gMC->Gspos("EB1L",1, "MB1L", 0.,0.,zpos_cu2,0, "only");
372      gMC->Gspos("EB2L",1, "MB2L", 0.,0.,zpos_cu2,0, "only");
373      gMC->Gspos("EB3L",1, "MB3L", 0.,0.,zpos_cu2,0, "only");
374      gMC->Gspos("EB4L",1, "MB4L", 0.,0.,zpos_cu2,0, "only");
375      gMC->Gspos("EB5L",1, "MB5L", 0.,0.,zpos_cu2,0, "only");
376      gMC->Gspos("EB6L",1, "MB6L", 0.,0.,zpos_eeb_bar,0, "only");
377
378 //Positioning of Mech. exit board
379      Float_t xpos_meb_hor =  1.10;
380      Float_t ypos_meb_hor = -0.60;
381
382      Float_t xpos_meb_ver = -0.60;
383      Float_t ypos_meb_ver = -0.35;
384
385      gMC->Gspos("MB0L",1, "RH0L", xpos_meb_hor,ypos_meb_hor,zpos_meb_bar,0, "only");
386      gMC->Gspos("MB1L",1, "RH1L", 0.,0.,zpos_meb,0, "only");
387      gMC->Gspos("MB2L",1, "RH2L", 0.,0.,zpos_meb,0, "only");
388      gMC->Gspos("MB3L",1, "RH3L", 0.,0.,zpos_meb,0, "only");
389      gMC->Gspos("MB4L",1, "RH4L", 0.,0.,zpos_meb,0, "only");
390      gMC->Gspos("MB5L",1, "RH5L", 0.,0.,zpos_meb,0, "only");
391      gMC->Gspos("MB6L",1, "RH6L", xpos_meb_ver,ypos_meb_ver,zpos_meb_bar,0, "only");
392
393 //Positioning Roha cell over copper sheet
394      gMC->Gspos("RH0L",1, "CU0L", 0.,0.,zpos_Roha_bar,0, "only");// box horizontal
395      gMC->Gspos("RH1L",1, "CU1L", 0.,0.,zpos_Roha,0, "only");
396      gMC->Gspos("RH2L",1, "CU2L", 0.,0.,zpos_Roha,0, "only");
397      gMC->Gspos("RH3L",1, "CU3L", 0.,0.,zpos_Roha,0, "only");
398      gMC->Gspos("RH4L",1, "CU4L", 0.,0.,zpos_Roha,0, "only");
399      gMC->Gspos("RH5L",1, "CU5L", 0.,0.,zpos_Roha,0, "only");
400      gMC->Gspos("RH6L",1, "CU6L", 0.,0.,zpos_Roha_bar,0, "only");
401
402 //Positioning Copper sheet over PCB
403      gMC->Gspos("CU0L",1, "CB0L", 0.,0.,zpos_cubar,0, "only");// box horizontal
404      gMC->Gspos("CU1L",1, "CB1L", 0.,0.,zpos_cu,0, "only");
405      gMC->Gspos("CU2L",1, "CB2L", 0.,0.,zpos_cu,0, "only");
406      gMC->Gspos("CU3L",1, "CB3L", 0.,0.,zpos_cu,0, "only");
407      gMC->Gspos("CU4L",1, "CB4L", 0.,0.,zpos_cu,0, "only");
408      gMC->Gspos("CU5L",1, "CB5L", 0.,0.,zpos_cu,0, "only");
409      gMC->Gspos("CU6L",1, "CB6L", 0.,0.,zpos_cubar,0, "only");
410
411
412 //Positioning the PCB
413       Float_t x_hor_pos = 95.5/2.+ 22.6; // 22.6 is inner radius of PCB
414       Float_t y_hor_pos = -(1.6/2); //
415
416       Float_t x_ver_pos = -(1.6/2); //
417       Float_t y_ver_pos = 95.5/2.+ 22.6; //
418
419       // chamber 3
420      gMC->Gspos("CB0L",1, "SQM3", x_hor_pos,y_hor_pos,zpos_cbb_bar,0, "only");// box horizontal
421      gMC->Gspos("CB1L",1, "SQM3", 0.,0.,zpos_cbb,0, "only");
422      gMC->Gspos("CB2L",1, "SQM3", 0.,0.,zpos_cbb,irot1,"only");
423      gMC->Gspos("CB3L",1, "SQM3", 0.,0.,zpos_cbb,irot2, "only");
424      gMC->Gspos("CB4L",1, "SQM3", 0.,0.,zpos_cbb,irot3, "only");
425      gMC->Gspos("CB5L",1, "SQM3", 0.,0.,zpos_cbb,irot4, "only");
426      gMC->Gspos("CB6L",1, "SQM3", x_ver_pos,y_ver_pos,zpos_cbb_bar,0, "only");// box vertical
427
428       // chamber 4
429      gMC->Gspos("CB0L",1, "SQM4", x_hor_pos,y_hor_pos,zpos_cbb_bar,0, "only");// box horizontal
430      gMC->Gspos("CB1L",1, "SQM4", 0.,0.,zpos_cbb,0, "only");
431      gMC->Gspos("CB2L",1, "SQM4", 0.,0.,zpos_cbb,irot1,"only");
432      gMC->Gspos("CB3L",1, "SQM4", 0.,0.,zpos_cbb,irot2, "only");
433      gMC->Gspos("CB4L",1, "SQM4", 0.,0.,zpos_cbb,irot3, "only");
434      gMC->Gspos("CB5L",1, "SQM4", 0.,0.,zpos_cbb,irot4, "only");
435      gMC->Gspos("CB6L",1, "SQM4", x_ver_pos,y_ver_pos,zpos_cbb,0, "only");// box vertical
436
437 //----------------------------------------------------------------------
438 //                          Frames
439 //----------------------------------------------------------------------
440 //Frame-1
441       Float_t frame1[3] ;                //Index-1 is used for horizontal frame bar
442       frame1[0] = 100.6/2.;              //and 2,3,4..... is used for the next frames
443       frame1[1] = 2.5/2.;                //from hor. to the vertical
444       frame1[2] = .95/2.;
445
446       Float_t rib1[3];
447       rib1[0] = frame1[0] - 0.9/2.;
448       rib1[1] = 1./2.;
449       rib1[2] = 1.84/2.;
450
451       Float_t xpos_fr1 = frame1[0] + 20.6;
452       Float_t ypos_fr1 = -3.7 + frame1[1] ;
453       Float_t zpos_fr1 = frame1[2];
454
455       Float_t xpos_rb1 = 0.9/2;
456       Float_t ypos_rb1 = -frame1[1] + rib1[1]+0.9;
457       Float_t zpos_rb1 = frame1[2] + rib1[2];
458
459       gMC->Gsvolu("FRHL", "BOX", idPGF30, frame1, 3); //Frame - 1
460       gMC->Gsvolu("RBHL", "BOX", idPGF30, rib1, 3); //Rib - 1
461
462 //Fixing Screws ...........................................
463 //---------screw parameters (on frame) M4 ------------------
464    //in this plane screw-length is taken eq. to thickness of frame/frame+rib
465    // the remaining of the actual size is adjusted in the other plane
466
467        Float_t spar[3];
468        spar[0] = 0.0;
469        spar[1] = 0.2;
470        spar[2] = 0.95/2.;
471
472        Float_t s_head[3];
473        s_head[0] = 0.0; // screw-head
474        s_head[1] = 0.4;
475        s_head[2] = 0.4/2.;
476
477        Float_t xpos_h = 0.0;
478        Float_t ypos_h = 0.0;
479        Float_t zpos_h = spar[2] + s_head[2];
480
481        gMC->Gsvolu("SCHL","TUBE",idScru, spar,3);    //screw-vertical part for Frame M4
482        gMC->Gsvolu("HDFL","TUBE",idScru, s_head,3);    //screw-head
483    //positioning head over screws
484        gMC->Gspos("HDFL",1,"SCHL",xpos_h,ypos_h,zpos_h,0,"ONLY");//positioning Screw-head
485
486    //Screws on Frame
487        Float_t xpos_s = frame1[0] - 0.4;
488        Float_t ypos_s = -frame1[1] + 0.4;
489        Float_t zpos_s =  0.0;
490
491        Int_t Tot_Scru1 = 21;   //Total no. of Scru
492        for(Int_t nos1 = 0; nos1 < Tot_Scru1; nos1++)
493           {
494            gMC->Gspos("SCHL",nos1+1,"FRHL",xpos_s,ypos_s,zpos_s,0,"ONLY");
495            xpos_s -= 5.;
496           } // nos1 is no. of scru
497
498        gMC->Gspos("RBHL",1, "FRHL", xpos_rb1, ypos_rb1, zpos_rb1,0, "only");// Rib-1
499 //       gMC->Gspos("FRHL",1, "SQM3", xpos_fr1, ypos_fr1, zpos_fr1,0, "only");// frame -1
500 //       gMC->Gspos("FRHL",1, "SQM4", xpos_fr1, ypos_fr1, zpos_fr1,0, "only");// frame -1
501
502 //......................................................................................
503 //Frame-2
504
505        Float_t frame2[3] ;
506        frame2[0] = 4./2.;
507        frame2[1] = 28.9/2.;
508        frame2[2] = frame1[2];
509
510        Float_t xpos_fr2 = frame1[0]  -frame2[0];
511        Float_t ypos_fr2 = frame2[1]+frame1[1] ;
512        Float_t zpos_fr2 = 0.;
513
514        Float_t rib2[3];
515        rib2[0] = 1./2.;
516        rib2[1] = frame2[1]+0.6;
517        rib2[2] = 1.84/2.;
518
519        Float_t xpos_rb2 = frame2[0] - rib2[0];
520        Float_t ypos_rb2 = - 0.6/2;
521        Float_t zpos_rb2 = frame2[2] + rib2[2];
522
523        gMC->Gsvolu("FR1L", "BOX", idPGF30, frame2, 3); //Frame - 2
524        gMC->Gsvolu("RB1L", "BOX", idPGF30, rib2, 3); //Rib - 2
525
526 //Fixing Screws ...........................................
527    //screw parameters (on Ribs) M4 x 65
528    //Head size & positions remianing the same-----------
529        Float_t spar2[3];
530        spar2[0] = 0.0;
531        spar2[1] = 0.2;
532        spar2[2] = 2.9/2.;
533        gMC->Gsvolu("SCRL","TUBE",idScru, spar2,3);    //screw-vertical part for Rib m4 x 65
534   //positioning head over screws
535        Float_t xpos2_h = 0.0;
536        Float_t ypos2_h = 0.0;
537        Float_t zpos2_h = spar2[2] + s_head[2];
538        gMC->Gspos("HDFL",2,"SCRL",xpos2_h,ypos2_h,zpos2_h,0,"ONLY");//positioning Screw-head
539
540        Float_t xpos2_s = -rib2[0] + 0.4;
541        Float_t ypos2_s = -rib2[1] + 1.7;
542        Float_t zpos2_s = -frame2[2];
543
544        Int_t Tot_Scru2 = 6;   // 6 screws
545        for(Int_t nos2 = 0; nos2 < Tot_Scru2; nos2++)
546           {
547            gMC->Gspos("SCRL",nos2+1,"RB1L",xpos2_s,ypos2_s,zpos2_s,0,"ONLY");
548            ypos2_s += 5.;
549           }
550
551        gMC->Gspos("RB1L",1, "FR1L", xpos_rb2, ypos_rb2, zpos_rb2,0, "only");
552        gMC->Gspos("FR1L",1, "FRHL", xpos_fr2, ypos_fr2, zpos_fr2,0, "only");
553
554 //......................................................................................
555 //Frame-3
556
557       Float_t frame3[3] ;
558       frame3[0] = 4./2.;
559       frame3[1] = 40.67/2.;
560       frame3[2] = frame1[2];
561       Float_t bend_ang = (22.5*PI/180.);  //bending angle of frame-3 w.r.t frame-2
562
563       Float_t xpos_fr3 =-frame3[1]* sin(bend_ang);
564       Float_t ypos_fr3 = frame2[1]+(frame3[1]*cos(bend_ang)-frame3[0]* sin(bend_ang));
565       Float_t zpos_fr3 = 0.;
566
567   //Frame part extended inside
568       Float_t fr_ex[3];
569       fr_ex[0] = 3.53/2.;
570       fr_ex[1] = 56.28/2.;
571       fr_ex[2] = frame1[2];
572
573       Float_t xpos_ex = -frame3[0] - fr_ex[0];
574       Float_t ypos_ex = 0.0;
575       Float_t zpos_ex = 0.0;
576
577       Float_t rib3[3];
578       rib3[0] = 1./2.;
579       rib3[1] = frame3[1];
580       rib3[2] = 1.84/2.;
581
582       Float_t xpos_rb3 = frame3[0] - rib3[0];
583       Float_t ypos_rb3 = 0.0;
584       Float_t zpos_rb3 = frame3[2] + rib3[2];
585
586       gMC->Gsvolu("FR2L", "BOX", idPGF30, frame3, 3); //Frame - 3
587       gMC->Gsvolu("FEXL", "BOX", idPGF30, fr_ex, 3); //frame- extended part
588       gMC->Gsvolu("RB2L", "BOX", idPGF30, rib3, 3); //Rib - 3
589
590       Float_t xpos3_s = -rib3[0] + 0.4;
591       Float_t ypos3_s = -rib3[1] + 1.1;
592       Float_t zpos3_s = -frame3[2];
593
594       Int_t Tot_Scru3 = Tot_Scru2 + 9;      //Toal screw on this rib is 9--index continues
595       for(Int_t nos3 = Tot_Scru2; nos3 < Tot_Scru3; nos3++)
596          {
597           gMC->Gspos("SCRL",nos3+1,"RB2L",xpos3_s,ypos3_s,zpos3_s,0,"ONLY");
598           ypos3_s += 5.;
599          }
600
601       gMC->Gspos("FEXL",1, "FR2L", xpos_ex, ypos_ex, zpos_ex,0, "only");
602       gMC->Gspos("RB2L",1, "FR2L", xpos_rb3, ypos_rb3, zpos_rb3,0, "only");
603       gMC->Gspos("FR2L",1, "FR1L", xpos_fr3, ypos_fr3, zpos_fr3,irot6, "only");
604 //......................................................................................
605 //Frame-4
606
607       Float_t frame4[3] ;
608       frame4[0] = 4./2;
609       frame4[1] = 52.54/2.;
610       frame4[2] = frame1[2];
611
612       Float_t xpos_fr4 =-frame4[1]* sin(bend_ang);
613       Float_t ypos_fr4 = frame3[1]+(frame4[1]*cos(bend_ang)-frame4[0]* sin(bend_ang));
614       Float_t zpos_fr4 =0.;
615
616       Float_t rib4[3];
617       rib4[0] = 1./2.;
618       rib4[1] = frame4[1];
619       rib4[2] = 1.84/2.;
620
621       Float_t xpos_rb4 = frame4[0] - rib4[0];
622       Float_t ypos_rb4 = 0.0;
623       Float_t zpos_rb4 = frame4[2] + rib4[2];
624
625       gMC->Gsvolu("FR3L", "BOX", idPGF30, frame4, 3); //Frame - 4
626       gMC->Gsvolu("RB3L", "BOX", idPGF30, rib4, 3); //Rib - 4
627
628       Float_t xpos4_s = -rib4[0] + 0.4;
629       Float_t ypos4_s = -rib4[1] + 4.33;
630       Float_t zpos4_s = -frame4[2];
631
632       Int_t Tot_Scru4 = Tot_Scru3 + 10;  //Toal screw on this rib is 10--index continues
633       for(Int_t nos4 = Tot_Scru3; nos4 < Tot_Scru4; nos4++)
634          {
635           gMC->Gspos("SCRL",nos4+1,"RB3L",xpos4_s,ypos4_s,zpos4_s,0,"ONLY");
636           ypos4_s += 5.;
637          }
638
639      gMC->Gspos("RB3L",1, "FR3L", xpos_rb4, ypos_rb4, zpos_rb4,0, "only");
640      gMC->Gspos("FR3L",1, "FR2L", xpos_fr4, ypos_fr4, zpos_fr4,irot6, "only");
641 //......................................................................................
642 //Frame-5
643
644       Float_t frame5[3] ;
645       frame5[0] = 4./2;
646       frame5[1] = 41.83/2;
647       frame5[2] = frame1[2];
648
649       Float_t xpos_fr5 =-frame5[1]*sin(bend_ang);
650       Float_t ypos_fr5 = frame4[1]+(frame5[1]*cos(bend_ang)-frame5[0]* sin(bend_ang));
651       Float_t zpos_fr5 = 0.;
652
653       Float_t rib5[3];
654       rib5[0] = 1./2.;
655       rib5[1] = frame5[1];
656       rib5[2] = 1.84/2.;
657
658       Float_t xpos_rb5 = frame5[0] - rib5[0];
659       Float_t ypos_rb5 = 0.0;
660       Float_t zpos_rb5 = frame5[2] + rib5[2];
661
662       gMC->Gsvolu("FR4L", "BOX", idPGF30, frame5, 3); //Frame - 5
663       gMC->Gsvolu("RB4L", "BOX", idPGF30, rib5, 3); //Rib - 5
664
665       Float_t xpos5_s = -rib5[0] + 0.4;
666       Float_t ypos5_s = -rib5[1] + 2.79;
667       Float_t zpos5_s = -frame5[2];
668
669       Int_t Tot_Scru5 = Tot_Scru4 + 8; //Toal screw on this rib is 8--index continues
670       for(Int_t nos5 = Tot_Scru4; nos5 < Tot_Scru5; nos5++)
671          {
672           gMC->Gspos("SCRL",nos5+1,"RB4L",xpos5_s,ypos5_s,zpos5_s,0,"ONLY");
673           ypos5_s += 5.;
674          }
675
676       gMC->Gspos("RB4L",1, "FR4L", xpos_rb5, ypos_rb5, zpos_rb5,0, "only");
677       gMC->Gspos("FR4L",1, "FR3L", xpos_fr5, ypos_fr5, zpos_fr5,irot6, "only");
678 //......................................................................................
679 //Frame-6
680
681       Float_t frame6[3] ;
682       frame6[0] = 3./2.;
683       frame6[1] = 30.84/2.;
684       frame6[2] = frame1[2];
685
686       Float_t xpos_fr6 = (-frame6[1]*sin(bend_ang))+0.5;
687       Float_t ypos_fr6 = frame5[1]+(frame6[1]*cos(bend_ang)-frame6[0]* sin(bend_ang));
688       Float_t zpos_fr6 = 0;
689
690       Float_t rib6[3];
691       rib6[0] = 1./2.;
692       rib6[1] = frame6[1]+0.8;
693       rib6[2] = 1.84/2.;
694
695       Float_t xpos_rb6 = frame6[0] - rib6[0];
696       Float_t ypos_rb6 = 0.4;
697       Float_t zpos_rb6 = frame6[2] + rib6[2];
698
699       gMC->Gsvolu("FR5L", "BOX", idPGF30, frame6, 3); //Frame - 6
700       gMC->Gsvolu("RB5L", "BOX", idPGF30, rib6, 3); //Rib - 6
701
702       Float_t xpos6_s = -rib6[0] + 0.4;
703       Float_t ypos6_s = -rib6[1] + 1.36;
704       Float_t zpos6_s = -frame6[2];
705
706       Int_t Tot_Scru6 = Tot_Scru5 + 6;      //Toal screw on this rib is 7--index continues
707       for(Int_t nos6 = Tot_Scru5; nos6 < Tot_Scru6; nos6++)
708          {
709           gMC->Gspos("SCRL",nos6+1,"RB5L",xpos6_s,ypos6_s,zpos6_s,0,"ONLY");
710           ypos6_s += 5.;
711          }
712
713       gMC->Gspos("RB5L",1, "FR5L", xpos_rb6, ypos_rb6, zpos_rb6,0, "only");
714       gMC->Gspos("FR5L",1, "FR4L", xpos_fr6, ypos_fr6, zpos_fr6,irot6, "only");
715 //......................................................................................
716 //Frame-7 Vertical frame
717
718       Float_t frame7[3] ;
719       frame7[0] = 2.7/2.;
720       frame7[1] = 97.9/2.;
721       frame7[2] = .95/2.;
722
723       Float_t rib7[3];
724       rib7[0] = 1./2.;
725       rib7[1] = frame7[1] - .9/2.;
726       rib7[2] = 1.84/2.;
727
728       Float_t xpos_fr7 =  frame7[0] -3.7;
729       Float_t ypos_fr7 =  frame7[1] +20.6;
730       Float_t zpos_fr7 = frame7[2];
731
732       Float_t xpos_rb7 = -frame7[0] + rib7[0]+0.9;
733       Float_t ypos_rb7 = .9/2.;
734       Float_t zpos_rb7 =  frame7[2] + rib7[2];
735
736       gMC->Gsvolu("FRVL", "BOX", idPGF30, frame7, 3); //Frame - vertical
737       gMC->Gsvolu("RBVL", "BOX", idPGF30, rib7, 3); //Rib
738
739   //Fixing Screws-- screw parameter and screw-head are taken from horizontal frame bar
740       gMC->Gsvolu("SCVL","TUBE",idScru, spar,3);    //screw-vertical part for Frame M4 x 25
741   //positioning head over screws
742       gMC->Gspos("HDFL",3,"SCVL",xpos_h,ypos_h,zpos_h,0,"ONLY");//positioning Screw-head
743  //Screws on Frame
744       Float_t xposv_s = -frame7[0] + 0.4;
745       Float_t yposv_s = -frame7[1] + 0.4;
746       Float_t zposv_s =  0.0;
747
748       Int_t Tot_Scru_v = 20;   //Total no. of Screws
749       for(Int_t nos_v = 0; nos_v < Tot_Scru_v; nos_v++)
750          {
751           gMC->Gspos("SCVL",nos_v+1,"FRVL",xposv_s,yposv_s,zposv_s,0,"ONLY");
752           yposv_s += 5.;
753          } // nos2 is no. of scru
754
755       gMC->Gspos("RBVL",1, "FRVL", xpos_rb7, ypos_rb7, zpos_rb7,0, "only");
756 //    gMC->Gspos("FRVL",1, "SQM3", xpos_fr7, ypos_fr7, zpos_fr7,0, "only");// frame vertical
757 //    gMC->Gspos("FRVL",1, "SQM4", xpos_fr7, ypos_fr7, zpos_fr7,0, "only");// frame vertical
758
759 //......................................................................................
760 //Frame - inner
761       Float_t fr_c[5];   //semi-circular frame
762       fr_c[0] = 20.6;
763       fr_c[1] = 23.1;
764       fr_c[2] = 0.95/2.;
765       fr_c[3] = -3.5;
766       fr_c[4] = 93.5;
767
768       Float_t xpos_frc = 0.0;
769       Float_t ypos_frc = 0.0;
770       Float_t zpos_frc = fr_c[2];
771
772       Float_t rib_c[5];
773       rib_c[0] = 21.5;
774       rib_c[1] = 22.5;
775       rib_c[2] = 1.84/2.;
776       rib_c[3] = fr_c[3]-2.0;
777       rib_c[4] = fr_c[4]+2.0;
778
779       Float_t xpos_rc = 0.0;
780       Float_t ypos_rc = 0.0;
781       Float_t zpos_rc = fr_c[2] + rib_c[2];
782
783       gMC->Gsvolu("FRCL", "TUBS", idPGF30, fr_c, 5); //Frame - semi circular
784       gMC->Gsvolu("RBCL", "TUBS", idPGF30, rib_c, 5); //Rib
785
786 //Screws
787       gMC->Gsvolu("SCYL","TUBE",idScru, spar,3);    //screw-vertical part for extended part in -Y
788       gMC->Gsvolu("SCIL","TUBE",idScru, spar,3);    //screw-vertical part
789       gMC->Gsvolu("SCXL","TUBE",idScru, spar,3);    //screw-vertical part for extended part in -X
790       gMC->Gspos("HDFL",3,"SCIL",xpos_h,ypos_h,zpos_h,0,"ONLY");//positioning Screw-head
791
792     // on circular part
793       Float_t zpos_is2 = 0.0;
794       Float_t theta[7];
795       Float_t radius = fr_c[0] + 0.4 ;   //inner radius + 0.4
796       Float_t arc = 3.667;  // for 10-degree angle
797       for(Int_t i = 0; i<8; i++)
798          {
799           theta[i] = arc/radius;
800           Float_t xpos_is2 = radius * cos(theta[i]);
801           Float_t ypos_is2 = radius * sin(theta[i]);
802           gMC->Gspos("SCIL",i+1,"FRCL",xpos_is2, ypos_is2, zpos_is2,0,"ONLY");
803           arc +=3.667;
804          }
805
806
807
808       gMC->Gspos("RBCL",1, "FRCL", xpos_rc, ypos_rc, zpos_rc,0, "only");  //Rib
809
810        gMC->Gspos("FRHL",1, "SQM3", xpos_fr1, ypos_fr1, zpos_fr1,0, "only");// frame -1
811        gMC->Gspos("FRHL",1, "SQM4", xpos_fr1, ypos_fr1, zpos_fr1,0, "only");// frame -1
812
813        gMC->Gspos("FRVL",1, "SQM3", xpos_fr7, ypos_fr7, zpos_fr7,0, "only");// frame vertical
814        gMC->Gspos("FRVL",1, "SQM4", xpos_fr7, ypos_fr7, zpos_fr7,0, "only");// frame vertical
815
816        gMC->Gspos("FRCL",1, "SQM3", xpos_frc, ypos_frc, zpos_frc,0, "only");// frame semi circular
817        gMC->Gspos("FRCL",1, "SQM4", xpos_frc, ypos_frc, zpos_frc,0, "only");// frame semi circular
818
819 //=============================================================================================
820
821 //                                   Plane - 2
822
823 //=============================================================================================
824
825  //Cathode PCB + Copper sheet over PCB + Roha cell over copper sheet
826
827 //Segment - 0
828        bpar_h[0] = 95.5/2.;
829        bpar_h[1] = 1.6/2.;
830        bpar_h[2] = zcbb/2.;
831        gMC->Gsvolu("CB0R", "BOX", idPCB, bpar_h, 3);
832
833        bpar_h[2] = zcu/2.;     //Thickness of Copper sheet
834        gMC->Gsvolu("CU0R", "BOX", idCU, bpar_h, 3);
835
836        bpar_h[2] = zRoha/2.;     //Thickness of Roha cell
837        gMC->Gsvolu("RH0R", "BOX", idRoha, bpar_h, 3);
838
839        bpar_h[0] = (100.6/2)-(0.9/2);
840        bpar_h[1] = 2.8/2.;
841        bpar_h[2] = zmeb/2.;
842        gMC->Gsvolu("MB0R", "BOX", idPCB, bpar_h, 3);
843
844        bpar_h[2] = zcu2/2;
845        gMC->Gsvolu("EB0R", "BOX", idCU, bpar_h, 3);
846
847 //Segment-1
848         pgpar[1] = 13.;
849         pgpar[5] = 22.5;
850         pgpar[6] = 120.2;
851         pgpar[7] = pgpar[4] - zcbb;
852         pgpar[8] = pgpar[5];
853         pgpar[9] = pgpar[6];
854         gMC->Gsvolu("CB1R", "PGON", idPCB, pgpar, 10);
855
856         pgpar[7] = pgpar[4] - zcu;  // Thickness of copper-sheet
857         gMC->Gsvolu("CU1R", "PGON", idCU, pgpar, 10);
858
859         pgpar[7] = pgpar[4] - zRoha;  // Thickness of Roha cell
860         gMC->Gsvolu("RH1R", "PGON", idRoha, pgpar, 10);
861
862         pgpar[5] = 21.5; // radius of inner rib
863         pgpar[6] = 121.2;
864         pgpar[7] = pgpar[4] - zmeb;
865         pgpar[8] = pgpar[5];
866         pgpar[9] = pgpar[6];
867         gMC->Gsvolu("MB1R", "PGON", idPCB, pgpar, 10);
868
869         pgpar[7] = pgpar[4] - zcu2;
870         gMC->Gsvolu("EB1R", "PGON", idCU, pgpar, 10);
871
872 //Segment-2
873
874         pgpar[1] = 21.;
875         pgpar[5] = 22.5;
876         pgpar[6] = 121.5;
877         pgpar[7] = pgpar[4] - zcbb;
878         pgpar[8] = pgpar[5];
879         pgpar[9] = pgpar[6];
880         gMC->Gsvolu("CB2R", "PGON", idPCB, pgpar, 10);
881
882         pgpar[7] = pgpar[4] - zcu;  // Thickness of copper-sheet
883         gMC->Gsvolu("CU2R", "PGON", idCU, pgpar, 10);
884
885         pgpar[7] = pgpar[4] - zRoha;  // Thickness of Roha cell
886         gMC->Gsvolu("RH2R", "PGON", idRoha, pgpar, 10);
887
888         pgpar[5] = 21.5; // radius of inner rib
889         pgpar[6] = 122.5;
890         pgpar[7] = pgpar[4] - zmeb;
891         pgpar[8] = pgpar[5];
892         pgpar[9] = pgpar[6];
893         gMC->Gsvolu("MB2R", "PGON", idPCB, pgpar, 10);
894
895         pgpar[7] = pgpar[4] - zcu2;
896         gMC->Gsvolu("EB2R", "PGON", idCU, pgpar, 10);
897
898 //Segment-3
899
900         pgpar[1] = 22.;
901         pgpar[5] = 22.5;
902         pgpar[6] = 119.9;
903         pgpar[7] = pgpar[4] - zcbb;
904         pgpar[8] = pgpar[5];
905         pgpar[9] = pgpar[6];
906         gMC->Gsvolu("CB3R", "PGON", idPCB, pgpar, 10);
907
908         pgpar[7] = pgpar[4] - zcu;  // Thickness of copper-sheet
909         gMC->Gsvolu("CU3R", "PGON", idCU, pgpar, 10);
910
911         pgpar[7] = pgpar[4] - zRoha;  // Thickness of Roha cell
912         gMC->Gsvolu("RH3R", "PGON", idRoha, pgpar, 10);
913
914         pgpar[5] = 21.5; // radius of inner rib
915         pgpar[6] = 120.9;
916         pgpar[7] = pgpar[4] - zmeb;
917         pgpar[8] = pgpar[5];
918         pgpar[9] = pgpar[6];
919         gMC->Gsvolu("MB3R", "PGON", idPCB, pgpar, 10);
920
921         pgpar[7] = pgpar[4] - zcu2;
922         gMC->Gsvolu("EB3R", "PGON", idCU, pgpar, 10);
923
924 //Segment-4
925
926         pgpar[1] = 20.;
927         pgpar[5] = 22.5;
928         pgpar[6] = 119.9;
929         pgpar[7] = pgpar[4] - zcbb;
930         pgpar[8] = pgpar[5];
931         pgpar[9] = pgpar[6];
932         gMC->Gsvolu("CB4R", "PGON", idPCB, pgpar, 10);
933
934         pgpar[7] = pgpar[4] - zcu;  // Thickness of copper-sheet
935         gMC->Gsvolu("CU4R", "PGON", idCU, pgpar, 10);
936
937         pgpar[7] = pgpar[4] - zRoha;  // Thickness of Roha cell
938         gMC->Gsvolu("RH4R", "PGON", idRoha, pgpar, 10);
939
940         pgpar[5] = 21.5; // radius of inner rib
941         pgpar[6] = 120.9;
942         pgpar[7] = pgpar[4] - zmeb;
943         pgpar[8] = pgpar[5];
944         pgpar[9] = pgpar[6];
945         gMC->Gsvolu("MB4R", "PGON", idPCB, pgpar, 10);
946
947         pgpar[7] = pgpar[4] - zcu2;
948         gMC->Gsvolu("EB4R", "PGON", idCU, pgpar, 10);
949
950 //Segment-5
951
952         pgpar[1] = 14.;
953         pgpar[5] = 22.5;
954         pgpar[6] = 117.5;
955         pgpar[7] = pgpar[4] - zcbb;
956         pgpar[8] = pgpar[5];
957         pgpar[9] = pgpar[6];
958         gMC->Gsvolu("CB5R", "PGON", idPCB, pgpar, 10);
959
960         pgpar[7] = pgpar[4] - zcu;  // Thickness of copper-sheet
961         gMC->Gsvolu("CU5R", "PGON", idCU, pgpar, 10);
962
963         pgpar[7] = pgpar[4] - zRoha;  // Thickness of Roha cell
964         gMC->Gsvolu("RH5R", "PGON", idRoha, pgpar, 10);
965
966         pgpar[5] = 21.5;// radius of inner rib
967         pgpar[6] = 118.5;
968         pgpar[7] = pgpar[4] - zmeb;
969         pgpar[8] = pgpar[5];
970         pgpar[9] = pgpar[6];
971         gMC->Gsvolu("MB5R", "PGON", idPCB, pgpar, 10);
972
973         pgpar[7] = pgpar[4] - zcu2;
974         gMC->Gsvolu("EB5R", "PGON", idCU, pgpar, 10);
975
976 //Segment-6 - vertical box
977
978         bpar_v[0] = 1.6/2.;
979         bpar_v[1] = 95.5/2.;
980         bpar_v[2] = zcbb/2.;
981         gMC->Gsvolu("CB6R", "BOX", idPCB, bpar_v, 3);
982         bpar_v[2] = zcu/2.;
983         gMC->Gsvolu("CU6R", "BOX", idCU, bpar_v, 3);
984
985         bpar_v[2] = zRoha/2.;
986         gMC->Gsvolu("RH6R", "BOX", idRoha, bpar_v, 3);
987
988         bpar_v[0] = 2.8/2.;
989         bpar_v[1] = (97.9/2)-(0.9/2.);
990         bpar_v[2] = zmeb/2;
991         gMC->Gsvolu("MB6R", "BOX", idPCB, bpar_v, 3);
992
993         bpar_v[2] = zcu2/2;
994         gMC->Gsvolu("EB6R", "BOX", idCU, bpar_v, 3);
995
996
997 //...........................................................................................
998 //Positioning of Electronic exit board
999      gMC->Gspos("EB0R",1, "MB0R", 0.,0.,-zpos_eeb_bar,0, "only");
1000      gMC->Gspos("EB1R",1, "MB1R", 0.,0.,-zpos_cu2,0, "only");
1001      gMC->Gspos("EB2R",1, "MB2R", 0.,0.,-zpos_cu2,0, "only");
1002      gMC->Gspos("EB3R",1, "MB3R", 0.,0.,-zpos_cu2,0, "only");
1003      gMC->Gspos("EB4R",1, "MB4R", 0.,0.,-zpos_cu2,0, "only");
1004      gMC->Gspos("EB5R",1, "MB5R", 0.,0.,-zpos_cu2,0, "only");
1005      gMC->Gspos("EB6R",1, "MB6R", 0.,0.,-zpos_eeb_bar,0, "only");
1006
1007 //Positioning of Mech. exit board
1008      xpos_meb_hor =  1.1;
1009      ypos_meb_hor = -0.6;
1010      xpos_meb_ver = -0.6;
1011      ypos_meb_ver = -0.35;
1012
1013      gMC->Gspos("MB0R",1, "RH0R", xpos_meb_hor,ypos_meb_hor,-zpos_meb_bar,0, "only");
1014      gMC->Gspos("MB1R",1, "RH1R", 0.,0.,-zpos_meb,0, "only");
1015      gMC->Gspos("MB2R",1, "RH2R", 0.,0.,-zpos_meb,0, "only");
1016      gMC->Gspos("MB3R",1, "RH3R", 0.,0.,-zpos_meb,0, "only");
1017      gMC->Gspos("MB4R",1, "RH4R", 0.,0.,-zpos_meb,0, "only");
1018      gMC->Gspos("MB5R",1, "RH5R", 0.,0.,-zpos_meb,0, "only");
1019      gMC->Gspos("MB6R",1, "RH6R", xpos_meb_ver,ypos_meb_ver,-zpos_meb_bar,0, "only");
1020
1021 //Positioning Roha cell over copper sheet
1022      gMC->Gspos("RH0R",1, "CU0R", 0.,0.,-zpos_Roha_bar,0, "only");// box horizontal
1023      gMC->Gspos("RH1R",1, "CU1R", 0.,0.,-zpos_Roha,0, "only");
1024      gMC->Gspos("RH2R",1, "CU2R", 0.,0.,-zpos_Roha,0, "only");
1025      gMC->Gspos("RH3R",1, "CU3R", 0.,0.,-zpos_Roha,0, "only");
1026      gMC->Gspos("RH4R",1, "CU4R", 0.,0.,-zpos_Roha,0, "only");
1027      gMC->Gspos("RH5R",1, "CU5R", 0.,0.,-zpos_Roha,0, "only");
1028      gMC->Gspos("RH6R",1, "CU6R", 0.,0.,-zpos_Roha_bar,0, "only");
1029
1030 //Positioning Copper sheet over PCB
1031      gMC->Gspos("CU0R",1, "CB0R", 0.,0.,-zpos_cubar,0, "only");// box horizontal
1032      gMC->Gspos("CU1R",1, "CB1R", 0.,0.,-zpos_cu,0, "only");
1033      gMC->Gspos("CU2R",1, "CB2R", 0.,0.,-zpos_cu,0, "only");
1034      gMC->Gspos("CU3R",1, "CB3R", 0.,0.,-zpos_cu,0, "only");
1035      gMC->Gspos("CU4R",1, "CB4R", 0.,0.,-zpos_cu,0, "only");
1036      gMC->Gspos("CU5R",1, "CB5R", 0.,0.,-zpos_cu,0, "only");
1037      gMC->Gspos("CU6R",1, "CB6R", 0.,0.,-zpos_cubar,0, "only");
1038
1039
1040 //Positioning the PCB
1041      x_hor_pos = 95.5/2.+ 22.6; // 22.6 is inner radius of PCB
1042      y_hor_pos = -(1.6/2); //
1043
1044      x_ver_pos = -(1.6/2); //
1045      y_ver_pos = 95.5/2.+ 22.6;
1046
1047      gMC->Gspos("CB0R",1, "SQM3", x_hor_pos,-bpar_h[1],-zpos_cbb_bar,0, "only");// box horizontal
1048      gMC->Gspos("CB1R",1, "SQM3", 0.,0.,-zpos_cbb,0, "only");
1049      gMC->Gspos("CB2R",1, "SQM3", 0.,0.,-zpos_cbb,irot1,"only");
1050      gMC->Gspos("CB3R",1, "SQM3", 0.,0.,-zpos_cbb,irot2, "only");
1051      gMC->Gspos("CB4R",1, "SQM3", 0.,0.,-zpos_cbb,irot3, "only");
1052      gMC->Gspos("CB5R",1, "SQM3", 0.,0.,-zpos_cbb,irot4, "only");
1053      gMC->Gspos("CB6R",1, "SQM3", x_ver_pos,y_ver_pos,-zpos_cbb_bar,0, "only");// box vertical
1054
1055      gMC->Gspos("CB0R",1, "SQM4", x_hor_pos,-bpar_h[1],-zpos_cbb_bar,0, "only");// box horizontal
1056      gMC->Gspos("CB1R",1, "SQM4", 0.,0.,-zpos_cbb,0, "only");
1057      gMC->Gspos("CB2R",1, "SQM4", 0.,0.,-zpos_cbb,irot1,"only");
1058      gMC->Gspos("CB3R",1, "SQM4", 0.,0.,-zpos_cbb,irot2, "only");
1059      gMC->Gspos("CB4R",1, "SQM4", 0.,0.,-zpos_cbb,irot3, "only");
1060      gMC->Gspos("CB5R",1, "SQM4", 0.,0.,-zpos_cbb,irot4, "only");
1061      gMC->Gspos("CB6R",1, "SQM4", x_ver_pos,y_ver_pos,-zpos_cbb_bar,0, "only");// box vertical
1062
1063 //----------------------------------------------------------------------
1064 //                          Frames P2
1065 //----------------------------------------------------------------------
1066 //Frame-1 P2
1067
1068        ypos_s = -frame1[1] + 0.4;
1069        zpos_fr1 = -frame1[2];
1070
1071        zpos_rb1 = -(frame1[2] + rib1[2]);
1072
1073        gMC->Gsvolu("FRHR", "BOX", idPGF30, frame1, 3); //Frame - 1 P2
1074        gMC->Gsvolu("RBHR", "BOX", idPGF30, rib1, 3);   //Rib - 1 P2
1075
1076    //Fixing Screws ...........................................
1077
1078        zpos_h = -(spar[2] + s_head[2]);
1079
1080        gMC->Gsvolu("SCHR","TUBE",idScru, spar,3);    //screw-vertical part for Frame M4 x 25
1081        gMC->Gsvolu("HDFR","TUBE",idScru, s_head,3);    //screw-head
1082    //positioning head over screws
1083        gMC->Gspos("HDFR",1,"SCHR",xpos_h,ypos_h,zpos_h,0,"ONLY");//positioning Screw-head
1084
1085    //Screws on Frame
1086
1087        xpos_s = frame1[0] - 0.4;
1088
1089        Tot_Scru1 = 21;   //Total no. of Scru
1090        for(Int_t nos1 = 0; nos1 < Tot_Scru1; nos1++)
1091           {
1092            gMC->Gspos("SCHR",nos1+1,"FRHR",xpos_s,ypos_s,zpos_s,irot1,"ONLY");
1093            xpos_s -= 5.;
1094           } // nos1 is no. of scru
1095
1096        gMC->Gspos("RBHR",1,"FRHR",xpos_rb1,ypos_rb1,zpos_rb1,0, "only");
1097        gMC->Gspos("FRHR",1,"SQM3",xpos_fr1,ypos_fr1,zpos_fr1,0, "only");
1098        gMC->Gspos("FRHR",1,"SQM4",xpos_fr1,ypos_fr1,zpos_fr1,0, "only");
1099
1100 //......................................................................................
1101
1102 //Frame-2
1103
1104       zpos_rb2 = -(frame2[2] + rib2[2]);
1105
1106       gMC->Gsvolu("FR1R", "BOX", idPGF30, frame2, 3); //Frame - 2
1107       gMC->Gsvolu("RB1R", "BOX", idPGF30, rib2, 3);   //Rib - 2
1108
1109 //Fixing Screws ...........................................
1110 //---------screw parameters (on Ribs) M4
1111
1112        spar2[2] = 2.9/2.;
1113        gMC->Gsvolu("SCRR","TUBE",idScru, spar2,3); //screw-vertical part for Rib m4
1114    //positioning head over screws
1115
1116        zpos2_h = -(spar2[2] + s_head[2]);
1117        gMC->Gspos("HDFR",2,"SCRR",xpos2_h,ypos2_h,zpos2_h,0,"ONLY");//positioning Screw-head
1118
1119        ypos2_s = -rib2[1] + 1.7;
1120        zpos2_s = frame2[2];
1121
1122        Tot_Scru2 = 6;   // 6 screws
1123        for(Int_t nos2 = 0; nos2 < Tot_Scru2; nos2++)
1124           {
1125            gMC->Gspos("SCRR",nos2+1,"RB1R",xpos2_s,ypos2_s,zpos2_s,0,"ONLY");
1126            ypos2_s += 5.;
1127           }
1128
1129        gMC->Gspos("RB1R",1, "FR1R", xpos_rb2, ypos_rb2, zpos_rb2,0, "only");
1130        gMC->Gspos("FR1R",1, "FRHR", xpos_fr2, ypos_fr2, zpos_fr2,0, "only");
1131
1132 //......................................................................................
1133
1134 //Frame-3 P2
1135
1136        zpos_rb3 = -(frame3[2] + rib3[2]);
1137
1138        gMC->Gsvolu("FR2R", "BOX", idPGF30, frame3, 3); //Frame - 3
1139        gMC->Gsvolu("FEXR", "BOX", idPGF30, fr_ex, 3); //frame- extended part
1140        gMC->Gsvolu("RB2R", "BOX", idPGF30, rib3, 3); //Rib - 3
1141
1142    //Fixing Screws ...........................................
1143         ypos3_s = -rib3[1] + 1.1;
1144         zpos3_s = frame3[2];
1145
1146         Tot_Scru3 = Tot_Scru2 + 9;      //Toal screw on this rib is 9--index continues
1147         for(Int_t nos3 = Tot_Scru2; nos3 < Tot_Scru3; nos3++)
1148            {
1149             gMC->Gspos("SCRR",nos3+1,"RB2R",xpos3_s,ypos3_s,zpos3_s,0,"ONLY");
1150             ypos3_s += 5.;
1151            }
1152
1153         gMC->Gspos("FEXR",1, "FR2R", xpos_ex, ypos_ex, zpos_ex,0, "only");
1154         gMC->Gspos("RB2R",1, "FR2R", xpos_rb3, ypos_rb3, zpos_rb3,0, "only");
1155         gMC->Gspos("FR2R",1, "FR1R", xpos_fr3, ypos_fr3, zpos_fr3,irot6, "only");
1156 //......................................................................................
1157
1158 //Frame-4 P2
1159
1160         zpos_rb4 = -(frame4[2] + rib4[2]);
1161
1162         gMC->Gsvolu("FR3R", "BOX", idPGF30, frame4, 3); //Frame - 4
1163         gMC->Gsvolu("RB3R", "BOX", idPGF30, rib4, 3); //Rib - 4
1164
1165    //Fixing Screws ...........................................
1166
1167         ypos4_s = -rib4[1] + 4.33;
1168         zpos4_s = frame4[2];
1169
1170         Tot_Scru4 = Tot_Scru3 + 10;      //Toal screw on this rib is 10--index continues
1171         for(Int_t nos4 = Tot_Scru3; nos4 < Tot_Scru4; nos4++)
1172            {
1173             gMC->Gspos("SCRR",nos4+1,"RB3R",xpos4_s,ypos4_s,zpos4_s,0,"ONLY");
1174             ypos4_s += 5.;
1175            }
1176
1177         gMC->Gspos("RB3R",1, "FR3R", xpos_rb4, ypos_rb4, zpos_rb4,0, "only");
1178         gMC->Gspos("FR3R",1, "FR2R", xpos_fr4, ypos_fr4, zpos_fr4,irot6, "only");
1179 //......................................................................................
1180 //Frame-5 P2
1181
1182         zpos_rb5 = -(frame5[2] + rib5[2]);
1183
1184         gMC->Gsvolu("FR4R", "BOX", idPGF30, frame5, 3); //Frame - 5
1185         gMC->Gsvolu("RB4R", "BOX", idPGF30, rib5, 3); //Rib - 5
1186
1187      //Fixing Screws ...........................................
1188
1189         ypos5_s = -rib5[1] + 2.79;
1190         zpos5_s = frame5[2];
1191
1192         Tot_Scru5 = Tot_Scru4 + 8;      //Toal screw on this rib is 8--index continues
1193         for(Int_t nos5 = Tot_Scru4; nos5 < Tot_Scru5; nos5++)
1194            {
1195             gMC->Gspos("SCRR",nos5+1,"RB4R",xpos5_s,ypos5_s,zpos5_s,0,"ONLY");
1196             ypos5_s += 5.;
1197            }
1198
1199         gMC->Gspos("RB4R",1, "FR4R", xpos_rb5, ypos_rb5, zpos_rb5,0, "only");
1200         gMC->Gspos("FR4R",1, "FR3R", xpos_fr5, ypos_fr5, zpos_fr5,irot6, "only");
1201 //......................................................................................
1202 //Frame-6 P2
1203
1204         zpos_rb6 = -(frame6[2] + rib6[2]);
1205
1206         gMC->Gsvolu("FR5R", "BOX", idPGF30, frame6, 3); //Frame - 6
1207         gMC->Gsvolu("RB5R", "BOX", idPGF30, rib6, 3); //Rib - 6
1208
1209      //Fixing Screws ...........................................
1210
1211         ypos6_s = -rib6[1] + 1.36;
1212         zpos6_s = frame6[2];
1213
1214         Tot_Scru6 = Tot_Scru5 + 6;      //Toal screw on this rib is 7--index continues
1215         for(Int_t nos6 = Tot_Scru5; nos6 < Tot_Scru6; nos6++)
1216            {
1217             gMC->Gspos("SCRR",nos6+1,"RB5R",xpos6_s,ypos6_s,zpos6_s,0,"ONLY");
1218             ypos6_s += 5.;
1219            }
1220
1221         gMC->Gspos("RB5R",1, "FR5R", xpos_rb6, ypos_rb6, zpos_rb6,0, "only");
1222         gMC->Gspos("FR5R",1, "FR4R", xpos_fr6, ypos_fr6, zpos_fr6,irot6, "only");
1223 //......................................................................................
1224
1225 //Frame-7 Vertical frame P2
1226
1227         zpos_fr7 = -frame7[2];
1228         zpos_rb7 =  -(frame7[2] + rib7[2]);
1229
1230         gMC->Gsvolu("FRVR", "BOX", idPGF30, frame7, 3); //Frame - vertical
1231         gMC->Gsvolu("RBVR", "BOX", idPGF30, rib7, 3); //Rib
1232
1233    //Fixing Screws-- screw parameter and screw-head are taken from horizontal frame bar
1234         gMC->Gsvolu("SCVR","TUBE",idScru, spar,3);    //screw-vertical part for Frame M4
1235    //positioning head over screws
1236         gMC->Gspos("HDFR",3,"SCVR",xpos_h,ypos_h,zpos_h,0,"ONLY");//positioning Screw-head
1237
1238        //Screws on Frame
1239        yposv_s = -frame7[1] + 0.4;
1240        zposv_s =  0.0;
1241
1242        Tot_Scru_v = 20;   //Total no. of Screws
1243        for(Int_t nos_v = 0; nos_v < Tot_Scru_v; nos_v++)
1244           {
1245            gMC->Gspos("SCVR",nos_v+1,"FRVR",xposv_s,yposv_s,zposv_s,0,"ONLY");
1246            yposv_s += 5.;
1247           }
1248
1249        gMC->Gspos("RBVR",1, "FRVR", xpos_rb7, ypos_rb7, zpos_rb7,0, "only");
1250        gMC->Gspos("FRVR",1, "SQM3", xpos_fr7, ypos_fr7, zpos_fr7,0, "only");// frame vertical
1251        gMC->Gspos("FRVR",1, "SQM4", xpos_fr7, ypos_fr7, zpos_fr7,0, "only");// frame vertical
1252
1253 //......................................................................................
1254 //Frame - inner
1255
1256        zpos_frc = - fr_c[2];
1257        zpos_rc = -(fr_c[2] + rib_c[2]);
1258
1259        gMC->Gsvolu("FRCR", "TUBS", idPGF30, fr_c, 5); //Frame - semi circular
1260        gMC->Gsvolu("RBCR", "TUBS", idPGF30, rib_c, 5); //Rib
1261
1262    //Screws -------------------------------------------------------
1263        gMC->Gsvolu("SCYR","TUBE",idScru, spar,3);    //screw-vertical part for extended part in -Y
1264        gMC->Gsvolu("SCIR","TUBE",idScru, spar,3);    //screw-vertical part
1265        gMC->Gsvolu("SCXR","TUBE",idScru, spar,3);    //screw-vertical part for extended part in -X
1266        gMC->Gspos("HDFR",3,"SCIR",xpos_h,ypos_h,zpos_h,0,"ONLY");//positioning Screw-head
1267
1268    // on circular part
1269       radius = fr_c[0] + 0.4 ;   //inner radius + 0.4
1270       zpos_is2 = 0.0;
1271       arc = 3.667;  // for 10-degree angle
1272       for(Int_t i = 0; i<8; i++)
1273          {
1274           theta[i] = arc/radius;
1275           Float_t xpos_is2 = radius * cos(theta[i]);
1276           Float_t ypos_is2 = radius * sin(theta[i]);
1277           gMC->Gspos("SCIR",i+1,"FRCR",xpos_is2, ypos_is2, zpos_is2,0,"ONLY");
1278           arc +=3.667;
1279          }
1280
1281       gMC->Gspos("RBCR",1, "FRCR", xpos_rc, ypos_rc, zpos_rc,0, "only");  //Rib
1282       gMC->Gspos("FRCR",1, "SQM3", xpos_frc, ypos_frc, zpos_frc,0, "only");// frame semi circular
1283       gMC->Gspos("FRCR",1, "SQM4", xpos_frc, ypos_frc, zpos_frc,0, "only");// frame semi circular
1284
1285
1286 //Plane 2 -----------------------------------------------------------------------------------
1287
1288 //^^^^^^^^^^^^^^^^^^^^^^^^^ Sensitive volumes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1289
1290        Float_t zsenv = 0.5; // distance between two cathode plane
1291
1292  //Segment-0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1293        bpar_h[0] = 95.5/2.;
1294        bpar_h[1] = 1.6/2.;
1295        bpar_h[2] = zsenv/2.;
1296        gMC->Gsvolu("C3G0", "BOX", idGas, bpar_h, 3);
1297        gMC->Gsvolu("C4G0", "BOX", idGas, bpar_h, 3);
1298
1299  //Segment-1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1300         pgpar[0] = 0.;
1301         pgpar[1] = 13.;
1302         pgpar[2] = 1.;
1303         pgpar[3] = 2.;
1304         pgpar[4] = -zsenv/2.;
1305         pgpar[5] = 22.5;
1306         pgpar[6] = 117.2;
1307         pgpar[7] = zsenv/2.;
1308         pgpar[8] = pgpar[5];
1309         pgpar[9] = pgpar[6];
1310         gMC->Gsvolu("C3G1", "PGON", idGas, pgpar, 10);
1311         gMC->Gsvolu("C4G1", "PGON", idGas, pgpar, 10);
1312
1313 //Segment-2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1314         pgpar[0] = 0.;
1315         pgpar[1] = 21.;
1316         pgpar[2] = 1.;
1317         pgpar[3] = 2.;
1318         pgpar[4] = -zsenv/2.;
1319         pgpar[5] = 22.5;
1320         pgpar[6] = 115.0;
1321         pgpar[7] = zsenv/2.;
1322         pgpar[8] = pgpar[5];
1323         pgpar[9] = pgpar[6];
1324         gMC->Gsvolu("C3G2", "PGON", idGas, pgpar, 10);
1325         gMC->Gsvolu("C4G2", "PGON", idGas, pgpar, 10);
1326
1327 //Segment-3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1328         pgpar[0] = 0.;
1329         pgpar[1] = 22.;
1330         pgpar[2] = 1.;
1331         pgpar[3] = 2.;
1332         pgpar[4] = -zsenv/2.;
1333         pgpar[5] = 22.5;
1334         pgpar[6] = 116.9;
1335         pgpar[7] = zsenv/2.;
1336         pgpar[8] = pgpar[5];
1337         pgpar[9] = pgpar[6];
1338         gMC->Gsvolu("C3G3", "PGON", idGas, pgpar, 10);
1339         gMC->Gsvolu("C4G3", "PGON", idGas, pgpar, 10);
1340
1341 //Segment-4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1342         pgpar[0] = 0.;
1343         pgpar[1] = 20.;
1344         pgpar[2] = 1.;
1345         pgpar[3] = 2.;
1346         pgpar[4] = -zsenv/2.;
1347         pgpar[5] = 22.5;
1348         pgpar[6] = 116.9;
1349         pgpar[7] = zsenv/2.;
1350         pgpar[8] = pgpar[5];
1351         pgpar[9] = pgpar[6];
1352         gMC->Gsvolu("C3G4", "PGON", idGas, pgpar, 10);
1353         gMC->Gsvolu("C4G4", "PGON", idGas, pgpar, 10);
1354
1355 //Segment-5 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1356         pgpar[0] = 0.;
1357         pgpar[1] = 14.;
1358         pgpar[2] = 1.;
1359         pgpar[3] = 2.;
1360         pgpar[4] = -zsenv/2.;
1361         pgpar[5] = 22.5;
1362         pgpar[6] = 115.5;
1363         pgpar[7] = zsenv/2.;
1364         pgpar[8] = pgpar[5];
1365         pgpar[9] = pgpar[6];
1366         gMC->Gsvolu("C3G5", "PGON", idGas, pgpar, 10);
1367         gMC->Gsvolu("C4G5", "PGON", idGas, pgpar, 10);
1368
1369 //Segment-6 - vertical box ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1370
1371         bpar_v[0] = 2.16/2.;
1372         bpar_v[1] = 95.5/2.;
1373         bpar_v[2] = zsenv/2.;
1374         gMC->Gsvolu("C3G6", "BOX", idGas, bpar_v, 3);
1375         gMC->Gsvolu("C4G6", "BOX", idGas, bpar_v, 3);
1376
1377 //...........................................................................................
1378
1379 //Positioning the PCB
1380       x_hor_pos = 95.5/2.+ 22.6; // 22.6 is inner radius of PCB
1381       y_hor_pos = -(1.6/2); //
1382
1383       x_ver_pos = -(1.6/2); //
1384       y_ver_pos = 95.5/2.+ 22.6;
1385
1386      gMC->Gspos("C3G0",1, "SQM3", x_hor_pos,y_hor_pos,0.,0, "only");// box horizontal
1387      gMC->Gspos("C3G1",1, "SQM3", 0.,0.,0.,0, "only");
1388      gMC->Gspos("C3G2",1, "SQM3", 0.,0.,0.,irot1,"only");
1389      gMC->Gspos("C3G3",1, "SQM3", 0.,0.,0.,irot2, "only");
1390      gMC->Gspos("C3G4",1, "SQM3", 0.,0.,0.,irot3, "only");
1391      gMC->Gspos("C3G5",1, "SQM3", 0.,0.,0.,irot4, "only");
1392      gMC->Gspos("C3G6",1, "SQM3", x_ver_pos,y_ver_pos,0.,0, "only");// box vertical
1393
1394      gMC->Gspos("C4G0",1, "SQM4", x_hor_pos,y_hor_pos,0.,0, "only");// box horizontal
1395      gMC->Gspos("C4G1",1, "SQM4", 0.,0.,0.,0, "only");
1396      gMC->Gspos("C4G2",1, "SQM4", 0.,0.,0.,irot1,"only");
1397      gMC->Gspos("C4G3",1, "SQM4", 0.,0.,0.,irot2, "only");
1398      gMC->Gspos("C4G4",1, "SQM4", 0.,0.,0.,irot3, "only");
1399      gMC->Gspos("C4G5",1, "SQM4", 0.,0.,0.,irot4, "only");
1400      gMC->Gspos("C4G6",1, "SQM4", x_ver_pos,y_ver_pos,0.,0, "only");// box vertical
1401
1402 //^^^^^^^^^^^^^^^^^^^^^^^^^ Sensitive volumes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1403
1404
1405 //##################################################################################################
1406 //   Positioning Quadrant  in chamber#3 and chamber#4
1407 //##################################################################################################
1408 /******Transformations for  Quadrant**********************************************
1409       ||        I  => Quadrant I:   no rotation
1410       ||
1411   II. || I.    II  => Quadrant II:  Reflaction of Quadrant I in XZ plane
1412       ||           => TGeoRotation("Qrot2",90.,180.,90.,90.,180.,0.);
1413 =============
1414       ||       III => Quadrant III: 180 degree rotation of Quadrant I in XY plane
1415  III. || IV.       => TGeoRotation("Qrot3",90.,180.,90.,90.,180.,0.);
1416       ||        IV => Quadrant IV:-180 degree rotation of Quadrant II in XY plane
1417                    => TGeoRotation("Qrot4",90.,0.,90.,-90.,180.,0.);
1418 **********************************************************************************************/
1419
1420  Int_t detElemId1 =  0;  // quadrant I
1421  Int_t detElemId2 = 51;  // quadrant II
1422  Int_t detElemId3 = 50;  // quadrant III
1423  Int_t detElemId4 =  1;  // quadrant IV
1424
1425 Float_t half_chamber = zcbb + zcu + zRoha + zmeb + zcu2 + zsenv/2;
1426 //   cout<<  "\n half_chamber \t" << half_chamber << endl;
1427 //   Float_t half_chamber =2.894;
1428 //     Float_t half_chamber =3.5;
1429
1430 // ------------------------------St2 Chamber3------------------------------------------------
1431
1432  //    GetEnvelopes(2)->AddEnvelope("S3M0", 300, true,TGeoTranslation(0.,0.,0.));
1433     GetEnvelopes(2)->AddEnvelope("SQM3", 300+detElemId1, 1, TGeoTranslation( 0., 0., - half_chamber));
1434     GetEnvelopes(2)->AddEnvelope("SQM3", 300+detElemId2, 2, TGeoTranslation( 0., 0., + half_chamber),
1435                                  TGeoRotation("Qrot3",90.,180.,90.,90.,180.,0.));
1436     GetEnvelopes(2)->AddEnvelope("SQM3", 300+detElemId3, 3, TGeoTranslation( 0., 0., - half_chamber),
1437                                   TGeoRotation("Qrot3",90.,180.,90.,270.,0.,0.));
1438     GetEnvelopes(2)->AddEnvelope("SQM3", 300+detElemId4, 4, TGeoTranslation( 0., 0., + half_chamber),
1439                                   TGeoRotation("Qrot4",90.,0.,90.,-90.,180.,0.));
1440
1441 //--------------------------------St2 Chamber4-------------------------------------------------
1442
1443     GetEnvelopes(3)->AddEnvelope("SQM4", 400+detElemId1, 1, TGeoTranslation( 0., 0., - half_chamber));
1444     GetEnvelopes(3)->AddEnvelope("SQM4", 400+detElemId2, 2, TGeoTranslation( 0., 0., + half_chamber),
1445                                  TGeoRotation("Qrot2",90.,180.,90.,90.,180.,0.));
1446     GetEnvelopes(3)->AddEnvelope("SQM4", 400+detElemId3, 3, TGeoTranslation( 0., 0., - half_chamber),
1447                                   TGeoRotation("Qrot3",90.,180.,90.,270.,0.,0.));
1448     GetEnvelopes(3)->AddEnvelope("SQM4", 400+detElemId4, 4, TGeoTranslation( 0., 0., + half_chamber),
1449                                   TGeoRotation("Qrot4",90.,0.,90.,-90.,180.,0.));
1450
1451 //**********************************************************************************************
1452
1453    }
1454
1455 //______________________________________________________________________________
1456 void AliMUONSt2GeometryBuilderV2::SetTransformations()
1457 {
1458 // Defines the transformations for the station2 chambers.
1459 // ---
1460
1461   AliMUONChamber* iChamber1 = &fMUON->Chamber(2);
1462   Double_t zpos1 = - iChamber1->Z();
1463   iChamber1->GetGeometry()
1464     ->SetTranslation(TGeoTranslation(0., 0., zpos1));
1465
1466   AliMUONChamber* iChamber2 = &fMUON->Chamber(3);
1467   Double_t zpos2 = - iChamber2->Z();
1468   iChamber2->GetGeometry()
1469     ->SetTranslation(TGeoTranslation(0., 0., zpos2));
1470 }
1471
1472 //______________________________________________________________________________
1473 void AliMUONSt2GeometryBuilderV2::SetSensitiveVolumes()
1474 {
1475 // Defines the sensitive volumes for station2 chambers.
1476 // ---
1477
1478   GetGeometry(2)->SetSensitiveVolume("C3G0");
1479   GetGeometry(2)->SetSensitiveVolume("C3G1");
1480   GetGeometry(2)->SetSensitiveVolume("C3G2");
1481   GetGeometry(2)->SetSensitiveVolume("C3G3");
1482   GetGeometry(2)->SetSensitiveVolume("C3G4");
1483   GetGeometry(2)->SetSensitiveVolume("C3G5");
1484   GetGeometry(2)->SetSensitiveVolume("C3G6");
1485
1486   GetGeometry(3)->SetSensitiveVolume("C4G0");
1487   GetGeometry(3)->SetSensitiveVolume("C4G1");
1488   GetGeometry(3)->SetSensitiveVolume("C4G2");
1489   GetGeometry(3)->SetSensitiveVolume("C4G3");
1490   GetGeometry(3)->SetSensitiveVolume("C4G4");
1491   GetGeometry(3)->SetSensitiveVolume("C4G5");
1492   GetGeometry(3)->SetSensitiveVolume("C4G6");
1493
1494 }