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