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