]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMDv1.cxx
G4 compatibility changes
[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 /*
17 $Log$
18 Revision 1.6  1999/09/29 09:24:28  fca
19 Introduction of the Copyright and cvs Log
20
21 */
22
23 ///////////////////////////////////////////////////////////////////////////////
24 //                                                                           //
25 //  Photon Multiplicity Detector Version 1                                   //
26 //                                                                           //
27 //Begin_Html
28 /*
29 <img src="picts/AliPMDv1Class.gif">
30 */
31 //End_Html
32 //                                                                           //
33 ///////////////////////////////////////////////////////////////////////////////
34
35 #include "AliPMDv1.h"
36 #include "AliRun.h"
37 #include "AliMC.h" 
38 #include "AliConst.h" 
39  
40 static Int_t maxbox, kdet;
41 static Float_t thmin,thmax,zdist,zdist1,thlow,thhigh;
42
43 ClassImp(AliPMDv1)
44  
45 //_____________________________________________________________________________
46 AliPMDv1::AliPMDv1()
47 {
48   //
49   // Default constructor 
50   //
51   fMedSens=0;
52 }
53  
54 //_____________________________________________________________________________
55 AliPMDv1::AliPMDv1(const char *name, const char *title)
56   : AliPMD(name,title)
57 {
58   //
59   // Standard constructor
60   //
61   fMedSens=0;
62 }
63 //_____________________________________________________________________________
64 void AliPMDv1::CreateGeometry()
65 {
66   //
67   // Create geometry for Photon Multiplicity Detector Version 1
68   //
69   //Begin_Html
70   /*
71     <img src="picts/AliPMDv1.gif">
72   */
73   //End_Html
74   //Begin_Html
75   /*
76     <img src="picts/AliPMDv1Tree.gif">
77   */
78   //End_Html
79   CreatePads();
80   CreateInside();
81 }
82  
83 //_____________________________________________________________________________
84 void AliPMDv1::CreateInside()
85 {
86   //
87   // Create inside of Pads
88   //
89   // -- Author :     Y.P. VIYOGI, 07/05/1996. 
90   // -- Modified:    P.V.K.S.Baba(JU), 15-12-97. 
91 // Sipmd, the dimension of TUBE mother volume of PMD, other dimensions
92 // like sip01.. are to place more tubes in the volume at different eta bins.  
93   Float_t sipmd[3] = { 40.,270.,15.};
94   Float_t sip01[3] = { 10.,57.89,25.};
95   Float_t sip02[3] = { 10.,64.03,25.};
96   Float_t sip03[3] = { 10.,70.80,25.};
97   Float_t sip04[3] = { 10.,78.32,25.};
98   Float_t sip05[3] = { 10.,86.68,25.};
99   Float_t sip06[3] = { 10.,95.91,25.};
100   Float_t sip07[3] = { 10.,106.14,25.};
101   Float_t sip08[3] = { 10.,117.48,25.};
102   Float_t sip09[3] = { 10.,130.18,25.};
103   Float_t sip10[3] = { 10.,144.18,25.};
104   Float_t sip11[3] = { 10.,159.87,25.};
105   Float_t sip12[3] = { 10.,177.43,25.};
106   Float_t sip13[3] = { 10.,197.11,25.};
107   Float_t sip14[3] = { 10.,219.28,25.};
108   Float_t sipmdl[5] = { 10.,310.,25.,90.,270. };
109   Float_t sipmdr[5] = { 10.,310.,25.,270.,90. };
110   
111   const Float_t root3_4 = sqrt(3)/4.;
112   const Float_t root3_2 = sqrt(3)/2.;
113   //  Float_t xiqa[4], yiqa[4];
114   Int_t i;
115   //  Float_t siqad[4];
116   Float_t  xp, yp, zp;
117   //  Int_t idrotm[100];
118   Int_t num_mod;
119   Int_t jhrotc,jhrotac;
120 //  const Float_t delx=78.8;
121   const Float_t delx=76.75;
122   //  const Float_t dely=delx*root3_2;
123 //  const Float_t delz=1.6/2.;
124   AliMatrix(jhrotc, 90., 30.,   90.,  120., 0., 0.);
125   AliMatrix(jhrotac, 90., 330., 90., 240., 0., 0.);
126   Float_t x1= delx*root3_4;
127   Float_t x2= delx*root3_4 + delx*root3_2;
128   Float_t x3= delx*root3_4 + 2*delx*root3_2;
129  Float_t xpos[13]={-x1,-x1,-x1,-x1,-x2,-x2,-x2,-x2,-x2,-x3,-x3,-x3,-x3};
130   Float_t x4=delx/4.; 
131  Float_t ypos[13]={(-70.-x4-delx),-(70.+x4),(70.+x4),(70.+x4+delx),-x4+2*delx,-x4+delx,-x4,-x4-delx,-x4-2*delx,-3*x4-delx,-x4-delx/2.,-3*x4+delx,-3*x4+2*delx};
132 // Float_t ypos[13]={(-70.-x4-delx),-(70.+x4),(70.+x4),(70.+x4+delx),(4*dely),(2*dely),0.,-(2*dely),-(4*dely),-3*x4-delx,-x4-delx/2.,-3*x4+delx,-3*x4+2*delx};
133   Int_t *idtmed = fIdtmed->GetArray()-599;
134   
135   //  VOLUMES Names : begining with D for all PMD volumes, 
136   // The names of SIZE variables begin with S and have more meaningful
137   // characters as shown below. 
138   
139   //            VOLUME  SIZE    MEDIUM  :       REMARKS 
140   //            ------  -----   ------  : --------------------------- 
141   
142   //            DPMD    SIPMD   AIR     : INSIDE PMD  and its SIZE 
143   
144   
145   
146   // *** Define the  DPMD   Volume and fill with air *** 
147
148   gMC->Gsvolu("DPMD", "TUBE", idtmed[698], sipmd, 3);
149   gMC->Gsvolu("PM01", "TUBE", idtmed[698], sip01, 3);
150   gMC->Gsvolu("PM02", "TUBE", idtmed[698], sip02, 3);
151   gMC->Gsvolu("PM03", "TUBE", idtmed[698], sip03, 3);
152   gMC->Gsvolu("PM04", "TUBE", idtmed[698], sip04, 3);
153   gMC->Gsvolu("PM05", "TUBE", idtmed[698], sip05, 3);
154   gMC->Gsvolu("PM06", "TUBE", idtmed[698], sip06, 3);
155   gMC->Gsvolu("PM07", "TUBE", idtmed[698], sip07, 3);
156   gMC->Gsvolu("PM08", "TUBE", idtmed[698], sip08, 3);
157   gMC->Gsvolu("PM09", "TUBE", idtmed[698], sip09, 3);
158   gMC->Gsvolu("PM10", "TUBE", idtmed[698], sip10, 3);
159   gMC->Gsvolu("PM11", "TUBE", idtmed[698], sip11, 3);
160   gMC->Gsvolu("PM12", "TUBE", idtmed[698], sip12, 3);
161   gMC->Gsvolu("PM13", "TUBE", idtmed[698], sip13, 3);
162   gMC->Gsvolu("PM14", "TUBE", idtmed[698], sip14, 3);
163   gMC->Gsvolu("PMDL", "TUBS", idtmed[698], sipmdl, 5);
164   gMC->Gsvolu("PMDR", "TUBS", idtmed[698], sipmdr, 5);
165 //  
166   const Int_t npad2=72; 
167   Float_t hexd1[10] = {0.,360.,6,2,-0.4,0.,0.53,0.4,0.,0.53};
168   Float_t dpara_sm[6] = {12.5,12.5,0.8,30.,0.,0.};
169   dpara_sm[0]=(npad2+0.25)*hexd1[6] + 1.2;
170   dpara_sm[1] = dpara_sm[0] *root3_2;
171   Float_t dpara_dm11[6] = {12.5,12.5,0.8,30.,0.,0.};
172   dpara_dm11[0]=dpara_sm[0]+.01;
173   dpara_dm11[1] = dpara_dm11[0] *root3_2;
174   dpara_dm11[2]= 6.2/2.;
175 //
176     for (i = 0; i < 2; ++i) {
177         num_mod=i+1;
178   gMC->Gsposp("DM11", num_mod, "DPMD", xpos[i],ypos[i],0., jhrotac, "ONLY", dpara_dm11, 6);
179   gMC->Gsposp("DM11", num_mod+13, "DPMD", TMath::Abs(xpos[i]),ypos[i],0., jhrotc, "ONLY", dpara_dm11, 6);
180     printf("Num_mod %d\n",num_mod);
181         }
182    maxbox=13;
183     for (i = 2; i < maxbox; ++i) {
184         num_mod=i+1;
185   gMC->Gsposp("DM11", num_mod, "DPMD", xpos[i],ypos[i],0., jhrotc, "ONLY", dpara_dm11, 6);
186   gMC->Gsposp("DM11", num_mod+13, "DPMD", TMath::Abs(xpos[i]),ypos[i],0., jhrotac, "ONLY", dpara_dm11, 6);
187     printf("Num_mod %d\n",num_mod);
188         }
189 //  gMC->Gspos("PM01", 1, "DPMD", 0.,0.,0., 0, "ONLY");
190 //  gMC->Gspos("PM02", 1, "DPMD", 0.,0.,0., 0, "ONLY");
191 //  gMC->Gspos("PM03", 1, "DPMD", 0.,0.,0., 0, "ONLY");
192 //  gMC->Gspos("PM04", 1, "DPMD", 0.,0.,0., 0, "ONLY");
193 //  gMC->Gspos("PM05", 1, "DPMD", 0.,0.,0., 0, "ONLY");
194 //  gMC->Gspos("PM06", 1, "DPMD", 0.,0.,0., 0, "ONLY");
195 //  gMC->Gspos("PM07", 1, "DPMD", 0.,0.,0., 0, "ONLY");
196 //  gMC->Gspos("PM08", 1, "DPMD", 0.,0.,0., 0, "ONLY");
197 //  gMC->Gspos("PM09", 1, "DPMD", 0.,0.,0., 0, "ONLY");
198 //  gMC->Gspos("PM10", 1, "DPMD", 0.,0.,0., 0, "ONLY");
199 //  gMC->Gspos("PM11", 1, "DPMD", 0.,0.,0., 0, "ONLY");
200 //  gMC->Gspos("PM12", 1, "DPMD", 0.,0.,0., 0, "ONLY");
201 //  gMC->Gspos("PM13", 1, "DPMD", 0.,0.,0., 0, "ONLY");
202 //  gMC->Gspos("PM14", 1, "DPMD", 0.,0.,0., 0, "ONLY");
203 // --- Place the DPMD in ALICE with front edge 5.8m from vertex  --- 
204     xp = 0.;
205     yp = 0.;
206     zp = zdist1;
207 //  gMC->Gspos("PMDL", 1, "DPMD", xp,yp,0., 0, "ONLY");
208 //  gMC->Gspos("PMDR", 1, "DPMD", xp,yp,0., 0, "ONLY");
209   gMC->Gspos("DPMD", 1, "ALIC", xp,yp,zp, 0, "ONLY");
210     
211 }
212
213 //_____________________________________________________________________________
214 void AliPMDv1::CreatePads()
215 {
216   //
217   // Create the geometry of the pads
218   // *** DEFINITION OF THE GEOMETRY OF THE PMD  *** 
219   // *** HEXAGONAL PADS WITH 10 MM SQUARE EQUIVALENT
220   // -- Author :     S. Chattopadhyay, 02/04/1999. 
221
222 // Basic unit is DP11, a hexagonal cell, which is placed inside another 
223 // hexagonal cell (DS11) of larger radius, compared to DP11. The difference in r// adius gives the dimension of half width of each cell wall.
224 // These cells are placed as 72 x 72 array in a 
225 // rhombus shaped supermodule (DW11). The rhombus shaped modules are designed
226 // to have closed packed structure.
227 // Each supermodule (SUPR), made of G10 is filled with following components
228 //  SMSS --> SS backing,
229 //  SMAR --> Gap between gas hexagonal cells and G10 backing.
230 //  DW11 --> Ar-Co2 filled gas hexagonal cells.
231 //  SMAR
232 // These supermodules are placed inside the main module (DM11), with Fe and 
233 // Pb converter positioned between CPV and PMD.
234 //  DM11 made of
235 // SUPR (rotated to place steel on the other side), this works as preshower
236 // when PMD is placed in -ve z.
237 // SUPB --> Pb converter
238 // SUFE --> Fe backing
239 // SUPR --> supermodule without rotation (this acts as CPV).
240 // 
241   
242   const Int_t npad2 = 72;
243   Float_t hexd1[10] = {0.,360.,6,2,-0.4,0.,0.53,0.4,0.,0.53};
244 //total wall thickness=0.2*2
245   Float_t hexd2[10] = {0.,360.,6,2,-0.4,0.,0.51,0.4,0.,0.51};
246   Int_t i, j;
247   Float_t xb, yb, zb;//, sw[3];
248   Int_t number;
249   Int_t ihrotm,irotdm;
250   const Float_t root3_cons = sqrt(3) /2.; 
251   Int_t *idtmed = fIdtmed->GetArray()-599;
252  
253   AliMatrix(ihrotm, 90., 30.,   90.,  120., 0., 0.);
254   AliMatrix(irotdm, 90., 180.,  90.,  270., 180., 0.);
255   zdist1  = fIn[2];
256   zdist = TMath::Abs(zdist1);
257 //
258   Int_t xrow=1;
259   Float_t dpara[6] = {12.5,12.5,0.4,30.,0.,0.};
260   dpara[0]=(npad2+0.25)*hexd1[6];
261   dpara[1] = dpara[0] *root3_cons;
262 //
263 //Subhasis, dimensional parameters of rhombus (dpara) as given to gsvolu
264 // rhombus to accomodate 72 x 72 hexagons, and with total 1.2cm extension  
265 //(1mm tolerance on both side and 5mm thick G10 wall)
266 // 
267   
268 // **** PAD SIZE 10 MM SQUARE EQUIVALENT
269 //
270 // Inner hex filled with gas
271   gMC->Gsvolu("DP11", "PGON", idtmed[604], hexd2,10);
272   gMC->Gsatt("DP11", "SEEN", 1);
273
274 // Outer hex filled with Plastic
275 //plastic  gMC->Gsvolu("DS11", "PGON", idtmed[616], hexd1,10);
276 // Iron
277   gMC->Gsvolu("DS11", "PGON", idtmed[601], hexd1,10);
278   gMC->Gsatt("DS11", "SEEN", 1);
279 // --- place  inner hex inside outer hex 
280     gMC->Gsposp("DP11", 1, "DS11", 0., 0., 0., 0, "ONLY", hexd2, 10);
281 // Rhombus shaped supermodules (defined by PARA)
282 // volume for SUPERMODULE 
283   Float_t dpara_sm[6] = {12.5,12.5,0.8,30.,0.,0.};
284   dpara_sm[0]=(npad2+0.25)*hexd1[6] + 1.2;
285   dpara_sm[1] = dpara_sm[0] *root3_cons;
286 //  
287   gMC->Gsvolu("SUPR","PARA", idtmed[607], dpara_sm, 6);
288   gMC->Gsatt("SUPR", "SEEN", 1);
289 //  SS 
290   Float_t dpara_ss[6] = {12.5,12.5,8.,30.,0.,0.};
291   dpara_ss[0]= dpara[0];
292   dpara_ss[1]= dpara[1];
293   dpara_ss[2]= 0.3/2.;
294 //
295   gMC->Gsvolu("SMSS","PARA", idtmed[601], dpara_ss, 6);
296   gMC->Gsatt("SMSS", "SEEN", 1);
297 // Air 
298   Float_t dpara_air[6] = {12.5,12.5,8.,30.,0.,0.};
299   dpara_air[0]= dpara[0] - 0.5;
300   dpara_air[1]= dpara_air[0] * root3_cons;
301   dpara_air[2]= 0.1/2.;
302 //  gMC->Gsvolu("SMAR","PARA", idtmed[604], dpara_air, 6);
303   gMC->Gsvolu("SMAR","PARA", idtmed[698], dpara_air, 6);
304   gMC->Gsatt("SMAR", "SEEN", 1);
305 //  
306 // volume for gas chamber (DW11)
307 //  
308 //  gMC->Gsvolu("DW11","PARA", idtmed[604], dpara, 6);
309   gMC->Gsvolu("DW11","PARA", idtmed[698], dpara, 6);
310   gMC->Gsatt("DW11", "SEEN", 1);
311 // Place outer hex inside DW11
312   yb = -dpara[1] + (1./root3_cons)*hexd1[6];
313   zb = 0.;
314   for (j = 1; j <= npad2; ++j) {
315   xb =-(dpara[0] + dpara[1]*0.577) + 2*hexd1[6];
316    if(xrow >= 2){
317     xb = xb+(xrow-1)*hexd1[6];
318     }
319   for (i = 1; i <= npad2; ++i) {
320       number = i+(j-1)*npad2;
321     gMC->Gsposp("DS11", number, "DW11", xb, yb, zb, ihrotm, "ONLY", hexd1, 10);
322     xb += (hexd1[6]*2.);
323   }
324    xrow = xrow+1;
325     yb += (hexd1[6]*sqrt(3.));
326   }
327  Float_t z_ss,z_air1,z_air2,z_gas; 
328 // Place other components inside super module 
329     z_ss=-dpara_sm[2]+dpara_ss[2]; 
330     gMC->Gspos("SMSS", 1, "SUPR", 0., 0., z_ss, 0, "ONLY");
331     z_air1=z_ss+dpara_ss[2] +dpara_air[2]; 
332     gMC->Gspos("SMAR", 1, "SUPR", 0., 0., z_air1, 0, "ONLY");
333     z_gas=z_air1+dpara_air[2]+dpara[2]+0.1; 
334     gMC->Gspos("DW11", 1, "SUPR", 0., 0., z_gas, 0, "ONLY");
335     z_air2=z_gas+dpara[2]+0.1+dpara_air[2]; 
336     gMC->Gspos("SMAR", 2, "SUPR", 0., 0., z_air2, 0, "ONLY");
337   
338 // --- DEFINE MODules, iron, and lead voLUMES 
339   
340   
341 // volume for SUPERMODULE 
342 //   Pb 
343   Float_t dpara_pb[6] = {12.5,12.5,8.,30.,0.,0.};
344   dpara_pb[0]=dpara_sm[0];
345   dpara_pb[1]=dpara_sm[1];
346 //  dpara_pb[2]=1.1/2.;
347   dpara_pb[2]=1.5/2.;
348   gMC->Gsvolu("SUPB","PARA", idtmed[600], dpara_pb, 6);
349   gMC->Gsatt("SUPB", "SEEN", 1);
350 //   Fe 
351   Float_t dpara_fe[6] = {12.5,12.5,8.,30.,0.,0.};
352   dpara_fe[0]=dpara_sm[0];
353   dpara_fe[1]=dpara_sm[1];
354   dpara_fe[2]=0.5/2.;
355   gMC->Gsvolu("SUFE","PARA", idtmed[601], dpara_fe, 6);
356   gMC->Gsatt("SUFE", "SEEN", 1);
357 // volume for DM11 
358   Float_t dpara_dm11[6] = {12.5,12.5,0.8,30.,0.,0.};
359   dpara_dm11[0]=dpara_sm[0]+.01;
360   dpara_dm11[1] = dpara_dm11[0] *root3_cons;
361   dpara_dm11[2]= 6.2/2.;
362
363 //  
364   gMC->Gsvolu("DM11","PARA", idtmed[698], dpara_dm11, 6);
365   gMC->Gsatt("DM11", "SEEN", 1);
366 // position super module inside DM11
367  Float_t z_ps,z_pb,z_fe,z_cv; 
368   z_ps=-dpara_dm11[2]+dpara_sm[2];
369   gMC->Gspos("SUPR", 1, "DM11", 0., 0., z_ps, irotdm, "ONLY");
370   z_pb=z_ps+dpara_sm[2]+dpara_pb[2];
371   gMC->Gspos("SUPB", 1, "DM11", 0., 0., z_pb, 0, "ONLY");
372   z_fe=z_pb+dpara_pb[2]+dpara_fe[2];
373   gMC->Gspos("SUFE", 1, "DM11", 0., 0., z_fe, 0, "ONLY");
374   z_cv=z_fe+dpara_fe[2]+dpara_sm[2];
375   gMC->Gspos("SUPR", 2, "DM11", 0., 0., z_cv, 0, "ONLY");
376 // 
377 }
378  
379 //_____________________________________________________________________________
380 void AliPMDv1::DrawModule()
381 {
382   //
383   // Draw a shaded view of the Photon Multiplicity Detector
384   //
385
386   gMC->Gsatt("*", "seen", -1);
387   gMC->Gsatt("alic", "seen", 0);
388   //
389   // Set the visibility of the components
390   // 
391   gMC->Gsatt("DP11","seen",0);
392   gMC->Gsatt("DS11","seen",1);
393   gMC->Gsatt("DW11","seen",0);
394   gMC->Gsatt("DM11","seen",1);
395   gMC->Gsatt("DPMD","seen",0);
396   //
397   gMC->Gdopt("hide", "on");
398   gMC->Gdopt("shad", "on");
399   gMC->Gsatt("*", "fill", 7);
400   gMC->SetClipBox(".");
401   gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
402   gMC->DefaultRange();
403   gMC->Gdraw("alic", 40, 30, 0, 22, 20.5, .02, .02);
404   gMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
405   //gMC->Gdman(17, 5, "MAN");
406   gMC->Gdopt("hide", "off");
407 }
408
409 //_____________________________________________________________________________
410 void AliPMDv1::CreateMaterials()
411 {
412   //
413   // Create materials for the PMD version 1
414   //
415   // ORIGIN    : Y. P. VIYOGI 
416   //
417   
418   // --- The Argon- CO2 mixture --- 
419   Float_t ag[2] = { 39.95 };
420   Float_t zg[2] = { 18. };
421   Float_t wg[2] = { .8,.2 };
422   Float_t dar   = .001782;   // --- Ar density in g/cm3 --- 
423   // --- CO2 --- 
424   Float_t ac[2] = { 12.,16. };
425   Float_t zc[2] = { 6.,8. };
426   Float_t wc[2] = { 1.,2. };
427   Float_t dc    = .001977;
428   Float_t dco   = .002;  // --- CO2 density in g/cm3 ---
429   
430   Float_t absl, radl, a, d, z;
431   Float_t dg;
432   Float_t x0ar;
433   Float_t buf[1];
434   Int_t nbuf;
435   Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
436   Float_t zsteel[4] = { 26.,24.,28.,14. };
437   Float_t wsteel[4] = { .715,.18,.1,.005 };
438   
439   Int_t *idtmed = fIdtmed->GetArray()-599;
440   Int_t isxfld = gAlice->Field()->Integ();
441   Float_t sxmgmx = gAlice->Field()->Max();
442   
443   // --- Define the various materials for GEANT --- 
444   AliMaterial(1, "Pb    $", 207.19, 82., 11.35, .56, 18.5);
445   x0ar = 19.55 / dar;
446   AliMaterial(2, "Argon$", 39.95, 18., dar, x0ar, 6.5e4);
447   AliMixture(3, "CO2  $", ac, zc, dc, -2, wc);
448   AliMaterial(4, "Al   $", 26.98, 13., 2.7, 8.9, 18.5);
449   AliMaterial(6, "Fe   $", 55.85, 26., 7.87, 1.76, 18.5);
450   AliMaterial(7, "W    $", 183.85, 74., 19.3, .35, 10.3);
451   AliMaterial(8, "G10  $", 20., 10., 1.7, 19.4, 999.);
452   AliMaterial(9, "SILIC$", 28.09, 14., 2.33, 9.36, 45.);
453   AliMaterial(10, "Be   $", 9.01, 4., 1.848, 35.3, 36.7);
454   AliMaterial(15, "Cu   $", 63.54, 29., 8.96, 1.43, 15.);
455   AliMaterial(16, "C    $", 12.01, 6., 2.265, 18.8, 49.9);
456   AliMaterial(17, "POLYCARBONATE    $", 20., 10., 1.2, 34.6, 999.);
457   
458   AliMaterial(96, "MYLAR$", 8.73, 4.55, 1.39, 28.7, 62.);
459   AliMaterial(97, "CONCR$", 20., 10., 2.5, 10.7, 40.);
460   AliMaterial(98, "Vacum$", 1e-9, 1e-9, 1e-9, 1e16, 1e16);
461   AliMaterial(99, "Air  $", 14.61, 7.3, .0012, 30420., 67500.);
462   AliMixture(19, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel); 
463   //    define gas-mixtures 
464   
465   char namate[21];
466   gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
467   ag[1] = a;
468   zg[1] = z;
469   dg = (dar * 4 + dco) / 5;
470   AliMixture(5, "ArCO2$", ag, zg, dg, 2, wg);
471   
472   // Define tracking media 
473   AliMedium(1, "Pb conv.$", 1,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
474   AliMedium(2, " S steel$", 19, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
475   AliMedium(7, "W  conv.$", 7,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
476   AliMedium(8, "G10plate$", 8,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
477   AliMedium(4, "Al      $", 4,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
478   AliMedium(6, "Fe      $", 6,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
479   AliMedium(5, "ArCO2   $", 5,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
480   AliMedium(9, "SILICON $", 9,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
481   AliMedium(10, "Be      $", 10, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
482   AliMedium(98, "Vacuum  $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .1,  10);
483   AliMedium(99, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .1,  .1);
484   AliMedium(15, "Cu      $", 15, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
485   AliMedium(16, "C       $", 16, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
486   AliMedium(17, "PLOYCARB$", 17, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
487   
488   // --- Generate explicitly delta rays in the iron, aluminium and lead --- 
489   gMC->Gstpar(idtmed[600], "LOSS", 3.);
490   gMC->Gstpar(idtmed[600], "DRAY", 1.);
491   
492   gMC->Gstpar(idtmed[603], "LOSS", 3.);
493   gMC->Gstpar(idtmed[603], "DRAY", 1.);
494   
495   gMC->Gstpar(idtmed[604], "LOSS", 3.);
496   gMC->Gstpar(idtmed[604], "DRAY", 1.);
497   
498   gMC->Gstpar(idtmed[605], "LOSS", 3.);
499   gMC->Gstpar(idtmed[605], "DRAY", 1.);
500   
501   gMC->Gstpar(idtmed[606], "LOSS", 3.);
502   gMC->Gstpar(idtmed[606], "DRAY", 1.);
503   
504   gMC->Gstpar(idtmed[607], "LOSS", 3.);
505   gMC->Gstpar(idtmed[607], "DRAY", 1.);
506   
507   // --- Energy cut-offs in the Pb and Al to gain time in tracking --- 
508   // --- without affecting the hit patterns --- 
509   gMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
510   gMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
511   gMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
512   gMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
513   gMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
514   gMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
515   gMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
516   gMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
517   gMC->Gstpar(idtmed[606], "CUTGAM", 1e-4);
518   gMC->Gstpar(idtmed[606], "CUTELE", 1e-4);
519   gMC->Gstpar(idtmed[606], "CUTNEU", 1e-4);
520   gMC->Gstpar(idtmed[606], "CUTHAD", 1e-4);
521   gMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
522   gMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
523   gMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
524   gMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
525   gMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
526   gMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
527   gMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
528   gMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
529   
530   // --- Prevent particles stopping in the gas due to energy cut-off --- 
531   gMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
532   gMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
533   gMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
534   gMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
535   gMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
536 }
537
538 //_____________________________________________________________________________
539 void AliPMDv1::Init()
540 {
541   //
542   // Initialises PMD detector after it has been built
543   //
544   Int_t i;
545   kdet=1;
546   //
547   printf("\n");
548   for(i=0;i<35;i++) printf("*");
549   printf(" PMD_INIT ");
550   for(i=0;i<35;i++) printf("*");
551   printf("\n");
552   printf("                 PMD simulation package (v1) initialised\n");
553   printf(" parameters of pmd\n");
554   printf("%6d %10.2f %10.2f %10.2f %10.2f %10.2f\n",kdet,thmin,thmax,zdist,thlow,thhigh);
555   //
556   for(i=0;i<80;i++) printf("*");
557   printf("\n");
558   //
559   Int_t *idtmed = fIdtmed->GetArray()-599;
560   fMedSens=idtmed[605-1];
561 }
562
563 //_____________________________________________________________________________
564 void AliPMDv1::StepManager()
565 {
566   //
567   // Called at each step in the PMD
568   //
569   Int_t   copy;
570   Float_t hits[4], destep;
571   Float_t center[3] = {0,0,0};
572   Int_t   vol[5];
573   //  char *namep;
574   
575   if(gMC->GetMedium() == fMedSens && (destep = gMC->Edep())) {
576     
577     gMC->CurrentVolID(copy);
578 //    namep=gMC->CurrentVolName();
579 //    printf("Current vol is %s \n",namep);
580     vol[0]=copy;
581     gMC->CurrentVolOffID(1,copy);
582 //    namep=gMC->CurrentVolOffName(1);
583 //    printf("Current vol 11 is %s \n",namep);
584     vol[1]=copy;
585     gMC->CurrentVolOffID(2,copy);
586 //    namep=gMC->CurrentVolOffName(2);
587 //    printf("Current vol 22 is %s \n",namep);
588     vol[2]=copy;
589 //      if(strncmp(namep,"DW11",4))vol[2]=1;
590     gMC->CurrentVolOffID(3,copy);
591 //    namep=gMC->CurrentVolOffName(3);
592 //    printf("Current vol 33 is %s \n",namep);
593     vol[3]=copy;
594     gMC->CurrentVolOffID(4,copy);
595 //    namep=gMC->CurrentVolOffName(4);
596 //    printf("Current vol 44 is %s \n",namep);
597     vol[4]=copy;
598 //      printf("volume number %d,%d,%d,%d,%d \n",vol[0],vol[1],vol[2],vol[3],vol[4]);
599     gMC->Gdtom(center,hits,1);
600     hits[3] = destep*1e9; //Number in eV
601     AddHit(gAlice->CurrentTrack(), vol, hits);
602   }
603 }
604
605