]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMDv1.cxx
implementation of effc++
[u/mrichter/AliRoot.git] / PMD / AliPMDv1.cxx
1 /***************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 /* $Id$ */
16
17 //
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 //  Photon Multiplicity Detector Version 1                                   //
21 //  Bedanga Mohanty : February 14th 2006
22 //                                                                           //
23 //Begin_Html
24 /*
25 <img src="picts/AliPMDv1Class.gif">
26 */
27 //End_Html
28 //                                                                           //
29 ///////////////////////////////////////////////////////////////////////////////
30 ////
31
32 #include "Riostream.h"
33 #include <TVirtualMC.h>
34
35 #include "AliConst.h" 
36 #include "AliLog.h"
37 #include "AliMC.h"
38 #include "AliMagF.h" 
39 #include "AliPMDv1.h"
40 #include "AliRun.h"
41
42 const Int_t   AliPMDv1::fgkNcolUM1    = 48;  // Number of cols in UM, type 1
43 const Int_t   AliPMDv1::fgkNcolUM2    = 96;  // Number of cols in UM, type 2
44 const Int_t   AliPMDv1::fgkNrowUM1    = 96;  // Number of rows in UM, type 1
45 const Int_t   AliPMDv1::fgkNrowUM2    = 48;  // Number of rows in UM, type 2
46 const Float_t AliPMDv1::fgkCellRadius = 0.25;     // Radius of a hexagonal cell
47 const Float_t AliPMDv1::fgkCellWall   = 0.02;     // Thickness of cell Wall
48 const Float_t AliPMDv1::fgkCellDepth  = 0.50;     // Gas thickness
49 const Float_t AliPMDv1::fgkThBase     = 0.2;      // Thickness of Base plate
50 const Float_t AliPMDv1::fgkThBKP      = 0.1;      // Thickness of Back plane
51 const Float_t AliPMDv1::fgkThAir      = 1.03;      // Thickness of Air
52 const Float_t AliPMDv1::fgkThPCB      = 0.16;     // Thickness of PCB
53 const Float_t AliPMDv1::fgkThLead     = 1.5;      // Thickness of Pb
54 const Float_t AliPMDv1::fgkThSteel    = 0.5;      // Thickness of Steel
55 const Float_t AliPMDv1::fgkGap        = 0.025;    // Air Gap
56 const Float_t AliPMDv1::fgkZdist      = 361.5;    // z-position of the detector
57 const Float_t AliPMDv1::fgkSqroot3    = 1.7320508;// Square Root of 3
58 const Float_t AliPMDv1::fgkSqroot3by2 = 0.8660254;// Square Root of 3 by 2
59 const Float_t AliPMDv1::fgkSSBoundary = 0.3;
60 const Float_t AliPMDv1::fgkThSS       = 1.03;
61 const Float_t AliPMDv1::fgkThG10      = 1.03;
62 ClassImp(AliPMDv1)
63  
64 //_____________________________________________________________________________
65 AliPMDv1::AliPMDv1():
66   fSMthick(0.),
67   fDthick(0.),
68   fSMLengthax(0.),
69   fSMLengthay(0.),
70   fSMLengthbx(0.),
71   fSMLengthby(0.),
72   fMedSens(0)
73 {
74   //
75   // Default constructor 
76   //
77   for (Int_t i = 0; i < 3; i++)
78     {
79       fDboxmm1[i]  = 0.;
80       fDboxmm12[i] = 0.;
81       fDboxmm2[i]  = 0.;
82       fDboxmm22[i] = 0.;
83     }
84 }
85  
86 //_____________________________________________________________________________
87 AliPMDv1::AliPMDv1(const char *name, const char *title):
88   AliPMD(name,title),
89   fSMthick(0.),
90   fDthick(0.),
91   fSMLengthax(0.),
92   fSMLengthay(0.),
93   fSMLengthbx(0.),
94   fSMLengthby(0.),
95   fMedSens(0)
96 {
97   //
98   // Standard constructor
99   //
100   for (Int_t i = 0; i < 3; i++)
101     {
102       fDboxmm1[i]  = 0.;
103       fDboxmm12[i] = 0.;
104       fDboxmm2[i]  = 0.;
105       fDboxmm22[i] = 0.;
106     }
107 }
108
109 //_____________________________________________________________________________
110 void AliPMDv1::CreateGeometry()
111 {
112   // Create geometry for Photon Multiplicity Detector
113
114   GetParameters();
115   CreateSupermodule();
116   CreatePMD();
117 }
118
119 //_____________________________________________________________________________
120 void AliPMDv1::CreateSupermodule()
121 {
122   // 
123   // Creates the geometry of the cells of PMD, places them in  supermodule 
124   // which is a rectangular object.
125   // Basic unit is ECAR, a hexagonal cell made of Ar+CO2, which is 
126   // placed inside another hexagonal cell made of Cu (ECCU) with larger 
127   // radius, compared to ECAR. The difference in radius gives the dimension 
128   // of half width of each cell wall.
129   // These cells are placed in a rectangular strip which are of 2 types 
130   // EST1 and EST2 
131   // 2 types of unit modules are made EUM1 and EUM2 which contains these strips
132   // placed repeatedly 
133   // Each supermodule (ESMA, ESMB), made of G10 is filled with following 
134   //components. They have 6 unit moudles inside them
135   // ESMA, ESMB are placed in EPMD along with EMPB (Pb converter) 
136   // and EMFE (iron support) 
137
138   
139   Int_t i,j;
140   Int_t number;
141   Int_t ihrotm,irotdm;
142   Float_t xb, yb, zb;
143
144   Int_t *idtmed = fIdtmed->GetArray()-599;
145  
146   AliMatrix(ihrotm, 90., 30.,   90.,  120., 0., 0.);
147   AliMatrix(irotdm, 90., 180.,  90.,  270., 180., 0.);
148  
149   // STEP - I
150   //******************************************************//
151   // First create the sensitive medium of a hexagon cell (ECAR)
152   // Inner hexagon filled with gas (Ar+CO2)
153   
154   Float_t hexd2[10] = {0.,360.,6,2,-0.25,0.,0.23,0.25,0.,0.23};
155   hexd2[4] = -fgkCellDepth/2.;
156   hexd2[7] =  fgkCellDepth/2.;
157   hexd2[6] =  fgkCellRadius - fgkCellWall;
158   hexd2[9] =  fgkCellRadius - fgkCellWall;
159   
160   gMC->Gsvolu("ECAR", "PGON", idtmed[604], hexd2,10);
161   gMC->Gsatt("ECAR", "SEEN", 0);
162   //******************************************************//
163
164   // STEP - II
165   //******************************************************//
166   // Place the sensitive medium inside a hexagon copper cell (ECCU)
167   // Outer hexagon made of Copper
168   
169   Float_t hexd1[10] = {0.,360.,6,2,-0.25,0.,0.25,0.25,0.,0.25};
170   hexd1[4] = -fgkCellDepth/2.;
171   hexd1[7] =  fgkCellDepth/2.;
172   hexd1[6] =  fgkCellRadius;
173   hexd1[9] =  fgkCellRadius;
174
175   gMC->Gsvolu("ECCU", "PGON", idtmed[614], hexd1,10);
176   gMC->Gsatt("ECCU", "SEEN", 0);
177   gMC->Gsatt("ECCU", "COLO", 4);
178
179   // Place  inner hex (sensitive volume) inside outer hex (copper)
180   
181   gMC->Gspos("ECAR", 1, "ECCU", 0., 0., 0., 0, "ONLY");
182   //******************************************************//
183
184   // STEP - III
185   //******************************************************//
186   // Now create Rectangular TWO strips (EST1, EST2) 
187   // of 1 column and 48 or 96 cells length
188
189   // volume for first strip EST1 made of AIR 
190
191   Float_t dbox1[3];
192   dbox1[0] = fgkCellRadius/fgkSqroot3by2;
193   dbox1[1] = fgkNrowUM1*fgkCellRadius;
194   dbox1[2] = fgkCellDepth/2.;
195   
196   gMC->Gsvolu("EST1","BOX", idtmed[698], dbox1, 3);
197   gMC->Gsatt("EST1", "SEEN", 0);
198
199   // volume for second strip EST2 
200
201
202   Float_t dbox2[3];
203   dbox2[1] = fgkNrowUM2*fgkCellRadius;
204   dbox2[0] = dbox1[0];
205   dbox2[2] = dbox1[2];
206
207   gMC->Gsvolu("EST2","BOX", idtmed[698], dbox2, 3);
208   gMC->Gsatt("EST2", "SEEN", 0);
209
210   // Place hexagonal cells ECCU placed inside EST1 
211   xb = 0.; 
212   zb = 0.;
213   yb = (dbox1[1]) - fgkCellRadius; 
214   for (i = 1; i <= fgkNrowUM1; ++i) 
215     {
216       number = i;
217       gMC->Gspos("ECCU", number, "EST1", xb,yb,zb, 0, "ONLY");
218       yb -= (fgkCellRadius*2.);
219     }
220
221   // Place hexagonal cells ECCU placed inside EST2 
222   xb = 0.; 
223   zb = 0.;
224   yb = (dbox2[1]) - fgkCellRadius; 
225   for (i = 1; i <= fgkNrowUM2; ++i) 
226     {
227       number = i;
228       gMC->Gspos("ECCU", number, "EST2", xb,yb,zb, 0, "ONLY");
229       //PH      cout << "ECCU in EST2 ==> " << number << "\t"<<xb <<  "\t"<<yb <<endl;
230       yb -= (fgkCellRadius*2.);
231     }
232
233
234   //******************************************************//
235  
236
237   // STEP - IV
238   //******************************************************//
239  // 2 types of rectangular shaped unit modules EUM1 and EUM2 (defined by BOX) 
240   //---------------------------------EHC1 Start----------------------//
241   // Create EHC1 : The honey combs for a unit module type 1
242   // First step is to create a honey comb unit module.
243   // This is named as EHC1, we will lay the EST1 strips of
244   // honey comb cells inside it.
245   
246   //Dimensions of EHC1
247   //X-dimension = Number of columns + cell radius
248   //Y-dimension = Number of rows * cell radius/sqrt3by2 - (some factor)
249   //Z-dimension = cell depth/2
250
251   Float_t dbox3[3];
252   dbox3[0] = (dbox1[0]*fgkNcolUM1)-(fgkCellRadius*fgkSqroot3*(fgkNcolUM1-1)/6.);   
253   dbox3[1] = dbox1[1]+fgkCellRadius/2.;
254   dbox3[2] = fgkCellDepth/2.;
255
256   //Create a BOX, Material AIR
257   gMC->Gsvolu("EHC1","BOX", idtmed[698], dbox3, 3);
258   gMC->Gsatt("EHC1", "SEEN", 0);  
259   // Place rectangular strips EST1 inside EHC1 unit module
260   xb = dbox3[0]-dbox1[0];  
261   
262   for (j = 1; j <= fgkNcolUM1; ++j)  
263     {
264       if(j%2 == 0)
265         {
266           yb = -fgkCellRadius/2.0;
267         }
268       else
269         {
270           yb = fgkCellRadius/2.0;
271         }
272       number = j;
273       gMC->Gspos("EST1",number, "EHC1", xb, yb , 0. , 0, "MANY");
274       //The strips are being placed from top towards bottom of the module
275       //This is because the first cell in a module in hardware is the top
276       //left corner cell
277       xb = (dbox3[0]-dbox1[0])-j*fgkCellRadius*fgkSqroot3;
278
279     }
280   //--------------------EHC1 done----------------------------------//
281
282
283   //---------------------------------EHC2 Start----------------------//
284   // Create EHC2 : The honey combs for a unit module type 2
285   // First step is to create a honey comb unit module.
286   // This is named as EHC2, we will lay the EST2 strips of
287   // honey comb cells inside it.
288
289   //Dimensions of EHC2
290   //X-dimension = Number of columns + cell radius
291   //Y-dimension = Number of rows * cell radius/sqrt3by2 - (some factor)
292   //Z-dimension = cell depth/2
293
294   dbox3[0] = (dbox1[0]*fgkNcolUM1)-(fgkCellRadius*fgkSqroot3*(fgkNcolUM1-1)/6.);   
295   dbox3[1] = dbox1[1]+fgkCellRadius/2.;
296   dbox3[2] = fgkCellDepth/2.;
297
298   Float_t dbox4[3];
299
300   dbox4[0] =(dbox2[0]*fgkNcolUM2)-(fgkCellRadius*fgkSqroot3*(fgkNcolUM2-1)/6.); 
301   dbox4[1] = dbox2[1] + fgkCellRadius/2.;
302   dbox4[2] = dbox3[2];
303   
304   //Create a BOX of AIR
305   gMC->Gsvolu("EHC2","BOX", idtmed[698], dbox4, 3);
306   gMC->Gsatt("EHC2", "SEEN", 0);
307
308   // Place rectangular strips EST2 inside EHC2 unit module
309   xb = dbox4[0]-dbox2[0]; 
310   for (j = 1; j <= fgkNcolUM2; ++j) 
311   {
312     if(j%2 == 0)
313   {
314     yb = -fgkCellRadius/2.0;
315   }
316     else
317   {
318     yb = +fgkCellRadius/2.0;
319   }
320     number = j;
321     gMC->Gspos("EST2",number, "EHC2", xb, yb , 0. ,0, "MANY");
322     xb = (dbox4[0]-dbox2[0])-j*fgkCellRadius*fgkSqroot3;
323   }
324   
325
326   //--------------------EHC2 done----------------------------------//
327
328
329   // Now the job is to assmeble an Unit module
330   // It will have the following components
331   // (a) Base plate of G10 of 0.2 cm 
332   // (b) Air gap  of 0.05 cm 
333   // (c) Bottom PCB of 0.16 cm G10
334   // (d) Honey comb 0f 0.5 cm
335   // (e) Top PCB  of 0.16 cm G10
336   // (f) Air gap of 0.16 cm
337   // (g) Back Plane of 0.1 cm G10
338   // (h) Then all around then we have an air gap of 0.5mm
339   // (i) Then all around 0.5mm thick G10 insulation
340   // (h) Then all around Stainless Steel boundary channel 0.3 cm thick
341   //Let us first create them one by one
342   //---------------------------------------------------//
343
344   // ---------------- Lets do it first for UM Type A -----//
345
346  //--------------------------------------------------//
347   //Bottom and Top PCB : EPCA
348   //===========================
349   // Make a 1.6mm thick G10 Bottom and Top PCB for Unit module A
350   // X-dimension same as EHC1 - dbox3[0]
351   // Y-dimension same as EHC1 - dbox3[1]
352   // Z-dimension 0.16/2 = 0.08 cm
353   //-------------------------------------------------//
354   Float_t dboxPcbA[3];
355   dboxPcbA[0]      = dbox3[0]; 
356   dboxPcbA[1]      = dbox3[1];       
357   dboxPcbA[2]      = fgkThPCB/2.;
358   
359   //Top and Bottom PCB is a BOX of Material G10
360   gMC->Gsvolu("EPCA","BOX", idtmed[607], dboxPcbA, 3);
361   gMC->Gsatt("EPCA", "SEEN", 0);
362   //--------------------------------------------------------//  
363   //Back Plane : EBKA
364   //==================
365   // Make a 1.0mm thick Back Plane PCB for Unit module A
366   // X-dimension same as EHC1 - dbox3[0]
367   // Y-dimension same as EHC1 - dbox3[1]
368   // Z-dimension 0.1/2 = 0.05 cm
369   //------------------------------------------------------//
370   Float_t dboxBPlaneA[3];
371   dboxBPlaneA[0]   = dbox3[0]; 
372   dboxBPlaneA[1]   = dbox3[1];       
373   dboxBPlaneA[2]   = fgkThBKP/2.;
374   
375   //Back PLane PCB of MAterial G10
376   gMC->Gsvolu("EBKA","BOX", idtmed[607], dboxBPlaneA, 3);
377   gMC->Gsatt("EBKA", "SEEN", 0);
378   //-------------------------------------------------------------//  
379
380  //---------- That was all in the Z -direction of Unit Module A----//
381
382   //  Now lets us construct the boundary arround the Unit Module --//
383   // This boundary has 
384   // (a) 0.5 mm X and Y and 10.3 mm Z dimension  AIR gap
385   // (b) 0.5 mm X and Y and 10.3 mm Z dimension G10
386   // (c) 3.0 mm X and Y and 12.3 mm Z dimension Stainless Steel
387
388
389
390   //-------------------------------------------------//
391   //AIR GAP between UM and Boundary : ECGA FOR PRESHOWER PLANE
392   //==========================================================
393   // Make a 10.3mm thick Air gap for Unit module A
394   // X-dimension same as EHC1+0.05
395   // Y-dimension same as EHC1+0.05
396   // Z-dimension 1.03/2 = 0.515 cm
397   Float_t dboxAir3A[3];
398   dboxAir3A[0]         = dbox3[0]+(2.0*fgkGap); 
399   dboxAir3A[1]         = dbox3[1]+(2.0*fgkGap); 
400   dboxAir3A[2]         = fgkThAir/2.;
401
402   //FOR PRESHOWER
403   //Air gap is a BOX of Material Air
404   gMC->Gsvolu("ECGA","BOX", idtmed[698], dboxAir3A, 3);
405   gMC->Gsatt("ECGA", "SEEN", 0);
406
407   //FOR VETO
408   //Air gap is a BOX of Material Air
409   gMC->Gsvolu("ECVA","BOX", idtmed[698], dboxAir3A, 3);
410   gMC->Gsatt("ECVA", "SEEN", 0);
411   //-------------------------------------------------//  
412
413  //-------------------------------------------------//
414   //G10 boundary between honeycomb and SS : EDGA
415   //================================================
416   // Make a 10.3mm thick G10 Boundary for Unit module A
417   // X-dimension same as EHC1+Airgap+0.05
418   // Y-dimension same as EHC1+Airgap+0.05
419   // Z-dimension 1.03/2 = 0.515 cm
420   Float_t dboxGGA[3];
421   dboxGGA[0]         = dboxAir3A[0]+(2.0*fgkGap); 
422   dboxGGA[1]         = dboxAir3A[1]+(2.0*fgkGap); 
423   dboxGGA[2]         = fgkThG10/2.;
424
425   //FOR PRESHOWER
426   //G10 BOX 
427   gMC->Gsvolu("EDGA","BOX", idtmed[607], dboxGGA, 3);
428   gMC->Gsatt("EDGA", "SEEN", 0);
429
430   //FOR VETO
431   //G10 BOX 
432   gMC->Gsvolu("EDVA","BOX", idtmed[607], dboxGGA, 3);
433   gMC->Gsatt("EDVA", "SEEN", 0);
434
435   //-------------------------------------------------//  
436   //----------------------------------------------------------//
437   //Stainless Steel Bounadry : ESSA
438   //==================================
439   // Make a 10.3mm thick Stainless Steel boundary for Unit module A
440   // X-dimension same as EHC1 + Airgap + G10 + 0.3
441   // Y-dimension same as EHC1 + Airgap + G10 + 0.3
442   // Z-dimension 1.03/2 = 0.515 cm
443   //------------------------------------------------------//
444   // A Stainless Steel Boundary Channel to house the unit module
445   Float_t fDboxss1[3];
446   fDboxss1[0]           = dboxGGA[0]+fgkSSBoundary; 
447   fDboxss1[1]           = dboxGGA[1]+fgkSSBoundary;       
448   fDboxss1[2]           = fgkThSS/2.;
449   
450   //FOR PRESHOWER
451
452   //Stainless Steel boundary - Material Stainless Steel
453   gMC->Gsvolu("ESSA","BOX", idtmed[618], fDboxss1, 3);
454   gMC->Gsatt("ESSA", "SEEN", 0);
455
456   //FOR VETO
457   //Stainless Steel boundary - Material Stainless Steel
458   gMC->Gsvolu("ESVA","BOX", idtmed[618], fDboxss1, 3);
459   gMC->Gsatt("ESVA", "SEEN", 0);
460
461   //----------------------------------------------------------------//
462
463   //----------------------------------------------------------------//
464   // Here we need to place the volume in order ESSA -> EDGA -> ECGA 
465   // this makes the SS boundary and the 0.5mm thick FR4 insulation in place, 
466   // and the air volume ECGA acts as mother for the rest of components.
467   // The above placeemnt is done at (0.,0.,0.) relative coordiante 
468   // Now we place bottom PCB, honeycomb, top PCB in this volume. We donot place
469   // unnecessary air volumes now. Just leave the gap as we are placing them
470   // in  air only. This also reduces the number of volumes for geant to track.
471
472 // Tree structure for different volumes
473 //
474 //                              EUM1
475 //                               |
476 //                      --------------------
477 //                      |        |         |
478 //                    EBPA      ESSA      EBKA
479 //                               |
480 //                              EDGA
481 //                               |
482 //                              ECGA
483 //                               |
484 //                      --------------------
485 //                      |        |         |
486 //                    EPCA(1)   EHC1     EPCA(2)
487 //                   (bottom)    |      (top PCB)
488 //                               |
489 //                          Sensitive volume
490 //                              (gas)
491 //      
492
493
494   //FOR VETO
495 //Creating the side channels 
496 // SS boundary channel, followed by G10 and Air Gap  
497   gMC->Gspos("EDVA", 1, "ESVA", 0., 0., 0., 0, "ONLY");
498   gMC->Gspos("ECVA", 1, "EDVA", 0., 0., 0., 0, "ONLY");
499
500 //FOR PRESHOWER
501   gMC->Gspos("EDGA", 1, "ESSA", 0., 0., 0., 0, "ONLY");
502   gMC->Gspos("ECGA", 1, "EDGA", 0., 0., 0., 0, "ONLY");
503
504  // now other components, using Bedanga's code, but changing the values.
505   //Positioning Bottom PCB, Honey Comb abd Top PCB in AIR
506
507   //For veto plane
508   //Positioning the Bottom 0.16 cm PCB
509   Float_t zbpcb = -dboxAir3A[2] + (2.0*fgkGap) + fgkThPCB/2.;
510   gMC->Gspos("EPCA", 1, "ECVA", 0., 0., zbpcb, 0, "ONLY");
511   //Positioning the Honey Comb 0.5 cm
512   Float_t zhc = zbpcb + fgkThPCB/2. + fgkCellDepth/2.;
513   gMC->Gspos("EHC1", 1, "ECVA", 0., 0., zhc, 0, "ONLY");
514   //Positioning the Top PCB 0.16 cm
515   Float_t ztpcb = zhc + fgkCellDepth/2 + fgkThPCB/2.;
516   gMC->Gspos("EPCA", 2, "ECVA", 0., 0., ztpcb, 0, "ONLY");
517
518
519   //For Preshower plane the ordering is reversed
520   //Positioning the Bottom 0.16 cm PCB
521   zbpcb = -dboxAir3A[2] + fgkThPCB + fgkThPCB/2.;
522   gMC->Gspos("EPCA", 1, "ECGA", 0., 0., zbpcb, 0, "ONLY");
523   //Positioning the Honey Comb 0.5 cm
524   zhc = zbpcb + fgkThPCB/2. + fgkCellDepth/2.;
525   gMC->Gspos("EHC1", 1, "ECGA", 0., 0., zhc, 0, "ONLY");
526   //Positioning the Top PCB 0.16 cm
527   ztpcb = zhc + fgkCellDepth/2 + fgkThPCB/2.;
528   gMC->Gspos("EPCA", 2, "ECGA", 0., 0., ztpcb, 0, "ONLY");
529
530
531
532
533  //--------------Now let us construct final UM ---------------//
534   // We will do it as follows :
535   // (i)  First make a UM of air. which will have dimensions
536   //      of the SS boundary Channel (in x,y) and of height 13.3mm
537   //(ii)  Then we will place all the components
538
539   //----------------------------------------------------------//
540   // A  unit module type A of Air
541   // Dimensions of Unit Module same as SS boundary channel
542   Float_t fDboxum1[3];
543   fDboxum1[0] = fDboxss1[0];
544   fDboxum1[1] = fDboxss1[1];
545   fDboxum1[2] = fgkThSS/2. +0.15; // 0.15 added to accomodate Base Plate at
546   // the bottom and the backplane PCB at the top.
547
548   //FOR PRESHOWER
549   //Create a Unit module of above dimensions Material : AIR
550   gMC->Gsvolu("EUM1","BOX", idtmed[698], fDboxum1, 3);
551   gMC->Gsatt("EUM1", "SEEN", 0);
552   //FOR VETO
553   gMC->Gsvolu("EUV1","BOX", idtmed[698], fDboxum1, 3);
554   gMC->Gsatt("EUV1", "SEEN", 0);
555
556   //----------------------------------------------------------------//
557
558   //BASE PLATE : EBPA
559   //==================
560   // Make a 2mm thick G10 Base plate for Unit module A
561   // Base plate is as big as the final UM dimensions that is as 
562   // SS boundary channel
563   Float_t dboxBaseA[3];
564   dboxBaseA[0]       = fDboxss1[0];
565   dboxBaseA[1]       = fDboxss1[1];       
566   dboxBaseA[2]       = fgkThBase/2.;
567   
568   //Base Blate is a G10 BOX
569   gMC->Gsvolu("EBPA","BOX", idtmed[607], dboxBaseA, 3);
570   gMC->Gsatt("EBPA", "SEEN", 0);
571   //----------------------------------------------------//  
572
573   //FOR VETO
574   //- Placing of all components of UM in AIR BOX EUM1--//
575   //(1)   FIRST PUT THE BASE PLATE
576   Float_t zbaseplate = -fDboxum1[2] + fgkThBase/2.;
577   gMC->Gspos("EBPA", 1, "EUV1", 0., 0., zbaseplate, 0, "ONLY");
578
579   //(2)   NEXT PLACING the SS BOX 
580   Float_t zss = zbaseplate + fgkThBase/2. + fgkThSS/2.;
581   gMC->Gspos("ESVA", 1, "EUV1", 0., 0., zss, 0, "ONLY");
582   
583   // (3) Positioning the Backplane PCB 0.1 cm
584   Float_t zbkp = zss + fgkThSS/2. + fgkThBKP/2.;
585   gMC->Gspos("EBKA", 1, "EUV1", 0., 0., zbkp, 0, "ONLY");
586
587   //FOR PRESHOWER
588   // (3) Positioning the Backplane PCB 0.1 cm
589   zbkp = -fDboxum1[2] + fgkThBKP/2.;
590   gMC->Gspos("EBKA", 1, "EUM1", 0., 0., zbkp, 0, "ONLY");
591
592   //(2)   NEXT PLACING the SS BOX 
593   zss = zbkp + fgkThBKP/2. + fgkThSS/2.;
594   gMC->Gspos("ESSA", 1, "EUM1", 0., 0., zss, 0, "ONLY");
595   
596   //(1)   FIRST PUT THE BASE PLATE
597   zbaseplate = zss + fgkThSS/2 + fgkThBase/2.;
598   gMC->Gspos("EBPA", 1, "EUM1", 0., 0., zbaseplate, 0, "ONLY");
599   //-------------------- UM Type A completed ------------------------//
600
601
602
603   //-------------------- Lets do the same thing for UM type B -------//
604  //--------------------------------------------------//
605   //Bottom and Top PCB : EPCB
606   //===========================
607   // Make a 1.6mm thick G10 Bottom and Top PCB for Unit module B
608   // X-dimension same as EHC2 - dbox4[0]
609   // Y-dimension same as EHC2 - dbox4[1]
610   // Z-dimension 0.16/2 = 0.08 cm
611   //-------------------------------------------------//
612   Float_t dboxPcbB[3];
613   dboxPcbB[0]      = dbox4[0]; 
614   dboxPcbB[1]      = dbox4[1];       
615   dboxPcbB[2]      = fgkThPCB/2.;
616   
617   //Top and Bottom PCB is a BOX of Material G10
618   gMC->Gsvolu("EPCB","BOX", idtmed[607], dboxPcbB, 3);
619   gMC->Gsatt("EPCB", "SEEN", 0);
620   //--------------------------------------------------------//  
621   //Back Plane : EBKB
622   //==================
623   // Make a 1.0mm thick Back Plane PCB for Unit module B
624   // X-dimension same as EHC2 - dbox4[0]
625   // Y-dimension same as EHC2 - dbox4[1]
626   // Z-dimension 0.1/2 = 0.05 cm
627   //------------------------------------------------------//
628   Float_t dboxBPlaneB[3];
629   dboxBPlaneB[0]   = dbox4[0]; 
630   dboxBPlaneB[1]   = dbox4[1];       
631   dboxBPlaneB[2]   = fgkThBKP/2.;
632   
633   //Back PLane PCB of MAterial G10
634   gMC->Gsvolu("EBKB","BOX", idtmed[607], dboxBPlaneB, 3);
635   gMC->Gsatt("EBKB", "SEEN", 0);
636   //-------------------------------------------------------------//  
637
638  //---------- That was all in the Z -direction of Unit Module B----//
639
640   //  Now lets us construct the boundary arround the Unit Module --//
641   // This boundary has 
642   // (a) 0.5 mm X and Y and 10.3 mm Z dimension  AIR gap
643   // (b) 0.5 mm X and Y and 10.3 mm Z dimension G10
644   // (c) 3.0 mm X and Y and 12.3 mm Z dimension Stainless Steel
645
646   //-------------------------------------------------//
647   //AIR GAP between UM and Boundary : ECGB
648   //================================================
649   // Make a 10.3mm thick Air gap for Unit module B
650   // X-dimension same as EHC2+0.05
651   // Y-dimension same as EHC2+0.05
652   // Z-dimension 1.03/2 = 0.515 cm
653   Float_t dboxAir3B[3];
654   dboxAir3B[0]         = dbox4[0]+(2.0*fgkGap); 
655   dboxAir3B[1]         = dbox4[1]+(2.0*fgkGap);       
656   dboxAir3B[2]         = fgkThAir/2.;
657
658   //PRESHOWER
659   //Air gap is a BOX of Material Air
660   gMC->Gsvolu("ECGB","BOX", idtmed[698], dboxAir3B, 3);
661   gMC->Gsatt("ECGB", "SEEN", 0);
662   //VETO
663   gMC->Gsvolu("ECVB","BOX", idtmed[698], dboxAir3B, 3);
664   gMC->Gsatt("ECVB", "SEEN", 0);
665
666   //-------------------------------------------------//  
667
668  //-------------------------------------------------//
669   //G10 boundary between honeycomb and SS : EDGB
670   //================================================
671   // Make a 10.3mm thick G10 Boundary for Unit module B
672   // X-dimension same as EHC2+Airgap+0.05
673   // Y-dimension same as EHC2+Airgap+0.05
674   // Z-dimension 1.03/2 = 0.515 cm
675   Float_t dboxGGB[3];
676   dboxGGB[0]         = dboxAir3B[0]+(2.0*fgkGap); 
677   dboxGGB[1]         = dboxAir3B[1]+(2.0*fgkGap);      
678   dboxGGB[2]         = fgkThG10/2.;
679
680   //PRESHOWER
681   //G10 BOX 
682   gMC->Gsvolu("EDGB","BOX", idtmed[607], dboxGGB, 3);
683   gMC->Gsatt("EDGB", "SEEN", 0);
684   //VETO
685   gMC->Gsvolu("EDVB","BOX", idtmed[607], dboxGGB, 3);
686   gMC->Gsatt("EDVB", "SEEN", 0);
687   //-------------------------------------------------//  
688   //----------------------------------------------------------//
689   //Stainless Steel Bounadry : ESSB
690   //==================================
691   // Make a 10.3mm thick Stainless Steel boundary for Unit module B
692   // X-dimension same as EHC2 + Airgap + G10 + 0.3
693   // Y-dimension same as EHC2 + Airgap + G10 + 0.3
694   // Z-dimension 1.03/2 = 0.515 cm
695   //------------------------------------------------------//
696   // A Stainless Steel Boundary Channel to house the unit module
697   Float_t fDboxss2[3];
698   fDboxss2[0]           = dboxGGB[0]+fgkSSBoundary; 
699   fDboxss2[1]           = dboxGGB[1]+fgkSSBoundary;       
700   fDboxss2[2]           = fgkThSS/2.;
701   
702   //PRESHOWER
703   //Stainless Steel boundary - Material Stainless Steel
704   gMC->Gsvolu("ESSB","BOX", idtmed[618], fDboxss2, 3);
705   gMC->Gsatt("ESSB", "SEEN", 0);
706   //VETO
707   gMC->Gsvolu("ESVB","BOX", idtmed[618], fDboxss2, 3);
708   gMC->Gsatt("ESVB", "SEEN", 0);
709   //----------------------------------------------------------------//
710
711   //----------------------------------------------------------------//
712   // Here we need to place the volume in order ESSB -> EDGB -> ECGB 
713   // this makes the SS boiundary and the 0.5mm thick FR4 insulation in place, 
714   // and the air volume ECGB acts as mother for the rest of components.
715   // The above placeemnt is done at (0.,0.,0.) relative coordiante 
716   // Now we place bottom PCB, honeycomb, top PCB in this volume. We donot place
717   // unnecessary air volumes now. Just leave the gap as we are placing them
718   // in  air only. This also reduces the number of volumes for geant to track.
719
720 // Tree structure for different volumes
721 //
722 //                              EUM2
723 //                               |
724 //                      --------------------
725 //                      |        |         |
726 //                    EBPB      ESSB      EBKB
727 //                               |
728 //                              EDGB
729 //                               |
730 //                              ECGB
731 //                               |
732 //                      --------------------
733 //                      |        |         |
734 //                    EPCB(1)   EHC2     EPCB(2)
735 //                   (bottom)    |      (top PCB)
736 //                               |
737 //                          Sensitive volume
738 //                              (gas)
739 //      
740
741 //PRESHOWER
742 //Creating the side channels
743 // SS boundary channel, followed by G10 and Air Gap  
744   gMC->Gspos("EDGB", 1, "ESSB", 0., 0., 0., 0, "ONLY");
745   gMC->Gspos("ECGB", 1, "EDGB", 0., 0., 0., 0, "ONLY");
746   //VETO
747   gMC->Gspos("EDVB", 1, "ESVB", 0., 0., 0., 0, "ONLY");
748   gMC->Gspos("ECVB", 1, "EDVB", 0., 0., 0., 0, "ONLY");
749
750  // now other components, using Bedang's code, but changing the values.
751   //Positioning Bottom PCB, Honey Comb abd Top PCB in AIR
752
753   //VETO
754   //Positioning the Bottom 0.16 cm PCB
755   Float_t zbpcb2 = -dboxAir3B[2] + (2.0*fgkGap) + fgkThPCB/2.;
756   gMC->Gspos("EPCB", 1, "ECVB", 0., 0., zbpcb2, 0, "ONLY");
757   //Positioning the Honey Comb 0.5 cm
758   Float_t zhc2 = zbpcb2 + fgkThPCB/2. + fgkCellDepth/2.;
759   gMC->Gspos("EHC2", 1, "ECVB", 0., 0., zhc2, 0, "ONLY");
760   //Positioning the Top PCB 0.16 cm
761   Float_t ztpcb2 = zhc2 + fgkCellDepth/2 + fgkThPCB/2.;
762   gMC->Gspos("EPCB", 2, "ECVB", 0., 0., ztpcb2, 0, "ONLY");
763
764   //PRESHOWER
765   //For preshower plane the ordering is reversed
766   //Positioning the Bottom 0.16 cm PCB
767   zbpcb2 = -dboxAir3B[2] + fgkThPCB + fgkThPCB/2.;
768   gMC->Gspos("EPCB", 1, "ECGB", 0., 0., zbpcb2, 0, "ONLY");
769   //Positioning the Honey Comb 0.5 cm
770   zhc2 = zbpcb2 + fgkThPCB/2. + fgkCellDepth/2.;
771   gMC->Gspos("EHC2", 1, "ECGB", 0., 0., zhc2, 0, "ONLY");
772   //Positioning the Top PCB 0.16 cm
773   ztpcb2 = zhc2 + fgkCellDepth/2 + fgkThPCB/2.;
774   gMC->Gspos("EPCB", 2, "ECGB", 0., 0., ztpcb2, 0, "ONLY");
775
776
777
778  //--------------Now let us construct final UM ---------------//
779   // We will do it as follows :
780   // (i)  First make a UM of air. which will have dimensions
781   //      of the SS boundary Channel (in x,y) and of height 13.3mm
782   //(ii)  Then we will place all the components
783
784   //----------------------------------------------------------//
785   // A  unit module type B of Air
786   // Dimensions of Unit Module same as SS boundary channel
787   Float_t fDboxum2[3];
788   fDboxum2[0] = fDboxss2[0];
789   fDboxum2[1] = fDboxss2[1];
790   fDboxum2[2] = fgkThSS/2. +0.15; // 0.15 added to accomodate Base Plate at
791   // the bottom and the backplane PCB at the top.
792
793   //PRESHOWER
794   //Create a Unit module of above dimensions Material : AIR
795   gMC->Gsvolu("EUM2","BOX", idtmed[698], fDboxum2, 3);
796   gMC->Gsatt("EUM2", "SEEN", 0);
797
798   //VETO
799   gMC->Gsvolu("EUV2","BOX", idtmed[698], fDboxum2, 3);
800   gMC->Gsatt("EUV2", "SEEN", 0);
801   //----------------------------------------------------------------//
802
803   //BASE PLATE : EBPB
804   //==================
805   // Make a 2mm thick G10 Base plate for Unit module B
806   // Base plate is as big as the final UM dimensions that is as 
807   // SS boundary channel
808   Float_t dboxBaseB[3];
809   dboxBaseB[0]       = fDboxss2[0];
810   dboxBaseB[1]       = fDboxss2[1];       
811   dboxBaseB[2]       = fgkThBase/2.;
812   
813   //Base Blate is a G10 BOX
814   gMC->Gsvolu("EBPB","BOX", idtmed[607], dboxBaseB, 3);
815   gMC->Gsatt("EBPB", "SEEN", 0);
816   //----------------------------------------------------//  
817
818   //VETO
819   //- Placing of all components of UM in AIR BOX EUM2--//
820   //(1)   FIRST PUT THE BASE PLATE
821   Float_t zbaseplate2 = -fDboxum2[2] + fgkThBase/2.;
822   gMC->Gspos("EBPB", 1, "EUV2", 0., 0., zbaseplate2, 0, "ONLY");
823
824   //(2)   NEXT PLACING the SS BOX 
825   Float_t zss2 = zbaseplate2 + fgkThBase/2. + fgkThSS/2.;
826   gMC->Gspos("ESVB", 1, "EUV2", 0., 0., zss2, 0, "ONLY");
827   
828   // (3) Positioning the Backplane PCB 0.1 cm
829   Float_t zbkp2 = zss2 + fgkThSS/2. + fgkThBKP/2.;
830   gMC->Gspos("EBKB", 1, "EUV2", 0., 0., zbkp2, 0, "ONLY");
831
832
833
834   //FOR PRESHOWER
835   // (3) Positioning the Backplane PCB 0.1 cm
836   zbkp2 = -fDboxum2[2] + fgkThBKP/2.;
837   gMC->Gspos("EBKB", 1, "EUM2", 0., 0., zbkp2, 0, "ONLY");
838
839   //(2)   NEXT PLACING the SS BOX 
840   zss2 = zbkp2 + fgkThBKP/2. + fgkThSS/2.;
841   gMC->Gspos("ESSB", 1, "EUM2", 0., 0., zss2, 0, "ONLY");
842   
843   //(1)   FIRST PUT THE BASE PLATE
844   zbaseplate2 = zss2 + fgkThSS/2 + fgkThBase/2.;
845   gMC->Gspos("EBPB", 1, "EUM2", 0., 0., zbaseplate2, 0, "ONLY");
846   //-------------------- UM Type B completed ------------------------//
847
848
849   //--- Now we need to make Lead plates of UM dimension -----//
850
851   /**************************/
852   //----------------------------------------------------------//
853   // The lead convertor is of unit module size
854   // Dimensions of Unit Module same as SS boundary channel
855
856   Float_t dboxPba[3];
857   dboxPba[0] = fDboxum1[0];
858   dboxPba[1] = fDboxum1[1];
859   dboxPba[2] = fgkThLead/2.;
860   // Lead of UM dimension
861   gMC->Gsvolu("EPB1","BOX", idtmed[600], dboxPba, 3);
862   gMC->Gsatt ("EPB1", "SEEN", 0);
863
864   Float_t dboxPbb[3];
865   dboxPbb[0] = fDboxum2[0];
866   dboxPbb[1] = fDboxum2[1];
867   dboxPbb[2] = fgkThLead/2.;
868   // Lead of UM dimension
869   gMC->Gsvolu("EPB2","BOX", idtmed[600], dboxPbb, 3);
870   gMC->Gsatt ("EPB2", "SEEN", 0);
871
872   //----------------------------------------------------------------//
873
874   // 2 types of Rectangular shaped supermodules (BOX) 
875   //each with 6 unit modules 
876   
877   // volume for SUPERMODULE ESMA 
878   //Space added to provide a gapping for HV between UM's
879   //There is a gap of 0.15 cm between two Modules (UMs)
880   // in x-direction and 0.1cm along y-direction
881
882   Float_t dboxSM1[3];
883   dboxSM1[0] = 3.0*fDboxum1[0] + (2.0*0.075);
884   dboxSM1[1] = 2.0*fDboxum1[1] +  0.05;
885   dboxSM1[2] = fDboxum1[2];
886
887   //FOR PRESHOWER  
888   gMC->Gsvolu("ESMA","BOX", idtmed[698], dboxSM1, 3);
889   gMC->Gsatt("ESMA", "SEEN", 0);
890   
891   //FOR VETO
892   gMC->Gsvolu("EMVA","BOX", idtmed[698], dboxSM1, 3);
893   gMC->Gsatt("EMVA", "SEEN", 0);
894
895   //Position the 6 unit modules in EMSA
896   Float_t xa1,xa2,xa3,ya1,ya2; 
897   xa1 =  dboxSM1[0] - fDboxum1[0];
898   xa2 = xa1 - fDboxum1[0] - 0.15 - fDboxum1[0];
899   xa3 = xa2 - fDboxum1[0] - 0.15 - fDboxum1[0];
900   ya1 = dboxSM1[1]  - fDboxum1[1];
901   ya2 = ya1 - fDboxum1[1] - 0.1 - fDboxum1[1];
902
903   //PRESHOWER
904   gMC->Gspos("EUM1", 1, "ESMA", xa1, ya1, 0., 0, "ONLY");
905   gMC->Gspos("EUM1", 2, "ESMA", xa2, ya1, 0., 0, "ONLY");
906   gMC->Gspos("EUM1", 3, "ESMA", xa3, ya1, 0., 0, "ONLY");
907   gMC->Gspos("EUM1", 4, "ESMA", xa1, ya2, 0., 0, "ONLY");
908   gMC->Gspos("EUM1", 5, "ESMA", xa2, ya2, 0., 0, "ONLY");
909   gMC->Gspos("EUM1", 6, "ESMA", xa3, ya2, 0., 0, "ONLY");
910
911   //VETO
912   gMC->Gspos("EUV1", 1, "EMVA", xa1, ya1, 0., 0, "ONLY");
913   gMC->Gspos("EUV1", 2, "EMVA", xa2, ya1, 0., 0, "ONLY");
914   gMC->Gspos("EUV1", 3, "EMVA", xa3, ya1, 0., 0, "ONLY");
915   gMC->Gspos("EUV1", 4, "EMVA", xa1, ya2, 0., 0, "ONLY");
916   gMC->Gspos("EUV1", 5, "EMVA", xa2, ya2, 0., 0, "ONLY");
917   gMC->Gspos("EUV1", 6, "EMVA", xa3, ya2, 0., 0, "ONLY");
918
919
920   // volume for SUPERMODULE ESMB 
921   //Space is added to provide a gapping for HV between UM's
922   Float_t dboxSM2[3];
923   dboxSM2[0] = 2.0*fDboxum2[0] + 0.075; 
924   dboxSM2[1] = 3.0*fDboxum2[1] + (2.0*0.05);
925   dboxSM2[2] = fDboxum2[2];
926   
927   //PRESHOWER
928   gMC->Gsvolu("ESMB","BOX", idtmed[698], dboxSM2, 3);
929   gMC->Gsatt("ESMB", "SEEN", 0);
930   //VETO 
931   gMC->Gsvolu("EMVB","BOX", idtmed[698], dboxSM2, 3);
932   gMC->Gsatt("EMVB", "SEEN", 0);
933
934   //Position the 6 unit modules in EMSB
935   Float_t xb1,xb2,yb1,yb2,yb3; 
936   xb1 = dboxSM2[0] - fDboxum2[0];
937   xb2 = xb1 - fDboxum2[0] - 0.15 - fDboxum2[0];
938   yb1 = dboxSM2[1]-fDboxum2[1];
939   yb2 = yb1 - fDboxum2[1] - 0.1 -  fDboxum2[1];
940   yb3 = yb2 - fDboxum2[1] - 0.1 -  fDboxum2[1];
941
942
943   //PRESHOWER  
944   gMC->Gspos("EUM2", 1, "ESMB", xb1, yb1, 0., 0, "ONLY");
945   gMC->Gspos("EUM2", 2, "ESMB", xb2, yb1, 0., 0, "ONLY");
946   gMC->Gspos("EUM2", 3, "ESMB", xb1, yb2, 0., 0, "ONLY");
947   gMC->Gspos("EUM2", 4, "ESMB", xb2, yb2, 0., 0, "ONLY");
948   gMC->Gspos("EUM2", 5, "ESMB", xb1, yb3, 0., 0, "ONLY");
949   gMC->Gspos("EUM2", 6, "ESMB", xb2, yb3, 0., 0, "ONLY");
950   
951   //VETO
952   gMC->Gspos("EUV2", 1, "EMVB", xb1, yb1, 0., 0, "ONLY");
953   gMC->Gspos("EUV2", 2, "EMVB", xb2, yb1, 0., 0, "ONLY");
954   gMC->Gspos("EUV2", 3, "EMVB", xb1, yb2, 0., 0, "ONLY");
955   gMC->Gspos("EUV2", 4, "EMVB", xb2, yb2, 0., 0, "ONLY");
956   gMC->Gspos("EUV2", 5, "EMVB", xb1, yb3, 0., 0, "ONLY");
957   gMC->Gspos("EUV2", 6, "EMVB", xb2, yb3, 0., 0, "ONLY");
958   
959   // Make smiliar stucture for lead as for PMD plane
960   //================================================
961
962   // 2 types of Rectangular shaped supermodules (BOX) 
963   //each with 6 unit modules 
964   
965   // volume for SUPERMODULE ESMPbA 
966   //Space added to provide a gapping for HV between UM's
967
968   Float_t dboxSMPb1[3];
969   dboxSMPb1[0] = 3.0*fDboxum1[0] + (2.0*0.075);
970   dboxSMPb1[1] = 2.0*fDboxum1[1] +  0.05;
971   dboxSMPb1[2] = fgkThLead/2.;
972   
973   gMC->Gsvolu("ESPA","BOX", idtmed[698], dboxSMPb1, 3);
974   gMC->Gsatt("ESPA", "SEEN", 0);
975   
976
977   //Position the 6 unit modules in ESMPbA
978   Float_t xpa1,xpa2,xpa3,ypa1,ypa2; 
979   xpa1 = -dboxSMPb1[0] + fDboxum1[0];
980   xpa2 = xpa1 + fDboxum1[0] + 0.15 + fDboxum1[0];
981   xpa3 = xpa2 + fDboxum1[0] + 0.15 + fDboxum1[0];
982   ypa1 = dboxSMPb1[1]  - fDboxum1[1];
983   ypa2 = ypa1 - fDboxum1[1] - 0.1 - fDboxum1[1];
984
985
986   gMC->Gspos("EPB1", 1, "ESPA", xpa1, ypa1, 0., 0, "ONLY");
987   gMC->Gspos("EPB1", 2, "ESPA", xpa2, ypa1, 0., 0, "ONLY");
988   gMC->Gspos("EPB1", 3, "ESPA", xpa3, ypa1, 0., 0, "ONLY");
989   gMC->Gspos("EPB1", 4, "ESPA", xpa1, ypa2, 0., 0, "ONLY");
990   gMC->Gspos("EPB1", 5, "ESPA", xpa2, ypa2, 0., 0, "ONLY");
991   gMC->Gspos("EPB1", 6, "ESPA", xpa3, ypa2, 0., 0, "ONLY");
992
993
994   // volume for SUPERMODULE ESMPbB 
995   //Space is added to provide a gapping for HV between UM's
996   Float_t dboxSMPb2[3];
997   dboxSMPb2[0] = 2.0*fDboxum2[0] + 0.075;
998   dboxSMPb2[1] = 3.0*fDboxum2[1] + (2.0*0.05);
999   dboxSMPb2[2] = fgkThLead/2.;
1000
1001   gMC->Gsvolu("ESPB","BOX", idtmed[698], dboxSMPb2, 3);
1002   gMC->Gsatt("ESPB", "SEEN", 0);
1003  
1004   //Position the 6 unit modules in ESMPbB
1005   Float_t xpb1,xpb2,ypb1,ypb2,ypb3; 
1006   xpb1 = -dboxSMPb2[0] + fDboxum2[0];
1007   xpb2 = xpb1 + fDboxum2[0] + 0.15 + fDboxum2[0];
1008   ypb1 = dboxSMPb2[1]  - fDboxum2[1];
1009   ypb2 = ypb1 - fDboxum2[1] - 0.1 -  fDboxum2[1];
1010   ypb3 = ypb2 - fDboxum2[1] - 0.1 -  fDboxum2[1];
1011
1012
1013   gMC->Gspos("EPB2", 1, "ESPB", xpb1, ypb1, 0., 0, "ONLY");
1014   gMC->Gspos("EPB2", 2, "ESPB", xpb2, ypb1, 0., 0, "ONLY");
1015   gMC->Gspos("EPB2", 3, "ESPB", xpb1, ypb2, 0., 0, "ONLY");
1016   gMC->Gspos("EPB2", 4, "ESPB", xpb2, ypb2, 0., 0, "ONLY");
1017   gMC->Gspos("EPB2", 5, "ESPB", xpb1, ypb3, 0., 0, "ONLY");
1018   gMC->Gspos("EPB2", 6, "ESPB", xpb2, ypb3, 0., 0, "ONLY");
1019
1020
1021   //---------------------------------------------------
1022   /// ALICE PMD FEE BOARDS IMPLEMENTATION
1023   // Dt: 25th February 2006 
1024   // - M.M.  Mondal, S.K. Prasad and P.K. Netrakanti
1025   //---------------------------------------------------
1026
1027   //FEE boards 
1028   // It is FR4 board of length 7cm
1029   // breadth of 2.4 cm and thickness 0.1cm
1030   Float_t dboxFEE[3];
1031   dboxFEE[0] = 0.05;
1032   dboxFEE[1] = 3.50;
1033   dboxFEE[2] = 1.20;
1034
1035   gMC->Gsvolu("EFEE","BOX", idtmed[607], dboxFEE, 3);
1036   gMC->Gsatt("EFEE", "SEEN", 0);
1037   gMC->Gsatt("EFEE", "COLO", 4);
1038
1039   //Mother volume to accomodate FEE boards
1040   // It should have the dimension 
1041   // as the back plane or the 
1042   //corresponding UM
1043   //TYPE A
1044   //------------------------------------------------------//
1045
1046   Float_t dboxFEEBPlaneA[3];
1047   dboxFEEBPlaneA[0]   = dboxBPlaneA[0]; //dbox3[0]; 
1048   dboxFEEBPlaneA[1]   = dboxBPlaneA[1];//dbox3[1];       
1049   dboxFEEBPlaneA[2]   = 1.2;
1050   
1051   //Volume of same dimension as Back PLane of Material AIR
1052   gMC->Gsvolu("EFBA","BOX", idtmed[698], dboxFEEBPlaneA, 3);
1053   gMC->Gsatt("EFBA", "SEEN", 0);
1054
1055   //TYPE B
1056   Float_t dboxFEEBPlaneB[3];
1057   dboxFEEBPlaneB[0]   = dboxBPlaneB[0]; //dbox4[0]; 
1058   dboxFEEBPlaneB[1]   = dboxBPlaneB[1];//dbox4[1];       
1059   dboxFEEBPlaneB[2]   = 1.2;
1060   
1061   //Back PLane PCB of MAterial G10
1062   gMC->Gsvolu("EFBB","BOX", idtmed[698], dboxFEEBPlaneB, 3);
1063   gMC->Gsatt("EFBB", "SEEN", 0);
1064
1065   //Placing the FEE boards in the Mother volume of AIR
1066
1067   //Type A 
1068
1069   Float_t x_fee; // X-position of FEE board
1070   Float_t y_fee; // Y-position of FEE board
1071   Float_t z_fee = 0.0; // Z-position of FEE board
1072
1073   Float_t x_a    = 0.25; //distance from the border to 1st FEE board
1074   Float_t y_a    = 4.00; //distance from the border to 1st FEE board
1075   Float_t x_sepa = 1.70; //Distance between two FEE boards
1076   Float_t y_sepa = 8.00; //Distance between two FEE boards
1077
1078   
1079   // FEE Boards EFEE placed inside EFBA
1080   number = 1;
1081   y_fee =  dboxFEEBPlaneA[1] - y_a;  
1082   for (i = 1; i <= 6; ++i) 
1083     {
1084       x_fee = -dboxFEEBPlaneA[0] + x_a; 
1085       for (j = 1; j <= 12; ++j) 
1086         {
1087           gMC->Gspos("EFEE", number, "EFBA", x_fee,y_fee,z_fee, 0, "ONLY");
1088           x_fee += x_sepa;
1089           number += 1;
1090         }
1091       y_fee -= y_sepa; 
1092     }
1093   // FEE Boards EFEE placed inside EFBB
1094   number = 1;
1095   y_fee =  dboxFEEBPlaneB[1] - y_a;  
1096   for (i = 1; i <= 3; ++i) 
1097     {
1098       x_fee = -dboxFEEBPlaneB[0] + x_a; 
1099       for (j = 1; j <= 24; ++j) 
1100         {
1101           gMC->Gspos("EFEE", number, "EFBB", x_fee,y_fee,z_fee, 0, "ONLY");
1102           x_fee += x_sepa;
1103           number += 1;
1104         }
1105       y_fee -= y_sepa; 
1106     }
1107
1108
1109   //Distance between the two backplanes of two UMs
1110   //in x-direction is 0.92 and ydirection is 0.95
1111   Float_t dboxEFSA[3];
1112   dboxEFSA[0] = 3.0*dboxFEEBPlaneA[0] + 0.92;
1113   dboxEFSA[1] = 2.0*dboxFEEBPlaneA[1] + (0.95/2.0);
1114   dboxEFSA[2] = dboxFEEBPlaneA[2];
1115
1116   //Type A
1117   gMC->Gsvolu("EFSA","BOX", idtmed[698],dboxEFSA, 3);
1118   gMC->Gsatt("EFSA", "SEEN", 0);
1119
1120   //Distance between the two backplanes of two UMs
1121   //in x-direction is 0.92 and ydirection is 0.95
1122   Float_t dboxEFSB[3];
1123   dboxEFSB[0] = 2.0*dboxFEEBPlaneB[0] + (0.938/2.0);
1124   dboxEFSB[1] = 3.0*dboxFEEBPlaneB[1] + 1.05;
1125   dboxEFSB[2] = dboxFEEBPlaneB[2];
1126
1127   //Type A
1128   gMC->Gsvolu("EFSB","BOX", idtmed[698],dboxEFSB, 3);
1129   gMC->Gsatt("EFSB", "SEEN", 0);
1130
1131
1132   Float_t xfs1,xfs2,xfs3,yfs1,yfs2,yfs3; 
1133   xfs1 = -dboxEFSA[0] + dboxFEEBPlaneA[0];
1134   xfs2 = xfs1 + dboxFEEBPlaneA[0] +  0.92 + dboxFEEBPlaneA[0];
1135   xfs3 = xfs2 + dboxFEEBPlaneA[0] +  0.92 + dboxFEEBPlaneA[0];
1136   yfs1 = dboxEFSA[1] - dboxFEEBPlaneA[1];
1137   yfs2 = yfs1 - dboxFEEBPlaneA[1] - 0.95 - dboxFEEBPlaneA[1];
1138
1139
1140
1141   gMC->Gspos("EFBA", 1, "EFSA", xfs1, yfs1, 0., 0, "ONLY");
1142   gMC->Gspos("EFBA", 2, "EFSA", xfs2, yfs1, 0., 0, "ONLY");
1143   gMC->Gspos("EFBA", 3, "EFSA", xfs3, yfs1, 0., 0, "ONLY");
1144   gMC->Gspos("EFBA", 4, "EFSA", xfs1, yfs2, 0., 0, "ONLY");
1145   gMC->Gspos("EFBA", 5, "EFSA", xfs2, yfs2, 0., 0, "ONLY");
1146   gMC->Gspos("EFBA", 6, "EFSA", xfs3, yfs2, 0., 0, "ONLY");
1147
1148
1149   //Type B positioning
1150
1151   xfs1 = -dboxEFSB[0] + dboxFEEBPlaneB[0];
1152   xfs2 = xfs1 + dboxFEEBPlaneB[0] + 0.938 + dboxFEEBPlaneB[0];
1153   yfs1 = dboxEFSB[1] - dboxFEEBPlaneB[1];
1154   yfs2 = yfs1 - dboxFEEBPlaneB[1] - 1.05 - dboxFEEBPlaneB[1];
1155   yfs3 = yfs2 - dboxFEEBPlaneB[1] - 1.05 - dboxFEEBPlaneB[1];
1156
1157
1158
1159   gMC->Gspos("EFBB", 1, "EFSB", xfs1, yfs1, 0., 0, "ONLY");
1160   gMC->Gspos("EFBB", 2, "EFSB", xfs2, yfs1, 0., 0, "ONLY");
1161   gMC->Gspos("EFBB", 3, "EFSB", xfs1, yfs2, 0., 0, "ONLY");
1162   gMC->Gspos("EFBB", 4, "EFSB", xfs2, yfs2, 0., 0, "ONLY");
1163   gMC->Gspos("EFBB", 5, "EFSB", xfs1, yfs3, 0., 0, "ONLY");
1164   gMC->Gspos("EFBB", 6, "EFSB", xfs2, yfs3, 0., 0, "ONLY");
1165
1166
1167 }
1168  
1169 //_____________________________________________________________________________
1170
1171 void AliPMDv1::CreatePMD()
1172 {
1173   //
1174   // Create final detector from supermodules
1175   // -- Author : Bedanga and Viyogi June 2003
1176
1177   Float_t   zp;
1178   Int_t jhrot12,jhrot13, irotdm;
1179   Int_t *idtmed = fIdtmed->GetArray()-599;
1180   
1181   //VOLUMES Names : begining with "E" for all PMD volumes, 
1182
1183   // --- DEFINE Iron volumes  for SM A
1184   //   Fe Support 
1185   Float_t dboxFea[3];
1186   dboxFea[0] = fSMLengthax;
1187   dboxFea[1] = fSMLengthay;
1188   dboxFea[2] = fgkThSteel/2.;
1189   
1190   gMC->Gsvolu("EFEA","BOX", idtmed[618], dboxFea, 3);
1191   gMC->Gsatt ("EFEA", "SEEN", 0);
1192
1193   // --- DEFINE Iron volumes  for SM B
1194   
1195   //   Fe Support 
1196   Float_t dboxFeb[3];
1197   dboxFeb[0] = fSMLengthbx;
1198   dboxFeb[1] = fSMLengthby;
1199   dboxFeb[2] = fgkThSteel/2.;
1200   
1201   gMC->Gsvolu("EFEB","BOX", idtmed[618], dboxFeb, 3);
1202   gMC->Gsatt ("EFEB", "SEEN", 0);
1203
1204   AliMatrix(irotdm, 90., 0.,  90.,  90., 180., 0.);
1205   AliMatrix(jhrot12, 90., 180., 90., 270., 0., 0.);
1206   AliMatrix(jhrot13, 90., 240., 90., 330., 0., 0.);
1207
1208   // Gaspmd, the dimension of RECTANGULAR mother volume of PMD,
1209   // Four mother volumes EPM1,EPM2 for A-type and 
1210   // volumes EPM3 and EPM4 for B-type. Four to create a hole
1211   // and avoid overlap with beam pipe
1212
1213   Float_t gaspmd[3];
1214   gaspmd[0] = fSMLengthax;
1215   gaspmd[1] = fSMLengthay;
1216   gaspmd[2] = fSMthick;
1217
1218   gMC->Gsvolu("EPM1", "BOX", idtmed[698], gaspmd, 3);
1219   gMC->Gsatt("EPM1", "SEEN", 1);
1220   gMC->Gsvolu("EPM2", "BOX", idtmed[698], gaspmd, 3);
1221   gMC->Gsatt("EPM2", "SEEN", 1);
1222
1223   //Complete detector for Type A
1224   //Position Super modules type A for both CPV and PMD in EPMD  
1225   Float_t zpsa,zpba,zfea,zcva,zfee; 
1226
1227   // zpsa = - gaspmd[2] + fSMthick/2.;
1228   // -2.5 is given to place PMD at -361.5 
1229   // BM : In future after putting proper electronics
1230   // -2.5 will be replaced by -gaspmd[2]
1231
1232   //TYPE A
1233   //Fee board
1234   zfee=-gaspmd[2] + 1.2;
1235   gMC->Gspos("EFSA", 1, "EPM1", 0., 0., zfee, 0, "ONLY");
1236   gMC->Gspos("EFSA", 2, "EPM2", 0., 0., zfee, jhrot12, "ONLY");
1237   //VETO
1238   zcva = zfee + 1.2 + fDthick;
1239   gMC->Gspos("EMVA", 1, "EPM1", 0., 0., zcva, 0, "ONLY");
1240   gMC->Gspos("EMVA", 2, "EPM2", 0., 0., zcva, jhrot12, "ONLY");
1241   //Iron support
1242   zfea = zcva + fDthick + fgkThSteel/2.;
1243   gMC->Gspos("EFEA", 1, "EPM1", 0., 0., zfea, 0, "ONLY");
1244   gMC->Gspos("EFEA", 2, "EPM2", 0., 0., zfea, 0, "ONLY");
1245   //Lead
1246   zpba=zfea+fgkThSteel/2.+ fgkThLead/2.;
1247   gMC->Gspos("ESPA", 1, "EPM1", 0., 0., zpba, 0, "ONLY");
1248   gMC->Gspos("ESPA", 2, "EPM2", 0., 0., zpba, 0, "ONLY");
1249   //Preshower
1250   zpsa = zpba + fgkThLead/2. + fDthick;
1251   gMC->Gspos("ESMA", 1, "EPM1", 0., 0., zpsa, 0, "ONLY");
1252   gMC->Gspos("ESMA", 2, "EPM2", 0., 0., zpsa, jhrot12, "ONLY");
1253   //FEE boards
1254   zfee=zpsa + fDthick + 1.2;
1255   gMC->Gspos("EFSA", 3, "EPM1", 0., 0., zfee, 0, "ONLY");
1256   gMC->Gspos("EFSA", 4, "EPM2", 0., 0., zfee, jhrot12, "ONLY");
1257
1258  
1259   //TYPE - B
1260   gaspmd[0] = fSMLengthbx; 
1261   gaspmd[1] = fSMLengthby; 
1262   gaspmd[2] = fSMthick; 
1263
1264   gMC->Gsvolu("EPM3", "BOX", idtmed[698], gaspmd, 3);
1265   gMC->Gsatt("EPM3", "SEEN", 1);
1266   gMC->Gsvolu("EPM4", "BOX", idtmed[698], gaspmd, 3);
1267   gMC->Gsatt("EPM4", "SEEN", 1);
1268
1269   //Complete detector for Type B
1270   //Position Super modules type B for both CPV and PMD in EPMD  
1271   Float_t zpsb,zpbb,zfeb,zcvb; 
1272   // zpsb = - gaspmd[2] + fSMthick/2.;
1273   // -2.5 is given to place PMD at -361.5 
1274   // BM: In future after putting proper electronics
1275   // -2.5 will be replaced by -gaspmd[2]
1276
1277  //Fee board
1278   zfee=-gaspmd[2] + 1.2;
1279   gMC->Gspos("EFSB", 5, "EPM3", 0., 0., zfee, 0, "ONLY");
1280   gMC->Gspos("EFSB", 6, "EPM4", 0., 0., zfee, jhrot12, "ONLY");
1281   //VETO
1282   zcvb= zfee + 1.2 + fDthick;
1283   gMC->Gspos("EMVB", 3, "EPM3", 0., 0., zcvb, 0, "ONLY");
1284   gMC->Gspos("EMVB", 4, "EPM4", 0., 0., zcvb, jhrot12, "ONLY");
1285
1286   //IRON SUPPORT
1287   zfeb= zcvb + fDthick +  fgkThSteel/2.;
1288   gMC->Gspos("EFEB", 3, "EPM3", 0., 0., zfeb, 0, "ONLY");
1289   gMC->Gspos("EFEB", 4, "EPM4", 0., 0., zfeb, 0, "ONLY");
1290   //LEAD
1291   zpbb= zfeb + fgkThSteel/2.+ fgkThLead/2.;
1292   gMC->Gspos("ESPB", 3, "EPM3", 0., 0., zpbb, 0, "ONLY");
1293   gMC->Gspos("ESPB", 4, "EPM4", 0., 0., zpbb, 0, "ONLY");
1294   //PRESHOWER
1295   zpsb = zpbb + fgkThLead/2.+ fDthick;
1296   gMC->Gspos("ESMB", 3, "EPM3", 0., 0., zpsb, 0, "ONLY");
1297   gMC->Gspos("ESMB", 4, "EPM4", 0., 0., zpsb, jhrot12, "ONLY");
1298   //FEE boards
1299   zfee=zpsb + fDthick + 1.2;
1300   gMC->Gspos("EFSB", 7, "EPM3", 0., 0., zfee, 0, "ONLY");
1301   gMC->Gspos("EFSB", 8, "EPM4", 0., 0., zfee, jhrot12, "ONLY");
1302
1303
1304   // --- Place the EPMD in ALICE 
1305   //Z-distance of PMD from Interaction Point
1306   zp = fgkZdist;
1307
1308   //X and Y-positions of the PMD planes
1309   Float_t xfinal,yfinal; 
1310   Float_t xsmb,ysmb;
1311   Float_t xsma,ysma;
1312
1313   xfinal = fSMLengthax + 0.48/2 + fSMLengthbx;
1314   yfinal = fSMLengthay + 0.20/2 + fSMLengthby;
1315   
1316
1317   xsma =  xfinal  - fSMLengthax;
1318   ysma =  yfinal  - fSMLengthay;
1319   xsmb =  -xfinal + fSMLengthbx;
1320   ysmb =  yfinal  - fSMLengthby;
1321
1322
1323 //Position Full PMD in ALICE   
1324 //
1325 //   EPM1      EPM3
1326 //
1327 //   EPM4      EPM2
1328 // (rotated   (rotated EPM1)
1329 //  EPM3)
1330 //
1331   gMC->Gspos("EPM1", 1, "ALIC",  xsma,ysma,zp,  0, "ONLY");
1332   gMC->Gspos("EPM2", 1, "ALIC", -xsma,-ysma,zp, 0, "ONLY");
1333   gMC->Gspos("EPM3", 1, "ALIC",  xsmb,ysmb,zp,  0, "ONLY");
1334   gMC->Gspos("EPM4", 1, "ALIC", -xsmb,-ysmb,zp, 0, "ONLY");
1335 }
1336
1337  
1338 //_____________________________________________________________________________
1339 void AliPMDv1::DrawModule() const
1340 {
1341   // Draw a shaded view of the Photon Multiplicity Detector
1342   //
1343   //  cout << " Inside Draw Modules " << endl;
1344
1345   gMC->Gsatt("*", "seen", -1);
1346   gMC->Gsatt("alic", "seen", 0);
1347   //
1348   // Set the visibility of the components
1349   // 
1350   gMC->Gsatt("ECAR","seen",0);
1351   gMC->Gsatt("ECCU","seen",1);
1352   gMC->Gsatt("EST1","seen",1);
1353   gMC->Gsatt("EST2","seen",1);
1354   gMC->Gsatt("EUM1","seen",1);
1355   gMC->Gsatt("EUM2","seen",1);
1356   gMC->Gsatt("ESMA","seen",1);
1357   gMC->Gsatt("EPMD","seen",1);
1358   //
1359   gMC->Gdopt("hide", "on");
1360   gMC->Gdopt("shad", "on");
1361   gMC->Gsatt("*", "fill", 7);
1362   gMC->SetClipBox(".");
1363   gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
1364   gMC->DefaultRange();
1365   gMC->Gdraw("alic", 40, 30, 0, 22, 20.5, .02, .02);
1366   gMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
1367
1368   //gMC->Gdman(17, 5, "MAN");
1369   gMC->Gdopt("hide", "off");
1370
1371   AliDebug(1,"Outside Draw Modules");
1372 }
1373
1374 //_____________________________________________________________________________
1375 void AliPMDv1::CreateMaterials()
1376 {
1377   // Create materials for the PMD
1378   //
1379   // ORIGIN    : Y. P. VIYOGI 
1380   //
1381   //  cout << " Inside create materials " << endl;
1382
1383   Int_t *idtmed = fIdtmed->GetArray()-599;
1384   Int_t isxfld = gAlice->Field()->Integ();
1385   Float_t sxmgmx = gAlice->Field()->Max();
1386   
1387   // --- Define the various materials for GEANT --- 
1388
1389   AliMaterial(1, "Pb    $", 207.19, 82., 11.35, .56, 18.5);
1390   
1391   // Argon
1392
1393   Float_t dAr   = 0.001782;   // --- Ar density in g/cm3 --- 
1394   Float_t x0Ar = 19.55 / dAr;
1395   AliMaterial(2, "Argon$", 39.95, 18., dAr, x0Ar, 6.5e4);
1396
1397   // --- CO2 --- 
1398
1399   Float_t aCO2[2] = { 12.,16. };
1400   Float_t zCO2[2] = { 6.,8. };
1401   Float_t wCO2[2] = { 1.,2. };
1402   Float_t dCO2    = 0.001977;
1403   AliMixture(3, "CO2  $", aCO2, zCO2, dCO2, -2, wCO2);
1404
1405   AliMaterial(4, "Al   $", 26.98, 13., 2.7, 8.9, 18.5);
1406
1407   // ArCO2
1408
1409   Float_t aArCO2[3] = {39.948,12.0107,15.9994};
1410   Float_t zArCO2[3] = {18.,6.,8.};
1411   Float_t wArCO2[3] = {0.7,0.08,0.22};
1412   Float_t dArCO2    = dAr * 0.7 + dCO2 * 0.3;
1413   AliMixture(5, "ArCO2$", aArCO2, zArCO2, dArCO2, 3, wArCO2);
1414
1415   AliMaterial(6, "Fe   $", 55.85, 26., 7.87, 1.76, 18.5);
1416
1417   // G10
1418   
1419   Float_t aG10[4]={1.,12.011,15.9994,28.086};
1420   Float_t zG10[4]={1.,6.,8.,14.};
1421   Float_t wG10[4]={0.15201,0.10641,0.49444,0.24714};
1422   AliMixture(8,"G10",aG10,zG10,1.7,4,wG10);
1423   
1424   AliMaterial(15, "Cu   $", 63.54, 29., 8.96, 1.43, 15.);
1425
1426   // Steel
1427   Float_t aSteel[4] = { 55.847,51.9961,58.6934,28.0855 };
1428   Float_t zSteel[4] = { 26.,24.,28.,14. };
1429   Float_t wSteel[4] = { .715,.18,.1,.005 };
1430   Float_t dSteel    = 7.88;
1431   AliMixture(19, "STAINLESS STEEL$", aSteel, zSteel, dSteel, 4, wSteel); 
1432
1433   //Air
1434
1435   Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
1436   Float_t zAir[4]={6.,7.,8.,18.};
1437   Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
1438   Float_t dAir1 = 1.20479E-10;
1439   Float_t dAir = 1.20479E-3;
1440   AliMixture(98, "Vacum$", aAir,  zAir, dAir1, 4, wAir);
1441   AliMixture(99, "Air  $", aAir,  zAir, dAir , 4, wAir);
1442
1443   // Define tracking media 
1444   AliMedium(1,  "Pb conv.$", 1,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
1445   AliMedium(4,  "Al      $", 4,  0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
1446   AliMedium(5,  "ArCO2   $", 5,  1, 0, isxfld, sxmgmx, .1, .1, .10, .1);
1447   AliMedium(6,  "Fe      $", 6,  0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
1448   AliMedium(8,  "G10plate$", 8,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
1449   AliMedium(15, "Cu      $", 15, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
1450   AliMedium(19, "S  steel$", 19, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
1451   AliMedium(98, "Vacuum  $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .10, 10);
1452   AliMedium(99, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .10, .1);
1453   
1454   // --- Generate explicitly delta rays in the iron, aluminium and lead --- 
1455   gMC->Gstpar(idtmed[600], "LOSS", 3.);
1456   gMC->Gstpar(idtmed[600], "DRAY", 1.);
1457   
1458   gMC->Gstpar(idtmed[603], "LOSS", 3.);
1459   gMC->Gstpar(idtmed[603], "DRAY", 1.);
1460   
1461   gMC->Gstpar(idtmed[604], "LOSS", 3.);
1462   gMC->Gstpar(idtmed[604], "DRAY", 1.);
1463   
1464   gMC->Gstpar(idtmed[605], "LOSS", 3.);
1465   gMC->Gstpar(idtmed[605], "DRAY", 1.);
1466   
1467   gMC->Gstpar(idtmed[607], "LOSS", 3.);
1468   gMC->Gstpar(idtmed[607], "DRAY", 1.);
1469   
1470   // --- Energy cut-offs in the Pb and Al to gain time in tracking --- 
1471   // --- without affecting the hit patterns --- 
1472   gMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
1473   gMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
1474   gMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
1475   gMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
1476
1477   gMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
1478   gMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
1479   gMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
1480   gMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
1481
1482   gMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
1483   gMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
1484   gMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
1485   gMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
1486 //   gMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
1487 //   gMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
1488 //   gMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
1489 //   gMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
1490   // --- Prevent particles stopping in the gas due to energy cut-off --- 
1491   gMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
1492   gMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
1493   gMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
1494   gMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
1495   gMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
1496
1497   AliDebug(1,"Outside create materials");
1498
1499 }
1500
1501 //_____________________________________________________________________________
1502 void AliPMDv1::Init()
1503 {
1504   //
1505   // Initialises PMD detector after it has been built
1506   //
1507
1508   //
1509   AliDebug(2,"Inside Init");
1510   AliDebug(2,"PMD simulation package (v1) initialised");
1511   AliDebug(2,"parameters of pmd");
1512   AliDebug(2,Form("%10.2f %10.2f %10.2f %10.2f\n",
1513                   fgkCellRadius,fgkCellWall,fgkCellDepth,fgkZdist));
1514   Int_t *idtmed = fIdtmed->GetArray()-599;
1515   fMedSens=idtmed[605-1];
1516
1517 }
1518
1519 //_____________________________________________________________________________
1520 void AliPMDv1::StepManager()
1521 {
1522   //
1523   // Called at each step in the PMD
1524   //
1525
1526   Int_t   copy;
1527   Float_t hits[4], destep;
1528   Float_t center[3] = {0,0,0};
1529   Int_t   vol[10];
1530   //  const char *namep;
1531   
1532   if(gMC->CurrentMedium() == fMedSens && (destep = gMC->Edep())) {
1533   
1534     gMC->CurrentVolID(copy);
1535     //     namep=gMC->CurrentVolName();
1536     // printf("Current vol  is %s \n",namep);
1537     vol[0]=copy;
1538
1539     gMC->CurrentVolOffID(1,copy);
1540     //namep=gMC->CurrentVolOffName(1);
1541     // printf("Current vol 11 is %s \n",namep);
1542     vol[1]=copy;
1543
1544     gMC->CurrentVolOffID(2,copy);
1545     //namep=gMC->CurrentVolOffName(2);
1546     //printf("Current vol 22 is %s \n",namep);
1547     vol[2]=copy;
1548
1549     //  if(strncmp(namep,"EHC1",4))vol[2]=1;
1550
1551     gMC->CurrentVolOffID(3,copy);
1552     // namep=gMC->CurrentVolOffName(3);
1553     //printf("Current vol 33 is %s \n",namep);
1554     vol[3]=copy;
1555
1556     gMC->CurrentVolOffID(4,copy);
1557     // namep=gMC->CurrentVolOffName(4);
1558     // printf("Current vol 44 is %s \n",namep);
1559     vol[4]=copy;
1560
1561     gMC->CurrentVolOffID(5,copy);
1562     // namep=gMC->CurrentVolOffName(5);
1563     // printf("Current vol 55 is %s \n",namep);
1564     vol[5]=copy;
1565
1566     gMC->CurrentVolOffID(6,copy);
1567     // namep=gMC->CurrentVolOffName(6);
1568     // printf("Current vol 66 is %s \n",namep);
1569     vol[6]=copy;
1570
1571     gMC->CurrentVolOffID(7,copy);
1572     //  namep=gMC->CurrentVolOffName(7);
1573     // printf("Current vol 77 is %s \n",namep);
1574     vol[7]=copy;
1575
1576     gMC->CurrentVolOffID(8,copy);
1577     // namep=gMC->CurrentVolOffName(8);
1578     // printf("Current vol 88 is %s \n",namep);
1579     vol[8]=copy;
1580
1581
1582     gMC->CurrentVolOffID(9,copy);
1583     // namep=gMC->CurrentVolOffName(9);
1584     // printf("Current vol 99 is %s \n",namep);
1585     vol[9]=copy;
1586
1587
1588     // printf("volume number %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d %10.3f \n",vol[0],vol[1],vol[2],vol[3],vol[4],vol[5],vol[6],vol[7],vol[8],vol[9],destep*1000000);
1589     
1590     gMC->Gdtom(center,hits,1);
1591     hits[3] = destep*1e9; //Number in eV
1592     AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1593
1594   }
1595 }
1596
1597   
1598 //------------------------------------------------------------------------
1599 // Get parameters
1600
1601 void AliPMDv1::GetParameters()
1602 {
1603   // This gives all the parameters of the detector
1604   // such as Length of Supermodules, type A, type B,
1605   // thickness of the Supermodule
1606   //
1607   
1608   fSMLengthax = 32.7434;
1609   //The total length in X is due to the following components
1610   // Factor 3 is because of 3 module length in X for this type
1611   // fgkNcolUM1*fgkCellRadius (48 x 0.25): Total span of each module in X
1612   // fgkCellRadius/2. : There is offset of 1/2 cell
1613   // 0.05+0.05 : Insulation gaps etc
1614   // fgkSSBoundary (0.3) : Boundary frame
1615   // double XA = 3.0*((fgkCellRadius/fgkSqroot3by2*fgkNcolUM1)-(fgkCellRadius*fgkSqroot3*(fgkNcolUM1-1)/6.)+(2.0*fgkGap)+(2.0*fgkGap)+fgkSSBoundary) + (2.0*0.075);
1616
1617   fSMLengthbx = 42.5886;
1618   //The total length in X is due to the following components
1619   // Factor 2 is because of 2 module length in X for this type
1620   // fgkNcolUM2*fgkCellRadius (96 x 0.25): Total span of each module in X
1621   // fgkCellRadius/2. : There is offset of 1/2 cell
1622   // 0.05+0.05 : Insulation gaps etc
1623   // fgkSSBoundary (0.3) : Boundary frame
1624   //double XB = 2.0*((fgkCellRadius/fgkSqroot3by2*fgkNcolUM2)-(fgkCellRadius*fgkSqroot3*(fgkNcolUM2-1)/6.)+(2.0*fgkGap)+(2.0*fgkGap)+fgkSSBoundary) + 0.075; 
1625
1626
1627
1628   fSMLengthay = 49.1;
1629   //The total length in Y is due to the following components
1630   // Factor 2 is because of 2 module length in Y for this type
1631   // fgkCellRadius/fgkSqroot3by2)*fgkNrowUM1 (0.25/sqrt3/2 * 96): Total span of each module in Y
1632   //  of strips
1633   // 0.05+0.05 : Insulation gaps etc
1634   // fgkSSBoundary (0.3) : Boundary frame
1635   // double  YA = 2.0*(fgkNrowUM1*fgkCellRadius+fgkCellRadius/2.+(2.0*fgkGap)+(2.0*fgkGap)+fgkSSBoundary) +  0.05;
1636
1637   fSMLengthby =  37.675;
1638   //The total length in Y is due to the following components
1639   // Factor 3 is because of 3 module length in Y for this type
1640   // fgkCellRadius/fgkSqroot3by2)*fgkNrowUM2 (0.25/sqrt3/2 * 48): Total span of each module in Y
1641   //  of strips
1642   // 0.05+0.05 : Insulation gaps etc
1643   // fgkSSBoundary (0.3) : Boundary frame
1644     //double YB = 3.0*((fgkNrowUM2*fgkCellRadius + fgkCellRadius/2.)+(2.0*fgkGap)+(2.0*fgkGap)+fgkSSBoundary) + (2.0*0.05);
1645
1646
1647   //Thickness of a pre/veto plane 
1648   fDthick     = fgkThSS/2. +0.15;
1649
1650   //Thickness of the PMD ; 2.4 added for FEE boards 
1651     fSMthick    = 2.0*(fgkThSS/2. +0.15)
1652                 +fgkThSteel/2.+fgkThLead/2.0 + 2.4;
1653
1654
1655   
1656 }
1657