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