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