]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv1.cxx
Release version of ITS code
[u/mrichter/AliRoot.git] / ITS / AliITSv1.cxx
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$
18 Revision 1.14.2.2  2000/05/19 10:09:21  nilsen
19 fix for bug with HP and Sun unix + fix for event display in ITS-working branch
20
21 Revision 1.14.2.1  2000/03/04 23:45:19  nilsen
22 Fixed up the comments/documentation.
23
24 Revision 1.14  1999/11/25 06:52:56  fca
25 Correct value of drca
26
27 Revision 1.13.2.1  1999/11/25 06:52:21  fca
28 Correct value of drca
29
30 Revision 1.13  1999/10/27 11:16:26  fca
31 Correction of problem in geometry
32
33 Revision 1.12  1999/10/22 08:25:25  fca
34 remove double definition of destructors
35
36 Revision 1.11  1999/10/22 08:16:49  fca
37 Correct destructors, thanks to I.Hrivnacova
38
39 Revision 1.10  1999/10/06 19:56:50  fca
40 Add destructor
41
42 Revision 1.9  1999/10/05 08:05:09  fca
43 Minor corrections for uninitialised variables.
44
45 Revision 1.8  1999/09/29 09:24:20  fca
46 Introduction of the Copyright and cvs Log
47
48 */
49
50 ///////////////////////////////////////////////////////////////////////////////
51 //                                                                           //
52 //  Inner Traking System version 1                                           //
53 //  This class contains the base procedures for the Inner Tracking System    //
54 //                                                                           //
55 // Authors: R. Barbera, A. Morsch.
56 // version 1.
57 // Created  1998.
58 //
59 //  NOTE: THIS IS THE COARSE pre.TDR geometry of the ITS. THIS WILL NOT WORK
60 // with the geometry or module classes or any analysis classes. You are 
61 // strongly encouraged to uses AliITSv5.
62 //                                                                           //
63 ///////////////////////////////////////////////////////////////////////////////
64  
65 #include <TMath.h>
66 #include <TRandom.h>
67 #include <TVector.h>
68 #include <TGeometry.h>
69 #include <TNode.h>
70 #include <TTUBE.h>
71 #include <TFile.h>    // only required for Tracking function?
72 #include <TCanvas.h>
73 #include <TObjArray.h>
74 #include <TClonesArray.h>
75
76
77 #include "AliMC.h"
78 #include "AliConst.h"
79
80 #include "AliITShit.h"
81 #include "AliITSv1.h"
82 #include "AliRun.h"
83
84
85 ClassImp(AliITSv1)
86  
87 //_____________________________________________________________________________
88 AliITSv1::AliITSv1() {
89 ////////////////////////////////////////////////////////////////////////
90 //    Standard default constructor for the ITS version 1.
91 ////////////////////////////////////////////////////////////////////////
92
93   fIdN = 6;
94   fIdName = new TString[fIdN];
95   fIdName[0] = "ITS1";
96   fIdName[1] = "ITS2";
97   fIdName[2] = "ITS3";
98   fIdName[3] = "ITS4";
99   fIdName[4] = "ITS5";
100   fIdName[5] = "ITS6";
101   fIdSens    = new Int_t[fIdN];
102   for (Int_t i=0;i<fIdN;i++) fIdSens[i]=fIdName[i].Length();
103 }
104 //_____________________________________________________________________________
105 AliITSv1::AliITSv1(const char *name, const char *title) : AliITS(name, title){
106 ////////////////////////////////////////////////////////////////////////
107 //    Standard constructor for the ITS version 1.
108 ////////////////////////////////////////////////////////////////////////
109
110   fIdN = 6;
111   fIdName = new TString[fIdN];
112   fIdName[0] = "ITS1";
113   fIdName[1] = "ITS2";
114   fIdName[2] = "ITS3";
115   fIdName[3] = "ITS4";
116   fIdName[4] = "ITS5";
117   fIdName[5] = "ITS6";
118   fIdSens    = new Int_t[fIdN];
119   for (Int_t i=0;i<fIdN;i++) fIdSens[i]=fIdName[i].Length();
120
121 }
122 //____________________________________________________________________________
123 AliITSv1::AliITSv1(const AliITSv1 &source){
124 ////////////////////////////////////////////////////////////////////////
125 //     Copy Constructor for ITS version 1.
126 ////////////////////////////////////////////////////////////////////////
127     if(&source == this) return;
128     printf("Not allowed to copy AliITSv1\n");
129     return;
130 }
131 //_____________________________________________________________________________
132 AliITSv1& AliITSv1::operator=(const AliITSv1 &source){
133 ////////////////////////////////////////////////////////////////////////
134 //    Assignment operator for the ITS version 1.
135 ////////////////////////////////////////////////////////////////////////
136   if(&source == this) return *this;
137     printf("Not allowed to copy AliITSv1\n");
138   return *this;
139 }
140 //_____________________________________________________________________________
141 AliITSv1::~AliITSv1() {
142 ////////////////////////////////////////////////////////////////////////
143 //    Standard destructor for the ITS version 1.
144 ////////////////////////////////////////////////////////////////////////
145 }
146
147 //__________________________________________________________________________
148 void AliITSv1::BuildGeometry(){
149 ////////////////////////////////////////////////////////////////////////
150 //    Geometry builder for the ITS version 1.
151 ////////////////////////////////////////////////////////////////////////
152     TNode *node, *top;
153     const int kColorITS=kYellow;
154     //
155     top = gAlice->GetGeometry()->GetNode("alice");
156
157     new TTUBE("S_layer1","Layer1 of ITS","void",3.9,3.9+0.05475,12.25);
158     top->cd();
159     node = new TNode("Layer1","Layer1","S_layer1",0,0,0,"");
160     node->SetLineColor(kColorITS);
161     fNodes->Add(node);
162
163     new TTUBE("S_layer2","Layer2 of ITS","void",7.6,7.6+0.05475,16.3);
164     top->cd();
165     node = new TNode("Layer2","Layer2","S_layer2",0,0,0,"");
166     node->SetLineColor(kColorITS);
167     fNodes->Add(node);
168
169     new TTUBE("S_layer3","Layer3 of ITS","void",14,14+0.05288,21.1);
170     top->cd();
171     node = new TNode("Layer3","Layer3","S_layer3",0,0,0,"");
172     node->SetLineColor(kColorITS);
173     fNodes->Add(node);
174
175     new TTUBE("S_layer4","Layer4 of ITS","void",24,24+0.05288,29.6);
176     top->cd();
177     node = new TNode("Layer4","Layer4","S_layer4",0,0,0,"");
178     node->SetLineColor(kColorITS);
179     fNodes->Add(node);
180
181     new TTUBE("S_layer5","Layer5 of ITS","void",40,40+0.05382,45.1);
182     top->cd();
183     node = new TNode("Layer5","Layer5","S_layer5",0,0,0,"");
184     node->SetLineColor(kColorITS);
185     fNodes->Add(node);
186
187     new TTUBE("S_layer6","Layer6 of ITS","void",45,45+0.05382,50.4);
188     top->cd();
189     node = new TNode("Layer6","Layer6","S_layer6",0,0,0,"");
190     node->SetLineColor(kColorITS);
191     fNodes->Add(node);
192 }
193 //_____________________________________________________________________________
194 void AliITSv1::CreateGeometry(){
195 ////////////////////////////////////////////////////////////////////////
196 //    This routine defines and Creates the geometry for version 1 of the ITS.
197 ////////////////////////////////////////////////////////////////////////
198   
199   Float_t drcer[6] = { 0.,0.,.08,.08,0.,0. };           //CERAMICS THICKNESS
200   Float_t drepx[6] = { 0.,0.,0.,0.,.5357,.5357 };       //EPOXY THICKNESS
201   Float_t drpla[6] = { 0.,0.,0.,0.,.1786,.1786 };       //PLASTIC THICKNESS
202   Float_t dzb[6]   = { 0.,0.,15.,15.,4.,4. };           //LENGTH OF BOXES
203   Float_t dphi[6]  = { 72.,72.,72.,72.,50.6,45. };      //COVERED PHI-RANGE FOR LAYERS 1-6
204   Float_t rl[6]    = { 3.9,7.6,14.,24.,40.,45. };       //SILICON LAYERS INNER RADIUS
205   Float_t drl[6]   = { .755,.755,.809,.809,.7,.7 };     //THICKNESS OF LAYERS (in % radiation length)
206   Float_t dzl[6]   = { 12.67,16.91,20.85,29.15,45.11,50.975 };//HALF LENGTH OF LAYERS
207   Float_t drpcb[6] = { 0.,0.,.06,.06,0.,0. };           //PCB THICKNESS
208   Float_t drcu[6]  = { 0.,0.,.0504,.0504,.0357,.0357 }; //COPPER THICKNESS
209   Float_t drsi[6]  = { 0.,0.,.006,.006,.3571,.3571 };   //SILICON THICKNESS
210
211   Float_t drca, dzfc;
212   Int_t i, nsec;
213   Float_t rend, drcatpc, dzco, zend, dits[3], rlim, drsu, zmax;
214   Float_t zpos, dzco1, dzco2;
215   Float_t drcac[6], acone, dphii;
216   Float_t pcits[15], xltpc;
217   Float_t rzcone, rstep, r0, z0, acable, fp, dz, zi, ri;
218   Int_t idrotm[399];
219   Float_t dgh[15];
220   
221   Int_t *idtmed = fIdtmed->GetArray()-199;
222   
223   //     CONVERT INTO CM (RL(SI)=9.36 CM) 
224   for (i = 0; i < 6; ++i) {
225     drl[i] = drl[i] / 100. * 9.36;
226   }
227   
228   //     SUPPORT ENDPLANE THICKNESS 
229   drsu = 2.*0.06+1./20;  // 1./20. is 1 cm of honeycomb (1/20 carbon density);
230   
231   //     CONE BELOW TPC 
232   
233   drcatpc = 1.2/4.;
234   
235   //     CABLE THICKNESS (CONICAL CABLES CONNECTING THE LAYERS) 
236
237   drca = 0.2;
238   
239   //     ITS CONE ANGLE 
240   
241   acone  = 45.;
242   acone *= kDegrad;
243   
244   //     CONE RADIUS AT 1ST LAYER 
245   
246   rzcone = 30.;
247   
248   //     FIELD CAGE HALF LENGTH 
249   
250   dzfc  = 64.5;
251   rlim  = 48.;
252   zmax  = 80.;
253   xltpc = 275.;
254   
255   
256   //     PARAMETERS FOR SMALL (1/2) ITS 
257
258   for (i = 0; i < 6; ++i) {
259     dzl[i] /= 2.;
260     dzb[i] /= 2.;
261   }
262   drca     /= 2.;
263   acone    /= 2.;
264   drcatpc /= 2.;
265   rzcone   /= 2.;
266   dzfc     /= 2.;
267   zmax     /= 2.;
268   xltpc    /= 2.;
269   acable    = 15.;
270   
271   
272   
273   //     EQUAL DISTRIBUTION INTO THE 6 LAYERS 
274   rstep = drcatpc / 6.;
275   for (i = 0; i < 6; ++i) {
276     drcac[i] = (i+1) * rstep;
277   }
278
279   //     NUMBER OF PHI SECTORS 
280   
281   nsec = 5;
282   
283   //     PACK IN PHI AS MUCH AS POSSIBLE 
284   //     NOW PACK USING THICKNESS 
285   
286   for (i = 0; i < 6; ++i) {
287     
288 //     PACKING FACTOR 
289     fp = rl[5] / rl[i];
290     
291     //      PHI-PACKING NOT SUFFICIENT ? 
292     
293     if (dphi[i]/45 < fp) {
294       drcac[i] = drcac[i] * fp * 45/dphi[i];
295     }
296   }
297   
298   
299   // --- Define ghost volume containing the six layers and fill it with air 
300   
301   dgh[0] = 3.5;
302   dgh[1] = 50.;
303   dgh[2] = zmax;
304   gMC->Gsvolu("ITSV", "TUBE", idtmed[275], dgh, 3);
305   
306   // --- Place the ghost volume in its mother volume (ALIC) and make it 
307   //     invisible 
308   
309   gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., 0, "ONLY");
310   gMC->Gsatt("ITSV", "SEEN", 0);
311   
312   //     ITS LAYERS (SILICON) 
313   
314   dits[0] = rl[0];
315   dits[1] = rl[0] + drl[0];
316   dits[2] = dzl[0];
317   gMC->Gsvolu("ITS1", "TUBE", idtmed[199], dits, 3);
318   gMC->Gspos("ITS1", 1, "ITSV", 0., 0., 0., 0, "ONLY");
319   
320   dits[0] = rl[1];
321   dits[1] = rl[1] + drl[1];
322   dits[2] = dzl[1];
323   gMC->Gsvolu("ITS2", "TUBE", idtmed[199], dits, 3);
324   gMC->Gspos("ITS2", 1, "ITSV", 0., 0., 0., 0, "ONLY");
325   
326   dits[0] = rl[2];
327   dits[1] = rl[2] + drl[2];
328   dits[2] = dzl[2];
329   gMC->Gsvolu("ITS3", "TUBE", idtmed[224], dits, 3);
330   gMC->Gspos("ITS3", 1, "ITSV", 0., 0., 0., 0, "ONLY");
331   
332   dits[0] = rl[3];
333   dits[1] = rl[3] + drl[3];
334   dits[2] = dzl[3];
335   gMC->Gsvolu("ITS4", "TUBE", idtmed[224], dits, 3);
336   gMC->Gspos("ITS4", 1, "ITSV", 0., 0., 0., 0, "ONLY");
337   
338   dits[0] = rl[4];
339   dits[1] = rl[4] + drl[4];
340   dits[2] = dzl[4];
341   gMC->Gsvolu("ITS5", "TUBE", idtmed[249], dits, 3);
342   gMC->Gspos("ITS5", 1, "ITSV", 0., 0., 0., 0, "ONLY");
343   
344   dits[0] = rl[5];
345   dits[1] = rl[5] + drl[5];
346   dits[2] = dzl[5];
347   gMC->Gsvolu("ITS6", "TUBE", idtmed[249], dits, 3);
348   gMC->Gspos("ITS6", 1, "ITSV", 0., 0., 0., 0, "ONLY");
349   
350   //    ELECTRONICS BOXES 
351   
352   //     PCB (layer #3 and #4) 
353   
354   gMC->Gsvolu("IPCB", "TUBE", idtmed[233], dits, 0);
355   for (i = 2; i < 4; ++i) {
356     dits[0] = rl[i];
357     dits[1] = dits[0] + drpcb[i];
358     dits[2] = dzb[i] / 2.;
359     zpos = dzl[i] + dits[2];
360     gMC->Gsposp("IPCB", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
361     gMC->Gsposp("IPCB", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
362   }
363   
364   //     COPPER (layer #3 and #4) 
365   
366   gMC->Gsvolu("ICO2", "TUBE", idtmed[234], dits, 0);
367   for (i = 2; i < 4; ++i) {
368     dits[0] = rl[i] + drpcb[i];
369     dits[1] = dits[0] + drcu[i];
370     dits[2] = dzb[i] / 2.;
371     zpos = dzl[i] + dits[2];
372     gMC->Gsposp("ICO2", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
373     gMC->Gsposp("ICO2", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
374   }
375   
376   //     CERAMICS (layer #3 and #4) 
377   
378   gMC->Gsvolu("ICER", "TUBE", idtmed[235], dits, 0);
379   for (i = 2; i < 4; ++i) {
380     dits[0] = rl[i] + drpcb[i] + drcu[i];
381     dits[1] = dits[0] + drcer[i];
382     dits[2] = dzb[i] / 2.;
383     zpos = dzl[i] + dits[2];
384     gMC->Gsposp("ICER", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
385     gMC->Gsposp("ICER", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
386   }
387   
388   //     SILICON (layer #3 and #4) 
389   
390   gMC->Gsvolu("ISI2", "TUBE", idtmed[226], dits, 0);
391   for (i = 2; i < 4; ++i) {
392     dits[0] = rl[i] + drpcb[i] + drcu[i] + drcer[i];
393     dits[1] = dits[0] + drsi[i];
394     dits[2] = dzb[i] / 2.;
395     zpos = dzl[i] + dits[2];
396     gMC->Gsposp("ISI2", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
397     gMC->Gsposp("ISI2", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
398   }
399   
400   //     PLASTIC (G10FR4) (layer #5 and #6) 
401   
402   gMC->Gsvolu("IPLA", "TUBE", idtmed[262], dits, 0);
403   for (i = 4; i < 6; ++i) {
404     dits[0] = rl[i];
405     dits[1] = dits[0] + drpla[i];
406     dits[2] = dzb[i] / 2.;
407     zpos = dzl[i] + dits[2];
408     gMC->Gsposp("IPLA", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
409     gMC->Gsposp("IPLA", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
410   }
411   
412   //     COPPER (layer #5 and #6) 
413   
414   gMC->Gsvolu("ICO3", "TUBE", idtmed[259], dits, 0);
415   for (i = 4; i < 6; ++i) {
416     dits[0] = rl[i] + drpla[i];
417     dits[1] = dits[0] + drcu[i];
418     dits[2] = dzb[i] / 2.;
419     zpos = dzl[i] + dits[2];
420     gMC->Gsposp("ICO3", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
421     gMC->Gsposp("ICO3", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
422   }
423   
424   //     EPOXY (layer #5 and #6) 
425   
426   gMC->Gsvolu("IEPX", "TUBE", idtmed[262], dits, 0);
427   for (i = 4; i < 6; ++i) {
428     dits[0] = rl[i] + drpla[i] + drcu[i];
429     dits[1] = dits[0] + drepx[i];
430     dits[2] = dzb[i] / 2.;
431     zpos = dzl[i] + dits[2];
432     gMC->Gsposp("IEPX", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
433     gMC->Gsposp("IEPX", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
434   }
435   
436   //     SILICON (layer #5 and #6) 
437   
438   gMC->Gsvolu("ISI3", "TUBE", idtmed[251], dits, 0);
439   for (i = 4; i < 6; ++i) {
440     dits[0] = rl[i] + drpla[i] + drcu[i] + drepx[i];
441     dits[1] = dits[0] + drsi[i];
442     dits[2] = dzb[i] / 2.;
443     zpos = dzl[i] + dits[2];
444     gMC->Gsposp("ISI3", i-1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
445     gMC->Gsposp("ISI3", i+1, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
446   }
447   
448   //    SUPPORT 
449   
450   gMC->Gsvolu("ISUP", "TUBE", idtmed[274], dits, 0);
451   for (i = 0; i < 6; ++i) {
452     dits[0] = rl[i];
453     if (i < 5) dits[1] = rl[i+1];
454     else       dits[1] = rlim;
455     dits[2] = drsu / 2.;
456     zpos = dzl[i] + dzb[i] + dits[2];
457     gMC->Gsposp("ISUP", i+1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
458     gMC->Gsposp("ISUP", i+7, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
459   }
460   
461   // CABLES (HORIZONTAL) 
462   
463   gMC->Gsvolu("ICHO", "TUBE", idtmed[278], dits, 0);
464   for (i = 0; i < 6; ++i) {
465     dits[0] = rl[i];
466     dits[1] = dits[0] + drca;
467     dits[2] = (rzcone + TMath::Tan(acone) * (rl[i] - rl[0]) - (dzl[i]+ dzb[i] + drsu)) / 2.;
468     zpos = dzl[i - 1] + dzb[i] + drsu + dits[2];
469     gMC->Gsposp("ICHO", i+1, "ITSV", 0., 0., zpos, 0, "ONLY", dits, 3);
470     gMC->Gsposp("ICHO", i+7, "ITSV", 0., 0.,-zpos, 0, "ONLY", dits, 3);
471   }
472   //    DEFINE A CONICAL GHOST VOLUME FOR THE PHI SEGMENTATION 
473   pcits[0] = 0.;
474   pcits[1] = 360.;
475   pcits[2] = 2.;
476   pcits[3] = rzcone;
477   pcits[4] = 3.5;
478   pcits[5] = rl[0];
479   pcits[6] = pcits[3] + TMath::Tan(acone) * (rlim - rl[0]);
480   pcits[7] = rlim - rl[0] + 3.5;
481   pcits[8] = rlim;
482   gMC->Gsvolu("ICMO", "PCON", idtmed[275], pcits, 9);
483   AliMatrix(idrotm[200], 90., 0., 90., 90., 180., 0.);
484   gMC->Gspos("ICMO", 1, "ITSV", 0., 0., 0., 0, "ONLY");
485   gMC->Gspos("ICMO", 2, "ITSV", 0., 0., 0., idrotm[200], "ONLY");
486   
487   //     DIVIDE INTO NSEC PHI-SECTIONS 
488   
489   gMC->Gsdvn("ICMD", "ICMO", nsec, 2);
490   gMC->Gsatt("ICMO", "SEEN", 0);
491   gMC->Gsatt("ICMD", "SEEN", 0);
492   
493   //     CONICAL CABLES 
494   
495   pcits[2] = 2.;
496   gMC->Gsvolu("ICCO", "PCON", idtmed[278], pcits, 0);
497   for (i = 1; i < 6; ++i) {
498     pcits[0] = -dphi[i] / 2.;
499     pcits[1] = dphi[i];
500     if (i < 5) {
501       dzco = TMath::Tan(acone) * (rl[i+1] - rl[i]);
502     } else {
503       dzco1 = zmax - (rzcone + TMath::Tan(acone) * (rl[5] - rl[0])) -2.;
504       dzco2 = (rlim - rl[5]) * TMath::Tan(acone);
505       if (rl[5] + dzco1 / TMath::Tan(acone) < rlim) {
506         dzco = dzco1;
507       } else {
508         dzco = dzco2;
509       }
510     }
511     pcits[3] = rzcone + TMath::Tan(acone) * (rl[i] - rl[0]);
512     pcits[4] = rl[i] - drcac[i] / TMath::Sin(acone);
513     pcits[5] = rl[i];
514     pcits[6] = pcits[3] + dzco;
515     pcits[7] = rl[i] + dzco / TMath::Tan(acone) - drcac[i] / TMath::Sin(acone);
516     pcits[8] = rl[i] + dzco / TMath::Tan(acone);
517     
518     gMC->Gsposp("ICCO", i, "ICMD", 0., 0., 0., 0, "ONLY", pcits, 9);
519     
520   }
521   zend = pcits[6];
522   rend = pcits[8];
523   
524   //  CONICAL CABLES BELOW TPC 
525   
526   //    DEFINE A CONICAL GHOST VOLUME FOR THE PHI SEGMENTATION 
527   pcits[0] = 0.;
528   pcits[1] = 360.;
529   pcits[2] = 2.;
530   pcits[3] = zend;
531   pcits[5] = rend;
532   pcits[4] = pcits[5] - drcatpc;
533   pcits[6] = xltpc;
534   pcits[8] = pcits[4] + (pcits[6] - pcits[3]) * TMath::Tan(acable * kDegrad);
535   pcits[7] = pcits[8] - drcatpc;
536   AliMatrix(idrotm[200], 90., 0., 90., 90., 180., 0.);
537   gMC->Gsvolu("ICCM", "PCON", idtmed[275], pcits, 9);
538   gMC->Gspos("ICCM", 1, "ALIC", 0., 0., 0., 0, "ONLY");
539   gMC->Gspos("ICCM", 2, "ALIC", 0., 0., 0., idrotm[200], "ONLY");
540   gMC->Gsdvn("ITMD", "ICCM", nsec, 2);
541   gMC->Gsatt("ITMD", "SEEN", 0);
542   gMC->Gsatt("ICCM", "SEEN", 0);
543   
544   //     NOW PLACE SEGMENTS WITH DECREASING PHI SEGMENTS INTO THE 
545   //     GHOST-VOLUME 
546   
547   pcits[2] = 2.;
548   gMC->Gsvolu("ITTT", "PCON", idtmed[278], pcits, 0);
549   r0 = rend;
550   z0 = zend;
551   dz = (xltpc - zend) / 9.;
552   for (i = 0; i < 9; ++i) {
553     zi = z0 + i*dz + dz / 2.;
554     ri = r0 + (zi - z0) * TMath::Tan(acable * kDegrad);
555     dphii = dphi[5] * r0 / ri;
556     pcits[0] = -dphii / 2.;
557     pcits[1] = dphii;
558     pcits[3] = zi - dz / 2.;
559     pcits[5] = r0 + (pcits[3] - z0) * TMath::Tan(acable * kDegrad);
560     pcits[4] = pcits[5] - drcatpc;
561     pcits[6] = zi + dz / 2.;
562     pcits[8] = r0 + (pcits[6] - z0) * TMath::Tan(acable * kDegrad);
563     pcits[7] = pcits[8] - drcatpc;
564     
565     gMC->Gsposp("ITTT", i+1, "ITMD", 0., 0., 0., 0, "ONLY", pcits, 9);
566   }
567   
568   // --- Outputs the geometry tree in the EUCLID/CAD format 
569   
570   if (fEuclidOut) {
571     gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
572   }
573 }
574 //_____________________________________________________________________________
575 void AliITSv1::CreateMaterials(){
576 ////////////////////////////////////////////////////////////////////////
577   //
578   // Create ITS materials
579   //     This function defines the default materials used in the Geant
580   // Monte Carlo simulations for the geometries AliITSv1 and AliITSv3.
581   // In general it is automatically replaced by
582   // the CreatMaterials routine defined in AliITSv?. Should the function
583   // CreateMaterials not exist for the geometry version you are using this
584   // one is used. See the definition found in AliITSv5 or the other routine
585   // for a complete definition.
586   //
587   // Water H2O
588   Float_t awat[2]  = { 1.00794,15.9994 };
589   Float_t zwat[2]  = { 1.,8. };
590   Float_t wwat[2]  = { 2.,1. };
591   Float_t denswat  = 1.;
592   // Freon
593   Float_t afre[2]  = { 12.011,18.9984032 };
594   Float_t zfre[2]  = { 6.,9. };
595   Float_t wfre[2]  = { 5.,12. };
596   Float_t densfre  = 1.5;
597   // Ceramics
598   //     94.4% Al2O3 , 2.8% SiO2 , 2.3% MnO , 0.5% Cr2O3 
599   Float_t acer[5]  = { 26.981539,15.9994,28.0855,54.93805,51.9961 };
600   Float_t zcer[5]  = { 13.,8.,14.,25.,      24. };
601   Float_t wcer[5]  = { .49976,1.01233,.01307,       .01782,.00342 };
602   Float_t denscer  = 3.6;
603   //
604   //     60% SiO2 , 40% G10FR4 
605   // PC board
606   Float_t apcb[3]  = { 28.0855,15.9994,17.749 };
607   Float_t zpcb[3]  = { 14.,8.,8.875 };
608   Float_t wpcb[3]  = { .28,.32,.4 };
609   Float_t denspcb  = 1.8;
610   // POLYETHYL
611   Float_t apoly[2] = { 12.01,1. };
612   Float_t zpoly[2] = { 6.,1. };
613   Float_t wpoly[2] = { .33,.67 };
614   // SERVICES
615   Float_t zserv[4] = { 1.,6.,26.,29. };
616   Float_t aserv[4] = { 1.,12.,55.8,63.5 };
617   Float_t wserv[4] = { .014,.086,.42,.48 };
618   
619   Int_t  isxfld  = gAlice->Field()->Integ();
620   Float_t sxmgmx = gAlice->Field()->Max();
621   
622   
623   // --- Define the various materials for GEANT --- 
624   
625   //  200-224 --> Silicon Pixel Detectors (detectors, chips, buses, cooling,..)
626   
627   AliMaterial(0, "SPD Si$",      28.0855, 14., 2.33, 9.36, 999);
628   AliMaterial(1, "SPD Si chip$", 28.0855, 14., 2.33, 9.36, 999);
629   AliMaterial(2, "SPD Si bus$",  28.0855, 14., 2.33, 9.36, 999);
630   AliMaterial(3, "SPD C$",       12.011,   6., 2.265,18.8, 999);
631   // v. dens 
632   AliMaterial(4, "SPD Air$",    14.61, 7.3, .001205, 30423., 999);
633   AliMaterial(5, "SPD Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
634   AliMaterial(6, "SPD Al$",     26.981539, 13., 2.6989, 8.9, 999);
635   AliMixture( 7, "SPD Water $", awat, zwat, denswat, -2, wwat);
636   AliMixture( 8, "SPD Freon$",  afre, zfre, densfre, -2, wfre);
637   // ** 
638   AliMedium(0, "SPD Si$",      0, 1,isxfld,sxmgmx, 10., .01, .1, .003, .003);
639   AliMedium(1, "SPD Si chip$", 1, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
640   AliMedium(2, "SPD Si bus$",  2, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
641   AliMedium(3, "SPD C$",       3, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
642   AliMedium(4, "SPD Air$",     4, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
643   AliMedium(5, "SPD Vacuum$",  5, 0,isxfld,sxmgmx, 10.,1.00, .1, .100,10.00);
644   AliMedium(6, "SPD Al$",      6, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
645   AliMedium(7, "SPD Water $",  7, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
646   AliMedium(8, "SPD Freon$",   8, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
647   
648   //  225-249 --> Silicon Drift Detectors (detectors, chips, buses, cooling,..)
649   
650   AliMaterial(25, "SDD Si$",      28.0855, 14., 2.33,  9.36, 999);
651   AliMaterial(26, "SDD Si chip$", 28.0855, 14., 2.33,  9.36, 999);
652   AliMaterial(27, "SDD Si bus$",  28.0855, 14., 2.33,  9.36, 999);
653   AliMaterial(28, "SDD C$",       12.011,   6., 2.265,18.8,  999);
654   // v. dens 
655   AliMaterial(29, "SDD Air$",     14.61, 7.3, .001205, 30423., 999);
656   AliMaterial(30, "SDD Vacuum$",  1e-16, 1e-16, 1e-16, 1e16,  1e16);
657   AliMaterial(31, "SDD Al$",      26.981539, 13., 2.6989, 8.9, 999);
658   // After a call with ratios by number (negative number of elements), 
659   // the ratio array is changed to the ratio by weight, so all successive 
660   // calls with the same array must specify the number of elements as 
661   // positive 
662   AliMixture(32, "SDD Water $", awat, zwat, denswat, 2, wwat);
663   // After a call with ratios by number (negative number of elements), 
664   // the ratio array is changed to the ratio by weight, so all successive 
665   // calls with the same array must specify the number of elements as 
666   // positive 
667   AliMixture( 33, "SDD Freon$", afre, zfre, densfre, 2, wfre);
668   AliMixture( 34, "SDD PCB$",   apcb, zpcb, denspcb, 3, wpcb);
669   AliMaterial(35, "SDD Copper$", 63.546, 29., 8.96, 1.43, 999);
670   AliMixture( 36, "SDD Ceramics$", acer, zcer, denscer, -5, wcer);
671   AliMaterial(37, "SDD Kapton$", 12.011, 6., 1.3, 31.27, 999);
672   // ** 
673   // check A and Z 
674   AliMedium(25, "SDD Si$",      25, 1,isxfld,sxmgmx, 10., .01, .1, .003, .003);
675   AliMedium(26, "SDD Si chip$", 26, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
676   AliMedium(27, "SDD Si bus$",  27, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
677   AliMedium(28, "SDD C$",       28, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
678   AliMedium(29, "SDD Air$",     29, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
679   AliMedium(30, "SDD Vacuum$",  30, 0,isxfld,sxmgmx, 10.,1.00, .1, .100,10.00);
680   AliMedium(31, "SDD Al$",      31, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
681   AliMedium(32, "SDD Water $",  32, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
682   AliMedium(33, "SDD Freon$",   33, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
683   AliMedium(34, "SDD PCB$",     34, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
684   AliMedium(35, "SDD Copper$",  35, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
685   AliMedium(36, "SDD Ceramics$",36, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
686   AliMedium(37, "SDD Kapton$",  37, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
687   
688   //  250-274 --> Silicon Strip Detectors (detectors, chips, buses, cooling,..)
689   
690   AliMaterial(50, "SSD Si$",      28.0855, 14., 2.33, 9.36, 999.);
691   AliMaterial(51, "SSD Si chip$", 28.0855, 14., 2.33, 9.36, 999.);
692   AliMaterial(52, "SSD Si bus$",  28.0855, 14., 2.33, 9.36, 999.);
693   AliMaterial(53, "SSD C$",       12.011,   6., 2.265,18.8, 999.);
694   // v. dens 
695   AliMaterial(54, "SSD Air$",     14.61, 7.3, .001205, 30423., 999);
696   AliMaterial(55, "SSD Vacuum$",  1e-16, 1e-16, 1e-16, 1e16, 1e16);
697   AliMaterial(56, "SSD Al$",      26.981539, 13., 2.6989, 8.9, 999);
698   // After a call with ratios by number (negative number of elements), 
699   // the ratio array is changed to the ratio by weight, so all successive 
700   // calls with the same array must specify the number of elements as 
701   // positive 
702   AliMixture(57, "SSD Water $", awat, zwat, denswat, 2, wwat);
703   // After a call with ratios by number (negative number of elements), 
704   // the ratio array is changed to the ratio by weight, so all successive 
705   // calls with the same array must specify the number of elements as 
706   // positive 
707   AliMixture(58, "SSD Freon$", afre, zfre, densfre, 2, wfre);
708   AliMixture(59, "SSD PCB$",   apcb, zpcb, denspcb, 3, wpcb);
709   AliMaterial(60, "SSD Copper$", 63.546, 29., 8.96, 1.43, 999.);
710   // After a call with ratios by number (negative number of elements), 
711   // the ratio array is changed to the ratio by weight, so all successive 
712   // calls with the same array must specify the number of elements as 
713   // positive 
714   AliMixture( 61, "SSD Ceramics$", acer, zcer, denscer, 5, wcer);
715   AliMaterial(62, "SSD Kapton$", 12.011, 6., 1.3, 31.27, 999.);
716   // check A and Z 
717   AliMaterial(63, "SDD G10FR4$", 17.749, 8.875, 1.8, 21.822, 999.);
718   // ** 
719   AliMedium(50, "SSD Si$",      50, 1,isxfld,sxmgmx, 10., .01, .1, .003, .003);
720   AliMedium(51, "SSD Si chip$", 51, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
721   AliMedium(52, "SSD Si bus$",  52, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
722   AliMedium(53, "SSD C$",       53, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
723   AliMedium(54, "SSD Air$",     54, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
724   AliMedium(55, "SSD Vacuum$",  55, 0,isxfld,sxmgmx, 10.,1.00, .1, .100,10.00);
725   AliMedium(56, "SSD Al$",      56, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
726   AliMedium(57, "SSD Water $",  57, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
727   AliMedium(58, "SSD Freon$",   58, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
728   AliMedium(59, "SSD PCB$",     59, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
729   AliMedium(60, "SSD Copper$",  60, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
730   AliMedium(61, "SSD Ceramics$",61, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
731   AliMedium(62, "SSD Kapton$",  62, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
732   AliMedium(63, "SSD G10FR4$",  63, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
733   
734   //     275-299 --> General (end-caps, frames, cooling, cables, etc.) 
735   
736   AliMaterial(75, "GEN C$", 12.011, 6., 2.265, 18.8, 999.);
737   // verify density 
738   AliMaterial(76, "GEN Air$", 14.61, 7.3, .001205, 30423., 999);
739   AliMaterial(77, "GEN Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
740   AliMixture( 78, "GEN POLYETHYL$", apoly, zpoly, .95, -2, wpoly);
741   AliMixture( 79, "GEN SERVICES$",  aserv, zserv, 4.68, 4, wserv);
742   AliMaterial(80, "GEN Copper$", 63.546, 29., 8.96, 1.43, 999.);
743   // After a call with ratios by number (negative number of elements), 
744   // the ratio array is changed to the ratio by weight, so all successive 
745   // calls with the same array must specify the number of elements as 
746   // positive 
747   AliMixture(81, "GEN Water $", awat, zwat, denswat, 2, wwat);
748   // ** 
749   AliMedium(75,"GEN C$",        75, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
750   AliMedium(76,"GEN Air$",      76, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
751   AliMedium(77,"GEN Vacuum$",   77, 0,isxfld,sxmgmx, 10., .10, .1, .100,10.00);
752   AliMedium(78,"GEN POLYETHYL$",78, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
753   AliMedium(79,"GEN SERVICES$", 79, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
754   AliMedium(80,"GEN Copper$",   80, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
755   AliMedium(81,"GEN Water $",   81, 0,isxfld,sxmgmx, 10., .01, .1, .003, .003);
756 }
757 //_____________________________________________________________________________
758 void AliITSv1::Init(){
759 ////////////////////////////////////////////////////////////////////////
760 //     Initialise the ITS after it has been created.
761 ////////////////////////////////////////////////////////////////////////
762
763     //
764     AliITS::Init();
765     fMajorVersion = 1;
766     fMinorVersion = 0;
767 }  
768  
769 //_____________________________________________________________________________
770 void AliITSv1::DrawModule(){
771 ////////////////////////////////////////////////////////////////////////
772 //     Draw a shaded view of the FMD version 1.
773 ////////////////////////////////////////////////////////////////////////
774   
775   // Set everything unseen
776   gMC->Gsatt("*", "seen", -1);
777   // 
778   // Set ALIC mother visible
779   gMC->Gsatt("ALIC","SEEN",0);
780   //
781   // Set the volumes visible
782   gMC->Gsatt("ITSV","SEEN",0);
783   gMC->Gsatt("ITS1","SEEN",1);
784   gMC->Gsatt("ITS2","SEEN",1);
785   gMC->Gsatt("ITS3","SEEN",1);
786   gMC->Gsatt("ITS4","SEEN",1);
787   gMC->Gsatt("ITS5","SEEN",1);
788   gMC->Gsatt("ITS6","SEEN",1);
789
790   gMC->Gsatt("IPCB","SEEN",1);
791   gMC->Gsatt("ICO2","SEEN",1);
792   gMC->Gsatt("ICER","SEEN",0);
793   gMC->Gsatt("ISI2","SEEN",0);
794   gMC->Gsatt("IPLA","SEEN",0);
795   gMC->Gsatt("ICO3","SEEN",0);
796   gMC->Gsatt("IEPX","SEEN",0);
797   gMC->Gsatt("ISI3","SEEN",1);
798   gMC->Gsatt("ISUP","SEEN",0);
799   gMC->Gsatt("ICHO","SEEN",0);
800   gMC->Gsatt("ICMO","SEEN",0);
801   gMC->Gsatt("ICMD","SEEN",0);
802   gMC->Gsatt("ICCO","SEEN",1);
803   gMC->Gsatt("ICCM","SEEN",0);
804   gMC->Gsatt("ITMD","SEEN",0);
805   gMC->Gsatt("ITTT","SEEN",1);
806
807   //
808   gMC->Gdopt("hide", "on");
809   gMC->Gdopt("shad", "on");
810   gMC->Gsatt("*", "fill", 7);
811   gMC->SetClipBox(".");
812   gMC->SetClipBox("*", 0, 300, -300, 300, -300, 300);
813   gMC->DefaultRange();
814   gMC->Gdraw("alic", 40, 30, 0, 11, 10, .07, .07);
815   gMC->Gdhead(1111, "Inner Tracking System Version 1");
816   gMC->Gdman(17, 6, "MAN");
817 }
818 //_____________________________________________________________________________
819 void AliITSv1::StepManager(){
820 ////////////////////////////////////////////////////////////////////////
821 //    Called for every step in the ITS, then calles the AliITShit class
822 // creator with the information to be recoreded about that hit.
823 ////////////////////////////////////////////////////////////////////////
824   Int_t         copy, id;
825   Float_t       hits[8];
826   Int_t         vol[4];
827   TLorentzVector position, momentum;
828   TClonesArray &lhits = *fHits;
829   //
830   // Track status
831   vol[3] = 0;
832   if(gMC->IsTrackInside())      vol[3] +=  1;
833   if(gMC->IsTrackEntering())    vol[3] +=  2;
834   if(gMC->IsTrackExiting())     vol[3] +=  4;
835   if(gMC->IsTrackOut())         vol[3] +=  8;
836   if(gMC->IsTrackDisappeared()) vol[3] += 16;
837   if(gMC->IsTrackStop())        vol[3] += 32;
838   if(gMC->IsTrackAlive())       vol[3] += 64;
839   //
840   // Fill hit structure.
841   if( !(gMC->TrackCharge()) ) return;
842     //
843     // Only entering charged tracks
844     if((id=gMC->CurrentVolID(copy))==fIdSens[0]) {  
845       vol[0]=1;
846       id=gMC->CurrentVolOffID(1,copy);      
847       vol[1]=copy;
848       id=gMC->CurrentVolOffID(2,copy);
849       vol[2]=copy;                       
850     } else if(id==fIdSens[1]) {
851       vol[0]=2;
852       id=gMC->CurrentVolOffID(1,copy);       
853       vol[1]=copy;
854       id=gMC->CurrentVolOffID(2,copy);
855       vol[2]=copy;                    
856     } else if(id==fIdSens[2]) {
857       vol[0]=3;
858       vol[1]=copy;
859       id=gMC->CurrentVolOffID(1,copy);
860       vol[2]=copy;             
861     } else if(id==fIdSens[3]) {
862       vol[0]=4;
863       vol[1]=copy;
864       id=gMC->CurrentVolOffID(1,copy);
865       vol[2]=copy;                  
866     } else if(id==fIdSens[4]) {
867       vol[0]=5;
868       vol[1]=copy;
869       id=gMC->CurrentVolOffID(1,copy);
870       vol[2]=copy;               
871     } else if(id==fIdSens[5]) {
872       vol[0]=6;
873       vol[1]=copy;
874       id=gMC->CurrentVolOffID(1,copy);
875       vol[2]=copy;                      
876     } else return;
877     gMC->TrackPosition(position);
878     gMC->TrackMomentum(momentum);
879     hits[0]=position[0];
880     hits[1]=position[1];
881     hits[2]=position[2];          
882     hits[3]=momentum[0];
883     hits[4]=momentum[1];
884     hits[5]=momentum[2];
885     hits[6]=gMC->Edep();
886     hits[7]=gMC->TrackTime();
887     new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
888 }
889 //____________________________________________________________________________
890 void AliITSv1::Streamer(TBuffer &R__b){
891 ////////////////////////////////////////////////////////////////////////
892 //    A dummy Streamer function for this class AliITSv1. By default it
893 // only streams the AliITS class as it is required. Since this class
894 // dosen't contain any "real" data to be saved, it doesn't.
895 ////////////////////////////////////////////////////////////////////////
896
897    if (R__b.IsReading()) {
898       Version_t R__v = R__b.ReadVersion(); if (R__v) { }
899       AliITS::Streamer(R__b);
900    } else {
901       R__b.WriteVersion(AliITSv1::IsA());
902       AliITS::Streamer(R__b);
903    } // end if R__b.IsReading()
904 }