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