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