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