Update of HP decoders:
[u/mrichter/AliRoot.git] / ZDC / AliZDCv3.cxx
CommitLineData
8d433671 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///////////////////////////////////////////////////////////////////////
18// //
19// AliZDCv3 --- new ZDC geometry //
20// with the both ZDC set geometry implemented //
21// //
22///////////////////////////////////////////////////////////////////////
23
24// --- Standard libraries
25#include "stdio.h"
26
27// --- ROOT system
28#include <TBRIK.h>
8d433671 29#include <TMath.h>
30#include <TNode.h>
31#include <TRandom.h>
32#include <TSystem.h>
33#include <TTree.h>
34#include <TVirtualMC.h>
35#include <TGeoManager.h>
36
8d433671 37// --- AliRoot classes
38#include "AliConst.h"
39#include "AliMagF.h"
8d433671 40#include "AliRun.h"
41#include "AliZDCv3.h"
42#include "AliMC.h"
43
44class AliZDCHit;
45class AliPDG;
46class AliDetector;
47
48
49ClassImp(AliZDCv3)
50
51//_____________________________________________________________________________
f853b9aa 52AliZDCv3::AliZDCv3() :
53 AliZDC(),
54 fMedSensF1(0),
55 fMedSensF2(0),
56 fMedSensZP(0),
57 fMedSensZN(0),
58 fMedSensZEM(0),
59 fMedSensGR(0),
60 fMedSensPI(0),
29c8f0dc 61 fMedSensTDI(0),
f853b9aa 62 fNalfan(0),
63 fNalfap(0),
64 fNben(0),
65 fNbep(0),
66 fZEMLength(0),
67 fpLostITC(0),
68 fpLostD1C(0),
69 fpDetectedC(0),
70 fnDetectedC(0),
8cbab886 71 fnLumiC(0),
f853b9aa 72 fpLostITA(0),
73 fpLostD1A(0),
74 fpLostTDI(0),
75 fpDetectedA(0),
8cbab886 76 fnDetectedA(0),
77 fnLumiA(0),
78 fnTrou(0)
8d433671 79{
80 //
81 // Default constructor for Zero Degree Calorimeter
82 //
83
8d433671 84}
85
86//_____________________________________________________________________________
a718c993 87AliZDCv3::AliZDCv3(const char *name, const char *title) :
f853b9aa 88 AliZDC(name,title),
89 fMedSensF1(0),
90 fMedSensF2(0),
91 fMedSensZP(0),
92 fMedSensZN(0),
93 fMedSensZEM(0),
94 fMedSensGR(0),
95 fMedSensPI(0),
29c8f0dc 96 fMedSensTDI(0),
f853b9aa 97 fNalfan(90),
98 fNalfap(90),
99 fNben(18),
100 fNbep(28),
64d8b611 101 fZEMLength(0),
f853b9aa 102 fpLostITC(0),
103 fpLostD1C(0),
104 fpDetectedC(0),
105 fnDetectedC(0),
8cbab886 106 fnLumiC(0),
f853b9aa 107 fpLostITA(0),
108 fpLostD1A(0),
109 fpLostTDI(0),
110 fpDetectedA(0),
8cbab886 111 fnDetectedA(0),
112 fnLumiA(0),
113 fnTrou(0)
8d433671 114{
115 //
116 // Standard constructor for Zero Degree Calorimeter
117 //
118 //
119 // Check that DIPO, ABSO, DIPO and SHIL is there (otherwise tracking is wrong!!!)
120
121 AliModule* pipe=gAlice->GetModule("PIPE");
122 AliModule* abso=gAlice->GetModule("ABSO");
123 AliModule* dipo=gAlice->GetModule("DIPO");
124 AliModule* shil=gAlice->GetModule("SHIL");
125 if((!pipe) || (!abso) || (!dipo) || (!shil)) {
126 Error("Constructor","ZDC needs PIPE, ABSO, DIPO and SHIL!!!\n");
127 exit(1);
128 }
f853b9aa 129 //
8d433671 130 Int_t ip,jp,kp;
131 for(ip=0; ip<4; ip++){
132 for(kp=0; kp<fNalfap; kp++){
133 for(jp=0; jp<fNbep; jp++){
134 fTablep[ip][kp][jp] = 0;
135 }
136 }
137 }
138 Int_t in,jn,kn;
139 for(in=0; in<4; in++){
140 for(kn=0; kn<fNalfan; kn++){
141 for(jn=0; jn<fNben; jn++){
142 fTablen[in][kn][jn] = 0;
143 }
144 }
145 }
f853b9aa 146 //
8d433671 147 // Parameters for hadronic calorimeters geometry
148 fDimZN[0] = 3.52;
149 fDimZN[1] = 3.52;
150 fDimZN[2] = 50.;
151 fDimZP[0] = 11.2;
152 fDimZP[1] = 6.;
153 fDimZP[2] = 75.;
f853b9aa 154 fPosZNC[0] = 0.;
155 fPosZNC[1] = 1.2;
156 fPosZNC[2] = -11650.;
157 fPosZPC[0] = 23.9;
cd807e71 158 fPosZPC[1] = 0.;
159 fPosZPC[2] = -11600.;
f853b9aa 160 fPosZNA[0] = 0.;
161 fPosZNA[1] = 1.2;
162 fPosZNA[2] = 11620.;
cd807e71 163 fPosZPA[0] = 24.;
164 fPosZPA[1] = 0.;
165 fPosZPA[2] = 11620.;
8d433671 166 fFibZN[0] = 0.;
167 fFibZN[1] = 0.01825;
168 fFibZN[2] = 50.;
169 fFibZP[0] = 0.;
170 fFibZP[1] = 0.0275;
171 fFibZP[2] = 75.;
8d433671 172 // Parameters for EM calorimeter geometry
173 fPosZEM[0] = 8.5;
174 fPosZEM[1] = 0.;
175 fPosZEM[2] = 735.;
8d433671 176 Float_t kDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice
177 Float_t kDimZEMAir = 0.001; // scotch
178 Float_t kFibRadZEM = 0.0315; // External fiber radius (including cladding)
179 Int_t kDivZEM[3] = {92, 0, 20}; // Divisions for EM detector
180 Float_t kDimZEM0 = 2*kDivZEM[2]*(kDimZEMPb+kDimZEMAir+kFibRadZEM*(TMath::Sqrt(2.)));
181 fZEMLength = kDimZEM0;
182
183}
184
185//_____________________________________________________________________________
186void AliZDCv3::CreateGeometry()
187{
188 //
189 // Create the geometry for the Zero Degree Calorimeter version 2
190 //* Initialize COMMON block ZDC_CGEOM
191 //*
192
193 CreateBeamLine();
194 CreateZDC();
195}
196
197//_____________________________________________________________________________
198void AliZDCv3::CreateBeamLine()
199{
200 //
201 // Create the beam line elements
202 //
203
204 Float_t zc, zq, zd1, zd2, zql, zd2l;
205 Float_t conpar[9], tubpar[3], tubspar[5], boxpar[3];
206 Int_t im1, im2;
f853b9aa 207 //
8d433671 208 Int_t *idtmed = fIdtmed->GetArray();
209
210 ////////////////////////////////////////////////////////////////
211 // //
212 // SIDE C - RB26 (dimuon side) //
213 // //
214 ///////////////////////////////////////////////////////////////
215
216
217 // -- Mother of the ZDCs (Vacuum PCON)
218 zd1 = 1921.6;
219
220 conpar[0] = 0.;
221 conpar[1] = 360.;
222 conpar[2] = 2.;
223 conpar[3] = -13500.;
224 conpar[4] = 0.;
225 conpar[5] = 55.;
226 conpar[6] = -zd1;
227 conpar[7] = 0.;
228 conpar[8] = 55.;
cd807e71 229 gMC->Gsvolu("ZDCC", "PCON", idtmed[10], conpar, 9);
f853b9aa 230 gMC->Gspos("ZDCC", 1, "ALIC", 0., 0., 0., 0, "ONLY");
8d433671 231
232
233 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
234 // the beginning of D1)
235 tubpar[0] = 6.3/2.;
236 tubpar[1] = 6.7/2.;
237 // From beginning of ZDC volumes to beginning of D1
238 tubpar[2] = (5838.3-zd1)/2.;
239 gMC->Gsvolu("QT01", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 240 gMC->Gspos("QT01", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 241 // Ch.debug
242 //printf("\n QT01 TUBE pipe from z = %f to z= %f (D1 beg.)\n",-zd1,-2*tubpar[2]-zd1);
243
244 //-- SECOND SECTION OF THE BEAM PIPE (from the end of D1 to the
245 // beginning of D2)
246
247 //-- FROM MAGNETIC BEGINNING OF D1 TO MAGNETIC END OF D1 + 13.5 cm
248 //-- Cylindrical pipe (r = 3.47) + conical flare
249
250 // -> Beginning of D1
251 zd1 += 2.*tubpar[2];
252
253 tubpar[0] = 3.47;
254 tubpar[1] = 3.47+0.2;
255 tubpar[2] = 958.5/2.;
256 gMC->Gsvolu("QT02", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 257 gMC->Gspos("QT02", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 258 // Ch.debug
259 //printf("\n QT02 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
260
261 zd1 += 2.*tubpar[2];
262
263 conpar[0] = 25./2.;
264 conpar[1] = 10./2.;
265 conpar[2] = 10.4/2.;
266 conpar[3] = 6.44/2.;
267 conpar[4] = 6.84/2.;
268 gMC->Gsvolu("QC01", "CONE", idtmed[7], conpar, 5);
f853b9aa 269 gMC->Gspos("QC01", 1, "ZDCC", 0., 0., -conpar[0]-zd1, 0, "ONLY");
8d433671 270 // Ch.debug
271 //printf("\n QC01 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
272
273 zd1 += 2.*conpar[0];
274
275 tubpar[0] = 10./2.;
276 tubpar[1] = 10.4/2.;
277 tubpar[2] = 50./2.;
278 gMC->Gsvolu("QT03", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 279 gMC->Gspos("QT03", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 280 // Ch.debug
281 //printf("\n QT03 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
282
283 zd1 += tubpar[2]*2.;
284
285 tubpar[0] = 10./2.;
286 tubpar[1] = 10.4/2.;
287 tubpar[2] = 10./2.;
288 gMC->Gsvolu("QT04", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 289 gMC->Gspos("QT04", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 290 // Ch.debug
291 //printf("\n QT04 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
292
293 zd1 += tubpar[2] * 2.;
294
295 tubpar[0] = 10./2.;
296 tubpar[1] = 10.4/2.;
297 tubpar[2] = 3.16/2.;
298 gMC->Gsvolu("QT05", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 299 gMC->Gspos("QT05", 1, "ZDCC", 0., 0., -tubpar[0]-zd1, 0, "ONLY");
8d433671 300 // Ch.debug
301 //printf("\n QT05 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
302
303 zd1 += tubpar[2] * 2.;
304
305 tubpar[0] = 10.0/2.;
306 tubpar[1] = 10.4/2;
307 tubpar[2] = 190./2.;
308 gMC->Gsvolu("QT06", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 309 gMC->Gspos("QT06", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 310 // Ch.debug
311 //printf("\n QT06 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
312
313 zd1 += tubpar[2] * 2.;
314
315 conpar[0] = 30./2.;
316 conpar[1] = 20.6/2.;
317 conpar[2] = 21./2.;
318 conpar[3] = 10./2.;
319 conpar[4] = 10.4/2.;
320 gMC->Gsvolu("QC02", "CONE", idtmed[7], conpar, 5);
f853b9aa 321 gMC->Gspos("QC02", 1, "ZDCC", 0., 0., -conpar[0]-zd1, 0, "ONLY");
8d433671 322 // Ch.debug
323 //printf("\n QC02 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
324
325 zd1 += conpar[0] * 2.;
326
327 tubpar[0] = 20.6/2.;
328 tubpar[1] = 21./2.;
329 tubpar[2] = 450./2.;
330 gMC->Gsvolu("QT07", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 331 gMC->Gspos("QT07", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 332 // Ch.debug
333 //printf("\n QT07 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
334
335 zd1 += tubpar[2] * 2.;
336
337 conpar[0] = 13.6/2.;
338 conpar[1] = 25.4/2.;
339 conpar[2] = 25.8/2.;
340 conpar[3] = 20.6/2.;
341 conpar[4] = 21./2.;
342 gMC->Gsvolu("QC03", "CONE", idtmed[7], conpar, 5);
f853b9aa 343 gMC->Gspos("QC03", 1, "ZDCC", 0., 0., -conpar[0]-zd1, 0, "ONLY");
8d433671 344 // Ch.debug
345 //printf("\n QC03 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
346
347 zd1 += conpar[0] * 2.;
348
349 tubpar[0] = 25.4/2.;
350 tubpar[1] = 25.8/2.;
351 tubpar[2] = 205.8/2.;
352 gMC->Gsvolu("QT08", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 353 gMC->Gspos("QT08", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 354 // Ch.debug
355 //printf("\n QT08 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
356
357 zd1 += tubpar[2] * 2.;
358
359 tubpar[0] = 50./2.;
360 tubpar[1] = 50.4/2.;
361 // QT09 is 10 cm longer to accomodate TDI
362 tubpar[2] = 515.4/2.;
363 gMC->Gsvolu("QT09", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 364 gMC->Gspos("QT09", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 365 // Ch.debug
366 //printf("\n QT09 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
367
8d433671 368 zd1 += tubpar[2] * 2.;
369
370 tubpar[0] = 50./2.;
371 tubpar[1] = 50.4/2.;
372 // QT10 is 10 cm shorter
373 tubpar[2] = 690./2.;
374 gMC->Gsvolu("QT10", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 375 gMC->Gspos("QT10", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 376 // Ch.debug
377 //printf("\n QT10 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
378
379 zd1 += tubpar[2] * 2.;
380
381 tubpar[0] = 50./2.;
382 tubpar[1] = 50.4/2.;
383 tubpar[2] = 778.5/2.;
384 gMC->Gsvolu("QT11", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 385 gMC->Gspos("QT11", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 386 // Ch.debug
387 //printf("\n QT11 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
388
389 zd1 += tubpar[2] * 2.;
390
391 conpar[0] = 14.18/2.;
392 conpar[1] = 55./2.;
393 conpar[2] = 55.4/2.;
394 conpar[3] = 50./2.;
395 conpar[4] = 50.4/2.;
396 gMC->Gsvolu("QC04", "CONE", idtmed[7], conpar, 5);
f853b9aa 397 gMC->Gspos("QC04", 1, "ZDCC", 0., 0., -conpar[0]-zd1, 0, "ONLY");
8d433671 398 // Ch.debug
399 //printf("\n QC04 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
400
401 zd1 += conpar[0] * 2.;
402
403 tubpar[0] = 55./2.;
404 tubpar[1] = 55.4/2.;
405 tubpar[2] = 730./2.;
406 gMC->Gsvolu("QT12", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 407 gMC->Gspos("QT12", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 408 // Ch.debug
409 //printf("\n QT12 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
410
411 zd1 += tubpar[2] * 2.;
412
413 conpar[0] = 36.86/2.;
414 conpar[1] = 68./2.;
415 conpar[2] = 68.4/2.;
416 conpar[3] = 55./2.;
417 conpar[4] = 55.4/2.;
418 gMC->Gsvolu("QC05", "CONE", idtmed[7], conpar, 5);
f853b9aa 419 gMC->Gspos("QC05", 1, "ZDCC", 0., 0., -conpar[0]-zd1, 0, "ONLY");
8d433671 420 // Ch.debug
421 //printf("\n QC05 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
422
423 zd1 += conpar[0] * 2.;
424
425 tubpar[0] = 68./2.;
426 tubpar[1] = 68.4/2.;
427 tubpar[2] = 927.3/2.;
428 gMC->Gsvolu("QT13", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 429 gMC->Gspos("QT13", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 430 // Ch.debug
431 //printf("\n QT13 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
432
433 zd1 += tubpar[2] * 2.;
434
435 tubpar[0] = 0./2.;
436 tubpar[1] = 68.4/2.;
437 tubpar[2] = 0.2/2.;
438 gMC->Gsvolu("QT14", "TUBE", idtmed[8], tubpar, 3);
f853b9aa 439 gMC->Gspos("QT14", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 440 // Ch.debug
441 //printf("\n QT14 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
442
443 zd1 += tubpar[2] * 2.;
444
445 tubpar[0] = 0./2.;
446 tubpar[1] = 6.4/2.;
447 tubpar[2] = 0.2/2.;
448 gMC->Gsvolu("QT15", "TUBE", idtmed[11], tubpar, 3);
449 //-- Position QT15 inside QT14
450 gMC->Gspos("QT15", 1, "QT14", -7.7, 0., 0., 0, "ONLY");
451
452 gMC->Gsvolu("QT16", "TUBE", idtmed[11], tubpar, 3);
453 //-- Position QT16 inside QT14
454 gMC->Gspos("QT16", 1, "QT14", 7.7, 0., 0., 0, "ONLY");
455
456
457 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
458
459 tubpar[0] = 6.4/2.;
460 tubpar[1] = 6.8/2.;
461 tubpar[2] = 680.8/2.;
462 gMC->Gsvolu("QT17", "TUBE", idtmed[7], tubpar, 3);
463
464 tubpar[0] = 6.4/2.;
465 tubpar[1] = 6.8/2.;
466 tubpar[2] = 680.8/2.;
467 gMC->Gsvolu("QT18", "TUBE", idtmed[7], tubpar, 3);
468
469 // -- ROTATE PIPES
470 Float_t angle = 0.143*kDegrad; // Rotation angle
471
472 //AliMatrix(im1, 90.+0.143, 0., 90., 90., 0.143, 0.); // x<0
473 gMC->Matrix(im1, 90.+0.143, 0., 90., 90., 0.143, 0.); // x<0
f853b9aa 474 gMC->Gspos("QT17", 1, "ZDCC", TMath::Sin(angle) * 680.8/ 2. - 9.4,
8d433671 475 0., -tubpar[2]-zd1, im1, "ONLY");
2fdd1072 476 //printf("\n QT17-18 pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
8d433671 477
478 //AliMatrix(im2, 90.-0.143, 0., 90., 90., 0.143, 180.); // x>0 (ZP)
479 gMC->Matrix(im2, 90.-0.143, 0., 90., 90., 0.143, 180.); // x>0 (ZP)
f853b9aa 480 gMC->Gspos("QT18", 1, "ZDCC", 9.7 - TMath::Sin(angle) * 680.8 / 2.,
8d433671 481 0., -tubpar[2]-zd1, im2, "ONLY");
2fdd1072 482
483 // -- Luminometer (Cu box) in front of ZN - side C
484 boxpar[0] = 8.0/2.;
485 boxpar[1] = 8.0/2.;
486 boxpar[2] = 15./2.;
487 gMC->Gsvolu("QLUC", "BOX ", idtmed[6], boxpar, 3);
488 gMC->Gspos("QLUC", 1, "ZDCC", 0., 0., fPosZNC[2]+66.+boxpar[2], 0, "ONLY");
489 //printf("\n QLUC LUMINOMETER from z = %f to z= %f\n", fPosZNC[2]+66., fPosZNC[2]+66.+2*boxpar[2]);
8d433671 490
491 // -- END OF BEAM PIPE VOLUME DEFINITION FOR SIDE C (RB26 SIDE)
492 // ----------------------------------------------------------------
493
494 ////////////////////////////////////////////////////////////////
495 // //
496 // SIDE A - RB24 //
497 // //
498 ///////////////////////////////////////////////////////////////
499
500 // Rotation Matrices definition
501 Int_t irotpipe2, irotpipe1,irotpipe5, irotpipe6, irotpipe7, irotpipe8;
502 //-- rotation matrices for the tilted tube before and after the TDI
503 gMC->Matrix(irotpipe2,90.+6.3025,0.,90.,90.,6.3025,0.);
504 //-- rotation matrices for the tilted cone after the TDI to recenter vacuum chamber
505 gMC->Matrix(irotpipe1,90.-2.2918,0.,90.,90.,2.2918,180.);
506 //-- rotation matrices for the legs
507 gMC->Matrix(irotpipe5,90.-5.0109,0.,90.,90.,5.0109,180.);
508 gMC->Matrix(irotpipe6,90.+5.0109,0.,90.,90.,5.0109,0.);
509 gMC->Matrix(irotpipe7,90.-1.0027,0.,90.,90.,1.0027,180.);
510 gMC->Matrix(irotpipe8,90.+1.0027,0.,90.,90.,1.0027,0.);
511
512 // -- Mother of the ZDCs (Vacuum PCON)
513 zd2 = 1910.;// zd2 initial value
514
515 conpar[0] = 0.;
516 conpar[1] = 360.;
517 conpar[2] = 2.;
518 conpar[3] = zd2;
519 conpar[4] = 0.;
520 conpar[5] = 55.;
521 conpar[6] = 13500.;
522 conpar[7] = 0.;
523 conpar[8] = 55.;
f853b9aa 524 gMC->Gsvolu("ZDCA", "PCON", idtmed[10], conpar, 9);
525 gMC->Gspos("ZDCA", 1, "ALIC", 0., 0., 0., 0, "ONLY");
8d433671 526
f853b9aa 527 // BEAM PIPE from 19.10 m to inner triplet beginning (22.965 m)
8d433671 528 tubpar[0] = 6.0/2.;
529 tubpar[1] = 6.4/2.;
530 tubpar[2] = 386.5/2.;
cd807e71 531 gMC->Gsvolu("QA01", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 532 gMC->Gspos("QA01", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 533 // Ch.debug
f853b9aa 534 //printf("\n QA01 TUBE from z = %f to z= %f (Inner triplet beg.)\n",zd2,2*tubpar[2]+zd2);
8d433671 535
536 zd2 += 2.*tubpar[2];
537
538 // -- FIRST SECTION OF THE BEAM PIPE (from beginning of inner triplet to
f853b9aa 539 // beginning of D1)
8d433671 540 tubpar[0] = 6.3/2.;
541 tubpar[1] = 6.7/2.;
542 tubpar[2] = 3541.8/2.;
cd807e71 543 gMC->Gsvolu("QA02", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 544 gMC->Gspos("QA02", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 545 // Ch.debug
f853b9aa 546 //printf("\n QA02 TUBE from z = %f to z= %f (D1 beg.)\n",zd2,2*tubpar[2]+zd2);
8d433671 547
548 zd2 += 2.*tubpar[2];
549
550
551 // -- SECOND SECTION OF THE BEAM PIPE (from the beginning of D1 to the beginning of D2)
552 //
553 // FROM (MAGNETIC) BEGINNING OF D1 TO THE (MAGNETIC) END OF D1 + 126.5 cm
554 // CYLINDRICAL PIPE of diameter increasing from 6.75 cm up to 8.0 cm
555 // from magnetic end :
556 // 1) 80.1 cm still with ID = 6.75 radial beam screen
557 // 2) 2.5 cm conical section from ID = 6.75 to ID = 8.0 cm
558 // 3) 43.9 cm straight section (tube) with ID = 8.0 cm
f853b9aa 559 //
560 //printf("\n Beginning of D1 at z= %f\n",zd2);
8d433671 561
562 tubpar[0] = 6.75/2.;
563 tubpar[1] = 7.15/2.;
564 tubpar[2] = (945.0+80.1)/2.;
cd807e71 565 gMC->Gsvolu("QA03", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 566 gMC->Gspos("QA03", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 567 // Ch.debug
f853b9aa 568 //printf("\n QA03 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 569
570 zd2 += 2.*tubpar[2];
571
572 // Transition Cone from ID=67.5 mm to ID=80 mm
8d433671 573 conpar[0] = 2.5/2.;
574 conpar[1] = 6.75/2.;
575 conpar[2] = 7.15/2.;
576 conpar[3] = 8.0/2.;
577 conpar[4] = 8.4/2.;
cd807e71 578 gMC->Gsvolu("QA04", "CONE", idtmed[7], conpar, 5);
f853b9aa 579 gMC->Gspos("QA04", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
580 //printf(" QA04 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 581
582 zd2 += 2.*conpar[0];
583
584 tubpar[0] = 8.0/2.;
585 tubpar[1] = 8.4/2.;
586 tubpar[2] = 43.9/2.;
cd807e71 587 gMC->Gsvolu("QA05", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 588 gMC->Gspos("QA05", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 589 // Ch.debug
f853b9aa 590 //printf("\n QA05 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 591
592 zd2 += 2.*tubpar[2];
8d433671 593
594 // Bellow (ID=80 mm) - length = 0.2 m - VMAA
8d433671 595 tubpar[0] = 8.0/2.;
596 tubpar[1] = 8.4/2.;
597 tubpar[2] = 20./2.;
cd807e71 598 gMC->Gsvolu("QA06", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 599 gMC->Gspos("QA06", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 600 // Ch.debug
f853b9aa 601 //printf(" QA06 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 602
603 zd2 += 2.*tubpar[2];
604
f853b9aa 605 // Beam Position Monitor (ID=80 mm) Cu - BPMSX
8d433671 606 tubpar[0] = 8.0/2.;
607 tubpar[1] = 8.4/2.;
608 tubpar[2] = 28.5/2.;
cd807e71 609 gMC->Gsvolu("QA07", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 610 gMC->Gspos("QA07", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 611 // Ch.debug
f853b9aa 612 //printf(" QA07 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 613
614 zd2 += 2.*tubpar[2];
615
f853b9aa 616 // First section of VAEHI (tube ID=80mm)
8d433671 617 tubpar[0] = 8.0/2.;
618 tubpar[1] = 8.4/2.;
619 tubpar[2] = 28.5/2.;
cd807e71 620 gMC->Gsvolu("QAV1", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 621 gMC->Gspos("QAV1", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 622 // Ch.debug
f853b9aa 623 //printf(" QAV1 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 624
625 zd2 += 2.*tubpar[2];
626
f853b9aa 627 // Second section of VAEHI (transition cone from ID=80mm to ID=98mm)
8d433671 628 conpar[0] = 4.0/2.;
629 conpar[1] = 8.0/2.;
630 conpar[2] = 8.4/2.;
631 conpar[3] = 9.8/2.;
632 conpar[4] = 10.2/2.;
cd807e71 633 gMC->Gsvolu("QAV2", "CONE", idtmed[7], conpar, 5);
f853b9aa 634 gMC->Gspos("QAV2", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
635 //printf(" QAV2 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 636
637 zd2 += 2.*conpar[0];
638
f853b9aa 639 //Third section of VAEHI (transition cone from ID=98mm to ID=90mm)
8d433671 640 conpar[0] = 1.0/2.;
641 conpar[1] = 9.8/2.;
642 conpar[2] = 10.2/2.;
643 conpar[3] = 9.0/2.;
644 conpar[4] = 9.4/2.;
cd807e71 645 gMC->Gsvolu("QAV3", "CONE", idtmed[7], conpar, 5);
f853b9aa 646 gMC->Gspos("QAV3", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
647 //printf(" QAV3 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 648
649 zd2 += 2.*conpar[0];
650
f853b9aa 651 // Fourth section of VAEHI (tube ID=90mm)
8d433671 652 tubpar[0] = 9.0/2.;
653 tubpar[1] = 9.4/2.;
654 tubpar[2] = 31.0/2.;
cd807e71 655 gMC->Gsvolu("QAV4", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 656 gMC->Gspos("QAV4", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 657 // Ch.debug
f853b9aa 658 //printf(" QAV4 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 659
660 zd2 += 2.*tubpar[2];
661
8d433671 662 //---------------------------- TCDD beginning ----------------------------------
663 // space for the insertion of the collimator TCDD (2 m)
8d433671 664 // TCDD ZONE - 1st volume
665 conpar[0] = 1.3/2.;
666 conpar[1] = 9.0/2.;
667 conpar[2] = 13.0/2.;
668 conpar[3] = 9.6/2.;
669 conpar[4] = 13.0/2.;
cd807e71 670 gMC->Gsvolu("Q01T", "CONE", idtmed[7], conpar, 5);
f853b9aa 671 gMC->Gspos("Q01T", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
672 //printf(" Q01T CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 673
674 zd2 += 2.*conpar[0];
675
676 // TCDD ZONE - 2nd volume
677 tubpar[0] = 9.6/2.;
678 tubpar[1] = 10.0/2.;
679 tubpar[2] = 1.0/2.;
cd807e71 680 gMC->Gsvolu("Q02T", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 681 gMC->Gspos("Q02T", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 682 // Ch.debug
f853b9aa 683 //printf(" Q02T TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 684
685 zd2 += 2.*tubpar[2];
686
687 // TCDD ZONE - third volume
688 conpar[0] = 9.04/2.;
689 conpar[1] = 9.6/2.;
690 conpar[2] = 10.0/2.;
691 conpar[3] = 13.8/2.;
692 conpar[4] = 14.2/2.;
cd807e71 693 gMC->Gsvolu("Q03T", "CONE", idtmed[7], conpar, 5);
f853b9aa 694 gMC->Gspos("Q03T", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
695 //printf(" Q03T CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 696
697 zd2 += 2.*conpar[0];
698
699 // TCDD ZONE - 4th volume
700 tubpar[0] = 13.8/2.;
701 tubpar[1] = 14.2/2.;
702 tubpar[2] = 38.6/2.;
cd807e71 703 gMC->Gsvolu("Q04T", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 704 gMC->Gspos("Q04T", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 705 // Ch.debug
f853b9aa 706 //printf(" Q04T TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 707
708 zd2 += 2.*tubpar[2];
709
710 // TCDD ZONE - 5th volume
711 tubpar[0] = 21.0/2.;
712 tubpar[1] = 21.4/2.;
713 tubpar[2] = 100.12/2.;
cd807e71 714 gMC->Gsvolu("Q05T", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 715 gMC->Gspos("Q05T", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 716 // Ch.debug
f853b9aa 717 //printf(" Q05T TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 718
719 zd2 += 2.*tubpar[2];
720
721 // TCDD ZONE - 6th volume
722 tubpar[0] = 13.8/2.;
723 tubpar[1] = 14.2/2.;
724 tubpar[2] = 38.6/2.;
cd807e71 725 gMC->Gsvolu("Q06T", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 726 gMC->Gspos("Q06T", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 727 // Ch.debug
f853b9aa 728 //printf(" Q06T TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 729
730 zd2 += 2.*tubpar[2];
731
732 // TCDD ZONE - 7th volume
733 conpar[0] = 11.34/2.;
734 conpar[1] = 13.8/2.;
735 conpar[2] = 14.2/2.;
736 conpar[3] = 18.0/2.;
737 conpar[4] = 18.4/2.;
cd807e71 738 gMC->Gsvolu("Q07T", "CONE", idtmed[7], conpar, 5);
f853b9aa 739 gMC->Gspos("Q07T", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
740 //printf(" Q07T CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 741
742 zd2 += 2.*conpar[0];
743
f853b9aa 744 // Upper section : one single phi segment of a tube
745 // 5 parameters for tubs: inner radius = 0.,
746 // outer radius = 7.5 cm, half length = 50 cm
747 // phi1 = 0., phi2 = 180.
8d433671 748 tubspar[0] = 0.0/2.;
749 tubspar[1] = 15.0/2.;
750 tubspar[2] = 100.0/2.;
751 tubspar[3] = 0.;
752 tubspar[4] = 180.;
cd807e71 753 gMC->Gsvolu("Q08T", "TUBS", idtmed[7], tubspar, 5);
8d433671 754 // Ch.debug
f853b9aa 755 //printf("\n upper part : one single phi segment of a tube (Q08T)\n");
756
757 // rectangular beam pipe inside TCDD upper section (Vacuum)
8d433671 758 boxpar[0] = 7.0/2.;
759 boxpar[1] = 2.5/2.;
760 boxpar[2] = 100./2.;
761 gMC->Gsvolu("Q09T", "BOX ", idtmed[10], boxpar, 3);
f853b9aa 762 // positioning vacuum box in the upper section of TCDD
8d433671 763 gMC->Gspos("Q09T", 1, "Q08T", 0., 1.25, 0., 0, "ONLY");
764
f853b9aa 765 // lower section : one single phi segment of a tube
8d433671 766 tubspar[0] = 0.0/2.;
767 tubspar[1] = 15.0/2.;
768 tubspar[2] = 100.0/2.;
769 tubspar[3] = 180.;
770 tubspar[4] = 360.;
cd807e71 771 gMC->Gsvolu("Q10T", "TUBS", idtmed[7], tubspar, 5);
f853b9aa 772 // rectangular beam pipe inside TCDD lower section (Vacuum)
8d433671 773 boxpar[0] = 7.0/2.;
774 boxpar[1] = 2.5/2.;
775 boxpar[2] = 100./2.;
776 gMC->Gsvolu("Q11T", "BOX ", idtmed[10], boxpar, 3);
f853b9aa 777 // positioning vacuum box in the lower section of TCDD
8d433671 778 gMC->Gspos("Q11T", 1, "Q10T", 0., -1.25, 0., 0, "ONLY");
779
780 // positioning TCDD elements in ZDC2, (inside TCDD volume)
f853b9aa 781 gMC->Gspos("Q08T", 1, "ZDCA", 0., 2.5, -100+zd2, 0, "ONLY");
782 gMC->Gspos("Q10T", 1, "ZDCA", 0., -2.5, -100+zd2, 0, "ONLY");
8d433671 783
784 // RF screen
785 boxpar[0] = 0.2/2.;
786 boxpar[1] = 5.0/2.;
787 boxpar[2] = 100./2.;
cd807e71 788 gMC->Gsvolu("Q12T", "BOX ", idtmed[7], boxpar, 3);
8d433671 789 // positioning RF screen at both sides of TCDD
f853b9aa 790 gMC->Gspos("Q12T", 1, "ZDCA", tubspar[1]+boxpar[0], 0., -100+zd2, 0, "ONLY");
791 gMC->Gspos("Q12T", 2, "ZDCA", -tubspar[1]-boxpar[0], 0., -100+zd2, 0, "ONLY");
8d433671 792 //---------------------------- TCDD end ---------------------------------------
793
794 // Bellow (ID=80 mm) - length = 0.3 m - VMAAB
795 tubpar[0] = 8.0/2.;
796 tubpar[1] = 8.4/2.;
797 tubpar[2] = 30.0/2.;
cd807e71 798 gMC->Gsvolu("QA08", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 799 gMC->Gspos("QA08", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 800 // Ch.debug
f853b9aa 801 //printf(" QA08 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 802
803 zd2 += 2.*tubpar[2];
804
f853b9aa 805 // Flange (ID=80 mm) Cu (first section of VCTCE)
8d433671 806 tubpar[0] = 8.0/2.;
807 tubpar[1] = 8.4/2.;
808 tubpar[2] = 2.0/2.;
cd807e71 809 gMC->Gsvolu("QA09", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 810 gMC->Gspos("QA09", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 811 // Ch.debug
f853b9aa 812 //printf(" QA09 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 813
814 zd2 += 2.*tubpar[2];
815
f853b9aa 816 // transition cone from ID=80 to ID=212 (second section of VCTCE)
8d433671 817 conpar[0] = 25.0/2.;
818 conpar[1] = 8.0/2.;
819 conpar[2] = 8.4/2.;
820 conpar[3] = 21.2/2.;
821 conpar[4] = 21.8/2.;
cd807e71 822 gMC->Gsvolu("QA10", "CONE", idtmed[7], conpar, 5);
f853b9aa 823 gMC->Gspos("QA10", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
824 //printf(" QA10 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 825
826 zd2 += 2.*conpar[0];
827
f853b9aa 828 // tube (ID=212 mm) Cu (third section of VCTCE)
8d433671 829 tubpar[0] = 21.2/2.;
830 tubpar[1] = 21.8/2.;
831 tubpar[2] = 403.54/2.;
cd807e71 832 gMC->Gsvolu("QA11", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 833 gMC->Gspos("QA11", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 834 // Ch.debug
f853b9aa 835 //printf(" QA11 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 836
837 zd2 += 2.*tubpar[2];
838
839 // bellow (ID=212 mm) (VMBGA)
8d433671 840 tubpar[0] = 21.2/2.;
841 tubpar[1] = 21.8/2.;
842 tubpar[2] = 40.0/2.;
cd807e71 843 gMC->Gsvolu("QA12", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 844 gMC->Gspos("QA12", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 845 // Ch.debug
f853b9aa 846 //printf(" QA12 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 847
848 zd2 += 2.*tubpar[2];
849
850 // TDI valve assembly (ID=212 mm)
8d433671 851 tubpar[0] = 21.2/2.;
852 tubpar[1] = 21.8/2.;
853 tubpar[2] = 30.0/2.;
cd807e71 854 gMC->Gsvolu("QA13", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 855 gMC->Gspos("QA13", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 856 // Ch.debug
f853b9aa 857 //printf(" QA13 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 858
859 zd2 += 2.*tubpar[2];
860
861 // bellow (ID=212 mm) (VMBGA)
8d433671 862 tubpar[0] = 21.2/2.;
863 tubpar[1] = 21.8/2.;
864 tubpar[2] = 40.0/2.;
cd807e71 865 gMC->Gsvolu("QA14", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 866 gMC->Gspos("QA14", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 867 // Ch.debug
f853b9aa 868 //printf(" QA14 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 869
870 zd2 += 2.*tubpar[2];
871
872 // skewed transition piece (ID=212 mm) (before TDI)
8d433671 873 tubpar[0] = 21.2/2.;
874 tubpar[1] = 21.8/2.;
875 tubpar[2] = 20.0/2.;
cd807e71 876 gMC->Gsvolu("QA15", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 877 gMC->Gspos("QA15", 1, "ZDCA", 1.10446, 0., tubpar[2]+zd2, irotpipe2, "ONLY");
8d433671 878 // Ch.debug
f853b9aa 879 //printf(" QA15 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 880
881 zd2 += 2.*tubpar[2];
882
f853b9aa 883 // Vacuum chamber containing TDI
8d433671 884 tubpar[0] = 54.0/2.;
885 tubpar[1] = 54.6/2.;
886 tubpar[2] = 540.0/2.;
cd807e71 887 gMC->Gsvolu("Q13T", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 888 gMC->Gspos("Q13T", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 889 // Ch.debug
f853b9aa 890 //printf(" Q13T TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 891
892 zd2 += 2.*tubpar[2];
893
f853b9aa 894 //---------------- INSERT TDI INSIDE Q13T -----------------------------------
8d433671 895 boxpar[0] = 11.0/2.;
896 boxpar[1] = 9.0/2.;
897 boxpar[2] = 540.0/2.;
cd807e71 898 gMC->Gsvolu("QTD1", "BOX ", idtmed[7], boxpar, 3);
8d433671 899 gMC->Gspos("QTD1", 1, "Q13T", -3.8, 10.5, 0., 0, "ONLY");
900 boxpar[0] = 11.0/2.;
901 boxpar[1] = 9.0/2.;
902 boxpar[2] = 540.0/2.;
cd807e71 903 gMC->Gsvolu("QTD2", "BOX ", idtmed[7], boxpar, 3);
8d433671 904 gMC->Gspos("QTD2", 1, "Q13T", -3.8, -10.5, 0., 0, "ONLY");
905 boxpar[0] = 5.1/2.;
906 boxpar[1] = 0.2/2.;
907 boxpar[2] = 540.0/2.;
cd807e71 908 gMC->Gsvolu("QTD3", "BOX ", idtmed[7], boxpar, 3);
8d433671 909 gMC->Gspos("QTD3", 1, "Q13T", -3.8+5.5+boxpar[0], 6.1, 0., 0, "ONLY");
910 gMC->Gspos("QTD3", 2, "Q13T", -3.8+5.5+boxpar[0], -6.1, 0., 0, "ONLY");
911 gMC->Gspos("QTD3", 3, "Q13T", -3.8-5.5-boxpar[0], 6.1, 0., 0, "ONLY");
912 gMC->Gspos("QTD3", 4, "Q13T", -3.8-5.5-boxpar[0], -6.1, 0., 0, "ONLY");
f853b9aa 913 //
8d433671 914 tubspar[0] = 12.0/2.;
915 tubspar[1] = 12.4/2.;
916 tubspar[2] = 540.0/2.;
917 tubspar[3] = 90.;
918 tubspar[4] = 270.;
cd807e71 919 gMC->Gsvolu("QTD4", "TUBS", idtmed[7], tubspar, 5);
8d433671 920 gMC->Gspos("QTD4", 1, "Q13T", -3.8-10.6, 0., 0., 0, "ONLY");
921 tubspar[0] = 12.0/2.;
922 tubspar[1] = 12.4/2.;
923 tubspar[2] = 540.0/2.;
924 tubspar[3] = -90.;
925 tubspar[4] = 90.;
cd807e71 926 gMC->Gsvolu("QTD5", "TUBS", idtmed[7], tubspar, 5);
8d433671 927 gMC->Gspos("QTD5", 1, "Q13T", -3.8+10.6, 0., 0., 0, "ONLY");
8d433671 928 //---------------- END DEFINING TDI INSIDE Q13T -------------------------------
929
930 // skewed transition piece (ID=212 mm) (after TDI)
931 tubpar[0] = 21.2/2.;
932 tubpar[1] = 21.8/2.;
933 tubpar[2] = 20.0/2.;
cd807e71 934 gMC->Gsvolu("QA16", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 935 gMC->Gspos("QA16", 1, "ZDCA", 1.10446+2.2, 0., tubpar[2]+zd2, irotpipe2, "ONLY");
8d433671 936 // Ch.debug
f853b9aa 937 //printf(" QA16 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 938
939 zd2 += 2.*tubpar[2];
940
941 // bellow (ID=212 mm) (VMBGA)
942 tubpar[0] = 21.2/2.;
943 tubpar[1] = 21.8/2.;
944 tubpar[2] = 40.0/2.;
cd807e71 945 gMC->Gsvolu("QA17", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 946 gMC->Gspos("QA17", 1, "ZDCA", 4.4, 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 947 // Ch.debug
f853b9aa 948 //printf(" QA17 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 949
950 zd2 += 2.*tubpar[2];
951
952 // TDI valve assembly (ID=212 mm)
953 tubpar[0] = 21.2/2.;
954 tubpar[1] = 21.8/2.;
955 tubpar[2] = 30.0/2.;
cd807e71 956 gMC->Gsvolu("QA18", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 957 gMC->Gspos("QA18", 1, "ZDCA", 4.4, 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 958 // Ch.debug
f853b9aa 959 //printf(" QA18 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 960
961 zd2 += 2.*tubpar[2];
962
963 // bellow (ID=212 mm) (VMBGA)
964 tubpar[0] = 21.2/2.;
965 tubpar[1] = 21.8/2.;
966 tubpar[2] = 40.0/2.;
cd807e71 967 gMC->Gsvolu("QA19", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 968 gMC->Gspos("QA19", 1, "ZDCA", 4.4, 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 969 // Ch.debug
f853b9aa 970 //printf(" QA19 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 971
972 zd2 += 2.*tubpar[2];
973
974 // vacuum chamber (ID=212 mm) (BTVST)
975 tubpar[0] = 21.2/2.;
976 tubpar[1] = 21.8/2.;
977 tubpar[2] = 50.0/2.;
cd807e71 978 gMC->Gsvolu("QA20", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 979 gMC->Gspos("QA20", 1, "ZDCA", 4.4, 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 980 // Ch.debug
f853b9aa 981 //printf(" QA20 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 982
983 zd2 += 2.*tubpar[2];
984
985 // bellow (ID=212 mm) (VMBGA) repeated 3 times
986 tubpar[0] = 21.2/2.;
987 tubpar[1] = 21.8/2.;
988 tubpar[2] = 120.0/2.;
cd807e71 989 gMC->Gsvolu("QA21", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 990 gMC->Gspos("QA21", 1, "ZDCA", 4.4, 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 991 // Ch.debug
f853b9aa 992 //printf(" QA21 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 993
994 zd2 += 2.*tubpar[2];
995
996 // skewed transition cone from ID=212 mm to ID=797 mm SS for the moment
997 conpar[0] = 110.0/2.;
998 conpar[1] = 21.2/2.;
999 conpar[2] = 21.8/2.;
1000 conpar[3] = 79.7/2.;
1001 conpar[4] = 81.3/2.;
cd807e71 1002 gMC->Gsvolu("QA22", "CONE", idtmed[7], conpar, 5);
f853b9aa 1003 gMC->Gspos("QA22", 1, "ZDCA", 4.4-2.201, 0., conpar[0]+zd2, irotpipe1, "ONLY");
1004 //printf(" QA22 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 1005
1006 zd2 += 2.*conpar[0];
1007
1008 // beam pipe (ID=797 mm) SS
1009 tubpar[0] = 79.7/2.;
1010 tubpar[1] = 81.3/2.;
1011 tubpar[2] = 2393.05/2.;
cd807e71 1012 gMC->Gsvolu("QA23", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1013 gMC->Gspos("QA23", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1014 // Ch.debug
9c374a22 1015 //printf(" QA23 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1016
1017 zd2 += 2.*tubpar[2];
1018
1019 // Transition from ID=797 mm to ID=196 mm SS for the moment:
1020 //
1021 // in order to simulate the thin window opened in the transition cone
1022 // we divide the transition cone in three cones:
1023 // the first 8 mm thick
1024 // the second 3 mm thick
1025 // the third 8 mm thick
f853b9aa 1026 //
1027 // First section
8d433671 1028 conpar[0] = 9.09/2.; // 15 degree
1029 conpar[1] = 79.7/2.;
1030 conpar[2] = 81.3/2.; // thickness 8 mm
1031 conpar[3] = 74.82868/2.;
1032 conpar[4] = 76.42868/2.; // thickness 8 mm
cd807e71 1033 gMC->Gsvolu("Q24A", "CONE", idtmed[7], conpar, 5);
f853b9aa 1034 gMC->Gspos("Q24A", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
1035 //printf(" Q24A CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 1036
1037 zd2 += 2.*conpar[0];
1038
f853b9aa 1039 // Second section
8d433671 1040 conpar[0] = 96.2/2.; // 15 degree
1041 conpar[1] = 74.82868/2.;
1042 conpar[2] = 75.42868/2.; // thickness 3 mm
1043 conpar[3] = 23.19588/2.;
1044 conpar[4] = 23.79588/2.; // thickness 3 mm
cd807e71 1045 gMC->Gsvolu("QA25", "CONE", idtmed[7], conpar, 5);
f853b9aa 1046 gMC->Gspos("QA25", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
1047 //printf(" QA25 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 1048
1049 zd2 += 2.*conpar[0];
1050
f853b9aa 1051 // Third section
8d433671 1052 conpar[0] = 6.71/2.; // 15 degree
1053 conpar[1] = 23.19588/2.;
1054 conpar[2] = 24.79588/2.;// thickness 8 mm
1055 conpar[3] = 19.6/2.;
1056 conpar[4] = 21.2/2.;// thickness 8 mm
cd807e71 1057 gMC->Gsvolu("QA26", "CONE", idtmed[7], conpar, 5);
f853b9aa 1058 gMC->Gspos("QA26", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
1059 //printf(" QA26 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 1060
1061 zd2 += 2.*conpar[0];
1062
1063 // beam pipe (ID=196 mm)
1064 tubpar[0] = 19.6/2.;
1065 tubpar[1] = 21.2/2.;
1066 tubpar[2] = 9.55/2.;
cd807e71 1067 gMC->Gsvolu("QA27", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1068 gMC->Gspos("QA27", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1069 // Ch.debug
f853b9aa 1070 //printf(" QA27 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1071
1072 zd2 += 2.*tubpar[2];
1073
1074 // Flange (ID=196 mm)
1075 tubpar[0] = 19.6/2.;
1076 tubpar[1] = 25.3/2.;
1077 tubpar[2] = 4.9/2.;
cd807e71 1078 gMC->Gsvolu("QF01", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1079 gMC->Gspos("QF01", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1080 // Ch.debug
f853b9aa 1081 //printf(" QF01 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1082
1083 zd2 += 2.*tubpar[2];
1084
1085 // Special Warm Module (made by 5 volumes)
8d433671 1086 tubpar[0] = 20.2/2.;
1087 tubpar[1] = 20.6/2.;
1088 tubpar[2] = 2.15/2.;
cd807e71 1089 gMC->Gsvolu("QA28", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1090 gMC->Gspos("QA28", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1091 // Ch.debug
f853b9aa 1092 //printf(" QA28 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1093
1094 zd2 += 2.*tubpar[2];
1095
1096 conpar[0] = 6.9/2.;
1097 conpar[1] = 20.2/2.;
1098 conpar[2] = 20.6/2.;
1099 conpar[3] = 23.9/2.;
1100 conpar[4] = 24.3/2.;
cd807e71 1101 gMC->Gsvolu("QA29", "CONE", idtmed[7], conpar, 5);
f853b9aa 1102 gMC->Gspos("QA29", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
8d433671 1103 // Ch.debug
f853b9aa 1104 //printf(" QA29 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 1105
1106 zd2 += 2.*conpar[0];
1107
1108 tubpar[0] = 23.9/2.;
1109 tubpar[1] = 25.5/2.;
1110 tubpar[2] = 17.0/2.;
cd807e71 1111 gMC->Gsvolu("QA30", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1112 gMC->Gspos("QA30", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1113 // Ch.debug
f853b9aa 1114 //printf(" QA30 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1115
1116 zd2 += 2.*tubpar[2];
1117
1118 conpar[0] = 6.9/2.;
1119 conpar[1] = 23.9/2.;
1120 conpar[2] = 24.3/2.;
1121 conpar[3] = 20.2/2.;
1122 conpar[4] = 20.6/2.;
cd807e71 1123 gMC->Gsvolu("QA31", "CONE", idtmed[7], conpar, 5);
f853b9aa 1124 gMC->Gspos("QA31", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
8d433671 1125 // Ch.debug
f853b9aa 1126 //printf(" QA31 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 1127
1128 zd2 += 2.*conpar[0];
1129
1130 tubpar[0] = 20.2/2.;
1131 tubpar[1] = 20.6/2.;
1132 tubpar[2] = 2.15/2.;
cd807e71 1133 gMC->Gsvolu("QA32", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1134 gMC->Gspos("QA32", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1135 // Ch.debug
f853b9aa 1136 //printf(" QA32 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1137
1138 zd2 += 2.*tubpar[2];
1139
1140 // Flange (ID=196 mm)
1141 tubpar[0] = 19.6/2.;
1142 tubpar[1] = 25.3/2.;
1143 tubpar[2] = 4.9/2.;
cd807e71 1144 gMC->Gsvolu("QF02", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1145 gMC->Gspos("QF02", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1146 // Ch.debug
f853b9aa 1147 //printf(" QF02 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1148
1149 zd2 += 2.*tubpar[2];
1150
1151 // simulation of the trousers (VCTYB)
addda976 1152 // (last design -mail 3/6/05)
8d433671 1153 // pipe: a tube (ID = 196. OD = 200.)
1154 tubpar[0] = 19.6/2.;
1155 tubpar[1] = 20.0/2.;
1156 tubpar[2] = 3.9/2.;
cd807e71 1157 gMC->Gsvolu("QA33", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1158 gMC->Gspos("QA33", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1159 // Ch.debug
f853b9aa 1160 //printf(" QA33 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1161
1162 zd2 += 2.*tubpar[2];
1163
1164 // transition cone from ID=196. to ID=216.6
1165 conpar[0] = 32.55/2.;
1166 conpar[1] = 19.6/2.;
1167 conpar[2] = 20.0/2.;
1168 conpar[3] = 21.66/2.;
1169 conpar[4] = 22.06/2.;
cd807e71 1170 gMC->Gsvolu("QA34", "CONE", idtmed[7], conpar, 5);
f853b9aa 1171 gMC->Gspos("QA34", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
8d433671 1172 // Ch.debug
f853b9aa 1173 //printf(" QA34 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 1174
1175 zd2 += 2.*conpar[0];
1176
1177 // Flange: first support for the trousers
1178 boxpar[0] = 25.3/2.;
1179 boxpar[1] = 25.3/2.;
1180 boxpar[2] = 2.5/2.;
cd807e71 1181 gMC->Gsvolu("QF03", "BOX ", idtmed[7], boxpar, 3);
8d433671 1182 tubpar[0] = 0.0/2.;
1183 tubpar[1] = 22.06/2.;
1184 tubpar[2] = 2.5/2.;
1185 gMC->Gsvolu("QFV1", "TUBE", idtmed[10], tubpar, 3);
1186 gMC->Gspos("QFV1", 1, "QF03", 0., 0., 0., 0, "MANY");
f853b9aa 1187 gMC->Gspos("QF03", 1, "ZDCA", 0., 0., 14.3+zd2, 0, "MANY");
8d433671 1188
1189 // tube
1190 tubpar[0] = 21.66/2.;
1191 tubpar[1] = 22.06/2.;
1192 tubpar[2] = 28.6/2.;
cd807e71 1193 gMC->Gsvolu("QA35", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1194 gMC->Gspos("QA35", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1195 // Ch.debug
f853b9aa 1196 //printf("\n QA35 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1197
1198 zd2 += 2.*tubpar[2];
1199
1200 // legs of the trousers
8d433671 1201 conpar[0] = (90.1+0.8)/2.;
1202 conpar[1] = 0.0/2.;
1203 conpar[2] = 21.6/2.;
1204 conpar[3] = 0.0/2.;
1205 conpar[4] = 5.8/2.;
cd807e71 1206 gMC->Gsvolu("QAL1", "CONE", idtmed[7], conpar, 5);
1207 gMC->Gsvolu("QAL2", "CONE", idtmed[7], conpar, 5);
f853b9aa 1208 gMC->Gspos("QAL1", 1, "ZDCA", -3.45-0.52, 0., (90.1/2.)+zd2, irotpipe5, "MANY");
1209 gMC->Gspos("QAL2", 1, "ZDCA", 3.45+0.52, 0., (90.1/2.)+zd2, irotpipe6, "MANY");
8d433671 1210
1211 conpar[0] = (90.1+0.8)/2.;
1212 conpar[1] = 0.0/2.;
1213 conpar[2] = 21.2/2.;
1214 conpar[3] = 0.0/2.;
1215 conpar[4] = 5.4/2.;
1216 gMC->Gsvolu("QAL3", "CONE", idtmed[10], conpar, 5);
1217 gMC->Gsvolu("QAL4", "CONE", idtmed[10], conpar, 5);
f853b9aa 1218 gMC->Gspos("QAL3", 1, "ZDCA", -3.45-0.52, 0., (90.1/2.)+zd2, irotpipe5, "ONLY");
1219 gMC->Gspos("QAL4", 1, "ZDCA", 3.45+0.52, 0., (90.1/2.)+zd2, irotpipe6, "ONLY");
8d433671 1220
8d433671 1221 zd2 += 90.1;
1222
f853b9aa 1223 // second section : 2 tubes (ID = 54. OD = 58.)
8d433671 1224 tubpar[0] = 5.4/2.;
1225 tubpar[1] = 5.8/2.;
1226 tubpar[2] = 40.0/2.;
cd807e71 1227 gMC->Gsvolu("QA36", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1228 gMC->Gspos("QA36", 1, "ZDCA", -15.8/2., 0., tubpar[2]+zd2, 0, "ONLY");
1229 gMC->Gspos("QA36", 2, "ZDCA", 15.8/2., 0., tubpar[2]+zd2, 0, "ONLY");
8d433671 1230 // Ch.debug
f853b9aa 1231 //printf(" QA36 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1232
1233 zd2 += 2.*tubpar[2];
1234
1235 // transition x2zdc to recombination chamber : skewed cone
1236 conpar[0] = 10./2.;
1237 conpar[1] = 5.4/2.;
1238 conpar[2] = 5.8/2.;
1239 conpar[3] = 6.3/2.;
1240 conpar[4] = 7.0/2.;
cd807e71 1241 gMC->Gsvolu("QA37", "CONE", idtmed[7], conpar, 5);
f853b9aa 1242 gMC->Gspos("QA37", 1, "ZDCA", -7.9-0.175, 0., conpar[0]+zd2, irotpipe7, "ONLY");
1243 gMC->Gspos("QA37", 2, "ZDCA", 7.9+0.175, 0., conpar[0]+zd2, irotpipe8, "ONLY");
1244 //printf(" QA37 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
8d433671 1245
1246 zd2 += 2.*conpar[0];
1247
1248 // Flange: second support for the trousers
8d433671 1249 boxpar[0] = 25.9/2.;
1250 boxpar[1] = 9.4/2.;
1251 boxpar[2] = 1./2.;
cd807e71 1252 gMC->Gsvolu("QF04", "BOX ", idtmed[7], boxpar, 3);
8d433671 1253 boxpar[0] = 16.5/2.;
1254 boxpar[1] = 7./2.;
1255 boxpar[2] = 1./2.;
1256 gMC->Gsvolu("QFV2", "BOX ", idtmed[10], boxpar, 3);
1257 gMC->Gspos("QFV2", 1, "QF04", 0., 0., 0., 0, "MANY");
1258 tubspar[0] = 0.0/2.;
1259 tubspar[1] = 7./2.;
1260 tubspar[2] = 1./2.;
1261 tubspar[3] = 90.;
1262 tubspar[4] = 270.;
1263 gMC->Gsvolu("QFV3", "TUBS", idtmed[10], tubspar, 5);
1264 gMC->Gspos("QFV3", 1, "QF04", -16.5/2., 0., 0., 0, "MANY");
1265 tubspar[0] = 0.0/2.;
1266 tubspar[1] = 7./2.;
1267 tubspar[2] = 1./2.;
1268 tubspar[3] = -90.;
1269 tubspar[4] = 90.;
1270 gMC->Gsvolu("QFV4", "TUBS", idtmed[10], tubspar, 5);
1271 gMC->Gspos("QFV4", 1, "QF04", 16.5/2., 0., 0., 0, "MANY");
f853b9aa 1272 gMC->Gspos("QF04", 1, "ZDCA", 0., 0., 18.5+zd2, 0, "MANY");
8d433671 1273
8d433671 1274 // 2 tubes (ID = 63 mm OD=70 mm)
1275 tubpar[0] = 6.3/2.;
1276 tubpar[1] = 7.0/2.;
1277 tubpar[2] = 512.9/2.;
cd807e71 1278 gMC->Gsvolu("QA38", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1279 gMC->Gspos("QA38", 1, "ZDCA", -16.5/2., 0., tubpar[2]+zd2, 0, "ONLY");
1280 gMC->Gspos("QA38", 2, "ZDCA", 16.5/2., 0., tubpar[2]+zd2, 0, "ONLY");
1281 //printf(" QA38 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
8d433671 1282
1283 zd2 += 2.*tubpar[2];
f853b9aa 1284 //printf("\n END OF BEAM PIPE VOLUME DEFINITION AT z= %f\n",zd2);
2fdd1072 1285
1286 // -- Luminometer (Cu box) in front of ZN - side A
1287 boxpar[0] = 8.0/2.;
1288 boxpar[1] = 8.0/2.;
1289 boxpar[2] = 15./2.;
cd807e71 1290 gMC->Gsvolu("QLUA", "BOX ", idtmed[7], boxpar, 3);
2fdd1072 1291 gMC->Gspos("QLUA", 1, "ZDCA", 0., 0., fPosZNA[2]-66.-boxpar[2], 0, "ONLY");
1292 //printf("\n QLUC LUMINOMETER from z = %f to z= %f\n\n", fPosZNA[2]-66., fPosZNA[2]-66.-2*boxpar[2]);
8d433671 1293
1294
1295 // ----------------------------------------------------------------
1296 // -- MAGNET DEFINITION -> LHC OPTICS 6.5
1297 // ----------------------------------------------------------------
1298 // ***************************************************************
1299 // SIDE C - RB26 (dimuon side)
1300 // ***************************************************************
1301 // -- COMPENSATOR DIPOLE (MBXW)
1302 zc = 1921.6;
1303
1304 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1305 tubpar[0] = 0.;
1306 tubpar[1] = 4.5;
1307 tubpar[2] = 170./2.;
1308 gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
1309
1310 // -- YOKE
1311 tubpar[0] = 4.5;
1312 tubpar[1] = 55.;
1313 tubpar[2] = 170./2.;
cd807e71 1314 gMC->Gsvolu("YMBX", "TUBE", idtmed[7], tubpar, 3);
8d433671 1315
f853b9aa 1316 gMC->Gspos("MBXW", 1, "ZDCC", 0., 0., -tubpar[2]-zc, 0, "ONLY");
1317 gMC->Gspos("YMBX", 1, "ZDCC", 0., 0., -tubpar[2]-zc, 0, "ONLY");
8d433671 1318
1319
1320 // -- INNER TRIPLET
1321 zq = 2296.5;
1322
1323 // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT
1324 // -- MQXL
1325 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1326 tubpar[0] = 0.;
1327 tubpar[1] = 3.5;
1328 tubpar[2] = 637./2.;
1329 gMC->Gsvolu("MQXL", "TUBE", idtmed[11], tubpar, 3);
f853b9aa 1330
8d433671 1331 // -- YOKE
1332 tubpar[0] = 3.5;
1333 tubpar[1] = 22.;
1334 tubpar[2] = 637./2.;
1335 gMC->Gsvolu("YMQL", "TUBE", idtmed[7], tubpar, 3);
1336
f853b9aa 1337 gMC->Gspos("MQXL", 1, "ZDCC", 0., 0., -tubpar[2]-zq, 0, "ONLY");
1338 gMC->Gspos("YMQL", 1, "ZDCC", 0., 0., -tubpar[2]-zq, 0, "ONLY");
8d433671 1339
f853b9aa 1340 gMC->Gspos("MQXL", 2, "ZDCC", 0., 0., -tubpar[2]-zq-2430., 0, "ONLY");
1341 gMC->Gspos("YMQL", 2, "ZDCC", 0., 0., -tubpar[2]-zq-2430., 0, "ONLY");
8d433671 1342
1343 // -- MQX
1344 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1345 tubpar[0] = 0.;
1346 tubpar[1] = 3.5;
1347 tubpar[2] = 550./2.;
1348 gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3);
1349
1350 // -- YOKE
1351 tubpar[0] = 3.5;
1352 tubpar[1] = 22.;
1353 tubpar[2] = 550./2.;
1354 gMC->Gsvolu("YMQ ", "TUBE", idtmed[7], tubpar, 3);
1355
f853b9aa 1356 gMC->Gspos("MQX ", 1, "ZDCC", 0., 0., -tubpar[2]-zq-908.5, 0, "ONLY");
1357 gMC->Gspos("YMQ ", 1, "ZDCC", 0., 0., -tubpar[2]-zq-908.5, 0, "ONLY");
8d433671 1358
f853b9aa 1359 gMC->Gspos("MQX ", 2, "ZDCC", 0., 0., -tubpar[2]-zq-1558.5, 0, "ONLY");
1360 gMC->Gspos("YMQ ", 2, "ZDCC", 0., 0., -tubpar[2]-zq-1558.5, 0, "ONLY");
8d433671 1361
1362 // -- SEPARATOR DIPOLE D1
1363 zd1 = 5838.3;
1364
1365 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1366 tubpar[0] = 0.;
1367 tubpar[1] = 6.94/2.;
1368 tubpar[2] = 945./2.;
1369 gMC->Gsvolu("MD1 ", "TUBE", idtmed[11], tubpar, 3);
1370
1371 // -- Insert horizontal Cu plates inside D1
1372 // -- (to simulate the vacuum chamber)
1373 boxpar[0] = TMath::Sqrt(tubpar[1]*tubpar[1]-(2.98+0.2)*(2.98+0.2)) - 0.05;
1374 boxpar[1] = 0.2/2.;
1375 boxpar[2] =945./2.;
1376 gMC->Gsvolu("MD1V", "BOX ", idtmed[6], boxpar, 3);
1377 gMC->Gspos("MD1V", 1, "MD1 ", 0., 2.98+boxpar[1], 0., 0, "ONLY");
1378 gMC->Gspos("MD1V", 2, "MD1 ", 0., -2.98-boxpar[1], 0., 0, "ONLY");
1379
1380 // -- YOKE
1381 tubpar[0] = 0.;
1382 tubpar[1] = 110./2;
1383 tubpar[2] = 945./2.;
1384 gMC->Gsvolu("YD1 ", "TUBE", idtmed[7], tubpar, 3);
1385
f853b9aa 1386 gMC->Gspos("YD1 ", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
8d433671 1387 gMC->Gspos("MD1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
1388
1389 // -- DIPOLE D2
1390 // --- LHC optics v6.4
1391 zd2 = 12147.6;
1392
1393 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1394 tubpar[0] = 0.;
1395 tubpar[1] = 7.5/2.;
1396 tubpar[2] = 945./2.;
1397 gMC->Gsvolu("MD2 ", "TUBE", idtmed[11], tubpar, 3);
1398
1399 // -- YOKE
1400 tubpar[0] = 0.;
1401 tubpar[1] = 55.;
1402 tubpar[2] = 945./2.;
1403 gMC->Gsvolu("YD2 ", "TUBE", idtmed[7], tubpar, 3);
1404
f853b9aa 1405 gMC->Gspos("YD2 ", 1, "ZDCC", 0., 0., -tubpar[2]-zd2, 0, "ONLY");
8d433671 1406
1407 gMC->Gspos("MD2 ", 1, "YD2 ", -9.4, 0., 0., 0, "ONLY");
1408 gMC->Gspos("MD2 ", 2, "YD2 ", 9.4, 0., 0., 0, "ONLY");
1409
1410 // ***************************************************************
1411 // SIDE A - RB24
1412 // ***************************************************************
1413
1414 // COMPENSATOR DIPOLE (MCBWA) (2nd compensator)
1415 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1416 tubpar[0] = 0.;
1417 tubpar[1] = 4.5;
1418 tubpar[2] = 153./2.;
1419 gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);
f853b9aa 1420 gMC->Gspos("MCBW", 1, "ZDCA", 0., 0., tubpar[2]+1972.5, 0, "ONLY");
8d433671 1421
1422 // -- YOKE
1423 tubpar[0] = 4.5;
1424 tubpar[1] = 55.;
1425 tubpar[2] = 153./2.;
cd807e71 1426 gMC->Gsvolu("YMCB", "TUBE", idtmed[7], tubpar, 3);
f853b9aa 1427 gMC->Gspos("YMCB", 1, "ZDCA", 0., 0., tubpar[2]+1972.5, 0, "ONLY");
8d433671 1428
1429
1430 // -- INNER TRIPLET
1431 zql = 2296.5;
1432
1433 // -- DEFINE MQX1 AND MQX2 QUADRUPOLE ELEMENT
1434 // -- MQX1
1435 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1436 tubpar[0] = 0.;
1437 tubpar[1] = 3.5;
1438 tubpar[2] = 637./2.;
1439 gMC->Gsvolu("MQX1", "TUBE", idtmed[11], tubpar, 3);
1440
1441 // -- YOKE
1442 tubpar[0] = 3.5;
1443 tubpar[1] = 22.;
1444 tubpar[2] = 637./2.;
cd807e71 1445 gMC->Gsvolu("YMQ1", "TUBE", idtmed[7], tubpar, 3);
8d433671 1446
1447 // -- BEAM SCREEN FOR Q1
1448 tubpar[0] = 4.78/2.;
1449 tubpar[1] = 5.18/2.;
1450 tubpar[2] = 637./2.;
1451 gMC->Gsvolu("QBS1", "TUBE", idtmed[6], tubpar, 3);
f853b9aa 1452 gMC->Gspos("QBS1", 1, "ZDCA", 0., 0., tubpar[2]+zql, 0, "ONLY");
8d433671 1453 // INSERT VERTICAL PLATE INSIDE Q1
1454 boxpar[0] = 0.2/2.0;
1455 boxpar[1] = TMath::Sqrt(tubpar[0]*tubpar[0]-(1.9+0.2)*(1.9+0.2));
1456 boxpar[2] =637./2.;
1457 gMC->Gsvolu("QBS2", "BOX ", idtmed[6], boxpar, 3);
f853b9aa 1458 gMC->Gspos("QBS2", 1, "ZDCA", 1.9+boxpar[0], 0., boxpar[2]+zql, 0, "ONLY");
1459 gMC->Gspos("QBS2", 2, "ZDCA", -1.9-boxpar[0], 0., boxpar[2]+zql, 0, "ONLY");
8d433671 1460
1461 // -- BEAM SCREEN FOR Q3
1462 tubpar[0] = 5.79/2.;
1463 tubpar[1] = 6.14/2.;
1464 tubpar[2] = 637./2.;
1465 gMC->Gsvolu("QBS3", "TUBE", idtmed[6], tubpar, 3);
f853b9aa 1466 gMC->Gspos("QBS3", 1, "ZDCA", 0., 0., tubpar[2]+zql+2400., 0, "ONLY");
8d433671 1467 // INSERT VERTICAL PLATE INSIDE Q3
1468 boxpar[0] = 0.2/2.0;
1469 boxpar[1] = TMath::Sqrt(tubpar[0]*tubpar[0]-(2.405+0.2)*(2.405+0.2));
1470 boxpar[2] =637./2.;
1471 gMC->Gsvolu("QBS4", "BOX ", idtmed[6], boxpar, 3);
f853b9aa 1472 gMC->Gspos("QBS4", 1, "ZDCA", 2.405+boxpar[0], 0., boxpar[2]+zql+2400., 0, "ONLY");
1473 gMC->Gspos("QBS4", 2, "ZDCA", -2.405-boxpar[0], 0., boxpar[2]+zql+2400., 0, "ONLY");
8d433671 1474
1475 // -- Q1
f853b9aa 1476 gMC->Gspos("MQX1", 1, "ZDCA", 0., 0., tubpar[2]+zql, 0, "MANY");
1477 gMC->Gspos("YMQ1", 1, "ZDCA", 0., 0., tubpar[2]+zql, 0, "ONLY");
8d433671 1478
1479 // -- Q3
f853b9aa 1480 gMC->Gspos("MQX1", 2, "ZDCA", 0., 0., tubpar[2]+zql+2400., 0, "MANY");
1481 gMC->Gspos("YMQ1", 2, "ZDCA", 0., 0., tubpar[2]+zql+2400., 0, "ONLY");
8d433671 1482
1483
1484 // -- MQX2
1485 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1486 tubpar[0] = 0.;
1487 tubpar[1] = 3.5;
1488 tubpar[2] = 550./2.;
1489 gMC->Gsvolu("MQX2", "TUBE", idtmed[11], tubpar, 3);
1490
1491 // -- YOKE
1492 tubpar[0] = 3.5;
1493 tubpar[1] = 22.;
1494 tubpar[2] = 550./2.;
cd807e71 1495 gMC->Gsvolu("YMQ2", "TUBE", idtmed[7], tubpar, 3);
8d433671 1496
1497
1498 // -- BEAM SCREEN FOR Q2
1499 tubpar[0] = 5.79/2.;
1500 tubpar[1] = 6.14/2.;
1501 tubpar[2] = 550./2.;
1502 gMC->Gsvolu("QBS5", "TUBE", idtmed[6], tubpar, 3);
1503 // VERTICAL PLATE INSIDE Q2
1504 boxpar[0] = 0.2/2.0;
1505 boxpar[1] = TMath::Sqrt(tubpar[0]*tubpar[0]-(2.405+0.2)*(2.405+0.2));
1506 boxpar[2] =550./2.;
1507 gMC->Gsvolu("QBS6", "BOX ", idtmed[6], boxpar, 3);
1508
1509 // -- Q2A
f853b9aa 1510 gMC->Gspos("MQX2", 1, "ZDCA", 0., 0., tubpar[2]+zql+908.5, 0, "MANY");
1511 gMC->Gspos("QBS5", 1, "ZDCA", 0., 0., tubpar[2]+zql+908.5, 0, "ONLY");
1512 gMC->Gspos("QBS6", 1, "ZDCA", 2.405+boxpar[0], 0., boxpar[2]+zql+908.5, 0, "ONLY");
1513 gMC->Gspos("QBS6", 2, "ZDCA", -2.405-boxpar[0], 0., boxpar[2]+zql+908.5, 0, "ONLY");
1514 gMC->Gspos("YMQ2", 1, "ZDCA", 0., 0., tubpar[2]+zql+908.5, 0, "ONLY");
8d433671 1515
1516
1517 // -- Q2B
f853b9aa 1518 gMC->Gspos("MQX2", 2, "ZDCA", 0., 0., tubpar[2]+zql+1558.5, 0, "MANY");
1519 gMC->Gspos("QBS5", 2, "ZDCA", 0., 0., tubpar[2]+zql+1558.5, 0, "ONLY");
1520 gMC->Gspos("QBS6", 3, "ZDCA", 2.405+boxpar[0], 0., boxpar[2]+zql+1558.5, 0, "ONLY");
1521 gMC->Gspos("QBS6", 4, "ZDCA", -2.405-boxpar[0], 0., boxpar[2]+zql+1558.5, 0, "ONLY");
1522 gMC->Gspos("YMQ2", 2, "ZDCA", 0., 0., tubpar[2]+zql+1558.5, 0, "ONLY");
8d433671 1523
1524 // -- SEPARATOR DIPOLE D1
1525 zd2 = 5838.3;
1526
1527 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1528 tubpar[0] = 0.;
1529 tubpar[1] = 6.75/2.;
1530 tubpar[2] = 945./2.;
1531 gMC->Gsvolu("MD1L", "TUBE", idtmed[11], tubpar, 3);
1532
1533 // -- The beam screen tube is provided by the beam pipe in D1 (QA03 volume)
1534 // -- Insert the beam screen horizontal Cu plates inside D1
1535 // -- (to simulate the vacuum chamber)
1536 boxpar[0] = TMath::Sqrt(tubpar[1]*tubpar[1]-(2.885+0.2)*(2.885+0.2));
1537 boxpar[1] = 0.2/2.;
1538 boxpar[2] =(945.+80.1)/2.;
1539 gMC->Gsvolu("QBS7", "BOX ", idtmed[6], boxpar, 3);
f853b9aa 1540 gMC->Gspos("QBS7", 1, "ZDCA", 0., 2.885+boxpar[1],boxpar[2]+zd2, 0, "ONLY");
1541 gMC->Gspos("QBS7", 2, "ZDCA", 0., -2.885-boxpar[1],boxpar[2]+zd2, 0, "ONLY");
8d433671 1542
1543 // -- YOKE
1544 tubpar[0] = 7.34/2.; // to be checked
1545 tubpar[1] = 110./2;
1546 tubpar[2] = 945./2.;
cd807e71 1547 gMC->Gsvolu("YD1L", "TUBE", idtmed[7], tubpar, 3);
8d433671 1548
f853b9aa 1549 gMC->Gspos("YD1L", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
1550 gMC->Gspos("MD1L", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "MANY");
8d433671 1551
1552
1553 // -- DIPOLE D2
1554 // --- LHC optics v6.5
1555 zd2l = 12167.8;
1556
1557 // -- GAP (VACUUM WITH MAGNETIC FIELD)
1558 tubpar[0] = 0.;
1559 tubpar[1] = 7.5/2.; // this has to be checked
1560 tubpar[2] = 945./2.;
1561 gMC->Gsvolu("MD2L", "TUBE", idtmed[11], tubpar, 3);
1562
1563 // -- YOKE
1564 tubpar[0] = 0.;
1565 tubpar[1] = 55.;
1566 tubpar[2] = 945./2.;
cd807e71 1567 gMC->Gsvolu("YD2L", "TUBE", idtmed[7], tubpar, 3);
8d433671 1568
f853b9aa 1569 gMC->Gspos("YD2L", 1, "ZDCA", 0., 0., tubpar[2]+zd2l, 0, "ONLY");
8d433671 1570
1571 gMC->Gspos("MD2L", 1, "YD2L", -9.4, 0., 0., 0, "ONLY");
1572 gMC->Gspos("MD2L", 2, "YD2L", 9.4, 0., 0., 0, "ONLY");
1573
1574 // -- END OF MAGNET DEFINITION
1575}
1576
1577//_____________________________________________________________________________
1578void AliZDCv3::CreateZDC()
1579{
1580 //
1581 // Create the various ZDCs (ZN + ZP)
1582 //
1583
1584 Float_t dimPb[6], dimVoid[6];
1585
1586 Int_t *idtmed = fIdtmed->GetArray();
1587
1588 // Parameters for hadronic calorimeters geometry
1589 // NB -> parameters used ONLY in CreateZDC()
1590 Float_t fGrvZN[3] = {0.03, 0.03, 50.}; // Grooves for neutron detector
1591 Float_t fGrvZP[3] = {0.04, 0.04, 75.}; // Grooves for proton detector
1592 Int_t fDivZN[3] = {11, 11, 0}; // Division for neutron detector
1593 Int_t fDivZP[3] = {7, 15, 0}; // Division for proton detector
1594 Int_t fTowZN[2] = {2, 2}; // Tower for neutron detector
1595 Int_t fTowZP[2] = {4, 1}; // Tower for proton detector
1596
1597 // Parameters for EM calorimeter geometry
1598 // NB -> parameters used ONLY in CreateZDC()
1599 Float_t kDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice
1600 Float_t kFibRadZEM = 0.0315; // External fiber radius (including cladding)
1601 Int_t fDivZEM[3] = {92, 0, 20}; // Divisions for EM detector
1602 Float_t fDimZEM[6] = {fZEMLength, 3.5, 3.5, 45., 0., 0.}; // Dimensions of EM detector
1603 Float_t fFibZEM2 = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-kFibRadZEM;
1604 Float_t fFibZEM[3] = {0., 0.0275, fFibZEM2}; // Fibers for EM calorimeter
1605
1606
1607 //-- Create calorimeters geometry
1608
1609 // -------------------------------------------------------------------------------
1610 //--> Neutron calorimeter (ZN)
1611
1612 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
1613 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
1614 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
1615 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
1616 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
1617 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
1618 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
1619 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
1620 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
1621
1622 // Divide ZNEU in towers (for hits purposes)
1623
1624 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
1625 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
1626
1627 //-- Divide ZN1 in minitowers
1628 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
1629 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
1630 // (4 fibres per minitower)
1631
1632 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
1633 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
1634
1635 // --- Position the empty grooves in the sticks (4 grooves per stick)
1636 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
1637 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
1638
1639 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
1640 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
1641 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
1642 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
1643
1644 // --- Position the fibers in the grooves
1645 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
1646 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
1647 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
1648 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
1649
1650 // --- Position the neutron calorimeter in ZDC
1651 // -- Rotation of ZDCs
1652 Int_t irotzdc;
1653 gMC->Matrix(irotzdc, 90., 180., 90., 90., 180., 0.);
1654 //
f853b9aa 1655 gMC->Gspos("ZNEU", 1, "ZDCC", fPosZNC[0], fPosZNC[1], fPosZNC[2]-fDimZN[2], irotzdc, "ONLY");
8d433671 1656 //Ch debug
1657 //printf("\n ZN -> %f < z < %f cm\n",fPosZN[2],fPosZN[2]-2*fDimZN[2]);
1658
1659 // --- Position the neutron calorimeter in ZDC2 (left line)
1660 // -- No Rotation of ZDCs
f853b9aa 1661 gMC->Gspos("ZNEU", 2, "ZDCA", fPosZNA[0], fPosZNA[1], fPosZNA[2]+fDimZN[2], 0, "ONLY");
8d433671 1662 //Ch debug
1663 //printf("\n ZN left -> %f < z < %f cm\n",fPosZNl[2],fPosZNl[2]+2*fDimZN[2]);
1664
1665
1666 // -------------------------------------------------------------------------------
1667 //--> Proton calorimeter (ZP)
1668
1669 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
1670 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
1671 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
1672 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
1673 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
1674 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
1675 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
1676 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
1677 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
1678
1679 //-- Divide ZPRO in towers(for hits purposes)
1680
1681 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
1682 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
1683
1684
1685 //-- Divide ZP1 in minitowers
1686 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
1687 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
1688 // (4 fiber per minitower)
1689
1690 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
1691 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
1692
1693 // --- Position the empty grooves in the sticks (4 grooves per stick)
1694 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
1695 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
1696
1697 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
1698 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
1699 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
1700 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
1701
1702 // --- Position the fibers in the grooves
1703 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
1704 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
1705 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
1706 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
1707
1708
f853b9aa 1709 // --- Position the proton calorimeter in ZDCC
921be7cf 1710 gMC->Gspos("ZPRO", 1, "ZDCC", fPosZPC[0], fPosZPC[1], fPosZPC[2]-fDimZP[2], irotzdc, "ONLY");
8d433671 1711 //Ch debug
1712 //printf("\n ZP -> %f < z < %f cm\n",fPosZP[2],fPosZP[2]-2*fDimZP[2]);
1713
f853b9aa 1714 // --- Position the proton calorimeter in ZDCA
1715 // --- No rotation
921be7cf 1716 gMC->Gspos("ZPRO", 2, "ZDCA", fPosZPA[0], fPosZPA[1], fPosZPA[2]+fDimZP[2], 0, "ONLY");
8d433671 1717 //Ch debug
1718 //printf("\n ZP left -> %f < z < %f cm\n",fPosZPl[2],fPosZPl[2]+2*fDimZP[2]);
1719
1720
1721 // -------------------------------------------------------------------------------
1722 // -> EM calorimeter (ZEM)
1723
1724 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
1725
1726 Int_t irot1, irot2;
1727 gMC->Matrix(irot1,0.,0.,90.,90.,-90.,0.); // Rotation matrix 1
1728 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]);// Rotation matrix 2
1729 //printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
1730
1731 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
1732
1733 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
1734
1735 dimPb[0] = kDimZEMPb; // Lead slices
1736 dimPb[1] = fDimZEM[2];
1737 dimPb[2] = fDimZEM[1];
1738 //dimPb[3] = fDimZEM[3]; //controllare
1739 dimPb[3] = 90.-fDimZEM[3]; //originale
1740 dimPb[4] = 0.;
1741 dimPb[5] = 0.;
1742 gMC->Gsvolu("ZEL0", "PARA", idtmed[5], dimPb, 6);
1743 gMC->Gsvolu("ZEL1", "PARA", idtmed[5], dimPb, 6);
1744 gMC->Gsvolu("ZEL2", "PARA", idtmed[5], dimPb, 6);
1745
1746 // --- Position the lead slices in the tranche
1747 Float_t zTran = fDimZEM[0]/fDivZEM[2];
1748 Float_t zTrPb = -zTran+kDimZEMPb;
1749 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
1750 gMC->Gspos("ZEL1", 1, "ZETR", kDimZEMPb, 0., 0., 0, "ONLY");
1751
1752 // --- Vacuum zone (to be filled with fibres)
1753 dimVoid[0] = (zTran-2*kDimZEMPb)/2.;
1754 dimVoid[1] = fDimZEM[2];
1755 dimVoid[2] = fDimZEM[1];
1756 dimVoid[3] = 90.-fDimZEM[3];
1757 dimVoid[4] = 0.;
1758 dimVoid[5] = 0.;
1759 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], dimVoid,6);
1760 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], dimVoid,6);
1761
1762 // --- Divide the vacuum slice into sticks along x axis
1763 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
1764 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
1765
1766 // --- Positioning the fibers into the sticks
1767 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
1768 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
1769
1770 // --- Positioning the vacuum slice into the tranche
1771 Float_t displFib = fDimZEM[1]/fDivZEM[0];
1772 gMC->Gspos("ZEV0", 1,"ZETR", -dimVoid[0], 0., 0., 0, "ONLY");
1773 gMC->Gspos("ZEV1", 1,"ZETR", -dimVoid[0]+zTran, 0., displFib, 0, "ONLY");
1774
1775 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
f853b9aa 1776 // NB -> ZEM is positioned in ALIC (instead of in ZDC) volume
8d433671 1777 gMC->Gspos("ZEM ", 1,"ALIC", -fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY");
1778
1779 // Second EM ZDC (same side w.r.t. IP, just on the other side w.r.t. beam pipe)
1780 gMC->Gspos("ZEM ", 2,"ALIC", fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY");
1781
1782 // --- Adding last slice at the end of the EM calorimeter
1783 Float_t zLastSlice = fPosZEM[2]+kDimZEMPb+2*fDimZEM[0];
1784 gMC->Gspos("ZEL2", 1,"ALIC", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
1785 //Ch debug
1786 //printf("\n ZEM lenght = %f cm\n",2*fZEMLength);
1787 //printf("\n ZEM -> %f < z < %f cm\n",fPosZEM[2],fPosZEM[2]+2*fZEMLength+zLastSlice+kDimZEMPb);
1788
1789}
1790
1791//_____________________________________________________________________________
1792void AliZDCv3::DrawModule() const
1793{
1794 //
1795 // Draw a shaded view of the Zero Degree Calorimeter version 1
1796 //
1797
1798 // Set everything unseen
1799 gMC->Gsatt("*", "seen", -1);
1800 //
1801 // Set ALIC mother transparent
1802 gMC->Gsatt("ALIC","SEEN",0);
1803 //
1804 // Set the volumes visible
f853b9aa 1805 gMC->Gsatt("ZDCC","SEEN",0);
8d433671 1806 gMC->Gsatt("QT01","SEEN",1);
1807 gMC->Gsatt("QT02","SEEN",1);
1808 gMC->Gsatt("QT03","SEEN",1);
1809 gMC->Gsatt("QT04","SEEN",1);
1810 gMC->Gsatt("QT05","SEEN",1);
1811 gMC->Gsatt("QT06","SEEN",1);
1812 gMC->Gsatt("QT07","SEEN",1);
1813 gMC->Gsatt("QT08","SEEN",1);
1814 gMC->Gsatt("QT09","SEEN",1);
1815 gMC->Gsatt("QT10","SEEN",1);
1816 gMC->Gsatt("QT11","SEEN",1);
1817 gMC->Gsatt("QT12","SEEN",1);
1818 gMC->Gsatt("QT13","SEEN",1);
1819 gMC->Gsatt("QT14","SEEN",1);
1820 gMC->Gsatt("QT15","SEEN",1);
1821 gMC->Gsatt("QT16","SEEN",1);
1822 gMC->Gsatt("QT17","SEEN",1);
1823 gMC->Gsatt("QT18","SEEN",1);
1824 gMC->Gsatt("QC01","SEEN",1);
1825 gMC->Gsatt("QC02","SEEN",1);
1826 gMC->Gsatt("QC03","SEEN",1);
1827 gMC->Gsatt("QC04","SEEN",1);
1828 gMC->Gsatt("QC05","SEEN",1);
1829 gMC->Gsatt("QTD1","SEEN",1);
1830 gMC->Gsatt("QTD2","SEEN",1);
1831 gMC->Gsatt("QTD3","SEEN",1);
1832 gMC->Gsatt("MQXL","SEEN",1);
1833 gMC->Gsatt("YMQL","SEEN",1);
1834 gMC->Gsatt("MQX ","SEEN",1);
1835 gMC->Gsatt("YMQ ","SEEN",1);
1836 gMC->Gsatt("ZQYX","SEEN",1);
1837 gMC->Gsatt("MD1 ","SEEN",1);
1838 gMC->Gsatt("MD1V","SEEN",1);
1839 gMC->Gsatt("YD1 ","SEEN",1);
1840 gMC->Gsatt("MD2 ","SEEN",1);
1841 gMC->Gsatt("YD2 ","SEEN",1);
1842 gMC->Gsatt("ZNEU","SEEN",0);
1843 gMC->Gsatt("ZNF1","SEEN",0);
1844 gMC->Gsatt("ZNF2","SEEN",0);
1845 gMC->Gsatt("ZNF3","SEEN",0);
1846 gMC->Gsatt("ZNF4","SEEN",0);
1847 gMC->Gsatt("ZNG1","SEEN",0);
1848 gMC->Gsatt("ZNG2","SEEN",0);
1849 gMC->Gsatt("ZNG3","SEEN",0);
1850 gMC->Gsatt("ZNG4","SEEN",0);
1851 gMC->Gsatt("ZNTX","SEEN",0);
1852 gMC->Gsatt("ZN1 ","COLO",4);
1853 gMC->Gsatt("ZN1 ","SEEN",1);
1854 gMC->Gsatt("ZNSL","SEEN",0);
1855 gMC->Gsatt("ZNST","SEEN",0);
1856 gMC->Gsatt("ZPRO","SEEN",0);
1857 gMC->Gsatt("ZPF1","SEEN",0);
1858 gMC->Gsatt("ZPF2","SEEN",0);
1859 gMC->Gsatt("ZPF3","SEEN",0);
1860 gMC->Gsatt("ZPF4","SEEN",0);
1861 gMC->Gsatt("ZPG1","SEEN",0);
1862 gMC->Gsatt("ZPG2","SEEN",0);
1863 gMC->Gsatt("ZPG3","SEEN",0);
1864 gMC->Gsatt("ZPG4","SEEN",0);
1865 gMC->Gsatt("ZPTX","SEEN",0);
1866 gMC->Gsatt("ZP1 ","COLO",6);
1867 gMC->Gsatt("ZP1 ","SEEN",1);
1868 gMC->Gsatt("ZPSL","SEEN",0);
1869 gMC->Gsatt("ZPST","SEEN",0);
1870 gMC->Gsatt("ZEM ","COLO",7);
1871 gMC->Gsatt("ZEM ","SEEN",1);
1872 gMC->Gsatt("ZEMF","SEEN",0);
1873 gMC->Gsatt("ZETR","SEEN",0);
1874 gMC->Gsatt("ZEL0","SEEN",0);
1875 gMC->Gsatt("ZEL1","SEEN",0);
1876 gMC->Gsatt("ZEL2","SEEN",0);
1877 gMC->Gsatt("ZEV0","SEEN",0);
1878 gMC->Gsatt("ZEV1","SEEN",0);
1879 gMC->Gsatt("ZES0","SEEN",0);
1880 gMC->Gsatt("ZES1","SEEN",0);
1881
1882 //
1883 gMC->Gdopt("hide", "on");
1884 gMC->Gdopt("shad", "on");
1885 gMC->Gsatt("*", "fill", 7);
1886 gMC->SetClipBox(".");
1887 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
1888 gMC->DefaultRange();
1889 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
f853b9aa 1890 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 3");
8d433671 1891 gMC->Gdman(18, 4, "MAN");
1892}
1893
1894//_____________________________________________________________________________
1895void AliZDCv3::CreateMaterials()
1896{
1897 //
1898 // Create Materials for the Zero Degree Calorimeter
1899 //
1900
8d433671 1901 Float_t dens, ubuf[1], wmat[2], a[2], z[2];
f853b9aa 1902
8d433671 1903 // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3
1904
1905 // --- Tantalum -> ZN passive material
1906 ubuf[0] = 1.1;
1907 AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
8d433671 1908
1909 // --- Brass (CuZn) -> ZP passive material
1910 dens = 8.48;
1911 a[0] = 63.546;
1912 a[1] = 65.39;
1913 z[0] = 29.;
1914 z[1] = 30.;
1915 wmat[0] = .63;
1916 wmat[1] = .37;
cd807e71 1917 AliMixture(2, "BRASS", a, z, dens, 2, wmat);
8d433671 1918
1919 // --- SiO2
1920 dens = 2.64;
1921 a[0] = 28.086;
1922 a[1] = 15.9994;
1923 z[0] = 14.;
1924 z[1] = 8.;
1925 wmat[0] = 1.;
1926 wmat[1] = 2.;
cd807e71 1927 AliMixture(3, "SIO2", a, z, dens, -2, wmat);
8d433671 1928
1929 // --- Lead
1930 ubuf[0] = 1.12;
1931 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
1932
1933 // --- Copper (energy loss taken into account)
1934 ubuf[0] = 1.10;
1935 AliMaterial(6, "COPP0", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
1936
8d433671 1937 // --- Iron (energy loss taken into account)
1938 ubuf[0] = 1.1;
1939 AliMaterial(7, "IRON0", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
1940
1941 // --- Iron (no energy loss)
1942 ubuf[0] = 1.1;
cd807e71 1943 AliMaterial(8, "IRON1", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
f853b9aa 1944 AliMaterial(13, "IRON2", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
1945
8d433671 1946 // ---------------------------------------------------------
1947 Float_t aResGas[3]={1.008,12.0107,15.9994};
1948 Float_t zResGas[3]={1.,6.,8.};
1949 Float_t wResGas[3]={0.28,0.28,0.44};
1950 Float_t dResGas = 3.2E-14;
1951
1952 // --- Vacuum (no magnetic field)
1953 AliMixture(10, "VOID", aResGas, zResGas, dResGas, 3, wResGas);
8d433671 1954
1955 // --- Vacuum (with magnetic field)
1956 AliMixture(11, "VOIM", aResGas, zResGas, dResGas, 3, wResGas);
8d433671 1957
1958 // --- Air (no magnetic field)
1959 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
1960 Float_t zAir[4]={6.,7.,8.,18.};
1961 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
1962 Float_t dAir = 1.20479E-3;
1963 //
1964 AliMixture(12, "Air $", aAir, zAir, dAir, 4, wAir);
8d433671 1965
1966 // --- Definition of tracking media:
1967
1968 // --- Tantalum = 1 ;
1969 // --- Brass = 2 ;
1970 // --- Fibers (SiO2) = 3 ;
1971 // --- Fibers (SiO2) = 4 ;
1972 // --- Lead = 5 ;
1973 // --- Copper (with energy loss)= 6 ;
1974 // --- Copper (with energy loss)= 13 ;
1975 // --- Iron (with energy loss) = 7 ;
1976 // --- Iron (without energy loss) = 8 ;
1977 // --- Vacuum (no field) = 10
1978 // --- Vacuum (with field) = 11
1979 // --- Air (no field) = 12
1980
1981 // ****************************************************
1982 // Tracking media parameters
1983 //
1984 Float_t epsil = 0.01; // Tracking precision,
1985 Float_t stmin = 0.01; // Min. value 4 max. step (cm)
1986 Float_t stemax = 1.; // Max. step permitted (cm)
1987 Float_t tmaxfd = 0.; // Maximum angle due to field (degrees)
1988 Float_t deemax = -1.; // Maximum fractional energy loss
1989 Float_t nofieldm = 0.; // Max. field value (no field)
1990 Float_t fieldm = 45.; // Max. field value (with field)
1991 Int_t isvol = 0; // ISVOL =0 -> not sensitive volume
1992 Int_t isvolActive = 1; // ISVOL =1 -> sensitive volume
1993 Int_t inofld = 0; // IFIELD=0 -> no magnetic field
1994 Int_t ifield =2; // IFIELD=2 -> magnetic field defined in AliMagFC.h
1995 // *****************************************************
1996
1997 AliMedium(1, "ZTANT", 1, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
1998 AliMedium(2, "ZBRASS",2, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
1999 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2000 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2001 AliMedium(5, "ZLEAD", 5, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2002 AliMedium(6, "ZCOPP", 6, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2003 AliMedium(7, "ZIRON", 7, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2004 AliMedium(8, "ZIRONN",8, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2005 AliMedium(10,"ZVOID",10, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2006 AliMedium(12,"ZAIR", 12, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2007 //
2008 AliMedium(11,"ZVOIM",11, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
f853b9aa 2009 AliMedium(13,"ZIRONE",13, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
2010
2011}
2012
2013//_____________________________________________________________________________
2014void AliZDCv3::AddAlignableVolumes() const
2015{
2016 //
2017 // Create entries for alignable volumes associating the symbolic volume
2018 // name with the corresponding volume path. Needs to be syncronized with
2019 // eventual changes in the geometry.
2020 //
63e6d88e 2021 TString volpath1 = "ALIC_1/ZDCC_1/ZNEU_1";
2022 TString volpath2 = "ALIC_1/ZDCC_1/ZPRO_1";
2023 TString volpath3 = "ALIC_1/ZDCA_1/ZNEU_2";
2024 TString volpath4 = "ALIC_1/ZDCA_1/ZPRO_2";
f853b9aa 2025
63e6d88e 2026 TString symname1="ZDC/NeutronZDC_C";
2027 TString symname2="ZDC/ProtonZDC_C";
2028 TString symname3="ZDC/NeutronZDC_A";
2029 TString symname4="ZDC/ProtonZDC_A";
f853b9aa 2030
2031 if(!gGeoManager->SetAlignableEntry(symname1.Data(),volpath1.Data()))
2032 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname1.Data(),volpath1.Data()));
2033
2034 if(!gGeoManager->SetAlignableEntry(symname2.Data(),volpath2.Data()))
2035 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname2.Data(),volpath2.Data()));
63e6d88e 2036
2037 if(!gGeoManager->SetAlignableEntry(symname3.Data(),volpath3.Data()))
2038 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname1.Data(),volpath1.Data()));
2039
2040 if(!gGeoManager->SetAlignableEntry(symname4.Data(),volpath4.Data()))
2041 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname2.Data(),volpath2.Data()));
2042
f853b9aa 2043}
2044
2045
2046//_____________________________________________________________________________
2047void AliZDCv3::Init()
2048{
2049 InitTables();
2050 Int_t *idtmed = fIdtmed->GetArray();
2051 Int_t i;
8d433671 2052 // Thresholds for showering in the ZDCs
2053 i = 1; //tantalum
2054 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
2055 gMC->Gstpar(idtmed[i], "CUTELE", .001);
2056 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
2057 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
2058 i = 2; //brass
2059 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
2060 gMC->Gstpar(idtmed[i], "CUTELE", .001);
2061 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
2062 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
2063 i = 5; //lead
2064 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
2065 gMC->Gstpar(idtmed[i], "CUTELE", .001);
2066 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
2067 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
2068
2069 // Avoid too detailed showering in TDI
f853b9aa 2070 i = 6; //copper
8d433671 2071 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
2072 gMC->Gstpar(idtmed[i], "CUTELE", .1);
2073 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
2074 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
2075
8d433671 2076 // Avoid too detailed showering along the beam line
2077 i = 7; //iron with energy loss (ZIRON)
2078 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
2079 gMC->Gstpar(idtmed[i], "CUTELE", .1);
2080 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
2081 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
2082
2083 // Avoid too detailed showering along the beam line
2084 i = 8; //iron with energy loss (ZIRONN)
2085 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
2086 gMC->Gstpar(idtmed[i], "CUTELE", .1);
2087 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
2088 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
cd807e71 2089
8d433671 2090 // Avoid too detailed showering along the beam line
f853b9aa 2091 i = 13; //iron with energy loss (ZIRONN)
2092 gMC->Gstpar(idtmed[i], "CUTGAM", 1.);
2093 gMC->Gstpar(idtmed[i], "CUTELE", 1.);
8d433671 2094 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
f853b9aa 2095 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
8d433671 2096
2097 // Avoid interaction in fibers (only energy loss allowed)
2098 i = 3; //fibers (ZSI02)
2099 gMC->Gstpar(idtmed[i], "DCAY", 0.);
2100 gMC->Gstpar(idtmed[i], "MULS", 0.);
2101 gMC->Gstpar(idtmed[i], "PFIS", 0.);
2102 gMC->Gstpar(idtmed[i], "MUNU", 0.);
2103 gMC->Gstpar(idtmed[i], "LOSS", 1.);
2104 gMC->Gstpar(idtmed[i], "PHOT", 0.);
2105 gMC->Gstpar(idtmed[i], "COMP", 0.);
2106 gMC->Gstpar(idtmed[i], "PAIR", 0.);
2107 gMC->Gstpar(idtmed[i], "BREM", 0.);
2108 gMC->Gstpar(idtmed[i], "DRAY", 0.);
2109 gMC->Gstpar(idtmed[i], "ANNI", 0.);
2110 gMC->Gstpar(idtmed[i], "HADR", 0.);
2111 i = 4; //fibers (ZQUAR)
2112 gMC->Gstpar(idtmed[i], "DCAY", 0.);
2113 gMC->Gstpar(idtmed[i], "MULS", 0.);
2114 gMC->Gstpar(idtmed[i], "PFIS", 0.);
2115 gMC->Gstpar(idtmed[i], "MUNU", 0.);
2116 gMC->Gstpar(idtmed[i], "LOSS", 1.);
2117 gMC->Gstpar(idtmed[i], "PHOT", 0.);
2118 gMC->Gstpar(idtmed[i], "COMP", 0.);
2119 gMC->Gstpar(idtmed[i], "PAIR", 0.);
2120 gMC->Gstpar(idtmed[i], "BREM", 0.);
2121 gMC->Gstpar(idtmed[i], "DRAY", 0.);
2122 gMC->Gstpar(idtmed[i], "ANNI", 0.);
2123 gMC->Gstpar(idtmed[i], "HADR", 0.);
2124
2125 // Avoid interaction in void
2126 i = 11; //void with field
2127 gMC->Gstpar(idtmed[i], "DCAY", 0.);
2128 gMC->Gstpar(idtmed[i], "MULS", 0.);
2129 gMC->Gstpar(idtmed[i], "PFIS", 0.);
2130 gMC->Gstpar(idtmed[i], "MUNU", 0.);
2131 gMC->Gstpar(idtmed[i], "LOSS", 0.);
2132 gMC->Gstpar(idtmed[i], "PHOT", 0.);
2133 gMC->Gstpar(idtmed[i], "COMP", 0.);
2134 gMC->Gstpar(idtmed[i], "PAIR", 0.);
2135 gMC->Gstpar(idtmed[i], "BREM", 0.);
2136 gMC->Gstpar(idtmed[i], "DRAY", 0.);
2137 gMC->Gstpar(idtmed[i], "ANNI", 0.);
2138 gMC->Gstpar(idtmed[i], "HADR", 0.);
2139
2140 //
2141 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
2142 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
2143 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
2144 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
2145 fMedSensZEM = idtmed[5]; // Sensitive volume: ZEM passive material
f853b9aa 2146 fMedSensTDI = idtmed[6]; // Sensitive volume: TDI Cu shield
8d433671 2147 fMedSensPI = idtmed[7]; // Sensitive volume: beam pipes
2148 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
8d433671 2149}
2150
2151//_____________________________________________________________________________
2152void AliZDCv3::InitTables()
2153{
2154 //
2155 // Read light tables for Cerenkov light production parameterization
2156 //
2157
2158 Int_t k, j;
2159
2160 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
2161 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
2162 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
2163
2164 // --- Reading light tables for ZN
f853b9aa 2165 lightfName1 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362207s");
8d433671 2166 if((fp1 = fopen(lightfName1,"r")) == NULL){
2167 printf("Cannot open file fp1 \n");
2168 return;
2169 }
f853b9aa 2170 lightfName2 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362208s");
8d433671 2171 if((fp2 = fopen(lightfName2,"r")) == NULL){
2172 printf("Cannot open file fp2 \n");
2173 return;
2174 }
f853b9aa 2175 lightfName3 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362209s");
8d433671 2176 if((fp3 = fopen(lightfName3,"r")) == NULL){
2177 printf("Cannot open file fp3 \n");
2178 return;
2179 }
f853b9aa 2180 lightfName4 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362210s");
8d433671 2181 if((fp4 = fopen(lightfName4,"r")) == NULL){
2182 printf("Cannot open file fp4 \n");
2183 return;
2184 }
2185
2186 for(k=0; k<fNalfan; k++){
2187 for(j=0; j<fNben; j++){
2188 fscanf(fp1,"%f",&fTablen[0][k][j]);
2189 fscanf(fp2,"%f",&fTablen[1][k][j]);
2190 fscanf(fp3,"%f",&fTablen[2][k][j]);
2191 fscanf(fp4,"%f",&fTablen[3][k][j]);
2192 }
2193 }
2194 fclose(fp1);
2195 fclose(fp2);
2196 fclose(fp3);
2197 fclose(fp4);
2198
2199 // --- Reading light tables for ZP and ZEM
f853b9aa 2200 lightfName5 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552207s");
8d433671 2201 if((fp5 = fopen(lightfName5,"r")) == NULL){
2202 printf("Cannot open file fp5 \n");
2203 return;
2204 }
f853b9aa 2205 lightfName6 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552208s");
8d433671 2206 if((fp6 = fopen(lightfName6,"r")) == NULL){
2207 printf("Cannot open file fp6 \n");
2208 return;
2209 }
f853b9aa 2210 lightfName7 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552209s");
8d433671 2211 if((fp7 = fopen(lightfName7,"r")) == NULL){
2212 printf("Cannot open file fp7 \n");
2213 return;
2214 }
f853b9aa 2215 lightfName8 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552210s");
8d433671 2216 if((fp8 = fopen(lightfName8,"r")) == NULL){
2217 printf("Cannot open file fp8 \n");
2218 return;
2219 }
2220
2221 for(k=0; k<fNalfap; k++){
2222 for(j=0; j<fNbep; j++){
2223 fscanf(fp5,"%f",&fTablep[0][k][j]);
2224 fscanf(fp6,"%f",&fTablep[1][k][j]);
2225 fscanf(fp7,"%f",&fTablep[2][k][j]);
2226 fscanf(fp8,"%f",&fTablep[3][k][j]);
2227 }
2228 }
2229 fclose(fp5);
2230 fclose(fp6);
2231 fclose(fp7);
2232 fclose(fp8);
2233}
2234//_____________________________________________________________________________
2235void AliZDCv3::StepManager()
2236{
2237 //
2238 // Routine called at every step in the Zero Degree Calorimeters
8cbab886 2239 //
2240
8d433671 2241 Int_t j, vol[2], ibeta=0, ialfa, ibe, nphe;
2242 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, out;
2243 //Float_t radius;
f853b9aa 2244 Float_t xalic[3], z, guiEff;
61424d1c 2245 // Parametrization for light guide uniformity
2246 // -> OBSOLETE!!!! For guide tilted @ 46 degrees
2247 //Float_t guiPar[4]={0.31,-0.0004,0.0197,0.7958};
2248 // NEW!!! Light guide tilted @ 51 degrees
2249 Float_t guiPar[4]={0.31,-0.0006305,0.01337,0.8895};
f853b9aa 2250 Double_t s[3], p[3];
8d433671 2251 const char *knamed;
f853b9aa 2252 //
8d433671 2253 for (j=0;j<10;j++) hits[j]=-999.;
f853b9aa 2254 //
8d433671 2255 // --- This part is for no shower developement in beam pipe and TDI
2256 // If particle interacts with beam pipe or TDI -> return
f853b9aa 2257 if((gMC->CurrentMedium() == fMedSensPI) || (gMC->CurrentMedium() == fMedSensTDI)){
8d433671 2258 // If option NoShower is set -> StopTrack
cd807e71 2259 if(fNoShower==1){
f853b9aa 2260 gMC->TrackPosition(s[0],s[1],s[2]);
cd807e71 2261 if(gMC->CurrentMedium() == fMedSensPI){
8d433671 2262 knamed = gMC->CurrentVolName();
f853b9aa 2263 if(!strncmp(knamed,"YMQ",3)){
2264 if(s[2]<0) fpLostITC += 1;
2265 else fpLostITA += 1;
2266 }
8cbab886 2267 else if(!strncmp(knamed,"YD1",3)){
f853b9aa 2268 if(s[2]<0) fpLostD1C += 1;
2269 else fpLostD1A += 1;
2270 }
8cbab886 2271 else if(!strncmp(knamed,"QAL",3)) fnTrou++;
8d433671 2272 }
f853b9aa 2273 else if(gMC->CurrentMedium() == fMedSensTDI){
8d433671 2274 knamed = gMC->CurrentVolName();
f853b9aa 2275 if(!strncmp(knamed,"MD1",3)){
2276 if(s[2]<0) fpLostD1C += 1;
2277 else fpLostD1A += 1;
2278 }
8cbab886 2279 else if(!strncmp(knamed,"QTD",3)) fpLostTDI += 1;
2280 else if(!strncmp(knamed,"QLU",3)){
2281 if(s[2]<0) fnLumiC ++;
2282 else fnLumiA++;
2283 }
8d433671 2284 }
cd807e71 2285 //
8cbab886 2286 //gMC->TrackMomentum(p[0], p[1], p[2], p[3]);
cd807e71 2287 //printf("\t Particle: mass = %1.3f, E = %1.3f GeV, pz = %1.2f GeV -> stopped in volume %s\n",
2288 // gMC->TrackMass(), p[3], p[2], gMC->CurrentVolName());
2289 //
8cbab886 2290 printf("\n\t **********************************\n");
2291 printf("\t ********** Side C **********\n");
2292 printf("\t # of spectators in IT = %d\n",fpLostITC);
2293 printf("\t # of spectators in D1 = %d\n",fpLostD1C);
2294 printf("\t # of spectators in luminometer = %d\n",fnLumiC);
2295 printf("\t ********** Side A **********\n");
2296 printf("\t # of spectators in IT = %d\n",fpLostITA);
2297 printf("\t # of spectators in D1 = %d\n",fpLostD1A);
2298 printf("\t # of spectators in TDI = %d\n",fpLostTDI);
2299 printf("\t # of spectators in luminometer = %d\n",fnLumiA);
2300 printf("\t # of spectators in trousers = %d\n",fnTrou);
2301 printf("\t **********************************\n");
8d433671 2302 gMC->StopTrack();
2303 }
2304 return;
2305 }
2306
2307
2308 if((gMC->CurrentMedium() == fMedSensZN) || (gMC->CurrentMedium() == fMedSensZP) ||
2309 (gMC->CurrentMedium() == fMedSensGR) || (gMC->CurrentMedium() == fMedSensF1) ||
2310 (gMC->CurrentMedium() == fMedSensF2) || (gMC->CurrentMedium() == fMedSensZEM)){
2311
8cbab886 2312
8d433671 2313 //Particle coordinates
f853b9aa 2314 gMC->TrackPosition(s[0],s[1],s[2]);
8d433671 2315 for(j=0; j<=2; j++) x[j] = s[j];
2316 hits[0] = x[0];
2317 hits[1] = x[1];
2318 hits[2] = x[2];
2319
2320 // Determine in which ZDC the particle is
2321 knamed = gMC->CurrentVolName();
2322 if(!strncmp(knamed,"ZN",2)){
921be7cf 2323 if(x[2]<0.) vol[0]=1; // ZNC (dimuon side)
2324 else if(x[2]>0.) vol[0]=4; //ZNA
8d433671 2325 }
2326 else if(!strncmp(knamed,"ZP",2)){
921be7cf 2327 if(x[2]<0.) vol[0]=2; //ZPC (dimuon side)
2328 else if(x[2]>0.) vol[0]=5; //ZPA
8d433671 2329 }
921be7cf 2330 else if(!strncmp(knamed,"ZE",2)) vol[0]=3; //ZEM
8d433671 2331
2332 // Determine in which quadrant the particle is
f853b9aa 2333 if(vol[0]==1){ //Quadrant in ZNC
61424d1c 2334 // Calculating particle coordinates inside ZNC
f853b9aa 2335 xdet[0] = x[0]-fPosZNC[0];
2336 xdet[1] = x[1]-fPosZNC[1];
8d433671 2337 // Calculating quadrant in ZN
2338 if(xdet[0]<=0.){
f853b9aa 2339 if(xdet[1]<=0.) vol[1]=1;
2340 else vol[1]=3;
8d433671 2341 }
2342 else if(xdet[0]>0.){
f853b9aa 2343 if(xdet[1]<=0.) vol[1]=2;
2344 else vol[1]=4;
8d433671 2345 }
2346 if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4))
2347 printf("\n ZDC StepManager->ERROR in ZN!!! vol[1] = %d, xdet[0] = %f,"
2348 "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]);
2349 }
2350
f853b9aa 2351 else if(vol[0]==2){ //Quadrant in ZPC
61424d1c 2352 // Calculating particle coordinates inside ZPC
f853b9aa 2353 xdet[0] = x[0]-fPosZPA[0];
2354 xdet[1] = x[1]-fPosZPA[1];
8d433671 2355 if(xdet[0]>=fDimZP[0]) xdet[0]=fDimZP[0]-0.01;
2356 if(xdet[0]<=-fDimZP[0]) xdet[0]=-fDimZP[0]+0.01;
2357 // Calculating tower in ZP
2358 Float_t xqZP = xdet[0]/(fDimZP[0]/2.);
2359 for(int i=1; i<=4; i++){
2360 if(xqZP>=(i-3) && xqZP<(i-2)){
2361 vol[1] = i;
2362 break;
2363 }
2364 }
2365 if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4))
2366 printf(" ZDC StepManager->ERROR in ZP!!! vol[1] = %d, xdet[0] = %f,"
2367 "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]);
2368 }
f853b9aa 2369 //
8d433671 2370 // Quadrant in ZEM: vol[1] = 1 -> particle in 1st ZEM (placed at x = 8.5 cm)
2371 // vol[1] = 2 -> particle in 2nd ZEM (placed at x = -8.5 cm)
2372 else if(vol[0] == 3){
2373 if(x[0]>0.){
2374 vol[1] = 1;
2375 // Particle x-coordinate inside ZEM1
2376 xdet[0] = x[0]-fPosZEM[0];
2377 }
2378 else{
2379 vol[1] = 2;
2380 // Particle x-coordinate inside ZEM2
2381 xdet[0] = x[0]+fPosZEM[0];
2382 }
2383 xdet[1] = x[1]-fPosZEM[1];
2384 }
f853b9aa 2385 //
2386 else if(vol[0]==4){ //Quadrant in ZNA
2387 // Calculating particle coordinates inside ZNA
2388 xdet[0] = x[0]-fPosZNA[0];
2389 xdet[1] = x[1]-fPosZNA[1];
2390 // Calculating quadrant in ZNA
2391 if(xdet[0]>=0.){
2392 if(xdet[1]<=0.) vol[1]=1;
2393 else vol[1]=3;
8d433671 2394 }
f853b9aa 2395 else if(xdet[0]<0.){
2396 if(xdet[1]<=0.) vol[1]=2;
2397 else vol[1]=4;
8d433671 2398 }
2399 if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4))
f853b9aa 2400 printf("\n ZDC StepManager->ERROR in ZNA!!! vol[1] = %d, xdet[0] = %f,"
8d433671 2401 "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]);
2402 }
f853b9aa 2403 //
2404 else if(vol[0]==5){ //Quadrant in ZPA
2405 // Calculating particle coordinates inside ZPA
2406 xdet[0] = x[0]-fPosZPC[0];
2407 xdet[1] = x[1]-fPosZPC[1];
8d433671 2408 if(xdet[0]>=fDimZP[0]) xdet[0]=fDimZP[0]-0.01;
2409 if(xdet[0]<=-fDimZP[0]) xdet[0]=-fDimZP[0]+0.01;
2410 // Calculating tower in ZP
f853b9aa 2411 Float_t xqZP = -xdet[0]/(fDimZP[0]/2.);
8d433671 2412 for(int i=1; i<=4; i++){
2413 if(xqZP>=(i-3) && xqZP<(i-2)){
2414 vol[1] = i;
2415 break;
2416 }
2417 }
2418 if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4))
f853b9aa 2419 printf(" ZDC StepManager->ERROR in ZPA!!! vol[1] = %d, xdet[0] = %f,"
8d433671 2420 "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]);
2421 }
2422
2423
2424 // Store impact point and kinetic energy of the ENTERING particle
2425
2426 if(gMC->IsTrackEntering()){
2427 //Particle energy
f853b9aa 2428 gMC->TrackMomentum(p[0],p[1],p[2],p[3]);
8d433671 2429 hits[3] = p[3];
2430 // Impact point on ZDC
2431 hits[4] = xdet[0];
2432 hits[5] = xdet[1];
2433 hits[6] = 0;
2434 hits[7] = 0;
2435 hits[8] = 0;
2436 hits[9] = 0;
2437
2438 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2439
2440 if(fNoShower==1){
921be7cf 2441 //printf("\t VolName %s -> det %d quad %d - x = %f, y = %f, z = %f\n",
2442 //knamed, vol[0], vol[1], x[0], x[1], x[2]);
2443 if(vol[0]==1){
2444 fnDetectedC += 1;
8cbab886 2445 printf("\n # of particles in ZNC = %d\n\n",fnDetectedC);
921be7cf 2446 }
2447 else if(vol[0]==2){
2448 fpDetectedC += 1;
8cbab886 2449 printf("\n # of particles in ZPC = %d\n\n",fpDetectedC);
921be7cf 2450 }
2451 else if(vol[0]==4){
2452 fnDetectedA += 1;
8cbab886 2453 printf("\n # of particles in ZNA = %d\n\n",fnDetectedA);
921be7cf 2454 }
2455 else if(vol[0]==5){
2456 fpDetectedA += 1;
8cbab886 2457 printf("\n # of particles in ZPA = %d\n\n",fpDetectedA);
921be7cf 2458 }
cd807e71 2459 //
2460 //printf("\t Particle: mass = %1.3f, E = %1.3f GeV, pz = %1.2f GeV -> stopped in volume %s\n",
2461 // gMC->TrackMass(), p[3], p[2], gMC->CurrentVolName());
2462 //
8d433671 2463 gMC->StopTrack();
8d433671 2464 return;
2465 }
2466 }
2467
2468 // Charged particles -> Energy loss
2469 if((destep=gMC->Edep())){
2470 if(gMC->IsTrackStop()){
f853b9aa 2471 gMC->TrackMomentum(p[0],p[1],p[2],p[3]);
8d433671 2472 m = gMC->TrackMass();
2473 ekin = p[3]-m;
2474 hits[9] = ekin;
2475 hits[7] = 0.;
2476 hits[8] = 0.;
2477 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2478 }
2479 else{
2480 hits[9] = destep;
2481 hits[7] = 0.;
2482 hits[8] = 0.;
2483 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2484 }
2485 }
2486 }
2487
2488
2489 // *** Light production in fibres
2490 if((gMC->CurrentMedium() == fMedSensF1) || (gMC->CurrentMedium() == fMedSensF2)){
2491
2492 //Select charged particles
2493 if((destep=gMC->Edep())){
2494
2495 // Particle velocity
2496 Float_t beta = 0.;
f853b9aa 2497 gMC->TrackMomentum(p[0],p[1],p[2],p[3]);
8d433671 2498 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
2499 if(p[3] > 0.00001) beta = ptot/p[3];
2500 else return;
2501 if(beta<0.67)return;
2502 else if((beta>=0.67) && (beta<=0.75)) ibeta = 0;
2503 else if((beta>0.75) && (beta<=0.85)) ibeta = 1;
2504 else if((beta>0.85) && (beta<=0.95)) ibeta = 2;
2505 else if(beta>0.95) ibeta = 3;
2506
2507 // Angle between particle trajectory and fibre axis
2508 // 1 -> Momentum directions
2509 um[0] = p[0]/ptot;
2510 um[1] = p[1]/ptot;
2511 um[2] = p[2]/ptot;
2512 gMC->Gmtod(um,ud,2);
2513 // 2 -> Angle < limit angle
2514 Double_t alfar = TMath::ACos(ud[2]);
2515 Double_t alfa = alfar*kRaddeg;
2516 if(alfa>=110.) return;
2517 //
2518 ialfa = Int_t(1.+alfa/2.);
2519
2520 // Distance between particle trajectory and fibre axis
f853b9aa 2521 gMC->TrackPosition(s[0],s[1],s[2]);
8d433671 2522 for(j=0; j<=2; j++){
2523 x[j] = s[j];
2524 }
2525 gMC->Gmtod(x,xdet,1);
2526 if(TMath::Abs(ud[0])>0.00001){
2527 Float_t dcoeff = ud[1]/ud[0];
2528 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
2529 }
2530 else{
2531 be = TMath::Abs(ud[0]);
2532 }
2533
2534 ibe = Int_t(be*1000.+1);
2535 //if((vol[0]==1)) radius = fFibZN[1];
2536 //else if((vol[0]==2)) radius = fFibZP[1];
2537
2538 //Looking into the light tables
2539 Float_t charge = gMC->TrackCharge();
2540
80e87581 2541 if(vol[0]==1 || vol[0]==4) { // (1) ZN fibres
8d433671 2542 if(ibe>fNben) ibe=fNben;
2543 out = charge*charge*fTablen[ibeta][ialfa][ibe];
2544 nphe = gRandom->Poisson(out);
2545 // Ch. debug
2546 //if(ibeta==3) printf("\t %f \t %f \t %f\n",alfa, be, out);
2547 //printf("\t ibeta = %d, ialfa = %d, ibe = %d -> nphe = %d\n\n",ibeta,ialfa,ibe,nphe);
2548 if(gMC->CurrentMedium() == fMedSensF1){
2549 hits[7] = nphe; //fLightPMQ
2550 hits[8] = 0;
2551 hits[9] = 0;
2552 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2553 }
2554 else{
2555 hits[7] = 0;
2556 hits[8] = nphe; //fLightPMC
2557 hits[9] = 0;
2558 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2559 }
2560 }
80e87581 2561 else if(vol[0]==2 || vol[0]==5) {// (2) ZP fibres
8d433671 2562 if(ibe>fNbep) ibe=fNbep;
2563 out = charge*charge*fTablep[ibeta][ialfa][ibe];
2564 nphe = gRandom->Poisson(out);
2565 if(gMC->CurrentMedium() == fMedSensF1){
2566 hits[7] = nphe; //fLightPMQ
2567 hits[8] = 0;
2568 hits[9] = 0;
2569 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2570 }
2571 else{
2572 hits[7] = 0;
2573 hits[8] = nphe; //fLightPMC
2574 hits[9] = 0;
2575 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2576 }
2577 }
2578 else if((vol[0]==3)) { // (3) ZEM fibres
2579 if(ibe>fNbep) ibe=fNbep;
2580 out = charge*charge*fTablep[ibeta][ialfa][ibe];
f853b9aa 2581 gMC->TrackPosition(s[0],s[1],s[2]);
8d433671 2582 for(j=0; j<=2; j++){
2583 xalic[j] = s[j];
2584 }
2585 // z-coordinate from ZEM front face
2586 // NB-> fPosZEM[2]+fZEMLength = -1000.+2*10.3 = 979.69 cm
2587 z = -xalic[2]+fPosZEM[2]+2*fZEMLength-xalic[1];
2588// z = xalic[2]-fPosZEM[2]-fZEMLength-xalic[1]*(TMath::Tan(45.*kDegrad));
2589// printf("\n fPosZEM[2]+2*fZEMLength = %f", fPosZEM[2]+2*fZEMLength);
2590 guiEff = guiPar[0]*(guiPar[1]*z*z+guiPar[2]*z+guiPar[3]);
2591 out = out*guiEff;
2592 nphe = gRandom->Poisson(out);
2593// printf(" out*guiEff = %f nphe = %d", out, nphe);
2594 if(vol[1] == 1){
2595 hits[7] = 0;
2596 hits[8] = nphe; //fLightPMC (ZEM1)
2597 hits[9] = 0;
2598 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2599 }
2600 else{
2601 hits[7] = nphe; //fLightPMQ (ZEM2)
2602 hits[8] = 0;
2603 hits[9] = 0;
2604 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2605 }
2606 }
2607 }
2608 }
2609}