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