Correction suggested by M. Masera
[u/mrichter/AliRoot.git] / ZDC / AliZDCv1.cxx
CommitLineData
68ca986e 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$
bdee0299 18Revision 1.7 2000/11/30 17:23:47 coppedis
19Remove first corrector dipole and introduce digitization
20
5ce39387 21Revision 1.6 2000/11/22 11:33:10 coppedis
22Major code revision
23
866ab5a2 24Revision 1.5 2000/10/02 21:28:20 fca
25Removal of useless dependecies via forward declarations
26
27Revision 1.3.2.1 2000/08/24 09:25:47 hristov
28Patch by P.Hristov: Bug in ZDC geometry corrected by E.Scomparin
29
94de3818 30Revision 1.4 2000/08/24 09:23:59 hristov
31Bug in ZDC geometry corrected by E.Scomparin
32
0500bdfc 33Revision 1.3 2000/07/12 06:59:16 fca
34Fixing dimension of hits array
35
366ff5c2 36Revision 1.2 2000/07/11 11:12:34 fca
37Some syntax corrections for non standard HP aCC
38
c0ceba4c 39Revision 1.1 2000/07/10 13:58:01 fca
40New version of ZDC from E.Scomparin & C.Oppedisano
41
68ca986e 42Revision 1.7 2000/01/19 17:17:40 fca
43
44Revision 1.6 1999/09/29 09:24:35 fca
45Introduction of the Copyright and cvs Log
46
47*/
48
49///////////////////////////////////////////////////////////////////////////////
50// //
51// Zero Degree Calorimeter //
866ab5a2 52// This class contains the basic functions for the ZDC //
53// Functions specific to one particular geometry are //
68ca986e 54// contained in the derived classes //
55// //
56///////////////////////////////////////////////////////////////////////////////
57
5ce39387 58// --- ROOT system
68ca986e 59#include <TBRIK.h>
60#include <TNode.h>
61#include <TMath.h>
5ce39387 62#include <TRandom.h>
866ab5a2 63#include <TSystem.h>
5ce39387 64#include <TTree.h>
68ca986e 65
66#include "stdio.h"
5ce39387 67
68// --- AliRoot classes
68ca986e 69#include "AliZDCv1.h"
5ce39387 70#include "AliZDCHit.h"
71#include "AliZDCDigit.h"
68ca986e 72#include "AliRun.h"
5ce39387 73#include "AliDetector.h"
94de3818 74#include "AliMagF.h"
68ca986e 75#include "AliMC.h"
76#include "AliCallf77.h"
77#include "AliConst.h"
78#include "AliPDG.h"
5ce39387 79#include "TLorentzVector.h"
68ca986e 80
81
82ClassImp(AliZDCv1)
83
84
85///////////////////////////////////////////////////////////////////////////////
86// //
87// Zero Degree Calorimeter version 1 //
88// //
89///////////////////////////////////////////////////////////////////////////////
90
91//_____________________________________________________________________________
92AliZDCv1::AliZDCv1() : AliZDC()
93{
94 //
95 // Default constructor for Zero Degree Calorimeter
96 //
5ce39387 97
866ab5a2 98 fMedSensF1 = 0;
99 fMedSensF2 = 0;
100 fMedSensZN = 0;
101 fMedSensZP = 0;
102 fMedSensGR = 0;
103 fMedSensZEM = 0;
104 fMedSensPI = 0;
105 fNoShower = 0;
68ca986e 106}
107
108//_____________________________________________________________________________
109AliZDCv1::AliZDCv1(const char *name, const char *title)
110 : AliZDC(name,title)
111{
112 //
113 // Standard constructor for Zero Degree Calorimeter
114 //
5ce39387 115
116 fDigits = new TClonesArray("AliZDCDigit",1000);
117
866ab5a2 118 fMedSensF1 = 0;
119 fMedSensF2 = 0;
120 fMedSensZN = 0;
121 fMedSensZP = 0;
122 fMedSensGR = 0;
123 fMedSensZEM = 0;
124 fMedSensPI = 0;
125 fNoShower = 0;
68ca986e 126}
127
128//_____________________________________________________________________________
129void AliZDCv1::CreateGeometry()
130{
131 //
132 // Create the geometry for the Zero Degree Calorimeter version 1
133 //* Initialize COMMON block ZDC_CGEOM
134 //*
135
136 CreateBeamLine();
137 CreateZDC();
138}
139
140//_____________________________________________________________________________
141void AliZDCv1::CreateBeamLine()
142{
143
144 Float_t angle;
145 Float_t zq, conpar[9], elpar[3], tubpar[3];
146 Int_t im1, im2;
147 Float_t zd1, zd2;
148
149
150 Int_t *idtmed = fIdtmed->GetArray();
151
152 // -- Mother of the ZDC
153
154 conpar[0] = 0.;
155 conpar[1] = 360.;
156 conpar[2] = 2.;
0500bdfc 157 conpar[3] = 805.;
68ca986e 158 conpar[4] = 0.;
159 conpar[5] = 55.;
160 conpar[6] = 13060.;
161 conpar[7] = 0.;
162 conpar[8] = 55.;
163 gMC->Gsvolu("ZDC ", "PCON", idtmed[10], conpar, 9);
164 gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
165
166 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
167 // beginning of D1)
168
169 zd1 = 1921.6;
170
171 tubpar[0] = 6.3/2.;
172 tubpar[1] = 6.7/2.;
173 tubpar[2] = 3916.7/2.;
174 gMC->Gsvolu("P001", "TUBE", idtmed[5], tubpar, 3);
175 gMC->Gspos("P001", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
176
177 //-- SECOND SECTION OF THE BEAM PIPE (FROM THE END OF D1 TO THE BEGINNING OF
178 // D2)
179
180 //-- FROM MAGNETIC BEGINNING OG D1 TO MAGNETIC END OF D1 + 23.5 cm
181 //-- Elliptic pipe
182
183 zd1 = 6310.8-472.5;
184
185 elpar[0] = 6.84/2.;
186 elpar[1] = 5.86/2.;
187 elpar[2] = 945./2.;
866ab5a2 188// gMC->Gsvolu("E001", "ELTU", idtmed[5], elpar, 3);
189// gMC->Gspos("E001", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
190//
68ca986e 191 elpar[0] = 6.44/2.;
192 elpar[1] = 5.46/2.;
193 elpar[2] = 945./2.;
866ab5a2 194// gMC->Gsvolu("E002", "ELTU", idtmed[10], elpar, 3);
195// gMC->Gspos("E002", 1, "E001", 0., 0., 0., 0, "ONLY");
68ca986e 196
197 zd1 += 2.*elpar[2];
198
199 elpar[0] = 6.84/2.;
200 elpar[1] = 5.86/2.;
201 elpar[2] = 13.5/2.;
866ab5a2 202// gMC->Gsvolu("E003", "ELTU", idtmed[5], elpar, 3);
203// gMC->Gspos("E002", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
68ca986e 204
205 elpar[0] = 6.44/2.;
206 elpar[1] = 5.46/2.;
207 elpar[2] = 13.5/2.;
866ab5a2 208// gMC->Gsvolu("E004", "ELTU", idtmed[10], elpar, 3);
209// gMC->Gspos("E004", 1, "E003", 0., 0., 0., 0, "ONLY");
68ca986e 210
211 zd1 += 2.*elpar[2];
212
213 conpar[0] = 25./2.;
214 conpar[1] = 6.44/2.;
215 conpar[2] = 6.84/2.;
216 conpar[3] = 10./2.;
217 conpar[4] = 10.4/2.;
218 gMC->Gsvolu("C001", "CONE", idtmed[5], conpar, 5);
219 gMC->Gspos("C001", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
220
221 zd1 += 2.*conpar[0];
222
223 tubpar[0] = 10./2.;
224 tubpar[1] = 10.4/2.;
225 tubpar[2] = 50./2.;
226 gMC->Gsvolu("P002", "TUBE", idtmed[5], tubpar, 3);
227 gMC->Gspos("P002", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
228
229 zd1 += tubpar[2] * 2.;
230
231 tubpar[0] = 10./2.;
232 tubpar[1] = 10.4/2.;
233 tubpar[2] = 10./2.;
234 gMC->Gsvolu("P003", "TUBE", idtmed[5], tubpar, 3);
235 gMC->Gspos("P003", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
236
237 zd1 += tubpar[2] * 2.;
238
239 tubpar[0] = 10./2.;
240 tubpar[1] = 10.4/2.;
241 tubpar[2] = 3.16/2.;
242 gMC->Gsvolu("P004", "TUBE", idtmed[5], tubpar, 3);
243 gMC->Gspos("P004", 1, "ZDC ", 0., 0., tubpar[0] + zd1, 0, "ONLY");
244
245 zd1 += tubpar[2] * 2.;
246
247 tubpar[0] = 10.0/2.;
248 tubpar[1] = 10.4/2;
249 tubpar[2] = 190./2.;
250 gMC->Gsvolu("P005", "TUBE", idtmed[5], tubpar, 3);
251 gMC->Gspos("P005", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
252
253 zd1 += tubpar[2] * 2.;
254
255 conpar[0] = 30./2.;
256 conpar[1] = 10./2.;
257 conpar[2] = 10.4/2.;
258 conpar[3] = 20.6/2.;
259 conpar[4] = 21./2.;
260 gMC->Gsvolu("P006", "CONE", idtmed[5], conpar, 5);
261 gMC->Gspos("P006", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
262
263 zd1 += conpar[0] * 2.;
264
265 tubpar[0] = 20.6/2.;
266 tubpar[1] = 21./2.;
267 tubpar[2] = 450./2.;
268 gMC->Gsvolu("P007", "TUBE", idtmed[5], tubpar, 3);
269 gMC->Gspos("P007", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
270
271 zd1 += tubpar[2] * 2.;
272
273 conpar[0] = 13.6/2.;
274 conpar[1] = 20.6/2.;
275 conpar[2] = 21./2.;
276 conpar[3] = 25.4/2.;
277 conpar[4] = 25.8/2.;
278 gMC->Gsvolu("P008", "CONE", idtmed[5], conpar, 5);
279 gMC->Gspos("P008", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
280
281 zd1 += conpar[0] * 2.;
282
283 tubpar[0] = 25.4/2.;
284 tubpar[1] = 25.8/2.;
285 tubpar[2] = 205.8/2.;
286 gMC->Gsvolu("P009", "TUBE", idtmed[5], tubpar, 3);
287 gMC->Gspos("P009", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
288
289 zd1 += tubpar[2] * 2.;
290
291 tubpar[0] = 50./2.;
292 tubpar[1] = 50.4/2.;
293 tubpar[2] = 505.4/2.;
294 gMC->Gsvolu("P010", "TUBE", idtmed[5], tubpar, 3);
295 gMC->Gspos("P010", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
296
297 zd1 += tubpar[2] * 2.;
298
299 tubpar[0] = 50./2.;
300 tubpar[1] = 50.4/2.;
301 tubpar[2] = 700./2.;
302 gMC->Gsvolu("P011", "TUBE", idtmed[5], tubpar, 3);
303 gMC->Gspos("P011", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
304
305 zd1 += tubpar[2] * 2.;
306
307 tubpar[0] = 50./2.;
308 tubpar[1] = 50.4/2.;
309 tubpar[2] = 778.5/2.;
310 gMC->Gsvolu("P012", "TUBE", idtmed[5], tubpar, 3);
311 gMC->Gspos("P012", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
312
313 zd1 += tubpar[2] * 2.;
314
315 conpar[0] = 14.18/2.;
316 conpar[1] = 50./2.;
317 conpar[2] = 50.4/2.;
318 conpar[3] = 55./2.;
319 conpar[4] = 55.4/2.;
320 gMC->Gsvolu("P013", "CONE", idtmed[5], conpar, 5);
321 gMC->Gspos("P013", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
322
323 zd1 += conpar[0] * 2.;
324
325 tubpar[0] = 55./2.;
326 tubpar[1] = 55.4/2.;
327 tubpar[2] = 730./2.;
328 gMC->Gsvolu("P014", "TUBE", idtmed[5], tubpar, 3);
329 gMC->Gspos("P014", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
330
331 zd1 += tubpar[2] * 2.;
332
333 conpar[0] = 36.86/2.;
334 conpar[1] = 55./2.;
335 conpar[2] = 55.4/2.;
336 conpar[3] = 68./2.;
337 conpar[4] = 68.4/2.;
338 gMC->Gsvolu("P015", "CONE", idtmed[5], conpar, 5);
339 gMC->Gspos("P015", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
340
341 zd1 += conpar[0] * 2.;
342
343 tubpar[0] = 68./2.;
344 tubpar[1] = 68.4/2.;
345 tubpar[2] = 927.3/2.;
346 gMC->Gsvolu("P016", "TUBE", idtmed[5], tubpar, 3);
347 gMC->Gspos("P016", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
348
349 zd1 += tubpar[2] * 2.;
350
351 tubpar[0] = 0./2.;
352 tubpar[1] = 68.4/2.;
353 tubpar[2] = 0.2/2.;
866ab5a2 354 gMC->Gsvolu("P017", "TUBE", idtmed[8], tubpar, 3);
68ca986e 355 gMC->Gspos("P017", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
356
357 zd1 += tubpar[2] * 2.;
358
359 tubpar[0] = 0./2.;
360 tubpar[1] = 5./2.;
361 tubpar[2] = 0.2/2.;
362 gMC->Gsvolu("Q017", "TUBE", idtmed[10], tubpar, 3);
363
364 //-- Position Q017 inside P017
365 gMC->Gspos("Q017", 1, "P017", -7.7, 0., 0., 0, "ONLY");
366
367 tubpar[0] = 0./2.;
368 tubpar[1] = 7./2.;
369 tubpar[2] = 0.2/2.;
370 gMC->Gsvolu("R017", "TUBE", idtmed[10], tubpar, 3);
371
372 //-- Position R017 inside P017
373 gMC->Gspos("R017", 1, "P017", 7.7, 0., 0., 0, "ONLY");
374
375 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
376
377 tubpar[0] = 5./2.;
378 tubpar[1] = 5.4/2.;
379 tubpar[2] = 678./2.;
380 gMC->Gsvolu("P018", "TUBE", idtmed[5], tubpar, 3);
381
382 tubpar[0] = 7./2.;
383 tubpar[1] = 7.4/2.;
384 tubpar[2] = 678./2.;
385 gMC->Gsvolu("P019", "TUBE", idtmed[5], tubpar, 3);
386
387 // -- ROTATE PIPES
388
389 AliMatrix(im1, 90.-0.071, 0., 90., 90., .071, 180.);
390 angle = .071*kDegrad;
391 gMC->Gspos("P018", 1, "ZDC ", TMath::Sin(angle) * 645. / 2. - 9.7 +
392 TMath::Sin(angle) * 945. / 2., 0., tubpar[2] + zd1, im1, "ONLY");
393 AliMatrix(im2, 90.+0.071, 0., 90., 90., .071, 0.);
394 gMC->Gspos("P019", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 645. / 2., 0.,
395 tubpar[2] + zd1, im2, "ONLY");
396
397 // -- END OF BEAM PIPE VOLUME DEFINITION. MAGNET DEFINITION FOLLOWS
398 // (LHC OPTICS 6)
399
400 // -- COMPENSATOR DIPOLE (MBXW)
401 // GAP (VACUUM WITH MAGNETIC FIELD)
402
5ce39387 403// tubpar[0] = 0.;
404// tubpar[1] = 4.5;
405// tubpar[2] = 340./2.;
406// gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
407// gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
68ca986e 408
409 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
410
5ce39387 411// tubpar[0] = 4.5;
412// tubpar[1] = 55.;
413// tubpar[2] = 340./2.;
414// gMC->Gsvolu("YMBX", "TUBE", idtmed[5], tubpar, 3);
415// gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
68ca986e 416
417 // -- COMPENSATOR DIPOLE (MCBWA)
418 // GAP (VACUUM WITH MAGNETIC FIELD)
419
420 tubpar[0] = 0.;
421 tubpar[1] = 4.5;
422 tubpar[2] = 170./2.;
423 gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);
424 gMC->Gspos("MCBW", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
425
426 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
427
428 tubpar[0] = 4.5;
429 tubpar[1] = 55.;
430 tubpar[2] = 170./2.;
431 gMC->Gsvolu("YMCB", "TUBE", idtmed[5], tubpar, 3);
432 gMC->Gspos("YMCB", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
433
434 // -- INNER TRIPLET
435
436 zq = 2300.;
437
438 // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT
439
440 // MQXL
441 // -- GAP (VACUUM WITH MAGNETIC FIELD)
442
443 tubpar[0] = 0.;
444 tubpar[1] = 3.5;
445 tubpar[2] = 630./2.;
446 gMC->Gsvolu("MQXL", "TUBE", idtmed[11], tubpar, 3);
447
448 // -- YOKE
449
450 tubpar[0] = 3.5;
451 tubpar[1] = 22.;
452 tubpar[2] = 630./2.;
453 gMC->Gsvolu("YMQL", "TUBE", idtmed[5], tubpar, 3);
454
455 gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
456 gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
457
458 gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
459 gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
460
461 // -- MQX
462 // -- GAP (VACUUM WITH MAGNETIC FIELD)
463
464 tubpar[0] = 0.;
465 tubpar[1] = 3.5;
466 tubpar[2] = 550./2.;
467 gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3);
468
469 // -- YOKE
470
471 tubpar[0] = 3.5;
472 tubpar[1] = 22.;
473 tubpar[2] = 550./2.;
474 gMC->Gsvolu("YMQ ", "TUBE", idtmed[5], tubpar, 3);
475
476 gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
477 gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
478
479 gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
480 gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
481
482 // -- SEPARATOR DIPOLE D1
483
484 zd1 = 5838.3;
485
486 // -- GAP (VACUUM WITH MAGNETIC FIELD)
487
488 tubpar[0] = 0.;
489 tubpar[1] = 7.5/2.;
490 tubpar[2] = 945./2.;
491 gMC->Gsvolu("D1 ", "TUBE", idtmed[11], tubpar, 3);
492
493 // -- YOKE
494
495 tubpar[0] = 0.;
496 tubpar[1] = 110./2;
497 tubpar[2] = 945./2.;
498 gMC->Gsvolu("YD1 ", "TUBE", idtmed[5], tubpar, 3);
499
500 gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
501 gMC->Gspos("D1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
502
503 // -- DIPOLE D2
504
505 zd2 = 12147.6;
506
507 // -- GAP (VACUUM WITH MAGNETIC FIELD)
508
509 tubpar[0] = 0.;
510 tubpar[1] = 7.5/2.;
511 tubpar[2] = 945./2.;
512 gMC->Gsvolu("D2 ", "TUBE", idtmed[11], tubpar, 3);
513
514 // -- YOKE
515
516 tubpar[0] = 0.;
517 tubpar[1] = 55.;
518 tubpar[2] = 945./2.;
519 gMC->Gsvolu("YD2 ", "TUBE", idtmed[5], tubpar, 3);
520
521 gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY");
522
523 gMC->Gspos("D2 ", 1, "YD2 ", -9.7, 0., 0., 0, "ONLY");
524 gMC->Gspos("D2 ", 2, "YD2 ", 9.7, 0., 0., 0, "ONLY");
525
526 // -- END OF MAGNET DEFINITION
527}
528
529//_____________________________________________________________________________
530void AliZDCv1::CreateZDC()
531{
532
533 Int_t *idtmed = fIdtmed->GetArray();
866ab5a2 534 Int_t irot1, irot2;
535 Float_t DimPb[6], DimVoid[6];
536
68ca986e 537
538 //-- Create calorimeters geometry
539
540 //--> Neutron calorimeter (ZN)
541
542 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
543 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
544 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
545 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
546 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
547 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
548 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
549 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
550 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
551
552 // Divide ZNEU in towers (for hits purposes)
553
554 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
555 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
556
557 //-- Divide ZN1 in minitowers
558 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
559 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
560 // (4 fibres per minitower)
561
562 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
563 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
564
565 // --- Position the empty grooves in the sticks (4 grooves per stick)
566 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
567 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
568
569 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
570 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
571 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
572 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
573
574 // --- Position the fibers in the grooves
575 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
576 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
577 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
578 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
579
580 // --- Position the neutron calorimeter in ZDC
581 gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2] + fDimZN[2], 0, "ONLY");
582
866ab5a2 583
584 //--> Proton calorimeter (ZP)
68ca986e 585
586 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
587 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
588 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
589 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
590 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
591 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
592 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
593 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
594 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
595
596 //-- Divide ZPRO in towers(for hits purposes)
597
598 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
599 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
600
601
602 //-- Divide ZP1 in minitowers
603 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
604 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
605 // (4 fiber per minitower)
606
607 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
608 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
609
610 // --- Position the empty grooves in the sticks (4 grooves per stick)
611 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
612 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
613
614 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
615 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
616 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
617 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
618
619 // --- Position the fibers in the grooves
620 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
621 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
622 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
623 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
624
625
626 // --- Position the proton calorimeter in ZDC
627 gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2] + fDimZP[2], 0, "ONLY");
866ab5a2 628
629
630
631 //--> EM calorimeter (ZEM)
632
633 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
634
635 gMC->Matrix(irot1,0.,0.,90.,90.,90.,180.); // Rotation matrix 1
636 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]); // Rotation matrix 2
637// printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
638
639 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
640
641 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
642
643 DimPb[0] = fDimZEMPb; // Lead slices
644 DimPb[1] = fDimZEM[2];
645 DimPb[2] = fDimZEM[1];
646 DimPb[3] = 90.-fDimZEM[3];
647 DimPb[4] = 0.;
648 DimPb[5] = 0.;
649 gMC->Gsvolu("ZEL0", "PARA", idtmed[6], DimPb, 6);
650 gMC->Gsvolu("ZEL1", "PARA", idtmed[6], DimPb, 6);
651 gMC->Gsvolu("ZEL2", "PARA", idtmed[6], DimPb, 6);
652
653 // --- Position the lead slices in the tranche
654 Float_t zTran = fDimZEM[0]/fDivZEM[2];
655 Float_t zTrPb = -zTran+fDimZEMPb;
656 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
657 gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
658
659 // --- Vacuum zone (to be filled with fibres)
660 DimVoid[0] = (zTran-2*fDimZEMPb)/2.;
661 DimVoid[1] = fDimZEM[2];
662 DimVoid[2] = fDimZEM[1];
663 DimVoid[3] = 90.-fDimZEM[3];
664 DimVoid[4] = 0.;
665 DimVoid[5] = 0.;
666 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], DimVoid,6);
667 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], DimVoid,6);
668
669 // --- Divide the vacuum slice into sticks along x axis
670 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
671 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
672
673 // --- Positioning the fibers into the sticks
674 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
675 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
676
677 // --- Positioning the vacuum slice into the tranche
678 Float_t DisplFib = fDimZEM[1]/fDivZEM[0];
679 gMC->Gspos("ZEV0", 1,"ZETR", -DimVoid[0], 0., 0., 0, "ONLY");
680 gMC->Gspos("ZEV1", 1,"ZETR", -DimVoid[0]+zTran, 0., DisplFib, 0, "ONLY");
681
682 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
683 gMC->Gspos("ZEM ", 1,"ZDC ", fPosZEM[0], fPosZEM[1], fPosZEM[2], irot1, "ONLY");
684
685 // --- Adding last slice at the end of the EM calorimeter
686 Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+fDimZEM[0];
687 gMC->Gspos("ZEL2", 1,"ZDC ", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
68ca986e 688
689}
690
691//_____________________________________________________________________________
692void AliZDCv1::DrawModule()
693{
694 //
695 // Draw a shaded view of the Zero Degree Calorimeter version 1
696 //
697
698 // Set everything unseen
699 gMC->Gsatt("*", "seen", -1);
700 //
701 // Set ALIC mother transparent
702 gMC->Gsatt("ALIC","SEEN",0);
703 //
704 // Set the volumes visible
705 gMC->Gsatt("ZDC ","SEEN",0);
706 gMC->Gsatt("P001","SEEN",1);
707 gMC->Gsatt("E001","SEEN",1);
708 gMC->Gsatt("E002","SEEN",1);
709 gMC->Gsatt("E003","SEEN",1);
710 gMC->Gsatt("E004","SEEN",1);
711 gMC->Gsatt("C001","SEEN",1);
712 gMC->Gsatt("P002","SEEN",1);
713 gMC->Gsatt("P003","SEEN",1);
714 gMC->Gsatt("P004","SEEN",1);
715 gMC->Gsatt("P005","SEEN",1);
716 gMC->Gsatt("P006","SEEN",1);
717 gMC->Gsatt("P007","SEEN",1);
718 gMC->Gsatt("P008","SEEN",1);
719 gMC->Gsatt("P009","SEEN",1);
720 gMC->Gsatt("P010","SEEN",1);
721 gMC->Gsatt("P011","SEEN",1);
722 gMC->Gsatt("P012","SEEN",1);
723 gMC->Gsatt("P013","SEEN",1);
724 gMC->Gsatt("P014","SEEN",1);
725 gMC->Gsatt("P015","SEEN",1);
726 gMC->Gsatt("P016","SEEN",1);
727 gMC->Gsatt("P017","SEEN",1);
728 gMC->Gsatt("Q017","SEEN",1);
729 gMC->Gsatt("R017","SEEN",1);
730 gMC->Gsatt("P018","SEEN",1);
731 gMC->Gsatt("P019","SEEN",1);
5ce39387 732// gMC->Gsatt("MBXW","SEEN",1);
733// gMC->Gsatt("YMBX","SEEN",1);
68ca986e 734 gMC->Gsatt("MCBW","SEEN",1);
735 gMC->Gsatt("YMCB","SEEN",1);
736 gMC->Gsatt("MQXL","SEEN",1);
737 gMC->Gsatt("YMQL","SEEN",1);
738 gMC->Gsatt("MQX ","SEEN",1);
739 gMC->Gsatt("YMQ ","SEEN",1);
740 gMC->Gsatt("D1 ","SEEN",1);
741 gMC->Gsatt("YD1 ","SEEN",1);
742 gMC->Gsatt("D2 ","SEEN",1);
743 gMC->Gsatt("YD2 ","SEEN",1);
744 gMC->Gsatt("ZNEU","SEEN",0);
745 gMC->Gsatt("ZNF1","SEEN",0);
746 gMC->Gsatt("ZNF2","SEEN",0);
747 gMC->Gsatt("ZNF3","SEEN",0);
748 gMC->Gsatt("ZNF4","SEEN",0);
749 gMC->Gsatt("ZNG1","SEEN",0);
750 gMC->Gsatt("ZNG2","SEEN",0);
751 gMC->Gsatt("ZNG3","SEEN",0);
752 gMC->Gsatt("ZNG4","SEEN",0);
753 gMC->Gsatt("ZNTX","SEEN",0);
754 gMC->Gsatt("ZN1 ","COLO",2);
755 gMC->Gsatt("ZN1 ","SEEN",1);
756 gMC->Gsatt("ZNSL","SEEN",0);
757 gMC->Gsatt("ZNST","SEEN",0);
758 gMC->Gsatt("ZPRO","SEEN",0);
759 gMC->Gsatt("ZPF1","SEEN",0);
760 gMC->Gsatt("ZPF2","SEEN",0);
761 gMC->Gsatt("ZPF3","SEEN",0);
762 gMC->Gsatt("ZPF4","SEEN",0);
763 gMC->Gsatt("ZPG1","SEEN",0);
764 gMC->Gsatt("ZPG2","SEEN",0);
765 gMC->Gsatt("ZPG3","SEEN",0);
766 gMC->Gsatt("ZPG4","SEEN",0);
767 gMC->Gsatt("ZPTX","SEEN",0);
768 gMC->Gsatt("ZP1 ","COLO",2);
769 gMC->Gsatt("ZP1 ","SEEN",1);
770 gMC->Gsatt("ZPSL","SEEN",0);
771 gMC->Gsatt("ZPST","SEEN",0);
866ab5a2 772 gMC->Gsatt("ZEM ","COLO",2);
773 gMC->Gsatt("ZEM ","SEEN",1);
774 gMC->Gsatt("ZEMF","SEEN",0);
775 gMC->Gsatt("ZETR","SEEN",0);
776 gMC->Gsatt("ZEL0","SEEN",0);
777 gMC->Gsatt("ZEL1","SEEN",0);
778 gMC->Gsatt("ZEL2","SEEN",0);
779 gMC->Gsatt("ZEV0","SEEN",0);
780 gMC->Gsatt("ZEV1","SEEN",0);
781 gMC->Gsatt("ZES0","SEEN",0);
782 gMC->Gsatt("ZES1","SEEN",0);
68ca986e 783
784 //
785 gMC->Gdopt("hide", "on");
786 gMC->Gdopt("shad", "on");
787 gMC->Gsatt("*", "fill", 7);
788 gMC->SetClipBox(".");
789 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
790 gMC->DefaultRange();
791 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
792 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
793 gMC->Gdman(18, 4, "MAN");
794}
795
796//_____________________________________________________________________________
797void AliZDCv1::CreateMaterials()
798{
799 //
800 // Create Materials for the Zero Degree Calorimeter
801 //
802 // Origin : E. Scomparin
803
804 Int_t *idtmed = fIdtmed->GetArray();
805
866ab5a2 806 Float_t dens, ubuf[1], wmat[2], a[2], z[2], epsil=0.001, stmin=0.01;
807 Int_t i, isvolActive, isvol, inofld;
68ca986e 808 Float_t fieldm = gAlice->Field()->Max();
68ca986e 809 Float_t tmaxfd=gAlice->Field()->Max();
866ab5a2 810 Int_t isxfld = gAlice->Field()->Integ();
811 Float_t deemax=-1;
68ca986e 812 Float_t stemax;
813
814 // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3
815
816 // --- Tantalum -> ZN passive material
817 ubuf[0] = 1.1;
818 AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
819
820 // --- Tungsten
821// ubuf[0] = 1.11;
822// AliMaterial(1, "TUNG", 183.85, 74., 19.3, .35, 10.3, ubuf, 1);
823
824 // --- Brass (CuZn) -> ZP passive material
825 dens = 8.48;
826 a[0] = 63.546;
827 a[1] = 65.39;
828 z[0] = 29.;
829 z[1] = 30.;
830 wmat[0] = .63;
831 wmat[1] = .37;
832 AliMixture(2, "BRASS ", a, z, dens, 2, wmat);
833
834 // --- SiO2
835 dens = 2.64;
836 a[0] = 28.086;
837 a[1] = 15.9994;
838 z[0] = 14.;
839 z[1] = 8.;
840 wmat[0] = 1.;
841 wmat[1] = 2.;
842 AliMixture(3, "SIO2 ", a, z, dens, -2, wmat);
866ab5a2 843
844
845 // --- Lead
846 ubuf[0] = 1.12;
847 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
68ca986e 848
849 // --- Copper
850// ubuf[0] = 1.1;
851// AliMaterial(7, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
852
866ab5a2 853 // --- Iron (energy loss taken into account)
854 ubuf[0] = 1.1;
855 AliMaterial(6, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
68ca986e 856
866ab5a2 857 // --- Iron (no energy loss)
68ca986e 858 ubuf[0] = 1.1;
866ab5a2 859 AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
68ca986e 860
861 // --- Vacuum (no magnetic field)
862 AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
863
864 // --- Vacuum (with magnetic field)
865 AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
866
867 // --- Air (no magnetic field)
868 AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
869
870 // --- Definition of tracking media:
871
872 // --- Tantalum = 1 ;
873 // --- Brass = 2 ;
874 // --- Fibers (SiO2) = 3 ;
875 // --- Fibers (SiO2) = 4 ;
866ab5a2 876 // --- Lead = 5 ;
877 // --- Iron (with energy loss) = 6 ;
878 // --- Iron (without energy loss) = 7 ;
68ca986e 879 // --- Vacuum (no field) = 10
880 // --- Vacuum (with field) = 11
881 // --- Air (no field) = 12
882
883
884 // --- Tracking media parameters
885 epsil = .01;
886 stemax = 1.;
887 isvol = 0;
888 isvolActive = 1;
889 inofld = 0;
890 fieldm = 0.;
891
892 AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
893// AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
894 AliMedium(2, "ZBRASS", 2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
895 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
896 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
866ab5a2 897 AliMedium(6, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
68ca986e 898// AliMedium(7, "ZCOPP", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
866ab5a2 899 AliMedium(5, "ZIRON", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
900 AliMedium(8, "ZIRONN", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
68ca986e 901 AliMedium(10, "ZVOID", 10, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
902 AliMedium(12, "ZAIR", 12, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
903
904 fieldm = 45.;
905 AliMedium(11, "ZVOIM", 11, isvol, isxfld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
906
907 // Thresholds for showering in the ZDCs
908
909 i = 1;
910 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
911 gMC->Gstpar(idtmed[i], "CUTELE", .001);
912 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
913 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
914 i = 2;
915 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
916 gMC->Gstpar(idtmed[i], "CUTELE", .001);
917 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
918 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
866ab5a2 919 i = 6;
920 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
921 gMC->Gstpar(idtmed[i], "CUTELE", .001);
922 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
923 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
68ca986e 924
925 // Avoid too detailed showering along the beam line
926
927 i = 5;
928 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
929 gMC->Gstpar(idtmed[i], "CUTELE", .1);
930 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
931 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
932
933 // Avoid interaction in fibers (only energy loss allowed)
934 i = 3;
935 gMC->Gstpar(idtmed[i], "DCAY", 0.);
936 gMC->Gstpar(idtmed[i], "MULS", 0.);
937 gMC->Gstpar(idtmed[i], "PFIS", 0.);
938 gMC->Gstpar(idtmed[i], "MUNU", 0.);
939 gMC->Gstpar(idtmed[i], "LOSS", 1.);
940 gMC->Gstpar(idtmed[i], "PHOT", 0.);
941 gMC->Gstpar(idtmed[i], "COMP", 0.);
942 gMC->Gstpar(idtmed[i], "PAIR", 0.);
943 gMC->Gstpar(idtmed[i], "BREM", 0.);
944 gMC->Gstpar(idtmed[i], "DRAY", 0.);
945 gMC->Gstpar(idtmed[i], "ANNI", 0.);
946 gMC->Gstpar(idtmed[i], "HADR", 0.);
947 i = 4;
948 gMC->Gstpar(idtmed[i], "DCAY", 0.);
949 gMC->Gstpar(idtmed[i], "MULS", 0.);
950 gMC->Gstpar(idtmed[i], "PFIS", 0.);
951 gMC->Gstpar(idtmed[i], "MUNU", 0.);
952 gMC->Gstpar(idtmed[i], "LOSS", 1.);
953 gMC->Gstpar(idtmed[i], "PHOT", 0.);
954 gMC->Gstpar(idtmed[i], "COMP", 0.);
955 gMC->Gstpar(idtmed[i], "PAIR", 0.);
956 gMC->Gstpar(idtmed[i], "BREM", 0.);
957 gMC->Gstpar(idtmed[i], "DRAY", 0.);
958 gMC->Gstpar(idtmed[i], "ANNI", 0.);
959 gMC->Gstpar(idtmed[i], "HADR", 0.);
866ab5a2 960
961 // Avoid interaction in void
962 i = 10;
963 gMC->Gstpar(idtmed[i], "DCAY", 0.);
964 gMC->Gstpar(idtmed[i], "MULS", 0.);
965 gMC->Gstpar(idtmed[i], "PFIS", 0.);
966 gMC->Gstpar(idtmed[i], "MUNU", 0.);
967 gMC->Gstpar(idtmed[i], "LOSS", 0.);
968 gMC->Gstpar(idtmed[i], "PHOT", 0.);
969 gMC->Gstpar(idtmed[i], "COMP", 0.);
970 gMC->Gstpar(idtmed[i], "PAIR", 0.);
971 gMC->Gstpar(idtmed[i], "BREM", 0.);
972 gMC->Gstpar(idtmed[i], "DRAY", 0.);
973 gMC->Gstpar(idtmed[i], "ANNI", 0.);
974 gMC->Gstpar(idtmed[i], "HADR", 0.);
975
68ca986e 976 //
866ab5a2 977 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
978 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
979 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
980 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
981 fMedSensZEM = idtmed[6]; // Sensitive volume: ZEM passive material
982 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
983 fMedSensPI = idtmed[5]; // Sensitive volume: beam pipes
68ca986e 984}
985
986//_____________________________________________________________________________
987void AliZDCv1::Init()
988{
989 InitTables();
68ca986e 990}
991
992//_____________________________________________________________________________
993void AliZDCv1::InitTables()
994{
c0ceba4c 995 Int_t k, j;
68ca986e 996 //Initialize parameters for light tables and read them
997 fNalfan = 90;
998 fNalfap = 90;
999 fNben = 18;
1000 fNbep = 28;
1001
866ab5a2 1002 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
1003 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
68ca986e 1004 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
1005
866ab5a2 1006 lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s");
1007 if((fp1 = fopen(lightfName1,"r")) == NULL){
68ca986e 1008 printf("Cannot open file fp1 \n");
1009 return;
1010 }
866ab5a2 1011 lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s");
1012 if((fp2 = fopen(lightfName2,"r")) == NULL){
68ca986e 1013 printf("Cannot open file fp2 \n");
1014 return;
1015 }
866ab5a2 1016 lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s");
1017 if((fp3 = fopen(lightfName3,"r")) == NULL){
68ca986e 1018 printf("Cannot open file fp3 \n");
1019 return;
1020 }
866ab5a2 1021 lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s");
1022 if((fp4 = fopen(lightfName4,"r")) == NULL){
68ca986e 1023 printf("Cannot open file fp4 \n");
1024 return;
1025 }
1026// printf(" --- Reading light tables for ZN \n");
c0ceba4c 1027 for(k=0; k<fNalfan; k++){
1028 for(j=0; j<fNben; j++){
68ca986e 1029 fscanf(fp1,"%f",&fTablen[0][k][j]);
1030 fscanf(fp2,"%f",&fTablen[1][k][j]);
1031 fscanf(fp3,"%f",&fTablen[2][k][j]);
1032 fscanf(fp4,"%f",&fTablen[3][k][j]);
1033 }
1034 }
1035 fclose(fp1);
1036 fclose(fp2);
1037 fclose(fp3);
1038 fclose(fp4);
1039
866ab5a2 1040 lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s");
1041 if((fp5 = fopen(lightfName5,"r")) == NULL){
68ca986e 1042 printf("Cannot open file fp5 \n");
1043 return;
1044 }
866ab5a2 1045 lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s");
1046 if((fp6 = fopen(lightfName6,"r")) == NULL){
68ca986e 1047 printf("Cannot open file fp6 \n");
1048 return;
1049 }
866ab5a2 1050 lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s");
1051 if((fp7 = fopen(lightfName7,"r")) == NULL){
68ca986e 1052 printf("Cannot open file fp7 \n");
1053 return;
1054 }
866ab5a2 1055 lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s");
1056 if((fp8 = fopen(lightfName8,"r")) == NULL){
68ca986e 1057 printf("Cannot open file fp8 \n");
1058 return;
1059 }
866ab5a2 1060// printf(" --- Reading light tables for ZP and ZEM \n");
c0ceba4c 1061 for(k=0; k<fNalfap; k++){
1062 for(j=0; j<fNbep; j++){
68ca986e 1063 fscanf(fp5,"%f",&fTablep[0][k][j]);
1064 fscanf(fp6,"%f",&fTablep[1][k][j]);
1065 fscanf(fp7,"%f",&fTablep[2][k][j]);
1066 fscanf(fp8,"%f",&fTablep[3][k][j]);
1067 }
1068 }
1069 fclose(fp5);
1070 fclose(fp6);
1071 fclose(fp7);
1072 fclose(fp8);
1073}
5ce39387 1074
1075//_____________________________________________________________________________
1076Int_t AliZDCv1::Digitize(Int_t Det, Int_t Quad, Int_t Light)
1077{
1078 // Evaluation of the ADC channel corresponding to the light yield Light
1079
bdee0299 1080 printf("\n Digitize -> Det = %d, Quad = %d, Light = %d\n", Det, Quad, Light);
5ce39387 1081
1082 Int_t j,i;
1083 for(i=0; i<3; i++){
1084 for(j=0; j<5; j++){
1085 fPedMean[i][j] = 50.;
1086 fPedSigma[i][j] = 10.;
1087 fPMGain[i][j] = 10000000.;
1088 }
1089 }
1090 fADCRes = 0.00000064; // ADC Resolution: 250 fC/ADCch
1091
1092 Float_t Ped = gRandom->Gaus(fPedMean[Det-1][Quad],fPedSigma[Det-1][Quad]);
1093 Int_t ADCch = Int_t(Light*fPMGain[Det-1][Quad]*fADCRes+Ped);
1094
bdee0299 1095 printf(" Ped = %f, ADCch = %d\n", Ped, ADCch);
5ce39387 1096 return ADCch;
1097}
1098//_____________________________________________________________________________
1099void AliZDCv1::FinishEvent()
1100{
1101 // Creation of the digits from hits
1102
bdee0299 1103// if(fDebug == 1){
5ce39387 1104 printf("\n Event Hits --------------------------------------------------------\n");
1105 printf("\n Num. of primary hits = %d\n", fNPrimaryHits);
1106 fStHits->Print("");
bdee0299 1107// }
5ce39387 1108
1109 TClonesArray &lDigits = *fDigits;
1110
1111 AliZDCDigit *newdigit;
1112 AliZDCHit *hit;
1113
1114 Int_t PMCZN = 0, PMCZP = 0, PMQZN[4], PMQZP[4], PMZEM = 0;
1115
1116 Int_t h;
1117 for(h=0; h<4; h++){
1118 PMQZN[h] =0;
1119 PMQZP[h] =0;
1120 }
1121
1122 Int_t i;
1123 for(i=0; i<fNStHits; i++){
1124 hit = (AliZDCHit*)fStHits->At(i);
1125 Int_t det = hit->GetVolume(0);
1126 Int_t quad = hit->GetVolume(1);
1127 Int_t lightQ = Int_t(hit->GetLightPMQ());
1128 Int_t lightC = Int_t(hit->GetLightPMC());
1129// printf(" \ni = %d, fNStHits = %d, det = %d, quad = %d,"
1130// "lightC = %d lightQ = %d\n", i, fNStHits, det, quad, lightC, lightQ);
1131
1132 if(det == 1){ //ZN
1133 PMCZN = PMCZN + lightC;
1134 PMQZN[quad-1] = PMQZN[quad-1] + lightQ;
1135 }
1136
1137 if(det == 2){ //ZP
1138 PMCZP = PMCZP + lightC;
1139 PMQZP[quad-1] = PMQZP[quad-1] + lightQ;
1140 }
1141
1142 if(det == 3){ //ZEM
1143 PMZEM = PMZEM + lightC;
1144 }
1145 }
1146
bdee0299 1147 printf("\n PMCZN = %d, PMQZN[0] = %d, PMQZN[1] = %d, PMQZN[2] = %d, PMQZN[3] = %d\n"
1148 , PMCZN, PMQZN[0], PMQZN[1], PMQZN[2], PMQZN[3]);
1149 printf("\n PMCZP = %d, PMQZP[0] = %d, PMQZP[1] = %d, PMQZP[2] = %d, PMQZP[3] = %d\n"
1150 , PMCZP, PMQZP[0], PMQZP[1], PMQZP[2], PMQZP[3]);
1151 printf("\n PMZEM = %d\n", PMZEM);
5ce39387 1152
1153 // ------------------------------------ Hits2Digits
1154 // Digits for ZN
1155 newdigit = new AliZDCDigit(1, 0, Digitize(1, 0, PMCZN));
1156 new(lDigits[fNdigits]) AliZDCDigit(*newdigit);
1157 fNdigits++;
1158 delete newdigit;
1159
1160 Int_t j;
1161 for(j=0; j<4; j++){
1162 newdigit = new AliZDCDigit(1, j+1, Digitize(1, j+1, PMQZN[j]));
1163 new(lDigits[fNdigits]) AliZDCDigit(*newdigit);
1164 fNdigits++;
1165 delete newdigit;
1166 }
1167
1168 // Digits for ZP
1169 newdigit = new AliZDCDigit(2, 0, Digitize(2, 0, PMCZP));
1170 new(lDigits[fNdigits]) AliZDCDigit(*newdigit);
1171 fNdigits++;
1172 delete newdigit;
1173
1174 Int_t k;
1175 for(k=0; k<4; k++){
1176 newdigit = new AliZDCDigit(2, k+1, Digitize(2, k+1, PMQZP[k]));
1177 new(lDigits[fNdigits]) AliZDCDigit(*newdigit);
1178 fNdigits++;
1179 delete newdigit;
1180 }
1181
1182 // Digits for ZEM
1183 newdigit = new AliZDCDigit(3, 0, Digitize(3, 0, PMZEM));
1184 new(lDigits[fNdigits]) AliZDCDigit(*newdigit);
1185 fNdigits++;
1186 delete newdigit;
1187
1188
1189 gAlice->TreeD()->Fill();
1190 gAlice->TreeD()->Write();
1191
bdee0299 1192// if(fDebug == 1){
5ce39387 1193 printf("\n Event Digits -----------------------------------------------------\n");
1194 fDigits->Print("");
bdee0299 1195// }
5ce39387 1196
1197}
1198//_____________________________________________________________________________
1199 void AliZDCv1::MakeBranch(Option_t *opt)
1200{
1201 //
1202 // Create a new branch in the current Root Tree
1203 //
1204
1205 AliDetector::MakeBranch(opt);
1206
1207 char branchname[10];
1208 sprintf(branchname,"%s",GetName());
1209 char *cD = strstr(opt,"D");
1210
1211 if (fDigits && gAlice->TreeD() && cD) {
1212 gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize);
1213 printf("* AliZDCv1::MakeBranch * Making Branch %s for digits\n\n",branchname);
1214 }
1215}
68ca986e 1216//_____________________________________________________________________________
1217void AliZDCv1::StepManager()
1218{
1219 //
1220 // Routine called at every step in the Zero Degree Calorimeters
1221 //
1222
c0ceba4c 1223 Int_t j;
1224
5ce39387 1225 Int_t vol[2], ibeta=0, ialfa, ibe, nphe;
366ff5c2 1226 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
68ca986e 1227 TLorentzVector s, p;
1228 const char *knamed;
866ab5a2 1229
1230
68ca986e 1231 if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) ||
1232 (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) ||
866ab5a2 1233 (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM) ||
1234 (gMC->GetMedium() == fMedSensPI)){
bdee0299 1235
1236 for(j=0; j<=9; j++){
1237 hits[j] = 0;
1238 }
866ab5a2 1239
1240 // If particle interacts with beam pipe -> return
1241 if(gMC->GetMedium() == fMedSensPI){
1242
1243 // If option NoShower is set -> StopTrack
1244 if(fNoShower==1) gMC->StopTrack();
1245 return;
1246 }
1247
68ca986e 1248 //Particle coordinates
1249 gMC->TrackPosition(s);
c0ceba4c 1250 for(j=0; j<=2; j++){
68ca986e 1251 x[j] = s[j];
1252 }
1253 hits[0] = x[0];
1254 hits[1] = x[1];
1255 hits[2] = x[2];
1256
1257 // Determine in which ZDC the particle is
1258 knamed = gMC->CurrentVolName();
1259 if(!strncmp(knamed,"ZN",2))vol[0]=1;
1260 if(!strncmp(knamed,"ZP",2))vol[0]=2;
866ab5a2 1261 if(!strncmp(knamed,"ZE",2))vol[0]=3;
68ca986e 1262
1263 // Determine in which quadrant the particle is
1264
1265 //Quadrant in ZN
68ca986e 1266 if(vol[0]==1){
866ab5a2 1267 xdet[0] = x[0]-fPosZN[0];
1268 xdet[1] = x[1]-fPosZN[1];
1269 if((xdet[0]<=0.) && (xdet[1]>=0.)) vol[1]=1;
68ca986e 1270 if((xdet[0]>0.) && (xdet[1]>0.)) vol[1]=2;
1271 if((xdet[0]<0.) && (xdet[1]<0.)) vol[1]=3;
1272 if((xdet[0]>0.) && (xdet[1]<0.)) vol[1]=4;
1273 }
1274
1275 //Quadrant in ZP
1276 if(vol[0]==2){
866ab5a2 1277 xdet[0] = x[0]-fPosZP[0];
1278 xdet[1] = x[1]-fPosZP[1];
1279 if(xdet[0]>fDimZP[0])xdet[0]=fDimZP[0]-0.01;
1280 if(xdet[0]<-fDimZP[0])xdet[0]=-fDimZP[0]+0.01;
68ca986e 1281 Float_t xqZP = xdet[0]/(fDimZP[0]/2);
1282 for(int i=1; i<=4; i++){
866ab5a2 1283 if(xqZP>=(i-3) && xqZP<(i-2)){
68ca986e 1284 vol[1] = i;
1285 break;
1286 }
1287 }
1288 }
866ab5a2 1289
1290 //ZEM has only 1 quadrant
1291 if(vol[0] == 3){
1292 vol[1] = 1;
1293 xdet[0] = x[0]-fPosZEM[0];
1294 xdet[1] = x[1]-fPosZEM[1];
1295// printf("x %f %f xdet %f %f\n",x[0],x[1],xdet[0],xdet[1]);
1296 }
1297
1298 if(vol[1]>4){
1299 printf("\n-> Det. %d Quad. %d \n", vol[0], vol[1]);
1300 printf("x %f %f xdet %f %f\n",x[0],x[1],xdet[0],xdet[1]);}
68ca986e 1301
1302 // Store impact point and kinetic energy of the ENTERING particle
1303
1304// Int_t Curtrack = gAlice->CurrentTrack();
1305// Int_t Prim = gAlice->GetPrimary(Curtrack);
1306// printf ("Primary: %d, Current Track: %d \n", Prim, Curtrack);
1307
1308// if(Curtrack==Prim){
1309 if(gMC->IsTrackEntering()){
1310 //Particle energy
1311 gMC->TrackMomentum(p);
1312// printf("p[0] = %f, p[1] = %f, p[2] = %f, p[3] = %f \n",
1313// p[0], p[1], p[2], p[3]);
1314 hits[3] = p[3];
1315
866ab5a2 1316 // Impact point on ZDC
68ca986e 1317 hits[4] = xdet[0];
1318 hits[5] = xdet[1];
866ab5a2 1319 hits[6] = 0;
68ca986e 1320 hits[7] = 0;
1321 hits[8] = 0;
1322 hits[9] = 0;
1323
866ab5a2 1324// Int_t PcID = gMC->TrackPid();
1325// printf("Pc ID -> %d\n",PcID);
1326 AddHit(gAlice->CurrentTrack(), vol, hits);
1327
1328 if(fNoShower==1){
1329 gMC->StopTrack();
1330 return;
1331 }
68ca986e 1332 }
1333// }
1334
1335 // Charged particles -> Energy loss
1336 if((destep=gMC->Edep())){
1337 if(gMC->IsTrackStop()){
1338 gMC->TrackMomentum(p);
1339 m = gMC->TrackMass();
1340 ekin = p[3]-m;
1341 if(ekin<0.) printf("ATTENTION!!!!!!!!!!!!!!! -> ekin = %f <0 (?)",ekin);
1342 hits[9] = ekin;
1343 hits[7] = 0.;
1344 hits[8] = 0.;
1345 AddHit(gAlice->CurrentTrack(), vol, hits);
1346 }
1347 else{
1348 hits[9] = destep;
1349 hits[7] = 0.;
1350 hits[8] = 0.;
1351 AddHit(gAlice->CurrentTrack(), vol, hits);
1352 }
1353// printf(" -> Charged particle -> Dep. E = %f eV \n",hits[8]);
1354 }
1355// printf(" \n");
1356 }
1357
1358
1359 // *** Light production in fibres
1360 if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){
68ca986e 1361
1362 //Select charged particles
1363 if((destep=gMC->Edep())){
1364// printf(" -> CHARGED particle!!! \n");
1365
1366 // Particle velocity
1367 gMC->TrackMomentum(p);
1368 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
1369 Float_t beta = ptot/p[3];
68ca986e 1370// Int_t pcID = gMC->TrackPid();
1371// printf(" Pc %d in quadrant %d -> beta = %f \n", pcID, vol[1], beta);
1372 if(beta<0.67) return;
866ab5a2 1373 if((beta>=0.67) && (beta<=0.75)) ibeta = 0;
1374 if((beta>0.75) && (beta<=0.85)) ibeta = 1;
1375 if((beta>0.85) && (beta<=0.95)) ibeta = 2;
1376// if((beta>0.95) && (beta<=1.00)) ibeta = 3;
1377 if(beta>0.95) ibeta = 3;
68ca986e 1378
1379 // Angle between particle trajectory and fibre axis
1380 // 1 -> Momentum directions
1381 um[0] = p[0]/ptot;
1382 um[1] = p[1]/ptot;
1383 um[2] = p[2]/ptot;
1384 gMC->Gmtod(um,ud,2);
1385 // 2 -> Angle < limit angle
1386 Double_t alfar = TMath::ACos(ud[2]);
1387 Double_t alfa = alfar*kRaddeg;
866ab5a2 1388 if(alfa>=110.) return;
68ca986e 1389 ialfa = Int_t(1.+alfa/2.);
1390
1391 // Distance between particle trajectory and fibre axis
1392 gMC->TrackPosition(s);
c0ceba4c 1393 for(j=0; j<=2; j++){
68ca986e 1394 x[j] = s[j];
1395 }
1396 gMC->Gmtod(x,xdet,1);
1397 if(TMath::Abs(ud[0])>0.00001){
1398 Float_t dcoeff = ud[1]/ud[0];
1399 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
1400 }
1401 else{
1402 be = TMath::Abs(ud[0]);
1403 }
1404
1405 if((vol[0]==1)) radius = fFibZN[1];
1406 if((vol[0]==2)) radius = fFibZP[1];
1407 ibe = Int_t(be*1000.+1);
1408
1409 //Looking into the light tables
1410 Float_t charge = gMC->TrackCharge();
1411
1412 // (1) ZN
1413 if((vol[0]==1)) {
1414 if(ibe>fNben) ibe=fNben;
1415 out = charge*charge*fTablen[ibeta][ialfa][ibe];
5ce39387 1416 nphe = gRandom->Poisson(out);
68ca986e 1417 if(gMC->GetMedium() == fMedSensF1){
5ce39387 1418 hits[7] = nphe; //fLightPMQ
68ca986e 1419 hits[8] = 0;
1420 hits[9] = 0;
1421 AddHit(gAlice->CurrentTrack(), vol, hits);
1422 }
1423 else{
1424 hits[7] = 0;
5ce39387 1425 hits[8] = nphe; //fLightPMC
68ca986e 1426 hits[9] = 0;
1427 AddHit(gAlice->CurrentTrack(), vol, hits);
1428 }
1429 }
1430
1431 // (2) ZP
1432 if((vol[0]==2)) {
1433 if(ibe>fNbep) ibe=fNbep;
1434 out = charge*charge*fTablep[ibeta][ialfa][ibe];
5ce39387 1435 nphe = gRandom->Poisson(out);
68ca986e 1436 if(gMC->GetMedium() == fMedSensF1){
5ce39387 1437 hits[7] = nphe; //fLightPMQ
68ca986e 1438 hits[8] = 0;
1439 hits[9] = 0;
1440 AddHit(gAlice->CurrentTrack(), vol, hits);
1441 }
1442 else{
1443 hits[7] = 0;
5ce39387 1444 hits[8] = nphe; //fLightPMC
68ca986e 1445 hits[9] = 0;
1446 AddHit(gAlice->CurrentTrack(), vol, hits);
1447 }
1448 }
866ab5a2 1449 // (3) ZEM
1450 if((vol[0]==3)) {
1451 if(ibe>fNbep) ibe=fNbep;
1452 out = charge*charge*fTablep[ibeta][ialfa][ibe];
5ce39387 1453 nphe = gRandom->Poisson(out);
1454 hits[7] = nphe; //fLightPMQ
1455 hits[8] = 0;
1456 hits[9] = 0;
1457 AddHit(gAlice->CurrentTrack(), vol, hits);
866ab5a2 1458 }
68ca986e 1459 }
866ab5a2 1460
68ca986e 1461 }
1462}