]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMDv3.cxx
Replacing rindex by strrchr
[u/mrichter/AliRoot.git] / PMD / AliPMDv3.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 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 //  Photon Multiplicity Detector Version 1                                   //
21 //                                                                           //
22 //Begin_Html
23 /*
24 <img src="picts/AliPMDv3Class.gif">
25 */
26 //End_Html
27 //                                                                           //
28 ///////////////////////////////////////////////////////////////////////////////
29 ////
30
31 #include "AliPMDv3.h"
32 #include "AliRun.h"
33 #include "AliMagF.h"
34 #include "AliMC.h" 
35 #include "AliConst.h" 
36 #include "iostream.h"
37  
38 static Int_t   kdet, ncell_sm, ncell_hole;
39 static Float_t zdist, zdist1;
40 static Float_t sm_length, sm_thick, cell_radius, cell_wall, cell_depth;
41 static Float_t boundary, th_base, th_air, th_pcb;
42 static Float_t th_lead, th_steel;
43
44 ClassImp(AliPMDv3)
45  
46   //_____________________________________________________________________________
47   AliPMDv3::AliPMDv3()
48 {
49   //
50   // Default constructor 
51   //
52   fMedSens=0;
53 }
54  
55 //_____________________________________________________________________________
56 AliPMDv3::AliPMDv3(const char *name, const char *title)
57   : AliPMD(name,title)
58 {
59   //
60   // Standard constructor
61   //
62   fMedSens=0;
63 }
64
65 //_____________________________________________________________________________
66 void AliPMDv3::CreateGeometry()
67 {
68   //
69   // Create geometry for Photon Multiplicity Detector Version 3 :
70   // April 2, 2001
71   //
72   //Begin_Html
73   /*
74     <img src="picts/AliPMDv3.gif">
75   */
76   //End_Html
77   //Begin_Html
78   /*
79     <img src="picts/AliPMDv3Tree.gif">
80   */
81   //End_Html
82   GetParameters();
83   CreateSupermodule();
84   CreatePMD();
85 }
86
87 //_____________________________________________________________________________
88 void AliPMDv3::CreateSupermodule()
89 {
90   //
91   // Creates the geometry of the cells, places them in  supermodule which
92   // is a rhombus object.
93
94   // *** DEFINITION OF THE GEOMETRY OF THE PMD  *** 
95   // *** HEXAGONAL CELLS WITH 10 MM SQUARE EQUIVALENT
96   // -- Author :     S. Chattopadhyay, 02/04/1999. 
97
98   // Basic unit is ECAR, a hexagonal cell made of Ar+CO2, which is placed inside another 
99   // hexagonal cell made of Cu (ECCU) with larger radius, compared to ECAR. The difference
100   // in radius gives the dimension of half width of each cell wall.
101   // These cells are placed as 72 x 72 array in a 
102   // rhombus shaped supermodule (EHC1). The rhombus shaped modules are designed
103   // to have closed packed structure.
104   //
105   // Each supermodule (ESM1 or ESM2), made of G10 is filled with following components
106   //  EAIR --> Air gap between gas hexagonal cells and G10 backing.
107   //  EHC1 --> Rhombus shaped parallelopiped containing the hexagonal cells
108   //  EAIR --> Air gap between gas hexagonal cells and G10 backing.
109   //
110   // ESM1 is placed in EMM1 along with EMPB (Pb converter) and EMFE (iron support) 
111   //  EMM1 made of
112   // ESM1 --> Normal supermodule
113   // EMPB --> Pb converter
114   // EMFE --> Fe backing
115   //
116   // ESM2 is placed in EMM2 along with EMPB (Pb converter) and EMFE (iron support) 
117   //  EMM2 made of
118   // ESM2 --> Special supermodule containing the cut for the hole
119   // EMPB --> Pb converter
120   // EMFE --> Fe backing
121   
122   //
123   //                                 EPMD
124   //                                   |             
125   //                                   |
126   //        -------------------------------------------------------------------
127   //        |                   |                          |                   |
128   //       EHOL                EMM1                       EMM2               EALM
129   //                            |                           |
130   //                ----------------------       ------------------------
131   //                |       |      |     |       |      |        |      |
132   //               ESM1    EMPB  EMFE  ESM1     ESM2   EMPB     EMFE   ESM2
133   //                |                            |
134   //          ------------                 -------------
135   //          |     |     |                |     |      |
136   //        EAIR  EHC1   EAIR             EAIR  EHC2  EAIR
137   //                |                            |
138   //              ECCU                          ECCU
139   //                |                            |
140   //              ECAR                          ECAR 
141   
142
143   Int_t i, j;
144   Float_t xb, yb, zb;
145   Int_t number;
146   Int_t ihrotm,irotdm;
147   const Float_t root3_2 = TMath::Sqrt(3.) /2.; 
148   Int_t *idtmed = fIdtmed->GetArray()-599;
149  
150   AliMatrix(ihrotm, 90., 30.,   90.,  120., 0., 0.);
151   AliMatrix(irotdm, 90., 180.,  90.,  270., 180., 0.);
152  
153   zdist = TMath::Abs(zdist1);
154
155
156   //Subhasis, dimensional parameters of rhombus (dpara) as given to gsvolu
157   // rhombus to accomodate 72 x 72 hexagons, and with total 1.2cm extension  
158   //(1mm tolerance on both side and 5mm thick G10 wall)
159   // 
160   
161   // **** CELL SIZE 20mm^2 EQUIVALENT
162
163   // Inner hexagon filled with gas (Ar+CO2)
164
165   Float_t hexd2[10] = {0.,360.,6,2,-0.25,0.,0.23,0.25,0.,0.23};
166
167   hexd2[4]= - cell_depth/2.;
168   hexd2[7]=   cell_depth/2.;
169   hexd2[6]=   cell_radius - cell_wall;
170   hexd2[9]=   cell_radius - cell_wall;
171   
172   gMC->Gsvolu("ECAR", "PGON", idtmed[604], hexd2,10);
173   gMC->Gsatt("ECAR", "SEEN", 0);
174
175   // Outer hexagon made of Copper
176
177   Float_t hexd1[10] = {0.,360.,6,2,-0.25,0.,0.25,0.25,0.,0.25};
178   //total wall thickness=0.2*2
179
180   hexd1[4]= - cell_depth/2.;
181   hexd1[7]=   cell_depth/2.;
182   hexd1[6]=   cell_radius;
183   hexd1[9]=   cell_radius;
184
185   gMC->Gsvolu("ECCU", "PGON", idtmed[614], hexd1,10);
186   gMC->Gsatt("ECCU", "SEEN", 1);
187
188
189 // Rhombus shaped supermodules (defined by PARA) 
190
191 // volume for SUPERMODULE 
192    
193   Float_t dpara_sm[6] = {12.5,12.5,0.8,30.,0.,0.};
194   dpara_sm[0]=(ncell_sm+0.25)*hexd1[6] ;
195   dpara_sm[1] = dpara_sm[0] *root3_2;
196   dpara_sm[2] = sm_thick/2.;
197
198 //  G10 inner part of supermodule, these will be 9 in all, one being special
199
200   Float_t dpara_g10[6] = {12.5,12.5,8.,30.,0.,0.};
201   dpara_g10[0]= dpara_sm[0];
202   dpara_g10[1]= dpara_sm[1];
203   dpara_g10[2]= dpara_sm[2];
204
205 //
206   gMC->Gsvolu("ESM1","PARA", idtmed[607], dpara_g10, 6);
207   gMC->Gsatt("ESM1", "SEEN", 0);
208   //
209   gMC->Gsvolu("ESM2","PARA", idtmed[607], dpara_g10, 6);
210   gMC->Gsatt("ESM2", "SEEN", 0);
211
212   // Air residing between the PCB and the base
213
214   Float_t dpara_air[6] = {12.5,12.5,8.,30.,0.,0.};
215   dpara_air[0]= dpara_sm[0];
216   dpara_air[1]= dpara_sm[1];
217   dpara_air[2]= th_air/2.;
218
219   gMC->Gsvolu("EAIR","PARA", idtmed[698], dpara_air, 6);
220   gMC->Gsatt("EAIR", "SEEN", 0);
221
222   // volume for honeycomb chamber (EHC1 and EHC2)
223
224   Float_t dpara[6] = {12.5,12.5,0.4,30.,0.,0.};
225   dpara[0] = dpara_sm[0];
226   dpara[1] = dpara_sm[1];
227   dpara[2] = cell_depth/2.;
228
229   gMC->Gsvolu("EHC1","PARA", idtmed[698], dpara, 6);
230   gMC->Gsatt("EHC1", "SEEN", 1);
231   
232   gMC->Gsvolu("EHC2","PARA", idtmed[698], dpara, 6);
233   gMC->Gsatt("EHC2", "SEEN", 1);
234
235   // --- place  inner hex inside outer hex 
236
237   gMC->Gsposp("ECAR", 1, "ECCU", 0., 0., 0., 0, "ONLY", hexd2, 10);
238
239   // Place outer hex ECCU cells  inside EHC1 (72 X 72)
240
241   Int_t xrow=1;
242
243   yb = -dpara[1] + (1./root3_2)*hexd1[6];
244   zb = 0.;
245
246   for (j = 1; j <= ncell_sm; ++j) {
247     xb =-(dpara[0] + dpara[1]*0.577) + 2*hexd1[6]; //0.577=tan(30deg)
248     if(xrow >= 2){
249       xb = xb+(xrow-1)*hexd1[6];
250     }
251     for (i = 1; i <= ncell_sm; ++i) {
252       number = i+(j-1)*ncell_sm;
253       gMC->Gsposp("ECCU", number, "EHC1", xb,yb,zb, ihrotm, "ONLY", hexd1,10);
254       xb += (hexd1[6]*2.);
255     }
256     xrow = xrow+1;
257     yb += (hexd1[6]*TMath::Sqrt(3.));
258   }
259
260
261   // Place outer hex ECCU inside EHC2
262   // skip cells which go into the hole in top left corner.
263
264   xrow=1;
265   yb = -dpara[1] + (1./root3_2)*hexd1[6];
266   zb = 0.;
267   for (j = 1; j <= ncell_sm; ++j) {
268     xb =-(dpara[0] + dpara[1]*0.577) + 2*hexd1[6];
269     if(xrow >= 2){
270       xb = xb+(xrow-1)*hexd1[6];
271     }
272     for (i = 1; i <= ncell_sm; ++i) {
273       number = i+(j-1)*ncell_sm;
274       if(i > ncell_hole || j <= (ncell_sm - ncell_hole))
275         {
276           gMC->Gsposp("ECCU", number, "EHC2", xb,yb,zb, ihrotm, "ONLY", hexd1,10);
277         } 
278       xb += (hexd1[6]*2.);
279     }
280     xrow = xrow+1;
281     yb += (hexd1[6]*TMath::Sqrt(3.));
282   }
283
284   // Place EHC1 and EAIR into  ESM1; EHC2 and EAIR into ESM2 
285
286   Float_t z_air1,z_air2,z_gas; 
287
288   z_air1= -dpara_g10[2] + th_base + dpara_air[2]; 
289   gMC->Gspos("EAIR", 1, "ESM1", 0., 0., z_air1, 0, "ONLY");
290   z_gas=z_air1+dpara_air[2]+ th_pcb + dpara[2]; 
291   gMC->Gspos("EHC1", 1, "ESM1", 0., 0., z_gas, 0, "ONLY");
292   z_air2=z_gas+dpara[2]+ th_pcb + dpara_air[2]; 
293   gMC->Gspos("EAIR", 2, "ESM1", 0., 0., z_air2, 0, "ONLY");
294
295   z_air1= -dpara_g10[2] + th_base + dpara_air[2]; 
296   gMC->Gspos("EAIR", 1, "ESM2", 0., 0., z_air1, 0, "ONLY");
297   z_gas=z_air1+dpara_air[2]+ th_pcb + dpara[2]; 
298   gMC->Gspos("EHC2", 1, "ESM2", 0., 0., z_gas, 0, "ONLY");
299   z_air2=z_gas+dpara[2]+ th_pcb + dpara_air[2]; 
300   gMC->Gspos("EAIR", 2, "ESM2", 0., 0., z_air2, 0, "ONLY");
301
302 }
303  
304 //_____________________________________________________________________________
305
306 void AliPMDv3::CreatePMD()
307 {
308   //
309   // Create final detector from supermodules
310   //
311   // -- Author :     Y.P. VIYOGI, 07/05/1996. 
312   // -- Modified:    P.V.K.S.Baba(JU), 15-12-97. 
313   // -- Modified:    For New Geometry YPV, March 2001.
314
315
316   // Gaspmd, the dimension of TUBE mother volume of PMD,
317
318   Float_t gaspmd[3] = { 0.,150.,10.};
319
320   const Float_t root3_2 = TMath::Sqrt(3.)/2.;
321   const Float_t pi = 3.14159;
322   Int_t i,j;
323
324   Float_t  xp, yp, zp;
325
326   Int_t num_mod;
327   Int_t jhrot12,jhrot13, irotdm;
328
329   Int_t *idtmed = fIdtmed->GetArray()-599;
330   
331   //  VOLUMES Names : begining with D for all PMD volumes, 
332   // The names of SIZE variables begin with S and have more meaningful
333   // characters as shown below. 
334   
335   //            VOLUME  SIZE    MEDIUM  :       REMARKS 
336   //            ------  -----   ------  : --------------------------- 
337   
338   //            EPMD    GASPMD   AIR    : INSIDE PMD  and its SIZE 
339   
340   // *** Define the  EPMD   Volume and fill with air *** 
341
342   gMC->Gsvolu("EPMD", "TUBE", idtmed[698], gaspmd, 3);
343   gMC->Gsatt("EPMD", "SEEN", 0);
344
345   AliMatrix(irotdm, 90., 0.,  90.,  90., 180., 0.);
346    
347   AliMatrix(jhrot12, 90., 120., 90., 210., 0., 0.);
348   AliMatrix(jhrot13, 90., 240., 90., 330., 0., 0.);
349
350   // dpara_emm1 array contains parameters of the imaginary volume EMM1, 
351   // this is just a little more than the side of a supermodule. 
352
353   Float_t dm_thick = 2. * sm_thick + th_lead + th_steel;
354
355   Float_t dpara_emm1[6] = {12.5,12.5,0.8,30.,0.,0.};
356   dpara_emm1[0] = sm_length/2.;
357   dpara_emm1[1] = dpara_emm1[0] *root3_2;
358   dpara_emm1[2] = dm_thick/2.;
359
360   // EMM1 : normal volume as in old cases
361   gMC->Gsvolu("EMM1","PARA", idtmed[698], dpara_emm1, 6);
362   gMC->Gsatt("EMM1", "SEEN", 1);
363
364   // EMM2 : special volume containing special supermodule
365   gMC->Gsvolu("EMM2","PARA", idtmed[698], dpara_emm1, 6);
366   gMC->Gsatt("EMM2", "SEEN", 1);
367
368   //
369   // --- DEFINE MODules, iron, and lead voLUMES 
370   
371   //place ESM1 into EMM1 and ESM2 into EMM2 along with EMPB and EMFE
372
373   Float_t dx = sm_length;
374   Float_t dy = dx * root3_2;
375
376   Float_t xsup[9] = {-dx/2., dx/2., 3.*dx/2., 
377                      -dx,    0.,       dx,
378                      -3.*dx/2., -dx/2., dx/2.};
379
380   Float_t ysup[9] = {dy,  dy,  dy, 
381                      0.,  0.,  0., 
382                     -dy, -dy, -dy};
383
384   //
385   
386   // volume for SUPERMODULE 
387
388   //   Pb Convertor 
389   Float_t dpara_pb[6] = {12.5,12.5,8.,30.,0.,0.};
390   dpara_pb[0] = sm_length/2.;
391   dpara_pb[1] = dpara_pb[0] * root3_2;
392   dpara_pb[2] = th_lead/2.;
393
394   gMC->Gsvolu("EMPB","PARA", idtmed[600], dpara_pb, 6);
395   gMC->Gsatt ("EMPB", "SEEN", 0);
396
397   //   Fe Support
398   Float_t dpara_fe[6] = {12.5,12.5,8.,30.,0.,0.};
399   dpara_fe[0] = dpara_pb[0];
400   dpara_fe[1] = dpara_pb[1];
401   dpara_fe[2] = th_steel/2.;
402
403   gMC->Gsvolu("EMFE","PARA", idtmed[618], dpara_fe, 6);
404   gMC->Gsatt ("EMFE", "SEEN", 0);
405
406   // position supermodule ESM1 inside EMM1
407
408   Float_t z_ps,z_pb,z_fe,z_cv; 
409   
410   z_ps = - dpara_emm1[2] + sm_thick/2.;
411   gMC->Gspos("ESM1", 2, "EMM1", 0., 0., z_ps, irotdm, "ONLY");
412   z_pb=z_ps+sm_thick/2.+dpara_pb[2];
413   gMC->Gspos("EMPB", 1, "EMM1", 0., 0., z_pb, 0, "ONLY");
414   z_fe=z_pb+dpara_pb[2]+dpara_fe[2];
415   gMC->Gspos("EMFE", 1, "EMM1", 0., 0., z_fe, 0, "ONLY");
416   z_cv=z_fe+dpara_fe[2]+sm_thick/2.;
417   gMC->Gspos("ESM1", 1, "EMM1", 0., 0., z_cv, 0, "ONLY");
418
419   // position supermodule  ESM2 inside EMM2
420
421   z_ps = - dpara_emm1[2] + sm_thick/2.;
422   gMC->Gspos("ESM2", 2, "EMM2", 0., 0., z_ps, irotdm, "ONLY");
423   z_pb = z_ps + sm_thick/2.+dpara_pb[2];
424   gMC->Gspos("EMPB", 1, "EMM2", 0., 0., z_pb, 0, "ONLY");
425   z_fe = z_pb + dpara_pb[2]+dpara_fe[2];
426   gMC->Gspos("EMFE", 1, "EMM2", 0., 0., z_fe, 0, "ONLY");
427   z_cv = z_fe + dpara_fe[2]+sm_thick/2.;
428   gMC->Gspos("ESM2", 1, "EMM2", 0., 0., z_cv, 0, "ONLY");
429   // 
430
431   // EHOL is a tube structure made of air
432
433   Float_t d_hole[3];
434   d_hole[0] = 0.;
435   d_hole[1] = ncell_hole * cell_radius *2. * root3_2 + boundary;
436   d_hole[2] = dm_thick/2.;
437
438   gMC->Gsvolu("EHOL", "TUBE", idtmed[698], d_hole, 3);
439   gMC->Gsatt("EHOL", "SEEN", 1);
440
441   //Al-rod as boundary of the supermodules
442
443   Float_t Al_rod[3] ;
444   Al_rod[0] = sm_length * 3/2.;
445   Al_rod[1] = boundary;
446   Al_rod[2] = dm_thick/2.;
447
448   gMC->Gsvolu("EALM","BOX ", idtmed[698], Al_rod, 3);
449   gMC->Gsatt ("EALM", "SEEN", 1);
450   Float_t xalm[3];
451   xalm[0]=Al_rod[0];
452   xalm[1]=-xalm[0]/2.;
453   xalm[2]=xalm[1];
454
455   Float_t yalm[3];
456   yalm[0]=0.;
457   yalm[1]=xalm[0]*root3_2;
458   yalm[2]=-yalm[1];
459
460   // delx = full side of the supermodule
461   Float_t delx=sm_length * 3.;
462   Float_t x1= delx*root3_2 /2.;
463   Float_t x4=delx/4.; 
464
465   // xpos and ypos are the x & y coordinates of the centres of EMM1 volumes
466
467   Float_t xoff = boundary * TMath::Tan(pi/6.);
468   Float_t xmod[3]={x4 + xoff , x4 + xoff, -2.*x4-boundary/root3_2};
469   Float_t ymod[3] = {-x1 - boundary, x1 + boundary, 0.};
470   Float_t xpos[9], ypos[9];
471   Float_t theta[3] = {0., 2.*pi/3., 4.*pi/3.};
472   Int_t irotate[3] = {0, jhrot12, jhrot13};
473
474   for (j=0; j<3; ++j)
475     {
476       gMC->Gsposp("EALM", j+1, "EPMD", xalm[j],yalm[j], 0., irotate[j], "ONLY", Al_rod, 3);
477       for (i=0; i<9; ++i)
478         {
479           xpos[i]=xmod[j] + xsup[i]*TMath::Cos(theta[j]) - ysup[i]*TMath::Sin(theta[j]);
480           ypos[i]=ymod[j] + xsup[i]*TMath::Sin(theta[j]) + ysup[i]*TMath::Cos(theta[j]);
481
482           if(fDebug) printf("%s: %f %f \n", ClassName(), xpos[i], ypos[i]);
483
484           num_mod = i + 1 + j*9;
485
486           printf("\n%s: Num_mod %d\n",ClassName(),num_mod);
487
488           if(i==0){ 
489             gMC->Gsposp("EMM2", num_mod, "EPMD", xpos[i],ypos[i], 0., irotate[j], "ONLY", dpara_emm1, 6);
490           }
491           else {
492             gMC->Gsposp("EMM1", num_mod, "EPMD", xpos[i],ypos[i], 0., irotate[j], "ONLY", dpara_emm1, 6);
493           }
494         }
495     }
496
497         
498   // place EHOL in the centre of EPMD
499   gMC->Gspos("EHOL", 1, "EPMD", 0.,0.,0., 0, "ONLY");
500
501   // --- Place the EPMD in ALICE 
502   xp = 0.;
503   yp = 0.;
504   zp = zdist1;
505   
506   gMC->Gspos("EPMD", 1, "ALIC", xp,yp,zp, 0, "ONLY");
507     
508 }
509
510  
511 //_____________________________________________________________________________
512 void AliPMDv3::DrawModule()
513 {
514   //
515   // Draw a shaded view of the Photon Multiplicity Detector
516   //
517
518   gMC->Gsatt("*", "seen", -1);
519   gMC->Gsatt("alic", "seen", 0);
520   //
521   // Set the visibility of the components
522   // 
523   gMC->Gsatt("ECAR","seen",0);
524   gMC->Gsatt("ECCU","seen",1);
525   gMC->Gsatt("EHC1","seen",1);
526   gMC->Gsatt("EHC1","seen",1);
527   gMC->Gsatt("EHC2","seen",1);
528   gMC->Gsatt("EMM1","seen",1);
529   gMC->Gsatt("EHOL","seen",1);
530   gMC->Gsatt("EPMD","seen",0);
531   //
532   gMC->Gdopt("hide", "on");
533   gMC->Gdopt("shad", "on");
534   gMC->Gsatt("*", "fill", 7);
535   gMC->SetClipBox(".");
536   gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
537   gMC->DefaultRange();
538   gMC->Gdraw("alic", 40, 30, 0, 22, 20.5, .02, .02);
539   gMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
540
541   //gMC->Gdman(17, 5, "MAN");
542   gMC->Gdopt("hide", "off");
543 }
544
545 //_____________________________________________________________________________
546 void AliPMDv3::CreateMaterials()
547 {
548   //
549   // Create materials for the PMD
550   //
551   // ORIGIN    : Y. P. VIYOGI 
552   //
553   
554   // --- The Argon- CO2 mixture --- 
555   Float_t ag[2] = { 39.95 };
556   Float_t zg[2] = { 18. };
557   Float_t wg[2] = { .8,.2 };
558   Float_t dar   = .001782;   // --- Ar density in g/cm3 --- 
559   // --- CO2 --- 
560   Float_t ac[2] = { 12.,16. };
561   Float_t zc[2] = { 6.,8. };
562   Float_t wc[2] = { 1.,2. };
563   Float_t dc    = .001977;
564   Float_t dco   = .002;  // --- CO2 density in g/cm3 ---
565   
566   Float_t absl, radl, a, d, z;
567   Float_t dg;
568   Float_t x0ar;
569   //Float_t x0xe=2.4;
570   //Float_t dxe=0.005858;
571   Float_t buf[1];
572   Int_t nbuf;
573   Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
574   Float_t zsteel[4] = { 26.,24.,28.,14. };
575   Float_t wsteel[4] = { .715,.18,.1,.005 };
576   
577   Int_t *idtmed = fIdtmed->GetArray()-599;
578   Int_t isxfld = gAlice->Field()->Integ();
579   Float_t sxmgmx = gAlice->Field()->Max();
580   
581   // --- Define the various materials for GEANT --- 
582   AliMaterial(1, "Pb    $", 207.19, 82., 11.35, .56, 18.5);
583   x0ar = 19.55 / dar;
584   AliMaterial(2, "Argon$", 39.95, 18., dar, x0ar, 6.5e4);
585   AliMixture(3, "CO2  $", ac, zc, dc, -2, wc);
586   AliMaterial(4, "Al   $", 26.98, 13., 2.7, 8.9, 18.5);
587   AliMaterial(6, "Fe   $", 55.85, 26., 7.87, 1.76, 18.5);
588   AliMaterial(7, "W    $", 183.85, 74., 19.3, .35, 10.3);
589   AliMaterial(8, "G10  $", 20., 10., 1.7, 19.4, 999.);
590   AliMaterial(9, "SILIC$", 28.09, 14., 2.33, 9.36, 45.);
591   AliMaterial(10, "Be   $", 9.01, 4., 1.848, 35.3, 36.7);
592   AliMaterial(15, "Cu   $", 63.54, 29., 8.96, 1.43, 15.);
593   AliMaterial(16, "C    $", 12.01, 6., 2.265, 18.8, 49.9);
594   AliMaterial(17, "POLYCARBONATE    $", 20., 10., 1.2, 34.6, 999.);
595   AliMixture(19, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel); 
596   // AliMaterial(31, "Xenon$", 131.3, 54., dxe, x0xe, 6.5e4);
597   
598   AliMaterial(96, "MYLAR$", 8.73, 4.55, 1.39, 28.7, 62.);
599   AliMaterial(97, "CONCR$", 20., 10., 2.5, 10.7, 40.);
600   AliMaterial(98, "Vacum$", 1e-9, 1e-9, 1e-9, 1e16, 1e16);
601   AliMaterial(99, "Air  $", 14.61, 7.3, .0012, 30420., 67500.);
602  
603   //    define gas-mixtures 
604   
605   char namate[21]="";
606   gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
607   ag[1] = a;
608   zg[1] = z;
609   dg = (dar * 4 + dco) / 5;
610   AliMixture(5, "ArCO2$", ag, zg, dg, 2, wg);
611   
612   // Define tracking media 
613   AliMedium(1, "Pb conv.$", 1,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
614   AliMedium(7, "W  conv.$", 7,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
615   AliMedium(8, "G10plate$", 8,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
616   AliMedium(4, "Al      $", 4,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
617   AliMedium(6, "Fe      $", 6,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
618   AliMedium(5, "ArCO2   $", 5,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
619   AliMedium(9, "SILICON $", 9,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
620   AliMedium(10, "Be      $", 10, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
621   AliMedium(98, "Vacuum  $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .1,  10);
622   AliMedium(99, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .1,  .1);
623   AliMedium(15, "Cu      $", 15, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
624   AliMedium(16, "C       $", 16, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
625   AliMedium(17, "PLOYCARB$", 17, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
626   AliMedium(19, " S steel$", 19, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
627   //  AliMedium(31, "Xenon   $", 31,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
628   
629   // --- Generate explicitly delta rays in the iron, aluminium and lead --- 
630   gMC->Gstpar(idtmed[600], "LOSS", 3.);
631   gMC->Gstpar(idtmed[600], "DRAY", 1.);
632   
633   gMC->Gstpar(idtmed[603], "LOSS", 3.);
634   gMC->Gstpar(idtmed[603], "DRAY", 1.);
635   
636   gMC->Gstpar(idtmed[604], "LOSS", 3.);
637   gMC->Gstpar(idtmed[604], "DRAY", 1.);
638   
639   gMC->Gstpar(idtmed[605], "LOSS", 3.);
640   gMC->Gstpar(idtmed[605], "DRAY", 1.);
641   
642   gMC->Gstpar(idtmed[606], "LOSS", 3.);
643   gMC->Gstpar(idtmed[606], "DRAY", 1.);
644   
645   gMC->Gstpar(idtmed[607], "LOSS", 3.);
646   gMC->Gstpar(idtmed[607], "DRAY", 1.);
647   
648   // --- Energy cut-offs in the Pb and Al to gain time in tracking --- 
649   // --- without affecting the hit patterns --- 
650   gMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
651   gMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
652   gMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
653   gMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
654   gMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
655   gMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
656   gMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
657   gMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
658   gMC->Gstpar(idtmed[606], "CUTGAM", 1e-4);
659   gMC->Gstpar(idtmed[606], "CUTELE", 1e-4);
660   gMC->Gstpar(idtmed[606], "CUTNEU", 1e-4);
661   gMC->Gstpar(idtmed[606], "CUTHAD", 1e-4);
662   gMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
663   gMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
664   gMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
665   gMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
666   gMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
667   gMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
668   gMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
669   gMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
670   
671   // --- Prevent particles stopping in the gas due to energy cut-off --- 
672   gMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
673   gMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
674   gMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
675   gMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
676   gMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
677 }
678
679 //_____________________________________________________________________________
680 void AliPMDv3::Init()
681 {
682   //
683   // Initialises PMD detector after it has been built
684   //
685   Int_t i;
686   kdet=1;
687   //
688   if(fDebug) {
689     printf("\n%s: ",ClassName());
690     for(i=0;i<35;i++) printf("*");
691     printf(" PMD_INIT ");
692     for(i=0;i<35;i++) printf("*");
693     printf("\n");
694     printf("%s:                  PMD simulation package (v3) initialised\n",
695            ClassName());
696     printf("%s:  parameters of pmd\n",ClassName());
697     printf("%s: %10.2f %10.2f %10.2f %10.2f\n",ClassName(),
698            cell_radius,cell_wall,cell_depth,zdist1 );
699     printf("%s: ",ClassName());
700     for(i=0;i<80;i++) printf("*");
701     printf("\n");
702   }
703   
704   Int_t *idtmed = fIdtmed->GetArray()-599;
705   fMedSens=idtmed[605-1];
706 }
707
708 //_____________________________________________________________________________
709 void AliPMDv3::StepManager()
710 {
711   //
712   // Called at each step in the PMD
713   //
714   Int_t   copy;
715   Float_t hits[4], destep;
716   Float_t center[3] = {0,0,0};
717   Int_t   vol[5];
718   //char *namep;
719   
720   if(gMC->GetMedium() == fMedSens && (destep = gMC->Edep())) {
721   
722     gMC->CurrentVolID(copy);
723
724     //namep=gMC->CurrentVolName();
725     //printf("Current vol is %s \n",namep);
726
727     vol[0]=copy;
728     gMC->CurrentVolOffID(1,copy);
729
730     //namep=gMC->CurrentVolOffName(1);
731     //printf("Current vol 11 is %s \n",namep);
732
733     vol[1]=copy;
734     gMC->CurrentVolOffID(2,copy);
735
736     //namep=gMC->CurrentVolOffName(2);
737     //printf("Current vol 22 is %s \n",namep);
738
739     vol[2]=copy;
740
741     //  if(strncmp(namep,"EHC1",4))vol[2]=1;
742
743     gMC->CurrentVolOffID(3,copy);
744
745     //namep=gMC->CurrentVolOffName(3);
746     //printf("Current vol 33 is %s \n",namep);
747
748     vol[3]=copy;
749     gMC->CurrentVolOffID(4,copy);
750
751     //namep=gMC->CurrentVolOffName(4);
752     //printf("Current vol 44 is %s \n",namep);
753
754     vol[4]=copy;
755     //printf("volume number %d,%d,%d,%d,%d,%f \n",vol[0],vol[1],vol[2],vol[3],vol[4],destep*1000000);
756
757     gMC->Gdtom(center,hits,1);
758     hits[3] = destep*1e9; //Number in eV
759     AddHit(gAlice->CurrentTrack(), vol, hits);
760   }
761 }
762
763   
764 //------------------------------------------------------------------------
765 // Get parameters
766
767 void AliPMDv3::GetParameters()
768 {
769   Int_t ncell_um, num_um;
770   ncell_um=24;
771   num_um=3;
772   ncell_hole=12;
773   cell_radius=0.25;
774   cell_wall=0.02;
775   cell_depth=0.25 * 2.;
776   //
777   boundary=0.7;
778   ncell_sm=ncell_um * num_um;  //no. of cells in a row in one supermodule
779   sm_length= ((ncell_sm + 0.25 ) * cell_radius) * 2.;
780   //
781   th_base=0.3;
782   th_air=0.1;
783   th_pcb=0.16;
784   //
785   sm_thick = th_base + th_air + th_pcb + cell_depth + th_pcb + th_air + th_pcb;
786   //
787   th_lead=1.5;
788   th_steel=0.5;
789   //
790   zdist1 = -370.;
791 }
792
793
794
795
796
797
798
799
800
801
802
803
804