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