]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROv6.cxx
No local geometry export (B.Cheynis)
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv6.cxx
CommitLineData
c985a636 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 6 as designed by the Lyon group //
21// All comments should be sent to Brigitte CHEYNIS : //
22// b.cheynis@ipnl.in2p3.fr //
23// Geometry of september 2005 done with ROOT geometrical modeler // //
24// V0R (now V0C) sits between Z values -89.5 and -84.8 cm //
25// V0L (now V0A) sits between Z values +339.0 and +341.0 cm //
26// New coordinate system has been implemented in october 2003 //
27// //
28//////////////////////////////////////////////////////////////////////
29
30// --- Standard libraries ---
31#include <Riostream.h>
32#include <stdlib.h>
33#include <string.h>
34
35// --- ROOT libraries ---
36#include <TClonesArray.h>
37#include <TGeometry.h>
38#include <TLorentzVector.h>
39#include <TMath.h>
40#include <TNode.h>
41#include <TObjectTable.h>
42#include <TVirtualMC.h>
43#include <TParticle.h>
44
45#include <TGeoManager.h>
46#include <TGeoMaterial.h>
47#include <TGeoMedium.h>
48#include <TGeoNode.h>
49#include <TGeoVolume.h>
50#include "TGeoTube.h"
51#include "TGeoMatrix.h"
52
53// --- AliRoot header files ---
54#include "AliRun.h"
55#include "AliMC.h"
56#include "AliConst.h"
57#include "AliMagF.h"
58#include "AliVZEROLoader.h"
59#include "AliVZEROdigit.h"
60#include "AliVZEROhit.h"
61#include "AliVZEROv6.h"
62#include "AliLog.h"
63
64ClassImp(AliVZEROv6)
65
66//_____________________________________________________________________________
67AliVZEROv6:: AliVZEROv6():AliVZERO()
68{
69// Standard default constructor
70}
71
72//_____________________________________________________________________________
73AliVZEROv6::AliVZEROv6(const char *name, const char *title):
74 AliVZERO(name,title)
75{
76
77// Standard constructor for V-zero Detector version 6
78
79 AliDebug(2,"Create VZERO object ");
80
81 fVersion = 6; // version number
82
83// Parameters related to geometry :
84// V0 part in front of muon arm absorber
85
86 fV0CHeight1 = 2.5; // height of cell 1, in cm
87 fV0CHeight2 = 4.4; // height of cell 2, in cm
88 fV0CHeight3 = 7.4; // height of cell 3, in cm
89 fV0CHeight4 = 12.5; // height of cell 4, in cm
90 fV0CRMin = 4.6;
91 fV0CRBox = 38.0; // outer radius of box, in cm
92 fV0CLidThickness = 0.30; // thickness of Carbon lid
93 fV0CCellThickness = 2.00; // thickness of elementary cell
94 fV0CBoxThickness = 4.70; // thickness of V0C Box
95 fV0COffsetFibers = 1.0; // offset to output fibers, in cm
96
97// V0 part on the other side with respect to Interaction Point
98
99 fV0AHeight1 = 3.3; // height of cell 1, in cm
100 fV0AHeight2 = 6.2; // height of cell 2, in cm
101 fV0AHeight3 = 8.9; // height of cell 3, in cm
102 fV0AHeight4 = 20.9; // height of cell 4, in cm
103 fV0ARMin = 4.30;
104 fV0ACellThickness = 2.00; // thickness of elementary cell
105
106// Parameters related to light output :
107
108 fLightYield = 93.75; // Light yield in BC408 (93.75 eV per photon)
109 fLightAttenuation = 0.05; // Light attenuation in fiber (0.05 per meter)
110 fnMeters = 15.0; // Number of meters of clear fibers to PM
111 fFibToPhot = 0.3; // Attenuation at fiber-photocathode interface
112}
113
114//_____________________________________________________________________________
115
116void AliVZEROv6::BuildGeometry()
117{
118
119}
120
121//_____________________________________________________________________________
122void AliVZEROv6::CreateGeometry()
123{
124
125// Constructs TGeo geometry
126
127 const int kColorVZERO = kGreen;
128
129 AliDebug(2,"VZERO ConstructGeometry");
130
54aa7396 131// TGeoMedium *medAir = gGeoManager->GetMedium("VZERO_Air");
c985a636 132 TGeoMedium *medAlu = gGeoManager->GetMedium("VZERO_Aluminum");
133 TGeoMedium *medCar = gGeoManager->GetMedium("VZERO_Carbon");
134 TGeoMedium *medSci = gGeoManager->GetMedium("VZERO_Scintillator");
135
136 TGeoVolume *top = gGeoManager->GetVolume("ALIC");
137
c985a636 138 Float_t heightRight, r4Right;
139
140 Float_t zdet = 90.0 - 0.5 - fV0CBoxThickness/2.0;
141 heightRight = fV0CHeight1 + fV0CHeight2 + fV0CHeight3 + fV0CHeight4;
142 r4Right = fV0CRMin + heightRight + 3.0*0.2; // 3 spacings of 2mm between rings
c985a636 143
54aa7396 144// Creation of assembly V0RI - right part - :
c985a636 145
54aa7396 146 TGeoVolume *v0RI = new TGeoVolumeAssembly("V0RI");
c985a636 147 TGeoTranslation *tr1 = new TGeoTranslation(0.,0.,-zdet);
148 top->AddNode(v0RI,1,tr1);
c985a636 149
150// Creation of carbon lids (3.0 mm thick) to keep V0C box shut :
54aa7396 151
152 Float_t partube[3];
c985a636 153
154 partube[0] = fV0CRMin;
155 partube[1] = fV0CRBox;
156 partube[2] = fV0CLidThickness/2.0;
157
158 TGeoTube *sV0CA = new TGeoTube("V0CA", partube[0], partube[1], partube[2]);
159 TGeoVolume *v0CA = new TGeoVolume("V0CA",sV0CA,medCar);
160 TGeoTranslation *tr2 = new TGeoTranslation(0.,0., fV0CBoxThickness/2.0-partube[2]);
161 TGeoTranslation *tr3 = new TGeoTranslation(0.,0.,-fV0CBoxThickness/2.0+partube[2]);
162 v0RI->AddNode(v0CA,1,tr2);
163 v0RI->AddNode(v0CA,2,tr3);
164 v0CA->SetLineColor(kYellow);
165
166// Creation of aluminum rings 3.0 mm thick to maintain the v0RI pieces :
167
168 partube[0] = fV0CRMin - 0.3;
169 partube[1] = fV0CRMin;
170 partube[2] = fV0CBoxThickness/2.0;
171
172 TGeoTube *sV0IR = new TGeoTube("V0IR", partube[0], partube[1], partube[2]);
173 TGeoVolume *v0IR = new TGeoVolume("V0IR",sV0IR,medAlu);
174 v0RI->AddNode(v0IR,1,0);
175 v0IR->SetLineColor(kYellow);
176
177 partube[0] = fV0CRBox;
178 partube[1] = fV0CRBox + 0.3;
179 partube[2] = fV0CBoxThickness/2.0;
180
181 TGeoTube *sV0ER = new TGeoTube("V0ER", partube[0], partube[1], partube[2]);
182 TGeoVolume *v0ER = new TGeoVolume("V0ER",sV0ER,medAlu);
183 v0RI->AddNode(v0ER,1,0);
184 v0ER->SetLineColor(kYellow);
185
54aa7396 186// Creation of assembly V0R0 of scintillator cells within one sector
c985a636 187
54aa7396 188 TGeoVolume *v0R0 = new TGeoVolumeAssembly("V0R0");
c985a636 189
190// Elementary cell of ring 1 - right part - :
191// (cells of ring 1 will be shifted by 2.0 cm backwards to output fibers)
192
193 Float_t r1Right = fV0CRMin + fV0CHeight1;
54aa7396 194 Float_t offset = fV0CBoxThickness/2.0 - fV0CLidThickness - fV0CCellThickness/2.0;
195
196 Float_t partubs[5];
197
c985a636 198 partubs[0] = fV0CRMin;
199 partubs[1] = r1Right;
200 partubs[2] = fV0CCellThickness/2.0;
54aa7396 201 partubs[3] = 90.0-22.5;
202 partubs[4] = 135.0-22.5;
203
c985a636 204 TGeoTubeSeg *sV0R1 = new TGeoTubeSeg("V0R1", partubs[0], partubs[1], partubs[2],
205 partubs[3], partubs[4]);
206 TGeoVolume *v0R1 = new TGeoVolume("V0R1",sV0R1,medSci);
207 TGeoTranslation *tr4 = new TGeoTranslation(0.,0.,-offset);
208 v0R0->AddNode(v0R1,1,tr4);
209 v0R1->SetLineColor(kColorVZERO);
210
211// Elementary cell of ring 2 - right part - :
212// (cells of ring 2 will be shifted by 1.0 cm backwards to output fibers)
213
214 Float_t r2Right = r1Right + fV0CHeight2;
215
216 partubs[0] = r1Right; // must be equal to 7.1
217 partubs[1] = r2Right; // must be equal to 11.5
218 TGeoTubeSeg *sV0R2 = new TGeoTubeSeg("V0R2", partubs[0], partubs[1], partubs[2],
219 partubs[3], partubs[4]);
220 TGeoVolume *v0R2 = new TGeoVolume("V0R2",sV0R2,medSci);
221 TGeoTranslation *tr5 = new TGeoTranslation(0.0,0.2,-offset + fV0COffsetFibers);
222 v0R0->AddNode(v0R2,1,tr5);
223 v0R2->SetLineColor(kColorVZERO);
224
225// Ring 3 - right part - :
226
227// Float_t x = TMath::ATan(1.0/156.0) * ((180./TMath::Pi()));
228
229 r2Right = r2Right + 0.2;
230 Float_t r3Right = r2Right + fV0CHeight3;
54aa7396 231// printf(" r2 = %f, r3 = %f \n\n", r2Right,r3Right);
c985a636 232
233 partubs[0] = r2Right; // must be equal to 11.7
234 partubs[1] = r3Right; // must be equal to 19.1
235 partubs[3] = 90.0-22.5;
236 partubs[4] = 112.5-22.5;
237
238 TGeoTubeSeg *sV0R3 = new TGeoTubeSeg("V0R3", partubs[0], partubs[1], partubs[2],
239 partubs[3], partubs[4]);
240 TGeoVolume *v0R3 = new TGeoVolume("V0R3",sV0R3,medSci);
241 TGeoTranslation *tr6 = new TGeoTranslation(0.,0.2,-offset + 2.0*fV0COffsetFibers);
242 v0R0->AddNode(v0R3,1,tr6);
243 v0R3->SetLineColor(kColorVZERO);
244
245 partubs[3] = 112.5-22.5;
246 partubs[4] = 135.0-22.5;
247
248 TGeoTubeSeg *sV0R4 = new TGeoTubeSeg("V0R4", partubs[0], partubs[1], partubs[2],
249 partubs[3], partubs[4]);
250 TGeoVolume *v0R4 = new TGeoVolume("V0R4",sV0R4,medSci);
251 v0R0->AddNode(v0R4,1,tr6);
252 v0R4->SetLineColor(kColorVZERO);
253
254// Ring 4 - right part - :
255
256 Float_t x = TMath::ATan(3.5/257.5) * ((180./TMath::Pi()));
257 r3Right = r3Right + 0.2 + 0.2; // + 0.2 because no shift in translation here !!
258
259 partubs[0] = r3Right; // must be equal to 19.5
260 partubs[1] = r4Right; // must be equal to 32.0
261 partubs[3] = 90.0-22.5+x;
262 partubs[4] = 112.5-22.5-x;
263
264 TGeoTubeSeg *sV0R5 = new TGeoTubeSeg("V0R5", partubs[0], partubs[1], partubs[2],
265 partubs[3], partubs[4]);
266 TGeoVolume *v0R5 = new TGeoVolume("V0R5",sV0R5,medSci);
267 TGeoTranslation *tr7 = new TGeoTranslation(0.,0.0,-offset + 2.0*fV0COffsetFibers);
268 v0R0->AddNode(v0R5,1,tr7);
269 v0R5->SetLineColor(kColorVZERO);
270
271 partubs[3] = 112.5-22.5+x;
272 partubs[4] = 135.0-22.5-x;
273
274 TGeoTubeSeg *sV0R6 = new TGeoTubeSeg("V0R6", partubs[0], partubs[1], partubs[2],
275 partubs[3], partubs[4]);
276 TGeoVolume *v0R6 = new TGeoVolume("V0R6",sV0R6,medSci);
277 v0R0->AddNode(v0R6,1,tr7);
278 v0R6->SetLineColor(kColorVZERO);
279
280 Float_t phi;
281 Float_t phiDeg= 180./4.;
282
283 Int_t nsecR = 1; // number of sectors in right part of V0
284 Int_t ncellsR; // number of scintillating cells
285
286 for (phi = 22.5; phi < 360.0; phi = phi + phiDeg)
287
288 {
289 TGeoRotation *rot1 = new TGeoRotation("rot1", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );
290
291 v0RI->AddNode(v0R0,nsecR,rot1);
292 nsecR++;
293 }
294
295 ncellsR = (nsecR - 1) * 6; // 6 cells per sector (2 cells in ring 3 and 4)
296 AliInfo(Form("Number of cells on Right side - V0C = %d", ncellsR));
297
54aa7396 298// Creation of assembly v0LE - left part - :
c985a636 299// Entrance face at +339.0 cm (new coordinate system) ...
300
301 Float_t heightLeft = fV0AHeight1 + fV0AHeight2 + fV0AHeight3 + fV0AHeight4;
302 Float_t r4Left = fV0ARMin + heightLeft;
54aa7396 303
304 TGeoVolume *v0LE = new TGeoVolumeAssembly("V0LE");
305
c985a636 306 TGeoTranslation *tr8 = new TGeoTranslation(0.,0.,339.0 + fV0ACellThickness/2.0);
307 top->AddNode(v0LE,1,tr8);
54aa7396 308
309// Creation of assembly V0L0 of scintillator cells within one sector
310
311 TGeoVolume *v0L0 = new TGeoVolumeAssembly("V0L0");
c985a636 312
313 Float_t offsetLeft;
314 offsetLeft = - fV0ACellThickness/2.0;
315
316 Float_t r1Left = fV0ARMin + fV0AHeight1;
317
318 partubs[0] = fV0ARMin;
319 partubs[1] = r1Left;
54aa7396 320 partubs[2] = fV0ACellThickness/2.0;
321 partubs[3] = 90.0-22.5;
322 partubs[4] = 135.0-22.5;
323
c985a636 324 TGeoTubeSeg *sV0L1 = new TGeoTubeSeg("V0L1", partubs[0], partubs[1], partubs[2],
325 partubs[3], partubs[4]);
326 TGeoVolume *v0L1 = new TGeoVolume("V0L1",sV0L1,medSci);
327 v0L0->AddNode(v0L1,1,gGeoIdentity);
328 v0L1->SetLineColor(kColorVZERO);
329 v0L1->SetVisibility(kTRUE);
330
331 Float_t r2Left = r1Left + fV0AHeight2;
332
333 partubs[0] = r1Left;
334 partubs[1] = r2Left;
335
336 TGeoTubeSeg *sV0L2 = new TGeoTubeSeg("V0L2", partubs[0], partubs[1], partubs[2],
337 partubs[3], partubs[4]);
338 TGeoVolume *v0L2 = new TGeoVolume("V0L2",sV0L2,medSci);
339 v0L0->AddNode(v0L2,1,gGeoIdentity);
340 v0L2->SetLineColor(kColorVZERO);
341 v0L2->SetVisibility(kTRUE);
342
343 Float_t r3Left = r2Left + fV0AHeight3;
344
345 partubs[0] = r2Left;
346 partubs[1] = r3Left;
347
348 TGeoTubeSeg *sV0L3 = new TGeoTubeSeg("V0L3", partubs[0], partubs[1], partubs[2],
349 partubs[3], partubs[4]);
350 TGeoVolume *v0L3 = new TGeoVolume("V0L3",sV0L3,medSci);
351 v0L0->AddNode(v0L3,1,gGeoIdentity);
352 v0L3->SetLineColor(kColorVZERO);
353 v0L3->SetVisibility(kTRUE);
354
355 partubs[0] = r3Left;
356 partubs[1] = r4Left;
357
358 TGeoTubeSeg *sV0L4 = new TGeoTubeSeg("V0L4", partubs[0], partubs[1], partubs[2],
359 partubs[3], partubs[4]);
360 TGeoVolume *v0L4 = new TGeoVolume("V0L4",sV0L4,medSci);
361 v0L0->AddNode(v0L4,1,gGeoIdentity);
362 v0L4->SetLineColor(kColorVZERO);
363 v0L4->SetVisibility(kTRUE);
364
365 Int_t nsecL = 1; // number of sectors in left part of V0
366 Int_t ncellsL; // number of scintillating cells
367
368 for (phi = 22.5; phi < 360.0; phi = phi + phiDeg)
369
370 {
371 TGeoRotation *rot1 = new TGeoRotation("rot1", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );
372 v0LE->AddNode(v0L0,nsecL,rot1);
373 nsecL++;
374 }
375
376 ncellsL = (nsecL - 1) * 4; // 4 cells per sector
377 AliInfo(Form("Number of cells on Left side - V0A = %d\n", ncellsL));
16056ba5 378
379 gGeoManager->SetTopVolume(top);
c985a636 380 gGeoManager->CloseGeometry();
381// gGeoManager-> SetVisLevel(4);
c985a636 382}
383
384//_____________________________________________________________________________
385void AliVZEROv6::CreateMaterials()
386{
387
388// Creates materials used for geometry
389
390 AliDebug(2,"Create materials");
391
392// Int_t *idtmed = fIdtmed->GetArray()-2999;
393
394 Int_t fieldType = gAlice->Field()->Integ(); // Field type
54aa7396 395 Double_t maxField = gAlice->Field()->Max(); // Field max.
c985a636 396 Double_t maxBending = 0; // Max Angle
397 Double_t maxStepSize = 0.001; // Max step size
398 Double_t maxEnergyLoss = 1; // Max Delta E
399 Double_t precision = 0.001; // Precision
400 Double_t minStepSize = 0.001; // Minimum step size
401 Int_t id;
402 Double_t a, z, density, radLength, absLength;
403 Float_t tmaxfd, stemax, deemax, epsil, stmin;
404
405 a = 0.0; z = 0.0;
54aa7396 406 density = 0.0;
407 radLength = 0.0;
408 absLength = 999.0;
409 tmaxfd = 10.;
410 stemax = 0.1;
411 deemax = 0.1;
412 epsil = 0.001;
413 stmin = 0.001;
c985a636 414
415// Parameters for Air (= 0.01% C + 75% N + 23% O + 1% Ar )
416
417 Float_t aa[] = { 12.0107, 14.0067, 15.9994, 39.948 };
418 Float_t za[] = { 6., 7., 8., 18. };
419 Float_t wa[] = { 0.000124, 0.755267, 0.231781, 0.012827 };
420 density = 0.00120479;
421 maxBending = 1;
422 maxStepSize = .001;
423 precision = .001;
424 minStepSize = .001;
425 id = 1;
426 AliMixture(id, "Air", aa, za, density, 4, wa);
427 AliMedium(id, "Air", id, 1, fieldType, maxField, maxBending,
428 maxStepSize, maxEnergyLoss, precision, minStepSize);
429
430// Parameters for Aluminum
431
432 a = 26.98;
433 z = 13.00;
434 density = 2.7;
435 radLength = 8.9;
436 maxBending = 10;
437 maxStepSize = .01;
438 precision = .003;
439 minStepSize = .003;
440 id = 2;
441 AliMaterial( id, "Aluminum", a, z, density, radLength, 37.2, 0, 0);
442 AliMedium(id, "Aluminum", id, 1, fieldType, maxField, maxBending,
443 maxStepSize, maxEnergyLoss, precision, minStepSize);
444
445// Parameters for Carbon
446
447 a = 12.01;
448 z = 6.00;
449 density = 2.265;
450 radLength = 18.8;
451 id = 3;
452 AliMaterial(id, "Carbon", a, z, density, radLength, 49.9, 0, 0);
453 AliMedium(id, "Carbon", id, 1, fieldType, maxField, maxBending,
454 maxStepSize, maxEnergyLoss, precision, minStepSize);
455
456// Parameters for scintillator
457
458 Float_t as[] = { 1.00794, 12.011};
459 Float_t zs[] = { 1., 6.};
460 Float_t ws[] = { 1., 1.};
461 density = 1.032;
462 maxBending = 10;
463 maxStepSize = .01;
464 precision = .003;
465 minStepSize = .003;
466 id = 4;
467 AliMixture(id, "Scintillator", as, zs, density, -2, ws);
468 AliMedium(id, "Scintillator", id, 1, fieldType, maxField, maxBending,
469 maxStepSize,maxEnergyLoss,precision,minStepSize);
470
471
472}
473
474//_____________________________________________________________________________
475void AliVZEROv6::DrawModule() const
476{
477
478// Drawing is done in DrawVZERO.C
479
480 AliDebug(2,"DrawModule");
481}
482
483
484//_____________________________________________________________________________
485void AliVZEROv6::DrawGeometry()
486{
487
488// Drawing of V0 geometry done in DrawV0.C
489
490 AliDebug(2,"DrawGeometry");
491
492// Here is DrawV0.C :
493
494// void DrawV0()
495// {
496// TGeoVolume *top = gGeoManager->GetMasterVolume();
497// gGeoManager->SetNsegments(80);
498// Int_t nd = top->GetNdaughters();
499// for (Int_t i=0; i<nd; i++) top->GetNode(i)->GetVolume()->InvisibleAll();
500// TGeoVolume *v0ri = gGeoManager->GetVolume("V0RI");
501// TGeoVolume *v0le = gGeoManager->GetVolume("V0LE");
502// v0ri->SetVisibility(kTRUE);
503// v0ri->VisibleDaughters(kTRUE);
504// v0le->SetVisibility(kTRUE);
505// v0le->VisibleDaughters(kTRUE);
506// top->SetVisibility(kTRUE);
507// top->Draw();
508// }
509
510}
511
512//_____________________________________________________________________________
513void AliVZEROv6::Init()
514{
515// Initialises version of the VZERO Detector given in Config
516// Just prints an information message
517
518 AliInfo(Form("VZERO version %d initialized \n",IsVersion()));
519
520 AliVZERO::Init();
521}
522
523//_____________________________________________________________________________
524void AliVZEROv6::StepManager()
525{
526
527// Step Manager, called at each step
528
529 Int_t copy;
530 static Int_t vol[4];
531 static Float_t hits[21];
532 static Float_t eloss, tlength;
533 static Int_t nPhotonsInStep;
534 static Int_t nPhotons;
535 static Int_t numStep;
536 Float_t ringNumber;
537 Float_t destep, step;
538
539 numStep += 1;
540
541// We keep only charged tracks :
542
543 if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
544
545 vol[0] = gMC->CurrentVolOffID(1, vol[1]);
546 vol[2] = gMC->CurrentVolID(copy);
547 vol[3] = copy;
548
549 static Int_t idV0R1 = gMC->VolId("V0R1");
550 static Int_t idV0L1 = gMC->VolId("V0L1");
551 static Int_t idV0R2 = gMC->VolId("V0R2");
552 static Int_t idV0L2 = gMC->VolId("V0L2");
553 static Int_t idV0R3 = gMC->VolId("V0R3");
554 static Int_t idV0L3 = gMC->VolId("V0L3");
555 static Int_t idV0R4 = gMC->VolId("V0R4");
556 static Int_t idV0L4 = gMC->VolId("V0L4");
557 static Int_t idV0R5 = gMC->VolId("V0R5");
558 static Int_t idV0R6 = gMC->VolId("V0R6");
559
560 if ( gMC->CurrentVolID(copy) == idV0R1 ||
561 gMC->CurrentVolID(copy) == idV0L1 )
562 ringNumber = 1.0;
563 else if ( gMC->CurrentVolID(copy) == idV0R2 ||
564 gMC->CurrentVolID(copy) == idV0L2 )
565 ringNumber = 2.0;
566 else if ( gMC->CurrentVolID(copy) == idV0R3 ||
567 gMC->CurrentVolID(copy) == idV0R4 ||
568 gMC->CurrentVolID(copy) == idV0L3 )
569 ringNumber = 3.0;
570 else if ( gMC->CurrentVolID(copy) == idV0R5 ||
571 gMC->CurrentVolID(copy) == idV0R6 ||
572 gMC->CurrentVolID(copy) == idV0L4 )
573 ringNumber = 4.0;
574 else
575 ringNumber = 0.0;
576
577
578 if ( ringNumber > 0.5 ) {
579
580 destep = gMC->Edep();
581 step = gMC->TrackStep();
582
583 nPhotonsInStep = Int_t(destep / (fLightYield *1e-9) );
584 nPhotonsInStep = gRandom->Poisson(nPhotonsInStep);
585
586 eloss += destep;
587 tlength += step;
588
589 if ( gMC->IsTrackEntering() ) {
590
591 nPhotons = nPhotonsInStep;
592 gMC->TrackPosition(fTrackPosition);
593 gMC->TrackMomentum(fTrackMomentum);
594
595 Float_t pt = TMath::Sqrt( fTrackMomentum.Px() * fTrackMomentum.Px() +
596 fTrackMomentum.Py() * fTrackMomentum.Py() );
597
598 hits[0] = fTrackPosition.X();
599 hits[1] = fTrackPosition.Y();
600 hits[2] = fTrackPosition.Z();
601 hits[3] = Float_t (gMC->TrackPid());
602
603 hits[4] = gMC->TrackTime();
604 hits[5] = gMC->TrackCharge();
605 hits[6] = fTrackMomentum.Theta()*TMath::RadToDeg();
606 hits[7] = fTrackMomentum.Phi()*TMath::RadToDeg();
607 hits[8] = ringNumber;
608
609 hits[9] = pt;
610 hits[10] = fTrackMomentum.P();
611 hits[11] = fTrackMomentum.Px();
612 hits[12] = fTrackMomentum.Py();
613 hits[13] = fTrackMomentum.Pz();
614
615 TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
616 hits[14] = par->Vx();
617 hits[15] = par->Vy();
618 hits[16] = par->Vz();
619
620 tlength = 0.0;
621 eloss = 0.0;
622 }
623
624 nPhotons = nPhotons + nPhotonsInStep;
625
626 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
627
628 nPhotons = nPhotons - Int_t((Float_t(nPhotons) * fLightAttenuation * fnMeters));
629 nPhotons = nPhotons - Int_t( Float_t(nPhotons) * fFibToPhot);
630
631 hits[17] = eloss;
632 hits[18] = tlength;
633 hits[19] = nPhotons;
634 hits[20] = GetCellId (vol, hits);
54aa7396 635
c985a636 636 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
637
638 tlength = 0.0;
639 eloss = 0.0;
640 nPhotons = 0;
641 nPhotonsInStep = 0;
642
643 numStep = 0;
644 }
645 }
646
647}
648
649//_____________________________________________________________________________
650void AliVZEROv6::AddHit(Int_t track, Int_t *vol, Float_t *hits)
651{
652
653// Adds a VZERO hit
654
655 TClonesArray &lhits = *fHits;
656 new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
657}
658
659//_____________________________________________________________________________
660void AliVZEROv6::AddDigits(Int_t *tracks, Int_t* digits)
661{
662
663// Adds a VZERO digit
664
665 TClonesArray &ldigits = *fDigits;
666 new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
667}
668
669//_____________________________________________________________________________
670void AliVZEROv6::MakeBranch(Option_t *option)
671{
672
673// Creates new branches in the current Root Tree
674
675 char branchname[10];
676 sprintf(branchname,"%s",GetName());
677 AliDebug(2,Form("fBufferSize = %d",fBufferSize));
678
679 const char *cH = strstr(option,"H");
680
681 if (fHits && TreeH() && cH) {
682 TreeH()->Branch(branchname,&fHits, fBufferSize);
683 AliDebug(2,Form("Making Branch %s for hits",branchname));
684 }
685
686 const char *cD = strstr(option,"D");
687
688 if (fDigits && fLoader->TreeD() && cD) {
689 fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
690 AliDebug(2,Form("Making Branch %s for digits",branchname));
691 }
692
693}
694
695//_____________________________________________________________________________
696Int_t AliVZEROv6::GetCellId(Int_t *vol, Float_t *hits)
697{
698
699 // Returns Id of scintillator cell
700 // Right side from 0 to 47
701 // Left side from 48 to 95
702
703 // hits[8] = ring number (1 to 4)
704 // vol[1] = copy number (1 to 8)
705
706 Int_t index = vol[1];
707 Int_t RingNumber = Int_t(hits[8]);
708 fCellId = 0;
709
710// cout << "volID = " << vol[0] << " copy = " << vol[1] << endl;
711// cout << "X = " << hits[0] << " Y = " << hits[1] << endl;
712
713 Float_t phi = Float_t(TMath::ATan2(Double_t(hits[1]),Double_t(hits[0])) );
714 Float_t kRaddeg = 180.0/TMath::Pi();
715 phi = kRaddeg * phi;
716
717 if (index < 7) index = index + 8;
718
719 if (hits[2] < 0.0) {
720 if(RingNumber < 3) {
721 index = (index - 7) + ( ( RingNumber - 1 ) * 8);}
722 else if(RingNumber >= 3){
723 if(gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R3")||
724 gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R5") )
725 {index = (index*2 - 14) + ( ( RingNumber - 2 ) * 16); }
726 if(gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R4")||
727 gMC->CurrentVolID(vol[1]) == gMC->VolId("V0R6") )
728 {index = (index*2 - 13) + ( ( RingNumber - 2 ) * 16); }
729 }
730 fCellId = index;
731 }
732
733 else if (hits[2] > 0.0){
734 index = (index - 7 + 48) + ( ( RingNumber - 1 ) * 8);
735 fCellId = index;}
736
737// cout << " ring = " << RingNumber << " phi = "<< phi << endl;
738// cout << " cellID = " << fCellId << endl;
739// cout << "**********" << endl;
740
741 return fCellId;
742
743
744}