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