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