]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMDv1.cxx
This is the new geometry at -380cm
[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
16 /*
17 $Log$
18 Revision 1.8  2000/06/09 10:31:36  hristov
19 sqrt changed to TMath::Sqrt
20
21 Revision 1.7  1999/11/03 18:01:40  fca
22 Remove non orthogonal unused matrix
23
24 Revision 1.6  1999/09/29 09:24:28  fca
25 Introduction of the Copyright and cvs Log
26
27 */
28
29 ///////////////////////////////////////////////////////////////////////////////
30 //                                                                           //
31 //  Photon Multiplicity Detector Version 1                                   //
32 //                                                                           //
33 //Begin_Html
34 /*
35 <img src="picts/AliPMDv1Class.gif">
36 */
37 //End_Html
38 //                                                                           //
39 ///////////////////////////////////////////////////////////////////////////////
40 ////
41 #include "AliPMDv1.h"
42 #include "AliRun.h"
43 #include "AliMC.h" 
44 #include "AliConst.h" 
45 #include "AliMagF.h"
46
47  
48 static Int_t maxbox, kdet;
49 static Float_t thmin,thmax,zdist,zdist1,thlow,thhigh;
50
51 ClassImp(AliPMDv1)
52  
53 //_____________________________________________________________________________
54 AliPMDv1::AliPMDv1()
55 {
56   //
57   // Default constructor 
58   //
59   fMedSens=0;
60 }
61  
62 //_____________________________________________________________________________
63 AliPMDv1::AliPMDv1(const char *name, const char *title)
64   : AliPMD(name,title)
65 {
66   //
67   // Standard constructor
68   //
69   fMedSens=0;
70 }
71 //_____________________________________________________________________________
72 void AliPMDv1::CreateGeometry()
73 {
74   //
75   // Create geometry for Photon Multiplicity Detector Version 1
76   //
77   //Begin_Html
78   /*
79     <img src="picts/AliPMDv1.gif">
80   */
81   //End_Html
82   //Begin_Html
83   /*
84     <img src="picts/AliPMDv1Tree.gif">
85   */
86   //End_Html
87   CreatePads();
88   CreateInside();
89 }
90  
91 //_____________________________________________________________________________
92 void AliPMDv1::CreateInside()
93 {
94   //
95   // Create inside of Pads
96   //
97   // -- Author :     Y.P. VIYOGI, 07/05/1996. 
98   // -- Modified:    P.V.K.S.Baba(JU), 15-12-97. 
99 // Sipmd, the dimension of TUBE mother volume of PMD, other dimensions
100 // like sip01.. are to place more tubes in the volume at different eta bins.  
101   
102 //  Float_t sipmd[3] = { 40.,270.,15.};
103 // ORG  Float_t sipmd[3] = { 0.,130.,15.};
104   Float_t sipmd[3] = { 0.,150.,15.};
105
106   //  Float_t sip01[3] = { 10.,57.89,25.};
107   //Float_t sip02[3] = { 10.,64.03,25.};
108   //Float_t sip03[3] = { 10.,70.80,25.};
109   //Float_t sip04[3] = { 10.,78.32,25.};
110   //Float_t sip05[3] = { 10.,86.68,25.};
111   //Float_t sip06[3] = { 10.,95.91,25.};
112   //Float_t sip07[3] = { 10.,106.14,25.};
113   //Float_t sip08[3] = { 10.,117.48,25.};
114   //Float_t sip09[3] = { 10.,130.18,25.};
115   //Float_t sip10[3] = { 10.,144.18,25.};
116   //Float_t sip11[3] = { 10.,159.87,25.};
117   //Float_t sip12[3] = { 10.,177.43,25.};
118   //Float_t sip13[3] = { 10.,197.11,25.};
119   //Float_t sip14[3] = { 10.,219.28,25.};
120   //Float_t sipmdl[5] = { 10.,310.,25.,90.,270. };
121   //Float_t sipmdr[5] = { 10.,310.,25.,270.,90. };
122   
123   const Float_t root3_4 = TMath::Sqrt(3.)/4.;
124   const Float_t root3_2 = TMath::Sqrt(3.)/2.;
125   //  Float_t xiqa[4], yiqa[4];
126   Int_t i;
127   //  Float_t siqad[4];
128   Float_t  xp, yp, zp;
129   //  Int_t idrotm[100];
130   Int_t num_mod;
131   Int_t jhrotc,jhrotac;
132
133   Int_t *idtmed = fIdtmed->GetArray()-599;
134   
135   //  VOLUMES Names : begining with D for all PMD volumes, 
136   // The names of SIZE variables begin with S and have more meaningful
137   // characters as shown below. 
138   
139   //            VOLUME  SIZE    MEDIUM  :       REMARKS 
140   //            ------  -----   ------  : --------------------------- 
141   
142   //            DPMD    SIPMD   AIR     : INSIDE PMD  and its SIZE 
143   
144   
145   
146   // *** Define the  DPMD   Volume and fill with air *** 
147
148   gMC->Gsvolu("DPMD", "TUBE", idtmed[698], sipmd, 3);
149   gMC->Gsatt("DPMD", "SEEN", 0);
150
151
152   //  gMC->Gsvolu("PM01", "TUBE", idtmed[698], sip01, 3);
153   //gMC->Gsvolu("PM02", "TUBE", idtmed[698], sip02, 3);
154   //gMC->Gsvolu("PM03", "TUBE", idtmed[698], sip03, 3);
155   //gMC->Gsvolu("PM04", "TUBE", idtmed[698], sip04, 3);
156   //gMC->Gsvolu("PM05", "TUBE", idtmed[698], sip05, 3);
157   //gMC->Gsvolu("PM06", "TUBE", idtmed[698], sip06, 3);
158   //gMC->Gsvolu("PM07", "TUBE", idtmed[698], sip07, 3);
159   //gMC->Gsvolu("PM08", "TUBE", idtmed[698], sip08, 3);
160   //gMC->Gsvolu("PM09", "TUBE", idtmed[698], sip09, 3);
161   //gMC->Gsvolu("PM10", "TUBE", idtmed[698], sip10, 3);
162   //gMC->Gsvolu("PM11", "TUBE", idtmed[698], sip11, 3);
163   //gMC->Gsvolu("PM12", "TUBE", idtmed[698], sip12, 3);
164   //gMC->Gsvolu("PM13", "TUBE", idtmed[698], sip13, 3);
165   //gMC->Gsvolu("PM14", "TUBE", idtmed[698], sip14, 3);
166   //gMC->Gsvolu("PMDL", "TUBS", idtmed[698], sipmdl, 5);
167   //gMC->Gsvolu("PMDR", "TUBS", idtmed[698], sipmdr, 5);
168 //  
169   const Int_t npad2=72; 
170   const Float_t boundary=0.0;
171   const Float_t offset=0.05;
172
173   // hexd1 array contains parameters of unit cell (polygon with 6 sides)
174   // new cells having 64 sq.mm. area
175   Float_t hexd1[10] = {0.,360.,6,2,-0.25,0.,0.25,0.25,0.,0.25};
176   //  Float_t hexd1[10] = {0.,360.,6,2,-0.4,0.,0.40,0.4,0.,0.40};
177   // dpara_sm array contains parameters of Supermodule rhombus
178   Float_t dpara_sm[6] = {12.5,12.5,0.8,30.,0.,0.};
179   //suprmodule side is 2*7 mm bigger than the total size of 72 cells array.
180   dpara_sm[0]=(npad2+0.25)*hexd1[6] + boundary; 
181   dpara_sm[1] = dpara_sm[0] *root3_2;
182   //dpara_dm11 array contains parameters of the imaginary volume DM11, this is just a
183   // little more than the side of a supermodule. total side = 2*39 cm.
184   Float_t dpara_dm11[6] = {12.5,12.5,0.8,30.,0.,0.};
185   dpara_dm11[0]=dpara_sm[0] + offset;
186   dpara_dm11[1] = dpara_dm11[0] *root3_2;
187   dpara_dm11[2]= 6.2/2.;
188 //
189   Float_t dpara_hole[6] = {12.5,12.5,0.8,30.,0.,0.};
190   dpara_hole[0]=dpara_dm11[0]/3.;
191   dpara_hole[1] = dpara_hole[0] *root3_2;
192   dpara_hole[2]= 6.2/2.;
193   gMC->Gsvolu("HOLE", "PARA", idtmed[698], dpara_hole, 6);
194   gMC->Gsatt("HOLE", "SEEN", 1);
195
196 //
197
198   AliMatrix(jhrotc, 90., 30.,   90.,  120., 0., 0.);
199   AliMatrix(jhrotac, 90., 330., 90., 240., 0., 0.);
200
201   // delx = full side of the supermodule 78 cm.
202   Float_t delx=2*dpara_dm11[0];
203   Float_t x1= delx*root3_4;
204   Float_t x2= delx*root3_4 + delx*root3_2;
205   Float_t x3= delx*root3_4 + 2*delx*root3_2;
206   // xpos are the x-coordinates of the centres of 13 supermodules on the left half of the 
207   // PMD. Numbering of the boxes are : 
208   // starting from the bottom part of the first column
209   // 1,2,3,4,5,6 (going downwards), then second column from bottom, 7,8,9,10,11
210   // then third 
211   // cloumn from top 12,13,14,15.
212
213   Float_t xpos[15]={-x1,-x1,-x1,-x1,-x1,-x1,-x2,-x2,-x2,-x2,-x2,-x3,-x3,-x3,-x3};
214
215   Float_t x4=delx/4.; 
216
217   // ypos are the y-coordinates of the 13 supermodules (identical for both halves).
218
219   //  Float_t ypos[15]={(x4+2*delx),(x4+delx),x4,(x4-delx),x4-2*delx,
220   //x4-3*delx,-x4,-x4-delx,-x4-2*delx,-3*x4-delx,-x4-delx/2.,-3*x4+delx,-3*x4+2  //*delx};
221
222   Float_t ypos[15];
223   ypos[2]=x4;
224   ypos[1]=ypos[2]+delx;
225   ypos[0]=ypos[1]+delx;
226
227   ypos[3]=ypos[2]-delx;
228   ypos[4]=ypos[3]-delx;
229   ypos[5]=ypos[4]-delx;
230
231   ypos[6]=ypos[5]+delx/2;
232   ypos[7]=ypos[6]+delx;
233   ypos[8]=ypos[7]+delx;
234   ypos[9]=ypos[8]+delx;
235   ypos[10]=ypos[9]+delx;
236
237   ypos[11]=ypos[1];
238   ypos[12]=ypos[2];
239   ypos[13]=ypos[3];
240   ypos[14]=ypos[4];
241
242
243   //    for (i = 0; i < 2; ++i) {
244   //      num_mod=i+1;
245   //gMC->Gsposp("DM11", num_mod, "DPMD", xpos[i],ypos[i],0., jhrotac, "ONLY", dpara_dm11, 6);
246   // gMC->Gsposp("DM11", num_mod+13, "DPMD", TMath::Abs(xpos[i]),ypos[i],0., jhrotc, "ONLY", dpara_dm11, 6);
247   //printf("Num_mod %d\n",num_mod);
248   //    }
249
250    maxbox=15;
251     for (i = 0; i < maxbox; ++i) {
252         num_mod=i+1;
253   gMC->Gsposp("DM11", num_mod, "DPMD", xpos[i],ypos[i],0., jhrotc, "ONLY", dpara_dm11, 6);
254   gMC->Gsposp("DM11", num_mod+15, "DPMD", TMath::Abs(xpos[i]),ypos[i],0., jhrotac, "ONLY", dpara_dm11, 6);
255     printf("Num_mod %d\n",num_mod);
256         }
257
258     // place four unit modules to create a hole of air.
259     Float_t xhole = dpara_hole[0]*root3_2;
260     Float_t yhole = dpara_hole[0]/2;
261   gMC->Gsposp("HOLE", 1, "DPMD", -xhole, yhole, 0., jhrotc, "ONLY", dpara_hole, 6);
262   gMC->Gsposp("HOLE", 3, "DPMD", xhole, yhole ,0., jhrotac, "ONLY", dpara_hole, 6);
263   yhole=yhole-dpara_hole[0]*2;
264
265   gMC->Gsposp("HOLE", 2, "DPMD", -xhole, yhole, 0., jhrotc, "ONLY", dpara_hole, 6);
266   gMC->Gsposp("HOLE", 4, "DPMD", xhole, yhole ,0., jhrotac, "ONLY", dpara_hole, 6);
267
268
269 //  gMC->Gspos("PM01", 1, "DPMD", 0.,0.,0., 0, "ONLY");
270 //  gMC->Gspos("PM02", 1, "DPMD", 0.,0.,0., 0, "ONLY");
271 //  gMC->Gspos("PM03", 1, "DPMD", 0.,0.,0., 0, "ONLY");
272 //  gMC->Gspos("PM04", 1, "DPMD", 0.,0.,0., 0, "ONLY");
273 //  gMC->Gspos("PM05", 1, "DPMD", 0.,0.,0., 0, "ONLY");
274 //  gMC->Gspos("PM06", 1, "DPMD", 0.,0.,0., 0, "ONLY");
275 //  gMC->Gspos("PM07", 1, "DPMD", 0.,0.,0., 0, "ONLY");
276 //  gMC->Gspos("PM08", 1, "DPMD", 0.,0.,0., 0, "ONLY");
277 //  gMC->Gspos("PM09", 1, "DPMD", 0.,0.,0., 0, "ONLY");
278 //  gMC->Gspos("PM10", 1, "DPMD", 0.,0.,0., 0, "ONLY");
279 //  gMC->Gspos("PM11", 1, "DPMD", 0.,0.,0., 0, "ONLY");
280 //  gMC->Gspos("PM12", 1, "DPMD", 0.,0.,0., 0, "ONLY");
281 //  gMC->Gspos("PM13", 1, "DPMD", 0.,0.,0., 0, "ONLY");
282 //  gMC->Gspos("PM14", 1, "DPMD", 0.,0.,0., 0, "ONLY");
283 // --- Place the DPMD in ALICE with front edge 5.8m from vertex  --- 
284     xp = 0.;
285     yp = 0.;
286     zp = zdist1;
287 //  gMC->Gspos("PMDL", 1, "DPMD", xp,yp,0., 0, "ONLY");
288 //  gMC->Gspos("PMDR", 1, "DPMD", xp,yp,0., 0, "ONLY");
289   gMC->Gspos("DPMD", 1, "ALIC", xp,yp,zp, 0, "ONLY");
290     
291 }
292
293 //_____________________________________________________________________________
294 void AliPMDv1::CreatePads()
295 {
296   //
297   // Create the geometry of the pads
298   // *** DEFINITION OF THE GEOMETRY OF THE PMD  *** 
299   // *** HEXAGONAL PADS WITH 10 MM SQUARE EQUIVALENT
300   // -- Author :     S. Chattopadhyay, 02/04/1999. 
301
302 // Basic unit is DP11, a hexagonal cell, which is placed inside another 
303 // hexagonal cell (DS11) of larger radius, compared to DP11. The difference in r// adius gives the dimension of half width of each cell wall.
304 // These cells are placed as 72 x 72 array in a 
305 // rhombus shaped supermodule (DW11). The rhombus shaped modules are designed
306 // to have closed packed structure.
307 // Each supermodule (SUPR), made of G10 is filled with following components
308 //  SMSS --> SS backing,
309 //  SMAR --> Gap between gas hexagonal cells and G10 backing.
310 //  DW11 --> Ar-Co2 filled gas hexagonal cells.
311 //  SMAR
312 // These supermodules are placed inside the main module (DM11), with Fe and 
313 // Pb converter positioned between CPV and PMD.
314 //  DM11 made of
315 // SUPR (rotated to place steel on the other side), this works as preshower
316 // when PMD is placed in -ve z.
317 // SUPB --> Pb converter
318 // SUFE --> Fe backing
319 // SUPR --> supermodule without rotation (this acts as CPV).
320 // 
321   
322   const Int_t npad2 = 72;
323   Float_t hexd1[10] = {0.,360.,6,2,-0.25,0.,0.25,0.25,0.,0.25};
324 //total wall thickness=0.2*2
325   Float_t hexd2[10] = {0.,360.,6,2,-0.25,0.,0.23,0.25,0.,0.23};
326   Int_t i, j;
327   Float_t xb, yb, zb;//, sw[3];
328   Int_t number;
329   Int_t ihrotm,irotdm;
330   const Float_t root3_cons = TMath::Sqrt(3.) /2.; 
331   Int_t *idtmed = fIdtmed->GetArray()-599;
332  
333   AliMatrix(ihrotm, 90., 30.,   90.,  120., 0., 0.);
334   AliMatrix(irotdm, 90., 180.,  90.,  270., 180., 0.);
335   zdist1  = fIn[2];
336   zdist = TMath::Abs(zdist1);
337 //
338   Int_t xrow=1;
339   Float_t dpara[6] = {12.5,12.5,0.4,30.,0.,0.};
340   dpara[0]=(npad2+0.25)*hexd1[6];
341   dpara[1] = dpara[0] *root3_cons;
342 //
343 //Subhasis, dimensional parameters of rhombus (dpara) as given to gsvolu
344 // rhombus to accomodate 72 x 72 hexagons, and with total 1.2cm extension  
345 //(1mm tolerance on both side and 5mm thick G10 wall)
346 // 
347   
348 // **** PAD SIZE 10 MM SQUARE EQUIVALENT
349 //
350 // Inner hex filled with gas
351   gMC->Gsvolu("DP11", "PGON", idtmed[604], hexd2,10);
352   gMC->Gsatt("DP11", "SEEN", 0);
353
354 // Outer hex filled with Plastic
355 //plastic  gMC->Gsvolu("DS11", "PGON", idtmed[616], hexd1,10);
356 // Iron
357   gMC->Gsvolu("DS11", "PGON", idtmed[614], hexd1,10);
358   gMC->Gsatt("DS11", "SEEN", 0);
359 // --- place  inner hex inside outer hex 
360     gMC->Gsposp("DP11", 1, "DS11", 0., 0., 0., 0, "ONLY", hexd2, 10);
361 // Rhombus shaped supermodules (defined by PARA)
362 // volume for SUPERMODULE 
363   const Float_t boundary=0.0;
364   const Float_t offset=0.05;
365
366   Float_t dpara_sm[6] = {12.5,12.5,0.8,30.,0.,0.};
367   dpara_sm[0]=(npad2+0.25)*hexd1[6] + boundary;
368   dpara_sm[1] = dpara_sm[0] *root3_cons;
369 //  
370   gMC->Gsvolu("SUPR","PARA", idtmed[607], dpara_sm, 6);
371   gMC->Gsatt("SUPR", "SEEN", 0);
372 //  SS 
373   Float_t dpara_ss[6] = {12.5,12.5,8.,30.,0.,0.};
374   dpara_ss[0]= dpara[0];
375   dpara_ss[1]= dpara[1];
376   dpara_ss[2]= 0.15/2.;
377 //
378   gMC->Gsvolu("SMSS","PARA", idtmed[601], dpara_ss, 6);
379   gMC->Gsatt("SMSS", "SEEN", 0);
380 // Air 
381   Float_t dpara_air[6] = {12.5,12.5,8.,30.,0.,0.};
382   dpara_air[0]= dpara[0] - 0.5;
383   dpara_air[1]= dpara_air[0] * root3_cons;
384   dpara_air[2]= 0.1/2.;
385 //  gMC->Gsvolu("SMAR","PARA", idtmed[604], dpara_air, 6);
386   gMC->Gsvolu("SMAR","PARA", idtmed[698], dpara_air, 6);
387   gMC->Gsatt("SMAR", "SEEN", 0);
388 //  
389 // volume for gas chamber (DW11)
390 //  
391 //  gMC->Gsvolu("DW11","PARA", idtmed[604], dpara, 6);
392   gMC->Gsvolu("DW11","PARA", idtmed[698], dpara, 6);
393   gMC->Gsatt("DW11", "SEEN", 0);
394 // Place outer hex inside DW11
395   yb = -dpara[1] + (1./root3_cons)*hexd1[6];
396   zb = 0.;
397   for (j = 1; j <= npad2; ++j) {
398   xb =-(dpara[0] + dpara[1]*0.577) + 2*hexd1[6];
399    if(xrow >= 2){
400     xb = xb+(xrow-1)*hexd1[6];
401     }
402   for (i = 1; i <= npad2; ++i) {
403       number = i+(j-1)*npad2;
404     gMC->Gsposp("DS11", number, "DW11", xb, yb, zb, ihrotm, "ONLY", hexd1, 10);
405     xb += (hexd1[6]*2.);
406   }
407    xrow = xrow+1;
408     yb += (hexd1[6]*TMath::Sqrt(3.));
409   }
410  Float_t z_ss,z_air1,z_air2,z_gas; 
411 // Place other components inside super module 
412     z_ss=-dpara_sm[2]+dpara_ss[2]; 
413     gMC->Gspos("SMSS", 1, "SUPR", 0., 0., z_ss, 0, "ONLY");
414     z_air1=z_ss+dpara_ss[2] +dpara_air[2]; 
415     gMC->Gspos("SMAR", 1, "SUPR", 0., 0., z_air1, 0, "ONLY");
416     z_gas=z_air1+dpara_air[2]+dpara[2]+0.05; 
417     gMC->Gspos("DW11", 1, "SUPR", 0., 0., z_gas, 0, "ONLY");
418     z_air2=z_gas+dpara[2]+0.05+dpara_air[2]; 
419     gMC->Gspos("SMAR", 2, "SUPR", 0., 0., z_air2, 0, "ONLY");
420   
421 // --- DEFINE MODules, iron, and lead voLUMES 
422   
423   
424 // volume for SUPERMODULE 
425 //   Pb 
426   Float_t dpara_pb[6] = {12.5,12.5,8.,30.,0.,0.};
427   dpara_pb[0]=dpara_sm[0];
428   dpara_pb[1]=dpara_sm[1];
429   dpara_pb[2]=1.5/2.;
430 //  dpara_pb[2]=1.0/2.;
431   gMC->Gsvolu("SUPB","PARA", idtmed[600], dpara_pb, 6);
432   //---  gMC->Gsvolu("SUPB","PARA", idtmed[698], dpara_pb, 6);
433   gMC->Gsatt("SUPB", "SEEN", 0);
434 //   tungsten 
435   Float_t dpara_tg[6] = {12.5,12.5,8.,30.,0.,0.};
436   dpara_tg[0]=dpara_sm[0];
437   dpara_tg[1]=dpara_sm[1];
438   dpara_tg[2]=1.0/2.;
439   gMC->Gsvolu("SUTG","PARA", idtmed[606], dpara_tg, 6);
440   gMC->Gsatt("SUTG", "SEEN", 0);
441 //   Fe 
442   Float_t dpara_fe[6] = {12.5,12.5,8.,30.,0.,0.};
443   dpara_fe[0]=dpara_sm[0];
444   dpara_fe[1]=dpara_sm[1];
445   dpara_fe[2]=0.5/2.;
446   gMC->Gsvolu("SUFE","PARA", idtmed[601], dpara_fe, 6);
447   gMC->Gsatt("SUFE", "SEEN", 0);
448 // volume for DM11 
449   Float_t dpara_dm11[6] = {12.5,12.5,0.8,30.,0.,0.};
450   dpara_dm11[0]=dpara_sm[0]+offset;
451   dpara_dm11[1] = dpara_dm11[0] *root3_cons;
452   dpara_dm11[2]= 6.2/2.;
453
454 //  
455   gMC->Gsvolu("DM11","PARA", idtmed[698], dpara_dm11, 6);
456   gMC->Gsatt("DM11", "SEEN", 1);
457 // position super module inside DM11
458  Float_t z_ps,z_pb,z_fe,z_cv; 
459   z_ps=-dpara_dm11[2]+dpara_sm[2];
460   gMC->Gspos("SUPR", 2, "DM11", 0., 0., z_ps, irotdm, "ONLY");
461   z_pb=z_ps+dpara_sm[2]+dpara_pb[2];
462   gMC->Gspos("SUPB", 1, "DM11", 0., 0., z_pb, 0, "ONLY");
463   z_fe=z_pb+dpara_pb[2]+dpara_fe[2];
464   gMC->Gspos("SUFE", 1, "DM11", 0., 0., z_fe, 0, "ONLY");
465   z_cv=z_fe+dpara_fe[2]+dpara_sm[2];
466   gMC->Gspos("SUPR", 1, "DM11", 0., 0., z_cv, 0, "ONLY");
467 // 
468 }
469  
470 //_____________________________________________________________________________
471 void AliPMDv1::DrawModule()
472 {
473   //
474   // Draw a shaded view of the Photon Multiplicity Detector
475   //
476
477   gMC->Gsatt("*", "seen", -1);
478   gMC->Gsatt("alic", "seen", 0);
479   //
480   // Set the visibility of the components
481   // 
482   gMC->Gsatt("DP11","seen",0);
483   gMC->Gsatt("DS11","seen",0);
484   gMC->Gsatt("DW11","seen",0);
485   gMC->Gsatt("DM11","seen",1);
486   gMC->Gsatt("HOLE","seen",1);
487   gMC->Gsatt("DPMD","seen",0);
488   //
489   gMC->Gdopt("hide", "on");
490   gMC->Gdopt("shad", "on");
491   gMC->Gsatt("*", "fill", 7);
492   gMC->SetClipBox(".");
493   gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
494   gMC->DefaultRange();
495   gMC->Gdraw("alic", 40, 30, 0, 22, 20.5, .02, .02);
496   gMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
497   //gMC->Gdman(17, 5, "MAN");
498   gMC->Gdopt("hide", "off");
499 }
500
501 //_____________________________________________________________________________
502 void AliPMDv1::CreateMaterials()
503 {
504   //
505   // Create materials for the PMD version 1
506   //
507   // ORIGIN    : Y. P. VIYOGI 
508   //
509   
510   // --- The Argon- CO2 mixture --- 
511   Float_t ag[2] = { 39.95 };
512   Float_t zg[2] = { 18. };
513   Float_t wg[2] = { .8,.2 };
514   Float_t dar   = .001782;   // --- Ar density in g/cm3 --- 
515   // --- CO2 --- 
516   Float_t ac[2] = { 12.,16. };
517   Float_t zc[2] = { 6.,8. };
518   Float_t wc[2] = { 1.,2. };
519   Float_t dc    = .001977;
520   Float_t dco   = .002;  // --- CO2 density in g/cm3 ---
521   
522   Float_t absl, radl, a, d, z;
523   Float_t dg;
524   Float_t x0ar;
525   Float_t x0xe=2.4;
526   Float_t dxe=0.005858;
527   Float_t buf[1];
528   Int_t nbuf;
529   Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
530   Float_t zsteel[4] = { 26.,24.,28.,14. };
531   Float_t wsteel[4] = { .715,.18,.1,.005 };
532   
533   Int_t *idtmed = fIdtmed->GetArray()-599;
534   Int_t isxfld = gAlice->Field()->Integ();
535   Float_t sxmgmx = gAlice->Field()->Max();
536   
537   // --- Define the various materials for GEANT --- 
538   AliMaterial(1, "Pb    $", 207.19, 82., 11.35, .56, 18.5);
539   x0ar = 19.55 / dar;
540   AliMaterial(2, "Argon$", 39.95, 18., dar, x0ar, 6.5e4);
541   AliMixture(3, "CO2  $", ac, zc, dc, -2, wc);
542   AliMaterial(4, "Al   $", 26.98, 13., 2.7, 8.9, 18.5);
543   AliMaterial(6, "Fe   $", 55.85, 26., 7.87, 1.76, 18.5);
544   AliMaterial(7, "W    $", 183.85, 74., 19.3, .35, 10.3);
545   AliMaterial(8, "G10  $", 20., 10., 1.7, 19.4, 999.);
546   AliMaterial(9, "SILIC$", 28.09, 14., 2.33, 9.36, 45.);
547   AliMaterial(10, "Be   $", 9.01, 4., 1.848, 35.3, 36.7);
548   AliMaterial(15, "Cu   $", 63.54, 29., 8.96, 1.43, 15.);
549   AliMaterial(16, "C    $", 12.01, 6., 2.265, 18.8, 49.9);
550   AliMaterial(17, "POLYCARBONATE    $", 20., 10., 1.2, 34.6, 999.);
551   // AliMaterial(31, "Xenon$", 131.3, 54., dxe, x0xe, 6.5e4);
552   
553   AliMaterial(96, "MYLAR$", 8.73, 4.55, 1.39, 28.7, 62.);
554   AliMaterial(97, "CONCR$", 20., 10., 2.5, 10.7, 40.);
555   AliMaterial(98, "Vacum$", 1e-9, 1e-9, 1e-9, 1e16, 1e16);
556   AliMaterial(99, "Air  $", 14.61, 7.3, .0012, 30420., 67500.);
557   AliMixture(19, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel); 
558   //    define gas-mixtures 
559   
560   char namate[21];
561   gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
562   ag[1] = a;
563   zg[1] = z;
564   dg = (dar * 4 + dco) / 5;
565   AliMixture(5, "ArCO2$", ag, zg, dg, 2, wg);
566   
567   // Define tracking media 
568   AliMedium(1, "Pb conv.$", 1,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
569   AliMedium(2, " S steel$", 19, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
570   AliMedium(7, "W  conv.$", 7,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
571   AliMedium(8, "G10plate$", 8,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
572   AliMedium(4, "Al      $", 4,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
573   AliMedium(6, "Fe      $", 6,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
574   AliMedium(5, "ArCO2   $", 5,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
575   AliMedium(9, "SILICON $", 9,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
576   AliMedium(10, "Be      $", 10, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
577   AliMedium(98, "Vacuum  $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .1,  10);
578   AliMedium(99, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .1,  .1);
579   AliMedium(15, "Cu      $", 15, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
580   AliMedium(16, "C       $", 16, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
581   AliMedium(17, "PLOYCARB$", 17, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
582   //  AliMedium(31, "Xenon   $", 31,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
583   
584   // --- Generate explicitly delta rays in the iron, aluminium and lead --- 
585   gMC->Gstpar(idtmed[600], "LOSS", 3.);
586   gMC->Gstpar(idtmed[600], "DRAY", 1.);
587   
588   gMC->Gstpar(idtmed[603], "LOSS", 3.);
589   gMC->Gstpar(idtmed[603], "DRAY", 1.);
590   
591   gMC->Gstpar(idtmed[604], "LOSS", 3.);
592   gMC->Gstpar(idtmed[604], "DRAY", 1.);
593   
594   gMC->Gstpar(idtmed[605], "LOSS", 3.);
595   gMC->Gstpar(idtmed[605], "DRAY", 1.);
596   
597   gMC->Gstpar(idtmed[606], "LOSS", 3.);
598   gMC->Gstpar(idtmed[606], "DRAY", 1.);
599   
600   gMC->Gstpar(idtmed[607], "LOSS", 3.);
601   gMC->Gstpar(idtmed[607], "DRAY", 1.);
602   
603   // --- Energy cut-offs in the Pb and Al to gain time in tracking --- 
604   // --- without affecting the hit patterns --- 
605   gMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
606   gMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
607   gMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
608   gMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
609   gMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
610   gMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
611   gMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
612   gMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
613   gMC->Gstpar(idtmed[606], "CUTGAM", 1e-4);
614   gMC->Gstpar(idtmed[606], "CUTELE", 1e-4);
615   gMC->Gstpar(idtmed[606], "CUTNEU", 1e-4);
616   gMC->Gstpar(idtmed[606], "CUTHAD", 1e-4);
617   gMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
618   gMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
619   gMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
620   gMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
621   gMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
622   gMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
623   gMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
624   gMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
625   
626   // --- Prevent particles stopping in the gas due to energy cut-off --- 
627   gMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
628   gMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
629   gMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
630   gMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
631   gMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
632 }
633
634 //_____________________________________________________________________________
635 void AliPMDv1::Init()
636 {
637   //
638   // Initialises PMD detector after it has been built
639   //
640   Int_t i;
641   kdet=1;
642   //
643   printf("\n");
644   for(i=0;i<35;i++) printf("*");
645   printf(" PMD_INIT ");
646   for(i=0;i<35;i++) printf("*");
647   printf("\n");
648   printf("                 PMD simulation package (v1) initialised\n");
649   printf(" parameters of pmd\n");
650   printf("%6d %10.2f %10.2f %10.2f %10.2f %10.2f\n",kdet,thmin,thmax,zdist,thlow,thhigh);
651   //
652   for(i=0;i<80;i++) printf("*");
653   printf("\n");
654   //
655   Int_t *idtmed = fIdtmed->GetArray()-599;
656   fMedSens=idtmed[605-1];
657 }
658
659 //_____________________________________________________________________________
660 void AliPMDv1::StepManager()
661 {
662   //
663   // Called at each step in the PMD
664   //
665   Int_t   copy;
666   Float_t hits[4], destep;
667   Float_t center[3] = {0,0,0};
668   Int_t   vol[5];
669   //  char *namep;
670   
671   if(gMC->GetMedium() == fMedSens && (destep = gMC->Edep())) {
672     
673     gMC->CurrentVolID(copy);
674 //    namep=gMC->CurrentVolName();
675 //    printf("Current vol is %s \n",namep);
676     vol[0]=copy;
677     gMC->CurrentVolOffID(1,copy);
678 //    namep=gMC->CurrentVolOffName(1);
679 //    printf("Current vol 11 is %s \n",namep);
680     vol[1]=copy;
681     gMC->CurrentVolOffID(2,copy);
682 //    namep=gMC->CurrentVolOffName(2);
683 //    printf("Current vol 22 is %s \n",namep);
684     vol[2]=copy;
685 //      if(strncmp(namep,"DW11",4))vol[2]=1;
686     gMC->CurrentVolOffID(3,copy);
687 //    namep=gMC->CurrentVolOffName(3);
688 //    printf("Current vol 33 is %s \n",namep);
689     vol[3]=copy;
690     gMC->CurrentVolOffID(4,copy);
691 //    namep=gMC->CurrentVolOffName(4);
692 //    printf("Current vol 44 is %s \n",namep);
693     vol[4]=copy;
694 //      printf("volume number %d,%d,%d,%d,%d \n",vol[0],vol[1],vol[2],vol[3],vol[4]);
695     gMC->Gdtom(center,hits,1);
696     hits[3] = destep*1e9; //Number in eV
697     AddHit(gAlice->CurrentTrack(), vol, hits);
698   }
699 }
700
701