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