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