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