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