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