]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROv5.cxx
Retuning of vertexer parameters for fPileupAlgo=1. Added trigger and magnetic field...
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv5.cxx
CommitLineData
f4f76f65 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/* $Id$ */
17
18//////////////////////////////////////////////////////////////////////
19// //
20// (V-zero) detector version 5 as designed by the Lyon group //
21// All comments should be sent to Brigitte CHEYNIS : //
22// b.cheynis@ipnl.in2p3.fr //
23// Geometry of the 16 th of june 2004 //
24// (now 8 sectors instead of 12 sectors as in previous version) //
25// V0R (now V0C) sits between Z values -89.6 and -84.9 cm //
26// V0L (now V0A) sits between Z values +339.0 and +341.0 cm //
27// New coordinate system has been implemented in october 2003 //
28// //
29//////////////////////////////////////////////////////////////////////
30
31// --- Standard libraries ---
32#include <Riostream.h>
33#include <stdlib.h>
34#include <string.h>
35
36// --- ROOT libraries ---
37#include <TClonesArray.h>
f7a1cc68 38#include <TGeoGlobalMagField.h>
f4f76f65 39#include <TLorentzVector.h>
40#include <TMath.h>
f4f76f65 41#include <TObjectTable.h>
f4f76f65 42#include <TParticle.h>
f7a1cc68 43#include <TVirtualMC.h>
f4f76f65 44
45// --- AliRoot header files ---
46#include "AliRun.h"
47#include "AliMC.h"
48#include "AliConst.h"
49#include "AliMagF.h"
50#include "AliVZEROLoader.h"
51#include "AliVZEROdigit.h"
52#include "AliVZEROhit.h"
53#include "AliVZEROv5.h"
254ef8f1 54#include "AliLog.h"
f4f76f65 55
56ClassImp(AliVZEROv5)
57
58//_____________________________________________________________________________
0b2bea8b 59AliVZEROv5:: AliVZEROv5():AliVZERO(),
60 fCellId(0),
61 fTrackPosition(),
62 fTrackMomentum(),
63 fLightYield(93.75),
64 fLightAttenuation(0.05),
65 fnMeters(15.0),
66 fFibToPhot(0.3)
f4f76f65 67{
68// Standard default constructor
69}
70
71//_____________________________________________________________________________
72AliVZEROv5::AliVZEROv5(const char *name, const char *title):
0b2bea8b 73 AliVZERO(name,title),
74 fCellId(0),
75 fTrackPosition(),
76 fTrackMomentum(),
77 fLightYield(93.75),
78 fLightAttenuation(0.05),
79 fnMeters(15.0),
80 fFibToPhot(0.3)
f4f76f65 81{
82
83// Standard constructor for V-zero Detector version 5
84
254ef8f1 85 AliDebug(2,"Create VZERO object ");
0b2bea8b 86//
87// fLightYield = 93.75; // Light yield in BC408 (93.75 eV per photon)
88// fLightAttenuation = 0.05; // Light attenuation in fiber (0.05 per meter)
89// fnMeters = 15.0; // Number of meters of clear fibers to PM
90// fFibToPhot = 0.3; // Attenuation at fiber-photocathode interface
f4f76f65 91}
92
93//_____________________________________________________________________________
94void AliVZEROv5::CreateGeometry()
95{
96
97// Creates the GEANT geometry of the V-zero Detector version 5
98
254ef8f1 99 AliDebug(2,"Create Geometry ");
f4f76f65 100
101 Int_t *idtmed = fIdtmed->GetArray()-2999;
102
103 Int_t ndetR = 1;
104 Int_t ndetL = 1;
105
106 Int_t ncellsR = 1;
107 Int_t ncellsL = 1;
108
109 Int_t idrotm[999];
110
111 Float_t height1Right, height2Right, height3Right, height4Right;
112 Float_t heightRight;
113 Float_t theta;
114
115 Float_t halfThickQua;
116
117 Float_t zdet;
118 Float_t r0Right, r4Right, rBoxRight;
119 Float_t pi = TMath::Pi();
120
121 height1Right = 2.6; // height of cell 1, in cm
122 height2Right = 4.6; // height of cell 2, in cm
123 height3Right = 7.6; // height of cell 3, in cm
124 height4Right = 12.7; // height of cell 4, in cm
125
126 theta = pi/4.0/2.0; // half angular opening = 22.5 degrees
127
128 halfThickQua= fThickness1/2.0; // half thickness of elementary cell (inner ring)
129
130// distance 0.6 cm in zdet accounts for the fact V0R box back lid sits 0.6 away from
131// absorber nose sitting at 90 cm. Will use -zdet later...
132// size of V0R box (fThickness) is increased by 3 mm as compared to basic version
133
134 fThickness = fThickness + 0.3; // now 4.7 cm instead of 4.4 cm
135 zdet = 90.0 - 0.6 - fThickness/2.0; // distance to vertex (along Z axis)
136 r0Right = 4.20; // closest distance to center of the beam pipe
137 heightRight = height1Right + height2Right + height3Right + height4Right;
138 r4Right = r0Right + heightRight + 0.3;
139 rBoxRight = 38.0; // external radius of right box
140
141// Creation of mother volume v0LE - left part - :
142// Entrance face at +339.0 cm (new coordinate system) ...
143
144 Float_t partube[3];
145
146 partube[0] = 4.3;
147 partube[1] = 44.0;
148 partube[2] = fThickness1/2.0;
149
150 gMC->Gsvolu("V0LE","TUBE",idtmed[3005],partube,3);
151
152// Creation of five rings - left part - :
153// Entrance face at +339.0 cm (new coordinate system) ...
154
155// Mother volume v0L0 in which will be set 5 scintillator cells
156
157 Float_t partubs[5];
158
159 Float_t r0Left = 4.3;
160 Float_t height1Left = 3.3;
161 Float_t height2Left = 6.2;
162 Float_t height3Left = 8.9;
163 Float_t height4Left = 20.9;
164 Float_t heightLeft = height1Left + height2Left + height3Left + height4Left;
165
166 Float_t r4Left = r0Left + heightLeft;
167
168 partubs[0] = r0Left;
169 partubs[1] = r4Left;
170 partubs[2] = fThickness1/2.0;
171 partubs[3] = 90.0-22.5;
172 partubs[4] = 135.0-22.5;
173
174 gMC->Gsvolu("V0L0","TUBS",idtmed[3010],partubs,5); // air volume
175
176 Float_t r1Left = r0Left + height1Left;
177
178 partubs[0] = r0Left;
179 partubs[1] = r1Left;
180
181 gMC->Gsvolu("V0L1","TUBS",idtmed[3005],partubs,5); // quartz volume
182 gMC->Gspos("V0L1",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
183
184 Float_t r2Left = r1Left + height2Left;
185
186 partubs[0] = r1Left;
187 partubs[1] = r2Left;
188
189 gMC->Gsvolu("V0L2","TUBS",idtmed[3005],partubs,5); // quartz volume
190 gMC->Gspos("V0L2",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
191
192 Float_t r3Left = r2Left + height3Left;
193
194 partubs[0] = r2Left;
195 partubs[1] = r3Left;
196
197 gMC->Gsvolu("V0L3","TUBS",idtmed[3005],partubs,5); // quartz volume
198 gMC->Gspos("V0L3",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
199
200 partubs[0] = r3Left;
201 partubs[1] = r4Left;
202
203 gMC->Gsvolu("V0L4","TUBS",idtmed[3005],partubs,5); // quartz volume
204 gMC->Gspos("V0L4",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
205
206// Creation of mother volume v0RI - right part - :
207
208 partube[0] = r0Right - 0.2;
209 partube[1] = r4Right + 1.0;
210 partube[2] = fThickness/2.0;
211
212 gMC->Gsvolu("V0RI","TUBE",idtmed[3010],partube,3);
213
214// Creation of carbon lids (3.0 mm thick) to keep v0RI box shut...
215
216 Float_t lidThickness = 0.30;
217
218 partube[0] = r0Right;
219 partube[1] = rBoxRight;
220 partube[2] = +lidThickness/2.0;
221
222 gMC->Gsvolu("V0CA","TUBE",idtmed[3001],partube,3);
223 gMC->Gspos("V0CA",1,"V0RI",0.0,0.0, fThickness/2.0-partube[2],0,"ONLY");
224 gMC->Gspos("V0CA",2,"V0RI",0.0,0.0,-fThickness/2.0+partube[2],0,"ONLY");
225
226// Creation of aluminum rings 3.0 mm thick to maintain the v0RI pieces ...
227
228 partube[0] = r0Right;
229 partube[1] = r0Right + 0.3;
230 partube[2] = +fThickness/2.0;
231
232 gMC->Gsvolu("V0IR","TUBE",idtmed[3003],partube,3);
233 gMC->Gspos("V0IR",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
234
235 partube[0] = rBoxRight - 0.3;
236 partube[1] = rBoxRight;
237 partube[2] = +fThickness/2.0;
238
239 gMC->Gsvolu("V0ER","TUBE",idtmed[3003],partube,3);
240 gMC->Gspos("V0ER",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
241
242// Mother volume v0R0 in which will be set 6 scintillator cells
243
244 partubs[0] = r0Right;
245 partubs[1] = r4Right;
246 partubs[2] = fThickness/2.0;
247 partubs[3] = 90.0-22.5;
248 partubs[4] = 135.0-22.5;
249
250 gMC->Gsvolu("V0R0","TUBS",idtmed[3010],partubs,5); // air volume
251
252// Elementary cell of ring 1 :
253// (cells of ring 1 will be shifted by 2.0 cm backwards to output fibers)
254
255 Float_t offsetFibers = 1.0;
256 Float_t offset = fThickness/2.0 - lidThickness - fThickness1/2.0;
257 Float_t r1Right = r0Right + 0.3 + height1Right;
258
259 partubs[0] = r0Right + 0.3;
260 partubs[1] = r1Right;
261 partubs[2] = fThickness1/2.0;
262
263 gMC->Gsvolu("V0R1","TUBS",idtmed[3005],partubs,5); // scintillator volume
264 gMC->Gspos("V0R1",1,"V0R0", 0.0, 0.0 , -offset, 0,"ONLY");
265
266// Elementary cell of ring 2 :
267// (cells of ring 2 will be shifted by 1.0 cm backwards to output fibers)
268
269 Float_t r2Right = r1Right + height2Right;
270
271 partubs[0] = r1Right;
272 partubs[1] = r2Right;
273
274 gMC->Gsvolu("V0R2","TUBS",idtmed[3005],partubs,5); // scintillator volume
275 gMC->Gspos("V0R2",1,"V0R0", 0.0, 0.0 , -offset + offsetFibers, 0,"ONLY");
276
277// Elementary cell of ring 3 :
278
279 Float_t r3Right = r2Right + height3Right;
280
281 partubs[0] = r2Right;
282 partubs[1] = r3Right;
283 partubs[3] = 90.0-22.5;
284 partubs[4] = 112.5-22.5;
285
286 gMC->Gsvolu("V0R3","TUBS",idtmed[3005],partubs,5); // scintillator volume
287 gMC->Gspos("V0R3",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
288
289 partubs[3] = 112.5-22.5;
290 partubs[4] = 135.0-22.5;
291 gMC->Gsvolu("V0R4","TUBS",idtmed[3005],partubs,5); // scintillator volume
292 gMC->Gspos("V0R4",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
293
294// Elementary cell of ring 4 :
295
296 partubs[0] = r3Right;
297 partubs[1] = r4Right;
298 partubs[3] = 90.0-22.5;
299 partubs[4] = 112.5-22.5;
300
301 gMC->Gsvolu("V0R5","TUBS",idtmed[3005],partubs,5); // scintillator volume
302 gMC->Gspos("V0R5",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
303
304 partubs[3] = 112.5-22.5;
305 partubs[4] = 135.0-22.5;
306 gMC->Gsvolu("V0R6","TUBS",idtmed[3005],partubs,5); // scintillator volume
307 gMC->Gspos("V0R6",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
308
309 Float_t phiDeg = 180./4.;
310
311// Right part :
312
313 for(Float_t phi = 22.5; phi < 360.0; phi = phi + phiDeg)
314 {
315 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
316 gMC->Gspos("V0R0",ndetR,"V0RI",0.0,
317 0.0,0.0,idrotm[902],"ONLY");
318 ndetR++;
319 }
320
321 gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,-zdet,0,"ONLY");
322
323 ncellsR = (ndetR - 1) * 6;
254ef8f1 324 AliInfo(Form("Number of cells on Right side = %d\n", ncellsR));
f4f76f65 325
326// Left part :
327
328 for(Float_t phi = 22.5; phi < 360.0; phi = phi + phiDeg)
329 {
330 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
331 gMC->Gspos("V0L0",ndetL,"V0LE",0.0,
332 0.0,0.0,idrotm[902],"ONLY");
333 ndetL++;
334 }
335
336 gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,339.0+fThickness1/2.0,0,"ONLY");
337
338 ncellsL = (ndetL - 1) * 4;
254ef8f1 339 AliInfo(Form("Number of cells on Left side = %d\n", ncellsL));
f4f76f65 340
341}
342
f4f76f65 343//_____________________________________________________________________________
344void AliVZEROv5::CreateMaterials()
345{
346
347// Creates materials used for geometry
348
254ef8f1 349 AliDebug(2,"Create materials");
f4f76f65 350
351/*
352 Float_t ppckov[14] = { 5.5e-9, 5.7e-9, 5.9e-9, 6.1e-9, 6.3e-9, 6.5e-9, 6.7e-9,
353 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
354
355
356 Float_t ppckov_alu[14] = { 5.5e-9, 5.7e-9, 5.9e-9, 6.1e-9, 6.3e-9, 6.5e-9, 6.7e-9,
357 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
358
359 Float_t rindex_quarz[14] = { 1.52398, 1.53090, 1.53835, 1.54641, 1.55513, 1.56458,
360 1.57488, 1.58611, 1.59842, 1.61197, 1.62696, 1.64362,
361 1.662295, 1.68337 };
362
363 Float_t absco_quarz[14] = { 105.8, 45.656, 35.665, 28.598, 25.007, 21.04, 17.525,
364 14.177, 9.282, 4.0925, 1.149, 0.3627, 0.1497, 0.05 };
365
366 Float_t effic_all[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
367
368
369 Float_t rindex_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
370
371
372 Float_t absco_alu[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
373 1e-4,1e-4,1e-4,1e-4 };
374 Float_t effic_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
375
376*/
377
378 Int_t *idtmed = fIdtmed->GetArray()-2999;
379
f4f76f65 380
381// Parameters related to Quarz (SiO2) :
382
383 Float_t aqua[2], zqua[2], densqua, wmatqua[2];
384 Int_t nlmatqua;
385
386 aqua[0] = 28.09;
387 aqua[1] = 16.;
388 zqua[0] = 14.;
389 zqua[1] = 8.;
390 densqua = 2.64;
391 nlmatqua = -2;
392 wmatqua[0] = 1.;
393 wmatqua[1] = 2.;
394
395// Parameters related to aluminum sheets :
396
397 Float_t aal = 26.98;
398 Float_t zal = 13.00;
399 Float_t densal= 2.7;
400 Float_t radlal= 8.9;
401
402// Parameters related to scintillator CH :
403
404 Float_t ascin[2] = {1.00794,12.011};
405 Float_t zscin[2] = {1.,6.};
406 Float_t wscin[2] = {1.,1.};
407 Float_t denscin = 1.032;
408
b84cd1d5 409// AIR
410
411 Float_t aAir[4]={12.,14.,16.,36.};
412 Float_t zAir[4]={6.,7.,8.,18.};
413 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
414 Float_t dAir = 1.20479E-3;
415
f4f76f65 416// Definition of materials :
417
b84cd1d5 418 AliMixture( 1, "AIR A$", aAir,zAir,dAir,4,wAir);
419 AliMixture(11, "AIR I$", aAir,zAir,dAir,4,wAir);
f4f76f65 420 AliMaterial( 2, "CARBON$" , 12.01, 6.0, 2.265, 18.8, 49.9, 0, 0);
421 AliMixture( 3, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
422 AliMaterial( 4, "ALUMINIUM1$", 26.98, 13., 2.7, 8.9, 37.2, 0, 0);
423 AliMaterial( 5, "ALUMINIUM2$", aal, zal, densal, radlal, 0, 0, 0);
424
425 AliMixture( 6, "Scintillator$",ascin,zscin,denscin,-2,wscin);
426
427
f7a1cc68 428 Int_t iSXFLD = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ(); // Field type
429 Float_t sXMGMX = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max(); // Field max.
f4f76f65 430
431 Float_t tmaxfd, stemax, deemax, epsil, stmin;
432
433 tmaxfd = 10.;
434 stemax = 0.1;
435 deemax = 0.1;
436 epsil = 0.001;
437 stmin = 0.001;
438
439// Active Air :
440 AliMedium(1, "ACTIVE AIR$", 1, 1, iSXFLD, sXMGMX,
441 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
442
443// Inactive air :
444
445 AliMedium(11, "INACTIVE AIR$", 11, 0, iSXFLD, sXMGMX,
446 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
447
448 AliMedium(2, "CARBON$ ", 2, 1, iSXFLD, sXMGMX,
449 tmaxfd, stemax, deemax, epsil, stmin, 0, 0);
450
451 AliMedium(3, "QUARZ$", 3, 1, iSXFLD, sXMGMX,
452 tmaxfd, fMaxStepQua, fMaxDestepQua, epsil, stmin, 0, 0);
453
454 AliMedium(4,"ALUMINUM1$",4, 1, iSXFLD, sXMGMX,
455 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
456
457
458 AliMedium(5,"ALUMINUM2$",5, 1, iSXFLD, sXMGMX,
459 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
460
461 AliMedium(6,"SCINTILLATOR$",6, 1, iSXFLD, sXMGMX, 10.0, 0.1, 0.1, 0.003, 0.003, 0, 0);
462
463 gMC->Gstpar(idtmed[3000], "LOSS", 1.); // [3000] = air ACTIF [3010] = air INACTIF
464 gMC->Gstpar(idtmed[3000], "HADR", 1.);
465 gMC->Gstpar(idtmed[3000], "DCAY", 1.);
466 gMC->Gstpar(idtmed[3000], "DRAY", 1.);
467
468 gMC->Gstpar(idtmed[3001], "LOSS", 1.); // [3001] = carbon
469 gMC->Gstpar(idtmed[3001], "HADR", 1.);
470 gMC->Gstpar(idtmed[3001], "DCAY", 1.);
471 gMC->Gstpar(idtmed[3001], "DRAY", 1.);
472
473 gMC->Gstpar(idtmed[3002], "LOSS", 1.); // [3002] = quartz
474 gMC->Gstpar(idtmed[3002], "HADR", 1.);
475 gMC->Gstpar(idtmed[3002], "DCAY", 1.);
476 gMC->Gstpar(idtmed[3002], "DRAY", 1.);
477 gMC->Gstpar(idtmed[3002], "CUTGAM",0.5E-4) ;
478 gMC->Gstpar(idtmed[3002], "CUTELE",1.0E-4) ;
479
480 gMC->Gstpar(idtmed[3003], "LOSS", 1.); // [3003] = normal aluminum
481 gMC->Gstpar(idtmed[3003], "HADR", 1.);
482 gMC->Gstpar(idtmed[3003], "DCAY", 1.);
483 gMC->Gstpar(idtmed[3003], "DRAY", 1.);
484
485 gMC->Gstpar(idtmed[3004], "LOSS", 1.); // [3004] = reflecting aluminum
486 gMC->Gstpar(idtmed[3004], "HADR", 1.);
487 gMC->Gstpar(idtmed[3004], "DCAY", 1.);
488 gMC->Gstpar(idtmed[3004], "DRAY", 1.);
489 gMC->Gstpar(idtmed[3004], "CUTGAM",0.5E-4) ;
490 gMC->Gstpar(idtmed[3004], "CUTELE",1.0E-4) ;
491
492 gMC->Gstpar(idtmed[3005], "LOSS", 1.); // [3005] = scintillator
493 gMC->Gstpar(idtmed[3005], "HADR", 1.);
494 gMC->Gstpar(idtmed[3005], "DCAY", 1.);
495 gMC->Gstpar(idtmed[3005], "DRAY", 1.);
496 gMC->Gstpar(idtmed[3005], "CUTGAM",0.5E-4) ;
497 gMC->Gstpar(idtmed[3005], "CUTELE",1.0E-4) ;
498
499
500// geant3->Gsckov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
501// geant3->Gsckov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
502
503// gMC->SetCerenkov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
504// gMC->SetCerenkov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
505
506}
507
508//_____________________________________________________________________________
ba380e33 509void AliVZEROv5::DrawModule() const
f4f76f65 510{
511
512// Drawing is done in DrawVZERO.C
513
254ef8f1 514 AliDebug(2,"DrawModule");
f4f76f65 515}
516
517//_____________________________________________________________________________
518void AliVZEROv5::Init()
519{
520// Initialises version 2 of the VZERO Detector
521// Just prints an information message
522
254ef8f1 523 AliInfo(Form("VZERO version %d initialized \n",IsVersion()));
f4f76f65 524
525// gMC->SetMaxStep(fMaxStepAlu);
526// gMC->SetMaxStep(fMaxStepQua);
527
528 AliVZERO::Init();
529}
530
531//_____________________________________________________________________________
532void AliVZEROv5::StepManager()
533{
534
535// Step Manager, called at each step
536
537 Int_t copy;
538 static Int_t vol[4];
539 static Float_t hits[21];
540 static Float_t eloss, tlength;
541 static Int_t nPhotonsInStep;
542 static Int_t nPhotons;
543 static Int_t numStep;
544 Float_t ringNumber;
545 Float_t destep, step;
546
547 numStep += 1;
548
549// We keep only charged tracks :
550
551 if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
552
553 vol[0] = gMC->CurrentVolOffID(1, vol[1]);
554 vol[2] = gMC->CurrentVolID(copy);
555 vol[3] = copy;
556
d6fb41ac 557 static Int_t idV0R1 = gMC->VolId("V0R1");
558 static Int_t idV0L1 = gMC->VolId("V0L1");
559 static Int_t idV0R2 = gMC->VolId("V0R2");
560 static Int_t idV0L2 = gMC->VolId("V0L2");
561 static Int_t idV0R3 = gMC->VolId("V0R3");
562 static Int_t idV0L3 = gMC->VolId("V0L3");
563 static Int_t idV0R4 = gMC->VolId("V0R4");
564 static Int_t idV0L4 = gMC->VolId("V0L4");
565 static Int_t idV0R5 = gMC->VolId("V0R5");
566 static Int_t idV0R6 = gMC->VolId("V0R6");
567
568 if ( gMC->CurrentVolID(copy) == idV0R1 ||
569 gMC->CurrentVolID(copy) == idV0L1 )
f4f76f65 570 ringNumber = 1.0;
d6fb41ac 571 else if ( gMC->CurrentVolID(copy) == idV0R2 ||
572 gMC->CurrentVolID(copy) == idV0L2 )
f4f76f65 573 ringNumber = 2.0;
d6fb41ac 574 else if ( gMC->CurrentVolID(copy) == idV0R3 ||
575 gMC->CurrentVolID(copy) == idV0R4 ||
576 gMC->CurrentVolID(copy) == idV0L3 )
f4f76f65 577 ringNumber = 3.0;
d6fb41ac 578 else if ( gMC->CurrentVolID(copy) == idV0R5 ||
579 gMC->CurrentVolID(copy) == idV0R6 ||
580 gMC->CurrentVolID(copy) == idV0L4 )
f4f76f65 581 ringNumber = 4.0;
582 else
583 ringNumber = 0.0;
584
585 if ( ringNumber > 0.5 ) {
586
587 destep = gMC->Edep();
588 step = gMC->TrackStep();
589
590 nPhotonsInStep = Int_t(destep / (fLightYield *1e-9) );
591 nPhotonsInStep = gRandom->Poisson(nPhotonsInStep);
592
593 eloss += destep;
594 tlength += step;
595
596 if ( gMC->IsTrackEntering() ) {
597
598 nPhotons = nPhotonsInStep;
599 gMC->TrackPosition(fTrackPosition);
600 gMC->TrackMomentum(fTrackMomentum);
601
602 Float_t pt = TMath::Sqrt( fTrackMomentum.Px() * fTrackMomentum.Px() +
603 fTrackMomentum.Py() * fTrackMomentum.Py() );
604
605 hits[0] = fTrackPosition.X();
606 hits[1] = fTrackPosition.Y();
607 hits[2] = fTrackPosition.Z();
608 hits[3] = Float_t (gMC->TrackPid());
609
610 hits[4] = gMC->TrackTime();
611 hits[5] = gMC->TrackCharge();
612 hits[6] = fTrackMomentum.Theta()*TMath::RadToDeg();
613 hits[7] = fTrackMomentum.Phi()*TMath::RadToDeg();
614 hits[8] = ringNumber;
615
616 hits[9] = pt;
617 hits[10] = fTrackMomentum.P();
618 hits[11] = fTrackMomentum.Px();
619 hits[12] = fTrackMomentum.Py();
620 hits[13] = fTrackMomentum.Pz();
621
622 TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
623 hits[14] = par->Vx();
624 hits[15] = par->Vy();
625 hits[16] = par->Vz();
626
627 tlength = 0.0;
628 eloss = 0.0;
629 }
630
631 nPhotons = nPhotons + nPhotonsInStep;
632
633 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
634
635 nPhotons = nPhotons - Int_t((Float_t(nPhotons) * fLightAttenuation * fnMeters));
636 nPhotons = nPhotons - Int_t( Float_t(nPhotons) * fFibToPhot);
637
638 hits[17] = eloss;
639 hits[18] = tlength;
640 hits[19] = nPhotons;
641 hits[20] = GetCellId (vol, hits);
642
643 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
644
645 tlength = 0.0;
646 eloss = 0.0;
647 nPhotons = 0;
648 nPhotonsInStep = 0;
649
650 numStep = 0;
651 }
652 }
653
654}
655
656//_____________________________________________________________________________
657void AliVZEROv5::AddHit(Int_t track, Int_t *vol, Float_t *hits)
658{
659
660// Adds a VZERO hit
661
662 TClonesArray &lhits = *fHits;
663 new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
664}
665
666//_____________________________________________________________________________
667void AliVZEROv5::AddDigits(Int_t *tracks, Int_t* digits)
668{
669
670// Adds a VZERO digit
671
672 TClonesArray &ldigits = *fDigits;
673 new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
674}
675
676//_____________________________________________________________________________
677void AliVZEROv5::MakeBranch(Option_t *option)
678{
679
680// Creates new branches in the current Root Tree
681
682 char branchname[10];
683 sprintf(branchname,"%s",GetName());
254ef8f1 684 AliDebug(2,Form("fBufferSize = %d",fBufferSize));
f4f76f65 685
686 const char *cH = strstr(option,"H");
687
cb5b8b21 688 if (fHits && fLoader->TreeH() && cH) {
689 fLoader->TreeH()->Branch(branchname,&fHits, fBufferSize);
254ef8f1 690 AliDebug(2,Form("Making Branch %s for hits",branchname));
f4f76f65 691 }
692
693 const char *cD = strstr(option,"D");
694
695 if (fDigits && fLoader->TreeD() && cD) {
696 fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
254ef8f1 697 AliDebug(2,Form("Making Branch %s for digits",branchname));
f4f76f65 698 }
699
700}
701
702//_____________________________________________________________________________
703Int_t AliVZEROv5::GetCellId(Int_t *vol, Float_t *hits)
704{
705
706 // Returns Id of scintillator cell
707 // Right side from 0 to 47
708 // Left side from 48 to 95
709
710 // hits[8] = ring number (1 to 4)
711 // vol[1] = copy number (1 to 8)
712
713 Int_t index = vol[1];
714 Int_t RingNumber = Int_t(hits[8]);
715 fCellId = 0;
716
717// cout << "volID = " << vol[0] << " copy = " << vol[1] << endl;
718// cout << "X = " << hits[0] << " Y = " << hits[1] << endl;
719
720 Float_t phi = Float_t(TMath::ATan2(Double_t(hits[1]),Double_t(hits[0])) );
f4f76f65 721 phi = kRaddeg * phi;
722
723 if (index < 7) index = index + 8;
724
725 if (hits[2] < 0.0) {
726 if(RingNumber < 3) {
727 index = (index - 7) + ( ( RingNumber - 1 ) * 8);}
728 else if(RingNumber >= 3){
729 if(gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R3")||
730 gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R5") )
731 {index = (index*2 - 14) + ( ( RingNumber - 2 ) * 16); }
732 if(gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R4")||
733 gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R6") )
734 {index = (index*2 - 13) + ( ( RingNumber - 2 ) * 16); }
735 }
736 fCellId = index;
737 }
738
739 else if (hits[2] > 0.0){
740 index = (index - 7 + 48) + ( ( RingNumber - 1 ) * 8);
741 fCellId = index;}
742
743// cout << " ring = " << RingNumber << " phi = "<< phi << endl;
744// cout << " cellID = " << fCellId << endl;
745// cout << "**********" << endl;
746
747 return fCellId;
748
749
750}