New versions of the PMD from S.Chattopadhyay.
[u/mrichter/AliRoot.git] / PMD / AliPMDv2.cxx
CommitLineData
6edc06da 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Photon Multiplicity Detector Version 1 //
4// //
5//Begin_Html
6/*
7<img src="gif/AliPMDv2Class.gif">
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 /*
197 <img src="gif/AliPMDv2.gif">
198 */
199 //End_Html
200 //Begin_Html
201 /*
202 <img src="gif/AliPMDv2Tree.gif">
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
228 Int_t *idtmed = gAlice->Idtmed();
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
243 AliMC* pMC = AliMC::GetMC();
244
245 pMC->Gsvolu("DPMD", "BOX ", idtmed[698], sipmd, 3);
246
247 // *** Define DIQU Volume and fill with air
248 siqad[0] = sipmd[0] / 2. - 1.;
249 siqad[1] = sipmd[1] / 2. - 1.;
250 siqad[2] = sipmd[2];
251 pMC->Gsvolu("DIQU","BOX ", idtmed[698], siqad, 3);
252 pMC->Gsatt("DIQU", "SEEN", 1);
253
254
255 // --- Place the modules in INSIDE PMD (DPMD)
256 // --- FIRST CALCULATE THE COORDINATES OF THE MODULES WHICH CAN BE
257 // --- ACCOMODATED.
258
259 kdet = 1;
260 Coordinates();
261
262 //inum = 0;
263 zd = 0.;
264 AliMatrix(idrotm[1], 90., 0., 90., 90., 0., 0.);
265 AliMatrix(idrotm[2], 90., 180., 90., 90., 0., 0.);
266 AliMatrix(idrotm[3], 90., 180., 90., 270., 0., 0.);
267 AliMatrix(idrotm[4], 90., 0., 90., 270., 0., 0.);
268 // **** Filling the DIQU Vol. (One Quadrant)
269 inum2 = 0;
270 inum3 = 0;
271 inum4 = 0;
272 for (i = 0; i < maxbox; ++i) {
273 i2 = maxbox;
274 for (j = 0; j < i2; ++j) {
275 if (xbox[j][i] <= 0 && ybox[j][i] <= 0) continue;
276 xd = xbox[j][i] - siqad[0];
277 yd = ybox[j][i] - siqad[1];
278 if (pindex[j][i] == 1) {
279 ++inum2;
280 pMC->Gsposp("DM11", inum2, "DIQU", xd, yd, zd, 0, "ONLY", smod2, 3);
281 }
282 if (pindex[j][i] == 2) {
283 ++inum3;
284 pMC->Gsposp("DM12", inum3, "DIQU", xd, yd, zd, 0, "ONLY", smod3, 3);
285 }
286 if (pindex[j][i] == 3) {
287 ++inum4;
288 pMC->Gsposp("DM13", inum4, "DIQU", xd, yd, zd, 0, "ONLY", smod4, 3);
289 }
290 }
291 }
292 xiqa[0] = siqad[0];
293 xiqa[1] = -siqad[0];
294 xiqa[2] = xiqa[1];
295 xiqa[3] = xiqa[0];
296 yiqa[0] = siqad[0];
297 yiqa[1] = yiqa[0];
298 yiqa[2] = -siqad[0];
299 yiqa[3] = yiqa[2];
300 i2 = numqu;
301 for (k = 1; k <= i2; ++k) {
302 pMC->Gsposp("DIQU", k, "DPMD", xiqa[k-1], yiqa[k-1], zd, idrotm[k], "ONLY", siqad, 3);
303 }
304
305 // --- Place the DPMD in ALICE with front edge 6.0m from vertex ---
306 xp = 0.;
307 yp = 0.;
308 zp = zdist1;
309 pMC->Gspos("DPMD", 1, "ALIC", xp, yp, zp, 0, "ONLY");
310
311}
312
313//_____________________________________________________________________________
314void AliPMDv2::CreatePads()
315{
316 //
317 // Create the geometry of the pads
318 // *** DEFINITION OF THE GEOMETRY OF THE PMD ***
319 // *** DIFFERENT PADS WITH SIZES 8 MM, 10 MM, 12 MM AND 15 MM SQUARE
320 // -- Author : Y.P. VIYOGI, 04/06/1997.
321 // -- Modified: P.V.K.S.Baba(JU), 13-12-97.
322
323 AliMC* pMC = AliMC::GetMC();
324
325 Int_t npad1, npad2, npad3, npad4;
326 Float_t spad1[3], spad2[3], spad3[3], spad4[3];
327 Float_t scpv1[3], scpv2[3], scpv3[3], scpv4[3];
328 Int_t i, j;
329 Float_t sstr1[3], spsw1[3], sstr2[3], spsw2[3], sstr3[3], spsw3[3],
330 sstr4[3], spsw4[3];
331 Float_t xa, ya, za, xb, yb, zb, xc, sw[3], yc, zc;
332 Float_t sfe[3];
333 Float_t spb[3], pad1, pad2, pad3, pad4;
334 // VOLUMES Names : begining with D for all PMD volumes,
335 // DMO1 : MODULE TYPE 1 ( 8 MM PADS)
336 // DM11 : MODULE TYPE 2 (10 MM PADS)
337 // DM12 : MODULE TYPE 3 (12 MM PADS)
338 // DM13 : MODULE TYPE 4 (15 MM PADS)
339
340 // The names of SIZE variables begin with S and have more meaningful
341 // characters as shown below.
342
343 // VOLUME SIZE MEDIUM : REMARKS
344 // ------ ----- ------ : ---------------------------
345
346 // DPPB SPB PB : PB Converter and its SIZE
347 // DPFE SFE FE : FE Support Plate and its SIZE
348
349 // DP11 SPAD2 GAS : PAD TYPE 2 (10 MM)
350 // DP12 SPAD2 GAS : PAD TYPE 2 FOR CPV(10 MM)
351 // DS11 SSTR2 FE : STRIP OF IRON
352 // DW11 SPSW2 G10 : PRESHOWER
353 // DV11 SCPV2 G10 : CPV
354
355 // DP13 SPAD3 GAS : PAD TYPE 3 (12 MM)
356 // DP14 SPAD3 GAS : PAD TYPE 3 FOR CPV(12 MM)
357 // DS12 SSTR3 FE : STRIP OF IRON
358 // DW12 SPSW3 G10 : PRESHOWER
359 // DV12 SCPV3 G10 : CPV
360
361 // DP15 SPAD4 GAS : PAD TYPE 4 (15 MM)
362 // DP16 SPAD4 GAS : PAD TYPE 4 FOR CPV(15 MM)
363 // DS13 SSTR4 FE : STRIP OF IRON
364 // DW13 SPSW4 G10 : PRESHOWER
365 // DV13 SCPV4 G10 : CPV
366
367 // ****************** VOLUME TREE ******************
368
369 // DM11 (Module)
370 // |
371 // |
372 // -------------------------------------------------
373 // | | | |
374 // | | | |
375 // DV11( CPV) DPFE DPPB DW11(Preshower)
376 // | |
377 // | |
378 // DS12(Strip) DS11(Strip)
379 // | |
380 // | |
381 // DP12(Pads) DP11(Pads)
382
383 // ************************************************************
384
385 // --- The above gives the Volume Tree. PAD is a gas cell of size
386 // --- given by PADSIZE in the input cards. STRIP is a collection of
387 //--- PADs in a row. STRIPs are positioned in the PRESHOWER BOX. This is
388 //--- then placed in the MODULE. The PSW and the MODULE have the same size
389 // --- ; Lead converter, Iron support plate are also placed
390 // --- in the MODULE.
391
392
393 // DATA PAD1,PAD2,PAD3,PAD4/4*0.8/
394 // DATA NPAD1,NPAD2,NPAD3,NPAD4/4*30/
395
396 Int_t *idtmed = gAlice->Idtmed();
397
398 // **** PAD SIZE 8 MM
399 // pmdin = fPar[0];
400 // pmdout = fPar[1];
401 thgas = fPar[2];
402 thcell = fPar[3];
403 thmin = fIn[0];
404 thmax = fIn[1];
405 zdist1 = fIn[2];
406 zdist = TMath::Abs(zdist1);
407 thlow = fIn[3];
408 thhigh = fIn[4];
409 // wafer = fGeo[0];
410 edge = fGeo[1];
411 numqu = Int_t(fGeo[2]);
412
413
414 // *BABA
415 pad1 = fPadSize[0];
416 pad2 = fPadSize[1];
417 pad3 = fPadSize[2];
418 pad4 = fPadSize[3];
419 npad1 = Int_t(24/fPadSize[0]);
420 npad2 = Int_t(24/fPadSize[1]);
421 npad3 = Int_t(24/fPadSize[2]);
422 npad4 = Int_t(24/fPadSize[3]);
423 // *BABA
424 spad1[0] = (pad1 - thcell) / 2.;
425 spad1[1] = spad1[0];
426 spad1[2] = thgas / 2;
427 pMC->Gsvolu("DP21", "BOX ", idtmed[604], spad1, 3);
428 pMC->Gsatt("DP21", "SEEN", 1);
429 pMC->Gsvolu("DP22", "BOX ", idtmed[604], spad1, 3);
430 pMC->Gsatt("DP22", "SEEN", 1);
431
432 sstr1[0] = npad1*pad1/2;
433 sstr1[1] = pad1/2;
434 sstr1[2] = thgas/2;
435 pMC->Gsvolu("DS21", "BOX ", idtmed[605], sstr1, 3);
436 pMC->Gsatt("DS21", "SEEN", 1);
437 pMC->Gsvolu("DS22", "BOX ", idtmed[605], sstr1, 3);
438 pMC->Gsatt("DS22", "SEEN", 1);
439
440 spsw1[0] = sstr1[0] + edge;
441 spsw1[1] = spsw1[0];
442 spsw1[2] = (thgas + .4) / 2;
443 // 2 mm G10 Plate cover (NMATE = 808)
444 scpv1[0] = spsw1[0];
445 scpv1[1] = spsw1[1];
446 scpv1[2] = spsw1[2];
447 pMC->Gsvolu("DW21", "BOX ", idtmed[607], spsw1, 3);
448 pMC->Gsatt("DW21", "SEEN", 1);
449 pMC->Gsvolu("DV21", "BOX ", idtmed[607], spsw1, 3);
450 pMC->Gsatt("DV21", "SEEN", 1);
451
452 // --- place pads in a strip
453 xa = (-npad1 + 1.) * pad1 / 2.;
454 ya = 0.;
455 za = 0.;
456 for (i = 1; i <= npad1; ++i) {
457 pMC->Gsposp("DP21", i, "DS21", xa, ya, za, 0, "ONLY", spad1, 3);
458 pMC->Gsposp("DP22", i, "DS22", xa, ya, za, 0, "ONLY", spad1, 3);
459 xa += pad1;
460 }
461 // --- place strips in the PRESHOWER AND CPV boxes
462 xb = 0.;
463 yb = (-npad1 + 1.) * pad1 / 2.;
464 zb = 0.;
465 for (j = 1; j <= npad1; ++j) {
466 pMC->Gsposp("DS21", j, "DW21", xb, yb, zb, 0, "ONLY", sstr1, 3);
467 pMC->Gsposp("DS22", j, "DV21", xb, yb, zb, 0, "ONLY", sstr1, 3);
468 yb += pad1;
469 }
470
471 // **** PAD SIZE 10 MM
472
473 spad2[0] = (pad2 - thcell) / 2.;
474 spad2[1] = spad2[0];
475 spad2[2] = thgas / 2;
476 pMC->Gsvolu("DP11", "BOX ", idtmed[604], spad2, 3);
477 pMC->Gsatt("DP11", "SEEN", 1);
478 pMC->Gsvolu("DP12", "BOX ", idtmed[604], spad2, 3);
479 pMC->Gsatt("DP12", "SEEN", 1);
480
481 sstr2[0] = npad2 * pad2 / 2;
482 sstr2[1] = pad2 / 2;
483 sstr2[2] = thgas / 2;
484 pMC->Gsvolu("DS11", "BOX ", idtmed[605], sstr2, 3);
485 pMC->Gsatt("DS11", "SEEN", 1);
486 pMC->Gsvolu("DS12", "BOX ", idtmed[605], sstr2, 3);
487 pMC->Gsatt("DS12", "SEEN", 1);
488
489 spsw2[0] = sstr2[0] + edge;
490 spsw2[1] = spsw2[0];
491 spsw2[2] = (thgas + .4) / 2;
492 // 2 mm G10 Plate cover (NMATE = 808)
493 scpv2[0] = spsw2[0];
494 scpv2[1] = spsw2[1];
495 scpv2[2] = spsw2[2];
496 pMC->Gsvolu("DW11","BOX ", idtmed[607], spsw2, 3);
497 pMC->Gsatt("DW11", "SEEN", 1);
498 pMC->Gsvolu("DV11","BOX ", idtmed[607], spsw2, 3);
499 pMC->Gsatt("DV11", "SEEN", 1);
500
501 // --- place pads in a strip
502 xa = (-npad2 + 1.) * pad2 / 2.;
503 ya = 0.;
504 za = 0.;
505 for (i = 1; i <= npad2; ++i) {
506 pMC->Gsposp("DP11", i, "DS11", xa, ya, za, 0, "ONLY", spad2, 3);
507 pMC->Gsposp("DP12", i, "DS12", xa, ya, za, 0, "ONLY", spad2, 3);
508 xa += pad2;
509 }
510 // --- place strips in the PRESHOWER AND CPV boxes
511 xb = 0.;
512 yb = (-npad2 + 1.) * pad2 / 2.;
513 zb = 0.;
514 for (j = 1; j <= npad2; ++j) {
515 pMC->Gsposp("DS11", j, "DW11", xb, yb, zb, 0, "ONLY", sstr2, 3);
516 pMC->Gsposp("DS12", j, "DV11", xb, yb, zb, 0, "ONLY", sstr2, 3);
517 yb += pad2;
518 }
519
520 // **** PAD SIZE 12 MM
521
522 spad3[0] = (pad3 - thcell) / 2.;
523 spad3[1] = spad3[0];
524 spad3[2] = thgas / 2;
525 pMC->Gsvolu("DP13", "BOX ", idtmed[604], spad3, 3);
526 pMC->Gsatt("DP13", "SEEN", 1);
527 pMC->Gsvolu("DP14", "BOX ", idtmed[604], spad3, 3);
528 pMC->Gsatt("DP14", "SEEN", 1);
529
530 sstr3[0] = npad3 * pad3 / 2;
531 sstr3[1] = pad3 / 2;
532 sstr3[2] = thgas / 2;
533 pMC->Gsvolu("DS13", "BOX ", idtmed[605], sstr3, 3);
534 pMC->Gsatt("DS13", "SEEN", 1);
535 pMC->Gsvolu("DS14", "BOX ", idtmed[605], sstr3, 3);
536 pMC->Gsatt("DS14", "SEEN", 1);
537
538 spsw3[0] = sstr3[0] + edge;
539 spsw3[1] = spsw3[0];
540 spsw3[2] = (thgas + .4) / 2;
541 // 2 mm G10 Plate cover (NMATE = 808)
542 scpv3[0] = spsw3[0];
543 scpv3[1] = spsw3[1];
544 scpv3[2] = spsw3[2];
545 pMC->Gsvolu("DW12","BOX ", idtmed[607], spsw3, 3);
546 pMC->Gsatt("DW12", "SEEN", 1);
547 pMC->Gsvolu("DV12","BOX ", idtmed[607], spsw3, 3);
548 pMC->Gsatt("DV12", "SEEN", 1);
549
550 // --- place pads in a strip
551 xa = (-npad3 + 1.) * pad3 / 2.;
552 ya = 0.;
553 za = 0.;
554 for (i = 1; i <= npad3; ++i) {
555 pMC->Gsposp("DP13", i, "DS13", xa, ya, za, 0, "ONLY", spad3, 3);
556 pMC->Gsposp("DP14", i, "DS14", xa, ya, za, 0, "ONLY", spad3, 3);
557 xa += pad3;
558 }
559 // --- place strips in the PRESHOWER AND CPV boxes
560 xb = 0.;
561 yb = (-npad3 + 1.) * pad3 / 2.;
562 zb = 0.;
563 for (j = 1; j <= npad3; ++j) {
564 pMC->Gsposp("DS13", j, "DW12", xb, yb, zb, 0, "ONLY", sstr3, 3);
565 pMC->Gsposp("DS14", j, "DV12", xb, yb, zb, 0, "ONLY", sstr3, 3);
566 yb += pad3;
567 }
568
569 // **** PAD SIZE 15 MM
570
571 spad4[0] = (pad4 - thcell) / 2.;
572 spad4[1] = spad4[0];
573 spad4[2] = thgas / 2;
574 pMC->Gsvolu("DP15","BOX ", idtmed[604], spad4, 3);
575 pMC->Gsatt("DP15", "SEEN", 1);
576 pMC->Gsvolu("DP16","BOX ", idtmed[604], spad4, 3);
577 pMC->Gsatt("DP16", "SEEN", 1);
578
579 sstr4[0] = npad4 * pad4 / 2;
580 sstr4[1] = pad4 / 2;
581 sstr4[2] = thgas / 2;
582 pMC->Gsvolu("DS15","BOX ", idtmed[605], sstr4, 3);
583 pMC->Gsatt("DS15", "SEEN", 1);
584 pMC->Gsvolu("DS16","BOX ", idtmed[605], sstr4, 3);
585 pMC->Gsatt("DS16", "SEEN", 1);
586
587 spsw4[0] = sstr4[0] + edge;
588 spsw4[1] = spsw4[0];
589 spsw4[2] = (thgas + .4) / 2;
590 // 2 mm G10 Plate cover (NMATE = 808)
591 scpv4[0] = spsw4[0];
592 scpv4[1] = spsw4[1];
593 scpv4[2] = spsw4[2];
594 pMC->Gsvolu("DW13","BOX ", idtmed[607], spsw4, 3);
595 pMC->Gsatt("DW13", "SEEN", 1);
596 pMC->Gsvolu("DV13","BOX ", idtmed[607], spsw4, 3);
597 pMC->Gsatt("DV13", "SEEN", 1);
598
599 // --- place pads in a strip
600 xa = (-npad4 + 1.) * pad4 / 2.;
601 ya = 0.;
602 za = 0.;
603 for (i = 1; i <= npad4; ++i) {
604 pMC->Gsposp("DP15", i, "DS15", xa, ya, za, 0, "ONLY", spad4, 3);
605 pMC->Gsposp("DP16", i, "DS16", xa, ya, za, 0, "ONLY", spad4, 3);
606 xa += pad4;
607 }
608 // --- place strips in the PRESHOWER AND CPV boxes
609 xb = 0.;
610 yb = (-npad4 + 1.) * pad4 / 2.;
611 zb = 0.;
612 for (j = 1; j <= npad4; ++j) {
613 pMC->Gsposp("DS15", j, "DW13", xb, yb, zb, 0, "ONLY", sstr4, 3);
614 pMC->Gsposp("DS16", j, "DV13", xb, yb, zb, 0, "ONLY", sstr4, 3);
615 yb += pad4;
616 }
617
618
619 // --- DEFINE MODULES, IRON, TUNGSTEN AND LEAD VOLUMES
620
621
622 spb[0] = spsw1[0];
623 spb[1] = spsw1[1];
624 spb[2] = .75;
625 pMC->Gsvolu("DPPB","BOX ", idtmed[600], spb, 3);
626 pMC->Gsatt("DPPB", "SEEN", 1);
627
628 sw[0] = spsw1[0];
629 sw[1] = spsw1[1];
630 sw[2] = 0.9/2.;
631 pMC->Gsvolu("DPW ","BOX ", idtmed[600], sw, 3);
632 pMC->Gsatt("DPW ", "SEEN", 1);
633
634 sfe[0] = spsw1[0];
635 sfe[1] = spsw1[1];
636 sfe[2] = 0.6/2.;
637 pMC->Gsvolu("DPFE","BOX ", idtmed[605], sfe, 3);
638 pMC->Gsatt("DPFE", "SEEN", 1);
639
640 smod1[0] = spsw1[0];
641 smod1[1] = smod1[0];
642 // SMOD1(3)=SPSW1(3)+SFE(3)+SW (3)+SCPV1(3)
643 smod1[2] = spsw1[2] + sfe[2] + spb[2] + scpv1[2];
644 pMC->Gsvolu("DM21", "BOX ", idtmed[698], smod1, 3);
645
646 smod2[0] = spsw2[0];
647 smod2[1] = smod2[0];
648 smod2[2] = spsw2[2] + sfe[2] + spb[2] + scpv2[2];
649 pMC->Gsvolu("DM11", "BOX ", idtmed[698], smod2, 3);
650
651 smod3[0] = spsw3[0];
652 smod3[1] = smod3[0];
653 smod3[2] = spsw3[2] + sfe[2] + spb[2] + scpv3[2];
654 pMC->Gsvolu("DM12", "BOX ", idtmed[698], smod3, 3);
655
656 smod4[0] = spsw4[0];
657 smod4[1] = smod4[0];
658 smod4[2] = spsw4[2] + sfe[2] + spb[2] + scpv4[2];
659 pMC->Gsvolu("DM13", "BOX ", idtmed[698], smod4, 3);
660
661 // **** MODULE TYPE 1 : ALWAYS WITH TUNSGTEN CONVERTER
662
663 // *** try with PB once 8.6.97
664
665 // --- place gas box (as CPV), iron support, lead converter and gas box
666 // --- (preshower) in the module
667 xc = 0.;
668 yc = 0.;
669 // --- First the CPV box
670 zc = -(spsw1[2] + sfe[2] + spb[2] + spsw1[2]) + spsw1[2];
671 pMC->Gspos("DV21", 1, "DM21", xc, yc, zc, 0, "ONLY");
672 // --- Then iron support plate
673 zc = zc + sfe[2] + spsw1[2];
674 pMC->Gspos("DPFE", 1, "DM21", xc, yc, zc, 0, "ONLY");
675 // --- Then converter plate
676 zc = zc + sfe[2] + spb[2];
677 pMC->Gspos("DPPB", 1, "DM21", xc, yc, zc, 0, "ONLY");
678 // --- Lastly the preshower box
679 zc = zc + spb[2] + spsw1[2];
680 pMC->Gspos("DW21", 1, "DM21", xc, yc, zc, 0, "ONLY");
681
682 // **** MODULE TYPE 2
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 = -(spsw2[2] + sfe[2] + spb[2] + spsw2[2]) + spsw2[2];
690 pMC->Gspos("DV11", 1, "DM11", xc, yc, zc, 0, "ONLY");
691 // --- Then iron support plate
692 zc = zc + sfe[2] + spsw2[2];
693 pMC->Gspos("DPFE", 1, "DM11", xc, yc, zc, 0, "ONLY");
694 // --- Then lead converter plate
695 zc = zc + sfe[2] + spb[2];
696 pMC->Gspos("DPPB", 1, "DM11", xc, yc, zc, 0, "ONLY");
697 // --- Lastly the preshower box
698 zc = zc + spb[2] + spsw2[2];
699 pMC->Gspos("DW11", 1, "DM11", xc, yc, zc, 0, "ONLY");
700
701
702 // **** MODULE TYPE 3
703
704 // --- place gas box (as CPV), iron support, lead converter and gas box
705 // --- (preshower) in the module
706 xc = 0.;
707 yc = 0.;
708 // --- First the CPV box
709 zc = -(spsw3[2] + sfe[2] + spb[2] + spsw3[2]) + spsw3[2];
710 pMC->Gspos("DV12", 1, "DM12", xc, yc, zc, 0, "ONLY");
711 // --- Then iron support plate
712 zc = zc + sfe[2] + spsw3[2];
713 pMC->Gspos("DPFE", 1, "DM12", xc, yc, zc, 0, "ONLY");
714 // --- Then lead converter plate
715 zc = zc + sfe[2] + spb[2];
716 pMC->Gspos("DPPB", 1, "DM12", xc, yc, zc, 0, "ONLY");
717 // --- Lastly the preshower box
718 zc = zc + spb[2] + spsw3[2];
719 pMC->Gspos("DW12", 1, "DM12", xc, yc, zc, 0, "ONLY");
720
721
722 // **** MODULE TYPE 4
723
724 // --- place gas box (as CPV), iron support, lead converter and gas box
725 // --- (preshower) in the module
726 xc = 0.;
727 yc = 0.;
728 // --- First the CPV box
729 zc = -(spsw4[2] + sfe[2] + spb[2] + spsw4[2]) + spsw4[2];
730 pMC->Gspos("DV13", 1, "DM13", xc, yc, zc, 0, "ONLY");
731 // --- Then iron support plate
732 zc = zc + sfe[2] + spsw4[2];
733 pMC->Gspos("DPFE", 1, "DM13", xc, yc, zc, 0, "ONLY");
734 // --- Then lead converter plate
735 zc = zc + sfe[2] + spb[2];
736 pMC->Gspos("DPPB", 1, "DM13", xc, yc, zc, 0, "ONLY");
737 // --- Lastly the preshower box
738 zc = zc + spb[2] + spsw4[2];
739 pMC->Gspos("DW13", 1, "DM13", xc, yc, zc, 0, "ONLY");
740
741}
742
743//_____________________________________________________________________________
744void AliPMDv2::DrawModule()
745{
746 //
747 // Draw a shaded view of the Photon Multiplicity Detector
748 //
749
750 AliMC* pMC = AliMC::GetMC();
751
752 pMC->Gsatt("*", "seen", -1);
753 pMC->Gsatt("alic", "seen", 0);
754 //
755 // Set the visibility of the components
756 //
757 pMC->Gsatt("DP21","seen",0);
758 pMC->Gsatt("DP22","seen",0);
759 pMC->Gsatt("DS21","seen",1);
760 pMC->Gsatt("DS22","seen",1);
761 pMC->Gsatt("DW21","seen",0);
762 pMC->Gsatt("DV21","seen",0);
763 pMC->Gsatt("DP11","seen",0);
764 pMC->Gsatt("DP12","seen",0);
765 pMC->Gsatt("DS11","seen",1);
766 pMC->Gsatt("DS12","seen",1);
767 pMC->Gsatt("DW11","seen",0);
768 pMC->Gsatt("DV11","seen",0);
769 pMC->Gsatt("DP13","seen",0);
770 pMC->Gsatt("DP14","seen",0);
771 pMC->Gsatt("DS13","seen",1);
772 pMC->Gsatt("DS14","seen",1);
773 pMC->Gsatt("DW12","seen",0);
774 pMC->Gsatt("DV12","seen",0);
775 pMC->Gsatt("DP15","seen",0);
776 pMC->Gsatt("DP16","seen",0);
777 pMC->Gsatt("DS15","seen",1);
778 pMC->Gsatt("DS16","seen",1);
779 pMC->Gsatt("DW13","seen",0);
780 pMC->Gsatt("DV13","seen",0);
781 pMC->Gsatt("DPPB","seen",1);
782 pMC->Gsatt("DPW ","seen",1);
783 pMC->Gsatt("DPFE","seen",1);
784 pMC->Gsatt("DM21","seen",1);
785 pMC->Gsatt("DM11","seen",1);
786 pMC->Gsatt("DM12","seen",1);
787 pMC->Gsatt("DM13","seen",1);
788 pMC->Gsatt("DPMD","seen",0);
789 pMC->Gsatt("DIQU","seen",0);
790 //
791 pMC->Gdopt("hide", "on");
792 pMC->Gdopt("shad", "on");
793 pMC->Gsatt("*", "fill", 7);
794 pMC->SetClipBox(".");
795 pMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
796 pMC->DefaultRange();
797 pMC->Gdraw("alic", 40, 30, 0, 22, 15.5, .04, .04);
798 pMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
799 pMC->Gdman(17, 5, "MAN");
800 pMC->Gdopt("hide", "off");
801}
802
803//_____________________________________________________________________________
804void AliPMDv2::CreateMaterials()
805{
806 //
807 // Create materials for the PMD version 1
808 //
809 // ORIGIN : Y. P. VIYOGI
810 //
811
812 AliMC* pMC = AliMC::GetMC();
813
814 // --- The Argon- CO2 mixture ---
815 Float_t ag[2] = { 39.95 };
816 Float_t zg[2] = { 18. };
817 Float_t wg[2] = { .8,.2 };
818 Float_t dar = .001782; // --- Ar density in g/cm3 ---
819 // --- CO2 ---
820 Float_t ac[2] = { 12.,16. };
821 Float_t zc[2] = { 6.,8. };
822 Float_t wc[2] = { 1.,2. };
823 Float_t dc = .001977;
824 Float_t dco = .002; // --- CO2 density in g/cm3 ---
825
826 Float_t absl, radl, a, d, z;
827 Float_t dg;
828 Float_t x0ar;
829 Float_t buf[1];
830 Int_t nbuf;
831
832 Int_t *idtmed = gAlice->Idtmed();
833 Int_t isxfld = gAlice->Field()->Integ();
834 Float_t sxmgmx = gAlice->Field()->Max();
835
836 // --- Define the various materials for GEANT ---
837 AliMaterial(1, "Pb $", 207.19, 82., 11.35, .56, 18.5);
838 x0ar = 19.55 / dar;
839 AliMaterial(2, "Argon$", 39.95, 18., dar, x0ar, 6.5e4);
840 AliMixture(3, "CO2 $", ac, zc, dc, -2, wc);
841 AliMaterial(4, "Al $", 26.98, 13., 2.7, 8.9, 18.5);
842 AliMaterial(6, "Fe $", 55.85, 26., 7.87, 1.76, 18.5);
843 AliMaterial(7, "W $", 183.85, 74., 19.3, .35, 10.3);
844 AliMaterial(8, "G10 $", 20., 10., 1.7, 19.4, 999);
845 AliMaterial(9, "SILIC$", 28.09, 14., 2.33, 9.36, 45.);
846 AliMaterial(10, "Be $", 9.01, 4., 1.848, 35.3, 36.7);
847 AliMaterial(15, "Cu $", 63.54, 29., 8.96, 1.43, 15.);
848 AliMaterial(16, "C $", 12.01, 6., 2.265, 18.8, 49.9);
849
850 AliMaterial(96, "MYLAR$", 8.73, 4.55, 1.39, 28.7, 62.);
851 AliMaterial(97, "CONCR$", 20., 10., 2.5, 10.7, 40.);
852 AliMaterial(98, "Vacum$", 1e-9, 1e-9, 1e-9, 1e16, 1e16);
853 AliMaterial(99, "Air $", 14.61, 7.3, .0012, 30420., 67500.);
854
855 // define gas-mixtures
856
857 char namate[21];
858 pMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
859 ag[1] = a;
860 zg[1] = z;
861 dg = (dar * 4 + dco) / 5;
862 AliMixture(5, "ArCO2$", ag, zg, dg, 2, wg);
863
864 // Define tracking media
865 AliMedium(601, "Pb conv.$", 1, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
866 AliMedium(607, "W conv.$", 7, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
867 AliMedium(608, "G10plate$", 8, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
868 AliMedium(604, "Al $", 4, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
869 AliMedium(606, "Fe $", 6, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
870 AliMedium(605, "ArCO2 $", 5, 1, 0, isxfld, sxmgmx, .1, .1, .1, .1);
871 AliMedium(609, "SILICON $", 9, 1, 0, isxfld, sxmgmx, .1, .1, .1, .1);
872 AliMedium(610, "Be $", 10, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
873 AliMedium(698, "Vacuum $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .1, 10);
874 AliMedium(699, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .1, .1);
875 AliMedium(615, "Cu $", 15, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
876 AliMedium(616, "C $", 16, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
877
878 // --- Generate explicitly delta rays in the iron, aluminium and lead ---
879 pMC->Gstpar(idtmed[600], "LOSS", 3.);
880 pMC->Gstpar(idtmed[600], "DRAY", 1.);
881
882 pMC->Gstpar(idtmed[603], "LOSS", 3.);
883 pMC->Gstpar(idtmed[603], "DRAY", 1.);
884
885 pMC->Gstpar(idtmed[604], "LOSS", 3.);
886 pMC->Gstpar(idtmed[604], "DRAY", 1.);
887
888 pMC->Gstpar(idtmed[605], "LOSS", 3.);
889 pMC->Gstpar(idtmed[605], "DRAY", 1.);
890
891 pMC->Gstpar(idtmed[606], "LOSS", 3.);
892 pMC->Gstpar(idtmed[606], "DRAY", 1.);
893
894 pMC->Gstpar(idtmed[607], "LOSS", 3.);
895 pMC->Gstpar(idtmed[607], "DRAY", 1.);
896
897 // --- Energy cut-offs in the Pb and Al to gain time in tracking ---
898 // --- without affecting the hit patterns ---
899 pMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
900 pMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
901 pMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
902 pMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
903 pMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
904 pMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
905 pMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
906 pMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
907 pMC->Gstpar(idtmed[606], "CUTGAM", 1e-4);
908 pMC->Gstpar(idtmed[606], "CUTELE", 1e-4);
909 pMC->Gstpar(idtmed[606], "CUTNEU", 1e-4);
910 pMC->Gstpar(idtmed[606], "CUTHAD", 1e-4);
911 pMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
912 pMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
913 pMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
914 pMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
915 pMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
916 pMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
917 pMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
918 pMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
919
920 // --- Prevent particles stopping in the gas due to energy cut-off ---
921 pMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
922 pMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
923 pMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
924 pMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
925 pMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
926}
927
928//_____________________________________________________________________________
929void AliPMDv2::Init()
930{
931 //
932 // Initialises PMD detector after it has been built
933 //
934 Int_t i;
935 kdet=1;
936 //
937 printf("\n");
938 for(i=0;i<35;i++) printf("*");
939 printf(" PMD_INIT ");
940 for(i=0;i<35;i++) printf("*");
941 printf("\n");
942 printf(" PMD simulation package initialised\n");
943 printf(" parameters of pmd\n");
944 printf("%6d %10.2f %10.2f %10.2f %10.2f %10.2f\n",kdet,thmin,thmax,zdist,thlow,thhigh);
945 //
946 for(i=0;i<80;i++) printf("*");
947 printf("\n");
948 //
949 Int_t *idtmed = gAlice->Idtmed();
950 fMedSens=idtmed[605-1];
951}
952
953//_____________________________________________________________________________
954void AliPMDv2::StepManager()
955{
956 //
957 // Called at each step in the PMD
958 //
959 Int_t copy;
960 Float_t hits[4], destep;
961 Float_t center[3] = {0,0,0};
962 Int_t vol[5];
963 Text_t namep[5];
964
965 AliMC* pMC=AliMC::GetMC();
966 if(pMC->GetMedium() == fMedSens && (destep = pMC->Edep())) {
967
968 pMC->CurrentVol(namep, copy);
969 vol[0]=copy;
970 pMC->CurrentVolOff(1,namep,copy);
971 vol[1]=copy;
972 pMC->CurrentVolOff(2,namep,copy);
973 vol[2]=copy;
974 if(strncmp(namep,"DW11",4))vol[2]=1;
975 if(strncmp(namep,"DV11",4))vol[2]=2;
976 pMC->CurrentVolOff(3,namep,copy);
977 vol[3]=copy;
978 pMC->CurrentVolOff(4,namep,copy);
979 vol[4]=copy;
980 pMC->Gdtom(center,hits,1);
981 hits[3] = destep*1e9; //Number in eV
982 AddHit(gAlice->CurrentTrack(), vol, hits);
983 }
984}