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