Andreas's improvement of support
[u/mrichter/AliRoot.git] / START / AliSTARTv1.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 // START ( T-zero) detector  version 1                             //
20 //
21 //Begin Html       
22 /*
23 <img src="gif/AliSTARTv1Class.gif">
24 */
25 //End Html
26 //                                                                  //
27 //                                                                  //
28 //////////////////////////////////////////////////////////////////////
29
30 #include <Riostream.h>
31 #include <stdlib.h>
32
33 #include <TGeometry.h>
34 #include <TLorentzVector.h>
35 #include <TMath.h>
36 #include <TNode.h>
37 #include <TTUBE.h>
38 #include <TVirtualMC.h>
39
40 #include "AliMagF.h"
41 #include "AliRun.h"
42 #include "AliSTARThit.h"
43 #include "AliSTARTv1.h"
44 #include "AliMC.h"
45
46 ClassImp(AliSTARTv1)
47
48 //--------------------------------------------------------------------
49 AliSTARTv1::AliSTARTv1(const char *name, const char *title):
50  AliSTART(name,title)
51 {
52   //
53   // Standart constructor for START Detector version 0
54   //
55   fIdSens1=0;
56 //  setBufferSize(128000);
57 }
58 //-------------------------------------------------------------------------
59 void AliSTARTv1::CreateGeometry()
60 {
61   //
62   // Create the geometry of START Detector version 0
63   //
64   // begin Html
65   /*
66    <img src="gif/AliSTARTv0.gif">
67   */
68   //
69
70
71   Int_t *idtmed = fIdtmed->GetArray();
72   
73   Int_t is;
74   Int_t idrotm[999];
75   Float_t x,y,z;
76
77   Float_t pstartR[18]={0., 360., 5., 
78                        -76.5+0.00+69.7, 4.25, 10.,
79                        -76.5+6.05+69.7, 4.5, 10., 
80                        -76.5+8.05+69.7, 4.5, 10.,
81                        -76.5+8.05+69.7, 5.1, 10.,
82                        -62.9+0.00+69.7, 5.1, 10.};
83   
84   Float_t pstart[3]={4.3, 10.,6.8};
85   Float_t pinstart[3]={0.,1.6,6.5};
86   Float_t ppmt[3]={0.,1.3,3.5};
87   Float_t pdivider[3]={0.,1.2,1.75};
88   Float_t pdiv2[3]={0.,1.2,1.25};
89   Float_t pdiv1[3]={0.6,1.2,0.5};
90   Float_t ptop[3]={0.,1.3,1.5};
91   Float_t pbot[3]={0.6,1.2,0.1};
92   Float_t pglass[3]={1.2,1.3,2.};
93   Float_t pcer[3]={0.9,1.1,0.09};
94   Float_t psteel[3]={0.9,1.1,0.01};
95   Float_t ppins[3]={0.6,1.2,0.014};
96   Float_t phole[3]={0.6,1.2,0.015};
97   Float_t pknob[3]={0.5,0.6,0.4};
98   Float_t pknob_vac[3]={0.,0.5,0.4};
99   Float_t pknob_bot[3]={0.,0.6,0.05};
100   Float_t pribber[3] = {0.,1.2,2.413/2.};
101   Float_t presist[3] = {0.,1.2,0.087/2.};
102   Float_t psupport1[3] = {4.51,4.6,4.0};//C kozhuh vnutri
103   Float_t psupport2[3] = {9.4,9.5,4.0};// snaruzhi  C
104   Float_t psupport3[3] = {4.51,9.5,0.05};//kryshki  C
105   Float_t psupport4[3] = {0,1.6,0.05};// dyrki dlia feu v zadnej kryshke Air
106   Float_t psupport5[3] = {1.44,1.5,6.5}; // stakanchik dlai feu  C
107   Float_t psupport6[3] = {0,1.5,0.05}; //kryshechka stakanchika  Al
108   Float_t psupport7[3] = {1.5,1.6,0.6}; //kolechko snaruzhu stakanchika Al
109   // Mother Volume katushka dlia krepezha vokrug truby k Absorbru
110     AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
111   Float_t ppcon[70]; 
112     ppcon[0]  =   0;
113     ppcon[1]  = 360;
114     ppcon[2]  =  13;
115 //  1: 
116     ppcon[3]  =  14.1/2;
117     ppcon[4]  =   4.4;
118     ppcon[5]  =   4.5;
119 //  2
120     ppcon[6]  = ppcon[3]+1.;
121     ppcon[7]  =   4.4;
122     ppcon[8]  =   4.5;
123 //  3
124     ppcon[9]  = ppcon[6];
125     ppcon[10] =   4.4;
126     ppcon[11] =   5.1;
127
128 //  4
129
130     ppcon[12]  = ppcon[9]+0.1;
131     ppcon[13] =   4.4;
132     ppcon[14] =   5.1;
133 //  5
134
135     ppcon[15]  = ppcon[12];
136     ppcon[16] =   4.9;
137     ppcon[17] =   5.1;
138     
139 //  6
140     ppcon[18]  = ppcon[15]+7.05;
141     ppcon[19] =   4.9;
142     ppcon[20] =   5.1;
143     
144 //  7
145     ppcon[21]  = ppcon[18];
146     ppcon[22] =   4.9;
147     ppcon[23] =   5.1;
148
149     
150 /// 8
151     ppcon[24]  = ppcon[21];
152     ppcon[25] =   3.15;
153     ppcon[26] =   3.25;
154     
155 //  9
156     ppcon[27]  = ppcon[24]+4.5;
157     ppcon[28] =   3.15;
158     ppcon[29] =   3.25;
159
160 //  10
161     ppcon[30] = ppcon[27];
162     ppcon[31] =   3.15;
163     ppcon[32] =   3.25;
164
165 //  11
166     ppcon[33]  = ppcon[27];
167     ppcon[34] =   3.15;
168     ppcon[35] =   7.6;
169
170 //  12
171     ppcon[36]  = ppcon[33]+0.4;
172     ppcon[37] =   3.15;
173     ppcon[38] =   7.6;
174
175 //  13
176     ppcon[39]  = ppcon[36];
177     ppcon[40] =   3.15;
178     ppcon[41] =   7.6;
179
180     gMC->Gsvolu("0SUP", "PCON", idtmed[kAir], ppcon,42);
181     z=-69.7;//-14.1/2;
182     gMC->Gspos("0SUP",1,"ALIC",0.,0.,z,idrotm[901],"ONLY");
183
184
185    Float_t zdetRight=69.7,zdetLeft=350;
186  //-------------------------------------------------------------------
187  //  START volume 
188  //-------------------------------------------------------------------
189   
190     
191     gMC->Gsvolu("0STR","PCON",idtmed[kAir],pstartR,18);
192     gMC->Gsvolu("0STL","TUBE",idtmed[kAir],pstart,3);
193     gMC->Gspos("0STR",1,"ALIC",0.,0.,-zdetRight-pstart[2],idrotm[901],"ONLY");
194     gMC->Gspos("0STL",1,"ALIC",0.,0.,zdetLeft+pstart[2],0,"ONLY");
195
196 //START interior
197     gMC->Gsvolu("0INS","TUBE",idtmed[kAir],pinstart,3);
198     gMC->Gsvolu("0PMT","TUBE",idtmed[kVac],ppmt,3);     
199     gMC->Gsvolu("0DIV","TUBE",idtmed[kVac],pdivider,3);     
200     gMC->Gsvolu("0SU1","TUBE",idtmed[kC],psupport1,3);//C kozhuh vnutri
201     gMC->Gsvolu("0SU2","TUBE",idtmed[kC],psupport2,3);// snaruzhi  C
202     gMC->Gsvolu("0SU3","TUBE",idtmed[kC],psupport3,3);//kryshka perednaiai  C
203     gMC->Gsvolu("0SU4","TUBE",idtmed[kC],psupport3,3);//kryshka zadnaiai  C
204     gMC->Gsvolu("0SU5","TUBE",idtmed[kAir],psupport4,3);// dyrki dlia feu v zadnej kryshke Air
205     cout<<" 0Su6 >> "<<psupport5[0]<<" "<<psupport5[1]<<" "<<psupport5[2]<<endl;
206     gMC->Gsvolu("0SU6","TUBE",idtmed[kC],psupport5,3);// stakanchik dlai feu  C
207     gMC->Gsvolu("0SU7","TUBE",idtmed[kAl],psupport6,3);//kryshechka stakanchika  Al
208     gMC->Gsvolu("0SU8","TUBE",idtmed[kAl],psupport7,3);//kolechko snaruzhu stakanchika Al
209        
210 // first ring: 12 units of Scintillator+PMT+divider
211   Float_t  theta  = (180 / TMath::Pi()) * TMath::ATan(6.5 / zdetRight);
212   Float_t angel  = 2 * TMath::Pi() / 12;
213   Float_t phi[3];
214     
215    for (is=0; is<12; is++)
216       {  
217
218         x = 6.5 * TMath::Sin(is * angel);
219         y = 6.5 * TMath::Cos(is * angel);
220         
221      phi[0] = -30 * is;
222      phi[1] = 90 - is * 30;
223      phi[2] = 90 - is * 30;
224      for (Int_t j = 0; j < 3; j++)
225         if (phi[j] < 0)  phi[j] += 360;
226         
227      AliMatrix (idrotm[902 + is], 90.,         phi[0],
228                                  90. + theta, phi[1],
229                                  theta,       phi[2]);  
230         z=-pstart[2]+pinstart[2]+0.2;
231      gMC->Gspos ("0INS", is + 1, "0STR", x, y, z, idrotm[902 + is], "ONLY");
232      gMC->Gspos ("0INS", is + 13, "0STL", x, y, z, 0, "ONLY");
233       } 
234   
235       
236       x=0;
237     y=0;
238     z=-pinstart[2]+ppmt[2]+2.*psupport6[2]+0.1;
239     gMC->Gspos("0PMT",1,"0INS",x,y,z,0,"ONLY");
240     z=z+pdivider[2]+ppmt[2];
241     gMC->Gspos("0DIV",1,"0INS",x,y,z,0,"ONLY");
242       
243 // PMT
244       
245     // Entry window (glass)
246     gMC->Gsvolu("0TOP","TUBE",idtmed[kGlass],ptop,3); //glass
247      //   gMC->Gsvolu("0TOP","TUBE",idtmed[12],ptop,3); //lucite
248      z=-ppmt[2]+ptop[2];
249     gMC->Gspos("0TOP",1,"0PMT",0,0,z,0,"ONLY");
250     //     printf("Z PTOP %f -ppmt[2] %f ptop[2] %f\n",z,-ppmt[2],ptop[2]);
251     
252     // Bottom glass
253     gMC->Gsvolu("0BOT","TUBE",idtmed[kGlass],pbot,3);
254     z=ppmt[2]-pbot[2];
255     if(fDebug) printf("%s: Z bottom %f\n",ClassName(),z);
256     gMC->Gspos("0BOT",1,"0PMT",0,0,z,0,"ONLY");
257     // Side cylinder glass
258     gMC->Gsvolu("0OUT","TUBE",idtmed[kGlass],pglass,3);
259     z=ppmt[2]-pglass[2];
260     //      printf("Z glass %f\n",z);
261     gMC->Gspos("0OUT",1,"0PMT",0,0,z,0,"ONLY");
262     //PMT electrodes support structure
263     gMC->Gsvolu("0CER","TUBE",idtmed[kCer],pcer,3);
264     gMC->Gsvolu("0STE","TUBE",idtmed[kSteel],psteel,3);
265     z=-ppmt[2]+2*ptop[2]+0.3;;
266     //      printf("Z Cer 1 %f\n",z);
267     for (is=1; is<=15; is++)
268       {
269         z=z+psteel[2]+pcer[2];
270         gMC->Gspos("0CER",is,"0PMT",0,0,z,0,"ONLY");
271         z=z+psteel[2]+pcer[2];
272         gMC->Gspos("0STE",is,"0PMT",0,0,z,0,"ONLY");
273       }
274     
275     // Divider
276     // Knob at the bottom of PMT baloon
277     
278     gMC->Gsvolu("0NB","TUBE",idtmed[6],pknob,3);
279     z=-pdivider[2]+pknob[2];
280     //      printf("zknob %f\n",z);
281     gMC->Gspos("0NB",1,"0DIV",0,0,z,0,"ONLY");
282     gMC->Gsvolu("0KB","TUBE",idtmed[kGlass],pknob_bot,3);
283     z=-pdivider[2]+2*pknob[2]+pknob_bot[2];
284     //      printf(knobbot %f\n",z);
285     gMC->Gspos("0KB",1,"0DIV ",0,0,z,0,"ONLY");
286     gMC->Gsvolu("0VAC","TUBE",idtmed[kVac],pknob_vac,3);
287     z=-pdivider[2]+pknob_vac[2];
288     //      printf("knobvac %f\n",z);
289     gMC->Gspos("0VAC",1,"0DIV",0,0,z,0,"ONLY");
290     //Steel pins + pin holes
291     gMC->Gsvolu("0PIN","TUBE",idtmed[kSteel],ppins,3);
292     z=-pdivider[2]+ppins[2];
293     gMC->Gspos("0PIN",1,"0DIV",0,0,z,0,"ONLY");
294     gMC->Gsvolu("0HOL","TUBE",idtmed[kBrass],phole,3);
295     z=-pdivider[2]+2*ppins[2]+phole[2];
296     gMC->Gspos("0HOL",1,"0DIV",0,0,z,0,"ONLY");
297     
298     //Socket
299     gMC->Gsvolu("0V1","TUBE",idtmed[kCer],pdiv1,3);
300     z=-pdivider[2]+pdiv1[2];
301     gMC->Gspos("0V1",1,"0DIV",0,0,z,0,"ONLY");
302     //Resistors
303     gMC->Gsvolu("0V2","TUBE",idtmed[kAir],pdiv2,3);
304     z=pdivider[2]-pdiv2[2];
305     gMC->Gspos("0V2",1,"0DIV",0,0,z,0,"ONLY");
306     gMC->Gsvolu("0RS","TUBE",idtmed[kCer],presist,3);
307     z=-pdiv2[2]+presist[2];
308     gMC->Gspos("0RS",1,"0V2",0,0,z,0,"ONLY");
309     gMC->Gsvolu("0RB","TUBE",idtmed[kRibber],pribber,3);
310     z=pdiv2[2]-pribber[2];
311     gMC->Gspos("0RB",1,"0V2",0,0,z,0,"ONLY");
312    
313   
314     //Support  left side
315
316     z=-pstart[2]+psupport1[2];
317     gMC->Gspos("0SU1",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
318     gMC->Gspos("0SU2",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh vnutri
319     z=-pstart[2]+psupport3[2];
320     gMC->Gspos("0SU3",2,"0STL",0,0,z,0,"ONLY"); //peredniaia kryshka
321     z=-pstart[2]+2.*psupport1[2];
322     gMC->Gspos("0SU4",2,"0STL",0,0,z,0,"ONLY"); //zadnaiai kryshka
323     //Dyrki dlia feu v zadnej kryshke
324     z=0;
325     
326     for (is=1; is<=12; is++)
327       {  
328         x=6.5*TMath::Sin(is*angel);
329         y=6.5 *TMath::Cos(is*angel);
330         gMC->Gspos("0SU5",is+12,"0SU4",x,y,z,0,"ONLY");
331
332       } 
333
334     //Support  right side
335
336     z=-pstart[2]+psupport1[2]+0.1;
337     gMC->Gspos("0SU1",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
338     gMC->Gspos("0SU2",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh vnutri
339     z=-pstart[2]+psupport3[2]+0.1;
340     gMC->Gspos("0SU3",1,"0STR",0,0,z,0,"ONLY"); //peredniaia kryshka
341     z=-pstart[2]+2.*psupport1[2]+0.1;
342     gMC->Gspos("0SU4",1,"0STR",0,0,z,0,"ONLY"); //zadnaiai kryshka
343     //Dyrki dlia feu v zadnej kryshke
344     z=0;
345            
346     for (is=1; is<=12; is++)
347       {  
348         x=(6.5+7.8*TMath::Tan(5.4*3.1415/180)) *TMath::Sin(is*angel);
349         y=(6.5+7.8*TMath::Tan(5.4*3.1415/180)) *TMath::Cos(is*angel);
350         gMC->Gspos("0SU5",is,"0SU4",x,y,z,0,"ONLY");
351
352       } 
353
354     gMC->Gspos("0SU6",1,"0INS",0,0,0,0,"ONLY");//C stakanchik dlia feu 
355     z=-pinstart[2]+psupport6[2];
356     gMC->Gspos("0SU7",1,"0INS",0,0,z,0,"ONLY"); //Al kryshechka 
357     
358     z=pinstart[2]-psupport7[2];
359     gMC->Gspos("0SU8",1,"0INS",0,0,z,0,"ONLY"); //Al kolechko
360     
361         
362     Float_t par[3];
363     par[0]=4.4;
364     par[1]=4.5;
365     par[2]=0.5;
366     gMC->Gsvolu("0SC0","TUBE",idtmed[kC],par,3);
367     z=ppcon[3]+par[2];
368     gMC->Gspos("0SC0",1,"0SUP",0,0,z,0,"ONLY"); 
369     z += par[2];
370     par[0]=4.4;
371     par[1]=5.1;
372     par[2]=0.05;
373     gMC->Gsvolu("0SC1","TUBE",idtmed[kC],par,3);
374     z += par[2];
375     gMC->Gspos("0SC1",1,"0SUP",0,0,z,0,"ONLY"); 
376     z=z+par[2];
377     par[0]=4.9;
378     par[1]=5.0;
379     par[2]=6.9/2;
380     gMC->Gsvolu("0SC2","TUBE",idtmed[kC],par,3);
381     z += par[2];
382     gMC->Gspos("0SC2",1,"0SUP",0,0,z,0,"ONLY"); 
383     z += par[2];
384     /*
385     Float_t parC[5];
386     parC[0]=0.25;
387     parC[1]=5.1;
388     parC[2]=5.2;
389     parC[3]=5.5;
390     parC[4]=5.6;
391     gMC->Gsvolu("0SC3","CONE",idtmed[kC],parC,5);
392     z += parC[0];
393     gMC->Gspos("0SC3",1,"0SUP",0,0,z,0,"ONLY"); 
394     z += parC[0];
395     par[0]=5
396 .5;
397     par[1]=5.6;
398     par[2]=1.2/2;
399     gMC->Gsvolu("0SC4","TUBE",idtmed[kC],par,3);
400     z += par[2];
401     gMC->Gspos("0SC4",1,"0SUP",0,0,z,0,"ONLY"); 
402     par[0]=5.1;
403     par[1]=5.5;
404     par[2]=1.2/2;
405     gMC->Gsvolu("0SA0","TUBE",idtmed[kAl],par,3);
406     gMC->Gspos("0SA0",1,"0SUP",0,0,z,0,"ONLY"); 
407     //gvozdi dlia skruchivaniia Al i C parts
408     par[0]=5.75; 
409     par[1]=5.78;
410     gMC->Gsvolu("0SN1","TUBE",idtmed[kSteel],par,3);
411     gMC->Gspos("0SN1",1,"0SUP",0,0,z,0,"ONLY"); 
412     z += par[2];
413     */
414     par[0]=3.15;
415     par[1]=4.9;
416     par[2]=0.1/2;
417     gMC->Gsvolu("0SA1","TUBE",idtmed[kAl],par,3);
418     
419     z += par[2];
420     gMC->Gspos("0SA1",1,"0SUP",0,0,z,0,"ONLY"); 
421     z=z+par[2];
422     par[0]=3.15;
423     par[1]=3.16;
424     par[2]=4.5/2;
425     gMC->Gsvolu("0SA2","TUBE",idtmed[kAl],par,3);
426     z += par[2];
427     gMC->Gspos("0SA2",1,"0SUP",0,0,z,0,"ONLY"); 
428     z=z+par[2];
429     par[0]=3.16; // eta chast' prikruchena k absorberu
430     par[1]=7.5;
431     par[2]=0.2;
432     gMC->Gsvolu("0SA3","TUBE",idtmed[kAl],par,3);
433     z += par[2];
434     gMC->Gspos("0SA3",1,"0SUP",0,0,z,0,"ONLY"); 
435     par[0]=3.16; // gvozdi eta chast' prikruchena k absorberu
436     par[1]=7.5;
437     par[2]=0.01;
438     gMC->Gsvolu("0SN2","TUBE",idtmed[kSteel],par,3);
439     gMC->Gspos("0SN2",1,"0SUP",0,0,z,0,"ONLY"); 
440     
441  
442 }    
443 //------------------------------------------------------------------------
444 void AliSTARTv1::CreateMaterials()
445 {
446    Int_t isxfld   = gAlice->Field()->Integ();
447    Float_t sxmgmx = gAlice->Field()->Max();
448    Float_t a,z,d,radl,absl,buf[1];
449    Int_t nbuf;
450
451 // Scintillator CH
452    Float_t ascin[2]={1.01,12.01};
453    Float_t zscin[2]={1,6};
454    Float_t wscin[2]={1,1};
455    Float_t denscin=1.03;
456 //Lucite C(CH3)CO2CH3
457    Float_t alucite[3]={1.01,12.01,15.999};
458    Float_t zlucite[3]={1,6,8};
459    Float_t wlucite[3]={8,5,2};
460    Float_t denlucite=1.16;
461  // PMT glass SiO2
462    Float_t aglass[2]={28.0855,15.9994};
463    Float_t zglass[2]={14.,8.};
464    Float_t wglass[2]={1.,2.};
465    Float_t dglass=2.65;
466 // Ceramic   97.2% Al2O3 , 2.8% SiO2
467    Float_t acer[2],zcer[2],wcer[2]={0.972,0.028};
468    Float_t aal2o3[2]  = { 26.981539,15.9994 };
469    Float_t zal2o3[2]  = { 13.,8. };
470    Float_t wal2o3[2]  = { 2.,3. };
471    Float_t denscer  = 3.6;
472
473 // Brass 80% Cu, 20% Zn
474    Float_t abrass[2] = {63.546,65.39};
475    Float_t zbrass[2] = {29,30};
476    Float_t wbrass[2] = {0.8,0.2};
477    Float_t denbrass=8.96;
478
479 //Ribber C6H12S
480    Float_t aribber[3] = {12.,1.,32.};
481    Float_t zribber[3] = {6.,1.,16.};
482    Float_t wribber[3] = {6.,12.,1.};
483    Float_t denribber=0.8;
484 // Support inside 
485    Float_t asupport[2] = {12.,1.};
486    Float_t zsupport[2] = {6.,1.};
487    Float_t wsupport[2] = {1.,1.};
488    Float_t densupport=0.1;
489     
490 //*** Definition Of avaible START materials ***
491    AliMaterial(0, "START Steel$", 55.850,26.,7.87,1.76,999);
492    AliMaterial(1, "START Vacuum$", 1.e-16,1.e-16,1.e-16,1.e16,999);
493    AliMaterial(2, "START Air$", 14.61, 7.3, .001205, 30423.,999); 
494    AliMaterial(10, "CarbonPlastic$", 12.01, 6.0, 2.26, 18.8,999); 
495    AliMaterial(11, "Aliminium$", 26.98, 13.0, 2.7, 8.9,999); 
496
497    AliMixture( 3, "Al2O3   $", aal2o3, zal2o3, denscer, -2, wal2o3);
498    AliMixture( 4, "PMT glass   $",aglass,zglass,dglass,-2,wglass);
499    char namate[21]="";
500    gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
501    acer[0]=a;
502    zcer[0]=z;
503    gMC->Gfmate((*fIdmate)[4], namate, a, z, d, radl, absl, buf, nbuf);
504    acer[1]=a;
505    zcer[1]=z;
506    
507    AliMixture( 9, "Ceramic    $", acer, zcer, denscer, 2, wcer);
508    AliMixture( 5, "Scintillator$",ascin,zscin,denscin,-2,wscin);
509    AliMixture( 6, "Brass    $", abrass, zbrass, denbrass, 2, wbrass);
510    
511    AliMixture( 7, "Ribber $",aribber,zribber,denribber,-3,wribber);
512    AliMixture( 8, "Lucite$",alucite,zlucite,denlucite,-3,wlucite);
513    AliMixture( 9, "Penoplast$",asupport,zsupport,densupport,-2,wsupport);
514  
515    
516    AliMedium(1, "START Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
517    AliMedium(2, "Scintillator$", 5, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003);
518    AliMedium(3, "Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
519    AliMedium(4, "Ceramic$", 9, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
520    AliMedium(6, "Glass$", 4, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
521    AliMedium(8, "Steel$", 0, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001);
522    AliMedium(9, "Ribber  $", 7, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
523    AliMedium(11, "Brass  $", 6, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
524    AliMedium(12, "Lucite$", 8, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
525    AliMedium(13, "CarbonPlastic$", 10, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
526    AliMedium(14, "PenoPlast$", 9, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
527    AliMedium(15, "Aluminium$", 11, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
528
529    if(fDebug) cout<<ClassName()<<": ++++++++++++++Medium set++++++++++"<<endl;
530
531 }
532 //---------------------------------------------------------------------
533 void AliSTARTv1::DrawDetector()
534 {
535 //
536 // Draw a shaded view of the Forward multiplicity detector version 0
537 //
538   
539   //Set ALIC mother transparent
540   gMC->Gsatt("ALIC","SEEN",0);
541   //
542   //Set volumes visible
543   //  gMC->Gsatt("0ST","SEEN",0);
544   gMC->Gsatt("0INS","SEEN",0);
545   gMC->Gsatt("0PMT","SEEN",1);
546   gMC->Gsatt("0DIV","SEEN",1);
547   //
548   gMC->Gdopt("hide","off");
549   gMC->Gdopt("shad","on");
550   gMC->SetClipBox(".");
551   gMC->SetClipBox("*",0,1000,-1000,1000,-1000,1000);
552   gMC->DefaultRange();
553   gMC->Gdraw("alic",40,30,0,12,9.5,.7,0.7);
554   gMC->Gdhead(1111,"T-Zero detector");
555   gMC->Gdopt("hide","off");
556 }
557
558 //-------------------------------------------------------------------
559 void AliSTARTv1::Init()
560 {
561 // Initialises version 0 of the Forward Multiplicity Detector
562 //
563 //Int_t *idtmed  = gAlice->Idtmed();
564   AliSTART::Init();
565   fIdSens1=gMC->VolId("0TOP");
566   if(fDebug) printf("%s: *** START version 0 initialized ***\n",ClassName());
567  
568 }
569
570 //-------------------------------------------------------------------
571
572 void AliSTARTv1::StepManager()
573 {
574   //
575   // Called for every step in the START Detector
576   //
577   Int_t id,copy,copy1;
578   static Float_t hits[7];
579   static Float_t edep;
580   static Int_t vol[2];
581   TLorentzVector pos;
582   
583   TClonesArray &lhits = *fHits;
584   
585   if(!gMC->IsTrackAlive()) return; // particle has disappeared
586   //  Float_t charge = gMC->TrackCharge();
587   //  if(TMath::Abs(charge)<=0.) return; //take only charged particles
588   id=gMC->CurrentVolID(copy);
589   
590   
591    // Check the sensetive volume
592   if(id==fIdSens1 ) {
593     if(gMC->IsTrackEntering()) {
594       gMC->CurrentVolOffID(2,copy);
595       vol[1]=copy;
596       gMC->CurrentVolOffID(3,copy1);
597       vol[0]=copy1;
598
599       gMC->TrackPosition(pos);
600       hits[0] = pos[0];
601       hits[1] = pos[1];
602       hits[2] = pos[2];
603       if(pos[2]<0) vol[0]=2;
604       if(pos[2]>=0) vol[0]=1;
605      
606       Float_t etot=gMC->Etot();
607       hits[4]=etot;
608       Int_t iPart= gMC->TrackPid();
609       Int_t partID=gMC->IdFromPDG(iPart);
610       hits[5]=partID;
611       Float_t ttime=gMC->TrackTime();
612       hits[6]=ttime*1e9;
613       edep=0;
614     }
615     if(gMC->IsTrackInside())    {
616       Float_t de=gMC->Edep(); 
617       edep=edep+de;
618     } 
619   
620     if(gMC->IsTrackExiting())   {
621       Float_t de=gMC->Edep(); 
622       edep=edep+de;
623       hits[3]=edep*1e3;
624       new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);      
625     }
626   }
627 //---------------------------------------------------------------------
628 }
629
630
631
632
633
634
635
636
637