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