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