1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //////////////////////////////////////////////////////////////////////
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 //
29 //////////////////////////////////////////////////////////////////////
31 // --- Standard libraries ---
32 #include <Riostream.h>
36 // --- ROOT libraries ---
37 #include <TClonesArray.h>
38 #include <TGeometry.h>
39 #include <TLorentzVector.h>
42 #include <TObjectTable.h>
45 #include <TVirtualMC.h>
46 #include <TParticle.h>
48 // --- AliRoot header files ---
53 #include "AliVZEROLoader.h"
54 #include "AliVZEROdigit.h"
55 #include "AliVZEROhit.h"
56 #include "AliVZEROv5.h"
61 //_____________________________________________________________________________
62 AliVZEROv5:: AliVZEROv5():AliVZERO(),
67 fLightAttenuation(0.05),
71 // Standard default constructor
74 //_____________________________________________________________________________
75 AliVZEROv5::AliVZEROv5(const char *name, const char *title):
81 fLightAttenuation(0.05),
86 // Standard constructor for V-zero Detector version 5
88 AliDebug(2,"Create VZERO object ");
90 // fLightYield = 93.75; // Light yield in BC408 (93.75 eV per photon)
91 // fLightAttenuation = 0.05; // Light attenuation in fiber (0.05 per meter)
92 // fnMeters = 15.0; // Number of meters of clear fibers to PM
93 // fFibToPhot = 0.3; // Attenuation at fiber-photocathode interface
96 //_____________________________________________________________________________
97 void AliVZEROv5::CreateGeometry()
100 // Creates the GEANT geometry of the V-zero Detector version 5
102 AliDebug(2,"Create Geometry ");
104 Int_t *idtmed = fIdtmed->GetArray()-2999;
114 Float_t height1Right, height2Right, height3Right, height4Right;
118 Float_t halfThickQua;
121 Float_t r0Right, r4Right, rBoxRight;
122 Float_t pi = TMath::Pi();
124 height1Right = 2.6; // height of cell 1, in cm
125 height2Right = 4.6; // height of cell 2, in cm
126 height3Right = 7.6; // height of cell 3, in cm
127 height4Right = 12.7; // height of cell 4, in cm
129 theta = pi/4.0/2.0; // half angular opening = 22.5 degrees
131 halfThickQua= fThickness1/2.0; // half thickness of elementary cell (inner ring)
133 // distance 0.6 cm in zdet accounts for the fact V0R box back lid sits 0.6 away from
134 // absorber nose sitting at 90 cm. Will use -zdet later...
135 // size of V0R box (fThickness) is increased by 3 mm as compared to basic version
137 fThickness = fThickness + 0.3; // now 4.7 cm instead of 4.4 cm
138 zdet = 90.0 - 0.6 - fThickness/2.0; // distance to vertex (along Z axis)
139 r0Right = 4.20; // closest distance to center of the beam pipe
140 heightRight = height1Right + height2Right + height3Right + height4Right;
141 r4Right = r0Right + heightRight + 0.3;
142 rBoxRight = 38.0; // external radius of right box
144 // Creation of mother volume v0LE - left part - :
145 // Entrance face at +339.0 cm (new coordinate system) ...
151 partube[2] = fThickness1/2.0;
153 gMC->Gsvolu("V0LE","TUBE",idtmed[3005],partube,3);
155 // Creation of five rings - left part - :
156 // Entrance face at +339.0 cm (new coordinate system) ...
158 // Mother volume v0L0 in which will be set 5 scintillator cells
162 Float_t r0Left = 4.3;
163 Float_t height1Left = 3.3;
164 Float_t height2Left = 6.2;
165 Float_t height3Left = 8.9;
166 Float_t height4Left = 20.9;
167 Float_t heightLeft = height1Left + height2Left + height3Left + height4Left;
169 Float_t r4Left = r0Left + heightLeft;
173 partubs[2] = fThickness1/2.0;
174 partubs[3] = 90.0-22.5;
175 partubs[4] = 135.0-22.5;
177 gMC->Gsvolu("V0L0","TUBS",idtmed[3010],partubs,5); // air volume
179 Float_t r1Left = r0Left + height1Left;
184 gMC->Gsvolu("V0L1","TUBS",idtmed[3005],partubs,5); // quartz volume
185 gMC->Gspos("V0L1",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
187 Float_t r2Left = r1Left + height2Left;
192 gMC->Gsvolu("V0L2","TUBS",idtmed[3005],partubs,5); // quartz volume
193 gMC->Gspos("V0L2",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
195 Float_t r3Left = r2Left + height3Left;
200 gMC->Gsvolu("V0L3","TUBS",idtmed[3005],partubs,5); // quartz volume
201 gMC->Gspos("V0L3",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
206 gMC->Gsvolu("V0L4","TUBS",idtmed[3005],partubs,5); // quartz volume
207 gMC->Gspos("V0L4",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
209 // Creation of mother volume v0RI - right part - :
211 partube[0] = r0Right - 0.2;
212 partube[1] = r4Right + 1.0;
213 partube[2] = fThickness/2.0;
215 gMC->Gsvolu("V0RI","TUBE",idtmed[3010],partube,3);
217 // Creation of carbon lids (3.0 mm thick) to keep v0RI box shut...
219 Float_t lidThickness = 0.30;
221 partube[0] = r0Right;
222 partube[1] = rBoxRight;
223 partube[2] = +lidThickness/2.0;
225 gMC->Gsvolu("V0CA","TUBE",idtmed[3001],partube,3);
226 gMC->Gspos("V0CA",1,"V0RI",0.0,0.0, fThickness/2.0-partube[2],0,"ONLY");
227 gMC->Gspos("V0CA",2,"V0RI",0.0,0.0,-fThickness/2.0+partube[2],0,"ONLY");
229 // Creation of aluminum rings 3.0 mm thick to maintain the v0RI pieces ...
231 partube[0] = r0Right;
232 partube[1] = r0Right + 0.3;
233 partube[2] = +fThickness/2.0;
235 gMC->Gsvolu("V0IR","TUBE",idtmed[3003],partube,3);
236 gMC->Gspos("V0IR",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
238 partube[0] = rBoxRight - 0.3;
239 partube[1] = rBoxRight;
240 partube[2] = +fThickness/2.0;
242 gMC->Gsvolu("V0ER","TUBE",idtmed[3003],partube,3);
243 gMC->Gspos("V0ER",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
245 // Mother volume v0R0 in which will be set 6 scintillator cells
247 partubs[0] = r0Right;
248 partubs[1] = r4Right;
249 partubs[2] = fThickness/2.0;
250 partubs[3] = 90.0-22.5;
251 partubs[4] = 135.0-22.5;
253 gMC->Gsvolu("V0R0","TUBS",idtmed[3010],partubs,5); // air volume
255 // Elementary cell of ring 1 :
256 // (cells of ring 1 will be shifted by 2.0 cm backwards to output fibers)
258 Float_t offsetFibers = 1.0;
259 Float_t offset = fThickness/2.0 - lidThickness - fThickness1/2.0;
260 Float_t r1Right = r0Right + 0.3 + height1Right;
262 partubs[0] = r0Right + 0.3;
263 partubs[1] = r1Right;
264 partubs[2] = fThickness1/2.0;
266 gMC->Gsvolu("V0R1","TUBS",idtmed[3005],partubs,5); // scintillator volume
267 gMC->Gspos("V0R1",1,"V0R0", 0.0, 0.0 , -offset, 0,"ONLY");
269 // Elementary cell of ring 2 :
270 // (cells of ring 2 will be shifted by 1.0 cm backwards to output fibers)
272 Float_t r2Right = r1Right + height2Right;
274 partubs[0] = r1Right;
275 partubs[1] = r2Right;
277 gMC->Gsvolu("V0R2","TUBS",idtmed[3005],partubs,5); // scintillator volume
278 gMC->Gspos("V0R2",1,"V0R0", 0.0, 0.0 , -offset + offsetFibers, 0,"ONLY");
280 // Elementary cell of ring 3 :
282 Float_t r3Right = r2Right + height3Right;
284 partubs[0] = r2Right;
285 partubs[1] = r3Right;
286 partubs[3] = 90.0-22.5;
287 partubs[4] = 112.5-22.5;
289 gMC->Gsvolu("V0R3","TUBS",idtmed[3005],partubs,5); // scintillator volume
290 gMC->Gspos("V0R3",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
292 partubs[3] = 112.5-22.5;
293 partubs[4] = 135.0-22.5;
294 gMC->Gsvolu("V0R4","TUBS",idtmed[3005],partubs,5); // scintillator volume
295 gMC->Gspos("V0R4",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
297 // Elementary cell of ring 4 :
299 partubs[0] = r3Right;
300 partubs[1] = r4Right;
301 partubs[3] = 90.0-22.5;
302 partubs[4] = 112.5-22.5;
304 gMC->Gsvolu("V0R5","TUBS",idtmed[3005],partubs,5); // scintillator volume
305 gMC->Gspos("V0R5",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
307 partubs[3] = 112.5-22.5;
308 partubs[4] = 135.0-22.5;
309 gMC->Gsvolu("V0R6","TUBS",idtmed[3005],partubs,5); // scintillator volume
310 gMC->Gspos("V0R6",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
312 Float_t phiDeg = 180./4.;
316 for(Float_t phi = 22.5; phi < 360.0; phi = phi + phiDeg)
318 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
319 gMC->Gspos("V0R0",ndetR,"V0RI",0.0,
320 0.0,0.0,idrotm[902],"ONLY");
324 gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,-zdet,0,"ONLY");
326 ncellsR = (ndetR - 1) * 6;
327 AliInfo(Form("Number of cells on Right side = %d\n", ncellsR));
331 for(Float_t phi = 22.5; phi < 360.0; phi = phi + phiDeg)
333 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
334 gMC->Gspos("V0L0",ndetL,"V0LE",0.0,
335 0.0,0.0,idrotm[902],"ONLY");
339 gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,339.0+fThickness1/2.0,0,"ONLY");
341 ncellsL = (ndetL - 1) * 4;
342 AliInfo(Form("Number of cells on Left side = %d\n", ncellsL));
346 //_____________________________________________________________________________
347 void AliVZEROv5::CreateMaterials()
350 // Creates materials used for geometry
352 AliDebug(2,"Create materials");
355 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,
356 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
359 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,
360 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
362 Float_t rindex_quarz[14] = { 1.52398, 1.53090, 1.53835, 1.54641, 1.55513, 1.56458,
363 1.57488, 1.58611, 1.59842, 1.61197, 1.62696, 1.64362,
366 Float_t absco_quarz[14] = { 105.8, 45.656, 35.665, 28.598, 25.007, 21.04, 17.525,
367 14.177, 9.282, 4.0925, 1.149, 0.3627, 0.1497, 0.05 };
369 Float_t effic_all[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
372 Float_t rindex_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
375 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,
376 1e-4,1e-4,1e-4,1e-4 };
377 Float_t effic_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
381 Int_t *idtmed = fIdtmed->GetArray()-2999;
384 // Parameters related to Quarz (SiO2) :
386 Float_t aqua[2], zqua[2], densqua, wmatqua[2];
398 // Parameters related to aluminum sheets :
405 // Parameters related to scintillator CH :
407 Float_t ascin[2] = {1.00794,12.011};
408 Float_t zscin[2] = {1.,6.};
409 Float_t wscin[2] = {1.,1.};
410 Float_t denscin = 1.032;
414 Float_t aAir[4]={12.,14.,16.,36.};
415 Float_t zAir[4]={6.,7.,8.,18.};
416 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
417 Float_t dAir = 1.20479E-3;
419 // Definition of materials :
421 AliMixture( 1, "AIR A$", aAir,zAir,dAir,4,wAir);
422 AliMixture(11, "AIR I$", aAir,zAir,dAir,4,wAir);
423 AliMaterial( 2, "CARBON$" , 12.01, 6.0, 2.265, 18.8, 49.9, 0, 0);
424 AliMixture( 3, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
425 AliMaterial( 4, "ALUMINIUM1$", 26.98, 13., 2.7, 8.9, 37.2, 0, 0);
426 AliMaterial( 5, "ALUMINIUM2$", aal, zal, densal, radlal, 0, 0, 0);
428 AliMixture( 6, "Scintillator$",ascin,zscin,denscin,-2,wscin);
431 Int_t iSXFLD = gAlice->Field()->Integ();
432 Float_t sXMGMX = gAlice->Field()->Max();
434 Float_t tmaxfd, stemax, deemax, epsil, stmin;
443 AliMedium(1, "ACTIVE AIR$", 1, 1, iSXFLD, sXMGMX,
444 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
448 AliMedium(11, "INACTIVE AIR$", 11, 0, iSXFLD, sXMGMX,
449 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
451 AliMedium(2, "CARBON$ ", 2, 1, iSXFLD, sXMGMX,
452 tmaxfd, stemax, deemax, epsil, stmin, 0, 0);
454 AliMedium(3, "QUARZ$", 3, 1, iSXFLD, sXMGMX,
455 tmaxfd, fMaxStepQua, fMaxDestepQua, epsil, stmin, 0, 0);
457 AliMedium(4,"ALUMINUM1$",4, 1, iSXFLD, sXMGMX,
458 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
461 AliMedium(5,"ALUMINUM2$",5, 1, iSXFLD, sXMGMX,
462 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
464 AliMedium(6,"SCINTILLATOR$",6, 1, iSXFLD, sXMGMX, 10.0, 0.1, 0.1, 0.003, 0.003, 0, 0);
466 gMC->Gstpar(idtmed[3000], "LOSS", 1.); // [3000] = air ACTIF [3010] = air INACTIF
467 gMC->Gstpar(idtmed[3000], "HADR", 1.);
468 gMC->Gstpar(idtmed[3000], "DCAY", 1.);
469 gMC->Gstpar(idtmed[3000], "DRAY", 1.);
471 gMC->Gstpar(idtmed[3001], "LOSS", 1.); // [3001] = carbon
472 gMC->Gstpar(idtmed[3001], "HADR", 1.);
473 gMC->Gstpar(idtmed[3001], "DCAY", 1.);
474 gMC->Gstpar(idtmed[3001], "DRAY", 1.);
476 gMC->Gstpar(idtmed[3002], "LOSS", 1.); // [3002] = quartz
477 gMC->Gstpar(idtmed[3002], "HADR", 1.);
478 gMC->Gstpar(idtmed[3002], "DCAY", 1.);
479 gMC->Gstpar(idtmed[3002], "DRAY", 1.);
480 gMC->Gstpar(idtmed[3002], "CUTGAM",0.5E-4) ;
481 gMC->Gstpar(idtmed[3002], "CUTELE",1.0E-4) ;
483 gMC->Gstpar(idtmed[3003], "LOSS", 1.); // [3003] = normal aluminum
484 gMC->Gstpar(idtmed[3003], "HADR", 1.);
485 gMC->Gstpar(idtmed[3003], "DCAY", 1.);
486 gMC->Gstpar(idtmed[3003], "DRAY", 1.);
488 gMC->Gstpar(idtmed[3004], "LOSS", 1.); // [3004] = reflecting aluminum
489 gMC->Gstpar(idtmed[3004], "HADR", 1.);
490 gMC->Gstpar(idtmed[3004], "DCAY", 1.);
491 gMC->Gstpar(idtmed[3004], "DRAY", 1.);
492 gMC->Gstpar(idtmed[3004], "CUTGAM",0.5E-4) ;
493 gMC->Gstpar(idtmed[3004], "CUTELE",1.0E-4) ;
495 gMC->Gstpar(idtmed[3005], "LOSS", 1.); // [3005] = scintillator
496 gMC->Gstpar(idtmed[3005], "HADR", 1.);
497 gMC->Gstpar(idtmed[3005], "DCAY", 1.);
498 gMC->Gstpar(idtmed[3005], "DRAY", 1.);
499 gMC->Gstpar(idtmed[3005], "CUTGAM",0.5E-4) ;
500 gMC->Gstpar(idtmed[3005], "CUTELE",1.0E-4) ;
503 // geant3->Gsckov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
504 // geant3->Gsckov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
506 // gMC->SetCerenkov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
507 // gMC->SetCerenkov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
511 //_____________________________________________________________________________
512 void AliVZEROv5::DrawModule() const
515 // Drawing is done in DrawVZERO.C
517 AliDebug(2,"DrawModule");
520 //_____________________________________________________________________________
521 void AliVZEROv5::Init()
523 // Initialises version 2 of the VZERO Detector
524 // Just prints an information message
526 AliInfo(Form("VZERO version %d initialized \n",IsVersion()));
528 // gMC->SetMaxStep(fMaxStepAlu);
529 // gMC->SetMaxStep(fMaxStepQua);
534 //_____________________________________________________________________________
535 void AliVZEROv5::StepManager()
538 // Step Manager, called at each step
542 static Float_t hits[21];
543 static Float_t eloss, tlength;
544 static Int_t nPhotonsInStep;
545 static Int_t nPhotons;
546 static Int_t numStep;
548 Float_t destep, step;
552 // We keep only charged tracks :
554 if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
556 vol[0] = gMC->CurrentVolOffID(1, vol[1]);
557 vol[2] = gMC->CurrentVolID(copy);
560 static Int_t idV0R1 = gMC->VolId("V0R1");
561 static Int_t idV0L1 = gMC->VolId("V0L1");
562 static Int_t idV0R2 = gMC->VolId("V0R2");
563 static Int_t idV0L2 = gMC->VolId("V0L2");
564 static Int_t idV0R3 = gMC->VolId("V0R3");
565 static Int_t idV0L3 = gMC->VolId("V0L3");
566 static Int_t idV0R4 = gMC->VolId("V0R4");
567 static Int_t idV0L4 = gMC->VolId("V0L4");
568 static Int_t idV0R5 = gMC->VolId("V0R5");
569 static Int_t idV0R6 = gMC->VolId("V0R6");
571 if ( gMC->CurrentVolID(copy) == idV0R1 ||
572 gMC->CurrentVolID(copy) == idV0L1 )
574 else if ( gMC->CurrentVolID(copy) == idV0R2 ||
575 gMC->CurrentVolID(copy) == idV0L2 )
577 else if ( gMC->CurrentVolID(copy) == idV0R3 ||
578 gMC->CurrentVolID(copy) == idV0R4 ||
579 gMC->CurrentVolID(copy) == idV0L3 )
581 else if ( gMC->CurrentVolID(copy) == idV0R5 ||
582 gMC->CurrentVolID(copy) == idV0R6 ||
583 gMC->CurrentVolID(copy) == idV0L4 )
588 if ( ringNumber > 0.5 ) {
590 destep = gMC->Edep();
591 step = gMC->TrackStep();
593 nPhotonsInStep = Int_t(destep / (fLightYield *1e-9) );
594 nPhotonsInStep = gRandom->Poisson(nPhotonsInStep);
599 if ( gMC->IsTrackEntering() ) {
601 nPhotons = nPhotonsInStep;
602 gMC->TrackPosition(fTrackPosition);
603 gMC->TrackMomentum(fTrackMomentum);
605 Float_t pt = TMath::Sqrt( fTrackMomentum.Px() * fTrackMomentum.Px() +
606 fTrackMomentum.Py() * fTrackMomentum.Py() );
608 hits[0] = fTrackPosition.X();
609 hits[1] = fTrackPosition.Y();
610 hits[2] = fTrackPosition.Z();
611 hits[3] = Float_t (gMC->TrackPid());
613 hits[4] = gMC->TrackTime();
614 hits[5] = gMC->TrackCharge();
615 hits[6] = fTrackMomentum.Theta()*TMath::RadToDeg();
616 hits[7] = fTrackMomentum.Phi()*TMath::RadToDeg();
617 hits[8] = ringNumber;
620 hits[10] = fTrackMomentum.P();
621 hits[11] = fTrackMomentum.Px();
622 hits[12] = fTrackMomentum.Py();
623 hits[13] = fTrackMomentum.Pz();
625 TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
626 hits[14] = par->Vx();
627 hits[15] = par->Vy();
628 hits[16] = par->Vz();
634 nPhotons = nPhotons + nPhotonsInStep;
636 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
638 nPhotons = nPhotons - Int_t((Float_t(nPhotons) * fLightAttenuation * fnMeters));
639 nPhotons = nPhotons - Int_t( Float_t(nPhotons) * fFibToPhot);
644 hits[20] = GetCellId (vol, hits);
646 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
659 //_____________________________________________________________________________
660 void AliVZEROv5::AddHit(Int_t track, Int_t *vol, Float_t *hits)
665 TClonesArray &lhits = *fHits;
666 new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
669 //_____________________________________________________________________________
670 void AliVZEROv5::AddDigits(Int_t *tracks, Int_t* digits)
673 // Adds a VZERO digit
675 TClonesArray &ldigits = *fDigits;
676 new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
679 //_____________________________________________________________________________
680 void AliVZEROv5::MakeBranch(Option_t *option)
683 // Creates new branches in the current Root Tree
686 sprintf(branchname,"%s",GetName());
687 AliDebug(2,Form("fBufferSize = %d",fBufferSize));
689 const char *cH = strstr(option,"H");
691 if (fHits && fLoader->TreeH() && cH) {
692 fLoader->TreeH()->Branch(branchname,&fHits, fBufferSize);
693 AliDebug(2,Form("Making Branch %s for hits",branchname));
696 const char *cD = strstr(option,"D");
698 if (fDigits && fLoader->TreeD() && cD) {
699 fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
700 AliDebug(2,Form("Making Branch %s for digits",branchname));
705 //_____________________________________________________________________________
706 Int_t AliVZEROv5::GetCellId(Int_t *vol, Float_t *hits)
709 // Returns Id of scintillator cell
710 // Right side from 0 to 47
711 // Left side from 48 to 95
713 // hits[8] = ring number (1 to 4)
714 // vol[1] = copy number (1 to 8)
716 Int_t index = vol[1];
717 Int_t RingNumber = Int_t(hits[8]);
720 // cout << "volID = " << vol[0] << " copy = " << vol[1] << endl;
721 // cout << "X = " << hits[0] << " Y = " << hits[1] << endl;
723 Float_t phi = Float_t(TMath::ATan2(Double_t(hits[1]),Double_t(hits[0])) );
726 if (index < 7) index = index + 8;
730 index = (index - 7) + ( ( RingNumber - 1 ) * 8);}
731 else if(RingNumber >= 3){
732 if(gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R3")||
733 gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R5") )
734 {index = (index*2 - 14) + ( ( RingNumber - 2 ) * 16); }
735 if(gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R4")||
736 gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R6") )
737 {index = (index*2 - 13) + ( ( RingNumber - 2 ) * 16); }
742 else if (hits[2] > 0.0){
743 index = (index - 7 + 48) + ( ( RingNumber - 1 ) * 8);
746 // cout << " ring = " << RingNumber << " phi = "<< phi << endl;
747 // cout << " cellID = " << fCellId << endl;
748 // cout << "**********" << endl;