]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMDv1.cxx
Using the same optimization in the compiler and in the linker
[u/mrichter/AliRoot.git] / PMD / AliPMDv1.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 $Log$
17 Revision 1.28  2003/10/08 12:59:08  bnandi
18 zpos is positive
19
20 Revision 1.27  2003/10/08 12:56:58  bnandi
21 gaspmd[2] value changed from 7.0 to 0.25
22
23 Revision 1.26  2003/10/03 06:04:10  bnandi
24 z_psa and z_psb bugs fixed
25
26 Revision 1.25  2003/10/01 11:08:04  bnandi
27 changes for NewIO
28
29 Revision 1.24  2003/10/01 08:32:51  hristov
30 CurrentTrack replaced by GetCurrentTrackNumber
31
32 Revision 1.23  2003/10/01 05:07:51  bnandi
33 New geometry in new Alice Coordinate system
34
35 New rectangular geometry for ALICE PMD - Bedanga Mohanty and Y. P. Viyogi
36 June 2003
37 */
38 //
39 ///////////////////////////////////////////////////////////////////////////////
40 //                                                                           //
41 //  Photon Multiplicity Detector Version 1                                   //
42 //                                                                           //
43 //Begin_Html
44 /*
45 <img src="picts/AliPMDv1Class.gif">
46 */
47 //End_Html
48 //                                                                           //
49 ///////////////////////////////////////////////////////////////////////////////
50 ////
51
52 #include "AliPMDv1.h"
53 #include "AliRun.h"
54 #include "AliConst.h" 
55 #include "AliMagF.h" 
56 #include "Riostream.h"
57 #include <TVirtualMC.h>
58  
59 static Int_t     ncol_um1,ncol_um2, nrow_um1, nrow_um2;
60 static Int_t     kdet;
61 static Float_t   sm_length_ax,sm_length_ay;
62 static Float_t   sm_length_bx,sm_length_by;
63 static Float_t   zdist, zdist1;
64 static Float_t   sm_thick, cell_radius, cell_wall, cell_depth;
65 static Float_t   boundary, th_base, th_air, th_pcb;
66 static Float_t   th_lead, th_steel;
67
68 ClassImp(AliPMDv1)
69  
70   //_____________________________________________________________________________
71   AliPMDv1::AliPMDv1()
72 {
73   //
74   // Default constructor 
75   //
76   fMedSens=0;
77 }
78  
79 //_____________________________________________________________________________
80 AliPMDv1::AliPMDv1(const char *name, const char *title)
81   : AliPMD(name,title)
82 {
83   //
84   // Standard constructor
85   //
86   fMedSens=0;
87 }
88
89 //_____________________________________________________________________________
90 void AliPMDv1::CreateGeometry()
91 {
92   // Create geometry for Photon Multiplicity Detector
93
94   GetParameters();
95   CreateSupermodule();
96   CreatePMD();
97 }
98
99 //_____________________________________________________________________________
100 void AliPMDv1::CreateSupermodule()
101 {
102   // 
103   // Creates the geometry of the cells of PMD, places them in  supermodule 
104   // which is a rectangular object.
105   // Basic unit is ECAR, a hexagonal cell made of Ar+CO2, which is 
106   // placed inside another hexagonal cell made of Cu (ECCU) with larger 
107   // radius, compared to ECAR. The difference in radius gives the dimension 
108   // of half width of each cell wall.
109   // These cells are placed in a rectangular strip which are of 2 types 
110   // EST1 and EST2 
111   // 2 types of unit modules are made EUM1 and EUM2 which contains these strips
112   // placed repeatedly 
113   // Each supermodule (ESMA, ESMB), made of G10 is filled with following 
114   //components. They have 9 unit moudles inside them
115   // ESMA, ESMB are placed in EPMD along with EMPB (Pb converter) 
116   // and EMFE (iron support) 
117
118   
119   Int_t i,j;
120   Float_t xb, yb, zb;
121   Int_t number;
122   Int_t ihrotm,irotdm;
123   const Float_t root3_2 = TMath::Sqrt(3.) /2.; 
124   const Float_t root3 = TMath::Sqrt(3.); 
125   Int_t *idtmed = fIdtmed->GetArray()-599;
126  
127   AliMatrix(ihrotm, 90., 30.,   90.,  120., 0., 0.);
128   AliMatrix(irotdm, 90., 180.,  90.,  270., 180., 0.);
129  
130   zdist = TMath::Abs(zdist1);
131
132   // First create the sensitive medium of a hexagon cell (ECAR)
133   // Inner hexagon filled with gas (Ar+CO2)
134   
135   Float_t hexd2[10] = {0.,360.,6,2,-0.25,0.,0.23,0.25,0.,0.23};
136   hexd2[4] = -cell_depth/2.;
137   hexd2[7] =  cell_depth/2.;
138   hexd2[6] =  cell_radius - cell_wall;
139   hexd2[9] =  cell_radius - cell_wall;
140   
141   gMC->Gsvolu("ECAR", "PGON", idtmed[604], hexd2,10);
142   gMC->Gsatt("ECAR", "SEEN", 0);
143   
144   // Place the sensitive medium inside a hexagon copper cell (ECCU)
145   // Outer hexagon made of Copper
146   
147   Float_t hexd1[10] = {0.,360.,6,2,-0.25,0.,0.25,0.25,0.,0.25};
148   hexd1[4] = -cell_depth/2.;
149   hexd1[7] =  cell_depth/2.;
150   hexd1[6] =  cell_radius;
151   hexd1[9] =  cell_radius;
152
153   gMC->Gsvolu("ECCU", "PGON", idtmed[614], hexd1,10);
154   gMC->Gsatt("ECCU", "SEEN", 0);
155
156   // Place  inner hex (sensitive volume) inside outer hex (copper)
157   
158   gMC->Gsposp("ECAR", 1, "ECCU", 0., 0., 0., 0, "ONLY", hexd2, 10);
159   
160   // Now create Rectangular TWO strips (EST1, EST2) 
161   // of 1 column and 48 or 96 cells length
162
163   // volume for first strip EST1 made of AIR 
164
165   Float_t dbox1[3];
166   dbox1[0] = ncol_um1*cell_radius;
167   dbox1[1] = cell_radius/root3_2;
168   dbox1[2] = cell_depth/2.;
169   
170   gMC->Gsvolu("EST1","BOX", idtmed[698], dbox1, 3);
171   gMC->Gsatt("EST1", "SEEN", 0);
172
173   // volume for second strip EST2 
174
175   Float_t dbox2[3];
176   dbox2[0] = ncol_um2*cell_radius;
177   dbox2[1] = dbox1[1];
178   dbox2[2] = dbox1[2];
179
180   gMC->Gsvolu("EST2","BOX", idtmed[698], dbox2, 3);
181   gMC->Gsatt("EST2", "SEEN", 0);
182
183   // Place hexagonal cells ECCU placed inside EST1 
184   yb = 0.; 
185   zb = 0.;
186   xb = -(dbox1[0]) + cell_radius; 
187   for (i = 1; i <= ncol_um1; ++i) 
188         {
189           number = i;
190           gMC->Gsposp("ECCU", number, "EST1", xb,yb,zb, ihrotm, "ONLY", hexd1,10);
191           xb += (cell_radius*2.);
192         }
193   // Place hexagonal cells ECCU placed inside EST2 
194       yb = 0.; 
195       zb = 0.;
196       xb = -(dbox2[0]) + cell_radius; 
197       for (i = 1; i <= ncol_um2; ++i) 
198         {
199           number = i;
200           gMC->Gsposp("ECCU", number, "EST2", xb,yb,zb, ihrotm, "ONLY", hexd1,10);
201           xb += (cell_radius*2.);
202         }
203
204
205
206   // 2 types of rectangular shaped unit modules EUM1 and EUM2 (defined by BOX) 
207
208   // Create EUM1
209
210   Float_t dbox3[3];
211   dbox3[0] = dbox1[0]+cell_radius/2.;
212   dbox3[1] = (dbox1[1]*nrow_um1)-(cell_radius*root3*(nrow_um1-1)/6.); 
213   dbox3[2] = cell_depth/2.;
214   
215   gMC->Gsvolu("EUM1","BOX", idtmed[698], dbox3, 3);
216   gMC->Gsatt("EUM1", "SEEN", 1);
217   
218   // Place rectangular strips EST1 inside EUM1 unit module
219
220   yb = -dbox3[1]+dbox1[1];  
221   for (j = 1; j <= nrow_um1; ++j)  
222     {
223       if(j%2 == 0)
224         {
225       xb =cell_radius/2.0;
226         }
227       else
228         {
229           xb = -cell_radius/2.0;
230         }
231       number = j;
232       gMC->Gsposp("EST1",number, "EUM1", xb, yb , 0. , 0, "MANY",dbox1,3);
233       yb = (-dbox3[1]+dbox1[1])+j*1.0*cell_radius*root3;
234     }
235
236   // Create EUM2
237
238   Float_t dbox4[3];
239   dbox4[0] = dbox2[0]+cell_radius/2.;
240   dbox4[1] =(dbox2[1]*nrow_um2)-(cell_radius*root3*(nrow_um2-1)/6.); 
241   dbox4[2] = dbox3[2];
242
243   gMC->Gsvolu("EUM2","BOX", idtmed[698], dbox4, 3);
244   gMC->Gsatt("EUM2", "SEEN", 1);
245
246   // Place rectangular strips EST2 inside EUM2 unit module
247
248   yb = -dbox4[1]+dbox2[1]; 
249   for (j = 1; j <= nrow_um2; ++j) 
250       {
251       if(j%2 == 0)
252         {
253       xb =cell_radius/2.0;
254         }
255       else
256         {
257           xb = -cell_radius/2.0;
258         }
259       number = j;
260       gMC->Gsposp("EST2",number, "EUM2", xb, yb , 0. , 0, "MANY",dbox2,3);
261       yb = (-dbox4[1]+dbox2[1])+j*1.0*cell_radius*root3;
262     }
263
264   // 2 types of Rectangular shaped supermodules (BOX) 
265   //each with 6 unit modules 
266   
267   // volume for SUPERMODULE ESMA 
268   //Space added to provide a gapping for HV between UM's
269
270   Float_t dbox_sm1[3];
271   dbox_sm1[0] = 3.0*dbox3[0]+(2.0*0.025);
272   dbox_sm1[1] = 2.0*dbox3[1]+0.025;
273   dbox_sm1[2] = cell_depth/2.;
274
275   gMC->Gsvolu("ESMA","BOX", idtmed[698], dbox_sm1, 3);
276   gMC->Gsatt("ESMA", "SEEN", 1);
277
278   //Position the 6 unit modules in EMSA
279   Float_t x_a1,x_a2,x_a3,y_a1,y_a2; 
280   x_a1 = -dbox_sm1[0] + dbox3[0];
281   x_a2 = 0.;
282   x_a3 = dbox_sm1[0]  - dbox3[0]; 
283   y_a1 = dbox_sm1[1]  - dbox3[1];
284   y_a2 = -dbox_sm1[1] + dbox3[1];
285   
286   gMC->Gsposp("EUM1", 1, "ESMA", x_a1, y_a1, 0., 0, "ONLY",dbox3,3);
287   gMC->Gsposp("EUM1", 2, "ESMA", x_a2, y_a1, 0., 0, "ONLY",dbox3,3);
288   gMC->Gsposp("EUM1", 3, "ESMA", x_a3, y_a1, 0., 0, "ONLY",dbox3,3);
289   gMC->Gsposp("EUM1", 4, "ESMA", x_a1, y_a2, 0., 0, "ONLY",dbox3,3);
290   gMC->Gsposp("EUM1", 5, "ESMA", x_a2, y_a2, 0., 0, "ONLY",dbox3,3);
291   gMC->Gsposp("EUM1", 6, "ESMA", x_a3, y_a2, 0., 0, "ONLY",dbox3,3);
292
293
294   // volume for SUPERMODULE ESMB 
295   //Space is added to provide a gapping for HV between UM's
296   Float_t dbox_sm2[3];
297   dbox_sm2[0] = 2.0*dbox4[0]+0.025;
298   dbox_sm2[1] = 3.0*dbox4[1]+(2.0*0.025);
299   dbox_sm2[2] = cell_depth/2.;
300   
301   gMC->Gsvolu("ESMB","BOX", idtmed[698], dbox_sm2, 3);
302   gMC->Gsatt("ESMB", "SEEN", 1);
303
304   //Position the 6 unit modules in EMSB
305   Float_t x_b1,x_b2,y_b1,y_b2,y_b3; 
306   x_b1 = -dbox_sm2[0] +dbox4[0];
307   x_b2 = dbox_sm2[0]-dbox4[0];
308   y_b1  =dbox_sm2[1]-dbox4[1];
309   y_b2  = 0.; 
310   y_b3  = -dbox_sm2[1]+dbox4[1];
311   
312   gMC->Gsposp("EUM2", 1, "ESMB", x_b1, y_b1, 0., 0, "ONLY",dbox4,3);
313   gMC->Gsposp("EUM2", 2, "ESMB", x_b2, y_b1, 0., 0, "ONLY",dbox4,3);
314   gMC->Gsposp("EUM2", 3, "ESMB", x_b1, y_b2, 0., 0, "ONLY",dbox4,3);
315   gMC->Gsposp("EUM2", 4, "ESMB", x_b2, y_b2, 0., 0, "ONLY",dbox4,3);
316   gMC->Gsposp("EUM2", 5, "ESMB", x_b1, y_b3, 0., 0, "ONLY",dbox4,3);
317   gMC->Gsposp("EUM2", 6, "ESMB", x_b2, y_b3, 0., 0, "ONLY",dbox4,3);
318
319
320   // Make a 3mm thick G10 Base plate for ESMA
321   Float_t dbox_g1a[3];
322   dbox_g1a[0] = dbox_sm1[0]; 
323   dbox_g1a[1] = dbox_sm1[1];       
324   dbox_g1a[2] = th_base/2.;
325
326   gMC->Gsvolu("EBPA","BOX", idtmed[607], dbox_g1a, 3);
327   gMC->Gsatt("EBPA", "SEEN", 1);
328
329   // Make a 1.6mm thick G10 PCB for ESMA
330   Float_t dbox_g2a[3];
331   dbox_g2a[0] = dbox_sm1[0]; 
332   dbox_g2a[1] = dbox_sm1[1];       
333   dbox_g2a[2] = th_pcb/2.;
334
335   gMC->Gsvolu("EPCA","BOX", idtmed[607], dbox_g2a, 3);
336   gMC->Gsatt("EPCA", "SEEN", 1);
337
338
339   // Make a Full module EFPA of AIR to place EBPA, 
340   // 1mm AIR, EPCA, ESMA,EPCA for PMD
341   
342   Float_t dbox_alla[3];
343   dbox_alla[0] = dbox_sm1[0]; 
344   dbox_alla[1] = dbox_sm1[1];       
345   dbox_alla[2] = (th_base+0.1+th_pcb+dbox_sm1[2]+th_pcb)/2.;
346
347   gMC->Gsvolu("EFPA","BOX", idtmed[698], dbox_alla, 3);
348   gMC->Gsatt("EFPA", "SEEN", 1);
349
350
351   // Make a Full module EFCA of AIR to place EBPA, 
352   // 1mm AIR, EPCA, ESMA,EPC for CPV
353   Float_t dbox_alla2[3];
354   dbox_alla2[0] = dbox_sm1[0]; 
355   dbox_alla2[1] = dbox_sm1[1];       
356   dbox_alla2[2] = (th_base+0.1+th_pcb+dbox_sm1[2]+th_pcb)/2.;
357
358   gMC->Gsvolu("EFCA","BOX", idtmed[698], dbox_alla2, 3);
359   gMC->Gsatt("EFCA", "SEEN", 1);
360
361   // Now place everything in EFPA for PMD
362
363   Float_t z_bpa,z_pcba1,z_pcba2,z_sma; 
364   z_pcba1 = - dbox_alla[2]+th_pcb/2.0;
365   gMC->Gsposp("EPCA", 1, "EFPA", 0., 0., z_pcba1, 0, "ONLY",dbox_g2a,3);
366   z_sma = z_pcba1+dbox_sm1[2];
367   gMC->Gsposp("ESMA", 1, "EFPA", 0., 0., z_sma, 0, "ONLY",dbox_sm1,3);
368   z_pcba2 = z_sma+th_pcb/2.0;
369   gMC->Gsposp("EPCA", 2, "EFPA", 0., 0., z_pcba2, 0, "ONLY",dbox_g2a,3);
370   z_bpa = z_pcba2+0.1+th_base/2.0; // 0.1 for 0.1 mm Air gap 
371   gMC->Gsposp("EBPA", 1, "EFPA", 0., 0., z_bpa, 0, "ONLY",dbox_g1a,3);
372
373   // Now place everything in EFCA for CPV
374
375   Float_t z_bpa2,z_pcba12,z_pcba22,z_sma2; 
376   z_bpa2 = - dbox_alla2[2]+th_base/2.0;
377   gMC->Gsposp("EBPA", 1, "EFCA", 0., 0., z_bpa2, 0, "ONLY",dbox_g1a,3);
378   z_pcba12 = z_bpa2+0.1+th_pcb/2.0;
379   gMC->Gsposp("EPCA", 1, "EFCA", 0., 0., z_pcba12, 0, "ONLY",dbox_g2a,3);
380   z_sma2 = z_pcba12+dbox_sm1[2];
381   gMC->Gsposp("ESMA", 1, "EFCA", 0., 0., z_sma2, 0, "ONLY",dbox_sm1,3);
382   z_pcba22 = z_sma2+th_pcb/2.0;
383   gMC->Gsposp("EPCA", 2, "EFCA", 0., 0., z_pcba22, 0, "ONLY",dbox_g2a,3);
384
385
386
387   // Make a 3mm thick G10 Base plate for ESMB
388   Float_t dbox_g1b[3];
389   dbox_g1b[0] = dbox_sm2[0]; 
390   dbox_g1b[1] = dbox_sm2[1];       
391   dbox_g1b[2] = th_base/2.;
392
393   gMC->Gsvolu("EBPB","BOX", idtmed[607], dbox_g1b, 3);
394   gMC->Gsatt("EBPB", "SEEN", 1);
395
396   // Make a 1.6mm thick G10 PCB for ESMB
397   Float_t dbox_g2b[3];
398   dbox_g2b[0] = dbox_sm2[0]; 
399   dbox_g2b[1] = dbox_sm2[1];       
400   dbox_g2b[2] = th_pcb/2.;
401
402   gMC->Gsvolu("EPCB","BOX", idtmed[607], dbox_g2b, 3);
403   gMC->Gsatt("EPCB", "SEEN", 1);
404
405
406   // Make a Full module EFPB of AIR to place EBPB, 
407   //1mm AIR, EPCB, ESMB,EPCB for PMD
408   Float_t dbox_allb[3];
409   dbox_allb[0] = dbox_sm2[0]; 
410   dbox_allb[1] = dbox_sm2[1];       
411   dbox_allb[2] = (th_base+0.1+th_pcb+dbox_sm2[2]+th_pcb)/2.;
412
413   gMC->Gsvolu("EFPB","BOX", idtmed[698], dbox_allb, 3);
414   gMC->Gsatt("EFPB", "SEEN", 1);
415
416   // Make a Full module EFCB of AIR to place EBPB, 
417   //1mm AIR, EPCB, ESMB,EPCB for CPV
418   Float_t dbox_allb2[3];
419   dbox_allb2[0] = dbox_sm2[0]; 
420   dbox_allb2[1] = dbox_sm2[1];       
421   dbox_allb2[2] = (th_base+0.1+th_pcb+dbox_sm2[2]+th_pcb)/2.;
422
423   gMC->Gsvolu("EFCB","BOX", idtmed[698], dbox_allb2, 3);
424   gMC->Gsatt("EFCB", "SEEN", 1);
425
426
427   // Now place everything in EFPB for PMD
428
429   Float_t z_bpb,z_pcbb1,z_pcbb2,z_smb; 
430   z_pcbb1 = - dbox_allb[2]+th_pcb/2.0;
431   gMC->Gsposp("EPCB", 1, "EFPB", 0., 0., z_pcbb1, 0, "ONLY",dbox_g2b,3);
432   z_smb = z_pcbb1+dbox_sm2[2];
433   gMC->Gsposp("ESMB", 1, "EFPB", 0., 0., z_smb, 0, "ONLY",dbox_sm2,3);
434   z_pcbb2 = z_smb+th_pcb/2.0;
435   gMC->Gsposp("EPCB", 2, "EFPB", 0., 0., z_pcbb2, 0, "ONLY",dbox_g2b,3);
436   z_bpb = z_pcbb2+0.1+th_base/2.0; // 0.1 for 0.1 mm Air gap 
437   gMC->Gsposp("EBPB", 1, "EFPB", 0., 0., z_bpb, 0, "ONLY",dbox_g1b,3);
438
439
440   // Now place everything in EFCB for CPV
441
442   Float_t z_bpb2,z_pcbb12,z_pcbb22,z_smb2; 
443   z_bpb2 = - dbox_allb2[2]+th_base/2.0;
444   gMC->Gsposp("EBPB", 1, "EFCB", 0., 0., z_bpb2, 0, "ONLY",dbox_g1b,3);
445   z_pcbb12 = z_bpb2+0.1+th_pcb/2.0;
446   gMC->Gsposp("EPCB", 1, "EFCB", 0., 0., z_pcbb12, 0, "ONLY",dbox_g2b,3);
447   z_smb2 = z_pcbb12+dbox_sm2[2];
448   gMC->Gsposp("ESMB", 1, "EFCB", 0., 0., z_smb2, 0, "ONLY",dbox_sm2,3);
449   z_pcbb22 = z_smb2+th_pcb/2.0;
450   gMC->Gsposp("EPCB", 2, "EFCB", 0., 0., z_pcbb22, 0, "ONLY",dbox_g2b,3);
451
452
453   // Master MODULE EMPA of aluminum for PMD
454   //Float_t dbox_mm1[3];
455   dbox_mm1[0] = dbox_sm1[0]+boundary; 
456   dbox_mm1[1] = dbox_sm1[1]+boundary;       
457   dbox_mm1[2] = dbox_alla[2];
458
459   gMC->Gsvolu("EMPA","BOX", idtmed[603], dbox_mm1, 3);
460   gMC->Gsatt("EMPA", "SEEN", 1);
461
462   // Master MODULE EMCA of aluminum for CPV
463   //Float_t dbox_mm12[3];
464   dbox_mm12[0] = dbox_sm1[0]+boundary; 
465   dbox_mm12[1] = dbox_sm1[1]+boundary;       
466   dbox_mm12[2] = dbox_alla[2];
467
468   gMC->Gsvolu("EMCA","BOX", idtmed[603], dbox_mm12, 3);
469   gMC->Gsatt("EMCA", "SEEN", 1);
470
471
472   //Position EFMA inside EMMA for PMD and CPV
473   gMC->Gsposp("EFPA", 1, "EMPA", 0., 0., 0., 0, "ONLY",dbox_alla,3);
474   gMC->Gsposp("EFCA", 1, "EMCA", 0., 0., 0., 0, "ONLY",dbox_alla2,3);
475
476
477   // Master MODULE EMPB of aluminum for PMD
478   //Float_t dbox_mm2[3];
479   dbox_mm2[0] = dbox_sm2[0]+boundary; 
480   dbox_mm2[1] = dbox_sm2[1]+boundary;       
481   dbox_mm2[2] = dbox_allb[2];
482
483   gMC->Gsvolu("EMPB","BOX", idtmed[603], dbox_mm2, 3);
484   gMC->Gsatt("EMPB", "SEEN", 1);
485
486   // Master MODULE EMCB of aluminum for CPV
487   //Float_t dbox_mm22[3];
488   dbox_mm22[0] = dbox_sm2[0]+boundary; 
489   dbox_mm22[1] = dbox_sm2[1]+boundary;       
490   dbox_mm22[2] = dbox_allb[2];
491
492   gMC->Gsvolu("EMCB","BOX", idtmed[603], dbox_mm22, 3);
493   gMC->Gsatt("EMCB", "SEEN", 1);
494
495  
496   //Position EFMB inside EMMB
497   gMC->Gsposp("EFPB", 1, "EMPB", 0., 0., 0., 0, "ONLY",dbox_allb,3);
498   gMC->Gsposp("EFCB", 1, "EMCB", 0., 0., 0., 0, "ONLY",dbox_allb2,3);
499
500 }
501  
502 //_____________________________________________________________________________
503
504 void AliPMDv1::CreatePMD()
505 {
506
507   //
508   // Create final detector from supermodules
509   // -- Author : Bedanga and Viyogi June 2003
510
511   Float_t  xp, yp, zp;
512   Int_t jhrot12,jhrot13, irotdm;
513   Int_t *idtmed = fIdtmed->GetArray()-599;
514   
515   //VOLUMES Names : begining with "E" for all PMD volumes, 
516
517   // --- DEFINE Iron, and lead volumes  for SM A
518   
519   Float_t dbox_pba[3];
520   dbox_pba[0] = sm_length_ax;
521   dbox_pba[1] = sm_length_ay;
522   dbox_pba[2] = th_lead/2.;
523   
524   gMC->Gsvolu("EPBA","BOX", idtmed[600], dbox_pba, 3);
525   gMC->Gsatt ("EPBA", "SEEN", 0);
526   
527   //   Fe Support 
528   Float_t dbox_fea[3];
529   dbox_fea[0] = sm_length_ax;
530   dbox_fea[1] = sm_length_ay;
531   dbox_fea[2] = th_steel/2.;
532   
533   gMC->Gsvolu("EFEA","BOX", idtmed[618], dbox_fea, 3);
534   gMC->Gsatt ("EFEA", "SEEN", 0);
535
536   // --- DEFINE Iron, and lead volumes  for SM B
537
538   Float_t dbox_pbb[3];
539   dbox_pbb[0] = sm_length_bx;
540   dbox_pbb[1] = sm_length_by;
541   dbox_pbb[2] = th_lead/2.;
542   
543   gMC->Gsvolu("EPBB","BOX", idtmed[600], dbox_pbb, 3);
544   gMC->Gsatt ("EPBB", "SEEN", 0);
545   
546   //   Fe Support 
547   Float_t dbox_feb[3];
548   dbox_feb[0] = sm_length_bx;
549   dbox_feb[1] = sm_length_by;
550   dbox_feb[2] = th_steel/2.;
551   
552   gMC->Gsvolu("EFEB","BOX", idtmed[618], dbox_feb, 3);
553   gMC->Gsatt ("EFEB", "SEEN", 0);
554
555
556   // Gaspmd, the dimension of RECTANGULAR mother volume of PMD,
557
558   Float_t gaspmd[3] = {81.5,94.5,7.};
559   gaspmd[0] = sm_length_ax+sm_length_bx;
560   gaspmd[1] = sm_length_ay+sm_length_by;
561
562
563   gMC->Gsvolu("EPMD", "BOX", idtmed[698], gaspmd, 3);
564   gMC->Gsatt("EPMD", "SEEN", 1);
565
566   AliMatrix(irotdm, 90., 0.,  90.,  90., 180., 0.);
567    
568   AliMatrix(jhrot12, 90., 180., 90., 270., 0., 0.);
569   AliMatrix(jhrot13, 90., 240., 90., 330., 0., 0.);
570
571   Float_t x_sma,y_sma;
572   Float_t x_smb,y_smb;
573   x_sma = -(sm_length_bx)/1.0;
574   y_sma = sm_length_by;
575   x_smb = -sm_length_ax;
576   y_smb = -sm_length_ay;
577
578   //Complete detector for Type A
579   //Position Super modules type A for both CPV and PMD in EPMD  
580   Float_t z_psa,z_pba,z_fea,z_cva; 
581
582   z_psa = - gaspmd[2] + sm_thick/2.;
583
584   gMC->Gsposp("EMPA", 1, "EPMD", x_sma, y_sma, z_psa, 0, "ONLY",dbox_mm1,3);
585   gMC->Gsposp("EMPA", 2, "EPMD", -x_sma, -y_sma, z_psa, jhrot12, "ONLY",dbox_mm1,3);
586   z_pba=z_psa+sm_thick/2.+dbox_pba[2];
587   gMC->Gsposp("EPBA", 1, "EPMD", x_sma, y_sma, z_pba, 0, "ONLY",dbox_pba,3);
588   gMC->Gsposp("EPBA", 2, "EPMD", -x_sma, -y_sma, z_pba, 0, "ONLY",dbox_pba,3);
589   z_fea=z_pba+dbox_pba[2]+dbox_fea[2];
590   gMC->Gsposp("EFEA", 1, "EPMD", x_sma, y_sma, z_fea, 0, "ONLY",dbox_fea,3);
591   gMC->Gsposp("EFEA", 2, "EPMD", -x_sma, -y_sma, z_fea, 0, "ONLY",dbox_fea,3);
592   z_cva=z_fea+dbox_fea[2]+sm_thick/2.;
593   gMC->Gsposp("EMCA", 1, "EPMD", x_sma, y_sma, z_cva, 0, "ONLY",dbox_mm12,3);
594   gMC->Gsposp("EMCA", 2, "EPMD", -x_sma,-y_sma, z_cva, jhrot12, "ONLY",dbox_mm12,3);
595  
596   //Complete detector for Type B
597   //Position Super modules type B for both CPV and PMD in EPMD  
598   Float_t z_psb,z_pbb,z_feb,z_cvb; 
599   z_psb = - gaspmd[2] + sm_thick/2.;
600   
601   gMC->Gsposp("EMPB", 3, "EPMD", x_smb, y_smb, z_psb, 0, "ONLY",dbox_mm2,3);
602   gMC->Gsposp("EMPB", 4, "EPMD", -x_smb, -y_smb, z_psb, jhrot12, "ONLY",dbox_mm2,3);
603   z_pbb=z_psb+sm_thick/2.+dbox_pbb[2];
604   gMC->Gsposp("EPBB", 3, "EPMD", x_smb, y_smb, z_pbb, 0, "ONLY",dbox_pbb,3);
605   gMC->Gsposp("EPBB", 4, "EPMD", -x_smb, -y_smb, z_pbb, 0, "ONLY",dbox_pbb,3);
606   z_feb=z_pbb+dbox_pbb[2]+dbox_feb[2];
607   gMC->Gsposp("EFEB", 3, "EPMD", x_smb, y_smb, z_feb, 0, "ONLY",dbox_feb,3);
608   gMC->Gsposp("EFEB", 4, "EPMD", -x_smb, -y_smb, z_feb, 0, "ONLY",dbox_feb,3);
609   z_cvb=z_feb+dbox_feb[2]+sm_thick/2.;
610   gMC->Gsposp("EMCB", 3, "EPMD", x_smb, y_smb, z_cvb, 0, "ONLY",dbox_mm22,3);
611   gMC->Gsposp("EMCB", 4, "EPMD", -x_smb,-y_smb, z_cvb, jhrot12, "ONLY",dbox_mm22,3);
612   
613   // --- Place the EPMD in ALICE 
614   xp = 0.;
615   yp = 0.;
616   zp = zdist1;
617
618   //Position Full PMD in ALICE   
619   gMC->Gsposp("EPMD", 1, "ALIC", xp,yp,zp, 0, "ONLY",gaspmd,3);
620
621 }
622
623  
624 //_____________________________________________________________________________
625 void AliPMDv1::DrawModule()
626 {
627   cout << " Inside Draw Modules " << endl;
628   //
629   // Draw a shaded view of the Photon Multiplicity Detector
630   //
631
632   gMC->Gsatt("*", "seen", -1);
633   gMC->Gsatt("alic", "seen", 0);
634   //
635   // Set the visibility of the components
636   // 
637   gMC->Gsatt("ECAR","seen",0);
638   gMC->Gsatt("ECCU","seen",1);
639   gMC->Gsatt("EST1","seen",1);
640   gMC->Gsatt("EST2","seen",1);
641   gMC->Gsatt("EUM1","seen",1);
642   gMC->Gsatt("EUM2","seen",1);
643   gMC->Gsatt("ESMA","seen",1);
644   gMC->Gsatt("EPMD","seen",1);
645   //
646   gMC->Gdopt("hide", "on");
647   gMC->Gdopt("shad", "on");
648   gMC->Gsatt("*", "fill", 7);
649   gMC->SetClipBox(".");
650   gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
651   gMC->DefaultRange();
652   gMC->Gdraw("alic", 40, 30, 0, 22, 20.5, .02, .02);
653   gMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
654
655   //gMC->Gdman(17, 5, "MAN");
656   gMC->Gdopt("hide", "off");
657
658   cout << " Outside Draw Modules " << endl;
659 }
660
661 //_____________________________________________________________________________
662 void AliPMDv1::CreateMaterials()
663 {
664   cout << " Inside create materials " << endl;
665   //
666   // Create materials for the PMD
667   //
668   // ORIGIN    : Y. P. VIYOGI 
669   //
670   
671   // --- The Argon- CO2 mixture --- 
672   Float_t ag[2] = { 39.95 };
673   Float_t zg[2] = { 18. };
674   Float_t wg[2] = { .7,.3 };
675   Float_t dar   = .001782;   // --- Ar density in g/cm3 --- 
676   // --- CO2 --- 
677   Float_t ac[2] = { 12.,16. };
678   Float_t zc[2] = { 6.,8. };
679   Float_t wc[2] = { 1.,2. };
680   Float_t dc    = .001977;
681   Float_t dco   = .002;  // --- CO2 density in g/cm3 ---
682   
683   Float_t absl, radl, a, d, z;
684   Float_t dg;
685   Float_t x0ar;
686   Float_t buf[1];
687   Int_t nbuf;
688   Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
689   Float_t zsteel[4] = { 26.,24.,28.,14. };
690   Float_t wsteel[4] = { .715,.18,.1,.005 };
691   
692   Int_t *idtmed = fIdtmed->GetArray()-599;
693   Int_t isxfld = gAlice->Field()->Integ();
694   Float_t sxmgmx = gAlice->Field()->Max();
695   
696   // --- Define the various materials for GEANT --- 
697   AliMaterial(1, "Pb    $", 207.19, 82., 11.35, .56, 18.5);
698   x0ar = 19.55 / dar;
699   AliMaterial(2, "Argon$", 39.95, 18., dar, x0ar, 6.5e4);
700   AliMixture(3, "CO2  $", ac, zc, dc, -2, wc);
701   AliMaterial(4, "Al   $", 26.98, 13., 2.7, 8.9, 18.5);
702   AliMaterial(6, "Fe   $", 55.85, 26., 7.87, 1.76, 18.5);
703   AliMaterial(7, "W    $", 183.85, 74., 19.3, .35, 10.3);
704   AliMaterial(8, "G10  $", 20., 10., 1.7, 19.4, 999.);
705   AliMaterial(9, "SILIC$", 28.09, 14., 2.33, 9.36, 45.);
706   AliMaterial(10, "Be   $", 9.01, 4., 1.848, 35.3, 36.7);
707   AliMaterial(15, "Cu   $", 63.54, 29., 8.96, 1.43, 15.);
708   AliMaterial(16, "C    $", 12.01, 6., 2.265, 18.8, 49.9);
709   AliMaterial(17, "POLYCARBONATE    $", 20., 10., 1.2, 34.6, 999.);
710   AliMixture(19, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel); 
711   // AliMaterial(31, "Xenon$", 131.3, 54., dxe, x0xe, 6.5e4);
712   
713   AliMaterial(96, "MYLAR$", 8.73, 4.55, 1.39, 28.7, 62.);
714   AliMaterial(97, "CONCR$", 20., 10., 2.5, 10.7, 40.);
715   AliMaterial(98, "Vacum$", 1e-9, 1e-9, 1e-9, 1e16, 1e16);
716   AliMaterial(99, "Air  $", 14.61, 7.3, .0012, 30420., 67500.);
717  
718   //    define gas-mixtures 
719   
720   char namate[21];
721   gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
722   ag[1] = a;
723   zg[1] = z;
724   dg = (dar * 4 + dco) / 5;
725   AliMixture(5, "ArCO2$", ag, zg, dg, 2, wg);
726   
727   // Define tracking media 
728   AliMedium(1, "Pb conv.$", 1,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
729   AliMedium(7, "W  conv.$", 7,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
730   AliMedium(8, "G10plate$", 8,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
731   AliMedium(4, "Al      $", 4,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
732   AliMedium(6, "Fe      $", 6,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
733   AliMedium(5, "ArCO2   $", 5,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
734   AliMedium(9, "SILICON $", 9,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
735   AliMedium(10, "Be      $", 10, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
736   AliMedium(98, "Vacuum  $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .1,  10);
737   AliMedium(99, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .1,  .1);
738   AliMedium(15, "Cu      $", 15, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
739   AliMedium(16, "C       $", 16, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
740   AliMedium(17, "PLOYCARB$", 17, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
741   AliMedium(19, " S steel$", 19, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
742   //  AliMedium(31, "Xenon   $", 31,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
743   
744   // --- Generate explicitly delta rays in the iron, aluminium and lead --- 
745   gMC->Gstpar(idtmed[600], "LOSS", 3.);
746   gMC->Gstpar(idtmed[600], "DRAY", 1.);
747   
748   gMC->Gstpar(idtmed[603], "LOSS", 3.);
749   gMC->Gstpar(idtmed[603], "DRAY", 1.);
750   
751   gMC->Gstpar(idtmed[604], "LOSS", 3.);
752   gMC->Gstpar(idtmed[604], "DRAY", 1.);
753   
754   gMC->Gstpar(idtmed[605], "LOSS", 3.);
755   gMC->Gstpar(idtmed[605], "DRAY", 1.);
756   
757   gMC->Gstpar(idtmed[606], "LOSS", 3.);
758   gMC->Gstpar(idtmed[606], "DRAY", 1.);
759   
760   gMC->Gstpar(idtmed[607], "LOSS", 3.);
761   gMC->Gstpar(idtmed[607], "DRAY", 1.);
762   
763   // --- Energy cut-offs in the Pb and Al to gain time in tracking --- 
764   // --- without affecting the hit patterns --- 
765   gMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
766   gMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
767   gMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
768   gMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
769   gMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
770   gMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
771   gMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
772   gMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
773   gMC->Gstpar(idtmed[606], "CUTGAM", 1e-4);
774   gMC->Gstpar(idtmed[606], "CUTELE", 1e-4);
775   gMC->Gstpar(idtmed[606], "CUTNEU", 1e-4);
776   gMC->Gstpar(idtmed[606], "CUTHAD", 1e-4);
777   gMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
778   gMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
779   gMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
780   gMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
781   gMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
782   gMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
783   gMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
784   gMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
785   
786   // --- Prevent particles stopping in the gas due to energy cut-off --- 
787   gMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
788   gMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
789   gMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
790   gMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
791   gMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
792
793   cout << " Outside create materials " << endl;
794
795 }
796
797 //_____________________________________________________________________________
798 void AliPMDv1::Init()
799 {
800   //
801   // Initialises PMD detector after it has been built
802   //
803
804   Int_t i;
805   kdet=1;
806   //
807   cout << " Inside Init " << endl;
808   if(fDebug) {
809       printf("\n%s: ",ClassName());
810       for(i=0;i<35;i++) printf("*");
811       printf(" PMD_INIT ");
812       for(i=0;i<35;i++) printf("*");
813       printf("\n%s: ",ClassName());
814       printf("                 PMD simulation package (v1) initialised\n");
815       printf("%s: parameters of pmd\n",ClassName());
816       printf("%s: %10.2f %10.2f %10.2f \
817       %10.2f\n",ClassName(),cell_radius,cell_wall,cell_depth,zdist1 );
818       printf("%s: ",ClassName());
819       for(i=0;i<80;i++) printf("*");
820       printf("\n");
821   }
822   
823   Int_t *idtmed = fIdtmed->GetArray()-599;
824   fMedSens=idtmed[605-1];
825
826 }
827
828 //_____________________________________________________________________________
829 void AliPMDv1::StepManager()
830 {
831   //
832   // Called at each step in the PMD
833   //
834
835   Int_t   copy;
836   Float_t hits[4], destep;
837   Float_t center[3] = {0,0,0};
838   Int_t   vol[8]; //5
839   //const char *namep;
840   
841   if(gMC->GetMedium() == fMedSens && (destep = gMC->Edep())) {
842   
843     gMC->CurrentVolID(copy);
844     //namep=gMC->CurrentVolName();
845     //printf("Current vol  is %s \n",namep);
846     vol[0]=copy;
847
848     gMC->CurrentVolOffID(1,copy);
849     //namep=gMC->CurrentVolOffName(1);
850     //printf("Current vol 11 is %s \n",namep);
851     vol[1]=copy;
852
853     gMC->CurrentVolOffID(2,copy);
854     //namep=gMC->CurrentVolOffName(2);
855     //printf("Current vol 22 is %s \n",namep);
856     vol[2]=copy;
857
858     //  if(strncmp(namep,"EHC1",4))vol[2]=1;
859
860     gMC->CurrentVolOffID(3,copy);
861     //namep=gMC->CurrentVolOffName(3);
862     //printf("Current vol 33 is %s \n",namep);
863     vol[3]=copy;
864
865     gMC->CurrentVolOffID(4,copy);
866     //namep=gMC->CurrentVolOffName(4);
867     //printf("Current vol 44 is %s \n",namep);
868     vol[4]=copy;
869
870     gMC->CurrentVolOffID(5,copy);
871     //namep=gMC->CurrentVolOffName(5);
872     //printf("Current vol 55 is %s \n",namep);
873     vol[5]=copy;
874
875     gMC->CurrentVolOffID(6,copy);
876     //namep=gMC->CurrentVolOffName(6);
877     //printf("Current vol 66 is %s \n",namep);
878     vol[6]=copy;
879
880     gMC->CurrentVolOffID(7,copy);
881     //namep=gMC->CurrentVolOffName(7);
882     //printf("Current vol 77 is %s \n",namep);
883     vol[7]=copy;
884
885
886     //printf("volume number %4d %4d %4d %4d %4d %4d %4d %4d %10.3f \n",vol[0],vol[1],vol[2],vol[3],vol[4],vol[5],vol[6],vol[7],destep*1000000);
887     
888     gMC->Gdtom(center,hits,1);
889     hits[3] = destep*1e9; //Number in eV
890     AddHit(gAlice->GetCurrentTrackNumber(), vol, hits);
891
892   }
893 }
894
895   
896 //------------------------------------------------------------------------
897 // Get parameters
898
899 void AliPMDv1::GetParameters()
900 {
901   const Float_t root3 = TMath::Sqrt(3.); 
902   const Float_t root3_2 = TMath::Sqrt(3.) /2.; 
903   //
904   cell_radius=0.25;
905   cell_wall=0.02;
906   cell_depth=0.25 * 2.;
907   //
908   ncol_um1 = 48;
909   ncol_um2 = 96;
910   nrow_um1 = 96;//each strip has 1 row
911   nrow_um2 = 48;//each strip has 1 row
912   //
913   sm_length_ax = (3.0*(ncol_um1*cell_radius+cell_radius/2.)+(2.0*0.025)) + 0.7;
914   sm_length_bx = 2.0*(ncol_um2*cell_radius+cell_radius/2.)+0.025+0.7; 
915
916   sm_length_ay = 2.0*(((cell_radius/root3_2)*nrow_um1)-(cell_radius*root3*(nrow_um1-1)/6.))+0.025+0.7;
917   sm_length_by = 3.0*(((cell_radius/root3_2)*nrow_um2)-(cell_radius*root3*(nrow_um2-1)/6.))+(2.0*0.025)+0.7;
918     //
919     boundary=0.7;
920     //
921     th_base=0.3;
922     th_air=0.1;
923     th_pcb=0.16;
924     //
925     sm_thick = th_base + th_air + th_pcb + cell_depth + th_pcb + th_air + th_pcb;
926     //
927     th_lead=1.5;
928     th_steel=0.5;
929     
930     zdist1 = 361.5;
931
932 }