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