Removing obsolete includes of TGeant3.h
[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 "AliMagF.h"
55 #include "AliVZEROLoader.h"
56 #include "AliVZEROdigit.h"
57 #include "AliVZEROhit.h"
58 #include "AliVZEROv2.h"
59
60 ClassImp(AliVZEROv2)
61
62 //_____________________________________________________________________________
63 AliVZEROv2:: AliVZEROv2():AliVZERO()
64 {
65 // Standard default constructor 
66 }
67
68 //_____________________________________________________________________________
69 AliVZEROv2::AliVZEROv2(const char *name, const char *title):
70  AliVZERO(name,title)
71 {
72
73 // Standard constructor for V-zero Detector  version 2
74
75   Int_t i;
76
77   printf("\n");
78   for(i=0;i<26;i++) printf("*");
79   printf(" Create VZERO object ");
80   for(i=0;i<26;i++) printf("*");
81   printf("\n");
82   
83 }
84
85 //_____________________________________________________________________________
86 void AliVZEROv2::CreateGeometry()
87 {
88
89 // Creates the GEANT geometry of the V-zero Detector  version 2
90   
91   Int_t i;
92   
93   printf("\n");
94   for(i=0;i<26;i++) printf("*");
95   printf(" Create VZERO Geometry ");
96   for(i=0;i<26;i++) printf("*");
97   printf("\n");
98       
99   Int_t    *idtmed = fIdtmed->GetArray()-2999;
100
101   Int_t    ndetR = 1;
102   Int_t    ndetL = 1;
103  
104   Int_t    ncellsR = 1;
105   Int_t    ncellsL = 1;
106   
107   Int_t    idrotm[999];
108  
109   Float_t  height1, height2, height3, height4, height5; 
110   Float_t  height;
111   Float_t  theta;  
112   
113   Float_t  halfThickQua;
114   
115   Float_t  zdet;
116   Float_t  r0, r5;
117   Float_t  pi = TMath::Pi();
118     
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
124   
125   theta       = pi/6.0/2.0;       // half angular opening = 15 degrees
126     
127   halfThickQua= fThickness1/2.0;  // half thickness of elementary cell (inner ring)
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)   
133   r0          =    4.05;          // closest distance to center of the beam pipe
134   height      =    height1 + height2 + height3 + height4 + height5;
135   r5          =    r0 + height;
136
137 // Creation of mother volume v0LE - left part - :
138 // Entrance face at  +350.0 cm  (new coordinate system) ...
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);
147      
148 // Creation of five rings - left part - :
149 // Entrance face at +350.0 cm  (new coordinate system) ... 
150
151 // Mother volume v0L0 in which will be set 5 scintillator cells 
152
153   Float_t   partubs[5];  
154     
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;
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   
173   Float_t  r1Left =  r0Left + height1Left;        
174      
175   partubs[0]     =  r0Left;
176   partubs[1]     =  r1Left;
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
181   Float_t   r2Left  =   r1Left + height2Left;       
182   
183   partubs[0]     =  r1Left;
184   partubs[1]     =  r2Left;
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   
189   Float_t   r3Left =   r2Left + height3Left;
190    
191   partubs[0]     =  r2Left;
192   partubs[1]     =  r3Left;
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   
197   Float_t   r4Left =  r3Left + height4Left;
198    
199   partubs[0]     =  r3Left;
200   partubs[1]     =  r4Left;
201
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
205   partubs[0]     =  r4Left;
206   partubs[1]     =  r5Left;
207   partubs[3]     =  90.0-15.0;
208   partubs[4]     = 120.0-30.0;
209   
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   
213   partubs[3]     = 120.0-30.0;
214   partubs[4]     = 120.0-15.0;
215   
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
220 // Creation of mother volume v0RI - right part - :
221   
222   partube[0] = r0 - 0.2;
223   partube[1] = r5 + 1.0;
224   partube[2] = fThickness/2.0; 
225       
226   gMC->Gsvolu("V0RI","TUBE",idtmed[3010],partube,3);
227   
228 // Creation of  carbon lids (2 mm thick) to keep v0RI box shut...
229
230   Float_t  lidThickness = 0.2;
231  
232   partube[0] =   r0;
233   partube[1] =   r5;
234   partube[2] =   +lidThickness/2.0;
235     
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   
240 // Creation of aluminum rings to maintain the v0RI pieces ...
241
242   partube[0] =   r0 - 0.2;
243   partube[1] =   r0;
244   partube[2] =   +fThickness/2.0;
245    
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  
253   gMC->Gsvolu("V0ER","TUBE",idtmed[3003],partube,3);    
254   gMC->Gspos("V0ER",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
255   
256 // Mother volume v0R0 in which will be set 5  scintillator cells 
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
264   gMC->Gsvolu("V0R0","TUBS",idtmed[3010],partubs,5);  // air volume 
265
266 // Elementary cell of ring 1 :
267 // (cells 2 and 3  will be shifted by 1 cm to output fibers) 
268    
269   Float_t   offsetFibers  =  1.0;
270   Float_t   offset        =  fThickness/2.0 - lidThickness - fThickness1/2.0; 
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
278   gMC->Gspos("V0R1",1,"V0R0", 0.0, 0.0 , -offset, 0,"ONLY"); 
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
288   gMC->Gspos("V0R2",1,"V0R0", 0.0, 0.0 , -offset + offsetFibers, 0,"ONLY"); 
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
299   gMC->Gspos("V0R3",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");
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
309   gMC->Gspos("V0R4",1,"V0R0", 0.0, 0.0 ,  -offset + 2.0 * offsetFibers, 0,"ONLY");
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   
318   gMC->Gsvolu("V0R5","TUBS",idtmed[3005],partubs,5);  // scintillator volume
319   gMC->Gspos("V0R5",1,"V0R0", 0.0, 0.0 , -offset + 2.0 * offsetFibers, 0,"ONLY");  
320
321   partubs[3]     = 120.0-30.0;
322   partubs[4]     = 120.0-15.0;
323   
324   gMC->Gsvolu("V0R6","TUBS",idtmed[3005],partubs,5);  // scintillator volume
325   gMC->Gspos("V0R6",1,"V0R0", 0.0, 0.0 ,  -offset + 2.0 * offsetFibers, 0,"ONLY");
326    
327   Float_t  phiDeg = 180./6.; 
328
329 // Right part : 
330  
331   for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phiDeg)
332       {        
333         AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
334         gMC->Gspos("V0R0",ndetR,"V0RI",0.0,
335                           0.0,0.0,idrotm[902],"ONLY");
336         ndetR++;
337        }
338
339   gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,-zdet,0,"ONLY");
340  
341   ncellsR = (ndetR - 1) * 6;  
342   printf("    Number of cells on Right side =   %d\n",  ncellsR);    
343
344 // Left part :
345
346   for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phiDeg)
347       {       
348         AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
349         gMC->Gspos("V0L0",ndetL,"V0LE",0.0,
350                           0.0,0.0,idrotm[902],"ONLY");
351         ndetL++;
352        }
353
354   gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,350.0+fThickness1/2.0,0,"ONLY");
355  
356   ncellsL = (ndetL - 1) * 6;
357   printf("    Number of cells on Left side  =   %d\n",  ncellsL);    
358   for(i=0;i<75;i++) printf("*");
359   printf("\n");
360            
361 }
362             
363 //_____________________________________________________________________________
364 void AliVZEROv2::BuildGeometry()
365 {
366   
367 // Builds simple ROOT TNode geometry for event display
368
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");
376
377   TNode *top; 
378
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;
383    
384   const int kColorVZERO  = kGreen;
385  
386   top = gAlice->GetGeometry()->GetNode("alice");
387
388   Float_t  height1, height2, height3, height4, height5; 
389   Float_t  height;
390   Float_t  theta;  
391   
392   Float_t  halfThickQua;
393   Float_t  zdet;
394   Float_t  r0, r5;
395   Float_t  pi = TMath::Pi();
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
403   theta             =    pi/6.0/2.0;    
404    
405   halfThickQua    =    fThickness1/2.0; 
406   
407   zdet              =    90.0 - 0.6 - fThickness/2.0;   
408   r0                =    4.05;         
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   
420   TTUBE *v0RI = new TTUBE("V0RI", "V0RI", "void", partube[0], partube[1], partube[2]);
421                 
422   top->cd();
423   
424   v0Rnode = new TNode("V0RI","V0RI",v0RI,0.0,0.0,-zdet,0);
425   
426   v0Rnode->SetLineColor(kYellow);
427   fNodes->Add(v0Rnode);  
428   v0Rnode->SetVisibility(2);     
429  
430 // Rondelles de carbone (epaisseur 2 mm) de maintien des cellules ...
431
432   Float_t  lidThickness = 0.2;
433   
434   partube[0] =   r0;
435   partube[1] =   r5;
436   partube[2] =   +lidThickness/2.0;
437   
438   TTUBE  *v0CA = new TTUBE("V0CA", "V0CA", "void",partube[0], partube[1], partube[2]);
439   
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);
448   
449   partube[0] =   r0 - 0.2;
450   partube[1] =   r0;
451   partube[2] =   +fThickness/2.0;
452   
453   TTUBE *v0IR = new TTUBE("V0IR","V0IR","void", partube[0], partube[1], partube[2]);
454  
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);
459
460   partube[0] =   r5;
461   partube[1] =   r5 + 1.0; 
462   partube[2] =   +fThickness/2.0;
463
464   TTUBE  *v0ER = new TTUBE("V0ER","V0ER","void", partube[0], partube[1], partube[2]);
465   
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);
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
479   TTUBS  *v0R0 = new TTUBS("V0R0", "V0R0", "void",partubs[0], partubs[1], partubs[2], 
480                                                   partubs[3], partubs[4]); 
481                                                   
482   v0R0->SetNumberOfDivisions(ndiv);                                               
483
484   Float_t   r1     =  r0 + height1;
485   Float_t   offset = fThickness/2.0 - lidThickness - fThickness1/2.0; 
486   Float_t   offsetFibers = 1.0;
487     
488   partubs[0]     =  r0;
489   partubs[1]     =  r1;
490   partubs[2]     =  fThickness1/2.0;
491
492   TTUBS *v0R1 = new TTUBS("V0R1", "V0R1", "void", partubs[0], partubs[1], partubs[2], 
493                                                   partubs[3], partubs[4]);
494
495   v0R1->SetNumberOfDivisions(ndiv);
496   
497   Float_t   r2   =  r1 + height2;       
498   
499   partubs[0]     =  r1;
500   partubs[1]     =  r2;
501
502   TTUBS *v0R2 = new TTUBS("V0R2", "V0R2", "void", partubs[0], partubs[1], partubs[2], 
503                                                   partubs[3], partubs[4]);
504
505   v0R2->SetNumberOfDivisions(ndiv);
506   
507   Float_t   r3   =  r2 + height3;
508    
509   partubs[0]     =  r2;
510   partubs[1]     =  r3;
511   
512   TTUBS *v0R3 = new TTUBS("V0R3", "V0R3", "void", partubs[0], partubs[1], partubs[2], 
513                                                   partubs[3], partubs[4]);
514   v0R3->SetNumberOfDivisions(ndiv);
515  
516   Float_t   r4   =  r3 + height4;
517    
518   partubs[0]     =  r3;
519   partubs[1]     =  r4;
520
521   TTUBS *v0R4 = new TTUBS("V0R4", "V0R4", "void", partubs[0], partubs[1], partubs[2], 
522                                                   partubs[3], partubs[4]);
523
524   v0R4->SetNumberOfDivisions(ndiv);
525
526   partubs[0]     =  r4;
527   partubs[1]     =  r5;
528   partubs[3]     =  90.0-15.0;
529   partubs[4]     = 120.0-30.0;
530   
531   TTUBS *v0R5 = new TTUBS("V0R5", "V0R5", "void", partubs[0], partubs[1], partubs[2], 
532                                                   partubs[3], partubs[4]);
533
534   v0R5->SetNumberOfDivisions(ndiv);
535
536   partubs[3]     = 120.0-30.0;
537   partubs[4]     = 120.0-15.0;
538   
539   TTUBS *v0R6 = new TTUBS("V0R6", "V0R6", "void", partubs[0], partubs[1], partubs[2], 
540                                                   partubs[3], partubs[4]);
541                                                   
542   v0R6->SetNumberOfDivisions(ndiv);
543                 
544   Float_t  phi;
545   Float_t  phiDeg= 180./6.;
546     
547   Int_t    ndetR = 1; 
548
549   char     nameNode[12];  
550  
551   for (phi = 15.0; phi < 360.0; phi = phi + phiDeg)
552   
553   {
554      
555     TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );        
556      
557     sprintf(nameNode,"SUBDER%d",ndetR);
558     
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++;
564     
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++;
571     
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();    
588     v0Rnode4 = new TNode(nameNode,nameNode,v0R4,0.0,0.0, -offset + 2.0*offsetFibers,0);  
589     v0Rnode4->SetLineColor(kColorVZERO);
590     fNodes->Add(v0Rnode4);
591     ndetR++;
592      
593     sprintf(nameNode,"SUBDER%d",ndetR);
594     v0Rnode0->cd();    
595     v0Rnode5 = new TNode(nameNode,nameNode,v0R5,0.0,0.0, -offset + 2.0*offsetFibers,0);  
596     v0Rnode5->SetLineColor(kColorVZERO);
597     fNodes->Add(v0Rnode5);
598     ndetR++;
599     
600     sprintf(nameNode,"SUBDER%d",ndetR);
601     v0Rnode0->cd();    
602     v0Rnode6 = new TNode(nameNode,nameNode,v0R6,0.0,0.0, -offset + 2.0*offsetFibers,0);  
603     v0Rnode6->SetLineColor(kColorVZERO);
604     fNodes->Add(v0Rnode6);
605     ndetR++;
606        
607     v0Rnode0->SetVisibility(2);
608     
609   }    
610
611 // Left side of VZERO :
612      
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;
625   partube[2] =  fThickness1/2.0; 
626   
627   TTUBE *v0LE = new TTUBE("V0LE", "V0LE", "void", partube[0], partube[1], partube[2]);
628                 
629   top->cd();
630   
631   v0Lnode = new TNode("V0LE","V0LE",v0LE,0.0,0.0,350.0+fThickness1/2.0,0);
632   
633   v0Lnode->SetLineColor(kBlue);
634   fNodes->Add(v0Lnode);
635   
636   v0Lnode->SetVisibility(2);
637
638   partubs[0]      =  r0Left;
639   partubs[1]      =  r5Left;
640   partubs[2]      =  fThickness1/2.0;
641   partubs[3]      =  90.0-15.0;
642   partubs[4]      = 120.0-15.0;
643   
644   TTUBS *v0L0 = new TTUBS("V0L0", "V0L0", "void", partubs[0], partubs[1], partubs[2], 
645                                                   partubs[3], partubs[4]);
646
647   v0L0->SetNumberOfDivisions(ndiv); 
648   v0L0->SetLineColor(7);
649   
650   Float_t   offsetLeft;
651   offsetLeft    = - fThickness1/2.0; 
652
653   Float_t   r1Left =  r0Left + height1Left;        
654       
655   partubs[0]     =  r0Left;
656   partubs[1]     =  r1Left;
657
658   TTUBS *v0L1 = new TTUBS("V0L1", "V0L1", "void", partubs[0], partubs[1], partubs[2], 
659                                                   partubs[3], partubs[4]);
660
661   v0L1->SetNumberOfDivisions(ndiv);
662   
663   Float_t   r2Left =  r1Left + height2Left;       
664   
665   partubs[0]     =  r1Left;
666   partubs[1]     =  r2Left;
667
668   TTUBS *v0L2 = new TTUBS("V0L2", "V0L2", "void", partubs[0], partubs[1], partubs[2], 
669                                                   partubs[3], partubs[4]);
670
671   v0L2->SetNumberOfDivisions(ndiv);
672   
673   Float_t   r3Left  =  r2Left + height3Left;
674   
675   partubs[0]     =  r2Left;
676   partubs[1]     =  r3Left;
677   
678   TTUBS *v0L3 = new TTUBS("V0L3", "V0L3", "void", partubs[0], partubs[1], partubs[2], 
679                                                   partubs[3], partubs[4]);
680   v0L3->SetNumberOfDivisions(ndiv);
681  
682   Float_t   r4Left  =   r3Left + height4Left;
683   
684   partubs[0]     =  r3Left;
685   partubs[1]     =  r4Left;
686
687   TTUBS *v0L4 = new TTUBS("V0L4", "V0L4", "void", partubs[0], partubs[1], partubs[2], 
688                                                   partubs[3], partubs[4]);
689
690   v0L4->SetNumberOfDivisions(ndiv);
691
692   partubs[0]     =  r4Left;
693   partubs[1]     =  r5Left;
694   partubs[3]     =  90.0-15.0;
695   partubs[4]     = 120.0-30.0;
696   
697   TTUBS *v0L5 = new TTUBS("V0L5", "V0L5", "void", partubs[0], partubs[1], partubs[2], 
698                                                   partubs[3], partubs[4]);
699
700
701   v0L5->SetNumberOfDivisions(ndiv);
702
703   partubs[3]     = 120.0-30.0;
704   partubs[4]     = 120.0-15.0;
705   
706   TTUBS *v0L6 = new TTUBS("V0L6", "V0L6", "void", partubs[0], partubs[1], partubs[2], 
707                                                   partubs[3], partubs[4]);
708                                                   
709   v0L6->SetNumberOfDivisions(ndiv);
710
711   Int_t    ndetL   = 1;
712  
713   for (phi = 15.0; phi < 360.0; phi = phi + phiDeg)
714   
715   {
716      
717     TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );        
718     
719  
720     sprintf(nameNode,"SUBDEL%d",ndetL);
721     
722     v0Lnode->cd();
723     v0Lnode0 = new TNode(nameNode,nameNode,v0L0,0.0,0.0, offsetLeft + halfThickQua,mat920);      
724     v0Lnode0->SetLineColor(kColorVZERO);
725     fNodes->Add(v0Lnode0);
726     ndetL++;
727     
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++;
734     
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++;
756      
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++;
763     
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++;
770        
771     v0Lnode0->SetVisibility(2);
772     
773   }    
774      
775 }  
776     
777 //_____________________________________________________________________________
778 void AliVZEROv2::CreateMaterials()
779 {
780
781 // Creates materials used for geometry 
782
783     Int_t i;
784
785     printf("\n");
786     for(i=0;i<25;i++) printf("*");
787     printf(" VZERO create materials ");
788     for(i=0;i<26;i++) printf("*");
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     
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;
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         
856 //  Definition of materials :
857        
858     AliMixture( 1, "AIR A$", aAir,zAir,dAir,4,wAir);
859     AliMixture(11, "AIR I$", aAir,zAir,dAir,4,wAir);
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      
868     Int_t   iSXFLD = gAlice->Field()->Integ();
869     Float_t sXMGMX = gAlice->Field()->Max();
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 :    
880     AliMedium(1, "ACTIVE AIR$", 1, 1, iSXFLD, sXMGMX,
881               10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
882
883 //  Inactive air : 
884   
885     AliMedium(11, "INACTIVE AIR$", 11, 0, iSXFLD, sXMGMX,
886               10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
887     
888     AliMedium(2, "CARBON$ ", 2,  1, iSXFLD, sXMGMX,
889               tmaxfd, stemax, deemax, epsil, stmin, 0, 0);   
890
891     AliMedium(3, "QUARZ$", 3, 1, iSXFLD, sXMGMX,
892               tmaxfd, fMaxStepQua, fMaxDestepQua, epsil, stmin, 0, 0);
893     
894     AliMedium(4,"ALUMINUM1$",4, 1, iSXFLD, sXMGMX,
895               tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
896               
897
898     AliMedium(5,"ALUMINUM2$",5, 1, iSXFLD, sXMGMX,
899               tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);    
900
901     AliMedium(6,"SCINTILLATOR$",6, 1, iSXFLD, sXMGMX, 10.0, 0.1, 0.1, 0.003, 0.003, 0, 0);
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);
945                                        
946 }
947
948 //_____________________________________________________________________________
949 void 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
965 //_____________________________________________________________________________
966 void AliVZEROv2::Init()
967 {
968 // Initialises version 2 of the VZERO Detector
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
980
981 //_____________________________________________________________________________
982 void AliVZEROv2::StepManager()
983 {
984  
985 // Step Manager, called at each step 
986    
987      Int_t     copy;
988      static    Int_t   vol[4];
989      static    Float_t hits[19];
990      static    Float_t eloss, tlength;
991      
992      TLorentzVector pos;     
993      TLorentzVector mom;
994      
995      Float_t        theta;
996      Float_t        phi;
997      Float_t        kRaddeg = 180.0/TMath::Pi();
998      Float_t        ringNumber;
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      
1013
1014      if      ( gMC->CurrentVolID(copy) == gMC->VolId("V0R1") ||
1015                gMC->CurrentVolID(copy) == gMC->VolId("V0L1") )
1016                ringNumber = 1.0;
1017      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R2") ||
1018                gMC->CurrentVolID(copy) == gMC->VolId("V0L2") ) 
1019                ringNumber = 2.0;  
1020      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R3") ||
1021                gMC->CurrentVolID(copy) == gMC->VolId("V0L3") )
1022                ringNumber = 3.0;
1023      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R4") ||
1024                gMC->CurrentVolID(copy) == gMC->VolId("V0L4") )   
1025                ringNumber = 4.0; 
1026      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R5") ||
1027                gMC->CurrentVolID(copy) == gMC->VolId("V0L5") ||
1028                gMC->CurrentVolID(copy) == gMC->VolId("V0L6") ||
1029                gMC->CurrentVolID(copy) == gMC->VolId("V0R6") )    
1030                ringNumber = 5.0; 
1031      else
1032                ringNumber = 0.0;
1033
1034      if  (  ringNumber > 0.5  ) { 
1035      
1036         destep    = gMC->Edep();
1037         step      = gMC->TrackStep();
1038         eloss    += destep;
1039         tlength  += step; 
1040
1041         if  ( gMC->IsTrackEntering()  )  {  
1042        
1043             gMC->TrackPosition(pos);
1044      
1045             gMC->TrackMomentum(mom);      
1046             Double_t tc   = mom[0]*mom[0]+mom[1]*mom[1];
1047             Double_t pt   = TMath::Sqrt(tc);
1048             Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
1049             theta   = Float_t(TMath::ATan2(pt,Double_t(mom[2])))*kRaddeg;
1050             phi     = Float_t(TMath::ATan2(Double_t(pos[1]),Double_t(pos[0])))*kRaddeg;
1051
1052 ////////////////////////////////////////////////////////////////////////////         
1053      Float_t angle1 = Float_t(TMath::ATan2(Double_t(pos[1]),Double_t(pos[0])))*kRaddeg;
1054      if(angle1 < 0.0) angle1 = angle1 + 360.0;
1055      printf(" RingNumber, copy, phi1  = %f %d %f \n\n", ringNumber,vol[1],angle1); 
1056 ////////////////////////////////////////////////////////////////////////////    
1057                  
1058      
1059             ipart  = gMC->TrackPid();
1060
1061             hits[0]  = pos[0];
1062             hits[1]  = pos[1];
1063             hits[2]  = pos[2];           
1064             hits[3]  =  Float_t (ipart); 
1065
1066             hits[4]  = gMC->TrackTime();
1067             hits[5]  = gMC->TrackCharge();
1068             hits[6]  = theta;
1069             hits[7]  = phi;
1070             hits[8]  = ringNumber;
1071          
1072             hits[9]  = pt;
1073             hits[10] = pmom;
1074             hits[11] = mom[0];
1075             hits[12] = mom[1];
1076             hits[13] = mom[2];
1077             
1078             TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
1079             hits[14] = par->Vx();
1080             hits[15] = par->Vy();
1081             hits[16] = par->Vz();
1082             
1083             tlength  = 0.0;
1084             eloss    = 0.0;
1085             
1086          }
1087          
1088          if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1089          
1090          hits[17] =   eloss;
1091          hits[18] = tlength;
1092          
1093          AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1094                  
1095          tlength  = 0.0;
1096          eloss    = 0.0; 
1097           
1098          } 
1099     }
1100       
1101 }
1102
1103 //_____________________________________________________________________________
1104 void AliVZEROv2::AddHit(Int_t track, Int_t *vol, Float_t *hits)
1105 {
1106   
1107 //  Adds a VZERO hit
1108   
1109   TClonesArray &lhits = *fHits;
1110   new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
1111 }
1112
1113 //_____________________________________________________________________________
1114 void AliVZEROv2::AddDigits(Int_t *tracks, Int_t* digits) 
1115 {
1116
1117 //  Adds a VZERO digit
1118
1119    TClonesArray  &ldigits = *fDigits;
1120    new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
1121 }
1122
1123 //_____________________________________________________________________________
1124 void AliVZEROv2::MakeBranch(Option_t *option)
1125 {
1126   
1127 // Creates new branches in the current Root Tree
1128     
1129   char branchname[10];
1130   sprintf(branchname,"%s",GetName());
1131   printf(" fBufferSize = %d \n",fBufferSize);
1132   
1133   const char *cH = strstr(option,"H");
1134   
1135   if (fHits   && TreeH() && cH) {
1136     TreeH()->Branch(branchname,&fHits, fBufferSize);
1137     printf("* AliDetector::MakeBranch * Making Branch %s for hits\n",branchname);
1138   }     
1139
1140   const char *cD = strstr(option,"D");
1141   
1142   if (fDigits   && fLoader->TreeD() && cD) {
1143     fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
1144     printf("* AliDetector::MakeBranch * Making Branch %s for digits\n",branchname);
1145   }  
1146    
1147 }