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