Updated for changes in the base class constructor
[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 "AliMUONConstants.h"
37 #include "AliMUONGeometryModule.h"
38 #include "AliMUONGeometryEnvelopeStore.h"
39 #include "AliMUONConstants.h"
40
41 #define PI 3.14159
42
43 /// \cond CLASSIMP
44 ClassImp(AliMUONSt2GeometryBuilderV2)
45 /// \endcond
46
47 //______________________________________________________________________________
48 AliMUONSt2GeometryBuilderV2::AliMUONSt2GeometryBuilderV2(AliMUON* muon)
49  : AliMUONVGeometryBuilder(2, 2),
50    fMUON(muon)
51 {
52 // Standard constructor
53
54 }
55
56 //______________________________________________________________________________
57 AliMUONSt2GeometryBuilderV2::AliMUONSt2GeometryBuilderV2()
58  : AliMUONVGeometryBuilder(),
59    fMUON(0)
60 {
61 // Default constructor
62 }
63
64 //______________________________________________________________________________
65 AliMUONSt2GeometryBuilderV2::~AliMUONSt2GeometryBuilderV2() {
66 //
67 }
68
69 //
70 // public methods
71 //
72
73 //______________________________________________________________________________
74 void AliMUONSt2GeometryBuilderV2::CreateGeometry()
75 {
76
77 //
78 //********************************************************************
79 //                            Station 2                             **
80 //********************************************************************
81      // indices 1 and 2 for first and second chambers in the station
82      // iChamber (first chamber) kept for other quanties than Z,
83      // assumed to be the same in both chambers
84
85      // Get tracking medias Ids
86      Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
87      Int_t idAir  = idtmed[1100]; // medium 1
88      Int_t idGas  = idtmed[1108]; // medium Ar-CO2 gas (80%+20%)
89      Int_t idPCB  = idtmed[1122]; // medium FR4
90      Int_t idCU   = idtmed[1110]; // medium copper
91      Int_t idRoha = idtmed[1113]; // medium roha cell
92      Int_t idPGF30= idtmed[1123]; // medium for Frame Eq.to Bakelite
93      //Int_t idScru = idtmed[1128]; // screw material - Stainless Steel(18%Cr,9%Ni,Fe)
94
95
96
97 /*########################################################################################
98     Create volume for one Quadrant
99 ##########################################################################################*/
100      Float_t tpar1[5];
101      tpar1[0] = 20.55;
102      tpar1[1] = 123.5;
103      tpar1[2] = 6.8/2;
104      tpar1[3] = -12.0;
105      tpar1[4] = 102.0;
106
107
108      gMC->Gsvolu("SQM3","TUBS", idAir, tpar1, 5);
109      gMC->Gsvolu("SQM4","TUBS", idAir, tpar1, 5);
110
111
112
113 //==================================================================================
114 //                                 Plane      
115 //==================================================================================
116
117 //Thickness of variour parts
118        Float_t zCbb  = 0.04;       //cathode pcb
119        Float_t zCu   = 0.004;      // eff. cu in cathode pcb
120        Float_t zRoha = 2.5;        // Rhocell
121        Float_t zMeb = 0.08;      //Mech. exit board
122        Float_t zEeb = 0.02;     //Effective electronic exit board
123     //Z-positions of various parts--- in Plane-1
124
125        Float_t zposCbb   = 0.25;   // 2.5 mm => gap between anode & chatode plane
126        Float_t zposCu    =zposCbb + zCbb;
127        Float_t zposRoha  =zposCu + zCu;
128        Float_t zposMeb   =zposRoha + zRoha;
129        Float_t zposEeb   =zposMeb + zMeb;
130
131        Float_t zposCbbBar  = zposCbb + zCbb/2.;  //for segment 0 & 6
132        Float_t zposCuBar   = zCbb/2. + zCu/2.;
133        Float_t zposRohaBar = zCu/2. + zRoha/2.;
134        Float_t zposMebBar  =  zRoha/2. + zMeb/2.;
135        Float_t zposEebBar  = zMeb/2. + zEeb/2.;
136
137
138  //Cathode PCB + Copper sheet + Rohacell + mech exit board + eff. electronic exit board
139
140  //Segment-0 ~~~Horizantal box  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
141        Float_t bparH[3];
142        bparH[0] = 94.5/2.; // extension beyond 0 deg in x direction
143        bparH[1] = 1.2/2.;  // extension beyond 0 deg in y direction (3.7[total extn] - 2.5[frame dim])
144        bparH[2] = zCbb/2.; // thickness of cathode sheet in z direction
145        gMC->Gsvolu("CB0L", "BOX", idPCB, bparH, 3);
146        
147        bparH[2] = zCu/2.;     //Thickness of Copper sheet
148        gMC->Gsvolu("CU0L", "BOX", idCU, bparH, 3);
149
150        bparH[2] = zRoha/2.;     //Thickness of Roha cell
151        gMC->Gsvolu("RH0L", "BOX", idRoha, bparH, 3);
152
153        bparH[2] = zMeb/2;       //Thickness of mechanical exit board
154        gMC->Gsvolu("MB0L", "BOX", idPCB, bparH, 3);
155
156        bparH[2] = zEeb/2;          //Thickness of effective electronic  exit board
157        gMC->Gsvolu("EB0L", "BOX", idCU, bparH, 3);
158
159  //Segment-1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160        Float_t pgpar[10]; // polygon
161        pgpar[0] = 0.;  // initial angle
162        pgpar[1] = 90.; // increment in angle starting from initial angle 
163        pgpar[2] = 5;   // number of side
164        pgpar[3] = 2.; // number of plane
165        pgpar[4] = 0.; // z-position of the first plane
166        pgpar[5] = 23.1; // innner radius first plane
167        pgpar[6] = 117.6;  // outer radious first plane
168        pgpar[7] = pgpar[4] + zCbb; // z-position of the second plane
169        pgpar[8] = pgpar[5];  // innner radius of second plane
170        pgpar[9] = pgpar[6];  // outer radious of second plane
171        gMC->Gsvolu("CB1L", "PGON", idPCB, pgpar, 10);
172
173        pgpar[7] = pgpar[4] + zCu;  // Thickness of copper-sheet
174        gMC->Gsvolu("CU1L", "PGON", idCU, pgpar, 10);
175        
176        pgpar[7] = pgpar[4] + zRoha;  // Thickness of Roha cell
177        gMC->Gsvolu("RH1L", "PGON", idRoha, pgpar, 10);
178        
179        pgpar[7] = pgpar[4] + zMeb;  // Thickness of mechanical exit board
180        gMC->Gsvolu("MB1L", "PGON", idPCB, pgpar, 10);
181        
182        pgpar[7] = pgpar[4] + zEeb;  // Thickness of electronic exit board
183        gMC->Gsvolu("EB1L", "PGON", idCU, pgpar, 10);
184        
185
186 //Segment-2 - vertical box (simalar to horizontal bar as in Segment 0)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187        
188        Float_t bparV[3];
189        
190        bparV[0] = 1.0/2.;
191        bparV[1] = 94.5/2.;
192        bparV[2] = zCbb/2.;
193        gMC->Gsvolu("CB2L", "BOX", idPCB, bparV, 3);
194        
195        bparV[2] = zCu/2.;
196        gMC->Gsvolu("CU2L", "BOX", idCU, bparV, 3);
197
198        bparV[2] = zRoha/2.;
199        gMC->Gsvolu("RH2L", "BOX", idRoha, bparV, 3);
200        
201        bparV[2] = zMeb/2;
202        gMC->Gsvolu("MB2L", "BOX", idPCB, bparV, 3);
203        
204        bparV[2] = zEeb/2;
205        gMC->Gsvolu("EB2L", "BOX", idCU, bparV, 3);
206        
207 //....(Setting posion of Segment 0,1,2)..................................................................
208        
209        Float_t xposHorBox =  bparH[0] + 23.1; // 23.1 = 20.6(inner radius of qrd) + 2.5 (width of frame)
210        Float_t yposHorBox = -bparH[1];  
211        
212        Float_t xposVerBox = -bparV[0];
213        Float_t yposVerBox =  bparV[1] + 23.1;
214
215
216
217 //Positioning the PCB
218 //
219
220       // chamber 3
221      gMC->Gspos("CB0L",1, "SQM3",xposHorBox,yposHorBox,zposCbbBar,0, "ONLY");// box horizontal
222      gMC->Gspos("CB1L",1, "SQM3", 0.0,0.0,zposCbb,0, "ONLY");
223      gMC->Gspos("CB2L",1, "SQM3",xposVerBox,yposVerBox,zposCbbBar,0, "ONLY");// box vertical
224
225      gMC->Gspos("CB0L",2, "SQM3",xposHorBox,yposHorBox,-zposCbbBar,0, "ONLY");// box horizontal
226      gMC->Gspos("CB1L",2, "SQM3", 0.0,0.0,-(zposCbb+ zCbb),0, "ONLY");
227      gMC->Gspos("CB2L",2, "SQM3",xposVerBox,yposVerBox,zposCbbBar,0, "ONLY");// box vertical
228
229       // chamber 4
230      gMC->Gspos("CB0L",3, "SQM4",xposHorBox,yposHorBox,zposCbbBar,0, "ONLY");
231      gMC->Gspos("CB1L",3, "SQM4", 0.0,0.0,zposCbb,0, "ONLY");
232      gMC->Gspos("CB2L",3, "SQM4",xposVerBox,yposVerBox,zposCbbBar,0, "ONLY");
233
234      gMC->Gspos("CB0L",4, "SQM4",xposHorBox,yposHorBox,-zposCbbBar,0, "ONLY");
235      gMC->Gspos("CB1L",4, "SQM4", 0.0,0.0,-(zposCbb+ zCbb),0, "ONLY");
236      gMC->Gspos("CB2L",4, "SQM4",xposVerBox,yposVerBox,zposCbbBar,0, "ONLY");
237
238
239 //Positioning Copper sheet
240
241       // chamber 3
242
243      gMC->Gspos("CU0L",1, "SQM3",xposHorBox,yposHorBox,zposCuBar,0, "ONLY");
244      gMC->Gspos("CU1L",1, "SQM3", 0.0,0.0,zposCu,0, "ONLY");
245      gMC->Gspos("CU2L",1, "SQM3",xposVerBox,yposVerBox,zposCuBar,0, "ONLY");
246
247      gMC->Gspos("CU0L",2, "SQM3",xposHorBox,yposHorBox,-zposCuBar,0, "ONLY");
248      gMC->Gspos("CU1L",2, "SQM3", 0.0,0.0,-(zposCu+ zCu),0, "ONLY");
249      gMC->Gspos("CU2L",2, "SQM3",xposVerBox,yposVerBox,zposCuBar,0, "ONLY");
250       // chamber 4
251
252      gMC->Gspos("CU0L",3, "SQM4",xposHorBox,yposHorBox,zposCuBar,0, "ONLY");
253      gMC->Gspos("CU1L",3, "SQM4", 0.0,0.0,zposCu,0, "ONLY");
254      gMC->Gspos("CU2L",3, "SQM4",xposVerBox,yposVerBox,zposCuBar,0, "ONLY");
255
256      gMC->Gspos("CU0L",4, "SQM4",xposHorBox,yposHorBox,-zposCuBar,0, "ONLY");
257      gMC->Gspos("CU1L",4, "SQM4", 0.0,0.0,-(zposCu+ zCu),0, "ONLY");
258      gMC->Gspos("CU2L",4, "SQM4",xposVerBox,yposVerBox,zposCuBar,0, "ONLY");
259
260 //Positioning Roha cell 
261
262       // chamber 3
263
264      gMC->Gspos("RH0L",1, "SQM3",xposHorBox,yposHorBox,zposRohaBar,0, "ONLY");
265      gMC->Gspos("RH1L",1, "SQM3", 0.0,0.0,zposRoha,0, "ONLY");
266      gMC->Gspos("RH2L",1, "SQM3",xposVerBox,yposVerBox,zposRohaBar,0, "ONLY");
267
268      gMC->Gspos("RH0L",2, "SQM3",xposHorBox,yposHorBox,-zposRohaBar,0, "ONLY");
269      gMC->Gspos("RH1L",2, "SQM3", 0.0,0.0,-(zposRoha+ zRoha),0, "ONLY");
270      gMC->Gspos("RH2L",2, "SQM3",xposVerBox,yposVerBox,zposRohaBar,0, "ONLY");
271
272       // chamber 4
273
274      gMC->Gspos("RH0L",3, "SQM4",xposHorBox,yposHorBox,zposRohaBar,0, "ONLY");
275      gMC->Gspos("RH1L",3, "SQM4", 0.0,0.0,zposRoha,0, "ONLY");
276      gMC->Gspos("RH2L",3, "SQM4",xposVerBox,yposVerBox,zposRohaBar,0, "ONLY");
277
278      gMC->Gspos("RH0L",4, "SQM4",xposHorBox,yposHorBox,-zposRohaBar,0, "ONLY");
279      gMC->Gspos("RH1L",4, "SQM4", 0.0,0.0,-(zposRoha+ zRoha),0, "ONLY");
280      gMC->Gspos("RH2L",4, "SQM4",xposVerBox,yposVerBox,zposRohaBar,0, "ONLY");
281
282 //Positioning of Mech. exit board
283
284       // chamber 3
285
286      gMC->Gspos("MB0L",1, "SQM3",xposHorBox,yposHorBox,zposMebBar,0, "ONLY");
287      gMC->Gspos("MB1L",1, "SQM3", 0.0,0.0,zposMeb,0, "ONLY");
288      gMC->Gspos("MB2L",1, "SQM3",xposVerBox,yposVerBox,zposMebBar,0, "ONLY");
289
290      gMC->Gspos("MB0L",2, "SQM3",xposHorBox,yposHorBox,-zposMebBar,0, "ONLY");
291      gMC->Gspos("MB1L",2, "SQM3", 0.0,0.0,-(zposMeb+ zMeb),0, "ONLY");
292      gMC->Gspos("MB2L",2, "SQM3",xposVerBox,yposVerBox,zposMebBar,0, "ONLY");
293       // chamber 4
294
295      gMC->Gspos("MB0L",3, "SQM4",xposHorBox,yposHorBox,zposMebBar,0, "ONLY");
296      gMC->Gspos("MB1L",3, "SQM4", 0.0,0.0,zposMeb,0, "ONLY");
297      gMC->Gspos("MB2L",3, "SQM4",xposVerBox,yposVerBox,zposMebBar,0, "ONLY");
298
299      gMC->Gspos("MB0L",4, "SQM4",xposHorBox,yposHorBox,-zposMebBar,0, "ONLY");
300      gMC->Gspos("MB1L",4, "SQM4", 0.0,0.0,-(zposMeb+ zMeb),0, "ONLY");
301      gMC->Gspos("MB2L",4, "SQM4",xposVerBox,yposVerBox,zposMebBar,0, "ONLY");
302
303 //Positioning of Electronic exit board
304
305
306       // chamber 3
307
308      gMC->Gspos("EB0L",1, "SQM3",xposHorBox,yposHorBox,zposEebBar,0, "ONLY");
309      gMC->Gspos("EB1L",1, "SQM3", 0.0,0.0,zposEeb,0, "ONLY");
310      gMC->Gspos("EB2L",1, "SQM3",xposVerBox,yposVerBox,zposEebBar,0, "ONLY");
311
312      gMC->Gspos("EB0L",2, "SQM3",xposHorBox,yposHorBox,-zposEebBar,0, "ONLY");
313      gMC->Gspos("EB1L",2, "SQM3", 0.0,0.0,-(zposEeb+ zEeb),0, "ONLY");
314      gMC->Gspos("EB2L",2, "SQM3",xposVerBox,yposVerBox,zposEebBar,0, "ONLY");
315       // chamber 4
316
317      gMC->Gspos("EB0L",3, "SQM4",xposHorBox,yposHorBox,zposEebBar,0, "ONLY");
318      gMC->Gspos("EB1L",3, "SQM4", 0.0,0.0,zposEeb,0, "ONLY");
319      gMC->Gspos("EB2L",3, "SQM4",xposVerBox,yposVerBox,zposEebBar,0, "ONLY");
320
321      gMC->Gspos("EB0L",4, "SQM4",xposHorBox,yposHorBox,-zposEebBar,0, "ONLY");
322      gMC->Gspos("EB1L",4, "SQM4", 0.0,0.0,-(zposEeb+ zEeb),0, "ONLY");
323      gMC->Gspos("EB2L",4, "SQM4",xposVerBox,yposVerBox,zposEebBar,0, "ONLY");
324
325  
326 //----------------------------------------------------------------------
327 //                          Frames
328 //----------------------------------------------------------------------
329 //Frame-1
330      Float_t frame1[3] ;                
331      frame1[0] = 101.0/2.;             //100.6 = 94.5 + 2.5 + 3.6 
332      frame1[1] = 2.5/2.;               
333      frame1[2] = 5.0/2.;
334
335      gMC->Gsvolu("FRM1", "BOX", idPGF30, frame1, 3); //Frame - 1 // fill with pkk GF30
336      
337      Float_t arib1[3];
338      arib1[0] = frame1[0];
339      arib1[1] = 0.9/2.;
340      arib1[2] =(frame1[2]-0.95)/2.0;
341      
342      gMC->Gsvolu("FRA1", "BOX", idAir, arib1, 3); // fill with air
343      
344      Float_t xposarib1 = 0;
345      Float_t yposarib1 = -frame1[1] + arib1[1];
346      Float_t zposarib1 = frame1[2] - arib1[2];
347      
348      gMC->Gspos("FRA1",1, "FRM1", xposarib1, yposarib1, zposarib1,0, "ONLY");  //replace pkk GF30 with air(b)
349      gMC->Gspos("FRA1",2, "FRM1", xposarib1, yposarib1, -zposarib1,0, "ONLY"); //replace pkk GF30 with air(nb)
350      
351      Float_t rrib1[3];
352      rrib1[0] = frame1[0];
353      rrib1[1] = 0.6/2.;
354      rrib1[2] =(frame1[2]-0.95)/2.0;
355      
356      gMC->Gsvolu("FRR1", "BOX", idRoha, rrib1, 3); // fill with rohacell
357      
358      Float_t xposrrib1 = 0.0;
359      Float_t yposrrib1 = frame1[1] - rrib1[1];
360      Float_t zposrrib1 = frame1[2] - rrib1[2];
361      
362      gMC->Gspos("FRR1",1, "FRM1", xposrrib1, yposrrib1, zposrrib1,0, "ONLY");//replace pkk GF30 with rohacell
363      gMC->Gspos("FRR1",2, "FRM1", xposrrib1, yposrrib1, -zposrrib1,0, "ONLY");//replace pkk GF30 with rohacell
364
365      
366      Float_t xposFr1 = frame1[0] + 20.6;
367      Float_t yposFr1 = -3.7 + frame1[1] ;
368      Float_t zposFr1 = 0.0;
369      
370      gMC->Gspos("FRM1",1, "SQM3", xposFr1, yposFr1, zposFr1,0, "ONLY");// frame -1
371      gMC->Gspos("FRM1",2, "SQM4", xposFr1, yposFr1, zposFr1,0, "ONLY");// frame -1
372      
373
374 //......................................................................................
375 //Frame-2
376
377       Float_t frame2[3]; 
378       frame2[0] = 4.0/2.;
379       frame2[1] = 1.2/2.;
380       frame2[2] = 5.0/2;
381
382       gMC->Gsvolu("FRM2", "BOX", idPGF30, frame2, 3); //Frame - 2
383
384       Float_t rrib2[3];
385       rrib2[0] = frame2[0]-1.0/2.0;
386       rrib2[1] = frame2[1];
387       rrib2[2] =(frame2[2]-0.95)/2.0;
388
389       gMC->Gsvolu("FRR2", "BOX", idRoha, rrib2, 3);
390       
391       Float_t xposrrib2 = -1.0/2.0;
392       Float_t yposrrib2 = 0.0;
393       Float_t zposrrib2 = frame2[2] - rrib2[2];
394
395       gMC->Gspos("FRR2",1, "FRM2", xposrrib2, yposrrib2, zposrrib2,0, "ONLY");//replace pkk GF30 with rohacell
396       gMC->Gspos("FRR2",2, "FRM2", xposrrib2, yposrrib2, -zposrrib2,0, "ONLY");//replace pkk GF30 with roha
397
398
399
400       Float_t xposFr2 = frame2[0] + 117.6;
401       Float_t yposFr2 = -frame2[1];
402       Float_t zposFr2 = 0.0;
403
404       gMC->Gspos("FRM2",1, "SQM3", xposFr2, yposFr2, zposFr2,0, "ONLY");//global positing of frame in SQM3
405       gMC->Gspos("FRM2",2, "SQM4", xposFr2, yposFr2, zposFr2,0, "ONLY");//global positing of frame in SQM4
406       
407   
408 //......................................................................................
409 //Frame-3
410
411       Float_t pgparFr3[10];
412       pgparFr3[0] = 0.;
413       pgparFr3[1] = 90.;
414       pgparFr3[2] = 5;
415       pgparFr3[3] = 2.;
416       pgparFr3[4] = 0.;
417       pgparFr3[5] = 117.6;
418       pgparFr3[6] = 121.6;
419       pgparFr3[7] = pgparFr3[4] + 5.0;
420       pgparFr3[8] = pgparFr3[5];
421       pgparFr3[9] = pgparFr3[6];
422       
423       gMC->Gsvolu("FRM3", "PGON", idPGF30, pgparFr3, 10);
424       
425       Float_t pgparRrib3[10];
426       pgparRrib3[0] = 0.;
427       pgparRrib3[1] = 90.;
428       pgparRrib3[2] = 5;
429       pgparRrib3[3] = 2.;
430       pgparRrib3[4] = 0.;
431       pgparRrib3[5] = 117.6;
432       pgparRrib3[6] = 120.6;
433       pgparRrib3[7] = pgparRrib3[4] +1.55 ;
434       pgparRrib3[8] = pgparRrib3[5];
435       pgparRrib3[9] = pgparRrib3[6];
436       
437       gMC->Gsvolu("FRR3", "PGON", idRoha, pgparRrib3, 10);
438       
439       Float_t xposrrib3 = 0.0;
440       Float_t yposrrib3 = 0.0;
441       Float_t zposrrib3 = 0.0;
442
443       gMC->Gspos("FRR3",1, "FRM3", xposrrib3, yposrrib3, zposrrib3,0, "ONLY");
444
445       zposrrib3 = 3.45;
446       
447       gMC->Gspos("FRR3",2, "FRM3", xposrrib3, yposrrib3, zposrrib3,0, "ONLY");
448       
449       
450       
451       Float_t xposFr3 = 0.0;
452       Float_t yposFr3 = 0.0;
453       Float_t zposFr3 = -frame1[2];
454       
455       gMC->Gspos("FRM3",1, "SQM3", xposFr3, yposFr3, zposFr3,0, "ONLY");// frame -1
456       gMC->Gspos("FRM3",2, "SQM4", xposFr3, yposFr3, zposFr3,0, "ONLY");// frame -1
457       
458
459 //......................................................................................
460 //Frame-4
461  
462       Float_t frame4[3]; 
463       frame4[0] = 1.0/2.;
464       frame4[1] = 4.0/2.;
465       frame4[2] = frame1[2];
466
467       gMC->Gsvolu("FRM4", "BOX", idPGF30, frame4, 3); 
468
469       Float_t rrib4[3];
470       rrib4[0] = frame4[0];
471       rrib4[1] = frame4[1]-1.0/2;
472       rrib4[2] =(frame4[2]-0.95)/2.0;
473
474       gMC->Gsvolu("FRR4", "BOX", idRoha, rrib4, 3);
475       
476       Float_t xposrrib4 = 0.0;
477       Float_t yposrrib4 = -1.0/2;
478       Float_t zposrrib4 = frame4[2] - rrib4[2];
479
480       gMC->Gspos("FRR4",1, "FRM4", xposrrib4, yposrrib4, zposrrib4,0, "ONLY");
481       gMC->Gspos("FRR4",2, "FRM4", xposrrib4, yposrrib4, -zposrrib4,0, "ONLY");
482
483
484
485       Float_t xposFr4 = -frame4[0];
486       Float_t yposFr4 = -frame4[1] + 117.6;
487       Float_t zposFr4 = 0.0;
488
489       gMC->Gspos("FRM4",1, "SQM3", xposFr4, yposFr4, zposFr4,0, "ONLY");
490       gMC->Gspos("FRM4",2, "SQM4", xposFr4, yposFr4, zposFr4,0, "ONLY");
491       
492
493 //......................................................................................
494 //Frame-5
495       Float_t frame5[3] ;               
496       frame5[0] = 2.7/2.;            
497       frame5[1] = 101.0/2.;              
498       frame5[2] = 5.0/2.;
499
500       gMC->Gsvolu("FRM5", "BOX", idPGF30, frame5, 3); //Frame - 1
501       
502       Float_t arib5[3];
503       arib5[0] = 0.9/2.0;
504       arib5[1] = frame5[1];
505       arib5[2] = (frame5[2]-0.95)/2.0;
506
507       gMC->Gsvolu("FRA5", "BOX", idAir, arib5, 3);
508
509       Float_t xposarib5 = -frame5[0] + arib5[0];
510       Float_t yposarib5 = 0.0;
511       Float_t zposarib5 = frame5[2] - arib5[2];
512
513       gMC->Gspos("FRA5",1, "FRM5", xposarib5, yposarib5, zposarib5,0, "ONLY");
514       gMC->Gspos("FRA5",2, "FRM5", xposarib5, yposarib5, -zposarib5,0, "ONLY");
515
516       Float_t rrib5[3];
517       rrib5[0] = 0.8/2.0;
518       rrib5[1] = frame5[1];
519       rrib5[2] = (frame5[2]-0.95)/2.0;
520
521       gMC->Gsvolu("FRR5", "BOX", idRoha, rrib5, 3);
522
523       Float_t xposrrib5 = frame5[0] - rrib5[0];
524       Float_t yposrrib5 = 0.0;
525       Float_t zposrrib5 = frame5[2] - rrib5[2];
526
527       gMC->Gspos("FRR5",1, "FRM5", xposrrib5, yposrrib5, zposrrib5,0, "ONLY");
528       gMC->Gspos("FRR5",2, "FRM5", xposrrib5, yposrrib5, -zposrrib5,0, "ONLY");
529
530       Float_t xposFr5 = -3.7 + frame5[0];
531       Float_t yposFr5 = frame5[1] + 20.6;
532       Float_t zposFr5 = 0.0;
533
534       gMC->Gspos("FRM5",1, "SQM3", xposFr5, yposFr5, zposFr5,0, "ONLY");
535       gMC->Gspos("FRM5",2, "SQM4", xposFr5, yposFr5, zposFr5,0, "ONLY");
536
537 //......................................................................................
538 //Frame -6 
539  
540       Float_t frame6[3]; 
541       frame6[0] = 1.0/2.;
542       frame6[1] = 2.5/2.;
543       frame6[2] = frame1[2];
544
545       gMC->Gsvolu("FRM6", "BOX", idPGF30, frame6, 3); 
546
547       Float_t rrib6[3];
548       rrib6[0] = frame6[0];
549       rrib6[1] = 1.5/2.;
550       rrib6[2] =(frame2[2]-0.95)/2.0;
551
552       gMC->Gsvolu("FRR6", "BOX", idRoha, rrib6, 3);
553       
554       Float_t xposrrib6 = 0.0;
555       Float_t yposrrib6 = 1.0/2.0;
556       Float_t zposrrib6 = frame6[2] - rrib6[2];
557
558       gMC->Gspos("FRR6",1, "FRM6", xposrrib6, yposrrib6, zposrrib6,0, "ONLY");
559       gMC->Gspos("FRR6",2, "FRM6", xposrrib6, yposrrib6, -zposrrib6,0, "ONLY");
560
561
562
563       Float_t xposFr6 = -frame6[0];
564       Float_t yposFr6 = frame6[1] + 20.6;
565       Float_t zposFr6 = 0.0;
566
567       gMC->Gspos("FRM6",1, "SQM3", xposFr6, yposFr6, zposFr6,0, "ONLY");
568       gMC->Gspos("FRM6",2, "SQM4", xposFr6, yposFr6, zposFr6,0, "ONLY");
569       
570
571 //......................................................................................
572 //Frame - 7 inner pgon
573
574         Float_t pgparFr7[10];
575         pgparFr7[0] = 0.;
576         pgparFr7[1] = 90.;
577         pgparFr7[2] = 5;
578         pgparFr7[3] = 2.;
579         pgparFr7[4] = 0.;
580         pgparFr7[5] = 20.6;
581         pgparFr7[6] = 23.1;
582         pgparFr7[7] = pgparFr7[4] + 5.0;
583         pgparFr7[8] = pgparFr7[5];
584         pgparFr7[9] = pgparFr7[6];
585
586         gMC->Gsvolu("FRM7", "PGON", idPGF30, pgparFr7, 10);
587
588         Float_t pgparRrib7[10];
589         pgparRrib7[0] = 0.;
590         pgparRrib7[1] = 90.;
591         pgparRrib7[2] = 5;
592         pgparRrib7[3] = 2.;
593         pgparRrib7[4] = 0.;
594         pgparRrib7[5] = 21.6;
595         pgparRrib7[6] = 23.1;
596         pgparRrib7[7] = pgparRrib7[4] + 1.55;
597         pgparRrib7[8] = pgparRrib7[5];
598         pgparRrib7[9] = pgparRrib7[6];
599
600         gMC->Gsvolu("FRR7", "PGON", idRoha, pgparRrib7, 10);
601       
602         Float_t xposrrib7 = 0.0;
603         Float_t yposrrib7 = 0.0;
604         Float_t zposrrib7 = 0.0;
605
606         gMC->Gspos("FRR7",1, "FRM7", xposrrib7, yposrrib7, zposrrib7,0, "ONLY");
607
608         zposrrib7 = 3.45;
609
610         gMC->Gspos("FRR7",2, "FRM7", xposrrib7, yposrrib7, zposrrib7,0, "ONLY");
611
612         Float_t xposFr7 = 0.0;
613         Float_t yposFr7 = 0.0;
614         Float_t zposFr7 = -frame1[2];
615
616         gMC->Gspos("FRM7",1, "SQM3", xposFr7, yposFr7, zposFr7,0, "ONLY");
617         gMC->Gspos("FRM7",2, "SQM4", xposFr7, yposFr7, zposFr7,0, "ONLY");
618       
619
620 //......................................................................................
621 //Frame - 8 
622
623
624       Float_t frame8[3] ;
625       frame8[0] = 2.5/2.0;
626       frame8[1] = 1.2/2.0;
627       frame8[2] = frame1[2];
628
629       gMC->Gsvolu("FRM8", "BOX", idPGF30, frame8, 3); //Frame - 2
630
631       Float_t rrib8[3];
632       rrib8[0] = frame8[0]-1.0/2;
633       rrib8[1] = frame8[1];
634       rrib8[2] =(frame8[2]-0.95)/2.0;
635
636       gMC->Gsvolu("FRR8", "BOX", idRoha, rrib8, 3);
637       
638       Float_t xposrrib8 = -1.0/2;
639       Float_t yposrrib8 = 0.0;
640       Float_t zposrrib8 = frame8[2] - rrib8[2];
641
642       gMC->Gspos("FRR8",1, "FRM8", xposrrib8, yposrrib8, zposrrib8,0, "ONLY");
643       gMC->Gspos("FRR8",2, "FRM8", xposrrib8, yposrrib8, -zposrrib8,0, "ONLY");
644
645
646
647       Float_t xposFr8 = frame8[0] + 20.6;
648       Float_t yposFr8 = -frame8[1];
649       Float_t zposFr8 = 0.0;
650
651       gMC->Gspos("FRM8",1, "SQM3", xposFr8, yposFr8, zposFr8,0, "ONLY");
652       gMC->Gspos("FRM8",2, "SQM4", xposFr8, yposFr8, zposFr8,0, "ONLY");
653       
654  
655
656
657 //^^^^^^^^^^^^^^^^^^^^^^^^^ Sensitive volumes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
658
659        Float_t zsenv = 0.5; // distance between two cathode plane
660
661  //Segment-0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
662        bparH[0] = 94.5/2.;
663        bparH[1] = 1.2/2.;
664        bparH[2] = zsenv/2.;
665        gMC->Gsvolu("C3G0", "BOX", idGas, bparH, 3);
666        gMC->Gsvolu("C4G0", "BOX", idGas, bparH, 3);
667
668  //Segment-1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
669         pgpar[0] = 0.;
670         pgpar[1] = 90.;
671         pgpar[2] = 5;
672         pgpar[3] = 2.;
673         pgpar[4] = -zsenv/2.;
674         pgpar[5] = 23.1;
675         pgpar[6] = 117.6;
676         pgpar[7] = zsenv/2.;
677         pgpar[8] = pgpar[5];
678         pgpar[9] = pgpar[6];
679         gMC->Gsvolu("C3G1", "PGON", idGas, pgpar, 10);
680         gMC->Gsvolu("C4G1", "PGON", idGas, pgpar, 10);
681
682
683 //Segment-2 - vertical box ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
684
685         bparV[0] = 1.0/2.;
686         bparV[1] = 95.5/2.;
687         bparV[2] = zsenv/2.;
688         gMC->Gsvolu("C3G2", "BOX", idGas, bparV, 3);
689         gMC->Gsvolu("C4G2", "BOX", idGas, bparV, 3);
690
691 //...........................................................................................
692
693      xposHorBox =  bparH[0] + 23.1;
694      yposHorBox = -bparH[1];
695
696      xposVerBox = -bparV[0];
697      yposVerBox = bparV[1] + 23.1;
698
699      gMC->Gspos("C3G0",1, "SQM3", xposHorBox,yposHorBox,0.,0, "ONLY");
700      gMC->Gspos("C3G1",1, "SQM3", 0.,0.,0.,0, "ONLY");
701      gMC->Gspos("C3G2",1, "SQM3", xposVerBox,yposVerBox,0.,0, "ONLY");
702
703
704      gMC->Gspos("C4G0",1, "SQM4", xposHorBox,yposHorBox,0.,0, "ONLY");
705      gMC->Gspos("C4G1",1, "SQM4", 0.,0.,0.,0, "ONLY");
706      gMC->Gspos("C4G2",1, "SQM4", xposVerBox,yposVerBox,0.,0, "ONLY");
707
708
709 //^^^^^^^^^^^^^^^^^^^^^^^^^ Sensitive volumes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
710
711
712 //##################################################################################################
713 //   Positioning Quadrant  in chamber#3 and chamber#4
714 //##################################################################################################
715 /******Transformations for  Quadrant**********************************************
716       ||        I  => Quadrant I:   no rotation
717       ||
718   II. || I.    II  => Quadrant II:  Reflaction of Quadrant I in XZ plane
719       ||           => TGeoRotation("Qrot2",90.,180.,90.,90.,180.,0.);
720 =============
721       ||       III => Quadrant III: 180 degree rotation of Quadrant I in XY plane
722  III. || IV.       => TGeoRotation("Qrot3",90.,180.,90.,90.,180.,0.);
723       ||        IV => Quadrant IV:-180 degree rotation of Quadrant II in XY plane
724                    => TGeoRotation("Qrot4",90.,0.,90.,-90.,180.,0.);
725 **********************************************************************************************/
726
727  Int_t detElemId1 =  1;  // quadrant I
728  Int_t detElemId2 =  0;  // quadrant II
729  Int_t detElemId3 =  3;  // quadrant III
730  Int_t detElemId4 =  2;  // quadrant IV
731
732  //Float_t halfChamber = zCbb + zCu + zRoha + zMeb + zEeb + zsenv/2;
733 //   cout<<  "\n half_chamber \t" << half_chamber << endl;
734
735  Float_t halfChamber = tpar1[2];// tpar1[2] = 6.8/2;
736
737 // ------------------------------St2 Chamber3------------------------------------------------
738
739  //    GetEnvelopes(2)->AddEnvelope("S3M0", 300, true,TGeoTranslation(0.,0.,0.));
740     GetEnvelopes(2)->AddEnvelope("SQM3", 300+detElemId1, 1, TGeoTranslation( 0., 0., - halfChamber));
741     GetEnvelopes(2)->AddEnvelope("SQM3", 300+detElemId2, 2, TGeoTranslation( 0., 0., + halfChamber),
742                                  TGeoRotation("Qrot3",90.,180.,90.,90.,180.,0.));
743     GetEnvelopes(2)->AddEnvelope("SQM3", 300+detElemId3, 3, TGeoTranslation( 0., 0., - halfChamber),
744                                   TGeoRotation("Qrot3",90.,180.,90.,270.,0.,0.));
745     GetEnvelopes(2)->AddEnvelope("SQM3", 300+detElemId4, 4, TGeoTranslation( 0., 0., + halfChamber),
746                                   TGeoRotation("Qrot4",90.,0.,90.,-90.,180.,0.));
747
748 //--------------------------------St2 Chamber4-------------------------------------------------
749
750     GetEnvelopes(3)->AddEnvelope("SQM4", 400+detElemId1, 1, TGeoTranslation( 0., 0., - halfChamber));
751     GetEnvelopes(3)->AddEnvelope("SQM4", 400+detElemId2, 2, TGeoTranslation( 0., 0., + halfChamber),
752                                  TGeoRotation("Qrot2",90.,180.,90.,90.,180.,0.));
753     GetEnvelopes(3)->AddEnvelope("SQM4", 400+detElemId3, 3, TGeoTranslation( 0., 0., - halfChamber),
754                                   TGeoRotation("Qrot3",90.,180.,90.,270.,0.,0.));
755     GetEnvelopes(3)->AddEnvelope("SQM4", 400+detElemId4, 4, TGeoTranslation( 0., 0., + halfChamber),
756                                   TGeoRotation("Qrot4",90.,0.,90.,-90.,180.,0.));
757
758 //**********************************************************************************************
759
760 }
761 //______________________________________________________________________________
762 void AliMUONSt2GeometryBuilderV2::SetTransformations()
763 {
764 // Defines the transformations for the station2 chambers.
765 // ---
766
767   if (gAlice->GetModule("SHIL")) {
768     SetMotherVolume(2, "YOUT1");
769     SetMotherVolume(3, "YOUT1");
770   }  
771
772   // Define chamber volumes as virtual
773   SetVolume(2, "SC03", true);
774   SetVolume(3, "SC04", true);
775
776   Double_t zpos1 = - AliMUONConstants::DefaultChamberZ(2); 
777   SetTranslation(2, TGeoTranslation(0., 0., zpos1));
778
779   Double_t zpos2 = - AliMUONConstants::DefaultChamberZ(3); 
780   SetTranslation(3, TGeoTranslation(0., 0., zpos2));
781 }
782
783 //______________________________________________________________________________
784 void AliMUONSt2GeometryBuilderV2::SetSensitiveVolumes()
785 {
786 // Defines the sensitive volumes for station2 chambers.
787 // ---
788
789   GetGeometry(2)->SetSensitiveVolume("C3G0");
790   GetGeometry(2)->SetSensitiveVolume("C3G1");
791   GetGeometry(2)->SetSensitiveVolume("C3G2");
792
793   GetGeometry(3)->SetSensitiveVolume("C4G0");
794   GetGeometry(3)->SetSensitiveVolume("C4G1");
795   GetGeometry(3)->SetSensitiveVolume("C4G2");
796 }
797