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