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