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