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