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