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