]> git.uio.no Git - u/mrichter/AliRoot.git/blame - START/AliSTARTv2.cxx
Adaption to new fluka common blocks (E. Futo)
[u/mrichter/AliRoot.git] / START / AliSTARTv2.cxx
CommitLineData
2fa82489 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// START ( T-zero) detector version 0 //
19//
20//Begin Html
21/*
22<img src="gif/AliSTARTv2Class.gif">
23*/
24//End Html
25// //
26// //
27//////////////////////////////////////////////////////////////////////
28
29#define RIGHT_ARRAY 1
30#define LEFT_ARRAY 2
31
32#include <TMath.h>
33#include <TGeometry.h>
34#include <TTUBE.h>
35#include <TNode.h>
36#include <TLorentzVector.h>
37
38#include "AliSTARTv2.h"
39#include "AliRun.h"
2fa82489 40#include "AliMagF.h"
41#include "AliSTARThit.h"
2fa82489 42
ef0750c2 43#include <Riostream.h>
2fa82489 44
2fa82489 45#include <stdlib.h>
46
47ClassImp(AliSTARTv2)
48
49
50//////////////////////////////////////////////////////////////////////
51// Standart constructor for START Detector version 2
52//////////////////////////////////////////////////////////////////////
53AliSTARTv2::AliSTARTv2(const char *name, const char *title):
54 AliSTART(name,title)
55{
56 fIdSens1 = 0;
57// setBufferSize(128000);
58}
59
60
61//////////////////////////////////////////////////////////////////////
62// Create the geometry of START Detector version 2
63//////////////////////////////////////////////////////////////////////
64void AliSTARTv2::CreateGeometry()
65{
66 /*
67 <img src="gif/AliSTARTv2.gif">
68 */
69
70 Int_t *idtmed;
71 Int_t idrotm[999];
72 Int_t i, j;
73 Float_t x, y, z;
74 Float_t zRight;
75 Float_t zLeft;
76 Float_t phi[3];
77 Float_t theta;
78 Double_t angel;
79
80 Float_t pstart[3] = {4.5, 10.7, 5.3};
81 Float_t pinstart[3] = {0., 1.31, 5.25};
82 Float_t ppmt[3] = {0., 1.31, 3.5};
83 Float_t ptop[3] = {0., 1.3, 1.5};
84// Float_t preg[3] = {0., 1.3, 0.005};
85 Float_t preg[3] = {0., 0.875, 0.005};
86 Float_t pdes[3] = {0.875, 1.3, 0.005};
87
88
89 zRight = 75.;
90 zLeft = 350.;
91 theta = (180 / TMath::Pi()) * TMath::ATan(6.5 / zRight);
92 angel = 2 * TMath::Pi() / 12;
93 idtmed = fIdtmed->GetArray();
94
95
96 AliMatrix (idrotm[901], 90., 0., 90., 90., 180., 0.);
97
98 gMC->Gsvolu ("0RST", "TUBE", idtmed[3], pstart, 3);
99 gMC->Gsvolu ("0LST", "TUBE", idtmed[3], pstart, 3);
100 gMC->Gspos ("0RST", 1, "ALIC", 0., 0., zRight, 0, "ONLY");
101 gMC->Gspos ("0LST", 1, "ALIC", 0., 0., -zLeft, idrotm[901], "ONLY");
102
103// 12 unit: PMT + divider
104 gMC->Gsvolu("0INS", "TUBE", idtmed[3], pinstart, 3);
105 z = 0;
106 for (i = 0; i < 12; i++)
107 {
108 x = 6.5 * TMath::Sin(i * angel);
109 y = 6.5 * TMath::Cos(i * angel);
110
111 phi[0] = -30 * i;
112 phi[1] = 90 - i * 30;
113 phi[2] = 90 - i * 30;
114 for (j = 0; j < 3; j++)
115 if (phi[j] < 0) phi[j] += 360;
116
117 AliMatrix (idrotm[902 + i], 90., phi[0],
118 90. + theta, phi[1],
119 theta, phi[2]);
120
121 gMC->Gspos ("0INS", i + 1, "0RST", x, y, z, idrotm[902 + i], "ONLY");
122 gMC->Gspos ("0INS", i + 13, "0LST", x, y, z, 0, "ONLY");
123 }
124
125 gMC->Gsvolu ("0PMT", "TUBE", idtmed[1], ppmt, 3);
126 x = y = 0;
127 z = -pinstart[2] + ppmt[2];
128 gMC->Gspos ("0PMT", 1, "0INS", x, y, z, 0, "ONLY");
129
130// PMT
131 // Entry window (glass)
132 gMC->Gsvolu ("0TOP", "TUBE", idtmed[6], ptop, 3);
133 z = -ppmt[2] + ptop[2];
134 gMC->Gspos ("0TOP", 1, "0PMT", 0, 0, z, 0, "ONLY");
135
136 gMC->Gsvolu ("0REG", "TUBE", idtmed[6], preg, 3);
137 z = -ppmt[2] + 2 * ptop[2] + preg[2];
138 gMC->Gspos ("0REG", 1, "0PMT", 0, 0, z, 0, "ONLY");
139
140 gMC->Gsvolu ("0DES", "TUBE", idtmed[6], pdes, 3);
141 z = -ppmt[2] + 2 * ptop[2] + preg[2];
142 gMC->Gspos ("0DES", 1, "0PMT", 0, 0, z, 0, "ONLY");
143}
144
145
146//////////////////////////////////////////////////////////////////////
147// Definition of avaible START materials
148//////////////////////////////////////////////////////////////////////
149void AliSTARTv2::CreateMaterials()
150{
151 Int_t isxfld = gAlice->Field()->Integ();
152 Float_t sxmgmx = gAlice->Field()->Max();
153
154 Float_t a, z, d, radl, absl, buf[1];
155 Int_t nbuf;
156
157// Scintillator CH
158 Float_t ascin[2] = {1.01, 12.01};
159 Float_t zscin[2] = {1., 6.};
160 Float_t wscin[2] = {1., 1.};
161 Float_t denscin = 1.03;
162
163// PMT glass SiO2
164 Float_t aglass[2] = {28.0855, 15.9994};
165 Float_t zglass[2] = {14., 8.};
166 Float_t wglass[2] = { 1., 2.};
167 Float_t dglass = 2.65;
168
169// Ceramic 97.2% Al2O3 , 2.8% SiO2
170 Float_t acer[2], zcer[2];
171 Float_t wcer[2] = { 0.972, 0.028};
172 Float_t aal2o3[2] = {26.981539, 15.9994 };
173 Float_t zal2o3[2] = {13., 8.};
174 Float_t wal2o3[2] = { 2., 3.};
175 Float_t denscer = 3.6;
176
177// Brass 80% Cu, 20% Zn
178 Float_t abrass[2] = {63.546, 65.39};
179 Float_t zbrass[2] = {29., 30.};
180 Float_t wbrass[2] = { 0.8, 0.2};
181 Float_t denbrass = 8.96;
182
183//Ribber C6H12S
184 Float_t aribber[3] = {12., 1., 32.};
185 Float_t zribber[3] = { 6., 1., 16.};
186 Float_t wribber[3] = { 6., 12., 1.};
187 Float_t denribber = 0.8;
188
189// Definition Cherenkov parameters
190 const Int_t NUMENTRIES = 32;
191
192 Float_t ppckov[NUMENTRIES] =
193 { 2.034E-9, 2.068E-9, 2.103E-9, 2.139E-9,
194 2.177E-9, 2.216E-9, 2.256E-9, 2.298E-9,
195 2.341E-9, 2.386E-9, 2.433E-9, 2.481E-9,
196 2.532E-9, 2.585E-9, 2.640E-9, 2.697E-9,
197 2.757E-9, 2.820E-9, 2.885E-9, 2.954E-9,
198 3.026E-9, 3.102E-9, 3.181E-9, 3.265E-9,
199 3.353E-9, 3.446E-9, 3.545E-9, 3.649E-9,
200 3.760E-9, 3.877E-9, 4.002E-9, 4.136E-9 };
201
202 Float_t rindex_qwarz[NUMENTRIES] =
203 { 1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
204 1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
205 1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
206 1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
207 1.458, 1.458, 1.458, 1.458 };
208
209 Float_t rindex_air[NUMENTRIES] =
210 { 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
211 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
212 1., 1., 1., 1. };
213
214 Float_t effic_all[NUMENTRIES] =
215 { 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
216 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
217 1., 1., 1., 1. };
218
219 Float_t absor_qwarz[NUMENTRIES] =
220 { 2000., 2000., 2000., 2000., 2000., 2000., 2000.,
221 2000., 2000., 2000., 2000., 2000., 2000., 2000.,
222 2000., 2000., 2000., 2000., 2000., 2000., 2000.,
223 2000., 2000., 2000., 2000., 2000., 2000., 2000.,
224 2000., 2000., 2000., 2000. };
225
226 Float_t absor_air[NUMENTRIES] =
227 { 200., 200., 200., 200., 200., 200., 200.,
228 200., 200., 200., 200., 200., 200., 200.,
229 200., 200., 200., 200., 200., 200., 200.,
230 200., 200., 200., 200., 200., 200., 200.,
231 200., 200., 200., 200. };
232
233 Int_t *idtmed = fIdtmed->GetArray();
234
235
236 AliMaterial (0, "START Steel$", 55.850, 26., 7.87, 1.76, 999);
237 AliMaterial (1, "START Vacuum$", 1.e-16, 1.e-16, 1.e-16, 1.e16, 999);
238 AliMaterial (2, "START Air$", 14.61, 7.3, .001205, 30423., 999);
239
240 AliMixture (3, "Al2O3 $", aal2o3, zal2o3, denscer, -2, wal2o3);
241 AliMixture (4, "PMT glass $", aglass, zglass, dglass, -2, wglass);
242 char namate[21];
243 gMC->Gfmate ((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
244 acer[0] = a;
245 zcer[0] = z;
246 gMC->Gfmate ((*fIdmate)[4], namate, a, z, d, radl, absl, buf, nbuf);
247 acer[1] = a;
248 zcer[1] = z;
249
250 AliMixture (5, "Scintillator$",ascin,zscin,denscin,-2,wscin);
251 AliMixture (6, "Brass $", abrass, zbrass, denbrass, 2, wbrass);
252 AliMixture (7, "Ribber $",aribber,zribber,denribber,-3,wribber);
253 AliMixture (9, "Ceramic $", acer, zcer, denscer, 2, wcer);
254
255 AliMedium (1, "START Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
256 AliMedium (2, "Scintillator$", 5, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003);
257 AliMedium (3, "Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
258 AliMedium (4, "Ceramic$", 9, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
259 AliMedium (6, "Glass$", 4, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
260 AliMedium (8, "Steel$", 0, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001);
261 AliMedium (9, "Ribber $", 7, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
262 AliMedium(11, "Brass $", 6, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
263
264 gMC->SetCerenkov (idtmed[6], NUMENTRIES, ppckov, absor_qwarz, effic_all, rindex_qwarz);
265 gMC->SetCerenkov (idtmed[1], NUMENTRIES, ppckov, absor_air, effic_all, rindex_air);
266}
267
268
269//////////////////////////////////////////////////////////////////////
270// Draw a shaded view of the Forward multiplicity detector version 2
271//////////////////////////////////////////////////////////////////////
272void AliSTARTv2::DrawModule()
273{
274 //Set ALIC mother transparent
275 gMC->Gsatt ("ALIC", "SEEN", 0);
276
277 //Set volumes visible
278 gMC->Gsatt ("0STA", "SEEN", 0);
279 gMC->Gsatt ("0PMT", "SEEN", 1);
280 gMC->Gsatt ("0DIV", "SEEN", 1);
281
282 gMC->Gdopt ("hide", "on");
283 gMC->Gdopt ("shad", "on");
284 gMC->SetClipBox (".");
285 gMC->SetClipBox ("*", 0, 1000, -1000, 1000, -1000, 1000);
286 gMC->DefaultRange();
287 gMC->Gdraw ("alic", 40, 30, 0, 12, 9.5, 0.7, 0.7);
288 gMC->Gdhead (1111, "T-Zero detector");
289 gMC->Gdopt ("hide", "off");
290}
291
292
293//////////////////////////////////////////////////////////////////////
294// Initialises version 2 of the Forward Multiplicity Detector
295//////////////////////////////////////////////////////////////////////
296void AliSTARTv2::Init()
297{
298//Int_t *idtmed = gAlice->Idtmed();
299
300 AliSTART::Init();
301 fIdSens1 = gMC->VolId ("0REG");
302
303 printf ("*** START version 2 initialized ***\n");
304}
305
306
307//////////////////////////////////////////////////////////////////////
308// Called for every step in the START Detector
309//////////////////////////////////////////////////////////////////////
310void AliSTARTv2::StepManager()
311{
312 Int_t id;
313 Int_t copy;
314// Int_t copy1;
315 Float_t xyz[3];
316 Float_t XYZ[3];
317 Float_t hitPhoton[6];
318 static Float_t hits[7];
319 static Float_t edep;
320 static Int_t vol[2];
321 TLorentzVector pos;
322 TLorentzVector mom;
323
324
325 if(!gMC->IsTrackAlive()) return; // particle has disappeared
326
327// TGeant3 *g3 = (TGeant3*) gMC;
328// g3->Gpcxyz();
329
330 TClonesArray &lhits = *fHits;
331
332
333///////////////////////////////////////////////
334// If particles is photon then ...
335
336 if (gMC->TrackPid() == 50000050)
337 {
338 id = gMC->CurrentVolID(copy);
339
340 // Check the sensetive volume
341 if (id == fIdSens1)
342 {
343 if (gMC->IsTrackEntering())
344 {
345 gMC->CurrentVolOffID(2,copy);
346 if (copy < 13)
347 {
348 vol[0] = RIGHT_ARRAY;
349 vol[1] = copy;
350 }
351 else
352 {
353 vol[0] = LEFT_ARRAY;
354 vol[1] = copy - 12;
355 }
356
357 gMC->TrackPosition(pos);
358 gMC->TrackMomentum(mom);
359 XYZ[0] = pos[0];
360 XYZ[1] = pos[1];
361 XYZ[2] = pos[2];
362 gMC->Gmtod (XYZ, xyz, 1);
363
364 hitPhoton[0] = sqrt (xyz[0] * xyz[0] + xyz[1] * xyz[1]);
365 hitPhoton[1] = mom[0];
366 hitPhoton[2] = mom[1];
367 hitPhoton[3] = mom[2];
368 hitPhoton[4] = 1e9 * gMC->TrackTime();
369 hitPhoton[5] = 1e9 * gMC->Etot();
370
371 AddHitPhoton (gAlice->CurrentTrack(), vol, hitPhoton);
372 }
373 gMC->StopTrack();
374 }
375 else
376 if (id == gMC->VolId ("0DES")) gMC->StopTrack();
377 }
378
379// end photon particalary
380///////////////////////////////////////////////
381
382
383///////////////////////////////////////////////
384// If particles is charge then ...
385
386 // Float_t charge = gMC->TrackCharge();
387 // if(TMath::Abs(charge) <= 0.) return;
388 id = gMC->CurrentVolID(copy);
389
390
391 // printf("gMC->ckine->ipart %d",gMC->ckine->ipart);
392 // Check the sensetive volume
393 if(id==gMC->VolId("0TOP") ) {
394 if(gMC->IsTrackEntering()) {
395 gMC->CurrentVolOffID(2,copy);
396 if (copy < 13)
397 {
398 vol[0] = RIGHT_ARRAY;
399 vol[1] = copy;
400 }
401 else
402 {
403 vol[0] = LEFT_ARRAY;
404 vol[1] = copy - 12;
405 }
406
407 gMC->TrackPosition(pos);
408 hits[0] = pos[0];
409 hits[1] = pos[1];
410 hits[2] = pos[2];
411 Float_t etot = gMC->Etot();
412 hits[4] = etot;
413 Int_t part = gMC->TrackPid();
414 hits[5] = part;
415 Float_t ttime = gMC->TrackTime();
416 hits[6] = ttime*1e9;
417 edep = 0;
418 }
419 if(gMC->IsTrackInside()) {
420 Float_t de = gMC->Edep();
421 edep = edep + de;
422 // printf ("E deposition %f\n",edep);
423 // for (i=0; i<=6; i++){
424 // printf(" HITS on START inside %f\n",hits[i]); }
425 }
426 if(gMC->IsTrackExiting()) {
427 Float_t de = gMC->Edep();
428 edep = edep + de;
429 hits[3] = edep * 1e3;
430
431 // for (i=0; i<=6; i++){
432 // printf(" HITS on START Exit %f\n",hits[i]); }
433 //for (i=0; i<=1; i++) { printf("START vol %d\n",vol[i]);}
434
435 new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->CurrentTrack(),vol,hits);
436 }
437 }
438
439// end charge particles particalary
440///////////////////////////////////////////////
441
442}