]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv11.cxx
Work continuing.
[u/mrichter/AliRoot.git] / ITS / AliITSv11.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.2  2003/01/26 14:35:15  nilsen
19 Some more geometry interface functions added and a start at the SSD support
20 cone geometry. Committed to allow easy updates of partical work between authors.
21
22 Revision 1.1  2003/01/20 23:32:49  nilsen
23 New ITS geometry. Only a Skeleton for now.
24
25 $Id$
26 */
27
28 //////////////////////////////////////////////////////////////////////////////
29 //                                                                          //
30 //  Inner Traking System version 11                                         //
31 //  This class contains the base procedures for the Inner Tracking System   //
32 //                                                                          //
33 // Authors: R. Barbera                                                      //
34 // version 6.                                                               //
35 // Created  2000.                                                           //
36 //                                                                          //
37 //  NOTE: THIS IS THE  SYMMETRIC PPR geometry of the ITS.                   //
38 // THIS WILL NOT WORK                                                       //
39 // with the geometry or module classes or any analysis classes. You are     //
40 // strongly encouraged to uses AliITSv5.                                    //
41 //                                                                          //
42 //////////////////////////////////////////////////////////////////////////////
43 // See AliITSv11::StepManager().
44 #include <Riostream.h>
45 #include <stdio.h>
46 #include <stdlib.h>
47 #include <TMath.h>
48 #include <TGeometry.h>
49 #include <TNode.h>
50 #include <TTUBE.h>
51 #include <TTUBS.h>
52 #include <TPCON.h>
53 #include <TFile.h>    // only required for Tracking function?
54 #include <TCanvas.h>
55 #include <TObjArray.h>
56 #include <TLorentzVector.h>
57 #include <TObjString.h>
58 #include <TClonesArray.h>
59 #include <TBRIK.h>
60 #include <TSystem.h>
61
62
63 #include "AliRun.h"
64 #include "AliMagF.h"
65 #include "AliConst.h"
66 #include "AliITSGeant3Geometry.h"
67 #include "AliITShit.h"
68 #include "AliITS.h"
69 #include "AliITSv11.h"
70 #include "AliITSgeom.h"
71 #include "AliITSgeomSPD.h"
72 #include "AliITSgeomSDD.h"
73 #include "AliITSgeomSSD.h"
74 #include "AliITSDetType.h"
75 #include "AliITSresponseSPD.h"
76 #include "AliITSresponseSDD.h"
77 #include "AliITSresponseSSD.h"
78 #include "AliITSsegmentationSPD.h"
79 #include "AliITSsegmentationSDD.h"
80 #include "AliITSsegmentationSSD.h"
81 #include "AliITSsimulationSPD.h"
82 #include "AliITSsimulationSDD.h"
83 #include "AliITSsimulationSSD.h"
84 #include "AliITSClusterFinderSPD.h"
85 #include "AliITSClusterFinderSDD.h"
86 #include "AliITSClusterFinderSSD.h"
87
88
89 ClassImp(AliITSv11)
90
91 //______________________________________________________________________
92 AliITSv11::AliITSv11() : AliITS() {
93     ////////////////////////////////////////////////////////////////////////
94     //    Standard default constructor for the ITS version 11.
95     ////////////////////////////////////////////////////////////////////////
96 }
97 //______________________________________________________________________
98 AliITSv11::AliITSv11(const char *title) : AliITS("ITS", title){
99     ////////////////////////////////////////////////////////////////////////
100     //    Standard constructor for the ITS version 11.
101     ////////////////////////////////////////////////////////////////////////
102 }
103 //______________________________________________________________________
104 AliITSv11::~AliITSv11() {
105     ////////////////////////////////////////////////////////////////////////
106     //    Standard destructor for the ITS version 11.
107     ////////////////////////////////////////////////////////////////////////
108 }
109 //______________________________________________________________________
110 void AliITSv11::Box(const char gnam[3],const TString &dis,
111                     Double_t dx,Double_t dy,Double_t dz,Int_t med){
112     // Interface to TMC->Gsvolu() for ITS bos geometries. Box with faces
113     // perpendicular to the axes. It has 3 paramters. See SetScale() for
114     // units. Default units are geant 3 [cm].
115     // Inputs:
116     //    const char gnam[3]  3 character geant volume name. The letter "I"
117     //                        is appended to the front to indecate that this
118     //                        is an ITS volume.
119     //    TString &dis        String containging part discription.
120     //    Double_t dx         half-length of box in x-axis
121     //    Double_t dy         half-length of box in y-axis
122     //    Double_t dz         half-length of box in z-axis
123     //    Int_t    med        media index number.
124     // Output:
125     //    none.
126     // Return.
127     //    none.
128     char name[4];
129     Float_t param[3];
130
131     param[0] = fScale*dx;
132     param[1] = fScale*dy;
133     param[2] = fScale*dz;
134     name[0] = 'I';
135     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
136     gMC->Gsvolu(name,"BOX ",fidmed[med],param,3);
137 }
138 //______________________________________________________________________
139 void AliITSv11::Trapezoid1(const char gnam[3],const TString &dis,
140                            Double_t dxn,Double_t dxp,Double_t dy,Double_t dz,
141                            Int_t med){
142     // Interface to TMC->Gsvolu() for ITS TRD1 geometries. Trapezoid with the 
143     // x dimension varing along z. It has 4 parameters. See SetScale() for
144     // units. Default units are geant 3 [cm].
145     // Inputs:
146     //    const char gnam[3]  3 character geant volume name. The letter "I"
147     //                        is appended to the front to indecate that this
148     //                        is an ITS volume.
149     //    TString &dis        String containging part discription.
150     //    Double_t dxn        half-length along x at the z surface positioned 
151     //                        at -DZ
152     //    Double_t dxp        half-length along x at the z surface positioned 
153     //                        at +DZ
154     //    Double_t dy         half-length along the y-axis
155     //    Double_t dz         half-length along the z-axis
156     //    Int_t    med        media index number.
157     // Output:
158     //    none.
159     // Return.
160     //    none.
161     char name[4];
162     Float_t param[4];
163
164     param[0] = fScale*dxn;
165     param[1] = fScale*dxp;
166     param[2] = fScale*dy;
167     param[3] = fScale*dz;
168     name[0] = 'I';
169     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
170     gMC->Gsvolu(name,"TRD1",fidmed[med],param,4);
171 }
172 //______________________________________________________________________
173 void AliITSv11::Trapezoid2(const char gnam[3],const TString &dis,Double_t dxn,
174                            Double_t dxp,Double_t dyn,Double_t dyp,Double_t dz,
175                            Int_t med){
176     // Interface to TMC->Gsvolu() for ITS TRD2 geometries. Trapezoid with the 
177     // x and y dimension varing along z. It has 5 parameters. See SetScale() 
178     // for units. Default units are geant 3 [cm].
179     // Inputs:
180     //    const char gnam[3]  3 character geant volume name. The letter "I"
181     //                        is appended to the front to indecate that this
182     //                        is an ITS volume.
183     //    TString &dis        String containging part discription.
184     //    Double_t dxn        half-length along x at the z surface positioned 
185     //                        at -DZ
186     //    Double_t dxp        half-length along x at the z surface positioned 
187     //                        at +DZ
188     //    Double_t dyn        half-length along x at the z surface positioned 
189     //                        at -DZ
190     //    Double_t dyp        half-length along x at the z surface positioned 
191     //                        at +DZ
192     //    Double_t dz         half-length along the z-axis
193     //    Int_t    med        media index number.
194     // Output:
195     //    none.
196     // Return.
197     //    none.
198     char name[4];
199     Float_t param[5];
200
201     param[0] = fScale*dxn;
202     param[1] = fScale*dxp;
203     param[2] = fScale*dyn;
204     param[3] = fScale*dyp;
205     param[4] = fScale*dz;
206     name[0] = 'I';
207     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
208     gMC->Gsvolu(name,"TRD2",fidmed[med],param,5);
209 }
210 //______________________________________________________________________
211 void AliITSv11::Trapezoid(const char gnam[3],const TString &dis,Double_t dz,
212                           Double_t thet,Double_t phi,Double_t h1,Double_t bl1,
213                           Double_t tl1,Double_t alp1,Double_t h2,Double_t bl2,
214                           Double_t tl2,Double_t alp2,Int_t med){
215     // Interface to TMC->Gsvolu() for ITS TRAP geometries. General Trapezoid, 
216     // The faces perpendicular to z are trapezia and their centers are not 
217     // necessarily on a line parallel to the z axis. This shape has 11 
218     // parameters, but only cosidering that the faces should be planar, only 9 
219     // are really independent. A check is performed on the user parameters and 
220     // a message is printed in case of non-planar faces. Ignoring this warning 
221     // may cause unpredictable effects at tracking time. See SetScale() 
222     // for units. Default units are geant 3 [cm].
223     // Inputs:
224     //    const char gnam[3]  3 character geant volume name. The letter "I"
225     //                        is appended to the front to indecate that this
226     //                        is an ITS volume.
227     //    TString &dis        String containging part discription.
228     //    Double_t dz         Half-length along the z-asix
229     //    Double_t thet       Polar angle of the line joing the center of the 
230     //                        face at -dz to the center of the one at dz 
231     //                        [degree].
232     //    Double_t phi        aximuthal angle of the line joing the center of 
233     //                        the face at -dz to the center of the one at +dz 
234     //                        [degree].
235     //    Double_t h1         half-length along y of the face at -dz.
236     //    Double_t bl1        half-length along x of the side at -h1 in y of 
237     //                        the face at -dz in z.
238     //    Double_t tl1        half-length along x of teh side at +h1 in y of 
239     //                        the face at -dz in z.
240     //    Double_t alp1       angle with respect to the y axis from the center 
241     //                        of the side at -h1 in y to the cetner of the 
242     //                        side at +h1 in y of the face at -dz in z 
243     //                        [degree].
244     //    Double_t h2         half-length along y of the face at +dz
245     //    Double_t bl2        half-length along x of the side at -h2 in y of
246     //                        the face at +dz in z.
247     //    Double_t tl2        half-length along x of the side at _h2 in y of 
248     //                        the face at +dz in z.
249     //    Double_t alp2       angle with respect to the y axis from the center 
250     //                        of the side at -h2 in y to the center of the 
251     //                        side at +h2 in y of the face at +dz in z 
252     //                        [degree].
253     //    Int_t    med        media index number.
254     // Output:
255     //    none.
256     // Return.
257     //    none.
258     char name[4];
259     Float_t param[11];
260
261     param[0] = fScale*dz;
262     param[1] = thet;
263     param[2] = phi;
264     param[3] = fScale*h1;
265     param[4] = fScale*bl1;
266     param[5] = fScale*tl1;
267     param[6] = alp1;
268     param[7] = fScale*h2;
269     param[8] = fScale*bl2;
270     param[9] = fScale*tl2;
271     param[10] = alp2;
272     name[0] = 'I';
273     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
274     gMC->Gsvolu(name,"TRAP",fidmed[med],param,11);
275 }
276 //______________________________________________________________________
277 void AliITSv11::Tube(const char gnam[3],const TString &dis,Double_t rmin,
278                      Double_t rmax,Double_t dz,Int_t med){
279     // Interface to TMC->Gsvolu() for ITS TUBE geometries. Simple Tube. It has
280     // 3 parameters. See SetScale() 
281     // for units. Default units are geant 3 [cm].
282     // Inputs:
283     //    const char gnam[3]  3 character geant volume name. The letter "I"
284     //                        is appended to the front to indecate that this
285     //                        is an ITS volume.
286     //    TString &dis        String containging part discription.
287     //    Double_t rmin       Inside Radius.
288     //    Double_t rmax       Outside Radius.
289     //    Double_t dz         half-length along the z-axis
290     //    Int_t    med        media index number.
291     // Output:
292     //    none.
293     // Return.
294     //    none.
295     char name[4];
296     Float_t param[3];
297
298     param[0] = fScale*rmin;
299     param[1] = fScale*rmax;
300     param[2] = fScale*dz;
301     name[0] = 'I';
302     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
303     gMC->Gsvolu(name,"TUBE",fidmed[med],param,3);
304 }
305 //______________________________________________________________________
306 void AliITSv11::TubeSegment(const char gnam[3],const TString &dis,
307                             Double_t rmin,Double_t rmax,Double_t dz,
308                             Double_t phi1,Double_t phi2,Int_t med){
309     // Interface to TMC->Gsvolu() for ITS TUBE geometries. Phi segment of a 
310     // tube. It has 5  parameters. Phi1 should be smaller than phi2. If this is
311     // not the case, the system adds 360 degrees to phi2. See SetScale() 
312     // for units. Default units are geant 3 [cm].
313     // Inputs:
314     //    const char gnam[3]  3 character geant volume name. The letter "I"
315     //                        is appended to the front to indecate that this
316     //                        is an ITS volume.
317     //    TString &dis        String containging part discription.
318     //    Double_t rmin       Inside Radius.
319     //    Double_t rmax       Outside Radius.
320     //    Double_t dz         half-length along the z-axis
321     //    Double_t phi1       Starting angle of the segment [degree].
322     //    Double_t phi2       Ending angle of the segment [degree].
323     //    Int_t    med        media index number.
324     // Output:
325     //    none.
326     // Return.
327     //    none.
328     char name[4];
329     Float_t param[5];
330
331     param[0] = fScale*rmin;
332     param[1] = fScale*rmax;
333     param[2] = fScale*dz;
334     param[3] = phi1;
335     param[4] = phi2;
336     name[0] = 'I';
337     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
338     gMC->Gsvolu(name,"TUBS",fidmed[med],param,5);
339 }
340 //______________________________________________________________________
341 void AliITSv11::Cone(const char gnam[3],const TString &dis,Double_t dz,
342                      Double_t rmin1,Double_t rmax1,Double_t rmin2,
343                      Double_t rmax2,Int_t med){
344     // Interface to TMC->Gsvolu() for ITS Cone geometries. Conical tube. It 
345     // has 5 parameters. See SetScale() 
346     // for units. Default units are geant 3 [cm].
347     // Inputs:
348     //    const char gnam[3]  3 character geant volume name. The letter "I"
349     //                        is appended to the front to indecate that this
350     //                        is an ITS volume.
351     //    TString &dis        String containging part discription.
352     //    Double_t dz         half-length along the z-axis
353     //    Double_t rmin1      Inside Radius at -dz.
354     //    Double_t rmax1      Outside Radius at -dz.
355     //    Double_t rmin2      inside radius at +dz.
356     //    Double_t rmax2      outside radius at +dz.
357     //    Int_t    med        media index number.
358     // Output:
359     //    none.
360     // Return.
361     //    none.
362     char name[4];
363     Float_t param[5];
364
365     param[0] = fScale*dz;
366     param[1] = fScale*rmin1;
367     param[2] = fScale*rmax1;
368     param[3] = fScale*rmin2;
369     param[4] = fScale*rmax2;
370     name[0] = 'I';
371     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
372     gMC->Gsvolu(name,"CONS",fidmed[med],param,5);
373 }
374 //______________________________________________________________________
375 void AliITSv11::ConeSegment(const char gnam[3],const TString &dis,Double_t dz,
376                             Double_t rmin1,Double_t rmax1,Double_t rmin2,
377                             Double_t rmax2,Double_t phi1,Double_t phi2,
378                             Int_t med){
379     // Interface to TMC->Gsvolu() for ITS ConS geometries. One segment of a 
380     // conical tube. It has 7 parameters. Phi1 should be smaller than phi2. If 
381     // this is not the case, the system adds 360 degrees to phi2. See 
382     // SetScale() for units. Default units are geant 3 [cm].
383     // Inputs:
384     //    const char gnam[3]  3 character geant volume name. The letter "I"
385     //                        is appended to the front to indecate that this
386     //                        is an ITS volume.
387     //    TString &dis        String containging part discription.
388     //    Double_t dz         half-length along the z-axis
389     //    Double_t rmin1      Inside Radius at -dz.
390     //    Double_t rmax1      Outside Radius at -dz.
391     //    Double_t rmin2      inside radius at +dz.
392     //    Double_t rmax2      outside radius at +dz.
393     //    Double_t phi1       Starting angle of the segment [degree].
394     //    Double_t phi2       Ending angle of the segment [degree].
395     //    Int_t    med        media index number.
396     // Output:
397     //    none.
398     // Return.
399     //    none.
400     char name[4];
401     Float_t param[7];
402
403     param[0] = fScale*dz;
404     param[1] = fScale*rmin1;
405     param[2] = fScale*rmax1;
406     param[3] = fScale*rmin2;
407     param[4] = fScale*rmax2;
408     param[5] = phi1;
409     param[6] = phi2;
410     name[0] = 'I';
411     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
412     gMC->Gsvolu(name,"CONS",fidmed[med],param,7);
413 }
414 //______________________________________________________________________
415 void AliITSv11::Sphere(const char gnam[3],const TString &dis,Double_t rmin,
416                        Double_t rmax,Double_t the1,Double_t the2,Double_t phi1,
417                        Double_t phi2,Int_t med){
418     // Interface to TMC->Gsvolu() for ITS SPHE geometries. Segment of a 
419     // sphereical shell. It has 6 parameters. See SetScale() 
420     // for units. Default units are geant 3 [cm].
421     // Inputs:
422     //    const char gnam[3]  3 character geant volume name. The letter "I"
423     //                        is appended to the front to indecate that this
424     //                        is an ITS volume.
425     //    TString &dis        String containging part discription.
426     //    Double_t rmin       Inside Radius.
427     //    Double_t rmax       Outside Radius.
428     //    Double_t the1       staring polar angle of the shell [degree].
429     //    Double_t the2       ending polar angle of the shell [degree].
430     //    Double_t phui       staring asimuthal angle of the shell [degree].
431     //    Double_t phi2       ending asimuthal angle of the shell [degree].
432     //    Int_t    med        media index number.
433     // Output:
434     //    none.
435     // Return.
436     //    none.
437     char name[4];
438     Float_t param[6];
439
440     param[0] = fScale*rmin;
441     param[1] = fScale*rmax;
442     param[2] = the1;
443     param[3] = the2;
444     param[4] = phi1;
445     param[5] = phi2;
446     name[0] = 'I';
447     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
448     gMC->Gsvolu(name,"SPHE",fidmed[med],param,6);
449 }
450 //______________________________________________________________________
451 void AliITSv11::Parallelepiped(const char gnam[3],const TString &dis,
452                                Double_t dx,Double_t dy,Double_t dz,
453                                Double_t alph,Double_t thet,Double_t phi,
454                                Int_t med){
455     // Interface to TMC->Gsvolu() for ITS PARA geometries. Parallelepiped. It 
456     // has 6 parameters. See SetScale() for units. Default units are geant 3 
457     // [cm].
458     // Inputs:
459     //    const char gnam[3]  3 character geant volume name. The letter "I"
460     //                        is appended to the front to indecate that this
461     //                        is an ITS volume.
462     //    TString &dis        String containging part discription.
463     //    Double_t dx         half-length allong x-axis
464     //    Double_t dy         half-length allong y-axis
465     //    Double_t dz         half-length allong z-axis
466     //    Double_t alpha      angle formed by the y axis and by the plane 
467     //                        joining the center of teh faces parallel to the 
468     //                        z-x plane at -dY and +dy [degree].
469     //    Double_t thet       polar angle of the line joining the centers of 
470     //                        the faces at -dz and +dz in z [degree].
471     //    Double_t phi        azimuthal angle of teh line joing the centers of 
472     //                        the faaces at -dz and +dz in z [degree].
473     //    Int_t    med        media index number.
474     // Output:
475     //    none.
476     // Return.
477     //    none.
478     char name[4];
479     Float_t param[6];
480
481     param[0] = fScale*dx;
482     param[1] = fScale*dy;
483     param[2] = fScale*dz;
484     param[3] = alpha;
485     param[4] = thet;
486     param[5] = phi;
487     name[0] = 'I';
488     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
489     gMC->Gsvolu(name,"PARA",fidmed[med],param,6);
490 }
491 //______________________________________________________________________
492 void AliITSv11::Polygon(const char gnam[3],const TString &dis,Double_t phi1,
493                         Double_t dphi,Int_t npdv,Int_t nz,Double_t *z,
494                         Double_t *rmin,Double_t *rmax,Double_t ,Int_t med){
495     // Interface to TMC->Gsvolu() for ITS PGON geometry. Polygon It has 10 
496     // parameters or more. See SetScale() for units. Default units are geant 3 
497     // [cm].
498     // Inputs:
499     //    const char gnam[3]  3 character geant volume name. The letter "I"
500     //                        is appended to the front to indecate that this
501     //                        is an ITS volume.
502     //    TString &dis        String containging part discription.
503     //    Double_t phi1       the azimuthal angle at which the volume begins 
504     //                        (angles are counted clouterclockwise) [degrees].
505     //    Double_t dphi       opening angle of the volume, which extends from 
506     //                        phi1 to phi1+dphi [degree].
507     //    Int_t npdv          the number of sides of teh cross section between 
508     //                        the given phi limits.
509     //    Int_t nz            number of planes perpendicular to the z axis 
510     //                        where the dimension of the section is given - 
511     //                        this number should be at least 2 and NP triples 
512     //                        of number must follow.
513     //    Double_t *z         array [nz] of z coordiates of the sections..
514     //    Double_t *rmin      array [nz] of radius of teh circle tangent to 
515     //                        the sides of the inner polygon in teh 
516     //                        cross-section.
517     //    Double_t *rmax      array [nz] of radius of the circle tangent to 
518     //                        the sides of the outer polygon in the 
519     //                       cross-section.
520     //    Int_t    med        media index number.
521     // Output:
522     //    none.
523     // Return.
524     //    none.
525     char name[4];
526     Float_t *param;
527     Int_t n,i;
528
529     n = 4+3*nz;
530     param = new Float_t[n]
531     param[0] = phi1;
532     param[1] = dphi;
533     param[2] = (Float_t)npdv;
534     param[3] = (Float_t)nz;
535     for(i=0;i<nz;i++){
536         param[4+3*i] = z[i];
537         param[5+3*i] = rmin[i];
538         param[6+3*i] = rmax[i];
539     } // end for i
540     name[0] = 'I';
541     for(i=0;i<3;i++) name[i+1] = gnam[i];
542     gMC->Gsvolu(name,"PGON",fidmed[med],param,n);
543
544     delete[] param;
545 }
546 //______________________________________________________________________
547 void AliITSv11::PolyCone(const char gnam[3],const TString &dis,Double_t phi1,
548                          Double_t dphi,Int_t nz,Double_t *z,Double_t *rmin,
549                          Double_t *rmax,Int_t med){
550     // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9 
551     // parameters or more. See SetScale() for units. Default units are geant 3 
552     // [cm].
553     // Inputs:
554     //    const char gnam[3]  3 character geant volume name. The letter "I"
555     //                        is appended to the front to indecate that this
556     //                        is an ITS volume.
557     //    TString &dis        String containging part discription.
558     //    Double_t phi1       the azimuthal angle at which the volume begins 
559     //                        (angles are counted clouterclockwise) [degrees].
560     //    Double_t dphi       opening angle of the volume, which extends from 
561     //                        phi1 to phi1+dphi [degree].
562     //    Int_t nz            number of planes perpendicular to the z axis 
563     //                        where the dimension of the section is given - 
564     //                        this number should be at least 2 and NP triples 
565     //                        of number must follow.
566     //    Double_t *z         Array [nz] of z coordinate of the section.
567     //    Double_t *rmin      Array [nz] of radius of teh inner circle in the 
568     //                        cross-section.
569     //    Double_t *rmax      Array [nz] of radius of the outer circle in the 
570     //                        cross-section.
571     //    Int_t    med        media index number.
572     // Output:
573     //    none.
574     // Return.
575     //    none.
576     char name[4];
577     Float_t *param;
578     Int_t n,i;
579
580     n = 3+3*nz;
581     param = new Float_t[n];
582     param[0] = phi1;
583     param[1] = dphi;
584     param[2] = (Float_t) nz;
585     for(i=0;i<nz;i++){
586         param[3+3*i] = z[i];
587         param[4+3*i] = rmin[i];
588         param[5+3*i] = rmax[i];
589     } // end for i
590     name[0] = 'I';
591     for(i=0;i<3;i++) name[i+1] = gnam[i];
592     gMC->Gsvolu(name,"PCON",fidmed[med],param,n);
593
594     delete[] param;
595 }
596 //______________________________________________________________________
597 void AliITSv11::TubeElliptical(const char gnam[3],const TString &dis,
598                                Double_t p1,Double_t p2,Double_t dz,Int_t med){
599     // Interface to TMC->Gsvolu() for ITS ELTU geometries. Elliptical 
600     // cross-section Tube. It has 3 parameters. See SetScale() 
601     // for units. Default units are geant 3 [cm]. The equation of the surface 
602     // is x^2 * p1^-2 + y^2 * p2^-2 = 1.
603     // Inputs:
604     //    const char gnam[3]  3 character geant volume name. The letter "I"
605     //                        is appended to the front to indecate that this
606     //                        is an ITS volume.
607     //    TString &dis        String containging part discription.
608     //    Double_t p1         semi-axis of the elipse along x.
609     //    Double_t p2         semi-axis of the elipse along y.
610     //    Double_t dz         half-length along the z-axis
611     //    Int_t    med        media index number.
612     // Output:
613     //    none.
614     // Return.
615     //    none.
616     char name[4];
617     Float_t param[3];
618
619     param[0] = fScale*p1;
620     param[1] = fScale*p2;
621     param[2] = fScale*dz;
622     name[0] = 'I';
623     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
624     gMC->Gsvolu(name,"ELTU",fidmed[med],param,3);
625 }
626 //______________________________________________________________________
627 void AliITSv11::HyperbolicTube(const char gnam[3],const TString &dis,
628                                Double_t rmin,Double_t rmax,Double_t dz,
629                                Double_t thet,Int_t med){
630     // Interface to TMC->Gsvolu() for ITS HYPE geometries. Hyperbolic tube. 
631     // Fore example the inner and outer surfaces are hyperboloids, as would be 
632     // foumed by a system of cylinderical wires which were then rotated 
633     // tangentially about their centers. It has 4 parameters. See SetScale() 
634     // for units. Default units are geant 3 [cm]. The hyperbolic surfaces are 
635     // given by r^2 = (ztan(thet)^2 + r(z=0)^2.
636     // Inputs:
637     //    const char gnam[3]  3 character geant volume name. The letter "I"
638     //                        is appended to the front to indecate that this
639     //                        is an ITS volume.
640     //    TString &dis        String containging part discription.
641     //    Double_t rmin       Inner radius at z=0 where tube is narrowest.
642     //    Double_t rmax       Outer radius at z=0 where tube is narrowest.
643     //    Double_t dz         half-length along the z-axis
644     //    Double_t thet       stero angel of rotation of the two faces 
645     //                       [degrees].
646     //    Int_t    med        media index number.
647     // Output:
648     //    none.
649     // Return.
650     //    none.
651     char name[4];
652     Float_t param[4];
653
654     param[0] = fScale*rmin;
655     param[1] = fScale*rmax;
656     param[2] = fScale*dz;
657     param[3] = thet;
658     name[0] = 'I';
659     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
660     gMC->Gsvolu(name,"HYPE",fidmed[med],param,4);
661 }
662 //______________________________________________________________________
663 void AliITSv11::TwistedTrapezoid(const char gnam[3],const TString &dis,
664                                  Double_t dz,Double_t thet,Double_t phi,
665                                  Double_t twist,Double_t h1,Double_t bl1,
666                                  Double_t tl1,Double_t apl1,Double_t h2,
667                                  Double_t bl2,Double_t tl2,Double_t apl2,
668                                  Int_t med){
669     // Interface to TMC->Gsvolu() for ITS GTRA geometries. General twisted 
670     // trapazoid. The faces perpendicular to z are trapazia and their centers 
671     // are not necessarily on a line parallel to the z axis as the TRAP. 
672     // Additionally, the faces may be twisted so that none of their edges are 
673     // parallel. It is a TRAP shape, exept that it is twisted in the x-y plane 
674     // as a function of z. The parallel sides perpendicular to the x axis are 
675     // rotated with respect to the x axis by an angle TWIST, which is one of 
676     // the parameters. The shape is defined by the eight corners and is assumed
677     // to be constructed of straight lines joingin points on the boundry of the
678     // trapezoidal face at Z=-dz to the coresponding points on the face at 
679     // z=+dz. Divisions are not allowed. It has 12 parameters. See SetScale() 
680     // for units. Default units are geant 3 [cm]. Note: This shape suffers from
681     // the same limitations than the TRAP. The tracking routines assume that 
682     // the faces are planar, but htis constraint is not easily expressed in 
683     // terms of the 12 parameters. Additionally, no check on th efaces is 
684     // performed in this case. Users should avoid to use this shape as much as 
685     // possible, and if they have to do so, they should make sure that the 
686     // faces are really planes. If this is not the case, the result of the 
687     // trasport is unpredictable. To accelerat ethe computations necessary for 
688     // trasport, 18 additioanl parameters are calculated for this shape are
689     // 1 DXODZ dx/dz of the line joing the centers of the faces at z=+_dz.
690     // 2 DYODZ dy/dz of the line joing the centers of the faces at z=+_dz.
691     // 3 XO1    x at z=0 for line joing the + on parallel side, perpendicular 
692     //          corners at z=+_dz.
693     // 4 YO1    y at z=0 for line joing the + on parallel side, + on 
694     //          perpendicular corners at z=+-dz.
695     // 5 DXDZ1  dx/dz for line joing the + on parallel side, + on 
696     //          perpendicular corners at z=+-dz.
697     // 6 DYDZ1  dy/dz for line joing the + on parallel side, + on 
698     //          perpendicular corners at z=+-dz.
699     // 7 X02    x at z=0 for line joing the - on parallel side, + on 
700     //          perpendicular corners at z=+-dz.
701     // 8 YO2    y at z=0 for line joing the - on parallel side, + on 
702     //          perpendicular corners at z=+-dz.
703     // 9 DXDZ2  dx/dz for line joing the - on parallel side, + on 
704     //          perpendicular corners at z=+-dz.
705     // 10 DYDZ2dy/dz for line joing the - on parallel side, + on 
706     //          perpendicular corners at z=+-dz.
707     // 11 XO3   x at z=0 for line joing the - on parallel side, - on 
708     //          perpendicular corners at z=+-dz.
709     // 12 YO3   y at z=0 for line joing the - on parallel side, - on 
710     //          perpendicular corners at z=+-dz.
711     // 13 DXDZ3 dx/dzfor line joing the - on parallel side, - on 
712     //          perpendicular corners at z=+-dz.
713     // 14 DYDZ3 dydz for line joing the - on parallel side, - on 
714     //          perpendicular corners at z=+-dz.
715     // 15 XO4   x at z=0 for line joing the + on parallel side, - on 
716     //          perpendicular corners at z=+-dz.
717     // 16 YO4   y at z=0 for line joing the + on parallel side, - on 
718     //          perpendicular corners at z=+-dz.
719     // 17 DXDZ4 dx/dz for line joing the + on parallel side, - on 
720     //          perpendicular corners at z=+-dz.
721     // 18 DYDZ4 dydz for line joing the + on parallel side, - on 
722     //          perpendicular corners at z=+-dz.
723     // Inputs:
724     //    const char gnam[3]  3 character geant volume name. The letter "I"
725     //                        is appended to the front to indecate that this
726     //                        is an ITS volume.
727     //    TString &dis        String containging part discription.
728     //    Double_t dz         half-length along the z axis.
729     //    Double_t thet       polar angle of the line joing the center of the 
730     //                        face at -dz to the center of the one at +dz 
731     //                        [degrees].
732     //    Double_t phi        Azymuthal angle of teh line joing the centre of 
733     //                        the face at -dz to the center of the one at +dz 
734     //                        [degrees].
735     //    Double_t twist      Twist angle of the faces parallel to the x-y 
736     //                        plane at z=+-dz around an axis parallel to z 
737     //                        passing through their centre [degrees].
738     //    Double_t h1         Half-length along y of the face at -dz.
739     //    Double_t bl1        half-length along x of the side -h1 in y of the 
740     //                        face at -dz in z.
741     //    Double_t tl1        half-length along x of the side at +h1 in y of 
742     //                        the face at -dz in z.
743     //    Double_t apl1       Angle with respect to the y ais from the center 
744     //                        of the side at -h1 in y to the centere of the 
745     //                        side at +h1 in y of the face at -dz in z 
746     //                        [degrees].
747     //    Double_t h2         half-length along the face at +dz.
748     //    Double_t bl2        half-length along x of the side at -h2 in y of 
749     //                        the face at -dz in z.
750     //    Double_t tl2        half-length along x of the side at +h2 in y of 
751     //                        the face at +dz in z.
752     //    Double_t apl2       angle with respect to the y axis from the center 
753     //                        of the side at -h2 in y to the center of the side
754     //                        at +h2 in y of the face at +dz in z [degrees].
755     //    Int_t    med        media index number.
756     // Output:
757     //    none.
758     // Return.
759     //    none.
760     char name[4];
761     Float_t param[12];
762
763     param[0] = fScale*dz;
764     param[1] = thet;
765     param[2] = phi;
766     param[3] = twist;
767     param[4] = fScale*h1;
768     param[5] = fScale*bl1;
769     param[6] = fScale*tl1;
770     param[7] = alp1;
771     param[8] = fScale*h2;
772     param[9] = fScale*bl2;
773     param[10] = fScale*tl2;
774     param[11] = alp2;
775     name[0] = 'I';
776     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
777     gMC->Gsvolu(name,"GTRA",fidmed[med],param,12);
778 }
779 //______________________________________________________________________
780 void AliITSv11::CutTube(const char gnam[3],const TString &dis,Double_t rmin,
781                         Double_t rmax,Double_t dz,Double_t phi1,Double_t phi2,
782                         Double_t lx,Double_t ly,Double_t lz,Double_t hx,
783                         Double_t hy,Double_t hz,Int_t med){
784     // Interface to TMC->Gsvolu() for ITS CTUB geometries. Cut tube. A tube cut
785     // at the extremities with planes not necessarily perpendicular tot he z 
786     // axis. It has 11 parameters. See SetScale() for units. Default units are 
787     // geant 3 [cm]. phi1 should be smaller than phi2. If this is not the case,
788     // the system adds 360 degrees to phi2.
789     // Inputs:
790     //    const char gnam[3]  3 character geant volume name. The letter "I"
791     //                        is appended to the front to indecate that this
792     //                        is an ITS volume.
793     //    TString &dis        String containging part discription.
794     //    Double_t rmin       Inner radius at z=0 where tube is narrowest.
795     //    Double_t rmax       Outer radius at z=0 where tube is narrowest.
796     //    Double_t dz         half-length along the z-axis
797     //    Double_t dz         half-length along the z-axis
798     //    Double_t phi1       Starting angle of the segment [degree].
799     //    Double_t phi2       Ending angle of the segment [degree].
800     //    Double_t lx         x component of a unit vector perpendicular to 
801     //                        the face at -dz.
802     //    Double_t ly         y component of a unit vector perpendicular to 
803     //                        the face at -dz.
804     //    Double_t lz         z component of a unit vector perpendicular to 
805     //                        the face at -dz.
806     //    Double_t hx         x component of a unit vector perpendicular to 
807     //                        the face at +dz.
808     //    Double_t hy         y component of a unit vector perpendicular to 
809     //                        the face at +dz.
810     //    Double_t hz         z component of a unit vector perpendicular to 
811     //                        the face at +dz.
812     //    Int_t    med        media index number.
813     // Output:
814     //    none.
815     // Return.
816     //    none.
817     char name[4];
818     Float_t param[11];
819
820     param[0] = fScale*rmin;
821     param[1] = fScale*rmax;
822     param[2] = fScale*dz;
823     param[3] = phi1;
824     param[4] = phi2;
825     param[5] = lx;
826     param[6] = ly;
827     param[7] = lz;
828     param[8] = hx;
829     param[9] = hy;
830     param[10] = hz;
831     name[0] = 'I';
832     for(Int_t i=0;i<3;i++) name[i+1] = gnam[i];
833     gMC->Gsvolu(name,"CTUB",fidmed[med],param,11);
834 }
835 //______________________________________________________________________
836 void AliITSv11::Pos(const char vol[3],Int_t cn,const char moth[3],Double_t x,
837                     Double_t y,Double_t z,Int_t irot){
838     // Place a copy of a volume previously defined by a call to GSVOLU inside 
839     // its mother volulme moth.
840     // Inputs:
841     //   const char vol[3]  3 character geant volume name. The letter "I"
842     //                      is appended to the front to indecate that this
843     //                      is an ITS volume.
844     //   const char moth[3] 3 character geant volume name of the mother volume 
845     //                      in which vol will be placed. The letter "I" is 
846     //                      appended to the front to indecate that this is an 
847     //                      ITS volume.
848     //   Double_t x         The x positon of the volume in the mother's 
849     //                      reference system
850     //   Double_t y         The y positon of the volume in the mother's 
851     //                      reference system
852     //   Double_t z         The z positon of the volume in the mother's 
853     //                      reference system
854     //   Int_t irot         the index for the rotation matrix to be used.
855     //                      irot=-1 => unit rotation.
856     // Outputs:
857     //    none.
858     // Return:
859     //    none.
860     char name[4],mother[4];
861     Float_t param[3];
862     Int_t r=0,i;
863
864     param[0] = x;
865     param[1] = y;
866     param[2] = z;
867     name[0] = 'I';
868     for(i=0;i<3;i++) name[i+1] = vol[i];
869     mother[0] = 'I';
870     for(i=0;i<3;i++) mother[i+1] = moth[i];
871     if(irot>=0) r=fidrot[irot];
872     fMC->Gspos(name,mother,param[0],param[1],param[2],r,"ONLY");
873 }
874 //______________________________________________________________________
875 void AliITSv11::Matrix(Int_t irot,Double_t thet1,Double_t phi1,
876                        Double_t thet2,Double_t phi2,
877                        Double_t thet3,Double_t phi3){
878     // Defines a Geant rotation matrix. checks to see if it is the unit
879     // matrix. If so, then no additonal matrix is defined. Stores rotation 
880     // matrix irot in the data structure JROTM. If the matrix is not 
881     // orthonormal, it will be corrected by setting y' perpendicular to x' 
882     // and z' = x' X y'. A warning message is printed in this case.
883     // Inputs:
884     //   Int_t irot     Intex specifing which rotation matrix.
885     //   Double_t thet1 Polar angle for axisw x [degrees].
886     //   Double_t phi1  azimuthal angle for axis x [degrees].
887     //   Double_t thet12Polar angle for axisw y [degrees].
888     //   Double_t phi2  azimuthal angle for axis y [degrees].
889     //   Double_t thet3 Polar angle for axisw z [degrees].
890     //   Double_t phi3  azimuthal angle for axis z [degrees].
891     // Outputs:
892     //    none.
893     // Return:
894     //    none.
895     Float_t t1,p1,t2,p2,t3,p3;
896
897     if(thet1==90.0&&phi1==0.0&&thet2==90.0&&phi2==90.0&&thet3==0.0&&phi3==0.0){
898         fidrot[irot] = 0; // Unit matrix
899     }else{
900         t1 = thet1;
901         p1 = phi1;
902         t2 = thet2;
903         p2 = phi2;
904         t3 = thet3;
905         p3 = phi3
906         AliMatrix(fidrot[irot],t1,p1,t2,p2,t3,p3);
907     } // end if
908 }
909 //______________________________________________________________________
910 void AliITSv11::Matrix(Int_t irot,Int_t axis,Double_t thet){
911     // Defines a Geant rotation matrix. checks to see if it is the unit
912     // matrix. If so, then no additonal matrix is defined. Stores rotation 
913     // matrix irot in the data structure JROTM. If the matrix is not 
914     // orthonormal, it will be corrected by setting y' perpendicular to x' 
915     // and z' = x' X y'. A warning message is printed in this case.
916     // Inputs:
917     //   Int_t irot         Intex specifing which rotation matrix.
918     //   Int_t axis         Axis about which rotation is to be done.
919     //   Double_t thet      Angle to rotate by [degrees].
920     // Outputs:
921     //    none.
922     // Return:
923     //    none.
924
925     if(thet==0.0){
926         fidrot[irot] = 0; // Unit matrix
927     }else{
928         switch (irot) {
929         case 0: //Rotate about x-axis, x-axis does not change.
930             AliMatrix(fidrot[irot],90.0,0.0,90.0+thet,90.0,thet,90.0);
931             break;
932         case 1: //Rotate about y-axis, y-axis does not change.
933             AliMatrix(fidrot[irot],-90.0-thet,0.0,90.0,90.0,thet,90.0);
934             break;
935         case 2: //Rotate about z-axis, z-axis does not change.
936             AliMatrix(fidrot[irot],90.0,thet,90.0,-thet-90.0,0.0,0.0);
937             break;
938         default:
939             Error("Matrix","axis must be either 0, 1, or 2. for matrix=%d",
940                   irot);
941             break;
942         } // end switch
943     } // end if
944 }
945 //______________________________________________________________________
946 void AliITSv11::Matrix(Int_t irot,Double_t rot[3][3]){
947     // Defines a Geant rotation matrix. checks to see if it is the unit
948     // matrix. If so, then no additonal matrix is defined. Stores rotation 
949     // matrix irot in the data structure JROTM. If the matrix is not 
950     // orthonormal, it will be corrected by setting y' perpendicular to x' 
951     // and z' = x' X y'. A warning message is printed in this case.
952     // Inputs:
953     //   Int_t irot         Intex specifing which rotation matrix.
954     //   Double_t rot[3][3] The 3 by 3 rotation matrix.
955     // Outputs:
956     //    none.
957     // Return:
958     //    none.
959
960     if(rot[0][0]==1.0&&rot[1][1]==1.0&&rot[2][2]==1.0&&
961        rot[0][1]==0.0&&rot[0][2]==0.0&&rot[1][0]==0.0&&
962        rot[1][2]==0.0&&rot[2][0]==0.0&&rot[2][1]==0.0){
963         fidrot[irot] = 0; // Unit matrix
964     }else{
965         Double_t si,c=180./TMath::Pi();
966         Double_t ang[6];
967
968         ang[1] = TMath::ATan2(rot[0][1],rot[0][0]);
969         if(TMath::Cos(ang[1])!=0.0) si = rot[0][0]/TMath::Cos(ang[1]);
970         else si = rot[0][1]/TMath::Sin(ang[1]);
971         ang[0] = TMath::ATan2(si,rot[0][2]);
972
973         ang[3] = TMath::ATan2(rot[1][1],rot[1][0]);
974         if(TMath::Cos(ang[3])!=0.0) si = rot[1][0]/TMath::Cos(ang[3]);
975         else si = rot[1][1]/TMath::Sin(ang[3]);
976         ang[2] = TMath::ATan2(si,rot[1][2]);
977
978         ang[5] = TMath::ATan2(rot[2][1],rot[2][0]);
979         if(TMath::Cos(ang[5])!=0.0) si = rot[2][0]/TMath::Cos(ang[5]);
980         else si = rot[2][1]/TMath::Sin(ang[5]);
981         ang[4] = TMath::ATan2(si,rot[2][2]);
982
983         for(Int_t i=0;i<6;i++) {ang[i] *= c; if(ang[i]<0.0) ang[i] += 360.;}
984         AliMatrix(fidrot[irot],ang[0],ang[1],ang[2],ang[3],ang[4],ang[5]);
985     } // end if
986 }
987 //______________________________________________________________________
988 Float_t AliITSv11::GetA(Int_t z){
989     // Returns the isotopicaly averaged atomic number.
990     // Inputs:
991     //    Int_t z  Elemental number
992     // Outputs:
993     //    none.
994     // Return:
995     //    The atomic mass number.
996     const Float_t A[]={ 1.00794 ,  4.0026902,  6.941   ,  9.012182 , 10.811   ,
997                        12.01007 , 14.00674  , 15.9994  , 18.9984032, 20.1797  ,
998                        22.98970 , 24.3050   , 26.981538, 28.0855   , 30.973761,
999                        32.066   , 35.4527   , 39.948   , 39.0983   , 40.078   ,
1000                        44.95591 , 47.867    , 50.9415  , 51.9961   , 54.938049,
1001                        55.845   , 58.933200 , 58.6934  , 63.546    , 65.39    ,
1002                        69.723   , 72.61     , 74.92160 , 78.96     , 79.904   ,
1003                        83.80    , 85.4678   , 87.62    , 88.9085   , 91.224   ,
1004                        92.90638 , 95.94     , 97.907215, 101.07    ,102.90550 ,
1005                       106.42    ,107.8682   ,112.411   ,114.818    ,118.710   ,
1006                       121.760   ,127.60     ,126.90447 ,131.29     ,132.90545 ,
1007                       137.327   ,138.9055   ,140.116   ,140.90765  ,144.24    ,
1008                       144.912746,150.36     ,151.964   ,157.25     ,158.92534 ,
1009                       162.50     ,164.93032 ,167.26    ,168.93421  ,173.04    ,
1010                       174.967    ,178.49    ,180.9479 ,183.84      ,186.207   ,
1011                       190.23     ,192.217   ,195.078  ,196.96655   ,200.59    ,
1012                       204.3833   ,207.2     ,208.98038,208.982415  ,209.987131,
1013                       222.017570 ,223.019731,226.025402,227.027747 ,232.0381  ,
1014                       231.03588  238.0289};
1015
1016     if(z<1||z>92){
1017         Error("GetA","z must be 0<z<93. z=%d",z);
1018         return 0.0;
1019     } // end if
1020     return A[z-1];
1021 }
1022 //______________________________________________________________________
1023 Float_t AliITSv11::GetStandardMaxStepSize(Int_t istd){
1024     // Returns one of a set of standard Maximum Step Size values.
1025     // Inputs:
1026     //   Int_t istd  Index to indecate which standard.
1027     // Outputs:
1028     //    none.
1029     // Return:
1030     //    The appropreate standard Maximum Step Size value [cm].
1031     Float_t t[]={1.0, // default
1032                  0.0075, // Silicon detectors...
1033                  1.0, // Air in central detectors region
1034                  1.0  // Material in non-centeral region
1035     };
1036     return t[istd];
1037 }
1038 //______________________________________________________________________
1039 Float_t AliITSv11::GetStandardThetaMax(Int_t istd){
1040     // Returns one of a set of standard Theata Max values.
1041     // Inputs:
1042     //   Int_t istd  Index to indecate which standard.
1043     // Outputs:
1044     //    none.
1045     // Return:
1046     //    The appropreate standard Theta max value [degrees].
1047     Float_t t[]={0.1, // default
1048                  0.1, // Silicon detectors...
1049                  0.1, // Air in central detectors region
1050                  1.0  // Material in non-centeral region
1051     };
1052     return t[istd];
1053 }
1054 //______________________________________________________________________
1055 Float_t AliITSv11::GetStandardEfraction(Int_t istd){
1056     // Returns one of a set of standard E fraction values.
1057     // Inputs:
1058     //   Int_t istd  Index to indecate which standard.
1059     // Outputs:
1060     //    none.
1061     // Return:
1062     //    The appropreate standard E fraction value [#].
1063     Float_t t[]={0.1, // default
1064                  0.1, // Silicon detectors...
1065                  0.1, // Air in central detectors region
1066                  1.0  // Material in non-centeral region
1067     };
1068     return t[istd];
1069 }
1070 //______________________________________________________________________
1071 void AliITSv11::Element(Int_t imat,const char* name,Int_t z,Double_t dens,
1072                         Int_t istd){
1073     // Defines a Geant single element material and sets its Geant medium
1074     // proporties. The average atomic A is assumed to be given by their
1075     // natural abundances. Things like the radiation length are calculated
1076     // for you.
1077     // Inputs:
1078     //    Int_t imat       Material number.
1079     //    const char* name Material name. No need to add a $ at the end.
1080     //    Int_t z          The elemental number.
1081     //    Double_t dens    The density of the material [g/cm^3].
1082     //    Int_t istd       Defines which standard set of transport parameters
1083     //                     which should be used.
1084     // Output:
1085     //     none.
1086     // Return:
1087     //     none.
1088     Float_t rad,Z,A=GetA(z),tmax,stemax,deemax,epsilon;
1089     char *name2;
1090     Int_t len;
1091
1092     len = strlng(name)+1;
1093     name2 = new char[len];
1094     strncpy(name2,name,len-1);
1095     name2[len-1] = '\0';
1096     name2[len-2] = '$';
1097     Z = (Float_t)z;
1098     rad = GetRadLength(z)/dens;
1099     AliMaterial(imat,name2,A,Z,dens,rad,0.0,0,0);
1100     tmax    = GetStandardTheataMax(istd);    // degree
1101     stemax  = GetStandardMaxStepSize(istd);  // cm
1102     deemax  = GetStandardEfraction(istd);     // #
1103     epsilon = GetStandardEpsilon(istd);
1104     AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1105               gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1106     delete[] name2;
1107 }
1108 //______________________________________________________________________
1109 void AliITSv11::MixtureByWeight(Int_t imat,const char* name,Int_t *z,
1110                                 Double_t *w,Double_t dens,Int_t n,Int_t istd){
1111     // Defines a Geant material by a set of elements and weights, and sets 
1112     // its Geant medium proporties. The average atomic A is assumed to be 
1113     // given by their natural abundances. Things like the radiation length 
1114     // are calculated for you.
1115     // Inputs:
1116     //    Int_t imat       Material number.
1117     //    const char* name Material name. No need to add a $ at the end.
1118     //    Int_t *z         Array of The elemental numbers.
1119     //    Double_t *w      Array of relative weights.
1120     //    Double_t dens    The density of the material [g/cm^3].
1121     //    Int_t n          the number of elements making up the mixture.
1122     //    Int_t istd       Defines which standard set of transport parameters
1123     //                     which should be used.   
1124     // Output:
1125     //     none.
1126     // Return:
1127     //     none.
1128     Float_t rad,*Z,*A,tmax,stemax,deemax,epsilon;
1129     char *name2;
1130     Int_t len,i;
1131     Z = new Float_t[n];
1132     A = new Float_t[n];
1133
1134     len = strlng(name)+1;
1135     name2 = new char[len];
1136     strncpy(name2,name,len-1);
1137     name2[len-1] = '\0';
1138     name2[len-2] = '$';
1139     for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
1140                      W[i] = (Float_t)w[i]}
1141     rad = GetRadLength(z)/dens;
1142     AliMixture(imat,name2,A,Z,dens,n,W);
1143     tmax    = GetStandardTheataMax(istd);    // degree
1144     stemax  = GetStandardMaxStepSize(istd);  // cm
1145     deemax  = GetStandardEfraction(istd);     // #
1146     epsilon = GetStandardEpsilon(istd);
1147     AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1148               gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1149     delete[] name2;
1150 }
1151 //______________________________________________________________________
1152 void AliITSv11::MixtureByNumber(Int_t imat,const char* name,Int_t *z,
1153                                 Int_t *w,Double_t dens,Int_t n,Int_t istd){
1154     // Defines a Geant material by a set of elements and number, and sets 
1155     // its Geant medium proporties. The average atomic A is assumed to be 
1156     // given by their natural abundances. Things like the radiation length 
1157     // are calculated for you.
1158     // Inputs:
1159     //    Int_t imat       Material number.
1160     //    const char* name Material name. No need to add a $ at the end.
1161     //    Int_t *z         Array of The elemental numbers.
1162     //    Int_t_t *w       Array of relative number.
1163     //    Double_t dens    The density of the material [g/cm^3].
1164     //    Int_t n          the number of elements making up the mixture.
1165     //    Int_t istd       Defines which standard set of transport parameters
1166     //                     which should be used.   
1167     // Output:
1168     //     none.
1169     // Return:
1170     //     none.
1171     Float_t rad,*Z,*A,tmax,stemax,deemax,epsilon;
1172     char *name2;
1173     Int_t len,i;
1174     Z = new Float_t[n];
1175     A = new Float_t[n];
1176
1177     len = strlng(name)+1;
1178     name2 = new char[len];
1179     strncpy(name2,name,len-1);
1180     name2[len-1] = '\0';
1181     name2[len-2] = '$';
1182     for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
1183                      W[i] = (Float_t)w[i]}
1184     rad = GetRadLength(z)/dens;
1185     AliMixture(imat,name2,A,Z,dens,-n,W);
1186     tmax    = GetStandardTheataMax(istd);    // degree
1187     stemax  = GetStandardMaxStepSize(istd);  // cm
1188     deemax  = GetStandardEfraction(istd);     // #
1189     epsilon = GetStandardEpsilon(istd);
1190     AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1191               gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1192     delete[] name2;
1193 //______________________________________________________________________
1194 void AliITSv11::SSDConeDetail(TVector3 &tran,const char moth[3],Int_t mat0){
1195     // Defines the volumes and materials for the ITS SSD Support cone.
1196     // Based on drawings ALR-0767 and ALR-0767/3. Units are in mm.
1197     // Inputs:
1198     //   Double_t zShift  The z shift to be applied to the final volume.
1199     // Outputs:
1200     //   none.
1201     // Return:
1202     //   none.
1203     Double_t th = 13.0; //mm, Thickness of Rohacell+carbon fiber
1204     Double_t ct=1.5; //mm, Carbon finber thickness
1205     Double_t r=15.0; // mm, Radius of curvature.
1206     Double_t tc=51.0; // angle of SSD cone [degrees].
1207     Double_t sintc=Sind(tc),costc=Cosd(tc),tantc=Tand(tc);
1208     Double_t z0=0.0,Routmax=0.5*985.,Routmin=0.5*945.,Rholemax=0.5*890.;
1209     Double_t Rholemin=0.5*740.,Rin=0.5*560.;
1210     Int_t nspoaks=12,ninscrews=40,npost=4;
1211     Int_t SSDcf=man0+1; // SSD support cone Carbon Fiber materal number.
1212     Int_t SSDfs=mat0+2; // SSD support cone inserto stesalite 4411w.
1213     Int_t SSDfo=mat0+3; // SSD support cone foam, Rohacell 50A.
1214     Int_t SSDsw=mat0+4; // SSD support cone screw material,Stainless steal
1215     Double_t t; // some general angle [degrees].
1216     Double_t phi0=0.0,dphi=360.0;
1217     Int_t i,j,n,nz,nrad=0;
1218
1219     SetScalemm();
1220     // Lets start with the upper left outer carbon fiber surface.
1221     // Between za[2],rmaxa[2] and za[4],rmaxa[4] there is a curved section
1222     // given by rmaxa = rmaxa[2]-r*Sind(t) for 0<=t<=tc and 
1223     // za = za[2] + r*Cosd(t) for 0<=t<=tc. Simularly between za[1],rmina[1
1224     // and za[3],rmina[3] there is a curve section given by
1225     // rmina = rmina[1]-r*Sind(t) for 0<=t<=tc and za = za[1]+r&Sind(t)
1226     // for t<=0<=tc. These curves have been replaced by straight lines
1227     // between the equivelent points for simplicity.
1228     Double_t dza = th/sintc-(Routmax-Routmin)/tantc;
1229     if(dza<=0){ // The number or order of the points are in error for a proper
1230         // call to pcons!
1231         Error("SSDcone","The definition of the points for a call to PCONS is"
1232               " in error. abort.");
1233         return;
1234     } // end if
1235     nz = 7;
1236     Double_t *za    = new Double_t[nz];
1237     Double_t *rmina = new Double_t[nz];
1238     Double_t *rmaxa = new Double_t[nz];
1239     za[0]    = z0;
1240     rmina[0] = Routmin;
1241     rmaxa[0] = Routmax;
1242     za[1]    = za[0]+13.5-5.0 - dza; // za[2] - dza.
1243     rmina[1] = rmina[0];
1244     rmaxa[1] =rmaxa[0];
1245     za[2]    = za[0]+13.5-5.0; // From Drawing ALR-0767 and ALR-0767/3
1246     rmaxa[2] = rmaxa[0];
1247     za[3]    = za[1]+rc*sintc;
1248     rmina[3] = rmina[1]-rc*sintc;
1249     rmina[2] = rmina[1]+(rmina[3]-rmina[1])*(za[2]-za[1])/(za[3]-za[1]);
1250     za[4]    = za[2]+rc*sintc;
1251     rmaxa[4] = rmaxa[2]-rc*sintc;
1252     rmaxa[3] = rmaxa[2]+(rmaxa[4]-rmaxa[2])*(za[3]-za[2])/(za[4]-za[2]);
1253     rmina[5] = Rholemax;
1254     za[5]    = za[3]+(za[4]-za[3])*(rmina[5]-rmina[3])/(rmina[4]-rmina[3]);
1255     rmina[4] = rmina[3]+(rmina[5]-rmina[3])*(za[4]-za[3])/(za[5]-za[3]);
1256     za[6]    = th/sinth+za[5];
1257     rmina[6] = Rholemax;
1258     rmaxa[6] = rmina[6];
1259     rmaxa[5] = rmaxa[4]+(rmaxa[6]-rmaxa[4])*(za[5]-za[4])/(za[6]-za[4]);
1260     //
1261     PolyCone("SCA","SSD Suport cone Carbon Fiber Surface outer left",
1262              phi0,dphi,nz,*z,*rmin,*rmax,SSDcf);
1263     Pos("SCA",1,moth,trans.x(),trans.y(),trans.z(),0);
1264     XMatrix(1,180.0);
1265     Pos("SCA",2,moth,trans.x(),trans.y(),-trans.z(),1);
1266     Za[0] = 1.; Wa[0] = ; // Hydrogen Content
1267     Za[1] = 6.; Wa[1] = ; // Carbon Content
1268     MixtureByWeight(SSDcf,"Carbon Fiber for SSD support cone",Z,W,dens,2);
1269     //
1270     // Now lets define the Inserto Stesalite 4411w material volume.
1271     nz = 6;
1272     Double_t *zb    = new Double_t[nz];
1273     Double_t *rminb = new Double_t[nz];
1274     Double_t *rmaxb = new Double_t[nz];
1275     zb[0] = z0;
1276     rminb[0] = rmina[0]+ct;
1277     rmaxb[0] = rmaxa[0]-ct;
1278     zb[1] = za[1];
1279     rminb[1] = rminb[0];
1280     rmaxb[1] = rmaxb[0];
1281     zb[2] = za[2];
1282     rmaxb[2] = rmaxb[1];
1283     zb[3] = za[4] - ct/sintc;
1284     rmaxb[3] = rmaxb[2] - (rc-ct)*sintc;
1285     zb[4] = za[3]+ct/sintc;
1286     rminb[4] = rminb[1]-(rc-ct)*sintc;
1287     rminb[2] = rminb[1]+(rminb[4]-rminb[1])*(zb[2]-zb[1])/(zb[4]-zb[1]);
1288     rminb[3] = rminb[1]+(rminb[4]-rminb[1])*(zb[3]-zb[1])/(zb[4]-zb[1]);
1289     zb[5] = zb[4]+(ct-2.*ct)/sintc;
1290     rminb[5] = rminb[4]+(ct-2.*ct)*tantc;
1291     rmaxb[5] = rminb[5];
1292     rmaxb[4] = rmaxb[3]+(rmaxb[5]-rmaxb[3])*(zb[4]-zb[3])/(zb[5]-zb[3]);
1293     PolyCone("SCB","SSD Suport cone Inserto Stesalite left edge",
1294              phi0,dphi,nz,*zb,*rminb,*rmaxb,SSDfs);
1295     Pos("SCB",1,"SCA",0.0,.0,0.0,0);
1296     Za[0] = 1.; Wa[0] = ; // Hydrogen Content
1297     Za[1] = 6.; Wa[1] = ; // Carbon Content
1298     MixtureByWeight(SSDfs,"Inserto stealite 4411w for SSD support cone",
1299                     Z,W,dens,3);
1300     //
1301     // Now lets define the Rohacell foam material volume.
1302     nz = 4;
1303     Double_t *zc    = new Double_t[nz];
1304     Double_t *rminc = new Double_t[nz];
1305     Double_t *rmaxc = new Double_t[nz];
1306     zc[0] = zb[4];
1307     rminc[0] = rminb[4];
1308     rmaxc[0] = rmminc[0];
1309     zc[1] = zb[5];
1310     rmaxc[1] = rminb[5];
1311     zc[2] = za[5] + ct/sintc;
1312     rminc[2] = rmina[5];
1313     rminc[1] = rminc[0] +(rminc[2]-rminc[0]*(zc[1]-zc[0])/(zc[2]-zc[0]);
1314     zc[3] = za[6] - ct/sintc;
1315     rminc[3] = rmina[6];
1316     rmaxc[3] = rminc[3];
1317     rmaxc[2] = rmaxc[1]+(rmaxc[3]-rmaxc[1])*(zc[2]-zc[1])/(zc[3]-zc[1]);
1318     PolyCone("SCC","SSD Suport cone Rohacell foam left edge",
1319              phi0,dphi,nz,*zc,*rminc,*rmaxc,SSDfs);
1320     Pos("SCC",1,"SCA",0.0,.0,0.0,0);
1321     Za[0] = 1.; Wa[0] = ; // Hydrogen Content
1322     Za[1] = 6.; Wa[1] = ; // Carbon Content
1323     MixtureByWeight(SSDfo,"Foam core (Rohacell 50A) for SSD support cone",
1324                     Z,W,dens,3);
1325 }
1326 //______________________________________________________________________
1327 void AliITSv11::SSDConeDetail(TVector3 &tran,const char moth[3]){
1328     // Defines the volumes and materials for the ITS SSD Support cone.
1329     // Based on drawings ALR-0767 and ALR-0767/3. Units are in mm.
1330     // Inputs:
1331     //   Double_t zShift  The z shift to be applied to the final volume.
1332     // Outputs:
1333     //   none.
1334     // Return:
1335     //   none.
1336     Double_t *za,*rmina,*rmaxa,phi0=0.0,dphi=360.0;
1337     Int_t i,j,n,nz,nrad=0;
1338     Double_t ct = 13.0; //mm, Thickness of Rohacell+carbon fiber
1339     Double_t cthick=1.5; //mm, Carbon finber thickness
1340     Double_t r=15.0; // mm, Radius of curvature.
1341     Double_t tc=51.0; // angle of SSD cone [degrees].
1342     Double_t t; // some general angle [degrees].
1343     Int_t SSDcf=; // SSD support cone Carbon Fiber materal number.
1344     Int_t SSDfs=; // SSD support cone inserto stesalite 4411w.
1345     Int_t SSDfo=; // SSD support cone foam, Rohacell 50A.
1346
1347     SetScalemm();
1348     // Lets start with the upper left outer carbon fiber surface.
1349     nz = 6;
1350     za    = new Double_t[nz];
1351     rmina = new Double_t[nz];
1352     rmaxa = new Double_t[nz];
1353     //
1354     za[0] = 0.0;
1355     rmaxa[0] = 985./2.;
1356     rmina[0] = rmaxa[0] - cthick;
1357     //
1358     za[1] = 13.5 - 5.0; // The original size of 13.5 (ALR-0767) is milled down
1359     rmaxa[1] = rmaxa[0]; // by 5mm to give a well defined reference surface 
1360     rmina[1] = rmina[0]; // (ALR-0767/3).
1361     // The curved section is given by the following fomula
1362     // rmax = -r*Sind(t)+rmaxa[1] for 0<=t<=tc. Outer curve.
1363     // rmin = -(r-cthick)*Sind(t)+rmina[1] for 0<=t<=tc. Inner curve.
1364     // zout = r*Cosd(t)+za[1] for 0<=t<=tc. Outer curve.
1365     // zin  = (r-cthick)*Sind(t)+za[1] for 0<=t<=tx. Inner curve.
1366     // We will only use a straight line between the beggining and ending points
1367     // of the arch (for now at least).
1368     za[2] = (r-cthick)*Sind(tc)+za[1];
1369     rmina[2] = -(r-cthick)*Sind(tc)+rmina[1];
1370     rmaxa[2] = za[1]+(r-cthick)*Sind(tc);
1371     //
1372     za[3] = r*Sind(tc)+za[1];
1373     rmaxa[3] = -r*Sind(tc)+rmaxa[1];
1374     // angled section. surface is given by the following equations
1375     // Rout = -Tand(tc)*(z-za[3]) + rmaxa[3], outer surface.
1376     // Rin  = -Tand(tx)*(z-za[2]) + rmina2], inner surface.
1377     rmina[3] = -Tand(tc)*(za[3]-za[2]) + rmina[2];
1378     // Point of whole. Whole surface has fixed radius = 890.0/2 +cthick mm
1379     // exclude carbon fiber covering whole.
1380     rmina[4] = 890.0/2.+cthick ; // Inner whole surface radius (ALR-0767)
1381     za[4] = (rmina[4] - rmina[2])/(-Tand(tc)) + za[2];
1382     rmaxa[4] = -Tand(tc)*(za[4]-za[3])+rmaxa[3];
1383     //
1384     rmaxa[5] = rmina[4];
1385     rmina[5] = rmina[4];
1386     za[5] = (rmaxa[5] - rmaxa[3])/(-Tand(tc)) +za[3];
1387     //
1388     PolyCone("SCA","SSD Suport cone Carbon Fiber Surface outer left",
1389              phi0,dphi,nz,*z,*rmin,*rmax,SSDcf);
1390     Pos("SCA",1,moth,trans.x(),trans.y(),trans.z(),0);
1391     XMatrix(1,180.0);
1392     Pos("SCA",2,moth,trans.x(),trans.y(),-trans.z(),1);
1393     Za[0] = 1.; Wa[0] = ; // Hydrogen Content
1394     Za[1] = 6.; Wa[1] = ; // Carbon Content
1395     MixtureByWeight(SSDcf,"Carbon Fiber for SSD support cone",Z,W,dens,2);
1396     //====================================================================
1397     // Now for the upper left inner carbon fiber suface.
1398     // Start by working backwards
1399     nz = 6;
1400     zd    = new Double_t[nz];
1401     rmind = new Double_t[nz];
1402     rmaxd = new Double_t[nz];
1403     // The two surfaces of this carbon fiber inner layer are given by
1404     // Rout = -Tand(tc)*(z-za[3])+rmaxa[3]-ct/cosd(tc)
1405     // Rin  = -Tand(tc)*(z-za[3])+rmaxa[3]-(ct-cthick)/Cosd(tc)
1406     rmind[4] = rmina[4]; // Stop at the same radii as part a.
1407     zd[4] = (rmind[4]-rmaxa[3]+ct/Cosd(tc))/(-Tand(tc)) + za[3];
1408     rmaxd[4] = -Tand(tc)*(zd[4]-za[3])+rmaxa[3]-(ct-cthick)/Cosd(tc);
1409     //
1410     rmind[5] = rmina[4]; // Stop at the same radii as part a.
1411     rmaxd[5] = rmind[5];
1412     zd[5] = (rmind[5]-rmaxa[3]+(ct-cthick)/Cosd(tc))/(-Tand(tc)) + za[3];
1413     // The other easy point is the very beginning.
1414     zd[0]    = za[0]; // same staring z as with the outer suface.
1415     rmind[0] = 945./2.;
1416     rmaxd[0] = rmind[0]+cthick;
1417     // The rest of this volume is defined by the lines || z axis starting
1418     // at zd[0] and rmind[0]/rmaxd[0], and the lines representing the
1419     // slopped surfaces defined above plus the curved sections connecting
1420     // the two (covering tc degrees of arc and having a radius of r mm).
1421     // The coordinate zd[1] is defined as the z coordinate of the point
1422     // of intersection between the line R=rmind[0]-r and the line
1423     // R=-Tand(tc)*(z-za[3])+rmaxa[3]-(ct+r)/Cosd(ct).
1424     zd[1] = (rmaxa[3]+r-rmind[0])/Tand(tc)-(ct+r)/Sind(tc)+za[3];
1425     rmind[1] = rmind[0];
1426     rmaxd[1] = rmaxd[0];
1427     //
1428     zd[2] = zd[1] + r*Sind(tc);
1429     rmind[2] = rmind[1] - r*Sind(rc);
1430     //
1431     zd[3] = zd[1] + (r+cthick)*Sind(tc);
1432     rmax[3] = rmax[1] - (r+cthick)*Sind(tc);
1433     // Get rmax[2] and rmin[3] from the line segments replacing the arc.
1434     rmax[2] = rmaxd[1]+(rmaxd[3]-rmaxd[1])*(zd[2]-zd[1])/(zd[3]-zd[1]);
1435     rmin[3] = rmind[2]+(rmind[4]-rmind[2])*(zd[3]-zd[2])/(zd[4]-dz[2]);
1436     //
1437     PolyCone("SCD","SSD Suport cone Carbon Fiber Surface inner left",
1438              phi0,dphi,nz,*zd,*rmind,*rmaxd,SSDcf);
1439     Pos("SCD",1,moth,trans.x(),trans.y(),trans.z(),0);
1440     Pos("SCD",2,moth,trans.x(),trans.y(),-trans.z(),1);
1441     //================================================================
1442     // Now for the fill between these two volumes. There are two different
1443     // materials. The line separating them goes through the points
1444     // zd[2],rmind[2] and zd[3],rmaxd[3]. Starting with the Inserto Stesalite
1445     // 4411w material.
1446     nz = 6;
1447     zb    = new Double_t[nz];
1448     rminb = new Double_t[nz];
1449     rmaxb = new Double_t[nz];
1450     //
1451     zb[0] = za[0];
1452     rminb[0] = rmaxd[0];
1453     rmaxb[0] = rmina[0];
1454     //
1455     zb[1] = zd[1];
1456     rminb[1] = rmaxd[1];
1457     rmaxb[1] = rmina[1];
1458     //
1459     zb[2] = za[1];
1460     rmaxb[2] = rmina[1];
1461     rminb[2] = rmaxd[2]+(rmaxd[3]-rmaxd[2])*(zb[2]-zd[2])/(zd[3]-zd[2]);
1462     //
1463     zb[3] = za[2];
1464     rmaxb[3] = rmina[2];
1465     rminb[3] =  rmaxd[2]+(rmaxd[3]-rmaxd[2])*(zb[3]-zd[2])/(zd[3]-zd[2]);
1466     //
1467     zb[4] = zd[2];
1468     rminb[4] = rmind[2];
1469     rmaxb[4] = rmina[2]+(rmina[3]-rmina[2])*(zb[4]-za[2])/(za[3]-za[2]);
1470     //
1471     zb[5] = zb[4]+(ct-2.*cthick)*Sind(tc);
1472     rminb[5] = rmina[2]-(rmina[3]-rmina[2])*(zb[5]-za[2])/(za[3]-za[2]);
1473     rmaxb[5] = rminb[5];
1474     //
1475     PolyCone("SCB","SSD Suport cone Inserto Stesalite left edge",
1476              phi0,dphi,nz,*zb,*rminb,*rmaxb,SSDfs);
1477     Pos("SCB",1,moth,trans.x(),trans.y(),trans.z(),0);
1478     Pos("SCB",2,moth,trans.x(),trans.y(),-trans.z(),1);
1479     Za[0] = 1.; Wa[0] = ; // Hydrogen Content
1480     Za[1] = 6.; Wa[1] = ; // Carbon Content
1481     MixtureByWeight(SSDfs,"Inserto stealite 4411w for SSD support cone",
1482                     Z,W,dens,3);
1483     //================================================================
1484     // Now for the section filled with Roacell foam.
1485     nz = 4;
1486     zc    = new Double_t[nz];
1487     rminc = new Double_t[nz];
1488     rmaxc = new Double_t[nz];
1489     zc[0] = zb[4];
1490     rminc[0] = rminb[4];
1491     rmaxc[0] = rminc[0];
1492     //
1493     zc[1] = zb[5];
1494     rminc[1] = rmaxd[2]+(rmaxd[3]-rmaxd[2])*(zc[1]-zd[2])/(zd[3]-zd[2]);;
1495     rmaxc[1] = rminb[5];
1496     //
1497     zc[2] = zd[5];
1498     rminc[2] = rmaxd[5];
1499     rmaxc[2] = rmina[2]+(rmina[3]-rmina[2])*(zc[2]-za[2])/(za[3]-za[2]);
1500     //
1501     zc[3] = za[4];
1502     rminc[3] = rmina[4];
1503     rmaxc[3] = rmina[4];
1504     //
1505     PolyCone("SCC","SSD Suport cone Inserto foam left edge",
1506              phi0,dphi,nz,*zc,*rminc,*rmaxc,SSDfo);
1507     Pos("SCC",1,moth,trans.x(),trans.y(),trans.z(),0);
1508     Pos("SCC",2,moth,trans.x(),trans.y(),-trans.z(),1);
1509     Za[0] = 1.; Wa[0] = ; // Hydrogen Content
1510     Za[1] = 6.; Wa[1] = ; // Carbon Content
1511     MixtureByWeight(SSDfo,"Foam core (Rohacell 50A) for SSD support cone",
1512                     Z,W,dens,3);
1513     //=================================================================
1514     // now for the part of the SSD cone which has the wholes in it.
1515     // We now define the spoaks. Start with outer carbon fiber surface
1516     // Follows the same surface as the sloped part of SCA.
1517     // The Spoaks have a radius matching them to the holes. This radius (in 
1518     // phi) can not be reproduce.
1519     Double_t sdr = 0.5*(890.-740.)+2*cthick; // length of spoak section
1520     // including the carbon finber thickness covering the opening (ALR-0767).
1521     phi0 = 12.5; // starting phi of spoak (centered about phi0=0).
1522     dphi =  5.0; // From (ALR-0767).
1523     ze    = new Double_t[nz];
1524     rmine = new Double_t[nz];
1525     rmaxe = new Double_t[nz];
1526     //
1527     ze[0] = za[4];
1528     rmine[0] = rmina[4];
1529     rmaxe[0] = rmine[0];
1530     //
1531     ze[1] = za[5];
1532     rmaxe[1] = rmina[5];
1533     rmine[1] = rmina[2]-(rmina[4]-rmina[2])*(ze[1]-za[2])/(za[4]-za[2]);
1534     //
1535     rmine[2] = rmine[0] - sdr;
1536     ze[2] = za[2]+(rmina[2]-rmine[2])*(za[4]-za[2])/(rmina[4]-rmina[2]);
1537     rmaxe[2] = rmaxa[3]-(rmaxa[5]-rmaxa[3])*(ze[2]-za[3])/(za[5]-za[3]);
1538     //
1539     rmine[3] = rmine[2];
1540     ze[3] = za[3]+(rmaxa[3]-rmine[3])*(za[5]-za[3])/(rmaxa[5]-rmaxa[3]);
1541     rmaxe[3] = rmine[2];
1542     //
1543     PolyCone("SCE","SSD Suport cone carbon fiber outer surface of spoak face",
1544              phi0,dphi,nz,*ze,*rmine,*rmaxe,SSDcf);
1545     Pos("SCE",1,moth,trans.x(),trans.y(),trans.z(),0); // place first copy
1546     for(i=1;i<12;i++){ // There are 12 spoaks around.
1547         ZMatrix(1+i,((Double_t)i)*360./12.);
1548         Pos("SCE",i+1,moth,trans.x(),trans.y(),trans.z(),1+i);
1549     } // end for i
1550     // Other side.
1551     Pos("SCE",1,moth,trans.x(),trans.y(),-trans.z(),1); // place first copy
1552     for(i=1;i<12;i++){ // There are 12 spoaks around.
1553         Matrix(13+i,180.0,0.0,((Double_t)i)*360./12.); // ??????????
1554         Pos("SCE",i+1,moth,trans.x(),trans.y(),-trans.z(),13+i);
1555     } // end for i
1556     //
1557     //Now for the inner carbon fiber surface.
1558     zf    = new Double_t[nz];
1559     rminf = new Double_t[nz];
1560     rmaxf = new Double_t[nz];
1561     //
1562     zf[0] = zd[4];
1563     rminf[0] = rmind[5];
1564     rmaxf[0] = rmine[0];
1565     //
1566     zf[1] = zd[5];
1567     rmaxf[1] = rmind[5];
1568     rminf[1] = rmind[2]-(rmind[4]-rmind[2])*(zf[1]-zd[2])/(zd[4]-zd[2]);
1569     //
1570     rminf[2] = rmine[0] - sdr;
1571     zf[2] = zd[2]+(rmind[2]-rminf[2])*(zd[4]-zd[2])/(rmind[4]-rmind[2]);
1572     rmaxf[2] = rmaxd[3]-(rmaxd[5]-rmaxd[3])*(zf[2]-zd[3])/(zd[5]-zd[3]);
1573     //
1574     rminf[3] = rmine[2];
1575     zf[3] = zd[3]+(rmaxd[3]-rminf[3])*(zd[5]-zd[3])/(rmaxd[5]-rmaxd[3]);
1576     rmaxf[3] = rmine[2];
1577     //
1578     PolyCone("SCF","SSD Suport cone carbon fiber inner surface of spoak face",
1579              phi0,dphi,nz,*zf,*rminf,*rmaxf,SSDcf);
1580     Pos("SCF",1,moth,trans.x(),trans.y(),trans.z(),0); // place first copy
1581     for(i=1;i<12;i++){ // There are 12 spoaks around.
1582         Pos("SCF",i+1,moth,trans.x(),trans.y(),trans.z(),1+i);
1583     } // end for i
1584     // Other side.
1585     Pos("SCF",1,moth,trans.x(),trans.y(),-trans.z(),1); // place first copy
1586     for(i=1;i<12;i++){ // There are 12 spoaks around.
1587         Pos("SCF",i+1,moth,trans.x(),trans.y(),-trans.z(),13+i);
1588     } // end for i
1589     //
1590     // Now for the foam filling of this spoak
1591     zg    = new Double_t[nz];
1592     rming = new Double_t[nz];
1593     rmaxg = new Double_t[nz];
1594     //
1595     phi0 = phi0+cthick/(0.25*(890.+740.));// Make space for Carbon fiber
1596     dphi = dphi-cthick/(0.25*(890.+740.));// covering hole on both sides.
1597     // thickness of this covering ic cthick. As given above it varies allong
1598     // the length of the spoak. No other solusion
1599     //
1600     zg[0] = zf[1];
1601     rming[0] = rmaxf[1];
1602     rmaxg[0] = rming[0];
1603     //
1604     zg[1] = ze[0];
1605     rmaxg[1] = rmine[0];
1606     rming[1] = rmind[2]-(rmind[4]-rmind[2])*(zg[1]-zd[2])/(zd[4]-zd[2]);
1607     //
1608     rming[2] = rminf[3];
1609     zg[2] = zd[2]+(rmind[2]-rming[2])*(zd[4]-zd[2])/(rmind[4]-rmind[2]);
1610     rmaxg[2] = rmaxd[3]-(rmaxd[5]-rmaxd[3])*(zg[2]-zd[3])/(zd[5]-zd[3]);
1611     //
1612     rming[3] = rmine[2];
1613     zg[3] = zd[3]+(rmaxd[3]-rming[3])*(zd[5]-zd[3])/(rmaxd[5]-rmaxd[3]);
1614     rmaxg[3] = rming[3];
1615     //
1616     PolyCone("SCG","SSD Suport cone spoak foam filling",
1617              phi0,dphi,nz,*zg,*rming,*rmaxg,SSDfo);
1618     Pos("SCG",1,moth,trans.x(),trans.y(),trans.z(),0); // place first copy
1619     for(i=1;i<12;i++){ // There are 12 spoaks around.
1620         Pos("SCG",i+1,moth,trans.x(),trans.y(),trans.z(),1+i);
1621     } // end for i
1622     // Other side.
1623     Pos("SCG",1,moth,trans.x(),trans.y(),-trans.z(),1); // place first copy
1624     for(i=1;i<12;i++){ // There are 12 spoaks around.
1625         Pos("SCG",i+1,moth,trans.x(),trans.y(),-trans.z(),13+i);
1626     } // end for i
1627     //============================================================
1628     // now for the carbon fiber covering the top of this hole.
1629     nz = 4;
1630     zh    = new Double_t[nz];
1631     rminh = new Double_t[nz];
1632     rmaxh = new Double_t[nz];
1633     //
1634     phi0= -12.5;
1635     dphi=  25.0;
1636     //
1637     rmaxh[0]=rmaxa[5];
1638     rminh[0]=rmaxh[0]-cthick;
1639     zh[0]=;
1640     //
1641     rmaxh[1]=rmaxh[0];
1642     rminh[1]=rminh[0];
1643     zh[1] = ;
1644     //
1645     PolyCone("SCI","SSD Suport cone carbon fiber inner top surface of hole",
1646              phi0,dphi,nz,*zi,*rmini,*rmaxi,SSDcf);
1647     //Pos("SCI",1,moth,trans.x(),trans.y(),trans.z(),0);
1648     //Pos("SCI",2,moth,trans.x(),trans.y(),-trans.z(),1);
1649     //
1650     // now for the carbon fiber covering the bottom of this hole.
1651     nz = 4;
1652     zj    = new Double_t[nz];
1653     rminj = new Double_t[nz];
1654     rmaxj = new Double_t[nz];
1655     //
1656     rmaxj[0]=rmaxe[4];
1657     rminj[0]=rmaxj[0]-cthick;
1658     zj[0]=;
1659     //
1660     rmaxj[1]=rmaxj[0];
1661     rminj[1]=rminj[0];
1662     zj[1]= ;
1663     //
1664     PolyCone("SCJ","SSD Suport cone carbon fiber inner bottom surface of hole",
1665              phi0,dphi,nz,*zi,*rmini,*rmaxi,SSDcf);
1666     //Pos("SCJ",1,moth,trans.x(),trans.y(),trans.z(),0);
1667     //Pos("SCJ",2,moth,trans.x(),trans.y(),-trans.z(),1);
1668     //
1669     //Now for the carbon fiber on the sides of the spoakes.
1670     //==============================================================
1671     delete[] za;delete[] rmina;delete[] rmaxa;
1672     delete[] zb;delete[] rminb;delete[] rmaxb;
1673     delete[] zc;delete[] rminc;delete[] rmaxc;
1674     delete[] zd;delete[] rmind;delete[] rmaxd;
1675     delete[] ze;delete[] rmine;delete[] rmaxe;
1676     delete[] zf;delete[] rminf;delete[] rmaxf;
1677     delete[] zg;delete[] rming;delete[] rmaxg;
1678     delete[] zh;delete[] rminh;delete[] rmaxh;
1679     delete[] zi;delete[] rmini;delete[] rmaxi;
1680     delete[] zj;delete[] rminj;delete[] rmaxj;
1681     // Set back to cm default scale before exiting.
1682     SetScalecm();
1683     return;
1684 }
1685 //______________________________________________________________________
1686 void AliITSv11::CreateGeometry(){
1687     ////////////////////////////////////////////////////////////////////////
1688     // This routine defines and Creates the geometry for version 11 of the ITS.
1689     ////////////////////////////////////////////////////////////////////////
1690 }
1691 //______________________________________________________________________
1692 void AliITSv11::CreateMaterials(){
1693 ////////////////////////////////////////////////////////////////////////
1694   //
1695   // Create ITS materials
1696   //     This function defines the default materials used in the Geant
1697   // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
1698   // AliITSv11.
1699   // In general it is automatically replaced by
1700   // the CreatMaterials routine defined in AliITSv?. Should the function
1701   // CreateMaterials not exist for the geometry version you are using this
1702   // one is used. See the definition found in AliITSv5 or the other routine
1703   // for a complete definition.
1704   //
1705 }
1706 //______________________________________________________________________
1707 void AliITSv11::InitAliITSgeom(){
1708     //     Based on the geometry tree defined in Geant 3.21, this
1709     // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
1710     // sturture.
1711 }
1712
1713 //______________________________________________________________________
1714 void AliITSv11::Init(){
1715     ////////////////////////////////////////////////////////////////////////
1716     //     Initialise the ITS after it has been created.
1717     ////////////////////////////////////////////////////////////////////////
1718 }
1719 //______________________________________________________________________
1720 void AliITSv11::SetDefaults(){
1721     // sets the default segmentation, response, digit and raw cluster classes
1722 }
1723 //______________________________________________________________________
1724 void AliITSv11::DrawModule(){
1725     ////////////////////////////////////////////////////////////////////////
1726     //     Draw a shaded view of the FMD version 11.
1727     ////////////////////////////////////////////////////////////////////////
1728 }
1729 //______________________________________________________________________
1730 void AliITSv11::StepManager(){
1731     ////////////////////////////////////////////////////////////////////////
1732     //    Called for every step in the ITS, then calles the AliITShit class
1733     // creator with the information to be recoreded about that hit.
1734     //     The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
1735     // printing of information to a file which can be used to create a .det
1736     // file read in by the routine CreateGeometry(). If set to 0 or any other
1737     // value except 1, the default behavior, then no such file is created nor
1738     // it the extra variables and the like used in the printing allocated.
1739     ////////////////////////////////////////////////////////////////////////
1740 }
1741