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