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