New methods and data member added by M. Horner.
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv0.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
17 //////////////////////////////////////////////////////////////////////
18 //                                                                  //
19 //  (V-zero) detector  version 0  as designed by the Lyon group     //
20 //   All comments should be sent to Brigitte CHEYNIS :              //
21 //                                  b.cheynis@ipnl.in2p3.fr         // 
22 //   Geometrie      du 25/02/2002                                   //
23 //                                                                  //
24 //////////////////////////////////////////////////////////////////////
25
26 #include <TMath.h>
27 #include <TGeometry.h>
28 #include <TTRD2.h>
29 #include <TCONE.h>
30 #include <TPGON.h>
31 #include <TPCON.h>
32 #include <TSPHE.h>
33 #include <TTRAP.h>
34 #include <TBRIK.h>
35 #include <TBox.h>
36
37 #include <TShape.h>
38 #include <TNode.h>
39 #include <TClonesArray.h>
40 #include <TH1.h>
41 #include <string.h>
42 #include <Riostream.h>
43
44 #include "AliVZEROv0.h"
45 #include "AliRun.h"
46 #include "AliMagF.h"
47 #include "AliVZEROhit.h"
48 #include "AliVZEROdigit.h"
49 #include <Riostream.h>
50 #include <Riostream.h>
51
52 #include <stdlib.h>
53 #include "TObjectTable.h"
54
55 #include "AliConst.h"
56 #include "ABSOSHILConst.h"
57 #include "ABSOConst.h"
58 #include "TLorentzVector.h"
59
60 ClassImp(AliVZEROv0)
61
62 //--------------------------------------------------------------------
63 AliVZEROv0:: AliVZEROv0():AliVZERO()
64 {
65
66
67 }
68 //--------------------------------------------------------------------
69 AliVZEROv0::AliVZEROv0(const char *name, const char *title):
70  AliVZERO(name,title)
71 {
72
73 // Standard constructor for V-zeroR Detector (right part)  version 0
74
75
76   Int_t i;
77
78   printf("\n");
79   for(i=0;i<30;i++) printf("*");
80   printf(" Create VZERO object ");
81   for(i=0;i<30;i++) printf("*");
82   printf("\n");
83   
84 }
85
86 //-------------------------------------------------------------------------
87 void AliVZEROv0::CreateGeometry()
88 {
89
90 // Creates the Geant geometry of the V-zero Detector  version 0
91
92   
93   Int_t i;
94   
95   printf("\n");
96   for(i=0;i<30;i++) printf("*");
97   printf(" Create VZERO Geometry ");
98   for(i=0;i<30;i++) printf("*");
99   printf("\n");
100     
101   
102   Int_t    *idtmed = fIdtmed->GetArray()-2999;
103
104   Int_t    n_detec_R = 1;
105   Int_t    n_detec_L = 1;
106  
107   Int_t    n_cells_R = 1;
108   Int_t    n_cells_L = 1;
109   
110   Int_t    idrotm[999];
111  
112   Float_t  height1, height2, height3, height4, height5; 
113   Float_t  height;
114   Float_t  theta;  
115   Float_t  half_thick_alu;
116   Float_t  half_thick_qua1,half_thick_qua2,half_thick_qua3;
117   Float_t  half_thick_qua4,half_thick_qua5;
118   Float_t  zdet;
119   Float_t  r0, r5;
120   Float_t  pi = TMath::Pi();
121   Float_t  thick_alu;
122   
123   height1           =     2.0;           // height of cell 1, in cm
124   height2           =     3.2;           // height of cell 2, in cm
125   height3           =     4.9;           // height of cell 3, in cm
126   height4           =     7.5;           // height of cell 4, in cm
127   height5           =    12.0;           // height of cell 5, in cm
128   
129   theta             = pi/6.0/2.0;       // half angular opening = 15 degrees
130   half_thick_alu    = 0.0025;            // half thickness of aluminum foil, in cm
131   thick_alu         = 2.0 * half_thick_alu; 
132   fThickness1       = 2.5;
133   half_thick_qua1   = fThickness1/2.0;   // half thickness of WRAPPED quartz cell (inner ring)
134   half_thick_qua2   = half_thick_qua1  - 0.25;
135   half_thick_qua3   = half_thick_qua2  - 0.25;
136   half_thick_qua4   = half_thick_qua3  - 0.25;
137   half_thick_qua5   = half_thick_qua4  - 0.25;
138   
139   zdet              =    86.9 +fThickness/2.0;  // distance to vertex (along Z axis)
140   r0                =    4.0;            // closest distance to center of the beam pipe
141   height            =    height1 + height2 + height3 + height4 + height5;
142   r5                =    r0 + height;
143
144 //............................................................................
145
146 // Here I add the flange which is sitting on beam line 
147 // right in front of V0R detector, and which I found on CERN drawing 
148 // entitled : ALICE BEAM VACCUM CHAMBER - RB26 version III :  
149    
150 //     Float_t   pflange[3];
151 //     
152 //     pflange[0] = 3.0;
153 //     pflange[1] = 5.675;
154 //     pflange[2] = 0.9;        
155 // 
156 //     gMC->Gsvolu("QFA0","TUBE", idtmed[3003], pflange, 3);
157 //     gMC->Gspos("QFA0", 1 ,"ALIC", 0.0, 0.0, 85.0+0.9, 0, "ONLY");
158      
159 //............................................................................
160
161
162 // Creation of mother volume V0LE - left part - :
163 // Face entree a -350.0 cm ...
164
165    Float_t   partube[3];
166    
167    partube[0] =  4.3;
168    partube[1] = 45.0;
169    partube[2] = fThickness1/2.0;   
170     
171    gMC->Gsvolu("V0LE","TUBE",idtmed[3002],partube,3);
172   
173    
174 // Creation of five rings - left part - :
175 // Face entree a -350.0 cm ... 
176
177 // Mother volume V0L0 in which will be set 5 quartz cells 
178
179
180   Float_t   par[11];
181   
182   Float_t   dist0_left;   
183   Float_t   r0_left      =   4.3;   
184   Float_t   height1_left =   2.6; 
185   Float_t   height2_left =   4.1;
186   Float_t   height3_left =   6.4;
187   Float_t   height4_left =  10.2;
188   Float_t   height5_left =  16.9;
189   Float_t   height_left  = height1_left + height2_left + height3_left 
190                                         + height4_left + height5_left;
191   Float_t   r5_left      = r0_left  + height_left; 
192   
193    
194   dist0_left  =  r0_left + height_left / 2.0;
195   thick_alu   =  2.0*half_thick_alu;
196   
197   par[0]      =  half_thick_qua1;
198   par[1]      =  0.0;
199   par[2]      =  0.0;
200   par[3]      =  height_left / 2.0 ;
201   par[4]      =  TMath::Tan(theta) * r0_left;
202   par[5]      =  TMath::Tan(theta) * r5_left;
203   par[6]      =  0.0;
204   par[7]      =  height_left / 2.0 ;
205   par[8]      =  TMath::Tan(theta) * r0_left;
206   par[9]      =  TMath::Tan(theta) * r5_left;
207   par[10]     =  0.0;
208   
209
210   gMC->Gsvolu("V0L0","TRAP",idtmed[3010],par,11);  // air volume
211   
212   Float_t   dist1_left;
213   Float_t   r1_left;
214   Float_t   offset_left;
215      
216   dist1_left     =  (- height_left + height1_left) /2.0; 
217   r1_left        =  r0_left + height1_left;
218   offset_left    = - fThickness1/2.0 + 0.1; 
219    
220   par[0]    =  half_thick_qua1 - thick_alu;
221   par[3]    =  height1_left / 2.0 - thick_alu;
222   par[4]    =  TMath::Tan(theta) * r0_left - thick_alu;
223   par[5]    =  TMath::Tan(theta) * r1_left- thick_alu;
224   par[7]    =  height1_left / 2.0 - thick_alu;
225   par[8]    =  TMath::Tan(theta) * r0_left - thick_alu;
226   par[9]    =  TMath::Tan(theta) * r1_left - thick_alu;
227
228
229   gMC->Gsvolu("V0L1","TRAP",idtmed[3002],par,11);  // quartz volume
230   gMC->Gspos("V0L1",1,"V0L0", 0.0, dist1_left , 0.0, 0,"ONLY"); 
231   
232   Float_t   dist2_left;
233   Float_t   r2_left; 
234     
235   dist2_left     =    (- height_left + height2_left) /2.0 + height1_left;
236   r2_left        =       r1_left + height2_left; 
237   
238   par[0]    =  half_thick_qua1 - thick_alu;   
239   par[3]    =  height2_left / 2.0 - thick_alu;
240   par[4]    =  TMath::Tan(theta) * r1_left - thick_alu;
241   par[5]    =  TMath::Tan(theta) * r2_left - thick_alu;
242   par[7]    =  height2_left / 2.0 - thick_alu;
243   par[8]    =  TMath::Tan(theta) * r1_left - thick_alu;
244   par[9]    =  TMath::Tan(theta) * r2_left - thick_alu;
245
246   gMC->Gsvolu("V0L2","TRAP",idtmed[3002],par,11);  // quartz volume
247   gMC->Gspos("V0L2",1,"V0L0", 0.0, dist2_left , 0.0, 0,"ONLY"); 
248   
249   
250   Float_t   dist3_left;
251   Float_t   r3_left;
252      
253   dist3_left     =    (- height_left + height3_left) /2.0 + height1_left + height2_left;
254   r3_left        =       r2_left + height3_left; 
255    
256   par[0]    =  half_thick_qua1 - thick_alu;   
257   par[3]    =  height3_left / 2.0 - thick_alu;
258   par[4]    =  TMath::Tan(theta) * r2_left - thick_alu;
259   par[5]    =  TMath::Tan(theta) * r3_left - thick_alu;
260   par[7]    =  height3_left / 2.0 - thick_alu;
261   par[8]    =  TMath::Tan(theta) * r2_left - thick_alu;
262   par[9]    =  TMath::Tan(theta) * r3_left - thick_alu;
263
264   gMC->Gsvolu("V0L3","TRAP",idtmed[3002],par,11);  // quartz volume
265   gMC->Gspos("V0L3",1,"V0L0", 0.0, dist3_left , 0.0, 0,"ONLY");
266     
267   Float_t   dist4_left;
268   Float_t   r4_left;
269        
270   dist4_left     =    (- height_left + height4_left) /2.0 + height1_left 
271                                      + height2_left + height3_left;
272   r4_left        =       r3_left + height4_left; 
273    
274   par[0]    =  half_thick_qua1 - thick_alu;   
275   par[3]    =  height4_left / 2.0 - thick_alu;
276   par[4]    =  TMath::Tan(theta) * r3_left - thick_alu;
277   par[5]    =  TMath::Tan(theta) * r4_left - thick_alu;
278   par[7]    =  height4_left / 2.0 - thick_alu;
279   par[8]    =  TMath::Tan(theta) * r3_left - thick_alu;
280   par[9]    =  TMath::Tan(theta) * r4_left - thick_alu;
281
282   gMC->Gsvolu("V0L4","TRAP",idtmed[3002],par,11);  // quartz volume
283   gMC->Gspos("V0L4",1,"V0L0", 0.0, dist4_left , 0.0, 0,"ONLY");
284
285
286   Float_t   dist5_left;
287
288          
289   dist5_left     =    (- height_left + height5_left) /2.0 + height1_left 
290                                      + height2_left + height3_left + height4_left;
291
292    
293   par[0]    =  half_thick_qua1 - thick_alu;   
294   par[3]    =  height5_left / 2.0 - thick_alu;
295   par[4]    =  TMath::Tan(theta) * r4_left - thick_alu;
296   par[5]    =  TMath::Tan(theta) * r5_left - thick_alu;
297   par[7]    =  height5_left / 2.0 - thick_alu;
298   par[8]    =  TMath::Tan(theta) * r4_left - thick_alu;
299   par[9]    =  TMath::Tan(theta) * r5_left - thick_alu;
300
301   gMC->Gsvolu("V0L5","TRAP",idtmed[3002],par,11);  // quartz volume
302   gMC->Gspos("V0L5",1,"V0L0", 0.0, dist5_left , 0.0, 0,"ONLY");
303   
304   
305 //............................................................................
306
307 // Creation of mother volume V0RI - right part - :
308
309   
310   partube[0] = r0 - 0.2;
311   partube[1] = (r5 + 1.0) / TMath::Cos(theta);
312   partube[2] = fThickness/2.0; 
313   
314     
315   gMC->Gsvolu("V0RI","TUBE",idtmed[3010],partube,3);
316   
317 // Creation of  carbon lids (1 mm thick) to keep V0RI box shut...
318
319   Float_t   parbox[10];
320   
321   parbox[0] =    0.;
322   parbox[1] =  360.;
323   parbox[2] =    12;
324   parbox[3] =     2;
325   parbox[4] =  -0.1/2.0;
326   parbox[5] =  r0;
327   parbox[6] =  r5;     
328   parbox[7] =  +0.1/2.0;
329   parbox[8] =  r0;
330   parbox[9] =  r5;  
331   
332   
333   gMC->Gsvolu("V0CA","PGON",idtmed[3001],parbox,10); 
334   gMC->Gspos("V0CA",1,"V0RI",0.0,0.0, fThickness/2.0-parbox[7],0,"ONLY");
335   gMC->Gspos("V0CA",2,"V0RI",0.0,0.0,-fThickness/2.0+parbox[7],0,"ONLY");
336   
337 // Creation of aluminum rings to maintain the V0RI pieces ...
338
339   parbox[4] =  -fThickness/2.0;
340   parbox[5] =  r0 -0.2;
341   parbox[6] =  r0;     
342   parbox[7] =  +fThickness/2.0;
343   parbox[8] =  r0 -0.2;
344   parbox[9] =  r0; 
345   
346   gMC->Gsvolu("V0IR","PGON",idtmed[3003],parbox,10);    
347   gMC->Gspos("V0IR",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
348   
349   parbox[4] =  -fThickness/2.0;
350   parbox[5] =  r5;
351   parbox[6] =  r5 + 1.0;     
352   parbox[7] =  +fThickness/2.0;
353   parbox[8] =  r5;
354   parbox[9] =  r5 + 1.0; 
355  
356   gMC->Gsvolu("V0ER","PGON",idtmed[3003],parbox,10);    
357   gMC->Gspos("V0ER",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
358   
359 // Mother volume V0R0 in which will be set 5  quartz cells 
360 // each one  WRAPPED in reflecting aluminum : 
361   
362   Float_t   dist0;   
363     
364   dist0     =  r0 + height / 2.0;
365   thick_alu =  2.0*half_thick_alu;
366   
367   par[0]    =  half_thick_qua1;
368   par[1]    =  0.0;
369   par[2]    =  0.0;
370   par[3]    =  height / 2.0 ;
371   par[4]    =  TMath::Tan(theta) * r0;
372   par[5]    =  TMath::Tan(theta) * r5;
373   par[6]    =  0.0;
374   par[7]    =  height / 2.0 ;
375   par[8]    =  TMath::Tan(theta) * r0;
376   par[9]    =  TMath::Tan(theta) * r5;
377   par[10]   =  0.0;
378
379
380   gMC->Gsvolu("V0R0","TRAP",idtmed[3010],par,11);  // air volume
381
382 // Elementary cell of ring 1 :
383  
384   Float_t   dist1;
385   Float_t   r1;
386   Float_t   offset;
387      
388   dist1     =  (- height + height1) /2.0; 
389   r1        =  r0 + height1;
390   offset    = - fThickness/2.0 + 0.1; 
391    
392   par[0]    =  half_thick_qua1 - thick_alu;
393   par[3]    =  height1 / 2.0 - thick_alu;
394   par[4]    =  TMath::Tan(theta) * r0 - thick_alu;
395   par[5]    =  TMath::Tan(theta) * r1- thick_alu;
396   par[7]    =  height1 / 2.0 - thick_alu;
397   par[8]    =  TMath::Tan(theta) * r0 - thick_alu;
398   par[9]    =  TMath::Tan(theta) * r1 - thick_alu;
399
400
401   gMC->Gsvolu("V0R1","TRAP",idtmed[3002],par,11);  // quartz volume
402   gMC->Gspos("V0R1",1,"V0R0", 0.0, dist1 , 0.0, 0,"ONLY");
403   
404   par[0]    =  half_thick_alu;
405
406   gMC->Gsvolu("V0A1","TRAP",idtmed[3004],par,11);  // aluminum trap-shaped foil
407   gMC->Gspos("V0A1",1,"V0R1",0.0,0.0, - half_thick_qua1 + half_thick_alu,0,"ONLY");  
408   gMC->Gspos("V0A1",2,"V0R1",0.0,0.0, + half_thick_qua1 - half_thick_alu,0,"ONLY");  
409
410   parbox[0] = half_thick_alu;
411   parbox[1] = height1 / TMath::Cos(theta)/ 2.0;
412   parbox[2] = half_thick_qua1;
413   
414   gMC->Gsvolu("V0A2","BOX",idtmed[3004],parbox,3);   // aluminum rectangular foil
415   Float_t  theta_deg = 180./6./2.0; 
416   Float_t h1;
417   h1 = TMath::Tan(theta) * (r0 + height1/2.0);  
418   AliMatrix(idrotm[911],90.0,+theta_deg,90.0,90.+theta_deg,0.0,0.);  
419   gMC->Gspos("V0A2",1,"V0R1",-h1 + half_thick_alu,0.0,0.0,idrotm[911],"ONLY"); 
420   AliMatrix(idrotm[912],90.0,-theta_deg,90.0,90.-theta_deg,0.0,0.);  
421   gMC->Gspos("V0A2",2,"V0R1",+h1 - half_thick_alu,0.0,0.0,idrotm[912],"ONLY"); 
422
423   parbox[0] = TMath::Tan(theta) * r0;
424   parbox[1] = half_thick_alu;
425   parbox[2] = half_thick_qua1;
426   gMC->Gsvolu("V0A3","BOX",idtmed[3004],parbox,3);
427   gMC->Gspos("V0A3",1,"V0R1",0.0, - (height1/2.0) + half_thick_alu ,0.0,0,"ONLY");
428     
429
430   parbox[0] = TMath::Tan(theta) * (r0 + height1);
431   parbox[1] = half_thick_alu;
432   parbox[2] = half_thick_qua1;
433   gMC->Gsvolu("V0A4","BOX",idtmed[3004],parbox,3);
434   gMC->Gspos("V0A4",1,"V0R1",0.0, (height1/2.0) - half_thick_alu,0.0,0,"ONLY");
435
436   
437 //  Elementary cell of ring 2 : 
438  
439   Float_t   dist2;
440   Float_t   r2; 
441     
442   dist2     =    (- height + height2) /2.0 + height1;
443   r2        =       r1 + height2; 
444   
445   par[0]    =  half_thick_qua2 - thick_alu;   
446   par[3]    =  height2 / 2.0 - thick_alu;
447   par[4]    =  TMath::Tan(theta) * r1 - thick_alu;
448   par[5]    =  TMath::Tan(theta) * r2 - thick_alu;
449   par[7]    =  height2 / 2.0 - thick_alu;
450   par[8]    =  TMath::Tan(theta) * r1 - thick_alu;
451   par[9]    =  TMath::Tan(theta) * r2 - thick_alu;
452
453   gMC->Gsvolu("V0R2","TRAP",idtmed[3002],par,11);  // quartz volume
454   gMC->Gspos("V0R2",1,"V0R0", 0.0, dist2 , - half_thick_qua1 + half_thick_qua2, 0,"ONLY");
455
456   par[0]    =  half_thick_alu;
457
458   gMC->Gsvolu("V0B1","TRAP",idtmed[3004],par,11);  // aluminum trap-shaped foil
459   gMC->Gspos("V0B1",1,"V0R2",0.0,0.0, - half_thick_qua2 + half_thick_alu,0,"ONLY");  
460   gMC->Gspos("V0B1",2,"V0R2",0.0,0.0, + half_thick_qua2 - half_thick_alu,0,"ONLY");  
461
462   parbox[0] = half_thick_alu;
463   parbox[1] = height2 / TMath::Cos(theta)/ 2.0;
464   parbox[2] = half_thick_qua2;
465   
466   gMC->Gsvolu("V0B2","BOX",idtmed[3004],parbox,3);   // aluminum rectangular foil
467   Float_t h2;
468   h2 = TMath::Tan(theta) * (r0  + height1 + height2/2.0);  
469   gMC->Gspos("V0B2",1,"V0R2",-h2 + half_thick_alu,0.0,0.0,idrotm[911],"ONLY"); 
470   gMC->Gspos("V0B2",2,"V0R2",+h2 - half_thick_alu,0.0,0.0,idrotm[912],"ONLY"); 
471
472   parbox[0] = TMath::Tan(theta) * (r0 + height1);
473   parbox[1] = half_thick_alu;
474   parbox[2] = half_thick_qua2;
475   gMC->Gsvolu("V0B3","BOX",idtmed[3004],parbox,3);
476   gMC->Gspos("V0B3",1,"V0R2",0.0, - (height2/2.0) + half_thick_alu ,0.0,0,"ONLY");
477     
478
479   parbox[0] = TMath::Tan(theta) * (r0 + height1 +  height2);
480   parbox[1] = half_thick_alu;
481   parbox[2] = half_thick_qua2;
482   gMC->Gsvolu("V0B4","BOX",idtmed[3004],parbox,3);
483   gMC->Gspos("V0B4",1,"V0R2",0.0, (height2/2.0) - half_thick_alu,0.0,0,"ONLY");
484   
485
486 // Elementary cell  ring 3 :   
487   
488   Float_t   dist3;
489   Float_t   r3; 
490     
491   dist3     =    (- height + height3) /2.0 + height1 + height2;
492   r3        =       r2 + height3; 
493    
494   par[0]    =  half_thick_qua3 - thick_alu;   
495   par[3]    =  height3 / 2.0 - thick_alu;
496   par[4]    =  TMath::Tan(theta) * r2 - thick_alu;
497   par[5]    =  TMath::Tan(theta) * r3 - thick_alu;
498   par[7]    =  height3 / 2.0 - thick_alu;
499   par[8]    =  TMath::Tan(theta) * r2 - thick_alu;
500   par[9]    =  TMath::Tan(theta) * r3 - thick_alu;
501
502   gMC->Gsvolu("V0R3","TRAP",idtmed[3002],par,11);  // quartz volume
503   gMC->Gspos("V0R3",1,"V0R0", 0.0, dist3 , - half_thick_qua1 +  half_thick_qua3, 0,"ONLY");
504
505
506   par[0]    =  half_thick_alu;
507
508   gMC->Gsvolu("V0C1","TRAP",idtmed[3004],par,11);  // aluminum trap-shaped foil
509   gMC->Gspos("V0C1",1,"V0R3",0.0,0.0, - half_thick_qua3 + half_thick_alu,0,"ONLY");  
510   gMC->Gspos("V0C1",2,"V0R3",0.0,0.0, + half_thick_qua3 - half_thick_alu,0,"ONLY");  
511
512   parbox[0] = half_thick_alu;
513   parbox[1] = height3 / TMath::Cos(theta)/ 2.0;
514   parbox[2] = half_thick_qua3;
515   
516   gMC->Gsvolu("V0C2","BOX",idtmed[3004],parbox,3);   // aluminum rectangular foil
517   Float_t h3;
518   h3 = TMath::Tan(theta) * (r0  + height1 + height2 + height3/2.0);  
519   gMC->Gspos("V0C2",1,"V0R3",-h3 + half_thick_alu,0.0,0.0,idrotm[911],"ONLY"); 
520   gMC->Gspos("V0C2",2,"V0R3",+h3 - half_thick_alu,0.0,0.0,idrotm[912],"ONLY"); 
521
522   parbox[0] = TMath::Tan(theta) * (r0 + height1 + height2);
523   parbox[1] = half_thick_alu;
524   parbox[2] = half_thick_qua3;
525   gMC->Gsvolu("V0C3","BOX",idtmed[3004],parbox,3);
526   gMC->Gspos("V0C3",1,"V0R3",0.0, - (height3/2.0) + half_thick_alu ,0.0,0,"ONLY");
527     
528
529   parbox[0] = TMath::Tan(theta) * (r0 + height1 + height2 + height3);
530   parbox[1] = half_thick_alu;
531   parbox[2] = half_thick_qua3;
532   gMC->Gsvolu("V0C4","BOX",idtmed[3004],parbox,3);
533   gMC->Gspos("V0C4",1,"V0R3",0.0, (height3/2.0) - half_thick_alu,0.0,0,"ONLY");
534
535
536 // Elementary cell  ring 4 :  
537
538   Float_t   dist4;
539   Float_t   r4; 
540     
541   dist4     =    (- height + height4) /2.0 + height1 + height2 + height3;
542   r4        =       r3 + height4; 
543    
544   par[0]    =  half_thick_qua4 - thick_alu;   
545   par[3]    =  height4 / 2.0 - thick_alu;
546   par[4]    =  TMath::Tan(theta) * r3 - thick_alu;
547   par[5]    =  TMath::Tan(theta) * r4 - thick_alu;
548   par[7]    =  height4 / 2.0 - thick_alu;
549   par[8]    =  TMath::Tan(theta) * r3 - thick_alu;
550   par[9]    =  TMath::Tan(theta) * r4 - thick_alu;
551
552   gMC->Gsvolu("V0R4","TRAP",idtmed[3002],par,11);  // quartz volume
553   gMC->Gspos("V0R4",1,"V0R0", 0.0, dist4 , - half_thick_qua1 + half_thick_qua4, 0,"ONLY"); 
554
555
556   par[0]    =  half_thick_alu;
557
558   gMC->Gsvolu("V0D1","TRAP",idtmed[3004],par,11);  // aluminum trap-shaped foil
559   gMC->Gspos("V0D1",1,"V0R4",0.0,0.0, - half_thick_qua4 + half_thick_alu,0,"ONLY");  
560   gMC->Gspos("V0D1",2,"V0R4",0.0,0.0, + half_thick_qua4 - half_thick_alu,0,"ONLY");  
561
562   parbox[0] = half_thick_alu;
563   parbox[1] = height4 / TMath::Cos(theta)/ 2.0;
564   parbox[2] = half_thick_qua4;
565   
566   gMC->Gsvolu("V0D2","BOX",idtmed[3004],parbox,3);   // aluminum rectangular foil
567   Float_t h4;
568   h4 = TMath::Tan(theta) * (r0  + height1 + height2 + height3 + height4/2.0);  
569   gMC->Gspos("V0D2",1,"V0R4",-h4 + half_thick_alu,0.0,0.0,idrotm[911],"ONLY"); 
570   gMC->Gspos("V0D2",2,"V0R4",+h4 - half_thick_alu,0.0,0.0,idrotm[912],"ONLY"); 
571
572   parbox[0] = TMath::Tan(theta) * (r0 + height1 + height2 + height3);
573   parbox[1] = half_thick_alu;
574   parbox[2] = half_thick_qua4;
575   gMC->Gsvolu("V0D3","BOX",idtmed[3004],parbox,3);
576   gMC->Gspos("V0D3",1,"V0R4",0.0, - (height4/2.0) + half_thick_alu ,0.0,0,"ONLY");
577     
578
579   parbox[0] = TMath::Tan(theta) * (r0 + height1 + height2 + height3 + height4);
580   parbox[1] = half_thick_alu;
581   parbox[2] = half_thick_qua4;
582   gMC->Gsvolu("V0D4","BOX",idtmed[3004],parbox,3);
583   gMC->Gspos("V0D4",1,"V0R4",0.0, (height4/2.0) - half_thick_alu,0.0,0,"ONLY");
584
585
586 // Elementary cell  ring 5 :  
587
588   Float_t   dist5;
589       
590   dist5     =    (- height + height5) /2.0 + height1 + height2 + height3 + height4;
591   
592   par[0]    =  half_thick_qua5 - thick_alu;      
593   par[3]    =  height5 / 2.0 - thick_alu;
594   par[4]    =  TMath::Tan(theta) * r4 - thick_alu;
595   par[5]    =  TMath::Tan(theta) * r5 - thick_alu;
596   par[7]    =  height5 / 2.0 - thick_alu;
597   par[8]    =  TMath::Tan(theta) * r4 - thick_alu;
598   par[9]    =  TMath::Tan(theta) * r5 - thick_alu;
599
600   gMC->Gsvolu("V0R5","TRAP",idtmed[3002],par,11);  // quartz volume
601   gMC->Gspos("V0R5",1,"V0R0", 0.0, dist5 , - half_thick_qua1 +  half_thick_qua5, 0,"ONLY"); 
602
603
604   par[0]    =  half_thick_alu;
605
606   gMC->Gsvolu("V0E1","TRAP",idtmed[3004],par,11);  // aluminum trap-shaped foil
607   gMC->Gspos("V0E1",1,"V0R5",0.0,0.0, - half_thick_qua5 + half_thick_alu,0,"ONLY");  
608   gMC->Gspos("V0E1",2,"V0R5",0.0,0.0, + half_thick_qua5 - half_thick_alu,0,"ONLY");  
609
610   parbox[0] = half_thick_alu;
611   parbox[1] = height5 / TMath::Cos(theta)/ 2.0;
612   parbox[2] = half_thick_qua5;
613   
614   gMC->Gsvolu("V0E2","BOX",idtmed[3004],parbox,3);   // aluminum rectangular foil
615   Float_t h5;
616   h5 = TMath::Tan(theta) * (r0  + height1 + height2 + height3 + height4 + height5/2.0);  
617   gMC->Gspos("V0E2",1,"V0R5",-h5 + half_thick_alu,0.0,0.0,idrotm[911],"ONLY"); 
618   gMC->Gspos("V0E2",2,"V0R5",+h5 - half_thick_alu,0.0,0.0,idrotm[912],"ONLY"); 
619
620   parbox[0] = TMath::Tan(theta) * (r0 + height1 + height2 + height3 + height4);
621   parbox[1] = half_thick_alu;
622   parbox[2] = half_thick_qua5;
623   gMC->Gsvolu("V0E3","BOX",idtmed[3004],parbox,3);
624   gMC->Gspos("V0E3",1,"V0R5",0.0, - (height5/2.0) + half_thick_alu ,0.0,0,"ONLY");
625     
626
627   parbox[0] = TMath::Tan(theta) * r5;
628   parbox[1] = half_thick_alu;
629   parbox[2] = half_thick_qua5;
630   gMC->Gsvolu("V0E4","BOX",idtmed[3004],parbox,3);
631   gMC->Gspos("V0E4",1,"V0R5",0.0, (height5/2.0) - half_thick_alu,0.0,0,"ONLY");
632
633
634   Float_t  phi_rad ;  
635   Float_t  phi_deg = 180./6.; 
636
637  // Partie de droite : 
638  
639   for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phi_deg)
640       {
641         phi_rad = phi*pi/180.;
642         AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
643         gMC->Gspos("V0R0",n_detec_R,"V0RI",-dist0*TMath::Sin(phi_rad),
644                           dist0*TMath::Cos(phi_rad),offset + half_thick_qua1,idrotm[902],"ONLY");
645         n_detec_R++;
646        }
647
648   gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,zdet,0,"ONLY");
649  
650   n_cells_R = (n_detec_R - 1) * 5;
651   printf(" \n\n\n"); 
652   printf("    Number of cells on Right side =   %d\n",  n_cells_R);    
653
654 // Partie de gauche :
655
656   for(Float_t  phi = 15.0; phi < 360.0; phi = phi + phi_deg)
657       {
658         phi_rad = phi*pi/180.;
659         AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
660         gMC->Gspos("V0L0",n_detec_L,"V0LE",-dist0_left*TMath::Sin(phi_rad),
661                           dist0_left*TMath::Cos(phi_rad),offset_left + half_thick_qua1,idrotm[902],"ONLY");
662         n_detec_L++;
663        }
664
665
666   gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,-350.0-fThickness1/2.0,0,"ONLY");
667  
668   n_cells_L = (n_detec_L - 1) * 5;
669   printf(" \n\n\n"); 
670   printf("    Number of cells on Left side  =   %d\n\n",  n_cells_L);    
671
672          
673 }
674     
675     
676     
677 //_____________________________________________________________________________
678 void AliVZEROv0::BuildGeometry()
679 {
680   
681   // Builds simple ROOT TNode geometry for event display
682
683   
684   Int_t i;
685
686   printf("\n");
687   for(i=0;i<30;i++) printf("*");
688   printf(" VZERO BuildGeometry ");
689   for(i=0;i<30;i++) printf("*");
690   printf("\n");
691   
692   TNode *Top; 
693
694   TNode *V0Rnode, *V0Rnode0, *V0Rnode6 , *V0Rnode7, *V0Rnode8, *V0Rnode9;
695   TNode *V0Rnode1, *V0Rnode2, *V0Rnode3, *V0Rnode4, *V0Rnode5;
696   TNode *V0Lnode, *V0Lnode0;
697   TNode *V0Lnode1, *V0Lnode2, *V0Lnode3, *V0Lnode4, *V0Lnode5;
698    
699   const int kColorVZERO  = kGreen;
700  
701   Top = gAlice->GetGeometry()->GetNode("alice");
702
703   Float_t  height1, height2, height3, height4, height5; 
704   Float_t  height;
705   Float_t  theta;  
706   Float_t  half_thick_alu;
707   Float_t  half_thick_qua1,half_thick_qua2,half_thick_qua3;
708   Float_t  half_thick_qua4,half_thick_qua5;
709   Float_t  zdet;
710   Float_t  r0, r5;
711   Float_t  pi = TMath::Pi();
712   Float_t  thick_alu;
713   
714 //   height1           =     1.9;         
715 //   height2           =     3.7; 
716 //   height3           =     6.2;
717 //   height4           =    10.5;
718 //   height5           =    10.5;
719
720   height1           =     2.0;           // height of cell 1, in cm
721   height2           =     3.2;           // height of cell 2, in cm
722   height3           =     4.9;           // height of cell 3, in cm
723   height4           =     7.5;           // height of cell 4, in cm
724   height5           =    12.0;           // height of cell 5, in cm
725   
726   theta             = pi/6.0/2.0;    
727   half_thick_alu    = 0.0025;        
728   thick_alu         = 2.0 * half_thick_alu; 
729   half_thick_qua1   = fThickness1/2.0; 
730   half_thick_qua2   = half_thick_qua1  - 0.25;
731   half_thick_qua3   = half_thick_qua2  - 0.25;
732   half_thick_qua4   = half_thick_qua3  - 0.25;
733   half_thick_qua5   = half_thick_qua4  - 0.25;
734   
735   zdet              =    86.9 +fThickness/2.0;   
736   r0                =    4.0;         
737   height            =    height1 + height2 + height3 + height4 + height5;
738   r5                =    r0 + height;
739
740   Float_t   partube[3];
741
742   partube[0] =  r0 - 0.2;
743   partube[1] = (r5 + 1.0) / TMath::Cos(theta);
744   partube[2] = fThickness/2.0;   
745   
746   TTUBE *V0RI = new TTUBE("V0RI", "V0RI", "void", partube[0], partube[1], partube[2]);
747                 
748   Top->cd();
749   
750   V0Rnode = new TNode("V0RI","V0RI",V0RI,0.0,0.0,+zdet,0);
751   
752   V0Rnode->SetLineColor(kBlue);
753   fNodes->Add(V0Rnode);
754   
755   V0Rnode->SetVisibility(2);
756      
757  
758 // Rondelles de carbone (epaisseur 1 mm) de maintien des cellules ...
759  
760
761   Float_t   parbox[10];
762  
763   parbox[0] =    0.;
764   parbox[1] =  360.;
765   parbox[2] =   12.;
766   parbox[3] =    2.;
767   parbox[4] =  -0.1/2.0;
768   parbox[5] =  r0;
769   parbox[6] =  r5;     
770   parbox[7] =  +0.1/2.0;
771   parbox[8] =  r0;
772   parbox[9] =  r5;  
773   
774   
775   TPGON *V0CA = new TPGON("V0CA", "V0CA", "void",parbox[0], parbox[1],
776                             Int_t(parbox[2]),Int_t(parbox[3]) );
777                             
778   V0CA->DefineSection( 0, parbox[4], parbox[5], parbox[6] );
779   V0CA->DefineSection( 1, parbox[7], parbox[8], parbox[9] ); 
780    
781   V0Rnode->cd();
782   V0Rnode6 = new TNode("V0CA", "V0CA",V0CA,0.0,0.0, fThickness/2.0-parbox[7],0);         
783   V0Rnode6->SetLineColor(kYellow);
784   fNodes->Add(V0Rnode6); 
785   V0Rnode->cd();
786   V0Rnode7 = new TNode("V0CA", "V0CA",V0CA,0.0,0.0,-fThickness/2.0+parbox[7],0);         
787   V0Rnode7->SetLineColor(kYellow);
788   fNodes->Add(V0Rnode7);
789   
790   parbox[4] =  -fThickness/2.0;
791   parbox[5] =  r0 - 0.2;
792   parbox[6] =  r0;     
793   parbox[7] =  +fThickness/2.0;
794   parbox[8] =  r0 - 0.2;
795   parbox[9] =  r0; 
796
797   TPGON  *V0IR = new TPGON("V0IR","V0IR","void",  parbox[0], parbox[1],
798                             Int_t(parbox[2]),Int_t(parbox[3]) );
799   V0IR->DefineSection( 0, parbox[4], parbox[5], parbox[6] );
800   V0IR->DefineSection( 1, parbox[7], parbox[8], parbox[9] );
801   
802   V0Rnode->cd();
803   V0Rnode8 = new TNode("V0IR", "V0IR",V0IR,0.0,0.0,0.0,0);
804   V0Rnode8->SetLineColor(kYellow);
805   fNodes->Add(V0Rnode8);
806  
807   parbox[4] =  -fThickness/2.0;
808   parbox[5] =  r5;
809   parbox[6] =  r5 + 1.0;     
810   parbox[7] =  +fThickness/2.0;
811   parbox[8] =  r5;
812   parbox[9] =  r5 + 1.0; 
813
814   TPGON  *V0ER = new TPGON("V0ER","V0ER","void",  parbox[0], parbox[1],
815                             Int_t(parbox[2]),Int_t(parbox[3]) );
816   V0ER->DefineSection( 0, parbox[4], parbox[5], parbox[6] );
817   V0ER->DefineSection( 1, parbox[7], parbox[8], parbox[9] );
818   
819   V0Rnode->cd();
820   V0Rnode9 = new TNode("V0ER", "V0ER",V0ER,0.0,0.0,0.0,0);
821   V0Rnode9->SetLineColor(kYellow);
822   fNodes->Add(V0Rnode9);
823
824   Float_t   dist0; 
825   Float_t   par[11];   
826     
827   dist0     =  r0 + height / 2.0;
828   thick_alu =  2.0*half_thick_alu;
829   
830   par[0]    =  half_thick_qua1;
831   par[1]    =  0.0;
832   par[2]    =  0.0;
833   par[3]    =  height / 2.0 ;
834   par[4]    =  TMath::Tan(theta) * r0;
835   par[5]    =  TMath::Tan(theta) * r5;
836   par[6]    =  0.0;
837   par[7]    =  height / 2.0 ;
838   par[8]    =  TMath::Tan(theta) * r0;
839   par[9]    =  TMath::Tan(theta) * r5;
840   par[10]   =  0.0;
841     
842   TTRAP *V0R0 = new TTRAP("V0R0", "V0R0", "void", par[0], par[1], par[2], par[3],
843                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
844                 
845   Float_t   dist1;
846   Float_t   r1;
847   Float_t   offset; 
848     
849   dist1     =  (- height + height1) /2.0; 
850   r1        =  r0 + height1;
851   offset    = - fThickness/2.0 + 0.1; 
852    
853   par[0]    =  half_thick_qua1 - thick_alu;
854   par[3]    =  height1 / 2.0 - thick_alu;
855   par[4]    =  TMath::Tan(theta) * r0 - thick_alu;
856   par[5]    =  TMath::Tan(theta) * r1- thick_alu;
857   par[7]    =  height1 / 2.0 - thick_alu;
858   par[8]    =  TMath::Tan(theta) * r0 - thick_alu;
859   par[9]    =  TMath::Tan(theta) * r1 - thick_alu;
860   
861   TTRAP *V0R1 = new TTRAP("V0R1", "V0R1", "void", par[0], par[1], par[2], par[3],
862                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
863                 
864
865   Float_t   dist2;
866   Float_t   r2; 
867     
868   dist2     =    (- height + height2) /2.0 + height1;
869   r2        =       r1 + height2; 
870   
871   par[0]    =  half_thick_qua2 - thick_alu;   
872   par[3]    =  height2 / 2.0 - thick_alu;
873   par[4]    =  TMath::Tan(theta) * r1 - thick_alu;
874   par[5]    =  TMath::Tan(theta) * r2 - thick_alu;
875   par[7]    =  height2 / 2.0 - thick_alu;
876   par[8]    =  TMath::Tan(theta) * r1 - thick_alu;
877   par[9]    =  TMath::Tan(theta) * r2 - thick_alu;
878
879
880   TTRAP *V0R2 = new TTRAP("V0R2", "V0R2", "void", par[0], par[1], par[2], par[3],
881                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
882  
883
884   Float_t   dist3;
885   Float_t   r3; 
886     
887   dist3     =    (- height + height3) /2.0 + height1 + height2;
888   r3        =       r2 + height3; 
889    
890   par[0]    =  half_thick_qua3 - thick_alu;   
891   par[3]    =  height3 / 2.0 - thick_alu;
892   par[4]    =  TMath::Tan(theta) * r2 - thick_alu;
893   par[5]    =  TMath::Tan(theta) * r3 - thick_alu;
894   par[7]    =  height3 / 2.0 - thick_alu;
895   par[8]    =  TMath::Tan(theta) * r2 - thick_alu;
896   par[9]    =  TMath::Tan(theta) * r3 - thick_alu;
897
898
899   TTRAP *V0R3 = new TTRAP("V0R3", "V0R3", "void", par[0], par[1], par[2], par[3],
900                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
901  
902
903   Float_t   dist4;
904   Float_t   r4; 
905     
906   dist4     =    (- height + height4) /2.0 + height1 + height2 + height3;
907   r4        =       r3 + height4; 
908    
909   par[0]    =  half_thick_qua4 - thick_alu;   
910   par[3]    =  height4 / 2.0 - thick_alu;
911   par[4]    =  TMath::Tan(theta) * r3 - thick_alu;
912   par[5]    =  TMath::Tan(theta) * r4 - thick_alu;
913   par[7]    =  height4 / 2.0 - thick_alu;
914   par[8]    =  TMath::Tan(theta) * r3 - thick_alu;
915   par[9]    =  TMath::Tan(theta) * r4 - thick_alu;
916
917
918   TTRAP *V0R4 = new TTRAP("V0R4", "V0R4", "void", par[0], par[1], par[2], par[3],
919                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
920
921
922   Float_t   dist5;
923     
924   dist5     =    (- height + height5) /2.0 + height1 + height2 + height3 + height4;
925   
926   par[0]    =  half_thick_qua5 - thick_alu;      
927   par[3]    =  height5 / 2.0 - thick_alu;
928   par[4]    =  TMath::Tan(theta) * r4 - thick_alu;
929   par[5]    =  TMath::Tan(theta) * r5 - thick_alu;
930   par[7]    =  height5 / 2.0 - thick_alu;
931   par[8]    =  TMath::Tan(theta) * r4 - thick_alu;
932   par[9]    =  TMath::Tan(theta) * r5 - thick_alu;
933
934
935   TTRAP *V0R5 = new TTRAP("V0R5", "V0R5", "void", par[0], par[1], par[2], par[3],
936                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
937
938                 
939   Float_t  phi;
940   Float_t  phi_deg= 180./6.;
941   Float_t  phi_rad;
942   Float_t  xdet,ydet;
943   Int_t    n_detec_R = 1; 
944
945   char     NameNode[12];  
946
947  
948   for (phi = 15.0; phi < 360.0; phi = phi + phi_deg) 
949   {
950      
951     TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );        
952     
953     phi_rad = phi*pi/180.;
954     xdet = dist0*TMath::Sin(phi_rad);
955     ydet = dist0*TMath::Cos(phi_rad);
956     
957   
958     sprintf(NameNode,"SUBDER%d",n_detec_R);
959     
960     V0Rnode->cd();
961     V0Rnode0 = new TNode(NameNode,NameNode,V0R0,-xdet,ydet, offset + half_thick_qua1,mat920);    
962     V0Rnode0->SetLineColor(kColorVZERO);
963     fNodes->Add(V0Rnode0);
964     n_detec_R++;
965     
966     sprintf(NameNode,"SUBDER%d",n_detec_R);
967     V0Rnode0->cd();    
968     V0Rnode1 = new TNode(NameNode,NameNode,V0R1,0.0,dist1, 0.0,0);       
969     V0Rnode1->SetLineColor(kColorVZERO);
970     fNodes->Add(V0Rnode1);
971     n_detec_R++;
972     
973     sprintf(NameNode,"SUBDER%d",n_detec_R);
974     V0Rnode0->cd();    
975     V0Rnode2 = new TNode(NameNode,NameNode,V0R2,0.0,dist2, - half_thick_qua1 + half_thick_qua2,0);       
976     V0Rnode2->SetLineColor(kColorVZERO);
977     fNodes->Add(V0Rnode2);
978     n_detec_R++;
979
980
981     sprintf(NameNode,"SUBDER%d",n_detec_R);
982     V0Rnode0->cd();    
983     V0Rnode3 = new TNode(NameNode,NameNode,V0R3,0.0,dist3, - half_thick_qua1 + half_thick_qua3,0);       
984     V0Rnode3->SetLineColor(kColorVZERO);
985     fNodes->Add(V0Rnode3);
986     n_detec_R++;
987
988     sprintf(NameNode,"SUBDER%d",n_detec_R);
989     V0Rnode0->cd();    
990     V0Rnode4 = new TNode(NameNode,NameNode,V0R4,0.0,dist4, - half_thick_qua1 + half_thick_qua4,0);       
991     V0Rnode4->SetLineColor(kColorVZERO);
992     fNodes->Add(V0Rnode4);
993     n_detec_R++;
994      
995     sprintf(NameNode,"SUBDER%d",n_detec_R);
996     V0Rnode0->cd();    
997     V0Rnode5 = new TNode(NameNode,NameNode,V0R5,0.0,dist5, - half_thick_qua1 + half_thick_qua5,0);       
998     V0Rnode5->SetLineColor(kColorVZERO);
999     fNodes->Add(V0Rnode5);
1000     n_detec_R++;
1001        
1002     V0Rnode0->SetVisibility(2);
1003     
1004   }  
1005
1006
1007 // Left side of VZERO :
1008   
1009   
1010   Float_t   dist0_left;   
1011   Float_t   r0_left      =   4.3;   
1012   Float_t   height1_left =   2.6; 
1013   Float_t   height2_left =   4.1;
1014   Float_t   height3_left =   6.4;
1015   Float_t   height4_left =  10.2;
1016   Float_t   height5_left =  16.9;
1017   Float_t   height_left  = height1_left + height2_left + height3_left 
1018                                         + height4_left + height5_left;
1019   Float_t   r5_left      = r0_left  + height_left; 
1020
1021   partube[0] =  r0_left;
1022   partube[1] = (r5_left) / TMath::Cos(theta);
1023   partube[2] = fThickness1/2.0; 
1024   
1025   TTUBE *V0LE = new TTUBE("V0LE", "V0LE", "void", partube[0], partube[1], partube[2]);
1026                 
1027   Top->cd();
1028   
1029   V0Lnode = new TNode("V0LE","V0LE",V0LE,0.0,0.0,-350.0-fThickness1/2.0,0);
1030   
1031   V0Lnode->SetLineColor(kBlue);
1032   fNodes->Add(V0Lnode);
1033   
1034   V0Lnode->SetVisibility(2);
1035   
1036   dist0_left  =  r0_left + height_left / 2.0;
1037   thick_alu   =  2.0*half_thick_alu;
1038   
1039   par[0]      =  half_thick_qua1;
1040   par[1]      =  0.0;
1041   par[2]      =  0.0;
1042   par[3]      =  height_left / 2.0 ;
1043   par[4]      =  TMath::Tan(theta) * r0_left;
1044   par[5]      =  TMath::Tan(theta) * r5_left;
1045   par[6]      =  0.0;
1046   par[7]      =  height_left / 2.0 ;
1047   par[8]      =  TMath::Tan(theta) * r0_left;
1048   par[9]      =  TMath::Tan(theta) * r5_left;
1049   par[10]     =  0.0;
1050   
1051   TTRAP *V0L0 = new TTRAP("V0L0", "V0L0", "void", par[0], par[1], par[2], par[3],
1052                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
1053                 
1054   
1055   Float_t   dist1_left;
1056   Float_t   r1_left;
1057   Float_t   offset_left;
1058      
1059   dist1_left     =  (- height_left + height1_left) /2.0; 
1060   r1_left        =  r0_left + height1_left;
1061   offset_left    = - fThickness1/2.0 + 0.1; 
1062    
1063   par[0]    =  half_thick_qua1 - thick_alu;
1064   par[3]    =  height1_left / 2.0 - thick_alu;
1065   par[4]    =  TMath::Tan(theta) * r0_left - thick_alu;
1066   par[5]    =  TMath::Tan(theta) * r1_left- thick_alu;
1067   par[7]    =  height1_left / 2.0 - thick_alu;
1068   par[8]    =  TMath::Tan(theta) * r0_left - thick_alu;
1069   par[9]    =  TMath::Tan(theta) * r1_left - thick_alu;
1070
1071   TTRAP *V0L1 = new TTRAP("V0L1", "V0L1", "void", par[0], par[1], par[2], par[3],
1072                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
1073  
1074   Float_t   dist2_left;
1075   Float_t   r2_left; 
1076     
1077   dist2_left     =    (- height_left + height2_left) /2.0 + height1_left;
1078   r2_left        =       r1_left + height2_left; 
1079   
1080   par[0]    =  half_thick_qua1 - thick_alu;   
1081   par[3]    =  height2_left / 2.0 - thick_alu;
1082   par[4]    =  TMath::Tan(theta) * r1_left - thick_alu;
1083   par[5]    =  TMath::Tan(theta) * r2_left - thick_alu;
1084   par[7]    =  height2_left / 2.0 - thick_alu;
1085   par[8]    =  TMath::Tan(theta) * r1_left - thick_alu;
1086   par[9]    =  TMath::Tan(theta) * r2_left - thick_alu;
1087
1088   TTRAP *V0L2 = new TTRAP("V0L2", "V0L2", "void", par[0], par[1], par[2], par[3],
1089                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
1090  
1091
1092   
1093   Float_t   dist3_left;
1094   Float_t   r3_left;
1095      
1096   dist3_left     =    (- height_left + height3_left) /2.0 + height1_left + height2_left;
1097   r3_left        =       r2_left + height3_left; 
1098    
1099   par[0]    =  half_thick_qua1 - thick_alu;   
1100   par[3]    =  height3_left / 2.0 - thick_alu;
1101   par[4]    =  TMath::Tan(theta) * r2_left - thick_alu;
1102   par[5]    =  TMath::Tan(theta) * r3_left - thick_alu;
1103   par[7]    =  height3_left / 2.0 - thick_alu;
1104   par[8]    =  TMath::Tan(theta) * r2_left - thick_alu;
1105   par[9]    =  TMath::Tan(theta) * r3_left - thick_alu;
1106   
1107   TTRAP *V0L3 = new TTRAP("V0L3", "V0L3", "void", par[0], par[1], par[2], par[3],
1108                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
1109  
1110    
1111   Float_t   dist4_left;
1112   Float_t   r4_left;
1113        
1114   dist4_left     =    (- height_left + height4_left) /2.0 + height1_left 
1115                                      + height2_left + height3_left;
1116   r4_left        =       r3_left + height4_left; 
1117    
1118   par[0]    =  half_thick_qua1 - thick_alu;   
1119   par[3]    =  height4_left / 2.0 - thick_alu;
1120   par[4]    =  TMath::Tan(theta) * r3_left - thick_alu;
1121   par[5]    =  TMath::Tan(theta) * r4_left - thick_alu;
1122   par[7]    =  height4_left / 2.0 - thick_alu;
1123   par[8]    =  TMath::Tan(theta) * r3_left - thick_alu;
1124   par[9]    =  TMath::Tan(theta) * r4_left - thick_alu;
1125   
1126   TTRAP *V0L4 = new TTRAP("V0L4", "V0L4", "void", par[0], par[1], par[2], par[3],
1127                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
1128                 
1129
1130   Float_t   dist5_left;
1131
1132          
1133   dist5_left     =    (- height_left + height5_left) /2.0 + height1_left 
1134                                      + height2_left + height3_left + height4_left;
1135
1136    
1137   par[0]    =  half_thick_qua1 - thick_alu;   
1138   par[3]    =  height5_left / 2.0 - thick_alu;
1139   par[4]    =  TMath::Tan(theta) * r4_left - thick_alu;
1140   par[5]    =  TMath::Tan(theta) * r5_left - thick_alu;
1141   par[7]    =  height5_left / 2.0 - thick_alu;
1142   par[8]    =  TMath::Tan(theta) * r4_left - thick_alu;
1143   par[9]    =  TMath::Tan(theta) * r5_left - thick_alu;
1144   
1145   TTRAP *V0L5 = new TTRAP("V0L5", "V0L5", "void", par[0], par[1], par[2], par[3],
1146                 par[4], par[5], par[6], par[7], par[8], par[9], par[10]);
1147
1148
1149   Int_t    n_detec_L = 1;
1150  
1151   for (phi = 15.0; phi < 360.0; phi = phi + phi_deg) 
1152   {
1153      
1154     TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );        
1155     
1156     phi_rad = phi*pi/180.;
1157     xdet = dist0_left*TMath::Sin(phi_rad);
1158     ydet = dist0_left*TMath::Cos(phi_rad);
1159     
1160   
1161     sprintf(NameNode,"SUBDEL%d",n_detec_L);
1162     
1163     V0Lnode->cd();
1164     V0Lnode0 = new TNode(NameNode,NameNode,V0L0,-xdet,ydet, offset_left + half_thick_qua1,mat920);       
1165     V0Lnode0->SetLineColor(kColorVZERO);
1166     fNodes->Add(V0Lnode0);
1167     n_detec_L++;
1168     
1169     sprintf(NameNode,"SUBDEL%d",n_detec_L);
1170     V0Lnode0->cd();    
1171     V0Lnode1 = new TNode(NameNode,NameNode,V0L1,0.0,dist1_left, 0.0,0);  
1172     V0Lnode1->SetLineColor(kColorVZERO);
1173     fNodes->Add(V0Lnode1);
1174     n_detec_L++;
1175     
1176     sprintf(NameNode,"SUBDEL%d",n_detec_L);
1177     V0Lnode0->cd();    
1178     V0Lnode2 = new TNode(NameNode,NameNode,V0L2,0.0,dist2_left, 0.0,0);  
1179     V0Lnode2->SetLineColor(kColorVZERO);
1180     fNodes->Add(V0Lnode2);
1181     n_detec_L++;
1182
1183
1184     sprintf(NameNode,"SUBDEL%d",n_detec_L);
1185     V0Lnode0->cd();    
1186     V0Lnode3 = new TNode(NameNode,NameNode,V0L3,0.0,dist3_left, 0.0,0);  
1187     V0Lnode3->SetLineColor(kColorVZERO);
1188     fNodes->Add(V0Lnode3);
1189     n_detec_L++;
1190
1191     sprintf(NameNode,"SUBDEL%d",n_detec_L);
1192     V0Lnode0->cd();    
1193     V0Lnode4 = new TNode(NameNode,NameNode,V0L4,0.0,dist4_left, 0.0,0);  
1194     V0Lnode4->SetLineColor(kColorVZERO);
1195     fNodes->Add(V0Lnode4);
1196     n_detec_L++;
1197      
1198     sprintf(NameNode,"SUBDEL%d",n_detec_L);
1199     V0Lnode0->cd();    
1200     V0Lnode5 = new TNode(NameNode,NameNode,V0L5,0.0,dist5_left, 0.0,0);  
1201     V0Lnode5->SetLineColor(kColorVZERO);
1202     fNodes->Add(V0Lnode5);
1203     n_detec_L++;
1204        
1205     V0Lnode0->SetVisibility(2);
1206     
1207   }    
1208
1209         
1210 }  
1211     
1212
1213 //------------------------------------------------------------------------
1214 void AliVZEROv0::CreateMaterials()
1215 {
1216     Int_t i;
1217
1218     printf("\n");
1219     for(i=0;i<30;i++) printf("*");
1220     printf(" VZERO create materials ");
1221     for(i=0;i<30;i++) printf("*");
1222     printf("\n");
1223     
1224
1225     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, 
1226                            6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
1227
1228            
1229     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, 
1230                                6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
1231                            
1232     Float_t rindex_quarz[14] = { 1.52398,  1.53090, 1.53835, 1.54641, 1.55513, 1.56458, 
1233                                  1.57488,  1.58611, 1.59842, 1.61197, 1.62696, 1.64362, 
1234                                  1.662295, 1.68337 };
1235                                  
1236     Float_t absco_quarz[14] = { 105.8,  45.656, 35.665, 28.598, 25.007, 21.04, 17.525, 
1237                                 14.177, 9.282, 4.0925, 1.149, 0.3627, 0.1497, 0.05 };   
1238                                                                                         
1239     Float_t effic_all[14]   = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1240     
1241         
1242     Float_t rindex_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. }; 
1243     
1244     
1245     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,
1246                                1e-4,1e-4,1e-4,1e-4 };
1247     Float_t effic_alu[14]  = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1248
1249
1250     Int_t *idtmed = fIdtmed->GetArray()-2999;
1251     
1252     
1253 //  Parameters related to Quarz (SiO2) :
1254  
1255     Float_t aqua[2], zqua[2], densqua, wmatqua[2];
1256     Int_t nlmatqua;
1257     
1258     aqua[0]    = 28.09;
1259     aqua[1]    = 16.;
1260     zqua[0]    = 14.;
1261     zqua[1]    = 8.;
1262     densqua    = 2.64;
1263     nlmatqua   = -2;
1264     wmatqua[0] = 1.;
1265     wmatqua[1] = 2.;
1266
1267 // Parameters  related to aluminum sheets :
1268     
1269     Float_t  aal   = 26.98;
1270     Float_t  zal   = 13.00; 
1271     Float_t  densal=   2.7; 
1272     Float_t  radlal=   8.9;
1273        
1274 // Parameters  related to scintillator CH :
1275     
1276     Float_t ascin[2] = {1.01,12.01};
1277     Float_t zscin[2] = {1,6};
1278     Float_t wscin[2] = {1,1};
1279     Float_t denscin  = 1.03;
1280     
1281 //  Definition of materials :
1282        
1283     AliMaterial( 1, "AIR A$", 14.61, 7.3, .001205, 30420., 67500, 0, 0);
1284     AliMaterial(11, "AIR I$", 14.61, 7.3, .001205, 30420., 67500, 0, 0);
1285     AliMaterial( 2, "CARBON$"  , 12.01, 6.0, 2.265, 18.8, 49.9, 0, 0);
1286     AliMixture(  3, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
1287     AliMaterial( 4, "ALUMINIUM1$", 26.98, 13., 2.7, 8.9, 37.2, 0, 0);
1288     AliMaterial( 5, "ALUMINIUM2$", aal, zal, densal, radlal, 0, 0, 0);
1289     
1290     
1291     AliMixture( 6, "Scintillator$",ascin,zscin,denscin,-2,wscin);
1292     
1293      
1294     Int_t   ISXFLD = gAlice->Field()->Integ();
1295     Float_t SXMGMX = gAlice->Field()->Max();
1296     
1297     Float_t tmaxfd, stemax, deemax, epsil, stmin;
1298     
1299     tmaxfd = 10.;
1300     stemax = 0.1;
1301     deemax = 0.1;     
1302     epsil  = 0.001;
1303     stmin  = 0.001;
1304               
1305     printf(" \n");
1306     printf(" StepQua,    StepAlu    = %f %f \n",fMaxStepQua,fMaxStepAlu);
1307     printf(" DeStepQua,  DeStepAlu  = %f %f \n",fMaxDestepQua,fMaxDestepAlu);
1308     printf(" \n");    
1309
1310
1311 //  Active Air :    
1312     AliMedium(1, "ACTIVE AIR$", 1, 1, ISXFLD, SXMGMX,
1313               10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
1314
1315 //  Inactive air : 
1316   
1317     AliMedium(11, "INACTIVE AIR$", 11, 0, ISXFLD, SXMGMX,
1318               10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
1319     
1320     AliMedium(2, "CARBON$ ", 2,  1, ISXFLD, SXMGMX,
1321               tmaxfd, stemax, deemax, epsil, stmin, 0, 0);   
1322
1323     AliMedium(3, "QUARZ$", 3, 1, ISXFLD, SXMGMX,
1324               tmaxfd, fMaxStepQua, fMaxDestepQua, epsil, stmin, 0, 0);
1325     
1326     AliMedium(4,"ALUMINUM1$",4, 1, ISXFLD, SXMGMX,
1327               tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
1328               
1329
1330     AliMedium(5,"ALUMINUM2$",5, 1, ISXFLD, SXMGMX,
1331               tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);    
1332
1333     AliMedium(6,"SCINTILLATOR$",6, 1, ISXFLD, SXMGMX, 10., .01, 1., .003, .003, 0, 0);
1334
1335     gMC->Gstpar(idtmed[3000], "LOSS", 1.);  //  [3000] = air ACTIF  [3010] = air INACTIF
1336     gMC->Gstpar(idtmed[3000], "HADR", 1.);
1337     gMC->Gstpar(idtmed[3000], "DCAY", 1.);
1338     gMC->Gstpar(idtmed[3000], "DRAY", 1.);
1339     
1340     gMC->Gstpar(idtmed[3001], "LOSS", 1.);  //  [3001] = carbon
1341     gMC->Gstpar(idtmed[3001], "HADR", 1.);
1342     gMC->Gstpar(idtmed[3001], "DCAY", 1.);
1343     gMC->Gstpar(idtmed[3001], "DRAY", 1.);
1344
1345     gMC->Gstpar(idtmed[3002], "LOSS", 1.);  //  [3002] = quartz
1346     gMC->Gstpar(idtmed[3002], "HADR", 1.);
1347     gMC->Gstpar(idtmed[3002], "DCAY", 1.);
1348     gMC->Gstpar(idtmed[3002], "DRAY", 1.);  
1349     gMC->Gstpar(idtmed[3002], "CUTGAM",0.5E-4) ; 
1350     gMC->Gstpar(idtmed[3002], "CUTELE",1.0E-4) ;
1351     
1352     gMC->Gstpar(idtmed[3003], "LOSS", 1.);  //  [3003] = normal aluminum
1353     gMC->Gstpar(idtmed[3003], "HADR", 1.);
1354     gMC->Gstpar(idtmed[3003], "DCAY", 1.);
1355     gMC->Gstpar(idtmed[3003], "DRAY", 1.);
1356     
1357     gMC->Gstpar(idtmed[3004], "LOSS", 1.);  //  [3004] = reflecting aluminum
1358     gMC->Gstpar(idtmed[3004], "HADR", 1.);
1359     gMC->Gstpar(idtmed[3004], "DCAY", 1.);
1360     gMC->Gstpar(idtmed[3004], "DRAY", 1.);
1361     gMC->Gstpar(idtmed[3004], "CUTGAM",0.5E-4) ; 
1362     gMC->Gstpar(idtmed[3004], "CUTELE",1.0E-4) ;
1363     
1364     gMC->Gstpar(idtmed[3005], "LOSS", 1.);  //  [3005] = scintillator
1365     gMC->Gstpar(idtmed[3005], "HADR", 1.);
1366     gMC->Gstpar(idtmed[3005], "DCAY", 1.);
1367     gMC->Gstpar(idtmed[3005], "DRAY", 1.);    
1368     
1369     gMC->SetCerenkov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);    
1370     gMC->SetCerenkov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
1371
1372     
1373 }
1374 //---------------------------------------------------------------------
1375 void AliVZEROv0::DrawModule()
1376 {
1377
1378 //  Drawing is done in DrawVZERO.C
1379
1380    Int_t i;
1381
1382    printf("\n");
1383    for(i=0;i<30;i++) printf("*");
1384    printf(" VZERO DrawModule ");
1385    for(i=0;i<30;i++) printf("*");
1386    printf("\n");
1387
1388
1389 }
1390
1391 //-------------------------------------------------------------------
1392 void AliVZEROv0::Init()
1393 {
1394 // Initialises version 0 of the VZERO Detector
1395 // Just prints an information message
1396   
1397    printf(" VZERO version %d initialized \n",IsVersion());
1398    
1399 //   gMC->SetMaxStep(fMaxStepAlu);
1400 //   gMC->SetMaxStep(fMaxStepQua);
1401    
1402 //   AliVZERO::Init();
1403   
1404 }
1405
1406 //-------------------------------------------------------------------
1407
1408 void AliVZEROv0::StepManager()
1409 {
1410   
1411 //   (Very)Minimal version of StepManager 
1412
1413     
1414      Int_t  copy;
1415      static Int_t vol[4];
1416      static Float_t hits[15];
1417      
1418      TLorentzVector pos;
1419      
1420      TLorentzVector mom;
1421      Float_t        theta;
1422      Float_t        phi;
1423      Float_t        kRaddeg = 180/TMath::Pi();
1424      Float_t        RingNumber;
1425
1426      Int_t ipart;
1427      
1428           
1429 //     TGeant3 *geant3 = (TGeant3*) gMC;     
1430 //     Int_t  Nphot = geant3->Gckin2()->ngphot;
1431      
1432
1433 //   Only charged tracks :
1434      
1435      if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return; 
1436
1437
1438      vol[0]    = gMC->CurrentVolOffID(1, vol[1]);
1439      vol[2]    = gMC->CurrentVolID(copy);
1440      vol[3]    = copy;
1441
1442      if      ( gMC->CurrentVolID(copy) == gMC->VolId("V0R1") ||
1443                gMC->CurrentVolID(copy) == gMC->VolId("V0L1") )
1444                RingNumber = 1.0;
1445      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R2") ||
1446                gMC->CurrentVolID(copy) == gMC->VolId("V0L2") ) 
1447                RingNumber = 2.0;  
1448      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R3") ||
1449                gMC->CurrentVolID(copy) == gMC->VolId("V0L3") )
1450                RingNumber = 3.0;
1451      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R4") ||
1452                gMC->CurrentVolID(copy) == gMC->VolId("V0L4") )   
1453                RingNumber = 4.0; 
1454      else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R5") ||
1455                gMC->CurrentVolID(copy) == gMC->VolId("V0L5") )    
1456                RingNumber = 5.0; 
1457      else
1458                RingNumber = 0.0;
1459
1460      if (gMC->IsTrackEntering() && RingNumber > 0.5) {
1461        
1462          gMC->TrackPosition(pos);
1463      
1464          gMC->TrackMomentum(mom);      
1465          Double_t tc   = mom[0]*mom[0]+mom[1]*mom[1];
1466          Double_t Pt   = TMath::Sqrt(tc);
1467          Double_t Pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
1468
1469          theta   = Float_t(TMath::ATan2(Pt,Double_t(mom[2])))*kRaddeg;
1470          phi     = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1471      
1472          ipart  = gMC->TrackPid();
1473
1474          hits[0]  = pos[0];
1475          hits[1]  = pos[1];
1476          hits[2]  = pos[2];              
1477          hits[3]  =  ipart; 
1478          
1479 //         Float_t ttime = gMC->TrackTime();
1480 //         hits[4] = ttime*1e9;
1481
1482          hits[4]  = gMC->TrackTime();
1483          hits[5]  = gMC->TrackCharge();
1484          hits[6]  = theta;
1485          hits[7]  = phi;
1486          hits[8]  = RingNumber;
1487          
1488          hits[9]  = Pt;
1489          hits[10] = Pmom;
1490          hits[11] = mom[0];
1491          hits[12] = mom[1];
1492          hits[13] = mom[2];
1493          
1494
1495          AddHit(gAlice->CurrentTrack(), vol, hits);
1496          
1497          }
1498      
1499 }
1500
1501 //_____________________________________________________________________________
1502 void AliVZEROv0::AddHit(Int_t track, Int_t *vol, Float_t *hits)
1503 {
1504   //
1505   // Add a VZERO hit
1506   //
1507
1508   TClonesArray &lhits = *fHits;
1509   new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
1510 }
1511
1512 //---------------------------------------------------------------------
1513 void AliVZEROv0::AddDigits(Int_t *tracks, Int_t* digits) 
1514 {
1515
1516    TClonesArray  &ldigits = *fDigits;
1517    new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
1518 }
1519
1520 //---------------------------------------------------------------------
1521 void AliVZEROv0::MakeBranch(Option_t *option)
1522 {
1523   
1524   // Creates new branches in the current Root Tree
1525   
1526   
1527   char branchname[10];
1528   sprintf(branchname,"%s",GetName());
1529   printf(" fBufferSize = %d \n",fBufferSize);
1530   
1531   const char *H = strstr(option,"H");
1532   
1533   if (fHits   && gAlice->TreeH() && H) {
1534     gAlice->TreeH()->Branch(branchname,&fHits, fBufferSize);
1535     printf("* AliDetector::MakeBranch * Making Branch %s for hits\n",branchname);
1536   }     
1537
1538   const char *D = strstr(option,"D");
1539   //
1540   if (fDigits   && gAlice->TreeD() && D) {
1541     gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize);
1542     printf("* AliDetector::MakeBranch * Making Branch %s for digits\n",branchname);
1543   }  
1544    
1545 }