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