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