]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMDv0.cxx
acffa78a1a5f83c2db9c89f0d3645431fe4ea6a1
[u/mrichter/AliRoot.git] / PMD / AliPMDv0.cxx
1 ///////////////////////////////////////////////////////////////////////////////
2 //                                                                           //
3 //  Photon Multiplicity Detector Version 1                                   //
4 //                                                                           //
5 //Begin_Html
6 /*
7 <img src="gif/AliPMDv0Class.gif">
8 */
9 //End_Html
10 //                                                                           //
11 ///////////////////////////////////////////////////////////////////////////////
12 #include "AliPMDv0.h"
13 #include "AliRun.h"
14 #include "AliMC.h" 
15 #include "AliConst.h" 
16  
17 static Float_t smod2[3], smod3[3], smod4[3];
18 static Int_t maxbox, kdet;
19 static Float_t thgas,thmin,thmax,zdist,zdist1,thlow,
20   thhigh,edge;
21 static Int_t numqu;
22 static Float_t xbox[40][40], ybox[40][40];
23 static Int_t pindex[40][40];
24  
25 ClassImp(AliPMDv0)
26 //_____________________________________________________________________________
27 AliPMDv0::AliPMDv0() : AliPMD()
28 {
29   //
30   // Default constructor 
31   //
32   fMedSens=0;
33 }
34  
35 //_____________________________________________________________________________
36 AliPMDv0::AliPMDv0(const char *name, const char *title)
37   : AliPMD(name,title)
38 {
39   //
40   // Standard constructor
41   //
42   fMedSens=0;
43 }
44
45 //_____________________________________________________________________________
46 void AliPMDv0::Coordnew()
47 {
48   //
49   // Find coordinates for pad geometry
50   //
51   // Author Y.P. Viyogi, VECC Calcutta
52   //
53
54   Float_t th1, th2, dbox, dist;
55   //Float_t xoff[40][40], yoff[40][40];
56   Int_t i, j, nbox;
57   Float_t rlow;
58   Int_t xoff1[3], yoff1[3], l;
59   Float_t rhigh, dmax, hole;
60   Int_t kk, nhol;
61   Float_t rr, xx, yy;
62   
63   th1 = thmin * kPI / 180;
64   th2 = thmax * kPI / 180;
65   /* ESTIMATES FOR OCTAGON */
66   dist = zdist * TMath::Tan(th2);
67   /* ***  04.06.97 Fixed Module size of 6 cm, 0 mm boundary. */
68   /* ***  variable pad sizes of 0.3 mm, 0.5  mm, 1.0 mm and 1.2 mm */
69   dbox = edge * 2 + 24;
70   maxbox = Int_t(dist / dbox + .5);
71   dmax= maxbox * dbox;
72   /* NOW GET THE HOLE SIZE ETC. */
73   hole = zdist * TMath::Tan(th1);
74   nhol = Int_t(hole / dbox + .5);
75   hole = nhol * dbox;
76   
77   rlow = zdist * TMath::Tan(thlow * kPI / 180);
78   rhigh = zdist * TMath::Tan(thhigh * kPI / 180);
79   for (i = 1; i <= 40; ++i) {
80     for (j = 1; j <= 40; ++j) {
81       //index[j][i] = 0;
82       //xoff[j][i] = 0;
83       //yoff[j][i] = 0;
84       xbox[j][i] = 0;
85       /* L5: */
86       ybox[j][i] = 0;
87     }
88   }
89   
90   // NOW START PLACING THE BOXES IN VARIOUS LAYERS, START FROM THE CENTRE 
91   
92   yy = dbox / 2;
93   for(i=0;i<3;i++) yoff1[i]=0;
94   nbox = 0;
95   //        PRINT*,'MAXBOX=',MAXBOX 
96   for (i = 1; i <= maxbox; ++i) {
97     xx = dbox / 2;
98     for(j=0;j<3;j++) xoff1[j]=0;
99         for (j = 1; j <= maxbox; ++j) {
100           rr = sqrt(xx*xx+yy*yy);
101           if (rr >= hole && rr <= dmax) {
102             //  BOX CAN BE FITTED 
103             //index[j][i] = 2;
104             //if (rr < rlow) index[j][i] = 1;
105             //else if (rr > rhigh) index[j][i] = 3;
106             xbox[j][i] = xx;
107             ybox[j][i] = yy;
108               ++nbox;
109               //xoff[j][i] = xoff1[index[j][i] - 1];
110               //yoff[j][i] = yoff1[index[j][i] - 1];
111           }
112           if (kdet == 1) kk = 1; else kk = 0;
113           for (l = 1; l <= 3; ++l)
114             xoff1[l - 1] += fNumPads[l + kk - 1];
115           xx += dbox;
116         }
117         
118         if (kdet == 1) kk = 1; else kk=0;
119         
120         for (l = 1; l <= 3; ++l)
121           yoff1[l - 1] += fNumPads[l + kk - 1];
122         yy += dbox;
123   }
124 }
125
126 //_____________________________________________________________________________
127 void AliPMDv0::Coordinates()
128 {
129   //
130   //  SUBROUTINE TO COMPUTE THE X- AND Y- COORDINATES OF THE BOXES 
131   //  WHICH CAN FIT INTO THE CIRCULAR REGION BETWEEN THE GIVEN ANGLES. 
132   //  INPUT : ZDIST, THMIN, THMAX, PADSIZE (FOR INSIDE and OUTSIDE PMD). 
133   //  ALL DIMENSIONS IN CM. 
134   // -- Author :        Y.P. VIYOGI, 10/05/1996. 
135
136   Float_t hole, dmax, dbox;
137   Int_t nhol;
138   Float_t dist;
139   Int_t nbox;
140   Float_t rlow;
141   Int_t i, j;
142   Float_t rhigh, rr, xx, yy, th1, th2;
143   
144   th1 = thmin*kPI/180;
145   th2 = thmax*kPI/180;
146   // ESTIMATES FOR OCTAGON 
147   dist = zdist * TMath::Tan(th2);
148   // ***  04.06.97 Fixed Module size of 24 cm, 3 mm boundary. 
149   // ***  variable pad sizes of 8 mm, 10 mm, 12mm and 15 mm 
150   dbox   = edge*2 + 24.;
151   maxbox = Int_t(dist / dbox + .5);
152   dmax   = maxbox*dbox;
153   // NOW GET THE HOLE SIZE ETC. 
154   hole = zdist * TMath::Tan(th1);
155   nhol = Int_t(hole / dbox + .5);
156   hole = nhol * dbox;
157   
158   rlow  = zdist * TMath::Tan(thlow*kPI/180);
159   rhigh = zdist * TMath::Tan(thhigh*kPI/180);
160   for (i = 0; i < 40; ++i) {
161     for (j = 0; j < 40; ++j) {
162       pindex[j][i] = 0;
163       xbox[j][i]   = 0;
164       ybox[j][i]   = 0;
165     }
166   }
167   
168   //  NOW START PLACING THE BOXES IN VARIOUS LAYERS, START FROM THE CENTRE 
169   yy   = dbox / 2;
170     nbox = 0;
171     for (i = 0; i < maxbox; ++i) {
172       xx = dbox / 2;
173       for (j = 0; j < maxbox; ++j) {
174         rr = TMath::Sqrt(xx*xx + yy*yy);
175         if (rr >= hole && rr <= dmax) {  //  BOX CAN BE FITTED 
176           pindex[j][i] = 2;
177           if (rr < rlow)  pindex[j][i] = 1;
178           if (rr > rhigh) pindex[j][i] = 3;
179           xbox[j][i] = xx;
180           ybox[j][i] = yy;
181           ++nbox;
182         }
183         xx += dbox;
184       }
185       yy += dbox;
186     }
187 }
188  
189 //_____________________________________________________________________________
190 void AliPMDv0::CreateGeometry()
191 {
192   //
193   // Create geometry for Photon Multiplicity Detector Version 1
194   //
195   //Begin_Html
196   /*
197     <img src="gif/AliPMDv0.gif">
198   */
199   //End_Html
200   //Begin_Html
201   /*
202     <img src="gif/AliPMDv0Tree.gif">
203   */
204   //End_Html
205   CreatePads();
206   CreateInside();
207 }
208  
209 //_____________________________________________________________________________
210 void AliPMDv0::CreateInside()
211 {
212   //
213   // Create inside of Pads
214   //
215   // -- Author :     Y.P. VIYOGI, 07/05/1996. 
216   // -- Modified:    P.V.K.S.Baba(JU), 15-12-97. 
217   
218   Float_t sipmd[3] = { 300.,300.,5. };
219   
220   Int_t i2;
221   
222   Float_t xiqa[4], yiqa[4];
223   Int_t inum2, inum3, inum4, i, j, k;
224   Float_t siqad[4];
225   Float_t zd, xd, yd, xp, yp, zp;
226   Int_t idrotm[100];
227   
228   Int_t *idtmed = gAlice->Idtmed();    
229   
230   //  VOLUMES Names : begining with D for all PMD volumes, 
231   // The names of SIZE variables begin with S and have more meaningful
232   // characters as shown below. 
233   
234   //            VOLUME  SIZE    MEDIUM  :       REMARKS 
235   //            ------  -----   ------  : --------------------------- 
236   
237   //            DPMD    SIPMD   AIR     : INSIDE PMD  and its SIZE 
238   
239   
240   
241   // *** Define the  DPMD   Volume and fill with air *** 
242
243   AliMC* pMC = AliMC::GetMC();
244   
245   pMC->Gsvolu("DPMD", "BOX ", idtmed[698], sipmd, 3);
246   
247   // *** Define DIQU Volume and fill with air 
248   siqad[0] = sipmd[0] / 2. - 1.;
249   siqad[1] = sipmd[1] / 2. - 1.;
250   siqad[2] = sipmd[2];
251   pMC->Gsvolu("DIQU","BOX ", idtmed[698], siqad, 3);
252   pMC->Gsatt("DIQU", "SEEN", 1);
253   
254   
255   // --- Place the modules in INSIDE PMD (DPMD) 
256   // --- FIRST CALCULATE THE COORDINATES OF THE MODULES WHICH CAN BE 
257   // --- ACCOMODATED. 
258   
259   kdet = 1;
260   Coordinates();
261   
262   //inum = 0;
263   zd   = 0.;
264   AliMatrix(idrotm[1], 90., 0.,   90.,  90., 0., 0.);
265   AliMatrix(idrotm[2], 90., 180., 90.,  90., 0., 0.);
266   AliMatrix(idrotm[3], 90., 180., 90., 270., 0., 0.);
267   AliMatrix(idrotm[4], 90., 0.,   90., 270., 0., 0.);
268   // ****  Filling the DIQU Vol. (One Quadrant) 
269   inum2 = 0;
270   inum3 = 0;
271     inum4 = 0;
272     for (i = 0; i < maxbox; ++i) {
273       i2 = maxbox;
274       for (j = 0; j < i2; ++j) {
275         if (xbox[j][i] <= 0 && ybox[j][i] <= 0) continue;
276         xd = xbox[j][i] - siqad[0];
277         yd = ybox[j][i] - siqad[1];
278         if (pindex[j][i] == 1) {
279           ++inum2;
280           pMC->Gsposp("DM11", inum2, "DIQU", xd, yd, zd, 0, "ONLY", smod2, 3);
281         }
282         if (pindex[j][i] == 2) {
283           ++inum3;
284           pMC->Gsposp("DM12", inum3, "DIQU", xd, yd, zd, 0, "ONLY", smod3, 3);
285         }
286         if (pindex[j][i] == 3) {
287           ++inum4;
288           pMC->Gsposp("DM13", inum4, "DIQU", xd, yd, zd, 0, "ONLY", smod4, 3);
289         }
290       }
291     }
292     xiqa[0] = siqad[0];
293     xiqa[1] = -siqad[0];
294     xiqa[2] = xiqa[1];
295     xiqa[3] = xiqa[0];
296     yiqa[0] = siqad[0];
297     yiqa[1] = yiqa[0];
298     yiqa[2] = -siqad[0];
299     yiqa[3] = yiqa[2];
300     i2      = numqu;
301     for (k = 1; k <= i2; ++k) {
302       pMC->Gsposp("DIQU", k, "DPMD", xiqa[k-1], yiqa[k-1], zd, idrotm[k], "ONLY", siqad, 3);
303     }
304     
305     // --- Place the DPMD in ALICE with front edge 6.0m from vertex  --- 
306     xp = 0.;
307     yp = 0.;
308     zp = zdist1;
309     pMC->Gspos("DPMD", 1, "ALIC", xp, yp, zp, 0, "ONLY");
310     
311 }
312
313 //_____________________________________________________________________________
314 void AliPMDv0::CreatePads()
315 {
316   //
317   // Create the geometry of the pads
318   // *** DEFINITION OF THE GEOMETRY OF THE PMD  *** 
319   // *** DIFFERENT PADS WITH SIZES 8 MM, 10 MM, 12 MM AND 15 MM SQUARE 
320   // -- Author :     Y.P. VIYOGI, 04/06/1997. 
321   // -- Modified:    P.V.K.S.Baba(JU), 13-12-97. 
322   
323   AliMC* pMC = AliMC::GetMC();
324   
325   Int_t npad2;
326   Float_t /* scpv1[3], */ scpv2[3] /*, scpv3[3], scpv4[3] */;
327   Float_t  spsw1[3], spsw2[3];//, spsw3[3], spsw4[3];
328   Float_t  sw[3], xc, yc, zc;
329   Float_t sfe[3];
330   Float_t spb[3], pad1, pad2, pad3, pad4;
331   //  VOLUMES Names : begining with D for all PMD volumes, 
332   
333   //     DM11 : MODULE TYPE 
334   
335   // The names of SIZE variables begin with S and have more meaningful
336   // characters as shown below. 
337   
338   //            VOLUME  SIZE    MEDIUM  :       REMARKS 
339   //            ------  -----   ------  : --------------------------- 
340   
341   //            DPPB    SPB     PB      : PB Converter and its SIZE 
342   //            DPFE    SFE     FE      : FE Support Plate and its SIZE 
343   
344   //               DW11    SPSW3   G10     : PRESHOWER 
345   //               DV11    SCPV3   G10     : CPV 
346   //     ****************** VOLUME TREE ****************** 
347   
348   //                    DM11 (Module) 
349   //                           | 
350   //                           | 
351   //    ------------------------------------------------- 
352   //       |             |               |                 | 
353   //       |             |               |                 | 
354   //    DV11( CPV)      DPFE            DPPB              DW11(Preshower) 
355   //    ************************************************************ 
356   
357   
358   
359   Int_t *idtmed = gAlice->Idtmed();
360   
361   thgas  = fPar[2];
362   thmin  = fIn[0];
363   thmax  = fIn[1];
364   zdist1  = fIn[2];
365   zdist  = TMath::Abs(zdist1);
366   thlow  = fIn[3];
367   thhigh = fIn[4];
368   edge   = fGeo[1];
369   numqu  = Int_t(fGeo[2]);
370   
371   pad1  = fPadSize[0];
372   pad2  = fPadSize[1];
373   pad3  = fPadSize[2];
374   pad4  = fPadSize[3];
375   npad2 = Int_t(24/fPadSize[1]);
376   
377   spsw2[0] = (npad2 * pad2)/2 + edge;
378   spsw2[1] = spsw2[0];
379   spsw2[2] = (thgas + .4) / 2;
380   scpv2[0] = spsw2[0];
381   scpv2[1] = spsw2[1];
382   scpv2[2] = spsw2[2];
383 // The modules (DW11 and DV11 are filed with gas, G10 plate is ignored)
384   pMC->Gsvolu("DW11","BOX ", idtmed[604], spsw2, 3);
385   pMC->Gsatt("DW11", "SEEN", 1);
386   pMC->Gsvolu("DV11","BOX ", idtmed[604], spsw2, 3);
387   pMC->Gsatt("DV11", "SEEN", 1);
388   
389   // --- DEFINE MODULES, IRON, TUNGSTEN AND LEAD VOLUMES 
390   
391   
392   spb[0] = spsw1[0];
393   spb[1] = spsw1[1];
394   spb[2] = .75;
395   pMC->Gsvolu("DPPB","BOX ", idtmed[600], spb, 3);
396   pMC->Gsatt("DPPB", "SEEN", 1);
397   
398   sw[0] = spsw1[0];
399   sw[1] = spsw1[1];
400   sw[2] = 0.9/2.;
401   pMC->Gsvolu("DPW ","BOX ", idtmed[600], sw, 3);
402   pMC->Gsatt("DPW ", "SEEN", 1);
403   
404   sfe[0] = spsw1[0];
405   sfe[1] = spsw1[1];
406   sfe[2] = 0.6/2.;
407   pMC->Gsvolu("DPFE","BOX ", idtmed[605], sfe, 3);
408   pMC->Gsatt("DPFE", "SEEN", 1);
409   
410   smod2[0] = spsw2[0];
411   smod2[1] = smod2[0];
412   smod2[2] = spsw2[2] + sfe[2] + spb[2] + scpv2[2];
413   pMC->Gsvolu("DM11", "BOX ", idtmed[698], smod2, 3);
414   
415   // ---  place gas box (as CPV), iron support, lead converter and gas box 
416   // ---  (preshower) in the module 
417   xc = 0.;
418   yc = 0.;
419   // --- First the CPV box 
420   zc = -(spsw2[2] + sfe[2] + spb[2] + spsw2[2]) + spsw2[2];
421   pMC->Gspos("DV11", 1, "DM11", xc, yc, zc, 0, "ONLY");
422   // --- Then iron support plate 
423   zc = zc + sfe[2] + spsw2[2];
424   pMC->Gspos("DPFE", 1, "DM11", xc, yc, zc, 0, "ONLY");
425   // --- Then lead converter plate 
426   zc = zc + sfe[2] + spb[2];
427   pMC->Gspos("DPPB", 1, "DM11", xc, yc, zc, 0, "ONLY");
428   // --- Lastly the preshower box 
429   zc = zc + spb[2] + spsw2[2];
430   pMC->Gspos("DW11", 1, "DM11", xc, yc, zc, 0, "ONLY");
431   
432 }
433  
434 //_____________________________________________________________________________
435 void AliPMDv0::DrawModule()
436 {
437   //
438   // Draw a shaded view of the Photon Multiplicity Detector
439   //
440
441   AliMC* pMC = AliMC::GetMC();
442   
443   pMC->Gsatt("*", "seen", -1);
444   pMC->Gsatt("alic", "seen", 0);
445   //
446   // Set the visibility of the components
447   // 
448   pMC->Gsatt("DW11","seen",0);
449   pMC->Gsatt("DV11","seen",0);
450   pMC->Gsatt("DPPB","seen",1);
451   pMC->Gsatt("DPW ","seen",1); 
452   pMC->Gsatt("DPFE","seen",1);
453   pMC->Gsatt("DM11","seen",1);
454   pMC->Gsatt("DPMD","seen",0);
455   pMC->Gsatt("DIQU","seen",0);
456   //
457   pMC->Gdopt("hide", "on");
458   pMC->Gdopt("shad", "on");
459   pMC->Gsatt("*", "fill", 7);
460   pMC->SetClipBox(".");
461   pMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
462   pMC->DefaultRange();
463   pMC->Gdraw("alic", 40, 30, 0, 22, 15.5, .04, .04);
464   pMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
465   pMC->Gdman(17, 5, "MAN");
466   pMC->Gdopt("hide", "off");
467 }
468
469 //_____________________________________________________________________________
470 void AliPMDv0::CreateMaterials()
471 {
472   //
473   // Create materials for the PMD version 1
474   //
475   // ORIGIN    : Y. P. VIYOGI 
476   //
477   
478   AliMC* pMC = AliMC::GetMC();
479   
480   // --- The Argon- CO2 mixture --- 
481   Float_t ag[2] = { 39.95 };
482   Float_t zg[2] = { 18. };
483   Float_t wg[2] = { .8,.2 };
484   Float_t dar   = .001782;   // --- Ar density in g/cm3 --- 
485   // --- CO2 --- 
486   Float_t ac[2] = { 12.,16. };
487   Float_t zc[2] = { 6.,8. };
488   Float_t wc[2] = { 1.,2. };
489   Float_t dc    = .001977;
490   Float_t dco   = .002;  // --- CO2 density in g/cm3 ---
491   
492   Float_t absl, radl, a, d, z;
493   Float_t dg;
494   Float_t x0ar;
495   Float_t buf[1];
496   Int_t nbuf;
497   
498   Int_t *idtmed = gAlice->Idtmed();
499   Int_t isxfld = gAlice->Field()->Integ();
500   Float_t sxmgmx = gAlice->Field()->Max();
501   
502   // --- Define the various materials for GEANT --- 
503   AliMaterial(1, "Pb    $", 207.19, 82., 11.35, .56, 18.5);
504   x0ar = 19.55 / dar;
505   AliMaterial(2, "Argon$", 39.95, 18., dar, x0ar, 6.5e4);
506   AliMixture(3, "CO2  $", ac, zc, dc, -2, wc);
507   AliMaterial(4, "Al   $", 26.98, 13., 2.7, 8.9, 18.5);
508   AliMaterial(6, "Fe   $", 55.85, 26., 7.87, 1.76, 18.5);
509   AliMaterial(7, "W    $", 183.85, 74., 19.3, .35, 10.3);
510   AliMaterial(8, "G10  $", 20., 10., 1.7, 19.4, 999);
511   AliMaterial(9, "SILIC$", 28.09, 14., 2.33, 9.36, 45.);
512   AliMaterial(10, "Be   $", 9.01, 4., 1.848, 35.3, 36.7);
513   AliMaterial(15, "Cu   $", 63.54, 29., 8.96, 1.43, 15.);
514   AliMaterial(16, "C    $", 12.01, 6., 2.265, 18.8, 49.9);
515   
516   AliMaterial(96, "MYLAR$", 8.73, 4.55, 1.39, 28.7, 62.);
517   AliMaterial(97, "CONCR$", 20., 10., 2.5, 10.7, 40.);
518   AliMaterial(98, "Vacum$", 1e-9, 1e-9, 1e-9, 1e16, 1e16);
519   AliMaterial(99, "Air  $", 14.61, 7.3, .0012, 30420., 67500.);
520   
521   //    define gas-mixtures 
522   
523   char namate[21];
524   pMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
525   ag[1] = a;
526   zg[1] = z;
527   dg = (dar * 4 + dco) / 5;
528   AliMixture(5, "ArCO2$", ag, zg, dg, 2, wg);
529   
530   // Define tracking media 
531   AliMedium(601, "Pb conv.$", 1,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
532   AliMedium(607, "W  conv.$", 7,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
533   AliMedium(608, "G10plate$", 8,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
534   AliMedium(604, "Al      $", 4,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
535   AliMedium(606, "Fe      $", 6,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
536   AliMedium(605, "ArCO2   $", 5,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
537   AliMedium(609, "SILICON $", 9,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
538   AliMedium(610, "Be      $", 10, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
539   AliMedium(698, "Vacuum  $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .1,  10);
540   AliMedium(699, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .1,  .1);
541   AliMedium(615, "Cu      $", 15, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
542   AliMedium(616, "C       $", 16, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
543   
544   // --- Generate explicitly delta rays in the iron, aluminium and lead --- 
545   pMC->Gstpar(idtmed[600], "LOSS", 3.);
546   pMC->Gstpar(idtmed[600], "DRAY", 1.);
547   
548   pMC->Gstpar(idtmed[603], "LOSS", 3.);
549   pMC->Gstpar(idtmed[603], "DRAY", 1.);
550   
551   pMC->Gstpar(idtmed[604], "LOSS", 3.);
552   pMC->Gstpar(idtmed[604], "DRAY", 1.);
553   
554   pMC->Gstpar(idtmed[605], "LOSS", 3.);
555   pMC->Gstpar(idtmed[605], "DRAY", 1.);
556   
557   pMC->Gstpar(idtmed[606], "LOSS", 3.);
558   pMC->Gstpar(idtmed[606], "DRAY", 1.);
559   
560   pMC->Gstpar(idtmed[607], "LOSS", 3.);
561   pMC->Gstpar(idtmed[607], "DRAY", 1.);
562   
563   // --- Energy cut-offs in the Pb and Al to gain time in tracking --- 
564   // --- without affecting the hit patterns --- 
565   pMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
566   pMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
567   pMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
568   pMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
569   pMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
570   pMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
571   pMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
572   pMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
573   pMC->Gstpar(idtmed[606], "CUTGAM", 1e-4);
574   pMC->Gstpar(idtmed[606], "CUTELE", 1e-4);
575   pMC->Gstpar(idtmed[606], "CUTNEU", 1e-4);
576   pMC->Gstpar(idtmed[606], "CUTHAD", 1e-4);
577   pMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
578   pMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
579   pMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
580   pMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
581   pMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
582   pMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
583   pMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
584   pMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
585   
586   // --- Prevent particles stopping in the gas due to energy cut-off --- 
587   pMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
588   pMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
589   pMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
590   pMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
591   pMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
592 }
593
594 //_____________________________________________________________________________
595 void AliPMDv0::Init()
596 {
597   //
598   // Initialises PMD detector after it has been built
599   //
600   Int_t i;
601   kdet=1;
602   //
603   printf("\n");
604   for(i=0;i<35;i++) printf("*");
605   printf(" PMD_INIT ");
606   for(i=0;i<35;i++) printf("*");
607   printf("\n");
608   printf("                 PMD simulation package initialised\n");
609   printf(" parameters of pmd\n");
610   printf("%6d %10.2f %10.2f %10.2f %10.2f %10.2f\n",kdet,thmin,thmax,zdist,thlow,thhigh);
611   //
612   for(i=0;i<80;i++) printf("*");
613   printf("\n");
614   //
615   Int_t *idtmed = gAlice->Idtmed();
616   fMedSens=idtmed[605-1];
617 }
618
619 //_____________________________________________________________________________
620 void AliPMDv0::StepManager()
621 {
622   //
623   // Called at each step in the PMD
624   //
625   Int_t   copy;
626   Float_t hits[4], destep;
627   Float_t center[3] = {0,0,0};
628   Int_t   vol[5];
629   Text_t namep[5];
630   
631   AliMC* pMC=AliMC::GetMC();
632   if(pMC->GetMedium() == fMedSens && (destep = pMC->Edep())) {
633     
634     pMC->CurrentVol(namep, copy);
635     vol[0]=copy;
636     pMC->CurrentVolOff(1,namep,copy);
637     vol[1]=copy;
638     pMC->CurrentVolOff(2,namep,copy);
639     vol[2]=copy;
640     if(strncmp(namep,"DW11",4))vol[2]=1;
641     if(strncmp(namep,"DV11",4))vol[2]=2;
642     pMC->CurrentVolOff(3,namep,copy);
643     vol[3]=copy;
644     pMC->CurrentVolOff(4,namep,copy);
645     vol[4]=copy;
646     pMC->Gdtom(center,hits,1);
647     hits[3] = destep*1e9; //Number in eV
648     AddHit(gAlice->CurrentTrack(), vol, hits);
649   }
650 }