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