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