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