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