]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/AliPMDv2.cxx
stdlib.h included (for Alpha)
[u/mrichter/AliRoot.git] / PMD / AliPMDv2.cxx
CommitLineData
4c039060 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$
0cc62300 18Revision 1.7 2000/10/02 21:28:12 fca
19Removal of useless dependecies via forward declarations
20
94de3818 21Revision 1.6 1999/09/29 09:24:28 fca
22Introduction of the Copyright and cvs Log
23
4c039060 24*/
25
6edc06da 26///////////////////////////////////////////////////////////////////////////////
27// //
28// Photon Multiplicity Detector Version 1 //
29// //
30//Begin_Html
31/*
1439f98e 32<img src="picts/AliPMDv2Class.gif">
6edc06da 33*/
34//End_Html
35// //
36///////////////////////////////////////////////////////////////////////////////
37#include "AliPMDv2.h"
38#include "AliRun.h"
39#include "AliMC.h"
94de3818 40#include "AliMagF.h"
6edc06da 41#include "AliConst.h"
0cc62300 42
43#include "TMath.h"
44static const Double_t kPI=TMath::Pi();
6edc06da 45
46static Float_t smod1[3], smod2[3], smod3[3], smod4[3];
47static Int_t maxbox, kdet;
48static Float_t thgas,thcell,thmin,thmax,zdist,zdist1,thlow,
49 thhigh,edge;
50static Int_t numqu;
51static Float_t xbox[40][40], ybox[40][40];
52static Int_t pindex[40][40];
53
54ClassImp(AliPMDv2)
55//_____________________________________________________________________________
56AliPMDv2::AliPMDv2() : AliPMD()
57{
58 //
59 // Default constructor
60 //
61 fMedSens=0;
62}
63
64//_____________________________________________________________________________
65AliPMDv2::AliPMDv2(const char *name, const char *title)
66 : AliPMD(name,title)
67{
68 //
69 // Standard constructor
70 //
71 fMedSens=0;
72}
73
74//_____________________________________________________________________________
75void AliPMDv2::Coordnew()
76{
77 //
78 // Find coordinates for pad geometry
79 //
80 // Author Y.P. Viyogi, VECC Calcutta
81 //
82
83 Float_t th1, th2, dbox, dist;
84 //Float_t xoff[40][40], yoff[40][40];
85 Int_t i, j, nbox;
86 Float_t rlow;
87 Int_t xoff1[3], yoff1[3], l;
88 Float_t rhigh, dmax, hole;
89 Int_t kk, nhol;
90 Float_t rr, xx, yy;
91
92 th1 = thmin * kPI / 180;
93 th2 = thmax * kPI / 180;
94 /* ESTIMATES FOR OCTAGON */
95 dist = zdist * TMath::Tan(th2);
96 /* *** 04.06.97 Fixed Module size of 6 cm, 0 mm boundary. */
97 /* *** variable pad sizes of 0.3 mm, 0.5 mm, 1.0 mm and 1.2 mm */
98 dbox = edge * 2 + 24;
99 maxbox = Int_t(dist / dbox + .5);
100 dmax= maxbox * dbox;
101 /* NOW GET THE HOLE SIZE ETC. */
102 hole = zdist * TMath::Tan(th1);
103 nhol = Int_t(hole / dbox + .5);
104 hole = nhol * dbox;
105
106 rlow = zdist * TMath::Tan(thlow * kPI / 180);
107 rhigh = zdist * TMath::Tan(thhigh * kPI / 180);
108 for (i = 1; i <= 40; ++i) {
109 for (j = 1; j <= 40; ++j) {
110 //index[j][i] = 0;
111 //xoff[j][i] = 0;
112 //yoff[j][i] = 0;
113 xbox[j][i] = 0;
114 /* L5: */
115 ybox[j][i] = 0;
116 }
117 }
118
119 // NOW START PLACING THE BOXES IN VARIOUS LAYERS, START FROM THE CENTRE
120
121 yy = dbox / 2;
122 for(i=0;i<3;i++) yoff1[i]=0;
123 nbox = 0;
124 // PRINT*,'MAXBOX=',MAXBOX
125 for (i = 1; i <= maxbox; ++i) {
126 xx = dbox / 2;
127 for(j=0;j<3;j++) xoff1[j]=0;
128 for (j = 1; j <= maxbox; ++j) {
129 rr = sqrt(xx*xx+yy*yy);
130 if (rr >= hole && rr <= dmax) {
131 // BOX CAN BE FITTED
132 //index[j][i] = 2;
133 //if (rr < rlow) index[j][i] = 1;
134 //else if (rr > rhigh) index[j][i] = 3;
135 xbox[j][i] = xx;
136 ybox[j][i] = yy;
137 ++nbox;
138 //xoff[j][i] = xoff1[index[j][i] - 1];
139 //yoff[j][i] = yoff1[index[j][i] - 1];
140 }
141 if (kdet == 1) kk = 1; else kk = 0;
142 for (l = 1; l <= 3; ++l)
143 xoff1[l - 1] += fNumPads[l + kk - 1];
144 xx += dbox;
145 }
146
147 if (kdet == 1) kk = 1; else kk=0;
148
149 for (l = 1; l <= 3; ++l)
150 yoff1[l - 1] += fNumPads[l + kk - 1];
151 yy += dbox;
152 }
153}
154
155//_____________________________________________________________________________
156void AliPMDv2::Coordinates()
157{
158 //
159 // SUBROUTINE TO COMPUTE THE X- AND Y- COORDINATES OF THE BOXES
160 // WHICH CAN FIT INTO THE CIRCULAR REGION BETWEEN THE GIVEN ANGLES.
161 // INPUT : ZDIST, THMIN, THMAX, PADSIZE (FOR INSIDE and OUTSIDE PMD).
162 // ALL DIMENSIONS IN CM.
163 // -- Author : Y.P. VIYOGI, 10/05/1996.
164
165 Float_t hole, dmax, dbox;
166 Int_t nhol;
167 Float_t dist;
168 Int_t nbox;
169 Float_t rlow;
170 Int_t i, j;
171 Float_t rhigh, rr, xx, yy, th1, th2;
172
173 th1 = thmin*kPI/180;
174 th2 = thmax*kPI/180;
175 // ESTIMATES FOR OCTAGON
176 dist = zdist * TMath::Tan(th2);
177 // *** 04.06.97 Fixed Module size of 24 cm, 3 mm boundary.
178 // *** variable pad sizes of 8 mm, 10 mm, 12mm and 15 mm
179 dbox = edge*2 + 24.;
180 maxbox = Int_t(dist / dbox + .5);
181 dmax = maxbox*dbox;
182 // NOW GET THE HOLE SIZE ETC.
183 hole = zdist * TMath::Tan(th1);
184 nhol = Int_t(hole / dbox + .5);
185 hole = nhol * dbox;
186
187 rlow = zdist * TMath::Tan(thlow*kPI/180);
188 rhigh = zdist * TMath::Tan(thhigh*kPI/180);
189 for (i = 0; i < 40; ++i) {
190 for (j = 0; j < 40; ++j) {
191 pindex[j][i] = 0;
192 xbox[j][i] = 0;
193 ybox[j][i] = 0;
194 }
195 }
196
197 // NOW START PLACING THE BOXES IN VARIOUS LAYERS, START FROM THE CENTRE
198 yy = dbox / 2;
199 nbox = 0;
200 for (i = 0; i < maxbox; ++i) {
201 xx = dbox / 2;
202 for (j = 0; j < maxbox; ++j) {
203 rr = TMath::Sqrt(xx*xx + yy*yy);
204 if (rr >= hole && rr <= dmax) { // BOX CAN BE FITTED
205 pindex[j][i] = 2;
206 if (rr < rlow) pindex[j][i] = 1;
207 if (rr > rhigh) pindex[j][i] = 3;
208 xbox[j][i] = xx;
209 ybox[j][i] = yy;
210 ++nbox;
211 }
212 xx += dbox;
213 }
214 yy += dbox;
215 }
216}
217
218//_____________________________________________________________________________
219void AliPMDv2::CreateGeometry()
220{
221 //
222 // Create geometry for Photon Multiplicity Detector Version 1
223 //
224 //Begin_Html
225 /*
1439f98e 226 <img src="picts/AliPMDv2.gif">
6edc06da 227 */
228 //End_Html
229 //Begin_Html
230 /*
1439f98e 231 <img src="picts/AliPMDv2Tree.gif">
6edc06da 232 */
233 //End_Html
234 CreatePads();
235 CreateInside();
236}
237
238//_____________________________________________________________________________
239void AliPMDv2::CreateInside()
240{
241 //
242 // Create inside of Pads
243 //
244 // -- Author : Y.P. VIYOGI, 07/05/1996.
245 // -- Modified: P.V.K.S.Baba(JU), 15-12-97.
246
247 Float_t sipmd[3] = { 300.,300.,5. };
248
249 Int_t i2;
250
251 Float_t xiqa[4], yiqa[4];
252 Int_t inum2, inum3, inum4, i, j, k;
253 Float_t siqad[4];
254 Float_t zd, xd, yd, xp, yp, zp;
255 Int_t idrotm[100];
256
ad51aeb0 257 Int_t *idtmed = fIdtmed->GetArray()-599;
6edc06da 258
259 // VOLUMES Names : begining with D for all PMD volumes,
260 // The names of SIZE variables begin with S and have more meaningful
261 // characters as shown below.
262
263 // VOLUME SIZE MEDIUM : REMARKS
264 // ------ ----- ------ : ---------------------------
265
266 // DPMD SIPMD AIR : INSIDE PMD and its SIZE
267
268
269
270 // *** Define the DPMD Volume and fill with air ***
271
cfce8870 272 gMC->Gsvolu("DPMD", "BOX ", idtmed[698], sipmd, 3);
6edc06da 273
274 // *** Define DIQU Volume and fill with air
275 siqad[0] = sipmd[0] / 2. - 1.;
276 siqad[1] = sipmd[1] / 2. - 1.;
277 siqad[2] = sipmd[2];
cfce8870 278 gMC->Gsvolu("DIQU","BOX ", idtmed[698], siqad, 3);
279 gMC->Gsatt("DIQU", "SEEN", 1);
6edc06da 280
281
282 // --- Place the modules in INSIDE PMD (DPMD)
283 // --- FIRST CALCULATE THE COORDINATES OF THE MODULES WHICH CAN BE
284 // --- ACCOMODATED.
285
286 kdet = 1;
287 Coordinates();
288
289 //inum = 0;
290 zd = 0.;
291 AliMatrix(idrotm[1], 90., 0., 90., 90., 0., 0.);
292 AliMatrix(idrotm[2], 90., 180., 90., 90., 0., 0.);
293 AliMatrix(idrotm[3], 90., 180., 90., 270., 0., 0.);
294 AliMatrix(idrotm[4], 90., 0., 90., 270., 0., 0.);
295 // **** Filling the DIQU Vol. (One Quadrant)
296 inum2 = 0;
297 inum3 = 0;
298 inum4 = 0;
299 for (i = 0; i < maxbox; ++i) {
300 i2 = maxbox;
301 for (j = 0; j < i2; ++j) {
302 if (xbox[j][i] <= 0 && ybox[j][i] <= 0) continue;
303 xd = xbox[j][i] - siqad[0];
304 yd = ybox[j][i] - siqad[1];
305 if (pindex[j][i] == 1) {
306 ++inum2;
cfce8870 307 gMC->Gsposp("DM11", inum2, "DIQU", xd, yd, zd, 0, "ONLY", smod2, 3);
6edc06da 308 }
309 if (pindex[j][i] == 2) {
310 ++inum3;
cfce8870 311 gMC->Gsposp("DM12", inum3, "DIQU", xd, yd, zd, 0, "ONLY", smod3, 3);
6edc06da 312 }
313 if (pindex[j][i] == 3) {
314 ++inum4;
cfce8870 315 gMC->Gsposp("DM13", inum4, "DIQU", xd, yd, zd, 0, "ONLY", smod4, 3);
6edc06da 316 }
317 }
318 }
319 xiqa[0] = siqad[0];
320 xiqa[1] = -siqad[0];
321 xiqa[2] = xiqa[1];
322 xiqa[3] = xiqa[0];
323 yiqa[0] = siqad[0];
324 yiqa[1] = yiqa[0];
325 yiqa[2] = -siqad[0];
326 yiqa[3] = yiqa[2];
327 i2 = numqu;
328 for (k = 1; k <= i2; ++k) {
cfce8870 329 gMC->Gsposp("DIQU", k, "DPMD", xiqa[k-1], yiqa[k-1], zd, idrotm[k], "ONLY", siqad, 3);
6edc06da 330 }
331
332 // --- Place the DPMD in ALICE with front edge 6.0m from vertex ---
333 xp = 0.;
334 yp = 0.;
335 zp = zdist1;
cfce8870 336 gMC->Gspos("DPMD", 1, "ALIC", xp, yp, zp, 0, "ONLY");
6edc06da 337
338}
339
340//_____________________________________________________________________________
341void AliPMDv2::CreatePads()
342{
343 //
344 // Create the geometry of the pads
345 // *** DEFINITION OF THE GEOMETRY OF THE PMD ***
346 // *** DIFFERENT PADS WITH SIZES 8 MM, 10 MM, 12 MM AND 15 MM SQUARE
347 // -- Author : Y.P. VIYOGI, 04/06/1997.
348 // -- Modified: P.V.K.S.Baba(JU), 13-12-97.
349
6edc06da 350 Int_t npad1, npad2, npad3, npad4;
351 Float_t spad1[3], spad2[3], spad3[3], spad4[3];
352 Float_t scpv1[3], scpv2[3], scpv3[3], scpv4[3];
353 Int_t i, j;
354 Float_t sstr1[3], spsw1[3], sstr2[3], spsw2[3], sstr3[3], spsw3[3],
355 sstr4[3], spsw4[3];
356 Float_t xa, ya, za, xb, yb, zb, xc, sw[3], yc, zc;
357 Float_t sfe[3];
358 Float_t spb[3], pad1, pad2, pad3, pad4;
359 // VOLUMES Names : begining with D for all PMD volumes,
360 // DMO1 : MODULE TYPE 1 ( 8 MM PADS)
361 // DM11 : MODULE TYPE 2 (10 MM PADS)
362 // DM12 : MODULE TYPE 3 (12 MM PADS)
363 // DM13 : MODULE TYPE 4 (15 MM PADS)
364
365 // The names of SIZE variables begin with S and have more meaningful
366 // characters as shown below.
367
368 // VOLUME SIZE MEDIUM : REMARKS
369 // ------ ----- ------ : ---------------------------
370
371 // DPPB SPB PB : PB Converter and its SIZE
372 // DPFE SFE FE : FE Support Plate and its SIZE
373
374 // DP11 SPAD2 GAS : PAD TYPE 2 (10 MM)
375 // DP12 SPAD2 GAS : PAD TYPE 2 FOR CPV(10 MM)
376 // DS11 SSTR2 FE : STRIP OF IRON
377 // DW11 SPSW2 G10 : PRESHOWER
378 // DV11 SCPV2 G10 : CPV
379
380 // DP13 SPAD3 GAS : PAD TYPE 3 (12 MM)
381 // DP14 SPAD3 GAS : PAD TYPE 3 FOR CPV(12 MM)
382 // DS12 SSTR3 FE : STRIP OF IRON
383 // DW12 SPSW3 G10 : PRESHOWER
384 // DV12 SCPV3 G10 : CPV
385
386 // DP15 SPAD4 GAS : PAD TYPE 4 (15 MM)
387 // DP16 SPAD4 GAS : PAD TYPE 4 FOR CPV(15 MM)
388 // DS13 SSTR4 FE : STRIP OF IRON
389 // DW13 SPSW4 G10 : PRESHOWER
390 // DV13 SCPV4 G10 : CPV
391
392 // ****************** VOLUME TREE ******************
393
394 // DM11 (Module)
395 // |
396 // |
397 // -------------------------------------------------
398 // | | | |
399 // | | | |
400 // DV11( CPV) DPFE DPPB DW11(Preshower)
401 // | |
402 // | |
403 // DS12(Strip) DS11(Strip)
404 // | |
405 // | |
406 // DP12(Pads) DP11(Pads)
407
408 // ************************************************************
409
410 // --- The above gives the Volume Tree. PAD is a gas cell of size
411 // --- given by PADSIZE in the input cards. STRIP is a collection of
412 //--- PADs in a row. STRIPs are positioned in the PRESHOWER BOX. This is
413 //--- then placed in the MODULE. The PSW and the MODULE have the same size
414 // --- ; Lead converter, Iron support plate are also placed
415 // --- in the MODULE.
416
417
418 // DATA PAD1,PAD2,PAD3,PAD4/4*0.8/
419 // DATA NPAD1,NPAD2,NPAD3,NPAD4/4*30/
420
ad51aeb0 421 Int_t *idtmed = fIdtmed->GetArray()-599;
6edc06da 422
423 // **** PAD SIZE 8 MM
424 // pmdin = fPar[0];
425 // pmdout = fPar[1];
426 thgas = fPar[2];
427 thcell = fPar[3];
428 thmin = fIn[0];
429 thmax = fIn[1];
430 zdist1 = fIn[2];
431 zdist = TMath::Abs(zdist1);
432 thlow = fIn[3];
433 thhigh = fIn[4];
434 // wafer = fGeo[0];
435 edge = fGeo[1];
436 numqu = Int_t(fGeo[2]);
437
438
439 // *BABA
440 pad1 = fPadSize[0];
441 pad2 = fPadSize[1];
442 pad3 = fPadSize[2];
443 pad4 = fPadSize[3];
444 npad1 = Int_t(24/fPadSize[0]);
445 npad2 = Int_t(24/fPadSize[1]);
446 npad3 = Int_t(24/fPadSize[2]);
447 npad4 = Int_t(24/fPadSize[3]);
448 // *BABA
449 spad1[0] = (pad1 - thcell) / 2.;
450 spad1[1] = spad1[0];
451 spad1[2] = thgas / 2;
cfce8870 452 gMC->Gsvolu("DP21", "BOX ", idtmed[604], spad1, 3);
453 gMC->Gsatt("DP21", "SEEN", 1);
454 gMC->Gsvolu("DP22", "BOX ", idtmed[604], spad1, 3);
455 gMC->Gsatt("DP22", "SEEN", 1);
6edc06da 456
457 sstr1[0] = npad1*pad1/2;
458 sstr1[1] = pad1/2;
459 sstr1[2] = thgas/2;
cfce8870 460 gMC->Gsvolu("DS21", "BOX ", idtmed[605], sstr1, 3);
461 gMC->Gsatt("DS21", "SEEN", 1);
462 gMC->Gsvolu("DS22", "BOX ", idtmed[605], sstr1, 3);
463 gMC->Gsatt("DS22", "SEEN", 1);
6edc06da 464
465 spsw1[0] = sstr1[0] + edge;
466 spsw1[1] = spsw1[0];
467 spsw1[2] = (thgas + .4) / 2;
468 // 2 mm G10 Plate cover (NMATE = 808)
469 scpv1[0] = spsw1[0];
470 scpv1[1] = spsw1[1];
471 scpv1[2] = spsw1[2];
cfce8870 472 gMC->Gsvolu("DW21", "BOX ", idtmed[607], spsw1, 3);
473 gMC->Gsatt("DW21", "SEEN", 1);
474 gMC->Gsvolu("DV21", "BOX ", idtmed[607], spsw1, 3);
475 gMC->Gsatt("DV21", "SEEN", 1);
6edc06da 476
477 // --- place pads in a strip
478 xa = (-npad1 + 1.) * pad1 / 2.;
479 ya = 0.;
480 za = 0.;
481 for (i = 1; i <= npad1; ++i) {
cfce8870 482 gMC->Gsposp("DP21", i, "DS21", xa, ya, za, 0, "ONLY", spad1, 3);
483 gMC->Gsposp("DP22", i, "DS22", xa, ya, za, 0, "ONLY", spad1, 3);
6edc06da 484 xa += pad1;
485 }
486 // --- place strips in the PRESHOWER AND CPV boxes
487 xb = 0.;
488 yb = (-npad1 + 1.) * pad1 / 2.;
489 zb = 0.;
490 for (j = 1; j <= npad1; ++j) {
cfce8870 491 gMC->Gsposp("DS21", j, "DW21", xb, yb, zb, 0, "ONLY", sstr1, 3);
492 gMC->Gsposp("DS22", j, "DV21", xb, yb, zb, 0, "ONLY", sstr1, 3);
6edc06da 493 yb += pad1;
494 }
495
496 // **** PAD SIZE 10 MM
497
498 spad2[0] = (pad2 - thcell) / 2.;
499 spad2[1] = spad2[0];
500 spad2[2] = thgas / 2;
cfce8870 501 gMC->Gsvolu("DP11", "BOX ", idtmed[604], spad2, 3);
502 gMC->Gsatt("DP11", "SEEN", 1);
503 gMC->Gsvolu("DP12", "BOX ", idtmed[604], spad2, 3);
504 gMC->Gsatt("DP12", "SEEN", 1);
6edc06da 505
506 sstr2[0] = npad2 * pad2 / 2;
507 sstr2[1] = pad2 / 2;
508 sstr2[2] = thgas / 2;
cfce8870 509 gMC->Gsvolu("DS11", "BOX ", idtmed[605], sstr2, 3);
510 gMC->Gsatt("DS11", "SEEN", 1);
511 gMC->Gsvolu("DS12", "BOX ", idtmed[605], sstr2, 3);
512 gMC->Gsatt("DS12", "SEEN", 1);
6edc06da 513
514 spsw2[0] = sstr2[0] + edge;
515 spsw2[1] = spsw2[0];
516 spsw2[2] = (thgas + .4) / 2;
517 // 2 mm G10 Plate cover (NMATE = 808)
518 scpv2[0] = spsw2[0];
519 scpv2[1] = spsw2[1];
520 scpv2[2] = spsw2[2];
cfce8870 521 gMC->Gsvolu("DW11","BOX ", idtmed[607], spsw2, 3);
522 gMC->Gsatt("DW11", "SEEN", 1);
523 gMC->Gsvolu("DV11","BOX ", idtmed[607], spsw2, 3);
524 gMC->Gsatt("DV11", "SEEN", 1);
6edc06da 525
526 // --- place pads in a strip
527 xa = (-npad2 + 1.) * pad2 / 2.;
528 ya = 0.;
529 za = 0.;
530 for (i = 1; i <= npad2; ++i) {
cfce8870 531 gMC->Gsposp("DP11", i, "DS11", xa, ya, za, 0, "ONLY", spad2, 3);
532 gMC->Gsposp("DP12", i, "DS12", xa, ya, za, 0, "ONLY", spad2, 3);
6edc06da 533 xa += pad2;
534 }
535 // --- place strips in the PRESHOWER AND CPV boxes
536 xb = 0.;
537 yb = (-npad2 + 1.) * pad2 / 2.;
538 zb = 0.;
539 for (j = 1; j <= npad2; ++j) {
cfce8870 540 gMC->Gsposp("DS11", j, "DW11", xb, yb, zb, 0, "ONLY", sstr2, 3);
541 gMC->Gsposp("DS12", j, "DV11", xb, yb, zb, 0, "ONLY", sstr2, 3);
6edc06da 542 yb += pad2;
543 }
544
545 // **** PAD SIZE 12 MM
546
547 spad3[0] = (pad3 - thcell) / 2.;
548 spad3[1] = spad3[0];
549 spad3[2] = thgas / 2;
cfce8870 550 gMC->Gsvolu("DP13", "BOX ", idtmed[604], spad3, 3);
551 gMC->Gsatt("DP13", "SEEN", 1);
552 gMC->Gsvolu("DP14", "BOX ", idtmed[604], spad3, 3);
553 gMC->Gsatt("DP14", "SEEN", 1);
6edc06da 554
555 sstr3[0] = npad3 * pad3 / 2;
556 sstr3[1] = pad3 / 2;
557 sstr3[2] = thgas / 2;
cfce8870 558 gMC->Gsvolu("DS13", "BOX ", idtmed[605], sstr3, 3);
559 gMC->Gsatt("DS13", "SEEN", 1);
560 gMC->Gsvolu("DS14", "BOX ", idtmed[605], sstr3, 3);
561 gMC->Gsatt("DS14", "SEEN", 1);
6edc06da 562
563 spsw3[0] = sstr3[0] + edge;
564 spsw3[1] = spsw3[0];
565 spsw3[2] = (thgas + .4) / 2;
566 // 2 mm G10 Plate cover (NMATE = 808)
567 scpv3[0] = spsw3[0];
568 scpv3[1] = spsw3[1];
569 scpv3[2] = spsw3[2];
cfce8870 570 gMC->Gsvolu("DW12","BOX ", idtmed[607], spsw3, 3);
571 gMC->Gsatt("DW12", "SEEN", 1);
572 gMC->Gsvolu("DV12","BOX ", idtmed[607], spsw3, 3);
573 gMC->Gsatt("DV12", "SEEN", 1);
6edc06da 574
575 // --- place pads in a strip
576 xa = (-npad3 + 1.) * pad3 / 2.;
577 ya = 0.;
578 za = 0.;
579 for (i = 1; i <= npad3; ++i) {
cfce8870 580 gMC->Gsposp("DP13", i, "DS13", xa, ya, za, 0, "ONLY", spad3, 3);
581 gMC->Gsposp("DP14", i, "DS14", xa, ya, za, 0, "ONLY", spad3, 3);
6edc06da 582 xa += pad3;
583 }
584 // --- place strips in the PRESHOWER AND CPV boxes
585 xb = 0.;
586 yb = (-npad3 + 1.) * pad3 / 2.;
587 zb = 0.;
588 for (j = 1; j <= npad3; ++j) {
cfce8870 589 gMC->Gsposp("DS13", j, "DW12", xb, yb, zb, 0, "ONLY", sstr3, 3);
590 gMC->Gsposp("DS14", j, "DV12", xb, yb, zb, 0, "ONLY", sstr3, 3);
6edc06da 591 yb += pad3;
592 }
593
594 // **** PAD SIZE 15 MM
595
596 spad4[0] = (pad4 - thcell) / 2.;
597 spad4[1] = spad4[0];
598 spad4[2] = thgas / 2;
cfce8870 599 gMC->Gsvolu("DP15","BOX ", idtmed[604], spad4, 3);
600 gMC->Gsatt("DP15", "SEEN", 1);
601 gMC->Gsvolu("DP16","BOX ", idtmed[604], spad4, 3);
602 gMC->Gsatt("DP16", "SEEN", 1);
6edc06da 603
604 sstr4[0] = npad4 * pad4 / 2;
605 sstr4[1] = pad4 / 2;
606 sstr4[2] = thgas / 2;
cfce8870 607 gMC->Gsvolu("DS15","BOX ", idtmed[605], sstr4, 3);
608 gMC->Gsatt("DS15", "SEEN", 1);
609 gMC->Gsvolu("DS16","BOX ", idtmed[605], sstr4, 3);
610 gMC->Gsatt("DS16", "SEEN", 1);
6edc06da 611
612 spsw4[0] = sstr4[0] + edge;
613 spsw4[1] = spsw4[0];
614 spsw4[2] = (thgas + .4) / 2;
615 // 2 mm G10 Plate cover (NMATE = 808)
616 scpv4[0] = spsw4[0];
617 scpv4[1] = spsw4[1];
618 scpv4[2] = spsw4[2];
cfce8870 619 gMC->Gsvolu("DW13","BOX ", idtmed[607], spsw4, 3);
620 gMC->Gsatt("DW13", "SEEN", 1);
621 gMC->Gsvolu("DV13","BOX ", idtmed[607], spsw4, 3);
622 gMC->Gsatt("DV13", "SEEN", 1);
6edc06da 623
624 // --- place pads in a strip
625 xa = (-npad4 + 1.) * pad4 / 2.;
626 ya = 0.;
627 za = 0.;
628 for (i = 1; i <= npad4; ++i) {
cfce8870 629 gMC->Gsposp("DP15", i, "DS15", xa, ya, za, 0, "ONLY", spad4, 3);
630 gMC->Gsposp("DP16", i, "DS16", xa, ya, za, 0, "ONLY", spad4, 3);
6edc06da 631 xa += pad4;
632 }
633 // --- place strips in the PRESHOWER AND CPV boxes
634 xb = 0.;
635 yb = (-npad4 + 1.) * pad4 / 2.;
636 zb = 0.;
637 for (j = 1; j <= npad4; ++j) {
cfce8870 638 gMC->Gsposp("DS15", j, "DW13", xb, yb, zb, 0, "ONLY", sstr4, 3);
639 gMC->Gsposp("DS16", j, "DV13", xb, yb, zb, 0, "ONLY", sstr4, 3);
6edc06da 640 yb += pad4;
641 }
642
643
644 // --- DEFINE MODULES, IRON, TUNGSTEN AND LEAD VOLUMES
645
646
647 spb[0] = spsw1[0];
648 spb[1] = spsw1[1];
649 spb[2] = .75;
cfce8870 650 gMC->Gsvolu("DPPB","BOX ", idtmed[600], spb, 3);
651 gMC->Gsatt("DPPB", "SEEN", 1);
6edc06da 652
653 sw[0] = spsw1[0];
654 sw[1] = spsw1[1];
655 sw[2] = 0.9/2.;
cfce8870 656 gMC->Gsvolu("DPW ","BOX ", idtmed[600], sw, 3);
657 gMC->Gsatt("DPW ", "SEEN", 1);
6edc06da 658
659 sfe[0] = spsw1[0];
660 sfe[1] = spsw1[1];
661 sfe[2] = 0.6/2.;
cfce8870 662 gMC->Gsvolu("DPFE","BOX ", idtmed[605], sfe, 3);
663 gMC->Gsatt("DPFE", "SEEN", 1);
6edc06da 664
665 smod1[0] = spsw1[0];
666 smod1[1] = smod1[0];
667 // SMOD1(3)=SPSW1(3)+SFE(3)+SW (3)+SCPV1(3)
668 smod1[2] = spsw1[2] + sfe[2] + spb[2] + scpv1[2];
cfce8870 669 gMC->Gsvolu("DM21", "BOX ", idtmed[698], smod1, 3);
6edc06da 670
671 smod2[0] = spsw2[0];
672 smod2[1] = smod2[0];
673 smod2[2] = spsw2[2] + sfe[2] + spb[2] + scpv2[2];
cfce8870 674 gMC->Gsvolu("DM11", "BOX ", idtmed[698], smod2, 3);
6edc06da 675
676 smod3[0] = spsw3[0];
677 smod3[1] = smod3[0];
678 smod3[2] = spsw3[2] + sfe[2] + spb[2] + scpv3[2];
cfce8870 679 gMC->Gsvolu("DM12", "BOX ", idtmed[698], smod3, 3);
6edc06da 680
681 smod4[0] = spsw4[0];
682 smod4[1] = smod4[0];
683 smod4[2] = spsw4[2] + sfe[2] + spb[2] + scpv4[2];
cfce8870 684 gMC->Gsvolu("DM13", "BOX ", idtmed[698], smod4, 3);
6edc06da 685
686 // **** MODULE TYPE 1 : ALWAYS WITH TUNSGTEN CONVERTER
687
688 // *** try with PB once 8.6.97
689
690 // --- place gas box (as CPV), iron support, lead converter and gas box
691 // --- (preshower) in the module
692 xc = 0.;
693 yc = 0.;
694 // --- First the CPV box
695 zc = -(spsw1[2] + sfe[2] + spb[2] + spsw1[2]) + spsw1[2];
cfce8870 696 gMC->Gspos("DV21", 1, "DM21", xc, yc, zc, 0, "ONLY");
6edc06da 697 // --- Then iron support plate
698 zc = zc + sfe[2] + spsw1[2];
cfce8870 699 gMC->Gspos("DPFE", 1, "DM21", xc, yc, zc, 0, "ONLY");
6edc06da 700 // --- Then converter plate
701 zc = zc + sfe[2] + spb[2];
cfce8870 702 gMC->Gspos("DPPB", 1, "DM21", xc, yc, zc, 0, "ONLY");
6edc06da 703 // --- Lastly the preshower box
704 zc = zc + spb[2] + spsw1[2];
cfce8870 705 gMC->Gspos("DW21", 1, "DM21", xc, yc, zc, 0, "ONLY");
6edc06da 706
707 // **** MODULE TYPE 2
708
709 // --- place gas box (as CPV), iron support, lead converter and gas box
710 // --- (preshower) in the module
711 xc = 0.;
712 yc = 0.;
713 // --- First the CPV box
714 zc = -(spsw2[2] + sfe[2] + spb[2] + spsw2[2]) + spsw2[2];
cfce8870 715 gMC->Gspos("DV11", 1, "DM11", xc, yc, zc, 0, "ONLY");
6edc06da 716 // --- Then iron support plate
717 zc = zc + sfe[2] + spsw2[2];
cfce8870 718 gMC->Gspos("DPFE", 1, "DM11", xc, yc, zc, 0, "ONLY");
6edc06da 719 // --- Then lead converter plate
720 zc = zc + sfe[2] + spb[2];
cfce8870 721 gMC->Gspos("DPPB", 1, "DM11", xc, yc, zc, 0, "ONLY");
6edc06da 722 // --- Lastly the preshower box
723 zc = zc + spb[2] + spsw2[2];
cfce8870 724 gMC->Gspos("DW11", 1, "DM11", xc, yc, zc, 0, "ONLY");
6edc06da 725
726
727 // **** MODULE TYPE 3
728
729 // --- place gas box (as CPV), iron support, lead converter and gas box
730 // --- (preshower) in the module
731 xc = 0.;
732 yc = 0.;
733 // --- First the CPV box
734 zc = -(spsw3[2] + sfe[2] + spb[2] + spsw3[2]) + spsw3[2];
cfce8870 735 gMC->Gspos("DV12", 1, "DM12", xc, yc, zc, 0, "ONLY");
6edc06da 736 // --- Then iron support plate
737 zc = zc + sfe[2] + spsw3[2];
cfce8870 738 gMC->Gspos("DPFE", 1, "DM12", xc, yc, zc, 0, "ONLY");
6edc06da 739 // --- Then lead converter plate
740 zc = zc + sfe[2] + spb[2];
cfce8870 741 gMC->Gspos("DPPB", 1, "DM12", xc, yc, zc, 0, "ONLY");
6edc06da 742 // --- Lastly the preshower box
743 zc = zc + spb[2] + spsw3[2];
cfce8870 744 gMC->Gspos("DW12", 1, "DM12", xc, yc, zc, 0, "ONLY");
6edc06da 745
746
747 // **** MODULE TYPE 4
748
749 // --- place gas box (as CPV), iron support, lead converter and gas box
750 // --- (preshower) in the module
751 xc = 0.;
752 yc = 0.;
753 // --- First the CPV box
754 zc = -(spsw4[2] + sfe[2] + spb[2] + spsw4[2]) + spsw4[2];
cfce8870 755 gMC->Gspos("DV13", 1, "DM13", xc, yc, zc, 0, "ONLY");
6edc06da 756 // --- Then iron support plate
757 zc = zc + sfe[2] + spsw4[2];
cfce8870 758 gMC->Gspos("DPFE", 1, "DM13", xc, yc, zc, 0, "ONLY");
6edc06da 759 // --- Then lead converter plate
760 zc = zc + sfe[2] + spb[2];
cfce8870 761 gMC->Gspos("DPPB", 1, "DM13", xc, yc, zc, 0, "ONLY");
6edc06da 762 // --- Lastly the preshower box
763 zc = zc + spb[2] + spsw4[2];
cfce8870 764 gMC->Gspos("DW13", 1, "DM13", xc, yc, zc, 0, "ONLY");
6edc06da 765
766}
767
768//_____________________________________________________________________________
769void AliPMDv2::DrawModule()
770{
771 //
772 // Draw a shaded view of the Photon Multiplicity Detector
773 //
774
cfce8870 775 gMC->Gsatt("*", "seen", -1);
776 gMC->Gsatt("alic", "seen", 0);
6edc06da 777 //
778 // Set the visibility of the components
779 //
cfce8870 780 gMC->Gsatt("DP21","seen",0);
781 gMC->Gsatt("DP22","seen",0);
782 gMC->Gsatt("DS21","seen",1);
783 gMC->Gsatt("DS22","seen",1);
784 gMC->Gsatt("DW21","seen",0);
785 gMC->Gsatt("DV21","seen",0);
786 gMC->Gsatt("DP11","seen",0);
787 gMC->Gsatt("DP12","seen",0);
788 gMC->Gsatt("DS11","seen",1);
789 gMC->Gsatt("DS12","seen",1);
790 gMC->Gsatt("DW11","seen",0);
791 gMC->Gsatt("DV11","seen",0);
792 gMC->Gsatt("DP13","seen",0);
793 gMC->Gsatt("DP14","seen",0);
794 gMC->Gsatt("DS13","seen",1);
795 gMC->Gsatt("DS14","seen",1);
796 gMC->Gsatt("DW12","seen",0);
797 gMC->Gsatt("DV12","seen",0);
798 gMC->Gsatt("DP15","seen",0);
799 gMC->Gsatt("DP16","seen",0);
800 gMC->Gsatt("DS15","seen",1);
801 gMC->Gsatt("DS16","seen",1);
802 gMC->Gsatt("DW13","seen",0);
803 gMC->Gsatt("DV13","seen",0);
804 gMC->Gsatt("DPPB","seen",1);
805 gMC->Gsatt("DPW ","seen",1);
806 gMC->Gsatt("DPFE","seen",1);
807 gMC->Gsatt("DM21","seen",1);
808 gMC->Gsatt("DM11","seen",1);
809 gMC->Gsatt("DM12","seen",1);
810 gMC->Gsatt("DM13","seen",1);
811 gMC->Gsatt("DPMD","seen",0);
812 gMC->Gsatt("DIQU","seen",0);
6edc06da 813 //
cfce8870 814 gMC->Gdopt("hide", "on");
815 gMC->Gdopt("shad", "on");
816 gMC->Gsatt("*", "fill", 7);
817 gMC->SetClipBox(".");
818 gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
819 gMC->DefaultRange();
820 gMC->Gdraw("alic", 40, 30, 0, 22, 15.5, .04, .04);
821 gMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
822 gMC->Gdman(17, 5, "MAN");
823 gMC->Gdopt("hide", "off");
6edc06da 824}
825
826//_____________________________________________________________________________
827void AliPMDv2::CreateMaterials()
828{
829 //
830 // Create materials for the PMD version 1
831 //
832 // ORIGIN : Y. P. VIYOGI
833 //
834
6edc06da 835 // --- The Argon- CO2 mixture ---
836 Float_t ag[2] = { 39.95 };
837 Float_t zg[2] = { 18. };
838 Float_t wg[2] = { .8,.2 };
839 Float_t dar = .001782; // --- Ar density in g/cm3 ---
840 // --- CO2 ---
841 Float_t ac[2] = { 12.,16. };
842 Float_t zc[2] = { 6.,8. };
843 Float_t wc[2] = { 1.,2. };
844 Float_t dc = .001977;
845 Float_t dco = .002; // --- CO2 density in g/cm3 ---
846
847 Float_t absl, radl, a, d, z;
848 Float_t dg;
849 Float_t x0ar;
850 Float_t buf[1];
851 Int_t nbuf;
852
ad51aeb0 853 Int_t *idtmed = fIdtmed->GetArray()-599;
6edc06da 854 Int_t isxfld = gAlice->Field()->Integ();
855 Float_t sxmgmx = gAlice->Field()->Max();
856
857 // --- Define the various materials for GEANT ---
858 AliMaterial(1, "Pb $", 207.19, 82., 11.35, .56, 18.5);
859 x0ar = 19.55 / dar;
860 AliMaterial(2, "Argon$", 39.95, 18., dar, x0ar, 6.5e4);
861 AliMixture(3, "CO2 $", ac, zc, dc, -2, wc);
862 AliMaterial(4, "Al $", 26.98, 13., 2.7, 8.9, 18.5);
863 AliMaterial(6, "Fe $", 55.85, 26., 7.87, 1.76, 18.5);
864 AliMaterial(7, "W $", 183.85, 74., 19.3, .35, 10.3);
865 AliMaterial(8, "G10 $", 20., 10., 1.7, 19.4, 999);
866 AliMaterial(9, "SILIC$", 28.09, 14., 2.33, 9.36, 45.);
867 AliMaterial(10, "Be $", 9.01, 4., 1.848, 35.3, 36.7);
868 AliMaterial(15, "Cu $", 63.54, 29., 8.96, 1.43, 15.);
869 AliMaterial(16, "C $", 12.01, 6., 2.265, 18.8, 49.9);
870
871 AliMaterial(96, "MYLAR$", 8.73, 4.55, 1.39, 28.7, 62.);
872 AliMaterial(97, "CONCR$", 20., 10., 2.5, 10.7, 40.);
873 AliMaterial(98, "Vacum$", 1e-9, 1e-9, 1e-9, 1e16, 1e16);
874 AliMaterial(99, "Air $", 14.61, 7.3, .0012, 30420., 67500.);
875
876 // define gas-mixtures
877
878 char namate[21];
cfce8870 879 gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
6edc06da 880 ag[1] = a;
881 zg[1] = z;
882 dg = (dar * 4 + dco) / 5;
883 AliMixture(5, "ArCO2$", ag, zg, dg, 2, wg);
884
885 // Define tracking media
ad51aeb0 886 AliMedium(1, "Pb conv.$", 1, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
887 AliMedium(7, "W conv.$", 7, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
888 AliMedium(8, "G10plate$", 8, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
889 AliMedium(4, "Al $", 4, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
890 AliMedium(6, "Fe $", 6, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
891 AliMedium(5, "ArCO2 $", 5, 1, 0, isxfld, sxmgmx, .1, .1, .1, .1);
892 AliMedium(9, "SILICON $", 9, 1, 0, isxfld, sxmgmx, .1, .1, .1, .1);
893 AliMedium(10, "Be $", 10, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
894 AliMedium(98, "Vacuum $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .1, 10);
895 AliMedium(99, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .1, .1);
896 AliMedium(15, "Cu $", 15, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
897 AliMedium(16, "C $", 16, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
6edc06da 898
899 // --- Generate explicitly delta rays in the iron, aluminium and lead ---
cfce8870 900 gMC->Gstpar(idtmed[600], "LOSS", 3.);
901 gMC->Gstpar(idtmed[600], "DRAY", 1.);
6edc06da 902
cfce8870 903 gMC->Gstpar(idtmed[603], "LOSS", 3.);
904 gMC->Gstpar(idtmed[603], "DRAY", 1.);
6edc06da 905
cfce8870 906 gMC->Gstpar(idtmed[604], "LOSS", 3.);
907 gMC->Gstpar(idtmed[604], "DRAY", 1.);
6edc06da 908
cfce8870 909 gMC->Gstpar(idtmed[605], "LOSS", 3.);
910 gMC->Gstpar(idtmed[605], "DRAY", 1.);
6edc06da 911
cfce8870 912 gMC->Gstpar(idtmed[606], "LOSS", 3.);
913 gMC->Gstpar(idtmed[606], "DRAY", 1.);
6edc06da 914
cfce8870 915 gMC->Gstpar(idtmed[607], "LOSS", 3.);
916 gMC->Gstpar(idtmed[607], "DRAY", 1.);
6edc06da 917
918 // --- Energy cut-offs in the Pb and Al to gain time in tracking ---
919 // --- without affecting the hit patterns ---
cfce8870 920 gMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
921 gMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
922 gMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
923 gMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
924 gMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
925 gMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
926 gMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
927 gMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
928 gMC->Gstpar(idtmed[606], "CUTGAM", 1e-4);
929 gMC->Gstpar(idtmed[606], "CUTELE", 1e-4);
930 gMC->Gstpar(idtmed[606], "CUTNEU", 1e-4);
931 gMC->Gstpar(idtmed[606], "CUTHAD", 1e-4);
932 gMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
933 gMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
934 gMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
935 gMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
936 gMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
937 gMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
938 gMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
939 gMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
6edc06da 940
941 // --- Prevent particles stopping in the gas due to energy cut-off ---
cfce8870 942 gMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
943 gMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
944 gMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
945 gMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
946 gMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
6edc06da 947}
948
949//_____________________________________________________________________________
950void AliPMDv2::Init()
951{
952 //
953 // Initialises PMD detector after it has been built
954 //
955 Int_t i;
956 kdet=1;
957 //
958 printf("\n");
959 for(i=0;i<35;i++) printf("*");
960 printf(" PMD_INIT ");
961 for(i=0;i<35;i++) printf("*");
962 printf("\n");
963 printf(" PMD simulation package initialised\n");
964 printf(" parameters of pmd\n");
965 printf("%6d %10.2f %10.2f %10.2f %10.2f %10.2f\n",kdet,thmin,thmax,zdist,thlow,thhigh);
966 //
967 for(i=0;i<80;i++) printf("*");
968 printf("\n");
969 //
ad51aeb0 970 Int_t *idtmed = fIdtmed->GetArray()-599;
6edc06da 971 fMedSens=idtmed[605-1];
972}
973
974//_____________________________________________________________________________
975void AliPMDv2::StepManager()
976{
977 //
978 // Called at each step in the PMD
979 //
980 Int_t copy;
981 Float_t hits[4], destep;
982 Float_t center[3] = {0,0,0};
983 Int_t vol[5];
0a6d8768 984 const char *namep;
6edc06da 985
cfce8870 986 if(gMC->GetMedium() == fMedSens && (destep = gMC->Edep())) {
6edc06da 987
0a6d8768 988 gMC->CurrentVolID(copy);
6edc06da 989 vol[0]=copy;
0a6d8768 990 gMC->CurrentVolOffID(1,copy);
6edc06da 991 vol[1]=copy;
0a6d8768 992 gMC->CurrentVolOffID(2,copy);
993 namep=gMC->CurrentVolOffName(2);
6edc06da 994 vol[2]=copy;
995 if(strncmp(namep,"DW11",4))vol[2]=1;
996 if(strncmp(namep,"DV11",4))vol[2]=2;
0a6d8768 997 gMC->CurrentVolOffID(3,copy);
6edc06da 998 vol[3]=copy;
0a6d8768 999 gMC->CurrentVolOffID(4,copy);
6edc06da 1000 vol[4]=copy;
cfce8870 1001 gMC->Gdtom(center,hits,1);
6edc06da 1002 hits[3] = destep*1e9; //Number in eV
1003 AddHit(gAlice->CurrentTrack(), vol, hits);
1004 }
1005}