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