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