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