Correction of problem in geometry
[u/mrichter/AliRoot.git] / ITS / AliITSv1.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$
7963222e 18Revision 1.12 1999/10/22 08:25:25 fca
19remove double definition of destructors
20
1e3deba7 21Revision 1.11 1999/10/22 08:16:49 fca
22Correct destructors, thanks to I.Hrivnacova
23
5b8cc8df 24Revision 1.10 1999/10/06 19:56:50 fca
25Add destructor
26
1c1b73f8 27Revision 1.9 1999/10/05 08:05:09 fca
28Minor corrections for uninitialised variables.
29
593d2ea1 30Revision 1.8 1999/09/29 09:24:20 fca
31Introduction of the Copyright and cvs Log
32
4c039060 33*/
34
fe4da5cc 35///////////////////////////////////////////////////////////////////////////////
36// //
37// Inner Traking System version 1 //
58005f18 38// This class contains the base procedures for the Inner Tracking System //
fe4da5cc 39// //
58005f18 40// Authors: R. Barbera, A. Morsch.
41// version 1.
42// Created 1998.
43//
44// NOTE: THIS IS THE COARSE pre.TDR geometry of the ITS. THIS WILL NOT WORK
45// with the geometry or module classes or any analysis classes. You are
46// strongly encouraged to uses AliITSv5.
fe4da5cc 47// //
48///////////////////////////////////////////////////////////////////////////////
49
50#include <TMath.h>
51#include <TRandom.h>
52#include <TVector.h>
58005f18 53#include "AliITShit.h"
fe4da5cc 54#include "AliITSv1.h"
55#include "AliRun.h"
56
57#include "AliMC.h"
58#include "AliConst.h"
59
60ClassImp(AliITSv1)
61
62//_____________________________________________________________________________
593d2ea1 63AliITSv1::AliITSv1() {
64 //
65 // Default constructor for the ITS
66 //
67 fId1N = 6;
68 fId1Name = new char*[fId1N];
69 fId1Name[0] = "ITS1";
70 fId1Name[1] = "ITS2";
71 fId1Name[2] = "ITS3";
72 fId1Name[3] = "ITS4";
73 fId1Name[4] = "ITS5";
74 fId1Name[5] = "ITS6";
fe4da5cc 75}
1e3deba7 76
fe4da5cc 77//_____________________________________________________________________________
593d2ea1 78AliITSv1::AliITSv1(const char *name, const char *title) : AliITS(name, title){
79 //
80 // Standard constructor for the ITS
81 //
82 fId1N = 6;
83 fId1Name = new char*[fId1N];
84 fId1Name[0] = "ITS1";
85 fId1Name[1] = "ITS2";
86 fId1Name[2] = "ITS3";
87 fId1Name[3] = "ITS4";
88 fId1Name[4] = "ITS5";
89 fId1Name[5] = "ITS6";
fe4da5cc 90}
91
1c1b73f8 92//_____________________________________________________________________________
93AliITSv1::~AliITSv1() {
94 //
95 // Standard destructor for the ITS
96 //
1c1b73f8 97 delete [] fId1Name;
1c1b73f8 98}
99
fe4da5cc 100//_____________________________________________________________________________
101void AliITSv1::CreateGeometry()
102{
103 //
104 // Create geometry for version 1 of the ITS
105 //
106 //
107 // Create Geometry for ITS version 0
108 //
58005f18 109 //
fe4da5cc 110
111
fe4da5cc 112
113 Float_t drcer[6] = { 0.,0.,.08,.08,0.,0. }; //CERAMICS THICKNESS
114 Float_t drepx[6] = { 0.,0.,0.,0.,.5357,.5357 }; //EPOXY THICKNESS
115 Float_t drpla[6] = { 0.,0.,0.,0.,.1786,.1786 }; //PLASTIC THICKNESS
116 Float_t dzb[6] = { 0.,0.,15.,15.,4.,4. }; //LENGTH OF BOXES
117 Float_t dphi[6] = { 72.,72.,72.,72.,50.6,45. }; //COVERED PHI-RANGE FOR LAYERS 1-6
118 Float_t rl[6] = { 3.9,7.6,14.,24.,40.,45. }; //SILICON LAYERS INNER RADIUS
119 Float_t drl[6] = { .755,.755,.809,.809,.7,.7 }; //THICKNESS OF LAYERS (in % radiation length)
120 Float_t dzl[6] = { 12.67,16.91,20.85,29.15,45.11,50.975 };//HALF LENGTH OF LAYERS
121 Float_t drpcb[6] = { 0.,0.,.06,.06,0.,0. }; //PCB THICKNESS
122 Float_t drcu[6] = { 0.,0.,.0504,.0504,.0357,.0357 }; //COPPER THICKNESS
123 Float_t drsi[6] = { 0.,0.,.006,.006,.3571,.3571 }; //SILICON THICKNESS
124
125 Float_t drca = 0, dzfc;
126 Int_t i, nsec;
127 Float_t rend, drca_tpc, dzco, zend, dits[3], rlim, drsu, zmax;
128 Float_t zpos, dzco1, dzco2;
129 Float_t drcac[6], acone, dphii;
130 Float_t pcits[15], xltpc;
131 Float_t rzcone, rstep, r0, z0, acable, fp, dz, zi, ri;
132 Int_t idrotm[399];
133 Float_t dgh[15];
134
ad51aeb0 135 Int_t *idtmed = fIdtmed->GetArray()-199;
fe4da5cc 136
137 // CONVERT INTO CM (RL(SI)=9.36 CM)
138 for (i = 0; i < 6; ++i) {
139 drl[i] = drl[i] / 100. * 9.36;
140 }
141
142 // SUPPORT ENDPLANE THICKNESS
143 drsu = 2.*0.06+1./20; // 1./20. is 1 cm of honeycomb (1/20 carbon density);
144
145 // CONE BELOW TPC
146
147 drca_tpc = 1.2/4.;
148
149 // CABLE THICKNESS (CONICAL CABLES CONNECTING THE LAYERS)
150
151
152 // ITS CONE ANGLE
153
154 acone = 45.;
155 acone *= kDegrad;
156
157 // CONE RADIUS AT 1ST LAYER
158
159 rzcone = 30.;
160
161 // FIELD CAGE HALF LENGTH
162
163 dzfc = 64.5;
164 rlim = 48.;
165 zmax = 80.;
166 xltpc = 275.;
167
168
169 // PARAMETERS FOR SMALL (1/2) ITS
170
171 for (i = 0; i < 6; ++i) {
172 dzl[i] /= 2.;
173 dzb[i] /= 2.;
174 }
175 drca /= 2.;
176 acone /= 2.;
177 drca_tpc /= 2.;
178 rzcone /= 2.;
179 dzfc /= 2.;
180 zmax /= 2.;
181 xltpc /= 2.;
182 acable = 15.;
183
184
185
186 // EQUAL DISTRIBUTION INTO THE 6 LAYERS
187 rstep = drca_tpc / 6.;
188 for (i = 0; i < 6; ++i) {
189 drcac[i] = (i+1) * rstep;
190 }
191
192 // NUMBER OF PHI SECTORS
193
194 nsec = 5;
195
196 // PACK IN PHI AS MUCH AS POSSIBLE
197 // NOW PACK USING THICKNESS
198
199 for (i = 0; i < 6; ++i) {
200
201// PACKING FACTOR
202 fp = rl[5] / rl[i];
203
204 // PHI-PACKING NOT SUFFICIENT ?
205
206 if (dphi[i]/45 < fp) {
207 drcac[i] = drcac[i] * fp * 45/dphi[i];
208 }
209 }
210
211
212 // --- Define ghost volume containing the six layers and fill it with air
213
214 dgh[0] = 3.5;
215 dgh[1] = 50.;
216 dgh[2] = zmax;
cfce8870 217 gMC->Gsvolu("ITSV", "TUBE", idtmed[275], dgh, 3);
fe4da5cc 218
219 // --- Place the ghost volume in its mother volume (ALIC) and make it
220 // invisible
221
cfce8870 222 gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., 0, "ONLY");
223 gMC->Gsatt("ITSV", "SEEN", 0);
fe4da5cc 224
225 // ITS LAYERS (SILICON)
226
227 dits[0] = rl[0];
228 dits[1] = rl[0] + drl[0];
229 dits[2] = dzl[0];
cfce8870 230 gMC->Gsvolu("ITS1", "TUBE", idtmed[199], dits, 3);
231 gMC->Gspos("ITS1", 1, "ITSV", 0., 0., 0., 0, "ONLY");
fe4da5cc 232
233 dits[0] = rl[1];
234 dits[1] = rl[1] + drl[1];
235 dits[2] = dzl[1];
cfce8870 236 gMC->Gsvolu("ITS2", "TUBE", idtmed[199], dits, 3);
237 gMC->Gspos("ITS2", 1, "ITSV", 0., 0., 0., 0, "ONLY");
fe4da5cc 238
239 dits[0] = rl[2];
240 dits[1] = rl[2] + drl[2];
241 dits[2] = dzl[2];
cfce8870 242 gMC->Gsvolu("ITS3", "TUBE", idtmed[224], dits, 3);
243 gMC->Gspos("ITS3", 1, "ITSV", 0., 0., 0., 0, "ONLY");
fe4da5cc 244
245 dits[0] = rl[3];
246 dits[1] = rl[3] + drl[3];
247 dits[2] = dzl[3];
cfce8870 248 gMC->Gsvolu("ITS4", "TUBE", idtmed[224], dits, 3);
249 gMC->Gspos("ITS4", 1, "ITSV", 0., 0., 0., 0, "ONLY");
fe4da5cc 250
251 dits[0] = rl[4];
252 dits[1] = rl[4] + drl[4];
253 dits[2] = dzl[4];
cfce8870 254 gMC->Gsvolu("ITS5", "TUBE", idtmed[249], dits, 3);
255 gMC->Gspos("ITS5", 1, "ITSV", 0., 0., 0., 0, "ONLY");
fe4da5cc 256
257 dits[0] = rl[5];
258 dits[1] = rl[5] + drl[5];
259 dits[2] = dzl[5];
cfce8870 260 gMC->Gsvolu("ITS6", "TUBE", idtmed[249], dits, 3);
261 gMC->Gspos("ITS6", 1, "ITSV", 0., 0., 0., 0, "ONLY");
fe4da5cc 262
263 // ELECTRONICS BOXES
264
265 // PCB (layer #3 and #4)
266
cfce8870 267 gMC->Gsvolu("IPCB", "TUBE", idtmed[233], dits, 0);
fe4da5cc 268 for (i = 2; i < 4; ++i) {
269 dits[0] = rl[i];
270 dits[1] = dits[0] + drpcb[i];
271 dits[2] = dzb[i] / 2.;
272 zpos = dzl[i] + dits[2];
cfce8870 273 gMC->Gsposp("IPCB", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
274 gMC->Gsposp("IPCB", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 275 }
276
277 // COPPER (layer #3 and #4)
278
cfce8870 279 gMC->Gsvolu("ICO2", "TUBE", idtmed[234], dits, 0);
fe4da5cc 280 for (i = 2; i < 4; ++i) {
281 dits[0] = rl[i] + drpcb[i];
282 dits[1] = dits[0] + drcu[i];
283 dits[2] = dzb[i] / 2.;
284 zpos = dzl[i] + dits[2];
cfce8870 285 gMC->Gsposp("ICO2", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
286 gMC->Gsposp("ICO2", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 287 }
288
289 // CERAMICS (layer #3 and #4)
290
cfce8870 291 gMC->Gsvolu("ICER", "TUBE", idtmed[235], dits, 0);
fe4da5cc 292 for (i = 2; i < 4; ++i) {
293 dits[0] = rl[i] + drpcb[i] + drcu[i];
294 dits[1] = dits[0] + drcer[i];
295 dits[2] = dzb[i] / 2.;
296 zpos = dzl[i] + dits[2];
cfce8870 297 gMC->Gsposp("ICER", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
298 gMC->Gsposp("ICER", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 299 }
300
301 // SILICON (layer #3 and #4)
302
cfce8870 303 gMC->Gsvolu("ISI2", "TUBE", idtmed[226], dits, 0);
fe4da5cc 304 for (i = 2; i < 4; ++i) {
305 dits[0] = rl[i] + drpcb[i] + drcu[i] + drcer[i];
306 dits[1] = dits[0] + drsi[i];
307 dits[2] = dzb[i] / 2.;
308 zpos = dzl[i] + dits[2];
cfce8870 309 gMC->Gsposp("ISI2", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
310 gMC->Gsposp("ISI2", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 311 }
312
313 // PLASTIC (G10FR4) (layer #5 and #6)
314
cfce8870 315 gMC->Gsvolu("IPLA", "TUBE", idtmed[262], dits, 0);
fe4da5cc 316 for (i = 4; i < 6; ++i) {
317 dits[0] = rl[i];
318 dits[1] = dits[0] + drpla[i];
319 dits[2] = dzb[i] / 2.;
320 zpos = dzl[i] + dits[2];
cfce8870 321 gMC->Gsposp("IPLA", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
322 gMC->Gsposp("IPLA", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 323 }
324
325 // COPPER (layer #5 and #6)
326
cfce8870 327 gMC->Gsvolu("ICO3", "TUBE", idtmed[259], dits, 0);
fe4da5cc 328 for (i = 4; i < 6; ++i) {
329 dits[0] = rl[i] + drpla[i];
330 dits[1] = dits[0] + drcu[i];
331 dits[2] = dzb[i] / 2.;
332 zpos = dzl[i] + dits[2];
cfce8870 333 gMC->Gsposp("ICO3", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
334 gMC->Gsposp("ICO3", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 335 }
336
337 // EPOXY (layer #5 and #6)
338
cfce8870 339 gMC->Gsvolu("IEPX", "TUBE", idtmed[262], dits, 0);
fe4da5cc 340 for (i = 4; i < 6; ++i) {
341 dits[0] = rl[i] + drpla[i] + drcu[i];
342 dits[1] = dits[0] + drepx[i];
343 dits[2] = dzb[i] / 2.;
344 zpos = dzl[i] + dits[2];
cfce8870 345 gMC->Gsposp("IEPX", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
346 gMC->Gsposp("IEPX", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 347 }
348
349 // SILICON (layer #5 and #6)
350
cfce8870 351 gMC->Gsvolu("ISI3", "TUBE", idtmed[251], dits, 0);
fe4da5cc 352 for (i = 4; i < 6; ++i) {
353 dits[0] = rl[i] + drpla[i] + drcu[i] + drepx[i];
354 dits[1] = dits[0] + drsi[i];
355 dits[2] = dzb[i] / 2.;
356 zpos = dzl[i] + dits[2];
cfce8870 357 gMC->Gsposp("ISI3", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
358 gMC->Gsposp("ISI3", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 359 }
360
361 // SUPPORT
362
cfce8870 363 gMC->Gsvolu("ISUP", "TUBE", idtmed[274], dits, 0);
fe4da5cc 364 for (i = 0; i < 6; ++i) {
365 dits[0] = rl[i];
7963222e 366 if (i < 5) dits[1] = rl[i+1];
fe4da5cc 367 else dits[1] = rlim;
368 dits[2] = drsu / 2.;
369 zpos = dzl[i] + dzb[i] + dits[2];
cfce8870 370 gMC->Gsposp("ISUP", i+1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
371 gMC->Gsposp("ISUP", i+7, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 372 }
373
374 // CABLES (HORIZONTAL)
375
cfce8870 376 gMC->Gsvolu("ICHO", "TUBE", idtmed[278], dits, 0);
fe4da5cc 377 for (i = 0; i < 6; ++i) {
378 dits[0] = rl[i];
379 dits[1] = dits[0] + drca;
380 dits[2] = (rzcone + TMath::Tan(acone) * (rl[i] - rl[0]) - (dzl[i]+ dzb[i] + drsu)) / 2.;
381 zpos = dzl[i - 1] + dzb[i] + drsu + dits[2];
cfce8870 382 gMC->Gsposp("ICHO", i+1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
383 gMC->Gsposp("ICHO", i+7, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
fe4da5cc 384 }
385 // DEFINE A CONICAL GHOST VOLUME FOR THE PHI SEGMENTATION
386 pcits[0] = 0.;
387 pcits[1] = 360.;
388 pcits[2] = 2.;
389 pcits[3] = rzcone;
390 pcits[4] = 3.5;
391 pcits[5] = rl[0];
392 pcits[6] = pcits[3] + TMath::Tan(acone) * (rlim - rl[0]);
393 pcits[7] = rlim - rl[0] + 3.5;
394 pcits[8] = rlim;
cfce8870 395 gMC->Gsvolu("ICMO", "PCON", idtmed[275], pcits, 9);
fe4da5cc 396 AliMatrix(idrotm[200], 90., 0., 90., 90., 180., 0.);
cfce8870 397 gMC->Gspos("ICMO", 1, "ITSV", 0., 0., 0., 0, "ONLY");
398 gMC->Gspos("ICMO", 2, "ITSV", 0., 0., 0., idrotm[200], "ONLY");
fe4da5cc 399
400 // DIVIDE INTO NSEC PHI-SECTIONS
401
cfce8870 402 gMC->Gsdvn("ICMD", "ICMO", nsec, 2);
403 gMC->Gsatt("ICMO", "SEEN", 0);
404 gMC->Gsatt("ICMD", "SEEN", 0);
fe4da5cc 405
406 // CONICAL CABLES
407
408 pcits[2] = 2.;
cfce8870 409 gMC->Gsvolu("ICCO", "PCON", idtmed[278], pcits, 0);
fe4da5cc 410 for (i = 1; i < 6; ++i) {
411 pcits[0] = -dphi[i] / 2.;
412 pcits[1] = dphi[i];
413 if (i < 5) {
414 dzco = TMath::Tan(acone) * (rl[i+1] - rl[i]);
415 } else {
416 dzco1 = zmax - (rzcone + TMath::Tan(acone) * (rl[5] - rl[0])) -2.;
417 dzco2 = (rlim - rl[5]) * TMath::Tan(acone);
418 if (rl[5] + dzco1 / TMath::Tan(acone) < rlim) {
419 dzco = dzco1;
420 } else {
421 dzco = dzco2;
422 }
423 }
424 pcits[3] = rzcone + TMath::Tan(acone) * (rl[i] - rl[0]);
425 pcits[4] = rl[i] - drcac[i] / TMath::Sin(acone);
426 pcits[5] = rl[i];
427 pcits[6] = pcits[3] + dzco;
428 pcits[7] = rl[i] + dzco / TMath::Tan(acone) - drcac[i] / TMath::Sin(acone);
429 pcits[8] = rl[i] + dzco / TMath::Tan(acone);
430
cfce8870 431 gMC->Gsposp("ICCO", i, "ICMD", 0., 0., 0., 0, "ONLY", pcits, 9);
fe4da5cc 432
433 }
434 zend = pcits[6];
435 rend = pcits[8];
436
437 // CONICAL CABLES BELOW TPC
438
439 // DEFINE A CONICAL GHOST VOLUME FOR THE PHI SEGMENTATION
440 pcits[0] = 0.;
441 pcits[1] = 360.;
442 pcits[2] = 2.;
443 pcits[3] = zend;
444 pcits[5] = rend;
445 pcits[4] = pcits[5] - drca_tpc;
446 pcits[6] = xltpc;
447 pcits[8] = pcits[4] + (pcits[6] - pcits[3]) * TMath::Tan(acable * kDegrad);
448 pcits[7] = pcits[8] - drca_tpc;
449 AliMatrix(idrotm[200], 90., 0., 90., 90., 180., 0.);
cfce8870 450 gMC->Gsvolu("ICCM", "PCON", idtmed[275], pcits, 9);
451 gMC->Gspos("ICCM", 1, "ALIC", 0., 0., 0., 0, "ONLY");
452 gMC->Gspos("ICCM", 2, "ALIC", 0., 0., 0., idrotm[200], "ONLY");
453 gMC->Gsdvn("ITMD", "ICCM", nsec, 2);
454 gMC->Gsatt("ITMD", "SEEN", 0);
455 gMC->Gsatt("ICCM", "SEEN", 0);
fe4da5cc 456
457 // NOW PLACE SEGMENTS WITH DECREASING PHI SEGMENTS INTO THE
458 // GHOST-VOLUME
459
460 pcits[2] = 2.;
cfce8870 461 gMC->Gsvolu("ITTT", "PCON", idtmed[278], pcits, 0);
fe4da5cc 462 r0 = rend;
463 z0 = zend;
464 dz = (xltpc - zend) / 9.;
465 for (i = 0; i < 9; ++i) {
466 zi = z0 + i*dz + dz / 2.;
467 ri = r0 + (zi - z0) * TMath::Tan(acable * kDegrad);
468 dphii = dphi[5] * r0 / ri;
469 pcits[0] = -dphii / 2.;
470 pcits[1] = dphii;
471 pcits[3] = zi - dz / 2.;
472 pcits[5] = r0 + (pcits[3] - z0) * TMath::Tan(acable * kDegrad);
473 pcits[4] = pcits[5] - drca_tpc;
474 pcits[6] = zi + dz / 2.;
475 pcits[8] = r0 + (pcits[6] - z0) * TMath::Tan(acable * kDegrad);
476 pcits[7] = pcits[8] - drca_tpc;
477
cfce8870 478 gMC->Gsposp("ITTT", i+1, "ITMD", 0., 0., 0., 0, "ONLY", pcits, 9);
fe4da5cc 479 }
480
481 // --- Outputs the geometry tree in the EUCLID/CAD format
482
483 if (fEuclidOut) {
cfce8870 484 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
fe4da5cc 485 }
486}
487
488//_____________________________________________________________________________
489void AliITSv1::CreateMaterials()
490{
491 //
492 // Create the materials for ITS
493 //
494 AliITS::CreateMaterials();
495}
496
497//_____________________________________________________________________________
593d2ea1 498void AliITSv1::Init(){
499 //
500 // Initialise the ITS after it has been built
501 //
502 Int_t i,j,l;
503
504 fIdN = fId1N;;
505 fIdName = new char*[fIdN];
506 fIdSens = new Int_t[fIdN];
507 for(i=0;i<fId1N;i++) {
508 l = strlen(fId1Name[i]);
509 fIdName[i] = new char[l+1];
510 for(j=0;j<l;j++) fIdName[i][j] = fId1Name[i][j];
511 fIdName[i][l] = '\0'; // Null terminate this string.
512 } // end for i
513 //
514 AliITS::Init();
515 fMajorVersion = 1;
516 fMinorVersion = 0;
fe4da5cc 517}
518
519//_____________________________________________________________________________
2cb30c3a 520void AliITSv1::DrawModule()
fe4da5cc 521{
522 //
523 // Draw a shaded view of the FMD version 1
524 //
525
fe4da5cc 526
527 // Set everything unseen
cfce8870 528 gMC->Gsatt("*", "seen", -1);
fe4da5cc 529 //
530 // Set ALIC mother visible
cfce8870 531 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 532 //
533 // Set the volumes visible
cfce8870 534 gMC->Gsatt("ITSV","SEEN",0);
535 gMC->Gsatt("ITS1","SEEN",1);
536 gMC->Gsatt("ITS2","SEEN",1);
537 gMC->Gsatt("ITS3","SEEN",1);
538 gMC->Gsatt("ITS4","SEEN",1);
539 gMC->Gsatt("ITS5","SEEN",1);
540 gMC->Gsatt("ITS6","SEEN",1);
fe4da5cc 541
cfce8870 542 gMC->Gsatt("IPCB","SEEN",1);
543 gMC->Gsatt("ICO2","SEEN",1);
544 gMC->Gsatt("ICER","SEEN",0);
545 gMC->Gsatt("ISI2","SEEN",0);
546 gMC->Gsatt("IPLA","SEEN",0);
547 gMC->Gsatt("ICO3","SEEN",0);
548 gMC->Gsatt("IEPX","SEEN",0);
549 gMC->Gsatt("ISI3","SEEN",1);
550 gMC->Gsatt("ISUP","SEEN",0);
551 gMC->Gsatt("ICHO","SEEN",0);
552 gMC->Gsatt("ICMO","SEEN",0);
553 gMC->Gsatt("ICMD","SEEN",0);
554 gMC->Gsatt("ICCO","SEEN",1);
555 gMC->Gsatt("ICCM","SEEN",0);
556 gMC->Gsatt("ITMD","SEEN",0);
557 gMC->Gsatt("ITTT","SEEN",1);
fe4da5cc 558
559 //
cfce8870 560 gMC->Gdopt("hide", "on");
561 gMC->Gdopt("shad", "on");
562 gMC->Gsatt("*", "fill", 7);
563 gMC->SetClipBox(".");
564 gMC->SetClipBox("*", 0, 300, -300, 300, -300, 300);
565 gMC->DefaultRange();
566 gMC->Gdraw("alic", 40, 30, 0, 11, 10, .07, .07);
567 gMC->Gdhead(1111, "Inner Tracking System Version 1");
568 gMC->Gdman(17, 6, "MAN");
fe4da5cc 569}
570
571//_____________________________________________________________________________
572void AliITSv1::StepManager()
573{
574 //
575 // Called at every step in the ITS
576 //
577 Int_t copy, id;
58005f18 578 Float_t hits[8];
579 Int_t vol[4];
0a6d8768 580 TLorentzVector position, momentum;
fe4da5cc 581 TClonesArray &lhits = *fHits;
fe4da5cc 582 //
58005f18 583 // Track status
584 vol[3] = 0;
585 if(gMC->IsTrackInside()) vol[3] += 1;
586 if(gMC->IsTrackEntering()) vol[3] += 2;
587 if(gMC->IsTrackExiting()) vol[3] += 4;
588 if(gMC->IsTrackOut()) vol[3] += 8;
589 if(gMC->IsTrackDisappeared()) vol[3] += 16;
590 if(gMC->IsTrackStop()) vol[3] += 32;
591 if(gMC->IsTrackAlive()) vol[3] += 64;
592 //
593 // Fill hit structure.
cfce8870 594 if(gMC->TrackCharge() && gMC->Edep()) {
fe4da5cc 595 //
596 // Only entering charged tracks
58005f18 597 if((id=gMC->CurrentVolID(copy))==fIdSens[0]) {
fe4da5cc 598 vol[0]=1;
0a6d8768 599 id=gMC->CurrentVolOffID(1,copy);
fe4da5cc 600 vol[1]=copy;
0a6d8768 601 id=gMC->CurrentVolOffID(2,copy);
fe4da5cc 602 vol[2]=copy;
58005f18 603 } else if(id==fIdSens[1]) {
fe4da5cc 604 vol[0]=2;
0a6d8768 605 id=gMC->CurrentVolOffID(1,copy);
fe4da5cc 606 vol[1]=copy;
0a6d8768 607 id=gMC->CurrentVolOffID(2,copy);
fe4da5cc 608 vol[2]=copy;
58005f18 609 } else if(id==fIdSens[2]) {
fe4da5cc 610 vol[0]=3;
611 vol[1]=copy;
0a6d8768 612 id=gMC->CurrentVolOffID(1,copy);
fe4da5cc 613 vol[2]=copy;
58005f18 614 } else if(id==fIdSens[3]) {
fe4da5cc 615 vol[0]=4;
616 vol[1]=copy;
0a6d8768 617 id=gMC->CurrentVolOffID(1,copy);
fe4da5cc 618 vol[2]=copy;
58005f18 619 } else if(id==fIdSens[4]) {
fe4da5cc 620 vol[0]=5;
621 vol[1]=copy;
0a6d8768 622 id=gMC->CurrentVolOffID(1,copy);
fe4da5cc 623 vol[2]=copy;
58005f18 624 } else if(id==fIdSens[5]) {
fe4da5cc 625 vol[0]=6;
626 vol[1]=copy;
0a6d8768 627 id=gMC->CurrentVolOffID(1,copy);
fe4da5cc 628 vol[2]=copy;
629 } else return;
cfce8870 630 gMC->TrackPosition(position);
631 gMC->TrackMomentum(momentum);
fe4da5cc 632 hits[0]=position[0];
633 hits[1]=position[1];
634 hits[2]=position[2];
0a6d8768 635 hits[3]=momentum[0];
636 hits[4]=momentum[1];
58005f18 637 hits[5]=momentum[2];
cfce8870 638 hits[6]=gMC->Edep();
58005f18 639 hits[7]=gMC->TrackTime();
fe4da5cc 640 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
641 }
642}
593d2ea1 643
644//____________________________________________________________________________
645void AliITSv1::Streamer(TBuffer &R__b)
646{
647 // Stream an object of class AliITSv1.
648
649 if (R__b.IsReading()) {
650 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
651 AliITS::Streamer(R__b);
652 // This information does not need to be read. It is "hard wired"
653 // into this class via its creators.
654 //R__b >> fId1N;
655 //R__b.ReadArray(fId1Name);
656 } else {
657 R__b.WriteVersion(AliITSv1::IsA());
658 AliITS::Streamer(R__b);
659 // This information does not need to be saved. It is "hard wired"
660 // into this class via its creators.
661 //R__b << fId1N;
662 //R__b.WriteArray(fId1Name, __COUNTER__);
663 }
664}