Script to create a random bad channel map.
[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>
88cb7938 40#include <TGeometry.h>
88cb7938 41#include <TLorentzVector.h>
42#include <TMath.h>
43#include <TNode.h>
44#include <TObjectTable.h>
47d9b1cb 45#include <TTUBE.h>
88cb7938 46#include <TTUBS.h>
47#include <TVirtualMC.h>
48#include <TParticle.h>
47d9b1cb 49
f359b593 50// --- AliRoot header files ---
b2501ea3 51#include "AliRun.h"
52#include "AliMC.h"
9a5d59b6 53#include "AliConst.h"
254ef8f1 54#include "AliLog.h"
47d9b1cb 55#include "AliMagF.h"
f359b593 56#include "AliVZEROLoader.h"
47d9b1cb 57#include "AliVZEROdigit.h"
88cb7938 58#include "AliVZEROhit.h"
59#include "AliVZEROv2.h"
47d9b1cb 60
61ClassImp(AliVZEROv2)
62
b2501ea3 63//_____________________________________________________________________________
47d9b1cb 64AliVZEROv2:: AliVZEROv2():AliVZERO()
65{
f359b593 66// Standard default constructor
47d9b1cb 67}
b2501ea3 68
69//_____________________________________________________________________________
47d9b1cb 70AliVZEROv2::AliVZEROv2(const char *name, const char *title):
71 AliVZERO(name,title)
72{
73
f359b593 74// Standard constructor for V-zero Detector version 2
47d9b1cb 75
254ef8f1 76 AliDebug(2,"Create VZERO object");
47d9b1cb 77
78}
79
b2501ea3 80//_____________________________________________________________________________
47d9b1cb 81void AliVZEROv2::CreateGeometry()
82{
83
84// Creates the GEANT geometry of the V-zero Detector version 2
47d9b1cb 85
254ef8f1 86 AliDebug(2,"Create VZERO Geometry");
c288a388 87
47d9b1cb 88 Int_t *idtmed = fIdtmed->GetArray()-2999;
89
f359b593 90 Int_t ndetR = 1;
91 Int_t ndetL = 1;
47d9b1cb 92
f359b593 93 Int_t ncellsR = 1;
94 Int_t ncellsL = 1;
47d9b1cb 95
96 Int_t idrotm[999];
97
98 Float_t height1, height2, height3, height4, height5;
99 Float_t height;
100 Float_t theta;
101
f359b593 102 Float_t halfThickQua;
47d9b1cb 103
104 Float_t zdet;
105 Float_t r0, r5;
106 Float_t pi = TMath::Pi();
c288a388 107
b2501ea3 108 height1 = 1.82; // height of cell 1, in cm
109 height2 = 3.81; // height of cell 2, in cm
110 height3 = 4.72; // height of cell 3, in cm
111 height4 = 7.12; // height of cell 4, in cm
112 height5 = 10.83; // height of cell 5, in cm
47d9b1cb 113
b2501ea3 114 theta = pi/6.0/2.0; // half angular opening = 15 degrees
c288a388 115
b2501ea3 116 halfThickQua= fThickness1/2.0; // half thickness of elementary cell (inner ring)
2f77b146 117
118// distance 0.6 cm in zdet accounts for the fact V0R box back lid sits 0.6 away from
119// absorber nose sitting at 90 cm. Will use -zdet later...
120
121 zdet = 90.0 - 0.6 -fThickness/2.0; // distance to vertex (along Z axis)
b2501ea3 122 r0 = 4.05; // closest distance to center of the beam pipe
123 height = height1 + height2 + height3 + height4 + height5;
124 r5 = r0 + height;
47d9b1cb 125
f359b593 126// Creation of mother volume v0LE - left part - :
9a5d59b6 127// Entrance face at +350.0 cm (new coordinate system) ...
47d9b1cb 128
129 Float_t partube[3];
130
131 partube[0] = 4.3;
132 partube[1] = 45.0;
133 partube[2] = fThickness1/2.0;
134
135 gMC->Gsvolu("V0LE","TUBE",idtmed[3005],partube,3);
c288a388 136
47d9b1cb 137// Creation of five rings - left part - :
9a5d59b6 138// Entrance face at +350.0 cm (new coordinate system) ...
47d9b1cb 139
f359b593 140// Mother volume v0L0 in which will be set 5 scintillator cells
47d9b1cb 141
47d9b1cb 142 Float_t partubs[5];
143
f359b593 144 Float_t r0Left = 4.3;
145 Float_t height1Left = 2.6;
146 Float_t height2Left = 4.1;
147 Float_t height3Left = 6.4;
148 Float_t height4Left = 10.2;
149 Float_t height5Left = 16.9;
150 Float_t heightLeft = height1Left + height2Left + height3Left
151 + height4Left + height5Left;
152 Float_t r5Left = r0Left + heightLeft;
153
154 partubs[0] = r0Left;
155 partubs[1] = r5Left;
47d9b1cb 156 partubs[2] = fThickness1/2.0;
157 partubs[3] = 90.0-15.0;
158 partubs[4] = 120.0-15.0;
159
160 gMC->Gsvolu("V0L0","TUBS",idtmed[3010],partubs,5); // air volume
161
f359b593 162 Float_t r1Left = r0Left + height1Left;
47d9b1cb 163
f359b593 164 partubs[0] = r0Left;
165 partubs[1] = r1Left;
47d9b1cb 166
167 gMC->Gsvolu("V0L1","TUBS",idtmed[3005],partubs,5); // quartz volume
168 gMC->Gspos("V0L1",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
169
f359b593 170 Float_t r2Left = r1Left + height2Left;
47d9b1cb 171
f359b593 172 partubs[0] = r1Left;
173 partubs[1] = r2Left;
47d9b1cb 174
175 gMC->Gsvolu("V0L2","TUBS",idtmed[3005],partubs,5); // quartz volume
176 gMC->Gspos("V0L2",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
177
f359b593 178 Float_t r3Left = r2Left + height3Left;
47d9b1cb 179
f359b593 180 partubs[0] = r2Left;
181 partubs[1] = r3Left;
47d9b1cb 182
183 gMC->Gsvolu("V0L3","TUBS",idtmed[3005],partubs,5); // quartz volume
184 gMC->Gspos("V0L3",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
185
f359b593 186 Float_t r4Left = r3Left + height4Left;
47d9b1cb 187
f359b593 188 partubs[0] = r3Left;
189 partubs[1] = r4Left;
47d9b1cb 190
47d9b1cb 191 gMC->Gsvolu("V0L4","TUBS",idtmed[3005],partubs,5); // quartz volume
192 gMC->Gspos("V0L4",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
193
f359b593 194 partubs[0] = r4Left;
195 partubs[1] = r5Left;
47d9b1cb 196 partubs[3] = 90.0-15.0;
197 partubs[4] = 120.0-30.0;
198
47d9b1cb 199 gMC->Gsvolu("V0L5","TUBS",idtmed[3005],partubs,5); // quartz volume
200 gMC->Gspos("V0L5",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
201
47d9b1cb 202 partubs[3] = 120.0-30.0;
203 partubs[4] = 120.0-15.0;
204
47d9b1cb 205 gMC->Gsvolu("V0L6","TUBS",idtmed[3005],partubs,5); // quartz volume
206 gMC->Gspos("V0L6",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
207
208
f359b593 209// Creation of mother volume v0RI - right part - :
47d9b1cb 210
211 partube[0] = r0 - 0.2;
212 partube[1] = r5 + 1.0;
213 partube[2] = fThickness/2.0;
c288a388 214
47d9b1cb 215 gMC->Gsvolu("V0RI","TUBE",idtmed[3010],partube,3);
216
2f77b146 217// Creation of carbon lids (2 mm thick) to keep v0RI box shut...
218
219 Float_t lidThickness = 0.2;
47d9b1cb 220
221 partube[0] = r0;
222 partube[1] = r5;
2f77b146 223 partube[2] = +lidThickness/2.0;
c288a388 224
47d9b1cb 225 gMC->Gsvolu("V0CA","TUBE",idtmed[3001],partube,3);
226 gMC->Gspos("V0CA",1,"V0RI",0.0,0.0, fThickness/2.0-partube[2],0,"ONLY");
227 gMC->Gspos("V0CA",2,"V0RI",0.0,0.0,-fThickness/2.0+partube[2],0,"ONLY");
228
f359b593 229// Creation of aluminum rings to maintain the v0RI pieces ...
47d9b1cb 230
231 partube[0] = r0 - 0.2;
232 partube[1] = r0;
233 partube[2] = +fThickness/2.0;
c288a388 234
47d9b1cb 235 gMC->Gsvolu("V0IR","TUBE",idtmed[3003],partube,3);
236 gMC->Gspos("V0IR",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
237
238 partube[0] = r5;
239 partube[1] = r5 + 1.0;
240 partube[2] = +fThickness/2.0;
241
47d9b1cb 242 gMC->Gsvolu("V0ER","TUBE",idtmed[3003],partube,3);
243 gMC->Gspos("V0ER",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
244
f359b593 245// Mother volume v0R0 in which will be set 5 scintillator cells
47d9b1cb 246
247 partubs[0] = r0;
248 partubs[1] = r5;
249 partubs[2] = fThickness/2.0;
250 partubs[3] = 90.0-15.0;
251 partubs[4] = 120.0-15.0;
252
c288a388 253 gMC->Gsvolu("V0R0","TUBS",idtmed[3010],partubs,5); // air volume
47d9b1cb 254
255// Elementary cell of ring 1 :
2f77b146 256// (cells 2 and 3 will be shifted by 1 cm to output fibers)
47d9b1cb 257
2f77b146 258 Float_t offsetFibers = 1.0;
259 Float_t offset = fThickness/2.0 - lidThickness - fThickness1/2.0;
47d9b1cb 260 Float_t r1 = r0 + height1;
261
262 partubs[0] = r0;
263 partubs[1] = r1;
264 partubs[2] = fThickness1/2.0;
265
266 gMC->Gsvolu("V0R1","TUBS",idtmed[3005],partubs,5); // scintillator volume
9a5d59b6 267 gMC->Gspos("V0R1",1,"V0R0", 0.0, 0.0 , -offset, 0,"ONLY");
47d9b1cb 268
269// Elementary cell of ring 2 :
270
271 Float_t r2 = r1 + height2;
272
273 partubs[0] = r1;
274 partubs[1] = r2;
275
276 gMC->Gsvolu("V0R2","TUBS",idtmed[3005],partubs,5); // scintillator volume
f359b593 277 gMC->Gspos("V0R2",1,"V0R0", 0.0, 0.0 , -offset + offsetFibers, 0,"ONLY");
47d9b1cb 278
279
280// Elementary cell of ring 3 :
281
282 Float_t r3 = r2 + height3;
283
284 partubs[0] = r2;
285 partubs[1] = r3;
286
287 gMC->Gsvolu("V0R3","TUBS",idtmed[3005],partubs,5); // scintillator volume
f359b593 288 gMC->Gspos("V0R3",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
47d9b1cb 289
290// Elementary cell of ring 4 :
291
292 Float_t r4 = r3 + height4 ;
293
294 partubs[0] = r3;
295 partubs[1] = r4;
296
297 gMC->Gsvolu("V0R4","TUBS",idtmed[3005],partubs,5); // scintillator volume
2f77b146 298 gMC->Gspos("V0R4",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
47d9b1cb 299
300// Elementary cells of ring 5 :
301
302 partubs[0] = r4;
303 partubs[1] = r5;
304 partubs[3] = 90.0-15.0;
305 partubs[4] = 120.0-30.0;
306
47d9b1cb 307 gMC->Gsvolu("V0R5","TUBS",idtmed[3005],partubs,5); // scintillator volume
2f77b146 308 gMC->Gspos("V0R5",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
47d9b1cb 309
310 partubs[3] = 120.0-30.0;
311 partubs[4] = 120.0-15.0;
312
47d9b1cb 313 gMC->Gsvolu("V0R6","TUBS",idtmed[3005],partubs,5); // scintillator volume
2f77b146 314 gMC->Gspos("V0R6",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
c288a388 315
f359b593 316 Float_t phiDeg = 180./6.;
47d9b1cb 317
318// Right part :
319
f359b593 320 for(Float_t phi = 15.0; phi < 360.0; phi = phi + phiDeg)
47d9b1cb 321 {
322 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
f359b593 323 gMC->Gspos("V0R0",ndetR,"V0RI",0.0,
c288a388 324 0.0,0.0,idrotm[902],"ONLY");
f359b593 325 ndetR++;
47d9b1cb 326 }
327
9a5d59b6 328 gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,-zdet,0,"ONLY");
47d9b1cb 329
f359b593 330 ncellsR = (ndetR - 1) * 6;
254ef8f1 331 AliInfo(Form("Number of cells on Right side = %d", ncellsR));
47d9b1cb 332
333// Left part :
334
f359b593 335 for(Float_t phi = 15.0; phi < 360.0; phi = phi + phiDeg)
47d9b1cb 336 {
337 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
f359b593 338 gMC->Gspos("V0L0",ndetL,"V0LE",0.0,
47d9b1cb 339 0.0,0.0,idrotm[902],"ONLY");
f359b593 340 ndetL++;
47d9b1cb 341 }
342
9a5d59b6 343 gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,350.0+fThickness1/2.0,0,"ONLY");
47d9b1cb 344
f359b593 345 ncellsL = (ndetL - 1) * 6;
254ef8f1 346 AliInfo(Form("Number of cells on Left side = %d", ncellsL));
c288a388 347
47d9b1cb 348}
c288a388 349
47d9b1cb 350//_____________________________________________________________________________
351void AliVZEROv2::BuildGeometry()
352{
353
354// Builds simple ROOT TNode geometry for event display
355
254ef8f1 356 AliDebug(2,"VZERO BuildGeometry");
9a5d59b6 357
f359b593 358 TNode *top;
47d9b1cb 359
f359b593 360 TNode *v0Rnode, *v0Rnode0, *v0Rnode6 , *v0Rnode7, *v0Rnode8, *v0Rnode9;
361 TNode *v0Rnode1, *v0Rnode2, *v0Rnode3, *v0Rnode4, *v0Rnode5;
362 TNode *v0Lnode, *v0Lnode0;
363 TNode *v0Lnode1, *v0Lnode2, *v0Lnode3, *v0Lnode4, *v0Lnode5, *v0Lnode6;
47d9b1cb 364
365 const int kColorVZERO = kGreen;
366
f359b593 367 top = gAlice->GetGeometry()->GetNode("alice");
47d9b1cb 368
369 Float_t height1, height2, height3, height4, height5;
370 Float_t height;
371 Float_t theta;
372
f359b593 373 Float_t halfThickQua;
47d9b1cb 374 Float_t zdet;
375 Float_t r0, r5;
376 Float_t pi = TMath::Pi();
c288a388 377
378 height1 = 1.82; // height of cell 1, in cm
379 height2 = 3.81; // height of cell 2, in cm
380 height3 = 4.72; // height of cell 3, in cm
381 height4 = 7.12; // height of cell 4, in cm
382 height5 = 10.83; // height of cell 5, in cm
383
47d9b1cb 384 theta = pi/6.0/2.0;
385
f359b593 386 halfThickQua = fThickness1/2.0;
47d9b1cb 387
c288a388 388 zdet = 90.0 - 0.6 - fThickness/2.0;
389 r0 = 4.05;
47d9b1cb 390 height = height1 + height2 + height3 + height4 + height5;
391 r5 = r0 + height;
392
393 Int_t ndiv = 1;
394
395 Float_t partube[3];
396
397 partube[0] = r0 - 0.2;
398 partube[1] = r5 + 1.0;
399 partube[2] = fThickness/2.0;
400
f359b593 401 TTUBE *v0RI = new TTUBE("V0RI", "V0RI", "void", partube[0], partube[1], partube[2]);
47d9b1cb 402
f359b593 403 top->cd();
47d9b1cb 404
f359b593 405 v0Rnode = new TNode("V0RI","V0RI",v0RI,0.0,0.0,-zdet,0);
47d9b1cb 406
f359b593 407 v0Rnode->SetLineColor(kYellow);
408 fNodes->Add(v0Rnode);
409 v0Rnode->SetVisibility(2);
47d9b1cb 410
2f77b146 411// Rondelles de carbone (epaisseur 2 mm) de maintien des cellules ...
412
413 Float_t lidThickness = 0.2;
c288a388 414
47d9b1cb 415 partube[0] = r0;
416 partube[1] = r5;
2f77b146 417 partube[2] = +lidThickness/2.0;
47d9b1cb 418
f359b593 419 TTUBE *v0CA = new TTUBE("V0CA", "V0CA", "void",partube[0], partube[1], partube[2]);
47d9b1cb 420
f359b593 421 v0Rnode->cd();
422 v0Rnode6 = new TNode("V0CA", "V0CA",v0CA,0.0,0.0, fThickness/2.0-partube[2],0);
423 v0Rnode6->SetLineColor(kYellow);
424 fNodes->Add(v0Rnode6);
425 v0Rnode->cd();
426 v0Rnode7 = new TNode("V0CA", "V0CA",v0CA,0.0,0.0,-fThickness/2.0+partube[2],0);
427 v0Rnode7->SetLineColor(kYellow);
428 fNodes->Add(v0Rnode7);
47d9b1cb 429
430 partube[0] = r0 - 0.2;
431 partube[1] = r0;
432 partube[2] = +fThickness/2.0;
433
f359b593 434 TTUBE *v0IR = new TTUBE("V0IR","V0IR","void", partube[0], partube[1], partube[2]);
47d9b1cb 435
f359b593 436 v0Rnode->cd();
437 v0Rnode8 = new TNode("V0IR", "V0IR",v0IR,0.0,0.0,0.0,0);
438 v0Rnode8->SetLineColor(kYellow);
439 fNodes->Add(v0Rnode8);
47d9b1cb 440
441 partube[0] = r5;
442 partube[1] = r5 + 1.0;
443 partube[2] = +fThickness/2.0;
444
f359b593 445 TTUBE *v0ER = new TTUBE("V0ER","V0ER","void", partube[0], partube[1], partube[2]);
47d9b1cb 446
f359b593 447 v0Rnode->cd();
448 v0Rnode9 = new TNode("V0ER", "V0ER",v0ER,0.0,0.0,0.0,0);
449 v0Rnode9->SetLineColor(kYellow);
450 fNodes->Add(v0Rnode9);
47d9b1cb 451
452 Float_t partubs[5];
453
454 partubs[0] = r0;
455 partubs[1] = r5;
456 partubs[2] = fThickness/2.0;
457 partubs[3] = 90.0-15.0;
458 partubs[4] = 120.0-15.0;
459
f359b593 460 TTUBS *v0R0 = new TTUBS("V0R0", "V0R0", "void",partubs[0], partubs[1], partubs[2],
47d9b1cb 461 partubs[3], partubs[4]);
462
f359b593 463 v0R0->SetNumberOfDivisions(ndiv);
47d9b1cb 464
465 Float_t r1 = r0 + height1;
2f77b146 466 Float_t offset = fThickness/2.0 - lidThickness - fThickness1/2.0;
467 Float_t offsetFibers = 1.0;
47d9b1cb 468
469 partubs[0] = r0;
470 partubs[1] = r1;
471 partubs[2] = fThickness1/2.0;
472
f359b593 473 TTUBS *v0R1 = new TTUBS("V0R1", "V0R1", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 474 partubs[3], partubs[4]);
475
f359b593 476 v0R1->SetNumberOfDivisions(ndiv);
47d9b1cb 477
478 Float_t r2 = r1 + height2;
47d9b1cb 479
480 partubs[0] = r1;
481 partubs[1] = r2;
482
f359b593 483 TTUBS *v0R2 = new TTUBS("V0R2", "V0R2", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 484 partubs[3], partubs[4]);
485
f359b593 486 v0R2->SetNumberOfDivisions(ndiv);
47d9b1cb 487
488 Float_t r3 = r2 + height3;
47d9b1cb 489
490 partubs[0] = r2;
491 partubs[1] = r3;
492
f359b593 493 TTUBS *v0R3 = new TTUBS("V0R3", "V0R3", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 494 partubs[3], partubs[4]);
f359b593 495 v0R3->SetNumberOfDivisions(ndiv);
47d9b1cb 496
497 Float_t r4 = r3 + height4;
498
499 partubs[0] = r3;
500 partubs[1] = r4;
501
f359b593 502 TTUBS *v0R4 = new TTUBS("V0R4", "V0R4", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 503 partubs[3], partubs[4]);
504
f359b593 505 v0R4->SetNumberOfDivisions(ndiv);
47d9b1cb 506
507 partubs[0] = r4;
508 partubs[1] = r5;
509 partubs[3] = 90.0-15.0;
510 partubs[4] = 120.0-30.0;
511
f359b593 512 TTUBS *v0R5 = new TTUBS("V0R5", "V0R5", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 513 partubs[3], partubs[4]);
514
f359b593 515 v0R5->SetNumberOfDivisions(ndiv);
47d9b1cb 516
517 partubs[3] = 120.0-30.0;
518 partubs[4] = 120.0-15.0;
519
f359b593 520 TTUBS *v0R6 = new TTUBS("V0R6", "V0R6", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 521 partubs[3], partubs[4]);
522
f359b593 523 v0R6->SetNumberOfDivisions(ndiv);
47d9b1cb 524
525 Float_t phi;
f359b593 526 Float_t phiDeg= 180./6.;
c288a388 527
f359b593 528 Int_t ndetR = 1;
47d9b1cb 529
f359b593 530 char nameNode[12];
47d9b1cb 531
f359b593 532 for (phi = 15.0; phi < 360.0; phi = phi + phiDeg)
47d9b1cb 533
534 {
535
536 TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );
c288a388 537
f359b593 538 sprintf(nameNode,"SUBDER%d",ndetR);
47d9b1cb 539
f359b593 540 v0Rnode->cd();
541 v0Rnode0 = new TNode(nameNode,nameNode,v0R0,0.0,0.0, 0.0,mat920);
542 v0Rnode0->SetLineColor(kYellow);
543 fNodes->Add(v0Rnode0);
544 ndetR++;
47d9b1cb 545
f359b593 546 sprintf(nameNode,"SUBDER%d",ndetR);
547 v0Rnode0->cd();
548 v0Rnode1 = new TNode(nameNode,nameNode,v0R1,0.0,0.0, -offset,0);
549 v0Rnode1->SetLineColor(kColorVZERO);
550 fNodes->Add(v0Rnode1);
551 ndetR++;
47d9b1cb 552
f359b593 553 sprintf(nameNode,"SUBDER%d",ndetR);
554 v0Rnode0->cd();
555 v0Rnode2 = new TNode(nameNode,nameNode,v0R2,0.0,0.0, -offset + offsetFibers,0);
556 v0Rnode2->SetLineColor(kColorVZERO);
557 fNodes->Add(v0Rnode2);
558 ndetR++;
559
560 sprintf(nameNode,"SUBDER%d",ndetR);
561 v0Rnode0->cd();
562 v0Rnode3 = new TNode(nameNode,nameNode,v0R3,0.0,0.0, -offset + 2.0*offsetFibers,0);
563 v0Rnode3->SetLineColor(kColorVZERO);
564 fNodes->Add(v0Rnode3);
565 ndetR++;
566
567 sprintf(nameNode,"SUBDER%d",ndetR);
568 v0Rnode0->cd();
2f77b146 569 v0Rnode4 = new TNode(nameNode,nameNode,v0R4,0.0,0.0, -offset + 2.0*offsetFibers,0);
f359b593 570 v0Rnode4->SetLineColor(kColorVZERO);
571 fNodes->Add(v0Rnode4);
572 ndetR++;
47d9b1cb 573
f359b593 574 sprintf(nameNode,"SUBDER%d",ndetR);
575 v0Rnode0->cd();
2f77b146 576 v0Rnode5 = new TNode(nameNode,nameNode,v0R5,0.0,0.0, -offset + 2.0*offsetFibers,0);
f359b593 577 v0Rnode5->SetLineColor(kColorVZERO);
578 fNodes->Add(v0Rnode5);
579 ndetR++;
47d9b1cb 580
f359b593 581 sprintf(nameNode,"SUBDER%d",ndetR);
582 v0Rnode0->cd();
2f77b146 583 v0Rnode6 = new TNode(nameNode,nameNode,v0R6,0.0,0.0, -offset + 2.0*offsetFibers,0);
f359b593 584 v0Rnode6->SetLineColor(kColorVZERO);
585 fNodes->Add(v0Rnode6);
586 ndetR++;
47d9b1cb 587
f359b593 588 v0Rnode0->SetVisibility(2);
47d9b1cb 589
590 }
591
47d9b1cb 592// Left side of VZERO :
47d9b1cb 593
f359b593 594 Float_t r0Left = 4.3;
595 Float_t height1Left = 2.6;
596 Float_t height2Left = 4.1;
597 Float_t height3Left = 6.4;
598 Float_t height4Left = 10.2;
599 Float_t height5Left = 16.9;
600 Float_t heightLeft = height1Left + height2Left + height3Left
601 + height4Left + height5Left;
602 Float_t r5Left = r0Left + heightLeft;
603
604 partube[0] = r0Left;
605 partube[1] = r5Left;
47d9b1cb 606 partube[2] = fThickness1/2.0;
607
f359b593 608 TTUBE *v0LE = new TTUBE("V0LE", "V0LE", "void", partube[0], partube[1], partube[2]);
47d9b1cb 609
f359b593 610 top->cd();
47d9b1cb 611
f359b593 612 v0Lnode = new TNode("V0LE","V0LE",v0LE,0.0,0.0,350.0+fThickness1/2.0,0);
47d9b1cb 613
f359b593 614 v0Lnode->SetLineColor(kBlue);
615 fNodes->Add(v0Lnode);
47d9b1cb 616
f359b593 617 v0Lnode->SetVisibility(2);
47d9b1cb 618
f359b593 619 partubs[0] = r0Left;
620 partubs[1] = r5Left;
47d9b1cb 621 partubs[2] = fThickness1/2.0;
622 partubs[3] = 90.0-15.0;
623 partubs[4] = 120.0-15.0;
624
f359b593 625 TTUBS *v0L0 = new TTUBS("V0L0", "V0L0", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 626 partubs[3], partubs[4]);
627
f359b593 628 v0L0->SetNumberOfDivisions(ndiv);
629 v0L0->SetLineColor(7);
47d9b1cb 630
b2501ea3 631 Float_t offsetLeft;
632 offsetLeft = - fThickness1/2.0;
47d9b1cb 633
f359b593 634 Float_t r1Left = r0Left + height1Left;
47d9b1cb 635
f359b593 636 partubs[0] = r0Left;
637 partubs[1] = r1Left;
47d9b1cb 638
f359b593 639 TTUBS *v0L1 = new TTUBS("V0L1", "V0L1", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 640 partubs[3], partubs[4]);
641
f359b593 642 v0L1->SetNumberOfDivisions(ndiv);
47d9b1cb 643
f359b593 644 Float_t r2Left = r1Left + height2Left;
47d9b1cb 645
f359b593 646 partubs[0] = r1Left;
647 partubs[1] = r2Left;
47d9b1cb 648
f359b593 649 TTUBS *v0L2 = new TTUBS("V0L2", "V0L2", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 650 partubs[3], partubs[4]);
651
f359b593 652 v0L2->SetNumberOfDivisions(ndiv);
47d9b1cb 653
f359b593 654 Float_t r3Left = r2Left + height3Left;
47d9b1cb 655
f359b593 656 partubs[0] = r2Left;
657 partubs[1] = r3Left;
47d9b1cb 658
f359b593 659 TTUBS *v0L3 = new TTUBS("V0L3", "V0L3", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 660 partubs[3], partubs[4]);
f359b593 661 v0L3->SetNumberOfDivisions(ndiv);
47d9b1cb 662
f359b593 663 Float_t r4Left = r3Left + height4Left;
47d9b1cb 664
f359b593 665 partubs[0] = r3Left;
666 partubs[1] = r4Left;
47d9b1cb 667
f359b593 668 TTUBS *v0L4 = new TTUBS("V0L4", "V0L4", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 669 partubs[3], partubs[4]);
670
f359b593 671 v0L4->SetNumberOfDivisions(ndiv);
47d9b1cb 672
f359b593 673 partubs[0] = r4Left;
674 partubs[1] = r5Left;
47d9b1cb 675 partubs[3] = 90.0-15.0;
676 partubs[4] = 120.0-30.0;
677
f359b593 678 TTUBS *v0L5 = new TTUBS("V0L5", "V0L5", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 679 partubs[3], partubs[4]);
680
681
f359b593 682 v0L5->SetNumberOfDivisions(ndiv);
47d9b1cb 683
684 partubs[3] = 120.0-30.0;
685 partubs[4] = 120.0-15.0;
686
f359b593 687 TTUBS *v0L6 = new TTUBS("V0L6", "V0L6", "void", partubs[0], partubs[1], partubs[2],
47d9b1cb 688 partubs[3], partubs[4]);
689
f359b593 690 v0L6->SetNumberOfDivisions(ndiv);
47d9b1cb 691
f359b593 692 Int_t ndetL = 1;
47d9b1cb 693
f359b593 694 for (phi = 15.0; phi < 360.0; phi = phi + phiDeg)
47d9b1cb 695
696 {
697
698 TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );
699
700
f359b593 701 sprintf(nameNode,"SUBDEL%d",ndetL);
47d9b1cb 702
f359b593 703 v0Lnode->cd();
b2501ea3 704 v0Lnode0 = new TNode(nameNode,nameNode,v0L0,0.0,0.0, offsetLeft + halfThickQua,mat920);
f359b593 705 v0Lnode0->SetLineColor(kColorVZERO);
706 fNodes->Add(v0Lnode0);
707 ndetL++;
47d9b1cb 708
f359b593 709 sprintf(nameNode,"SUBDEL%d",ndetL);
710 v0Lnode0->cd();
711 v0Lnode1 = new TNode(nameNode,nameNode,v0L1,0.0,0.0, 0.0,0);
712 v0Lnode1->SetLineColor(kColorVZERO);
713 fNodes->Add(v0Lnode1);
714 ndetL++;
47d9b1cb 715
f359b593 716 sprintf(nameNode,"SUBDEL%d",ndetL);
717 v0Lnode0->cd();
718 v0Lnode2 = new TNode(nameNode,nameNode,v0L2,0.0,0.0, 0.0,0);
719 v0Lnode2->SetLineColor(kColorVZERO);
720 fNodes->Add(v0Lnode2);
721 ndetL++;
722
723
724 sprintf(nameNode,"SUBDEL%d",ndetL);
725 v0Lnode0->cd();
726 v0Lnode3 = new TNode(nameNode,nameNode,v0L3,0.0,0.0, 0.0,0);
727 v0Lnode3->SetLineColor(kColorVZERO);
728 fNodes->Add(v0Lnode3);
729 ndetL++;
730
731 sprintf(nameNode,"SUBDEL%d",ndetL);
732 v0Lnode0->cd();
733 v0Lnode4 = new TNode(nameNode,nameNode,v0L4,0.0,0.0, 0.0,0);
734 v0Lnode4->SetLineColor(kColorVZERO);
735 fNodes->Add(v0Lnode4);
736 ndetL++;
47d9b1cb 737
f359b593 738 sprintf(nameNode,"SUBDEL%d",ndetL);
739 v0Lnode0->cd();
740 v0Lnode5 = new TNode(nameNode,nameNode,v0L5,0.0,0.0, 0.0,0);
741 v0Lnode5->SetLineColor(kColorVZERO);
742 fNodes->Add(v0Lnode5);
743 ndetL++;
47d9b1cb 744
f359b593 745 sprintf(nameNode,"SUBDEL%d",ndetL);
746 v0Lnode0->cd();
747 v0Lnode6 = new TNode(nameNode,nameNode,v0L6,0.0,0.0, 0.0,0);
748 v0Lnode6->SetLineColor(kColorVZERO);
749 fNodes->Add(v0Lnode6);
750 ndetL++;
47d9b1cb 751
f359b593 752 v0Lnode0->SetVisibility(2);
47d9b1cb 753
754 }
9a5d59b6 755
47d9b1cb 756}
757
b2501ea3 758//_____________________________________________________________________________
47d9b1cb 759void AliVZEROv2::CreateMaterials()
760{
f359b593 761
762// Creates materials used for geometry
763
254ef8f1 764 AliDebug(2,"VZERO create materials");
47d9b1cb 765
766/*
767 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,
768 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
769
770
771 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,
772 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
773
774 Float_t rindex_quarz[14] = { 1.52398, 1.53090, 1.53835, 1.54641, 1.55513, 1.56458,
775 1.57488, 1.58611, 1.59842, 1.61197, 1.62696, 1.64362,
776 1.662295, 1.68337 };
777
778 Float_t absco_quarz[14] = { 105.8, 45.656, 35.665, 28.598, 25.007, 21.04, 17.525,
779 14.177, 9.282, 4.0925, 1.149, 0.3627, 0.1497, 0.05 };
780
781 Float_t effic_all[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
782
783
784 Float_t rindex_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
785
786
787 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,
788 1e-4,1e-4,1e-4,1e-4 };
789 Float_t effic_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
790
791*/
792
793 Int_t *idtmed = fIdtmed->GetArray()-2999;
794
47d9b1cb 795
796// Parameters related to Quarz (SiO2) :
797
798 Float_t aqua[2], zqua[2], densqua, wmatqua[2];
799 Int_t nlmatqua;
800
801 aqua[0] = 28.09;
802 aqua[1] = 16.;
803 zqua[0] = 14.;
804 zqua[1] = 8.;
805 densqua = 2.64;
806 nlmatqua = -2;
807 wmatqua[0] = 1.;
808 wmatqua[1] = 2.;
809
810// Parameters related to aluminum sheets :
811
812 Float_t aal = 26.98;
813 Float_t zal = 13.00;
814 Float_t densal= 2.7;
815 Float_t radlal= 8.9;
816
817// Parameters related to scintillator CH :
818
819 Float_t ascin[2] = {1.00794,12.011};
820 Float_t zscin[2] = {1.,6.};
821 Float_t wscin[2] = {1.,1.};
822 Float_t denscin = 1.032;
25252ad5 823
824// AIR
825
826 Float_t aAir[4]={12.,14.,16.,36.};
827 Float_t zAir[4]={6.,7.,8.,18.};
828 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
829 Float_t dAir = 1.20479E-3;
830
47d9b1cb 831// Definition of materials :
832
25252ad5 833 AliMixture( 1, "AIR A$", aAir,zAir,dAir,4,wAir);
834 AliMixture(11, "AIR I$", aAir,zAir,dAir,4,wAir);
47d9b1cb 835 AliMaterial( 2, "CARBON$" , 12.01, 6.0, 2.265, 18.8, 49.9, 0, 0);
836 AliMixture( 3, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
837 AliMaterial( 4, "ALUMINIUM1$", 26.98, 13., 2.7, 8.9, 37.2, 0, 0);
838 AliMaterial( 5, "ALUMINIUM2$", aal, zal, densal, radlal, 0, 0, 0);
839
840 AliMixture( 6, "Scintillator$",ascin,zscin,denscin,-2,wscin);
841
842
f359b593 843 Int_t iSXFLD = gAlice->Field()->Integ();
844 Float_t sXMGMX = gAlice->Field()->Max();
47d9b1cb 845
846 Float_t tmaxfd, stemax, deemax, epsil, stmin;
847
848 tmaxfd = 10.;
849 stemax = 0.1;
850 deemax = 0.1;
851 epsil = 0.001;
852 stmin = 0.001;
853
854// Active Air :
f359b593 855 AliMedium(1, "ACTIVE AIR$", 1, 1, iSXFLD, sXMGMX,
47d9b1cb 856 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
857
858// Inactive air :
859
f359b593 860 AliMedium(11, "INACTIVE AIR$", 11, 0, iSXFLD, sXMGMX,
47d9b1cb 861 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
862
f359b593 863 AliMedium(2, "CARBON$ ", 2, 1, iSXFLD, sXMGMX,
47d9b1cb 864 tmaxfd, stemax, deemax, epsil, stmin, 0, 0);
865
f359b593 866 AliMedium(3, "QUARZ$", 3, 1, iSXFLD, sXMGMX,
47d9b1cb 867 tmaxfd, fMaxStepQua, fMaxDestepQua, epsil, stmin, 0, 0);
868
f359b593 869 AliMedium(4,"ALUMINUM1$",4, 1, iSXFLD, sXMGMX,
47d9b1cb 870 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
871
872
f359b593 873 AliMedium(5,"ALUMINUM2$",5, 1, iSXFLD, sXMGMX,
47d9b1cb 874 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
875
f359b593 876 AliMedium(6,"SCINTILLATOR$",6, 1, iSXFLD, sXMGMX, 10.0, 0.1, 0.1, 0.003, 0.003, 0, 0);
47d9b1cb 877
878 gMC->Gstpar(idtmed[3000], "LOSS", 1.); // [3000] = air ACTIF [3010] = air INACTIF
879 gMC->Gstpar(idtmed[3000], "HADR", 1.);
880 gMC->Gstpar(idtmed[3000], "DCAY", 1.);
881 gMC->Gstpar(idtmed[3000], "DRAY", 1.);
882
883 gMC->Gstpar(idtmed[3001], "LOSS", 1.); // [3001] = carbon
884 gMC->Gstpar(idtmed[3001], "HADR", 1.);
885 gMC->Gstpar(idtmed[3001], "DCAY", 1.);
886 gMC->Gstpar(idtmed[3001], "DRAY", 1.);
887
888 gMC->Gstpar(idtmed[3002], "LOSS", 1.); // [3002] = quartz
889 gMC->Gstpar(idtmed[3002], "HADR", 1.);
890 gMC->Gstpar(idtmed[3002], "DCAY", 1.);
891 gMC->Gstpar(idtmed[3002], "DRAY", 1.);
892 gMC->Gstpar(idtmed[3002], "CUTGAM",0.5E-4) ;
893 gMC->Gstpar(idtmed[3002], "CUTELE",1.0E-4) ;
894
895 gMC->Gstpar(idtmed[3003], "LOSS", 1.); // [3003] = normal aluminum
896 gMC->Gstpar(idtmed[3003], "HADR", 1.);
897 gMC->Gstpar(idtmed[3003], "DCAY", 1.);
898 gMC->Gstpar(idtmed[3003], "DRAY", 1.);
899
900 gMC->Gstpar(idtmed[3004], "LOSS", 1.); // [3004] = reflecting aluminum
901 gMC->Gstpar(idtmed[3004], "HADR", 1.);
902 gMC->Gstpar(idtmed[3004], "DCAY", 1.);
903 gMC->Gstpar(idtmed[3004], "DRAY", 1.);
904 gMC->Gstpar(idtmed[3004], "CUTGAM",0.5E-4) ;
905 gMC->Gstpar(idtmed[3004], "CUTELE",1.0E-4) ;
906
907 gMC->Gstpar(idtmed[3005], "LOSS", 1.); // [3005] = scintillator
908 gMC->Gstpar(idtmed[3005], "HADR", 1.);
909 gMC->Gstpar(idtmed[3005], "DCAY", 1.);
910 gMC->Gstpar(idtmed[3005], "DRAY", 1.);
911 gMC->Gstpar(idtmed[3005], "CUTGAM",0.5E-4) ;
912 gMC->Gstpar(idtmed[3005], "CUTELE",1.0E-4) ;
913
914
915// geant3->Gsckov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
916// geant3->Gsckov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
917
918// gMC->SetCerenkov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
919// gMC->SetCerenkov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
b2501ea3 920
47d9b1cb 921}
b2501ea3 922
923//_____________________________________________________________________________
ba380e33 924void AliVZEROv2::DrawModule() const
47d9b1cb 925{
926
927// Drawing is done in DrawVZERO.C
928
254ef8f1 929 AliDebug(2,"VZERO DrawModule");
47d9b1cb 930
931}
932
b2501ea3 933//_____________________________________________________________________________
47d9b1cb 934void AliVZEROv2::Init()
935{
b2501ea3 936// Initialises version 2 of the VZERO Detector
47d9b1cb 937// Just prints an information message
938
254ef8f1 939 AliInfo(Form("VZERO version %d initialized",IsVersion()));
47d9b1cb 940
941// gMC->SetMaxStep(fMaxStepAlu);
942// gMC->SetMaxStep(fMaxStepQua);
943
944 AliVZERO::Init();
945
946}
947
47d9b1cb 948
b2501ea3 949//_____________________________________________________________________________
47d9b1cb 950void AliVZEROv2::StepManager()
951{
f359b593 952
953// Step Manager, called at each step
47d9b1cb 954
955 Int_t copy;
956 static Int_t vol[4];
c288a388 957 static Float_t hits[19];
47d9b1cb 958 static Float_t eloss, tlength;
959
960 TLorentzVector pos;
961 TLorentzVector mom;
962
963 Float_t theta;
964 Float_t phi;
f359b593 965 Float_t ringNumber;
47d9b1cb 966
967 Int_t ipart;
968 Float_t destep, step;
969
970
971// We keep only charged tracks :
972
973 if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
974
975
976 vol[0] = gMC->CurrentVolOffID(1, vol[1]);
977 vol[2] = gMC->CurrentVolID(copy);
978 vol[3] = copy;
979
d6fb41ac 980 static Int_t idV0R1 = gMC->VolId("V0R1");
981 static Int_t idV0L1 = gMC->VolId("V0L1");
982 static Int_t idV0R2 = gMC->VolId("V0R2");
983 static Int_t idV0L2 = gMC->VolId("V0L2");
984 static Int_t idV0R3 = gMC->VolId("V0R3");
985 static Int_t idV0L3 = gMC->VolId("V0L3");
986 static Int_t idV0R4 = gMC->VolId("V0R4");
987 static Int_t idV0L4 = gMC->VolId("V0L4");
988 static Int_t idV0R5 = gMC->VolId("V0R5");
989 static Int_t idV0L5 = gMC->VolId("V0L5");
990 static Int_t idV0R6 = gMC->VolId("V0R6");
991 static Int_t idV0L6 = gMC->VolId("V0L6");
992
993 if ( gMC->CurrentVolID(copy) == idV0R1 ||
994 gMC->CurrentVolID(copy) == idV0L1 )
f359b593 995 ringNumber = 1.0;
d6fb41ac 996 else if ( gMC->CurrentVolID(copy) == idV0R2 ||
997 gMC->CurrentVolID(copy) == idV0L2 )
f359b593 998 ringNumber = 2.0;
d6fb41ac 999 else if ( gMC->CurrentVolID(copy) == idV0R3 ||
1000 gMC->CurrentVolID(copy) == idV0L3 )
f359b593 1001 ringNumber = 3.0;
d6fb41ac 1002 else if ( gMC->CurrentVolID(copy) == idV0R4 ||
1003 gMC->CurrentVolID(copy) == idV0L4 )
f359b593 1004 ringNumber = 4.0;
d6fb41ac 1005 else if ( gMC->CurrentVolID(copy) == idV0R5 ||
1006 gMC->CurrentVolID(copy) == idV0L5 ||
1007 gMC->CurrentVolID(copy) == idV0R6 ||
1008 gMC->CurrentVolID(copy) == idV0L6 )
f359b593 1009 ringNumber = 5.0;
47d9b1cb 1010 else
f359b593 1011 ringNumber = 0.0;
47d9b1cb 1012
f359b593 1013 if ( ringNumber > 0.5 ) {
47d9b1cb 1014
1015 destep = gMC->Edep();
1016 step = gMC->TrackStep();
1017 eloss += destep;
1018 tlength += step;
25252ad5 1019
47d9b1cb 1020 if ( gMC->IsTrackEntering() ) {
1021
1022 gMC->TrackPosition(pos);
1023
1024 gMC->TrackMomentum(mom);
1025 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
f359b593 1026 Double_t pt = TMath::Sqrt(tc);
1027 Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
1028 theta = Float_t(TMath::ATan2(pt,Double_t(mom[2])))*kRaddeg;
25252ad5 1029 phi = Float_t(TMath::ATan2(Double_t(pos[1]),Double_t(pos[0])))*kRaddeg;
1030
1031////////////////////////////////////////////////////////////////////////////
1032 Float_t angle1 = Float_t(TMath::ATan2(Double_t(pos[1]),Double_t(pos[0])))*kRaddeg;
1033 if(angle1 < 0.0) angle1 = angle1 + 360.0;
254ef8f1 1034 //PH AliDebug(2,Form("RingNumber, copy, phi1 = %f %d %f \n", ringNumber,vol[1],angle1));
25252ad5 1035////////////////////////////////////////////////////////////////////////////
1036
47d9b1cb 1037
1038 ipart = gMC->TrackPid();
1039
1040 hits[0] = pos[0];
1041 hits[1] = pos[1];
1042 hits[2] = pos[2];
c288a388 1043 hits[3] = Float_t (ipart);
47d9b1cb 1044
1045 hits[4] = gMC->TrackTime();
1046 hits[5] = gMC->TrackCharge();
1047 hits[6] = theta;
1048 hits[7] = phi;
f359b593 1049 hits[8] = ringNumber;
47d9b1cb 1050
f359b593 1051 hits[9] = pt;
1052 hits[10] = pmom;
47d9b1cb 1053 hits[11] = mom[0];
1054 hits[12] = mom[1];
1055 hits[13] = mom[2];
c288a388 1056
5d12ce38 1057 TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
c288a388 1058 hits[14] = par->Vx();
1059 hits[15] = par->Vy();
1060 hits[16] = par->Vz();
1061
47d9b1cb 1062 tlength = 0.0;
1063 eloss = 0.0;
1064
1065 }
1066
1067 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1068
c288a388 1069 hits[17] = eloss;
1070 hits[18] = tlength;
47d9b1cb 1071
5d12ce38 1072 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
c288a388 1073
47d9b1cb 1074 tlength = 0.0;
1075 eloss = 0.0;
47d9b1cb 1076
1077 }
1078 }
1079
1080}
1081
1082//_____________________________________________________________________________
1083void AliVZEROv2::AddHit(Int_t track, Int_t *vol, Float_t *hits)
1084{
1085
f359b593 1086// Adds a VZERO hit
47d9b1cb 1087
47d9b1cb 1088 TClonesArray &lhits = *fHits;
1089 new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
1090}
1091
b2501ea3 1092//_____________________________________________________________________________
47d9b1cb 1093void AliVZEROv2::AddDigits(Int_t *tracks, Int_t* digits)
1094{
1095
f359b593 1096// Adds a VZERO digit
1097
47d9b1cb 1098 TClonesArray &ldigits = *fDigits;
1099 new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
1100}
1101
b2501ea3 1102//_____________________________________________________________________________
47d9b1cb 1103void AliVZEROv2::MakeBranch(Option_t *option)
1104{
1105
f359b593 1106// Creates new branches in the current Root Tree
1107
47d9b1cb 1108 char branchname[10];
1109 sprintf(branchname,"%s",GetName());
254ef8f1 1110 AliDebug(2,Form("fBufferSize = %d",fBufferSize));
47d9b1cb 1111
f359b593 1112 const char *cH = strstr(option,"H");
47d9b1cb 1113
f359b593 1114 if (fHits && TreeH() && cH) {
88cb7938 1115 TreeH()->Branch(branchname,&fHits, fBufferSize);
254ef8f1 1116 AliDebug(2,Form("Making Branch %s for hits",branchname));
47d9b1cb 1117 }
1118
f359b593 1119 const char *cD = strstr(option,"D");
b2501ea3 1120
f359b593 1121 if (fDigits && fLoader->TreeD() && cD) {
88cb7938 1122 fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
254ef8f1 1123 AliDebug(2,Form("Making Branch %s for digits",branchname));
47d9b1cb 1124 }
1125
1126}