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