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