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