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