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