]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROv2.cxx
Several changes:
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv2.cxx
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 2  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  26th of november 2003                         //
24 //  (circular instead of trapezoidal shapes as in previous versions //
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     //
30 //                                                                  //
31 //////////////////////////////////////////////////////////////////////
32
33 // --- Standard libraries ---
34 #include <Riostream.h>
35 #include <stdlib.h>
36 #include <string.h>
37
38 // --- ROOT libraries ---
39 #include <TClonesArray.h>
40 #include <TGeometry.h>
41 #include <TLorentzVector.h>
42 #include <TMath.h>
43 #include <TNode.h>
44 #include <TObjectTable.h>
45 #include <TTUBE.h>
46 #include <TTUBS.h>
47 #include <TVirtualMC.h>
48 #include <TParticle.h>
49
50 // --- AliRoot header files ---
51 #include "AliRun.h"
52 #include "AliMC.h"
53 #include "AliConst.h"
54 #include "AliLog.h"
55 #include "AliMagF.h"
56 #include "AliVZEROLoader.h"
57 #include "AliVZEROdigit.h"
58 #include "AliVZEROhit.h"
59 #include "AliVZEROv2.h"
60
61 ClassImp(AliVZEROv2)
62
63 //_____________________________________________________________________________
64 AliVZEROv2:: AliVZEROv2():AliVZERO()
65 {
66 // Standard default constructor 
67 }
68
69 //_____________________________________________________________________________
70 AliVZEROv2::AliVZEROv2(const char *name, const char *title):
71  AliVZERO(name,title)
72 {
73
74 // Standard constructor for V-zero Detector  version 2
75
76   AliDebug(2,"Create VZERO object");
77   
78 }
79
80 //_____________________________________________________________________________
81 void AliVZEROv2::CreateGeometry()
82 {
83
84 // Creates the GEANT geometry of the V-zero Detector  version 2
85   
86   AliDebug(2,"Create VZERO Geometry");
87       
88   Int_t    *idtmed = fIdtmed->GetArray()-2999;
89
90   Int_t    ndetR = 1;
91   Int_t    ndetL = 1;
92  
93   Int_t    ncellsR = 1;
94   Int_t    ncellsL = 1;
95   
96   Int_t    idrotm[999];
97  
98   Float_t  height1, height2, height3, height4, height5; 
99   Float_t  height;
100   Float_t  theta;  
101   
102   Float_t  halfThickQua;
103   
104   Float_t  zdet;
105   Float_t  r0, r5;
106   Float_t  pi = TMath::Pi();
107     
108   height1     =     1.82;         // height of cell 1, in cm
109   height2     =     3.81;         // height of cell 2, in cm
110   height3     =     4.72;         // height of cell 3, in cm
111   height4     =     7.12;         // height of cell 4, in cm
112   height5     =    10.83;         // height of cell 5, in cm
113   
114   theta       = pi/6.0/2.0;       // half angular opening = 15 degrees
115     
116   halfThickQua= fThickness1/2.0;  // half thickness of elementary cell (inner ring)
117   
118 // distance 0.6 cm in zdet accounts for the fact V0R box back lid sits 0.6 away from 
119 // absorber nose sitting at 90 cm. Will use -zdet later...
120    
121   zdet        =    90.0 - 0.6 -fThickness/2.0;  // distance to vertex (along Z axis)   
122   r0          =    4.05;          // closest distance to center of the beam pipe
123   height      =    height1 + height2 + height3 + height4 + height5;
124   r5          =    r0 + height;
125
126 // Creation of mother volume v0LE - left part - :
127 // Entrance face at  +350.0 cm  (new coordinate system) ...
128
129    Float_t   partube[3];
130    
131    partube[0] =  4.3;
132    partube[1] = 45.0;
133    partube[2] = fThickness1/2.0;   
134     
135    gMC->Gsvolu("V0LE","TUBE",idtmed[3005],partube,3);
136      
137 // Creation of five rings - left part - :
138 // Entrance face at +350.0 cm  (new coordinate system) ... 
139
140 // Mother volume v0L0 in which will be set 5 scintillator cells 
141
142   Float_t   partubs[5];  
143     
144   Float_t   r0Left      =   4.3;   
145   Float_t   height1Left =   2.6; 
146   Float_t   height2Left =   4.1;
147   Float_t   height3Left =   6.4;
148   Float_t   height4Left =  10.2;
149   Float_t   height5Left =  16.9;
150   Float_t   heightLeft  = height1Left + height2Left + height3Left 
151                                       + height4Left + height5Left;
152   Float_t   r5Left      = r0Left  + heightLeft; 
153   
154   partubs[0]      =  r0Left;
155   partubs[1]      =  r5Left;
156   partubs[2]      =  fThickness1/2.0;
157   partubs[3]      =  90.0-15.0;
158   partubs[4]      = 120.0-15.0;
159
160   gMC->Gsvolu("V0L0","TUBS",idtmed[3010],partubs,5);  // air volume
161   
162   Float_t  r1Left =  r0Left + height1Left;        
163      
164   partubs[0]     =  r0Left;
165   partubs[1]     =  r1Left;
166
167   gMC->Gsvolu("V0L1","TUBS",idtmed[3005],partubs,5);  // quartz volume
168   gMC->Gspos("V0L1",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY"); 
169
170   Float_t   r2Left  =   r1Left + height2Left;       
171   
172   partubs[0]     =  r1Left;
173   partubs[1]     =  r2Left;
174
175   gMC->Gsvolu("V0L2","TUBS",idtmed[3005],partubs,5);  // quartz volume
176   gMC->Gspos("V0L2",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY"); 
177   
178   Float_t   r3Left =   r2Left + height3Left;
179    
180   partubs[0]     =  r2Left;
181   partubs[1]     =  r3Left;
182
183   gMC->Gsvolu("V0L3","TUBS",idtmed[3005],partubs,5);  // quartz volume
184   gMC->Gspos("V0L3",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
185   
186   Float_t   r4Left =  r3Left + height4Left;
187    
188   partubs[0]     =  r3Left;
189   partubs[1]     =  r4Left;
190
191   gMC->Gsvolu("V0L4","TUBS",idtmed[3005],partubs,5);  // quartz volume
192   gMC->Gspos("V0L4",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
193
194   partubs[0]     =  r4Left;
195   partubs[1]     =  r5Left;
196   partubs[3]     =  90.0-15.0;
197   partubs[4]     = 120.0-30.0;
198   
199   gMC->Gsvolu("V0L5","TUBS",idtmed[3005],partubs,5);  // quartz volume
200   gMC->Gspos("V0L5",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
201   
202   partubs[3]     = 120.0-30.0;
203   partubs[4]     = 120.0-15.0;
204   
205   gMC->Gsvolu("V0L6","TUBS",idtmed[3005],partubs,5);  // quartz volume
206   gMC->Gspos("V0L6",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
207   
208
209 // Creation of mother volume v0RI - right part - :
210   
211   partube[0] = r0 - 0.2;
212   partube[1] = r5 + 1.0;
213   partube[2] = fThickness/2.0; 
214       
215   gMC->Gsvolu("V0RI","TUBE",idtmed[3010],partube,3);
216   
217 // Creation of  carbon lids (2 mm thick) to keep v0RI box shut...
218
219   Float_t  lidThickness = 0.2;
220  
221   partube[0] =   r0;
222   partube[1] =   r5;
223   partube[2] =   +lidThickness/2.0;
224     
225   gMC->Gsvolu("V0CA","TUBE",idtmed[3001],partube,3); 
226   gMC->Gspos("V0CA",1,"V0RI",0.0,0.0, fThickness/2.0-partube[2],0,"ONLY");
227   gMC->Gspos("V0CA",2,"V0RI",0.0,0.0,-fThickness/2.0+partube[2],0,"ONLY");
228   
229 // Creation of aluminum rings to maintain the v0RI pieces ...
230
231   partube[0] =   r0 - 0.2;
232   partube[1] =   r0;
233   partube[2] =   +fThickness/2.0;
234    
235   gMC->Gsvolu("V0IR","TUBE",idtmed[3003],partube,3);    
236   gMC->Gspos("V0IR",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
237
238   partube[0] =   r5;
239   partube[1] =   r5 + 1.0;
240   partube[2] =   +fThickness/2.0;
241  
242   gMC->Gsvolu("V0ER","TUBE",idtmed[3003],partube,3);    
243   gMC->Gspos("V0ER",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
244   
245 // Mother volume v0R0 in which will be set 5  scintillator cells 
246   
247   partubs[0]      =  r0;
248   partubs[1]      =  r5;
249   partubs[2]      =  fThickness/2.0;
250   partubs[3]      =  90.0-15.0;
251   partubs[4]      = 120.0-15.0;
252
253   gMC->Gsvolu("V0R0","TUBS",idtmed[3010],partubs,5);  // air volume 
254
255 // Elementary cell of ring 1 :
256 // (cells 2 and 3  will be shifted by 1 cm to output fibers) 
257    
258   Float_t   offsetFibers  =  1.0;
259   Float_t   offset        =  fThickness/2.0 - lidThickness - fThickness1/2.0; 
260   Float_t   r1            =  r0 + height1;
261       
262   partubs[0]     =  r0;
263   partubs[1]     =  r1;
264   partubs[2]     =  fThickness1/2.0;
265   
266   gMC->Gsvolu("V0R1","TUBS",idtmed[3005],partubs,5);  // scintillator volume
267   gMC->Gspos("V0R1",1,"V0R0", 0.0, 0.0 , -offset, 0,"ONLY"); 
268
269 // Elementary cell of ring 2 :
270
271   Float_t   r2   =  r1 + height2;       
272   
273   partubs[0]     =  r1;
274   partubs[1]     =  r2;
275
276   gMC->Gsvolu("V0R2","TUBS",idtmed[3005],partubs,5);  // scintillator volume
277   gMC->Gspos("V0R2",1,"V0R0", 0.0, 0.0 , -offset + offsetFibers, 0,"ONLY"); 
278
279
280 // Elementary cell of ring 3 :
281   
282   Float_t   r3   =  r2 + height3;
283    
284   partubs[0]     =  r2;
285   partubs[1]     =  r3;
286
287   gMC->Gsvolu("V0R3","TUBS",idtmed[3005],partubs,5);  // scintillator volume
288   gMC->Gspos("V0R3",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
289
290 // Elementary cell of ring 4 :
291   
292   Float_t   r4   =  r3 + height4 ;
293   
294   partubs[0]     =  r3;
295   partubs[1]     =  r4;
296
297   gMC->Gsvolu("V0R4","TUBS",idtmed[3005],partubs,5);  // scintillator volume
298   gMC->Gspos("V0R4",1,"V0R0", 0.0, 0.0 ,  -offset + 2.0 * offsetFibers, 0,"ONLY");
299
300 // Elementary cells of ring 5 :
301
302   partubs[0]     =  r4;
303   partubs[1]     =  r5;
304   partubs[3]     =  90.0-15.0;
305   partubs[4]     = 120.0-30.0;
306   
307   gMC->Gsvolu("V0R5","TUBS",idtmed[3005],partubs,5);  // scintillator volume
308   gMC->Gspos("V0R5",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");  
309
310   partubs[3]     = 120.0-30.0;
311   partubs[4]     = 120.0-15.0;
312   
313   gMC->Gsvolu("V0R6","TUBS",idtmed[3005],partubs,5);  // scintillator volume
314   gMC->Gspos("V0R6",1,"V0R0", 0.0, 0.0 ,  -offset + 2.0 * offsetFibers, 0,"ONLY");
315    
316   Float_t  phiDeg = 180./6.; 
317
318 // Right part : 
319  
320   for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phiDeg)
321       {        
322         AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
323         gMC->Gspos("V0R0",ndetR,"V0RI",0.0,
324                           0.0,0.0,idrotm[902],"ONLY");
325         ndetR++;
326        }
327
328   gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,-zdet,0,"ONLY");
329  
330   ncellsR = (ndetR - 1) * 6;  
331   AliInfo(Form("Number of cells on Right side =   %d",  ncellsR));    
332
333 // Left part :
334
335   for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phiDeg)
336       {       
337         AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
338         gMC->Gspos("V0L0",ndetL,"V0LE",0.0,
339                           0.0,0.0,idrotm[902],"ONLY");
340         ndetL++;
341        }
342
343   gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,350.0+fThickness1/2.0,0,"ONLY");
344  
345   ncellsL = (ndetL - 1) * 6;
346   AliInfo(Form("Number of cells on Left side  =   %d",  ncellsL));    
347            
348 }            
349     
350 //_____________________________________________________________________________
351 void AliVZEROv2::CreateMaterials()
352 {
353
354 // Creates materials used for geometry 
355
356     AliDebug(2,"VZERO create materials");
357     
358 /*
359     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, 
360                            6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
361
362            
363     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, 
364                                6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
365                            
366     Float_t rindex_quarz[14] = { 1.52398,  1.53090, 1.53835, 1.54641, 1.55513, 1.56458, 
367                                  1.57488,  1.58611, 1.59842, 1.61197, 1.62696, 1.64362, 
368                                  1.662295, 1.68337 };
369                                  
370     Float_t absco_quarz[14] = { 105.8,  45.656, 35.665, 28.598, 25.007, 21.04, 17.525, 
371                                 14.177, 9.282, 4.0925, 1.149, 0.3627, 0.1497, 0.05 };   
372                                                                                         
373     Float_t effic_all[14]   = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
374     
375         
376     Float_t rindex_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. }; 
377     
378     
379     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,
380                                1e-4,1e-4,1e-4,1e-4 };
381     Float_t effic_alu[14]  = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
382
383 */        
384
385     Int_t *idtmed = fIdtmed->GetArray()-2999;
386     
387     
388 //  Parameters related to Quarz (SiO2) :
389  
390     Float_t aqua[2], zqua[2], densqua, wmatqua[2];
391     Int_t nlmatqua;
392     
393     aqua[0]    = 28.09;
394     aqua[1]    = 16.;
395     zqua[0]    = 14.;
396     zqua[1]    = 8.;
397     densqua    = 2.64;
398     nlmatqua   = -2;
399     wmatqua[0] = 1.;
400     wmatqua[1] = 2.;
401
402 // Parameters  related to aluminum sheets :
403     
404     Float_t  aal   = 26.98;
405     Float_t  zal   = 13.00; 
406     Float_t  densal=   2.7; 
407     Float_t  radlal=   8.9;
408        
409 // Parameters  related to scintillator CH :
410     
411     Float_t ascin[2] = {1.00794,12.011};
412     Float_t zscin[2] = {1.,6.};
413     Float_t wscin[2] = {1.,1.};
414     Float_t denscin  = 1.032;
415
416 // AIR
417
418     Float_t aAir[4]={12.,14.,16.,36.};
419     Float_t zAir[4]={6.,7.,8.,18.};
420     Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
421     Float_t dAir = 1.20479E-3;
422         
423 //  Definition of materials :
424        
425     AliMixture( 1, "AIR A$", aAir,zAir,dAir,4,wAir);
426     AliMixture(11, "AIR I$", aAir,zAir,dAir,4,wAir);
427     AliMaterial( 2, "CARBON$"  , 12.01, 6.0, 2.265, 18.8, 49.9, 0, 0);
428     AliMixture(  3, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
429     AliMaterial( 4, "ALUMINIUM1$", 26.98, 13., 2.7, 8.9, 37.2, 0, 0);
430     AliMaterial( 5, "ALUMINIUM2$", aal, zal, densal, radlal, 0, 0, 0);
431  
432     AliMixture( 6, "Scintillator$",ascin,zscin,denscin,-2,wscin);
433     
434      
435     Int_t   iSXFLD = gAlice->Field()->Integ();
436     Float_t sXMGMX = gAlice->Field()->Max();
437     
438     Float_t tmaxfd, stemax, deemax, epsil, stmin;
439         
440     tmaxfd = 10.;
441     stemax = 0.1;
442     deemax = 0.1;     
443     epsil  = 0.001;
444     stmin  = 0.001;
445   
446 //  Active Air :    
447     AliMedium(1, "ACTIVE AIR$", 1, 1, iSXFLD, sXMGMX,
448               10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
449
450 //  Inactive air : 
451   
452     AliMedium(11, "INACTIVE AIR$", 11, 0, iSXFLD, sXMGMX,
453               10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
454     
455     AliMedium(2, "CARBON$ ", 2,  1, iSXFLD, sXMGMX,
456               tmaxfd, stemax, deemax, epsil, stmin, 0, 0);   
457
458     AliMedium(3, "QUARZ$", 3, 1, iSXFLD, sXMGMX,
459               tmaxfd, fMaxStepQua, fMaxDestepQua, epsil, stmin, 0, 0);
460     
461     AliMedium(4,"ALUMINUM1$",4, 1, iSXFLD, sXMGMX,
462               tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
463               
464
465     AliMedium(5,"ALUMINUM2$",5, 1, iSXFLD, sXMGMX,
466               tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);    
467
468     AliMedium(6,"SCINTILLATOR$",6, 1, iSXFLD, sXMGMX, 10.0, 0.1, 0.1, 0.003, 0.003, 0, 0);
469
470     gMC->Gstpar(idtmed[3000], "LOSS", 1.);  //  [3000] = air ACTIF  [3010] = air INACTIF
471     gMC->Gstpar(idtmed[3000], "HADR", 1.);
472     gMC->Gstpar(idtmed[3000], "DCAY", 1.);
473     gMC->Gstpar(idtmed[3000], "DRAY", 1.);
474     
475     gMC->Gstpar(idtmed[3001], "LOSS", 1.);  //  [3001] = carbon
476     gMC->Gstpar(idtmed[3001], "HADR", 1.);
477     gMC->Gstpar(idtmed[3001], "DCAY", 1.);
478     gMC->Gstpar(idtmed[3001], "DRAY", 1.);
479
480     gMC->Gstpar(idtmed[3002], "LOSS", 1.);  //  [3002] = quartz
481     gMC->Gstpar(idtmed[3002], "HADR", 1.);
482     gMC->Gstpar(idtmed[3002], "DCAY", 1.);
483     gMC->Gstpar(idtmed[3002], "DRAY", 1.);  
484     gMC->Gstpar(idtmed[3002], "CUTGAM",0.5E-4) ; 
485     gMC->Gstpar(idtmed[3002], "CUTELE",1.0E-4) ;
486     
487     gMC->Gstpar(idtmed[3003], "LOSS", 1.);  //  [3003] = normal aluminum
488     gMC->Gstpar(idtmed[3003], "HADR", 1.);
489     gMC->Gstpar(idtmed[3003], "DCAY", 1.);
490     gMC->Gstpar(idtmed[3003], "DRAY", 1.);
491     
492     gMC->Gstpar(idtmed[3004], "LOSS", 1.);  //  [3004] = reflecting aluminum
493     gMC->Gstpar(idtmed[3004], "HADR", 1.);
494     gMC->Gstpar(idtmed[3004], "DCAY", 1.);
495     gMC->Gstpar(idtmed[3004], "DRAY", 1.);
496     gMC->Gstpar(idtmed[3004], "CUTGAM",0.5E-4) ; 
497     gMC->Gstpar(idtmed[3004], "CUTELE",1.0E-4) ;
498     
499     gMC->Gstpar(idtmed[3005], "LOSS", 1.);  //  [3005] = scintillator
500     gMC->Gstpar(idtmed[3005], "HADR", 1.);
501     gMC->Gstpar(idtmed[3005], "DCAY", 1.);
502     gMC->Gstpar(idtmed[3005], "DRAY", 1.); 
503     gMC->Gstpar(idtmed[3005], "CUTGAM",0.5E-4) ; 
504     gMC->Gstpar(idtmed[3005], "CUTELE",1.0E-4) ;
505       
506     
507 //    geant3->Gsckov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);    
508 //    geant3->Gsckov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
509
510 //    gMC->SetCerenkov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);    
511 //    gMC->SetCerenkov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
512                                        
513 }
514
515 //_____________________________________________________________________________
516 void AliVZEROv2::DrawModule() const
517 {
518
519 //  Drawing is done in DrawVZERO.C
520
521    AliDebug(2,"VZERO DrawModule");
522
523 }
524
525 //_____________________________________________________________________________
526 void AliVZEROv2::Init()
527 {
528 // Initialises version 2 of the VZERO Detector
529 // Just prints an information message
530   
531    AliInfo(Form("VZERO version %d initialized",IsVersion()));
532    
533 //   gMC->SetMaxStep(fMaxStepAlu);
534 //   gMC->SetMaxStep(fMaxStepQua);
535    
536     AliVZERO::Init();
537   
538 }
539
540
541 //_____________________________________________________________________________
542 void AliVZEROv2::StepManager()
543 {
544  
545 // Step Manager, called at each step 
546    
547      Int_t     copy;
548      static    Int_t   vol[4];
549      static    Float_t hits[19];
550      static    Float_t eloss, tlength;
551      
552      TLorentzVector pos;     
553      TLorentzVector mom;
554      
555      Float_t        theta;
556      Float_t        phi;
557      Float_t        ringNumber;
558
559      Int_t          ipart;
560      Float_t        destep, step;
561           
562
563 //   We keep only charged tracks :
564      
565      if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return; 
566
567
568      vol[0]    = gMC->CurrentVolOffID(1, vol[1]);
569      vol[2]    = gMC->CurrentVolID(copy);
570      vol[3]    = copy;
571      
572      static Int_t idV0R1 = gMC->VolId("V0R1");
573      static Int_t idV0L1 = gMC->VolId("V0L1");
574      static Int_t idV0R2 = gMC->VolId("V0R2");
575      static Int_t idV0L2 = gMC->VolId("V0L2");
576      static Int_t idV0R3 = gMC->VolId("V0R3");
577      static Int_t idV0L3 = gMC->VolId("V0L3");
578      static Int_t idV0R4 = gMC->VolId("V0R4");
579      static Int_t idV0L4 = gMC->VolId("V0L4");
580      static Int_t idV0R5 = gMC->VolId("V0R5");
581      static Int_t idV0L5 = gMC->VolId("V0L5");
582      static Int_t idV0R6 = gMC->VolId("V0R6");
583      static Int_t idV0L6 = gMC->VolId("V0L6");
584
585      if      ( gMC->CurrentVolID(copy) == idV0R1 ||
586                gMC->CurrentVolID(copy) == idV0L1 )
587                ringNumber = 1.0;
588      else if ( gMC->CurrentVolID(copy) == idV0R2 ||
589                gMC->CurrentVolID(copy) == idV0L2 ) 
590                ringNumber = 2.0;  
591      else if ( gMC->CurrentVolID(copy) == idV0R3 ||
592                gMC->CurrentVolID(copy) == idV0L3 )
593                ringNumber = 3.0;
594      else if ( gMC->CurrentVolID(copy) == idV0R4 ||
595                gMC->CurrentVolID(copy) == idV0L4 )       
596                ringNumber = 4.0; 
597      else if ( gMC->CurrentVolID(copy) == idV0R5 ||
598                gMC->CurrentVolID(copy) == idV0L5 ||
599                gMC->CurrentVolID(copy) == idV0R6 ||
600                gMC->CurrentVolID(copy) == idV0L6 )        
601                ringNumber = 5.0; 
602      else
603                ringNumber = 0.0;
604
605      if  (  ringNumber > 0.5  ) { 
606      
607         destep    = gMC->Edep();
608         step      = gMC->TrackStep();
609         eloss    += destep;
610         tlength  += step; 
611
612         if  ( gMC->IsTrackEntering()  )  {  
613        
614             gMC->TrackPosition(pos);
615      
616             gMC->TrackMomentum(mom);      
617             Double_t tc   = mom[0]*mom[0]+mom[1]*mom[1];
618             Double_t pt   = TMath::Sqrt(tc);
619             Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
620             theta   = Float_t(TMath::ATan2(pt,Double_t(mom[2])))*kRaddeg;
621             phi     = Float_t(TMath::ATan2(Double_t(pos[1]),Double_t(pos[0])))*kRaddeg;
622
623 ////////////////////////////////////////////////////////////////////////////         
624      Float_t angle1 = Float_t(TMath::ATan2(Double_t(pos[1]),Double_t(pos[0])))*kRaddeg;
625      if(angle1 < 0.0) angle1 = angle1 + 360.0;
626      //PH     AliDebug(2,Form("RingNumber, copy, phi1  = %f %d %f \n", ringNumber,vol[1],angle1)); 
627 ////////////////////////////////////////////////////////////////////////////    
628                  
629      
630             ipart  = gMC->TrackPid();
631
632             hits[0]  = pos[0];
633             hits[1]  = pos[1];
634             hits[2]  = pos[2];           
635             hits[3]  =  Float_t (ipart); 
636
637             hits[4]  = gMC->TrackTime();
638             hits[5]  = gMC->TrackCharge();
639             hits[6]  = theta;
640             hits[7]  = phi;
641             hits[8]  = ringNumber;
642          
643             hits[9]  = pt;
644             hits[10] = pmom;
645             hits[11] = mom[0];
646             hits[12] = mom[1];
647             hits[13] = mom[2];
648             
649             TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
650             hits[14] = par->Vx();
651             hits[15] = par->Vy();
652             hits[16] = par->Vz();
653             
654             tlength  = 0.0;
655             eloss    = 0.0;
656             
657          }
658          
659          if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
660          
661          hits[17] =   eloss;
662          hits[18] = tlength;
663          
664          AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
665                  
666          tlength  = 0.0;
667          eloss    = 0.0; 
668           
669          } 
670     }
671       
672 }
673
674 //_____________________________________________________________________________
675 void AliVZEROv2::AddHit(Int_t track, Int_t *vol, Float_t *hits)
676 {
677   
678 //  Adds a VZERO hit
679   
680   TClonesArray &lhits = *fHits;
681   new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
682 }
683
684 //_____________________________________________________________________________
685 void AliVZEROv2::AddDigits(Int_t *tracks, Int_t* digits) 
686 {
687
688 //  Adds a VZERO digit
689
690    TClonesArray  &ldigits = *fDigits;
691    new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
692 }
693
694 //_____________________________________________________________________________
695 void AliVZEROv2::MakeBranch(Option_t *option)
696 {
697   
698 // Creates new branches in the current Root Tree
699     
700   char branchname[10];
701   sprintf(branchname,"%s",GetName());
702   AliDebug(2,Form("fBufferSize = %d",fBufferSize));
703   
704   const char *cH = strstr(option,"H");
705   
706   if (fHits   && TreeH() && cH) {
707     TreeH()->Branch(branchname,&fHits, fBufferSize);
708     AliDebug(2,Form("Making Branch %s for hits",branchname));
709   }     
710
711   const char *cD = strstr(option,"D");
712   
713   if (fDigits   && fLoader->TreeD() && cD) {
714     fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
715     AliDebug(2,Form("Making Branch %s for digits",branchname));
716   }  
717    
718 }