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