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