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