Removing obsolete G3 functions
[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//_____________________________________________________________________________
1911void AliZDCv3::DrawModule() const
1912{
1913 //
1914 // Draw a shaded view of the Zero Degree Calorimeter version 1
1915 //
1916
1917 // Set everything unseen
1918 gMC->Gsatt("*", "seen", -1);
1919 //
1920 // Set ALIC mother transparent
1921 gMC->Gsatt("ALIC","SEEN",0);
1922 //
1923 // Set the volumes visible
f853b9aa 1924 gMC->Gsatt("ZDCC","SEEN",0);
8d433671 1925 gMC->Gsatt("QT01","SEEN",1);
1926 gMC->Gsatt("QT02","SEEN",1);
1927 gMC->Gsatt("QT03","SEEN",1);
1928 gMC->Gsatt("QT04","SEEN",1);
1929 gMC->Gsatt("QT05","SEEN",1);
1930 gMC->Gsatt("QT06","SEEN",1);
1931 gMC->Gsatt("QT07","SEEN",1);
1932 gMC->Gsatt("QT08","SEEN",1);
1933 gMC->Gsatt("QT09","SEEN",1);
1934 gMC->Gsatt("QT10","SEEN",1);
1935 gMC->Gsatt("QT11","SEEN",1);
1936 gMC->Gsatt("QT12","SEEN",1);
1937 gMC->Gsatt("QT13","SEEN",1);
8d433671 1938 gMC->Gsatt("QC01","SEEN",1);
1939 gMC->Gsatt("QC02","SEEN",1);
1940 gMC->Gsatt("QC03","SEEN",1);
1941 gMC->Gsatt("QC04","SEEN",1);
1942 gMC->Gsatt("QC05","SEEN",1);
8a132379 1943 gMC->Gsatt("QC06","SEEN",1);
1944 gMC->Gsatt("QC07","SEEN",1);
1945 gMC->Gsatt("QC08","SEEN",1);
1946 gMC->Gsatt("QC09","SEEN",1);
1947 gMC->Gsatt("QC10","SEEN",1);
8d433671 1948 gMC->Gsatt("MQXL","SEEN",1);
1949 gMC->Gsatt("YMQL","SEEN",1);
1950 gMC->Gsatt("MQX ","SEEN",1);
1951 gMC->Gsatt("YMQ ","SEEN",1);
1952 gMC->Gsatt("ZQYX","SEEN",1);
1953 gMC->Gsatt("MD1 ","SEEN",1);
1954 gMC->Gsatt("MD1V","SEEN",1);
1955 gMC->Gsatt("YD1 ","SEEN",1);
1956 gMC->Gsatt("MD2 ","SEEN",1);
1957 gMC->Gsatt("YD2 ","SEEN",1);
1958 gMC->Gsatt("ZNEU","SEEN",0);
1959 gMC->Gsatt("ZNF1","SEEN",0);
1960 gMC->Gsatt("ZNF2","SEEN",0);
1961 gMC->Gsatt("ZNF3","SEEN",0);
1962 gMC->Gsatt("ZNF4","SEEN",0);
1963 gMC->Gsatt("ZNG1","SEEN",0);
1964 gMC->Gsatt("ZNG2","SEEN",0);
1965 gMC->Gsatt("ZNG3","SEEN",0);
1966 gMC->Gsatt("ZNG4","SEEN",0);
1967 gMC->Gsatt("ZNTX","SEEN",0);
1968 gMC->Gsatt("ZN1 ","COLO",4);
1969 gMC->Gsatt("ZN1 ","SEEN",1);
1970 gMC->Gsatt("ZNSL","SEEN",0);
1971 gMC->Gsatt("ZNST","SEEN",0);
1972 gMC->Gsatt("ZPRO","SEEN",0);
1973 gMC->Gsatt("ZPF1","SEEN",0);
1974 gMC->Gsatt("ZPF2","SEEN",0);
1975 gMC->Gsatt("ZPF3","SEEN",0);
1976 gMC->Gsatt("ZPF4","SEEN",0);
1977 gMC->Gsatt("ZPG1","SEEN",0);
1978 gMC->Gsatt("ZPG2","SEEN",0);
1979 gMC->Gsatt("ZPG3","SEEN",0);
1980 gMC->Gsatt("ZPG4","SEEN",0);
1981 gMC->Gsatt("ZPTX","SEEN",0);
1982 gMC->Gsatt("ZP1 ","COLO",6);
1983 gMC->Gsatt("ZP1 ","SEEN",1);
1984 gMC->Gsatt("ZPSL","SEEN",0);
1985 gMC->Gsatt("ZPST","SEEN",0);
1986 gMC->Gsatt("ZEM ","COLO",7);
1987 gMC->Gsatt("ZEM ","SEEN",1);
1988 gMC->Gsatt("ZEMF","SEEN",0);
1989 gMC->Gsatt("ZETR","SEEN",0);
1990 gMC->Gsatt("ZEL0","SEEN",0);
1991 gMC->Gsatt("ZEL1","SEEN",0);
1992 gMC->Gsatt("ZEL2","SEEN",0);
1993 gMC->Gsatt("ZEV0","SEEN",0);
1994 gMC->Gsatt("ZEV1","SEEN",0);
1995 gMC->Gsatt("ZES0","SEEN",0);
1996 gMC->Gsatt("ZES1","SEEN",0);
8d433671 1997 //
8d433671 1998}
1999
2000//_____________________________________________________________________________
2001void AliZDCv3::CreateMaterials()
2002{
2003 //
2004 // Create Materials for the Zero Degree Calorimeter
2005 //
00521574 2006 Float_t dens, ubuf[1], wmat[3], a[3], z[3];
2007
2008 // --- W alloy -> ZN passive material
2009 dens = 17.6;
2010 a[0] = 183.85;
2011 a[1] = 55.85;
2012 a[2] = 58.71;
2013 z[0] = 74.;
2014 z[1] = 26.;
2015 z[2] = 28.;
2016 wmat[0] = .93;
2017 wmat[1] = .03;
2018 wmat[2] = .04;
6656fe8d 2019 AliMixture(1, "WALL", a, z, dens, 3, wmat);
8d433671 2020
8d433671 2021 // --- Brass (CuZn) -> ZP passive material
2022 dens = 8.48;
2023 a[0] = 63.546;
2024 a[1] = 65.39;
2025 z[0] = 29.;
2026 z[1] = 30.;
2027 wmat[0] = .63;
2028 wmat[1] = .37;
cd807e71 2029 AliMixture(2, "BRASS", a, z, dens, 2, wmat);
8d433671 2030
2031 // --- SiO2
2032 dens = 2.64;
2033 a[0] = 28.086;
2034 a[1] = 15.9994;
2035 z[0] = 14.;
2036 z[1] = 8.;
2037 wmat[0] = 1.;
2038 wmat[1] = 2.;
cd807e71 2039 AliMixture(3, "SIO2", a, z, dens, -2, wmat);
8d433671 2040
2041 // --- Lead
2042 ubuf[0] = 1.12;
30f5a47b 2043 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 0., ubuf, 1);
8d433671 2044
2045 // --- Copper (energy loss taken into account)
2046 ubuf[0] = 1.10;
2047 AliMaterial(6, "COPP0", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
fea9b334 2048
2049 // --- Copper
2050 ubuf[0] = 1.10;
2051 AliMaterial(9, "COPP1", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
8d433671 2052
8d433671 2053 // --- Iron (energy loss taken into account)
2054 ubuf[0] = 1.1;
2055 AliMaterial(7, "IRON0", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
2056
2057 // --- Iron (no energy loss)
2058 ubuf[0] = 1.1;
313e8ff0 2059 AliMaterial(8, "IRON1", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
30f5a47b 2060
2061 // --- Tatalum
2062 ubuf[0] = 1.1;
2063 AliMaterial(13, "TANT", 183.84, 74., 19.3, 0.35, 0., ubuf, 1);
f853b9aa 2064
8d433671 2065 // ---------------------------------------------------------
2066 Float_t aResGas[3]={1.008,12.0107,15.9994};
2067 Float_t zResGas[3]={1.,6.,8.};
2068 Float_t wResGas[3]={0.28,0.28,0.44};
2069 Float_t dResGas = 3.2E-14;
2070
2071 // --- Vacuum (no magnetic field)
2072 AliMixture(10, "VOID", aResGas, zResGas, dResGas, 3, wResGas);
8d433671 2073
2074 // --- Vacuum (with magnetic field)
2075 AliMixture(11, "VOIM", aResGas, zResGas, dResGas, 3, wResGas);
8d433671 2076
2077 // --- Air (no magnetic field)
2078 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
2079 Float_t zAir[4]={6.,7.,8.,18.};
2080 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
2081 Float_t dAir = 1.20479E-3;
2082 //
2083 AliMixture(12, "Air $", aAir, zAir, dAir, 4, wAir);
8d433671 2084
2085 // --- Definition of tracking media:
2086
2087 // --- Tantalum = 1 ;
2088 // --- Brass = 2 ;
2089 // --- Fibers (SiO2) = 3 ;
2090 // --- Fibers (SiO2) = 4 ;
2091 // --- Lead = 5 ;
fea9b334 2092 // --- Copper (with high thr.)= 6 ;
2093 // --- Copper (with low thr.)= 9;
8d433671 2094 // --- Iron (with energy loss) = 7 ;
2095 // --- Iron (without energy loss) = 8 ;
2096 // --- Vacuum (no field) = 10
2097 // --- Vacuum (with field) = 11
2098 // --- Air (no field) = 12
2099
2100 // ****************************************************
2101 // Tracking media parameters
2102 //
2103 Float_t epsil = 0.01; // Tracking precision,
2104 Float_t stmin = 0.01; // Min. value 4 max. step (cm)
2105 Float_t stemax = 1.; // Max. step permitted (cm)
2106 Float_t tmaxfd = 0.; // Maximum angle due to field (degrees)
331464fb 2107 Float_t tmaxfdv = 0.1; // Maximum angle due to field (degrees)
8d433671 2108 Float_t deemax = -1.; // Maximum fractional energy loss
2109 Float_t nofieldm = 0.; // Max. field value (no field)
2110 Float_t fieldm = 45.; // Max. field value (with field)
2111 Int_t isvol = 0; // ISVOL =0 -> not sensitive volume
2112 Int_t isvolActive = 1; // ISVOL =1 -> sensitive volume
2113 Int_t inofld = 0; // IFIELD=0 -> no magnetic field
2114 Int_t ifield =2; // IFIELD=2 -> magnetic field defined in AliMagFC.h
2115 // *****************************************************
2116
30f5a47b 2117 AliMedium(1, "ZWALL", 1, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
8d433671 2118 AliMedium(2, "ZBRASS",2, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2119 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2120 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2121 AliMedium(5, "ZLEAD", 5, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2122 AliMedium(6, "ZCOPP", 6, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2123 AliMedium(7, "ZIRON", 7, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2124 AliMedium(8, "ZIRONN",8, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
fea9b334 2125 AliMedium(9, "ZCOPL", 6, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
8d433671 2126 AliMedium(10,"ZVOID",10, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
331464fb 2127 AliMedium(11,"ZVOIM",11, isvol, ifield, fieldm, tmaxfdv, stemax, deemax, epsil, stmin);
fea9b334 2128 AliMedium(12,"ZAIR", 12, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
30f5a47b 2129 AliMedium(13,"ZTANT",13, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
2130 AliMedium(14, "ZIRONT", 7, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin);
f853b9aa 2131
2132}
2133
2134//_____________________________________________________________________________
2135void AliZDCv3::AddAlignableVolumes() const
2136{
2137 //
2138 // Create entries for alignable volumes associating the symbolic volume
2139 // name with the corresponding volume path. Needs to be syncronized with
2140 // eventual changes in the geometry.
2141 //
63e6d88e 2142 TString volpath1 = "ALIC_1/ZDCC_1/ZNEU_1";
2143 TString volpath2 = "ALIC_1/ZDCC_1/ZPRO_1";
2144 TString volpath3 = "ALIC_1/ZDCA_1/ZNEU_2";
2145 TString volpath4 = "ALIC_1/ZDCA_1/ZPRO_2";
f853b9aa 2146
63e6d88e 2147 TString symname1="ZDC/NeutronZDC_C";
2148 TString symname2="ZDC/ProtonZDC_C";
2149 TString symname3="ZDC/NeutronZDC_A";
2150 TString symname4="ZDC/ProtonZDC_A";
f853b9aa 2151
2152 if(!gGeoManager->SetAlignableEntry(symname1.Data(),volpath1.Data()))
2153 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname1.Data(),volpath1.Data()));
2154
2155 if(!gGeoManager->SetAlignableEntry(symname2.Data(),volpath2.Data()))
2156 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname2.Data(),volpath2.Data()));
63e6d88e 2157
2158 if(!gGeoManager->SetAlignableEntry(symname3.Data(),volpath3.Data()))
2159 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname1.Data(),volpath1.Data()));
2160
2161 if(!gGeoManager->SetAlignableEntry(symname4.Data(),volpath4.Data()))
2162 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname2.Data(),volpath2.Data()));
2163
f853b9aa 2164}
2165
2166
2167//_____________________________________________________________________________
2168void AliZDCv3::Init()
2169{
2170 InitTables();
2171 Int_t *idtmed = fIdtmed->GetArray();
8d433671 2172 //
30f5a47b 2173 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
2174 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
2175 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
2176 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
2177 fMedSensZEM = idtmed[5]; // Sensitive volume: ZEM passive material
2178 fMedSensTDI = idtmed[6]; // Sensitive volume: TDI Cu shield
2179 fMedSensPI = idtmed[7]; // Sensitive volume: beam pipes
2180 fMedSensLumi = idtmed[9]; // Sensitive volume: luminometer
2181 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
2182 fMedSensVColl = idtmed[13]; // Sensitive volume: collimator jaws
8d433671 2183}
2184
2185//_____________________________________________________________________________
2186void AliZDCv3::InitTables()
2187{
2188 //
2189 // Read light tables for Cerenkov light production parameterization
2190 //
2191
2192 Int_t k, j;
f8a0f802 2193 int read=1;
8d433671 2194
8d433671 2195 // --- Reading light tables for ZN
130a6809 2196 char *lightfName1 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362207s");
2197 FILE *fp1 = fopen(lightfName1,"r");
2198 if(fp1 == NULL){
8d433671 2199 printf("Cannot open file fp1 \n");
2200 return;
2201 }
f8a0f802 2202 else{
2203 for(k=0; k<fNalfan; k++){
2204 for(j=0; j<fNben; j++){
2205 read = fscanf(fp1,"%f",&fTablen[0][k][j]);
2206 if(read==0) AliDebug(3, " Error in reading light table 1");
2207 }
2208 }
2209 fclose(fp1);
2210 }
130a6809 2211 char *lightfName2 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362208s");
2212 FILE *fp2 = fopen(lightfName2,"r");
2213 if(fp2 == NULL){
8d433671 2214 printf("Cannot open file fp2 \n");
2215 return;
2216 }
f8a0f802 2217 else{
2218 for(k=0; k<fNalfan; k++){
2219 for(j=0; j<fNben; j++){
2220 read = fscanf(fp2,"%f",&fTablen[1][k][j]);
2221 if(read==0) AliDebug(3, " Error in reading light table 2");
2222 }
2223 }
2224 fclose(fp2);
2225 }
130a6809 2226 char *lightfName3 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362209s");
2227 FILE *fp3 = fopen(lightfName3,"r");
2228 if(fp3 == NULL){
8d433671 2229 printf("Cannot open file fp3 \n");
2230 return;
2231 }
f8a0f802 2232 else{
2233 for(k=0; k<fNalfan; k++){
2234 for(j=0; j<fNben; j++){
2235 read = fscanf(fp3,"%f",&fTablen[2][k][j]);
2236 if(read==0) AliDebug(3, " Error in reading light table 3");
2237 }
2238 }
2239 fclose(fp3);
2240 }
130a6809 2241 char *lightfName4 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362210s");
2242 FILE *fp4 = fopen(lightfName4,"r");
2243 if(fp4 == NULL){
8d433671 2244 printf("Cannot open file fp4 \n");
2245 return;
2246 }
f8a0f802 2247 else{
2248 for(k=0; k<fNalfan; k++){
2249 for(j=0; j<fNben; j++){
e83c8d88 2250 read = fscanf(fp4,"%f",&fTablen[3][k][j]);
2251 if(read==0) AliDebug(3, " Error in reading light table 4");
f8a0f802 2252 }
2253 }
2254 fclose(fp4);
8d433671 2255 }
f8a0f802 2256
8d433671 2257 // --- Reading light tables for ZP and ZEM
130a6809 2258 char *lightfName5 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552207s");
2259 FILE *fp5 = fopen(lightfName5,"r");
2260 if(fp5 == NULL){
8d433671 2261 printf("Cannot open file fp5 \n");
2262 return;
2263 }
f8a0f802 2264 else{
2265 for(k=0; k<fNalfap; k++){
2266 for(j=0; j<fNbep; j++){
2267 read = fscanf(fp5,"%f",&fTablep[0][k][j]);
2268 if(read==0) AliDebug(3, " Error in reading light table 5");
2269 }
2270 }
2271 fclose(fp5);
2272 }
130a6809 2273 char *lightfName6 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552208s");
2274 FILE *fp6 = fopen(lightfName6,"r");
2275 if(fp6 == NULL){
8d433671 2276 printf("Cannot open file fp6 \n");
2277 return;
2278 }
f8a0f802 2279 else{
2280 for(k=0; k<fNalfap; k++){
2281 for(j=0; j<fNbep; j++){
2282 read = fscanf(fp6,"%f",&fTablep[1][k][j]);
2283 if(read==0) AliDebug(3, " Error in reading light table 6");
2284 }
2285 }
c3dd4404 2286 fclose(fp6);
f8a0f802 2287 }
130a6809 2288 char *lightfName7 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552209s");
2289 FILE *fp7 = fopen(lightfName7,"r");
2290 if(fp7 == NULL){
8d433671 2291 printf("Cannot open file fp7 \n");
2292 return;
2293 }
f8a0f802 2294 else{
2295 for(k=0; k<fNalfap; k++){
2296 for(j=0; j<fNbep; j++){
2297 read = fscanf(fp7,"%f",&fTablep[2][k][j]);
2298 if(read==0) AliDebug(3, " Error in reading light table 7");
2299 }
2300 }
2301 fclose(fp7);
2302 }
130a6809 2303 char *lightfName8 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552210s");
2304 FILE *fp8 = fopen(lightfName8,"r");
2305 if(fp8 == NULL){
8d433671 2306 printf("Cannot open file fp8 \n");
2307 return;
2308 }
f8a0f802 2309 else{
2310 for(k=0; k<fNalfap; k++){
2311 for(j=0; j<fNbep; j++){
e83c8d88 2312 read = fscanf(fp8,"%f",&fTablep[3][k][j]);
2313 if(read==0) AliDebug(3, " Error in reading light table 8");
f8a0f802 2314 }
2315 }
2316 fclose(fp8);
8d433671 2317 }
f8a0f802 2318
8d433671 2319}
2320//_____________________________________________________________________________
2321void AliZDCv3::StepManager()
2322{
2323 //
2324 // Routine called at every step in the Zero Degree Calorimeters
b6a8f9f1 2325 //
47709f57 2326 Int_t j, vol[2]={0,0}, ibeta=0, ialfa=0, ibe=0, nphe=0;
130a6809 2327 Float_t hits[13], x[3], xdet[3]={999.,999.,999.}, um[3], ud[3];
33e9164a 2328 Float_t destep=0., be=0., out=0.;
796c8b58 2329 Double_t s[3], p[4];
8d433671 2330 const char *knamed;
f853b9aa 2331 //
ae3870e6 2332 for(j=0;j<13;j++) hits[j]=-999.;
f853b9aa 2333 //
30f5a47b 2334 // --- This part is for no shower developement in beam pipe, TDI, VColl
2335 // If particle interacts with beam pipe, TDI, VColl -> return
2336 if(fNoShower==1 && ((gMC->CurrentMedium() == fMedSensPI) || (gMC->CurrentMedium() == fMedSensTDI) ||
2337 (gMC->CurrentMedium() == fMedSensVColl || (gMC->CurrentMedium() == fMedSensLumi)))){
2338
6b7cc34d 2339 // If option NoShower is set -> StopTrack
30f5a47b 2340
6b7cc34d 2341 Int_t ipr = 0;
f853b9aa 2342 gMC->TrackPosition(s[0],s[1],s[2]);
cd807e71 2343 if(gMC->CurrentMedium() == fMedSensPI){
8d433671 2344 knamed = gMC->CurrentVolName();
f853b9aa 2345 if(!strncmp(knamed,"YMQ",3)){
2346 if(s[2]<0) fpLostITC += 1;
2347 else fpLostITA += 1;
6b7cc34d 2348 ipr=1;
f853b9aa 2349 }
8cbab886 2350 else if(!strncmp(knamed,"YD1",3)){
f853b9aa 2351 if(s[2]<0) fpLostD1C += 1;
2352 else fpLostD1A += 1;
6b7cc34d 2353 ipr=1;
f853b9aa 2354 }
8d433671 2355 }
f853b9aa 2356 else if(gMC->CurrentMedium() == fMedSensTDI){
8d433671 2357 knamed = gMC->CurrentVolName();
f853b9aa 2358 if(!strncmp(knamed,"MD1",3)){
2359 if(s[2]<0) fpLostD1C += 1;
2360 else fpLostD1A += 1;
6b7cc34d 2361 ipr=1;
f853b9aa 2362 }
8cbab886 2363 else if(!strncmp(knamed,"QTD",3)) fpLostTDI += 1;
8d433671 2364 }
30f5a47b 2365 else if(gMC->CurrentMedium() == fMedSensVColl){
2366 knamed = gMC->CurrentVolName();
2367 if(!strncmp(knamed,"QCVC",4)) fpcVCollC++;
2368 else if(!strncmp(knamed,"QCVA",4)) fpcVCollA++;
2369 ipr=1;
2370 }
cd807e71 2371 //
8cbab886 2372 //gMC->TrackMomentum(p[0], p[1], p[2], p[3]);
cd807e71 2373 //printf("\t Particle: mass = %1.3f, E = %1.3f GeV, pz = %1.2f GeV -> stopped in volume %s\n",
2374 // gMC->TrackMass(), p[3], p[2], gMC->CurrentVolName());
2375 //
30f5a47b 2376 if(ipr!=0){
6b7cc34d 2377 printf("\n\t **********************************\n");
2378 printf("\t ********** Side C **********\n");
30f5a47b 2379 printf("\t # of particles in IT = %d\n",fpLostITC);
2380 printf("\t # of particles in D1 = %d\n",fpLostD1C);
2381 printf("\t # of particles in VColl = %d\n",fpcVCollC);
6b7cc34d 2382 printf("\t ********** Side A **********\n");
30f5a47b 2383 printf("\t # of particles in IT = %d\n",fpLostITA);
2384 printf("\t # of particles in D1 = %d\n",fpLostD1A);
2385 printf("\t # of particles in TDI = %d\n",fpLostTDI);
2386 printf("\t # of particles in VColl = %d\n",fpcVCollA);
6b7cc34d 2387 printf("\t **********************************\n");
30f5a47b 2388 }
8d433671 2389 gMC->StopTrack();
30f5a47b 2390 return;
8d433671 2391 }
2392
8d433671 2393 if((gMC->CurrentMedium() == fMedSensZN) || (gMC->CurrentMedium() == fMedSensZP) ||
2394 (gMC->CurrentMedium() == fMedSensGR) || (gMC->CurrentMedium() == fMedSensF1) ||
2395 (gMC->CurrentMedium() == fMedSensF2) || (gMC->CurrentMedium() == fMedSensZEM)){
2396
8cbab886 2397
8d433671 2398 //Particle coordinates
f853b9aa 2399 gMC->TrackPosition(s[0],s[1],s[2]);
8d433671 2400 for(j=0; j<=2; j++) x[j] = s[j];
2401 hits[0] = x[0];
2402 hits[1] = x[1];
2403 hits[2] = x[2];
2404
2405 // Determine in which ZDC the particle is
2406 knamed = gMC->CurrentVolName();
2407 if(!strncmp(knamed,"ZN",2)){
921be7cf 2408 if(x[2]<0.) vol[0]=1; // ZNC (dimuon side)
2409 else if(x[2]>0.) vol[0]=4; //ZNA
8d433671 2410 }
2411 else if(!strncmp(knamed,"ZP",2)){
921be7cf 2412 if(x[2]<0.) vol[0]=2; //ZPC (dimuon side)
2413 else if(x[2]>0.) vol[0]=5; //ZPA
8d433671 2414 }
921be7cf 2415 else if(!strncmp(knamed,"ZE",2)) vol[0]=3; //ZEM
8d433671 2416
2417 // Determine in which quadrant the particle is
f853b9aa 2418 if(vol[0]==1){ //Quadrant in ZNC
61424d1c 2419 // Calculating particle coordinates inside ZNC
f853b9aa 2420 xdet[0] = x[0]-fPosZNC[0];
2421 xdet[1] = x[1]-fPosZNC[1];
8d433671 2422 // Calculating quadrant in ZN
2423 if(xdet[0]<=0.){
f853b9aa 2424 if(xdet[1]<=0.) vol[1]=1;
2425 else vol[1]=3;
8d433671 2426 }
2427 else if(xdet[0]>0.){
f853b9aa 2428 if(xdet[1]<=0.) vol[1]=2;
2429 else vol[1]=4;
8d433671 2430 }
8d433671 2431 }
2432
f853b9aa 2433 else if(vol[0]==2){ //Quadrant in ZPC
61424d1c 2434 // Calculating particle coordinates inside ZPC
09930289 2435 xdet[0] = x[0]-fPosZPC[0];
2436 xdet[1] = x[1]-fPosZPC[1];
8d433671 2437 if(xdet[0]>=fDimZP[0]) xdet[0]=fDimZP[0]-0.01;
2438 if(xdet[0]<=-fDimZP[0]) xdet[0]=-fDimZP[0]+0.01;
2439 // Calculating tower in ZP
2440 Float_t xqZP = xdet[0]/(fDimZP[0]/2.);
2441 for(int i=1; i<=4; i++){
2442 if(xqZP>=(i-3) && xqZP<(i-2)){
2443 vol[1] = i;
2444 break;
2445 }
2446 }
8d433671 2447 }
f853b9aa 2448 //
8d433671 2449 // Quadrant in ZEM: vol[1] = 1 -> particle in 1st ZEM (placed at x = 8.5 cm)
2450 // vol[1] = 2 -> particle in 2nd ZEM (placed at x = -8.5 cm)
2451 else if(vol[0] == 3){
2452 if(x[0]>0.){
2453 vol[1] = 1;
2454 // Particle x-coordinate inside ZEM1
2455 xdet[0] = x[0]-fPosZEM[0];
2456 }
2457 else{
2458 vol[1] = 2;
2459 // Particle x-coordinate inside ZEM2
2460 xdet[0] = x[0]+fPosZEM[0];
2461 }
2462 xdet[1] = x[1]-fPosZEM[1];
2463 }
f853b9aa 2464 //
2465 else if(vol[0]==4){ //Quadrant in ZNA
2466 // Calculating particle coordinates inside ZNA
2467 xdet[0] = x[0]-fPosZNA[0];
2468 xdet[1] = x[1]-fPosZNA[1];
2469 // Calculating quadrant in ZNA
2470 if(xdet[0]>=0.){
2471 if(xdet[1]<=0.) vol[1]=1;
2472 else vol[1]=3;
8d433671 2473 }
f853b9aa 2474 else if(xdet[0]<0.){
2475 if(xdet[1]<=0.) vol[1]=2;
2476 else vol[1]=4;
8d433671 2477 }
8d433671 2478 }
f853b9aa 2479 //
2480 else if(vol[0]==5){ //Quadrant in ZPA
2481 // Calculating particle coordinates inside ZPA
09930289 2482 xdet[0] = x[0]-fPosZPA[0];
2483 xdet[1] = x[1]-fPosZPA[1];
8d433671 2484 if(xdet[0]>=fDimZP[0]) xdet[0]=fDimZP[0]-0.01;
2485 if(xdet[0]<=-fDimZP[0]) xdet[0]=-fDimZP[0]+0.01;
2486 // Calculating tower in ZP
f853b9aa 2487 Float_t xqZP = -xdet[0]/(fDimZP[0]/2.);
8d433671 2488 for(int i=1; i<=4; i++){
2489 if(xqZP>=(i-3) && xqZP<(i-2)){
2490 vol[1] = i;
2491 break;
2492 }
2493 }
8d433671 2494 }
fd9afd60 2495 if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4))
fea9b334 2496 AliError(Form(" WRONG tower for det %d: tow %d with xdet=(%f, %f)\n",
fd9afd60 2497 vol[0], vol[1], xdet[0], xdet[1]));
2498 // Ch. debug
2499 //printf("\t *** det %d vol %d xdet(%f, %f)\n",vol[0], vol[1], xdet[0], xdet[1]);
8d433671 2500
2139bd52 2501
33e9164a 2502 // Store impact point and kinetic energy of the ENTERING particle
8d433671 2503
33e9164a 2504 if(gMC->IsTrackEntering()){
2505 //Particle energy
2506 gMC->TrackMomentum(p[0],p[1],p[2],p[3]);
2507 hits[3] = p[3];
30f5a47b 2508
33e9164a 2509 // Impact point on ZDC
2510 // X takes into account the LHC x-axis sign
30f5a47b 2511 // which is opposite to positive x on detector front face
33e9164a 2512 // for side A detectors (ZNA and ZPA)
2513 if(vol[0]==4 || vol[0]==5){
2514 hits[4] = -xdet[0];
2515 }
2516 else{
2517 hits[4] = xdet[0];
2518 }
2519 hits[5] = xdet[1];
2520 hits[6] = 0;
2521 hits[7] = 0;
2522 hits[8] = 0;
2523 hits[9] = 0;
2524 //
2525 Int_t curTrackN = gAlice->GetMCApp()->GetCurrentTrackNumber();
2526 TParticle *part = gAlice->GetMCApp()->Particle(curTrackN);
2527 hits[10] = part->GetPdgCode();
2528 //printf("\t PDGCode = %d\n", part->GetPdgCode());
2529 //
2530 Int_t imo = part->GetFirstMother();
2531 if(imo>0){
2532 TParticle * pmot = gAlice->GetMCApp()->Particle(imo);
2533 hits[11] = pmot->GetPdgCode();
2534 }
2535 else hits[11]=0;
2536 //
2537 hits[12] = 1.0e09*gMC->TrackTime(); // in ns!
2538 //printf("\t TrackTime = %f\n", hits[12]);
2539
2540 AddHit(curTrackN, vol, hits);
2541
2542 if(fNoShower==1){
33e9164a 2543 if(vol[0]==1){
2544 fnDetectedC += 1;
30f5a47b 2545 if(fnDetectedC==1) printf(" ### Particle in ZNC\n\n");
ae3870e6 2546 }
33e9164a 2547 else if(vol[0]==2){
2548 fpDetectedC += 1;
30f5a47b 2549 if(fpDetectedC==1) printf(" ### Particle in ZPC\n\n");
33e9164a 2550 }
2551 else if(vol[0]==4){
2552 fnDetectedA += 1;
30f5a47b 2553 if(fnDetectedA==1) printf(" ### Particle in ZNA\n\n");
33e9164a 2554 }
2555 else if(vol[0]==5){
2556 fpDetectedA += 1;
30f5a47b 2557 if(fpDetectedA==1) printf(" ### Particle in ZPA\n\n");
33e9164a 2558 }
2559 //
30f5a47b 2560 //printf("\t Pc: x %1.2f y %1.2f z %1.2f E %1.2f GeV pz = %1.2f GeV in volume %s\n",
2561 // x[0],x[1],x[3],p[3],p[2],gMC->CurrentVolName());
e4d73825 2562 //
33e9164a 2563 gMC->StopTrack();
2564 return;
8d433671 2565 }
33e9164a 2566 }
2567
2568 // Particle energy loss
2569 if(gMC->Edep() != 0){
2570 hits[9] = gMC->Edep();
2571 hits[7] = 0.;
2572 hits[8] = 0.;
2573 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2574 }
8d433671 2575 }
2576
2577
2578 // *** Light production in fibres
2579 if((gMC->CurrentMedium() == fMedSensF1) || (gMC->CurrentMedium() == fMedSensF2)){
2580
2581 //Select charged particles
2582 if((destep=gMC->Edep())){
2583
2584 // Particle velocity
2585 Float_t beta = 0.;
f853b9aa 2586 gMC->TrackMomentum(p[0],p[1],p[2],p[3]);
8d433671 2587 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
2588 if(p[3] > 0.00001) beta = ptot/p[3];
2589 else return;
2590 if(beta<0.67)return;
2591 else if((beta>=0.67) && (beta<=0.75)) ibeta = 0;
2592 else if((beta>0.75) && (beta<=0.85)) ibeta = 1;
2593 else if((beta>0.85) && (beta<=0.95)) ibeta = 2;
2594 else if(beta>0.95) ibeta = 3;
2595
2596 // Angle between particle trajectory and fibre axis
2597 // 1 -> Momentum directions
2598 um[0] = p[0]/ptot;
2599 um[1] = p[1]/ptot;
2600 um[2] = p[2]/ptot;
2601 gMC->Gmtod(um,ud,2);
2602 // 2 -> Angle < limit angle
2603 Double_t alfar = TMath::ACos(ud[2]);
2604 Double_t alfa = alfar*kRaddeg;
2605 if(alfa>=110.) return;
2606 //
2607 ialfa = Int_t(1.+alfa/2.);
2608
2609 // Distance between particle trajectory and fibre axis
f853b9aa 2610 gMC->TrackPosition(s[0],s[1],s[2]);
8d433671 2611 for(j=0; j<=2; j++){
2612 x[j] = s[j];
2613 }
2614 gMC->Gmtod(x,xdet,1);
2615 if(TMath::Abs(ud[0])>0.00001){
2616 Float_t dcoeff = ud[1]/ud[0];
2617 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
2618 }
2619 else{
2620 be = TMath::Abs(ud[0]);
2621 }
2622
2623 ibe = Int_t(be*1000.+1);
30f5a47b 2624
8d433671 2625 //Looking into the light tables
2626 Float_t charge = gMC->TrackCharge();
2627
80e87581 2628 if(vol[0]==1 || vol[0]==4) { // (1) ZN fibres
8d433671 2629 if(ibe>fNben) ibe=fNben;
2630 out = charge*charge*fTablen[ibeta][ialfa][ibe];
2631 nphe = gRandom->Poisson(out);
2632 // Ch. debug
2633 //if(ibeta==3) printf("\t %f \t %f \t %f\n",alfa, be, out);
2634 //printf("\t ibeta = %d, ialfa = %d, ibe = %d -> nphe = %d\n\n",ibeta,ialfa,ibe,nphe);
2635 if(gMC->CurrentMedium() == fMedSensF1){
2636 hits[7] = nphe; //fLightPMQ
2637 hits[8] = 0;
2638 hits[9] = 0;
2639 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2640 }
2641 else{
2642 hits[7] = 0;
2643 hits[8] = nphe; //fLightPMC
2644 hits[9] = 0;
2645 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2646 }
2647 }
80e87581 2648 else if(vol[0]==2 || vol[0]==5) {// (2) ZP fibres
8d433671 2649 if(ibe>fNbep) ibe=fNbep;
2650 out = charge*charge*fTablep[ibeta][ialfa][ibe];
2651 nphe = gRandom->Poisson(out);
2652 if(gMC->CurrentMedium() == fMedSensF1){
2653 hits[7] = nphe; //fLightPMQ
2654 hits[8] = 0;
2655 hits[9] = 0;
2656 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2657 }
2658 else{
2659 hits[7] = 0;
2660 hits[8] = nphe; //fLightPMC
2661 hits[9] = 0;
2662 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2663 }
2664 }
2665 else if((vol[0]==3)) { // (3) ZEM fibres
2666 if(ibe>fNbep) ibe=fNbep;
2667 out = charge*charge*fTablep[ibeta][ialfa][ibe];
f853b9aa 2668 gMC->TrackPosition(s[0],s[1],s[2]);
47709f57 2669 Float_t xalic[3];
2670 for(j=0; j<3; j++){
8d433671 2671 xalic[j] = s[j];
2672 }
2673 // z-coordinate from ZEM front face
2674 // NB-> fPosZEM[2]+fZEMLength = -1000.+2*10.3 = 979.69 cm
47709f57 2675 Float_t z = -xalic[2]+fPosZEM[2]+2*fZEMLength-xalic[1];
3268e9bb 2676 //z = xalic[2]-fPosZEM[2]-fZEMLength-xalic[1]*(TMath::Tan(45.*kDegrad));
8a132379 2677 //printf(" fPosZEM[2]+2*fZEMLength = %f", fPosZEM[2]+2*fZEMLength);
fea9b334 2678 //
2679 // Parametrization for light guide uniformity
2680 // NEW!!! Light guide tilted @ 51 degrees
2681 Float_t guiPar[4]={0.31,-0.0006305,0.01337,0.8895};
47709f57 2682 Float_t guiEff = guiPar[0]*(guiPar[1]*z*z+guiPar[2]*z+guiPar[3]);
8d433671 2683 out = out*guiEff;
2684 nphe = gRandom->Poisson(out);
3268e9bb 2685 //printf(" out*guiEff = %f nphe = %d", out, nphe);
8d433671 2686 if(vol[1] == 1){
2687 hits[7] = 0;
2688 hits[8] = nphe; //fLightPMC (ZEM1)
2689 hits[9] = 0;
2690 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2691 }
2692 else{
2693 hits[7] = nphe; //fLightPMQ (ZEM2)
2694 hits[8] = 0;
2695 hits[9] = 0;
2696 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
2697 }
2698 }
2699 }
2700 }
2701}