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