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