]> git.uio.no Git - u/mrichter/AliRoot.git/blob - START/AliSTARTv0.cxx
Adding START to the standard detectors
[u/mrichter/AliRoot.git] / START / AliSTARTv0.cxx
1 /////////////////////////////////////////////////////////////////////
2 //                                                                 //
3 // START ( T-zero) detector  version 0                        //
4 //
5 //Begin Html       
6 /*
7 <img src="gif/AliSTARTv0Class.gif">
8 */
9 //End Html
10 //                                                                  //
11 //                                                                  //
12 //////////////////////////////////////////////////////////////////////
13
14 #include <TMath.h>
15 #include <TGeometry.h>
16 #include <TTUBE.h>
17 #include <TNode.h>
18
19 #include "AliSTARTv0.h"
20 #include "AliRun.h"
21 #include "AliMC.h"
22
23 #include <iostream.h>
24 #include <fstream.h>
25
26 //#include "TGeant3.h"
27 #include <stdlib.h>
28
29 ClassImp(AliSTARTv0)
30
31 //--------------------------------------------------------------------
32 AliSTARTv0::AliSTARTv0(const char *name, const char *title):
33  AliSTART(name,title)
34 {
35   //
36   // Standart constructor for START Detector version 0
37   //
38   fIdSens1=0;
39 //  setBufferSize(128000);
40 }
41 //-------------------------------------------------------------------------
42 void AliSTARTv0::CreateGeometry()
43 {
44   //
45   // Create the geometry of START Detector version 0
46   //
47   // begin Html
48   /*
49    <img src="gif/AliSTARTv0.gif">
50   */
51   //
52
53
54   Int_t *idtmed = fIdtmed->GetArray()-2099;
55   
56   Int_t is;
57   Int_t idrotm[999];
58   Float_t x,y,z;
59
60   Float_t pstart[3]={4.5,10.7,5.3};
61   //  Float_t pscin[3]={0.,2.54/2.,1.5};
62   Float_t ppmt[3]={0.,1.3,3.5};
63   Float_t pdivider[3]={0.,1.2,1.75};
64   Float_t pdiv2[3]={0.,1.2,1.25};
65   Float_t pdiv1[3]={0.6,1.2,0.5};
66   Float_t ptop[3]={0.,1.3,1.5};
67   Float_t pbot[3]={0.6,1.2,0.1};
68   Float_t pglass[3]={1.2,1.3,2.};
69   Float_t pcer[3]={0.9,1.1,0.09};
70   Float_t psteel[3]={0.9,1.1,0.01};
71   Float_t ppins[3]={0.6,1.2,0.014};
72   Float_t phole[3]={0.6,1.2,0.015};
73   Float_t pknob[3]={0.5,0.6,0.4};
74   Float_t pknob_vac[3]={0.,0.5,0.4};
75   Float_t pknob_bot[3]={0.,0.6,0.05};
76   Float_t pribber[3] = {0.,1.2,2.413/2.};
77   Float_t presist[3] = {0.,1.2,0.087/2.};
78
79   Float_t zdet=75.;
80  //-------------------------------------------------------------------
81  //  START volume 
82  //-------------------------------------------------------------------
83
84     AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
85     gMC->Gsvolu("STRT","TUBE",idtmed[2101-1],pstart,3);
86     gMC->Gspos("STRT",1,"ALIC",0.,0.,zdet,0,"ONLY");
87     gMC->Gspos("STRT",2,"ALIC",0.,0.,-zdet,idrotm[901],"ONLY");
88
89 //START interior
90     //    gMC->Gsvolu("SCIN","TUBE",idtmed[2102-1],pscin,3);
91     gMC->Gsvolu("PMT ","TUBE",idtmed[2103-1],ppmt,3);     
92     gMC->Gsvolu("DIVI","TUBE",idtmed[2103-1],pdivider,3);     
93
94 // first ring: 13 units of Scintillator+PMT+divider
95     for (is=1; is<=13; is++)
96     {  
97       x=6.5*TMath::Sin(is*2*3.1415/13);
98       y=6.5*TMath::Cos(is*2*3.1415/13);
99       z=-pstart[2]+ppmt[2];
100       printf(" is %d x %f y %f r%f\n",is,x,y,sqrt(x*x+y*y));
101       //      gMC->Gspos("SCIN",is,"STRT",x,y,z,0,"ONLY");
102       //      z=z+pscin[2]+ppmt[2];
103       gMC->Gspos("PMT ",is,"STRT",x,y,z,0,"ONLY");
104       z=ppmt[2]+pdivider[2];
105       printf(" is %d, z Divider %f\n",is,z);
106       gMC->Gspos("DIVI",is,"STRT",x,y,z,0,"ONLY");
107     }
108 //second ring: 20 units of Scintillator+PMT+divider
109     for (is=14; is<=33;is++)  
110     {  
111       x=9.3*TMath::Sin(2.*3.1415/26+(is-13)*2*3.1415/20);
112       y=9.3*TMath::Cos(2.*3.1315/26+(is-13)*2*3.1415/20);
113       z=-pstart[2]+ppmt[2];
114       //      gMC->Gspos("SCIN",is,"STRT",x,y,z,0,"ONLY");
115       //z=z+pscin[2]+ppmt[2];
116       gMC->Gspos("PMT ",is,"STRT",x,y,z,0,"ONLY");
117       z=ppmt[2]+pdiv2[2];
118       gMC->Gspos("DIVI",is,"STRT",x,y,z,0,"ONLY");
119     }
120 // PMT
121       
122 // Entry window (glass)
123       gMC->Gsvolu("PTOP","TUBE",idtmed[2106-1],ptop,3);
124       z=-ppmt[2]+ptop[2];
125       gMC->Gspos("PTOP",1,"PMT ",0,0,z,0,"ONLY");
126  //     printf("Z PTOP %f -ppmt[2] %f ptop[2] %f\n",z,-ppmt[2],ptop[2]);
127 // Bottom glass
128       gMC->Gsvolu("PBOT","TUBE",idtmed[2106-1],pbot,3);
129       z=ppmt[2]-pbot[2];
130       printf("Z bottom %f\n",z);
131       gMC->Gspos("PBOT",1,"PMT ",0,0,z,0,"ONLY");
132 // Side cylinder glass
133       gMC->Gsvolu("POUT","TUBE",idtmed[2106-1],pglass,3);
134       z=ppmt[2]-pglass[2];
135 //      printf("Z glass %f\n",z);
136       gMC->Gspos("POUT",1,"PMT ",0,0,z,0,"ONLY");
137 //PMT electrodes support structure
138       gMC->Gsvolu("PCER","TUBE",idtmed[2104-1],pcer,3);
139       gMC->Gsvolu("PSTE","TUBE",idtmed[2108-1],psteel,3);
140       z=-ppmt[2]+2*ptop[2]+0.3;;
141 //      printf("Z Cer 1 %f\n",z);
142       for (is=1; is<=15; is++)
143       {
144          z=z+psteel[2]+pcer[2];
145          gMC->Gspos("PCER",is,"PMT",0,0,z,0,"ONLY");
146          z=z+psteel[2]+pcer[2];
147          gMC->Gspos("PSTE",is,"PMT",0,0,z,0,"ONLY");
148        }
149
150 // Divider
151 // Knob at the bottom of PMT baloon
152       gMC->Gsvolu("KNOB","TUBE",idtmed[2106-1],pknob,3);
153       z=-pdivider[2]+pknob[2];
154 //      printf("zknob %f\n",z);
155       gMC->Gspos("KNOB",1,"DIVI",0,0,z,0,"ONLY");
156       gMC->Gsvolu("KNBO","TUBE",idtmed[2106-1],pknob_bot,3);
157       z=-pdivider[2]+2*pknob[2]+pknob_bot[2];
158 //      printf("knobbot %f\n",z);
159       gMC->Gspos("KNBO",1,"DIVI ",0,0,z,0,"ONLY");
160       gMC->Gsvolu("KNVA","TUBE",idtmed[2106-1],pknob_vac,3);
161       z=-pdivider[2]+pknob_vac[2];
162 //      printf("knobvac %f\n",z);
163       gMC->Gspos("KNVA",1,"DIVI",0,0,z,0,"ONLY");
164  //Steel pins + pin holes
165       gMC->Gsvolu("PINS","TUBE",idtmed[2108-1],ppins,3);
166       z=-pdivider[2]+ppins[2];
167       gMC->Gspos("PINS",1,"DIVI",0,0,z,0,"ONLY");
168       gMC->Gsvolu("HOLE","TUBE",idtmed[2111-1],phole,3);
169       z=-pdivider[2]+2*ppins[2]+phole[2];
170       gMC->Gspos("HOLE",1,"DIVI",0,0,z,0,"ONLY");
171
172 //Socket
173       gMC->Gsvolu("DIV1","TUBE",idtmed[2104-1],pdiv1,3);
174       z=-pdivider[2]+pdiv1[2];
175       gMC->Gspos("DIV1",1,"DIVI",0,0,z,0,"ONLY");
176 //Resistors
177       gMC->Gsvolu("DIV2","TUBE",idtmed[2101-1],pdiv2,3);
178       z=pdivider[2]-pdiv2[2];
179       gMC->Gspos("DIV2",1,"DIVI",0,0,z,0,"ONLY");
180       gMC->Gsvolu("DRES","TUBE",idtmed[2104-1],presist,3);
181       z=-pdiv2[2]+presist[2];
182       gMC->Gspos("DRES",1,"DIV2",0,0,z,0,"ONLY");
183       gMC->Gsvolu("DRIB","TUBE",idtmed[2109-1],pribber,3);
184       z=pdiv2[2]-pribber[2];
185       gMC->Gspos("DRIB",1,"DIV2",0,0,z,0,"ONLY");
186 //      printf("z DRIB %f\n",z);
187
188 }    
189 //------------------------------------------------------------------------
190 void AliSTARTv0::CreateMaterials()
191 {
192    Int_t ISXFLD   = gAlice->Field()->Integ();
193    Float_t SXMGMX = gAlice->Field()->Max();
194    Float_t a,z,d,radl,absl,buf[1];
195    Int_t nbuf;
196
197 // Scintillator CH
198    //    Float_t ascin[2]={1.01,12.01};
199    // Float_t zscin[2]={1,6};
200    // Float_t wscin[2]={1,1};
201    // Float_t denscin=1.03;
202 // PMT glass SiO2
203     Float_t aglass[2]={28.0855,15.9994};
204     Float_t zglass[2]={14.,8.};
205     Float_t wglass[2]={1.,2.};
206     Float_t dglass=2.65;
207 // Ceramic   97.2% Al2O3 , 2.8% SiO2
208     Float_t acer[2],zcer[2],wcer[2]={0.972,0.028};
209     Float_t aal2o3[2]  = { 26.981539,15.9994 };
210     Float_t zal2o3[2]  = { 13.,8. };
211     Float_t wal2o3[2]  = { 2.,3. };
212     Float_t denscer  = 3.6;
213
214 // Brass 80% Cu, 20% Zn
215    Float_t abrass[2] = {63.546,65.39};
216    Float_t zbrass[2] = {29,30};
217    Float_t wbrass[2] = {0.8,0.2};
218    Float_t denbrass=8.96;
219
220 //Ribber C6H12S
221    Float_t aribber[3] = {12.,1.,32.};
222    Float_t zribber[3] = {6.,1.,16.};
223    Float_t wribber[3] = {6.,12.,1.};
224    Float_t denribber=0.8;
225  
226    
227 //   AliMC* gMC = AliMC::GetMC();
228
229  //  Int_t *idtmed = gAlice->Idtmed();
230  //  Int_t imat;
231
232 //*** Definition Of avaible START materials ***
233  AliMaterial(0, "START Steel$", 55.850,26.,7.87,1.76,999);
234  AliMaterial(1, "START Vacuum$", 1.e-16,1.e-16,1.e-16,1.e16,999);
235  AliMaterial(2, "START Air$", 14.61, 7.3, .001205, 30423.,999); 
236
237  AliMixture( 3, "Al2O3   $", aal2o3, zal2o3, denscer, -2, wcer);
238  AliMixture( 4, "PMT glass   $",aglass,zglass,dglass,-2,wglass);
239   char namate[21];
240   gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
241   acer[0]=a;
242   zcer[0]=z;
243   gMC->Gfmate((*fIdmate)[4], namate, a, z, d, radl, absl, buf, nbuf);
244   acer[1]=a;
245   zcer[1]=z;
246   
247  AliMixture( 9, "Ceramic    $", acer, zcer, denscer, 2, wcer);
248  // AliMixture( 5, "Scintillator$",ascin,zscin,denscin,-2,wscin);
249  AliMixture( 6, "Brass    $", abrass, zbrass, denbrass, 2, wbrass);
250
251  AliMixture( 7, "Ribber $",aribber,zribber,denribber,-3,wribber);
252  
253  
254
255 //**
256  AliMedium(1, "START Air$", 2, 0, ISXFLD, SXMGMX, 10., .1, 1., .003, .003);
257  // AliMedium(2102, "Scintillator$", 5, 1, ISXFLD, SXMGMX, 10., .01, 1., .003, .003);
258  AliMedium(3, "Vacuum$", 1, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
259  AliMedium(4, "Ceramic$", 9, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
260  AliMedium(6, "Glass$", 4, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
261  AliMedium(8, "Steel$", 0, 0, ISXFLD, SXMGMX, 1., .001, 1., .001, .001);
262  AliMedium(11, "Brass  $", 6, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
263  AliMedium(9, "Ribber  $", 7, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
264
265
266 }
267 //---------------------------------------------------------------------
268 void AliSTARTv0::DrawDetector()
269 {
270 //
271 // Draw a shaded view of the Forward multiplicity detector version 0
272 //
273
274 AliMC* gMC = AliMC::GetMC();
275
276 //Set ALIC mother transparent
277 gMC->Gsatt("ALIC","SEEN",0);
278 //
279 //Set volumes visible
280 gMC->Gsatt("STRT","SEEN",0);
281 //gMC->Gsatt("SCIN","SEEN",1);
282 gMC->Gsatt("PMT ","SEEN",1);
283 gMC->Gsatt("DIVI","SEEN",1);
284 //
285 gMC->Gdopt("hide","on");
286 gMC->Gdopt("shad","on");
287 gMC->SetClipBox(".");
288 gMC->SetClipBox("*",0,1000,-1000,1000,-1000,1000);
289 gMC->DefaultRange();
290 gMC->Gdraw("alic",40,30,0,12,9.5,.2,0.2);
291 gMC->Gdhead(1111,"T-Zero detector");
292 gMC->Gdopt("hide","off");
293 }
294 //-------------------------------------------------------------------
295 void AliSTARTv0::Init()
296 {
297 // Initialises version 0 of the Forward Multiplicity Detector
298 //
299 AliMC* gMC=AliMC::GetMC();
300 //Int_t *idtmed  = gAlice->Idtmed();
301 AliSTART::Init();
302 fIdSens1=gMC->VolId("PTOP");
303 printf("*** START version 0 initialized ***\n");
304  
305 }
306
307 //-------------------------------------------------------------------
308
309 void AliSTARTv0::StepManager()
310 {
311   //
312   // Called for every step in the START Detector
313   //
314   Int_t id,copy,copy1;
315   static Float_t hits[7];
316   static Float_t edep;
317   static Int_t vol[2];
318  TLorentzVector pos;
319
320   TClonesArray &lhits = *fHits;
321   //AliMC* gMC=AliMC::GetMC();
322   //  TGeant3* geant3= (TGeant3*)gMC; 
323   
324   if(!gMC->IsTrackAlive()) return; // particle has disappeared
325   Float_t charge = gMC->TrackCharge();
326   if(TMath::Abs(charge)<=0.) return; //take only charged particles
327  //    gMC->Gpcxyz();
328     id=gMC->CurrentVolID(copy);
329
330  
331 //  printf("igauto %d\n",gMC->ctrak->igauto);
332 //  printf("gMC->ckine->ipart %d",gMC->ckine->ipart);
333 // Check the sensetive volume
334    if(id==fIdSens1 )
335    {
336      if(gMC->IsTrackEntering())
337      {
338        gMC->CurrentVolOffID(2,copy);
339        vol[0]=copy;
340        gMC->CurrentVolOffID(1,copy1);
341        vol[1]=copy1;
342        gMC->TrackPosition(pos);
343        hits[0] = pos[0];
344        hits[1] = pos[1];
345        hits[2] = pos[2];
346        Float_t etot=gMC->Etot();
347        hits[4]=etot;
348        Int_t part= gMC->TrackPid();
349        hits[5]=part;
350        Float_t ttime=gMC->TrackTime();
351        hits[6]=ttime*1e9;
352        edep=0;
353        //       Float_t xV=geant3->Gckine()->vert[0];
354        //Float_t yV=geant3->Gckine()->vert[1];
355        //Float_t zV=geant3->Gckine()->vert[2];
356        //Float_t tl=gMC -> TrackLength();
357        //      if(hits[6]<2.4){     
358        //           for (i=0; i<=6; i++){
359        //           printf(" HITS on START entr %f\n",hits[i]);} 
360        //}
361      }
362      if(gMC->IsTrackInside())
363      {
364        Float_t de=gMC->Edep(); 
365        edep=edep+de;
366 //       printf ("E deposition %f\n",edep);
367 //    for (i=0; i<=6; i++){
368 //    printf(" HITS on START inside %f\n",hits[i]); } 
369      }
370      if(gMC->IsTrackExiting())
371     {
372        Float_t de=gMC->Edep(); 
373        edep=edep+de;
374        hits[3]=edep*1e3;
375        //       for (i=0; i<=6; i++){
376        //        printf(" HITS on START Exit %f\n",hits[i]); } 
377        //for (i=0; i<=1; i++) { printf("START vol %d\n",vol[i]);}
378     
379     new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->CurrentTrack(),vol,hits);      }
380     }
381 //---------------------------------------------------------------------
382     }
383  //}
384
385
386
387
388
389