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