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