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