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