]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSBaseGeometry.cxx
c983bba6adcbacc406d95a5c04007eb8345af751
[u/mrichter/AliRoot.git] / ITS / AliITSBaseGeometry.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 /* $Id$ */
17
18 /*
19   A base geometry class defining all of the ITS volumes that make up an ITS
20 geometry.
21 Auhors: B. S. Nilsen
22 Version 0
23 Created February 2003.
24 */
25
26 #include <Riostream.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <TMath.h>
31 #include <TGeometry.h>
32 #include <TNode.h>
33 #include <TTUBE.h>
34 #include <TTUBS.h>
35 #include <TPCON.h>
36 #include <TVector3.h>
37 #include <TFile.h>    // only required for Tracking function?
38 #include <TCanvas.h>
39 #include <TObjArray.h>
40 #include <TLorentzVector.h>
41 #include <TObjString.h>
42 #include <TClonesArray.h>
43 #include <TBRIK.h>
44 #include <TSystem.h>
45 #include <AliRun.h>
46 #include <AliMagF.h>
47 #include <AliConst.h>
48 #include "AliITSBaseGeometry.h"
49
50 ClassImp(AliITSBaseGeometry)
51
52 const Double_t AliITSBaseGeometry::fAlpha = 7.297352533e-3;
53 const Double_t AliITSBaseGeometry::fRe = 2.81794028e-13;
54 const Double_t AliITSBaseGeometry::fNa = 6.02214199e+23;
55 Int_t    AliITSBaseGeometry::fNCreates    = 0;
56 Int_t*   AliITSBaseGeometry::fidrot       = 0;
57 Int_t    AliITSBaseGeometry::fidrotsize   = 0;
58 Int_t    AliITSBaseGeometry::fidrotlast   = 0;
59 Int_t    AliITSBaseGeometry::fVolNameSize = 0;
60 Int_t    AliITSBaseGeometry::fVolNameLast = 0;
61 TString* AliITSBaseGeometry::fVolName     = 0;
62
63 //______________________________________________________________________
64 AliITSBaseGeometry::AliITSBaseGeometry(){
65     // Default construtor for the ITS Base Geometry class.
66     // Inputs:
67     //    none.
68     // Outputs:
69     //    none.
70     // Return:
71     //    none.
72
73     fScale = 1.0; // Default value.
74     fits = 0; // zero pointers.
75     if(fNCreates==0){ // only for very first init
76     } // end if
77     fNCreates++; // incrament this creation counter.
78 }
79 //______________________________________________________________________
80 AliITSBaseGeometry::AliITSBaseGeometry(AliITS *its,Int_t iflag){
81     // Standard construtor for the ITS Base Geometry class.
82     // Inputs:
83     //    Int_t iflag  flag to indecate specific swiches in the geometry
84     // Outputs:
85     //    none.
86     // Return:
87     //    none.
88
89     fScale = iflag; // remove warning message for unused variable
90     fScale = 1.0; // Default value.
91     fits = its; // get a copy of the pointer to the ITS.
92     if(fNCreates==0){ // only for very first init
93         fidrotsize = ITSG3VnameToIndex("TSV")+1;
94         fidrot = new Int_t[fidrotsize];
95         fidrotlast = 0;
96     } // end if
97     fNCreates++; // incrament this creation counter.
98 }
99 //______________________________________________________________________
100 AliITSBaseGeometry::~AliITSBaseGeometry(){
101     // Standeard destructor for the ITS Base Geometry class.
102     // Inputs:
103     //    Int_t iflag  flag to indecate specific swiches in the geometry
104     // Outputs:
105     //    none.
106     // Return:
107     //    none.
108
109     fits = 0; // This class does not own this class. It contaitns a pointer
110     // to it for conveniance.
111     fNCreates--;
112     if(fNCreates==0){ // Now delete the static members
113         Int_t i;
114         if(fVolName!=0){
115             for(i=0;i<fVolNameLast;i++) delete fVolName[i];
116             fVolNameSize = 0;
117             fVolNameLast = 0;
118             delete[] fVolName;
119         }// end if
120         delete[] fidrot;
121         fidrotsize = fidrotlast = 0;
122     }// end if
123 }
124 //______________________________________________________________________
125 Int_t AliITSBaseGeometry::AddVolName(const TString name){
126     // Checks if the volume name already exist, if not it adds it to
127     // the list of volume names and returns an index to that volume name.
128     // it will create and expand the array of volume names as needed.
129     // If the volume name already exists, it will give an error message and
130     // return an index <0.
131     // Inputs:
132     //    const TString name  Volume name to be added to the list.
133     // Outputs:
134     //    none.
135     // Return:
136     //    The index where this volume name is stored.
137     Int_t i;
138
139     if(fVolName==0){ // must create array.
140         fVolNameSize = 38624;
141         fVolName = new TString[fVolNameSize];
142         fVolNameLast = 0;
143     } // end if
144     for(i=0;i<fVolNameLast;i++) if(fVolName[i].CompareTo(name)==0){ // Error
145         Error("AddVolName","Volume name already exists for volume %d name %s",
146               i,name.Data());
147         return -1;
148     } // end for i
149     if(fVolNameSize==fVolNameLast-1){ // Array is full must expand.
150         Int_t size = fVolNameSize*2;
151         TString *old = fVolName;
152         fVolName = new TString[fVolNameSize];
153         for(i=0;i<fVolNameLast;i++) fVolName[i] = old[i];
154         delete[] old;
155         fVolNameSize = size;
156     } // end if
157     i=ITSIndexToITSG3name(fVolNameLast);
158     if(strcmp((char*)(&i),"ITSV")==0){
159         // Special Reserved Geant 3 volumen name. Skip it
160         // fill it with explination for conveniance.
161         fVolName[fVolNameLast] = "ITS Master Mother Volume";
162         fVolNameLast++;
163     } // end if
164     fVolName[fVolNameLast] = name;
165     fVolNameLast++;
166     return fVolNameLast-1; // return the index
167 }
168 //______________________________________________________________________
169 Int_t AliITSBaseGeometry::ITSIndexToITSG3name(const Int_t i){
170     // Given the ITS volume index i, it returns the Geant3 ITS volume
171     // name. The valid characters must be in the range
172     // '0' through 'Z'. This will include all upper case letter and the
173     // numbers 0-9. In addition it does not will include the following simbols
174     // ":;<=>?@"
175     // Inputs:
176     //    const Int_t i  the ITS volume index
177     // Output:
178     //    none.
179     // Return:
180     //    char[4] with the ITS volume name starting from "I000" to "IZZZ"
181     const Int_t rangen=(Int_t)('9'-'0'+1); // range of numbers
182     const Int_t rangel=(Int_t)('Z'-'A'+1); // range of letters
183     const Int_t range = rangen+rangel; // the number of characters between 
184                                        // 0-9 and A-Z.
185     Int_t k;
186     Byte_t *a = (Byte_t*) &k;
187     Int_t j = i;
188
189     k = 0;
190     a[0] = (Byte_t)('I');
191     a[1] = (Byte_t)('0'+j/(range*range));
192     if(a[1]>'9') a[1] += 'A'-'9'-1;//if it is a letter add in gap for simples.
193     j -= range*range*((Int_t)(j/(range*range)));
194     a[2] = (Byte_t)('0'+j/range);
195     if(a[2]>'9') a[2] += 'A'-'9'-1;//if it is a letter add in gap for simples.
196     j -= range*((Int_t)(j/range));
197     a[3] = (Byte_t)('0'+j);
198     if(a[3]>'9') a[3] += 'A'-'9'-1;//if it is a letter add in gap for simples.
199     return k;
200 }
201 //______________________________________________________________________
202 Int_t AliITSBaseGeometry::ITSG3VnameToIndex(const char *name){
203     // Given the last three characters of the ITS Geant3 volume name,
204     // this returns the index. The valid characters must be in the range
205     // '0' through 'Z'. This will include all upper case letter and the
206     // numbers 0-9. In addition it will include the following simbles
207     // ":;<=>?@"
208     // Inputs:
209     //    const char name[3]  The last three characters of the ITS Geant3
210     //                        volume name
211     // Output:
212     //    none.
213     // Return:
214     //    Int_t the index.
215     const Int_t rangen = (Int_t)('9'-'0'+1); // range of numbers
216     const Int_t rangel = (Int_t)('Z'-'A'+1); // range of letters
217     const Int_t range  = rangen+rangel; // the number of characters between
218                                         // 0-9 + A-Z.
219     Int_t i=0,j,k;
220
221     k = strlen(name)-1;
222     for(j=k;j>k-3;j--) if(isdigit(name[j])) // number
223         i += (Int_t)((name[j]-'0')*TMath::Power((Double_t)range,
224                                                 (Double_t)(k-j)));
225     else
226         i += (Int_t)((name[j]-'A'+rangen)*TMath::Power((Double_t)range,
227                                                        (Double_t)(k-j)));
228     return i;
229 }
230 //______________________________________________________________________
231 TString AliITSBaseGeometry::GetVolName(const Int_t i)const{
232     // Returns the volume name at a given index i. Index must be in
233     // range and the array of volume names must exist. If there is an
234     // error, a message is written and 0 is returned.
235     // Inputs:
236     //   const Int_t i Index
237     // Output:
238     //   none.
239     // Return:
240     //   A TString contianing the ITS volume name.
241
242     if(i<0||i>=fVolNameLast){
243         Error("GetVolName","Index=%d out of range but be witin 0<%d",i,
244               fVolName-1);
245         return 0;
246     } // end if Error
247     return fVolName[i];
248 }
249 //______________________________________________________________________
250 Int_t AliITSBaseGeometry::GetVolumeIndex(const TString &a){
251     // Return the index corresponding the the volume name a. If the
252     // Volumen name is not found, return -1, and a warning message given.
253     // Inputs:
254     //   const TString &a  Name of volume for which index is wanted.
255     // Output:
256     //   none.
257     // Return:
258     //   Int_t Index corresponding the volume a. If not found -1 is returned.
259     Int_t i;
260
261     for(i=0;i<fVolNameLast;i++) if(fVolName[i].CompareTo(a)==0) return i;
262     Info("GetVolumeIndex","Volume name %s not found",a.Data());
263     return -1;
264 }
265 //______________________________________________________________________
266 void AliITSBaseGeometry::Box(const char *gnam,const TString &dis,
267                              Double_t dx,Double_t dy,Double_t dz,Int_t med){
268     // Interface to TMC->Gsvolu() for ITS box geometries. Box with faces
269     // perpendicular to the axes. It has 3 paramters. See SetScale() for
270     // units. Default units are geant 3 [cm].
271     // Inputs:
272     //    const char *gnam  3 character geant volume name. The letter "I"
273     //                        is appended to the front to indecate that this
274     //                        is an ITS volume.
275     //    TString &dis        String containging part discription.
276     //    Double_t dx         half-length of box in x-axis
277     //    Double_t dy         half-length of box in y-axis
278     //    Double_t dz         half-length of box in z-axis
279     //    Int_t    med        media index number.
280     // Output:
281     //    none.
282     // Return.
283     //    none.
284     char name[5];
285     Float_t param[3];
286
287     AddVolName(dis);
288     param[0] = fScale*dx;
289     param[1] = fScale*dy;
290     param[2] = fScale*dz;
291     G3name(gnam,name);
292     gMC->Gsvolu(name,"BOX ",GetMed(med),param,3);
293 }
294 //______________________________________________________________________
295 void AliITSBaseGeometry::Box(AliITSBoxData &d,Int_t med){
296     // Interface to TMC->Gsvolu() for ITS box geometries. Box with faces
297     // perpendicular to the axes. It has 3 paramters. See SetScale() for
298     // units. Default units are geant 3 [cm].
299     // Inputs:
300     //    AliITSBoxData &d   Structure with the Box parameters defined.
301     //    Int_t         med  media index number.
302     // Output:
303     //    none.
304     // Return.
305     //    none.
306     char name[5];
307     Float_t param[3];
308     Int_t i,k;
309     char *j = (char *) &k;
310
311     param[0] = fScale*d.DxAt();
312     param[1] = fScale*d.DyAt();
313     param[2] = fScale*d.DzAt();
314     d.SetVid(AddVolName((d.GetName())->Data()));
315     k = ITSIndexToITSG3name(d.GetVid());
316     for(i=0;i<4;i++) name[i] = j[i];
317     name[4] = '\0';
318     gMC->Gsvolu(name,"BOX ",GetMed(med),param,3);
319 }
320 //______________________________________________________________________
321 void AliITSBaseGeometry::Trapezoid1(const char *gnam,const TString &dis,
322                                     Double_t dxn,Double_t dxp,Double_t dy,
323                                     Double_t dz,Int_t med){
324     // Interface to TMC->Gsvolu() for ITS TRD1 geometries. Trapezoid with the 
325     // x dimension varing along z. It has 4 parameters. See SetScale() for
326     // units. Default units are geant 3 [cm].
327     // Inputs:
328     //    const char *gnam  3 character geant volume name. The letter "I"
329     //                        is appended to the front to indecate that this
330     //                        is an ITS volume.
331     //    TString &dis        String containging part discription.
332     //    Double_t dxn        half-length along x at the z surface positioned 
333     //                        at -DZ
334     //    Double_t dxp        half-length along x at the z surface positioned 
335     //                        at +DZ
336     //    Double_t dy         half-length along the y-axis
337     //    Double_t dz         half-length along the z-axis
338     //    Int_t    med        media index number.
339     // Output:
340     //    none.
341     // Return.
342     //    none.
343     char name[5];
344     Float_t param[4];
345
346     AddVolName(dis);
347     param[0] = fScale*dxn;
348     param[1] = fScale*dxp;
349     param[2] = fScale*dy;
350     param[3] = fScale*dz;
351     G3name(gnam,name);
352     gMC->Gsvolu(name,"TRD1",GetMed(med),param,4);
353 }
354 //______________________________________________________________________
355 void AliITSBaseGeometry::Trapezoid1(AliITSTrapezoid1Data &d,Int_t med){
356     // Interface to TMC->Gsvolu() for ITS TRD1 geometries. Trapezoid with the 
357     // x dimension varing along z. It has 4 parameters. See SetScale() for
358     // units. Default units are geant 3 [cm].
359     // Inputs:
360     //    AliITSTrapezoid1Data &d   Structure with the Trapazoid data in it.
361     //    Int_t                med  media index number.
362     // Output:
363     //    none.
364     // Return.
365     //    none.
366     char name[5];
367     Float_t param[4];
368     Int_t i,k;
369     char *j = (char *) &k;
370
371     param[0] = fScale*d.DxAt(0);
372     param[1] = fScale*d.DxAt(1);
373     param[2] = fScale*d.DyAt();
374     param[3] = fScale*d.DzAt();
375     d.SetVid(AddVolName((d.GetName())->Data()));
376     k = ITSIndexToITSG3name(d.GetVid());
377     for(i=0;i<4;i++) name[i] = j[i];
378     name[4] = '\0';
379     gMC->Gsvolu(name,"TRD1",GetMed(med),param,4);
380 }
381 //______________________________________________________________________
382 void AliITSBaseGeometry::Trapezoid2(const char *gnam,const TString &dis,
383                                     Double_t dxn,Double_t dxp,Double_t dyn,
384                                     Double_t dyp,Double_t dz,Int_t med){
385     // Interface to TMC->Gsvolu() for ITS TRD2 geometries. Trapezoid with the 
386     // x and y dimension varing along z. It has 5 parameters. See SetScale() 
387     // for units. Default units are geant 3 [cm].
388     // Inputs:
389     //    const char *gnam  3 character geant volume name. The letter "I"
390     //                        is appended to the front to indecate that this
391     //                        is an ITS volume.
392     //    TString &dis        String containging part discription.
393     //    Double_t dxn        half-length along x at the z surface positioned 
394     //                        at -DZ
395     //    Double_t dxp        half-length along x at the z surface positioned 
396     //                        at +DZ
397     //    Double_t dyn        half-length along x at the z surface positioned 
398     //                        at -DZ
399     //    Double_t dyp        half-length along x at the z surface positioned 
400     //                        at +DZ
401     //    Double_t dz         half-length along the z-axis
402     //    Int_t    med        media index number.
403     // Output:
404     //    none.
405     // Return.
406     //    none.
407     char name[5];
408     Float_t param[5];
409
410     AddVolName(dis);
411     param[0] = fScale*dxn;
412     param[1] = fScale*dxp;
413     param[2] = fScale*dyn;
414     param[3] = fScale*dyp;
415     param[4] = fScale*dz;
416     G3name(gnam,name);
417     gMC->Gsvolu(name,"TRD2",GetMed(med),param,5);
418 }
419 //______________________________________________________________________
420 void AliITSBaseGeometry::Trapezoid2(AliITSTrapezoid2Data &d,Int_t med){
421     // Interface to TMC->Gsvolu() for ITS TRD2 geometries. Trapezoid with the 
422     // x and y dimension varing along z. It has 5 parameters. See SetScale() 
423     // for units. Default units are geant 3 [cm].
424     // Inputs:
425     //    AliITSTrapezoid2Data &d   Structure with the Trapazoid data in it.
426     //    Int_t                med  media index number.
427     // Output:
428     //    none.
429     // Return.
430     //    none.
431     char name[5];
432     Float_t param[5];
433     Int_t i,k;
434     char *j = (char *) &k;
435
436     param[0] = fScale*d.DxAt(0);
437     param[1] = fScale*d.DxAt(1);
438     param[2] = fScale*d.DyAt(0);
439     param[3] = fScale*d.DyAt(1);
440     param[4] = fScale*d.DzAt();
441     d.SetVid(AddVolName((d.GetName())->Data()));
442     k = ITSIndexToITSG3name(d.GetVid());
443     for(i=0;i<4;i++) name[i] = j[i];
444     name[4] = '\0';
445     gMC->Gsvolu(name,"TRD2",GetMed(med),param,5);
446 }
447 //______________________________________________________________________
448 void AliITSBaseGeometry::Trapezoid(const char *gnam,const TString &dis,
449                                    Double_t dz,Double_t thet,Double_t phi,
450                                    Double_t h1,Double_t bl1,Double_t tl1,
451                                    Double_t alp1,Double_t h2,Double_t bl2,
452                                    Double_t tl2,Double_t alp2,Int_t med){
453     // Interface to TMC->Gsvolu() for ITS TRAP geometries. General Trapezoid, 
454     // The faces perpendicular to z are trapezia and their centers are not 
455     // necessarily on a line parallel to the z axis. This shape has 11 
456     // parameters, but only cosidering that the faces should be planar, only
457     // 9 are really independent. A check is performed on the user parameters 
458     // and a message is printed in case of non-planar faces. Ignoring this
459     // warning may cause unpredictable effects at tracking time. See 
460     // SetScale() for units. Default units are geant 3 [cm].
461     // Inputs:
462     //    const char *gnam  3 character geant volume name. The letter "I"
463     //                        is appended to the front to indecate that this
464     //                        is an ITS volume.
465     //    TString &dis        String containging part discription.
466     //    Double_t dz         Half-length along the z-asix
467     //    Double_t thet       Polar angle of the line joing the center of the 
468     //                        face at -dz to the center of the one at dz 
469     //                        [degree].
470     //    Double_t phi        aximuthal angle of the line joing the center of 
471     //                        the face at -dz to the center of the one at +dz 
472     //                        [degree].
473     //    Double_t h1         half-length along y of the face at -dz.
474     //    Double_t bl1        half-length along x of the side at -h1 in y of 
475     //                        the face at -dz in z.
476     //    Double_t tl1        half-length along x of teh side at +h1 in y of 
477     //                        the face at -dz in z.
478     //    Double_t alp1       angle with respect to the y axis from the 
479     //                        center of the side at -h1 in y to the cetner 
480     //                        of the side at +h1 in y of the face at -dz in z 
481     //                        [degree].
482     //    Double_t h2         half-length along y of the face at +dz
483     //    Double_t bl2        half-length along x of the side at -h2 in y of
484     //                        the face at +dz in z.
485     //    Double_t tl2        half-length along x of the side at _h2 in y of 
486     //                        the face at +dz in z.
487     //    Double_t alp2       angle with respect to the y axis from the 
488     //                        center of the side at -h2 in y to the center 
489     //                        of the side at +h2 in y of the face at +dz in z 
490     //                        [degree].
491     //    Int_t    med        media index number.
492     // Output:
493     //    none.
494     // Return.
495     //    none.
496     char name[5];
497     Float_t param[11];
498
499     AddVolName(dis);
500     param[0] = fScale*dz;
501     param[1] = thet;
502     param[2] = phi;
503     param[3] = fScale*h1;
504     param[4] = fScale*bl1;
505     param[5] = fScale*tl1;
506     param[6] = alp1;
507     param[7] = fScale*h2;
508     param[8] = fScale*bl2;
509     param[9] = fScale*tl2;
510     param[10] = alp2;
511     G3name(gnam,name);
512     gMC->Gsvolu(name,"TRAP",GetMed(med),param,11);
513 }
514 //______________________________________________________________________
515 void AliITSBaseGeometry::Trapezoid(AliITSTrapezoidData &d,Int_t med){
516     // Interface to TMC->Gsvolu() for ITS TRAP geometries. General Trapezoid, 
517     // The faces perpendicular to z are trapezia and their centers are not 
518     // necessarily on a line parallel to the z axis. This shape has 11 
519     // parameters, but only cosidering that the faces should be planar, only
520     // 9 are really independent. A check is performed on the user parameters 
521     // and a message is printed in case of non-planar faces. Ignoring this
522     // warning may cause unpredictable effects at tracking time. See 
523     // SetScale() for units. Default units are geant 3 [cm].
524     // Inputs:
525     //    AliITSTrapezoidData &d   Structure with the Trapazoid data in it.
526     //    Int_t    med        media index number.
527     // Output:
528     //    none.
529     // Return.
530     //    none.
531     char name[5];
532     Float_t param[11];
533     Int_t i,k;
534     char *j = (char *) &k;
535
536     param[0] = fScale*d.DzAt();
537     param[1] = d.Theta();
538     param[2] = d.Phi();
539     param[3] = fScale*d.HAt(0);
540     param[4] = fScale*d.Bl(0);
541     param[5] = fScale*d.Tl(0);
542     param[6] = d.Alpha(0);
543     param[7] = fScale*d.HAt(1);
544     param[8] = fScale*d.Bl(1);
545     param[9] = fScale*d.Tl(1);
546     param[10] = d.Alpha(1);
547     d.SetVid(AddVolName((d.GetName())->Data()));
548     k = ITSIndexToITSG3name(d.GetVid());
549     for(i=0;i<4;i++) name[i] = j[i];
550     name[4] = '\0';
551     gMC->Gsvolu(name,"TRAP",GetMed(med),param,11);
552 }
553 //______________________________________________________________________
554 void AliITSBaseGeometry::TwistedTrapezoid(const char *gnam,
555                                           const TString &dis,
556                                  Double_t dz,Double_t thet,Double_t phi,
557                                  Double_t twist,Double_t h1,Double_t bl1,
558                                  Double_t tl1,Double_t apl1,Double_t h2,
559                                  Double_t bl2,Double_t tl2,Double_t apl2,
560                                  Int_t med){
561     // Interface to TMC->Gsvolu() for ITS GTRA geometries. General twisted 
562     // trapazoid. The faces perpendicular to z are trapazia and their centers 
563     // are not necessarily on a line parallel to the z axis as the TRAP. 
564     // Additionally, the faces may be twisted so that none of their edges are 
565     // parallel. It is a TRAP shape, exept that it is twisted in the x-y 
566     // plane as a function of z. The parallel sides perpendicular to the x 
567     // axis are rotated with respect to the x axis by an angle TWIST, which 
568     // is one of the parameters. The shape is defined by the eight corners 
569     // and is assumed to be constructed of straight lines joingin points on 
570     // the boundry of the trapezoidal face at Z=-dz to the coresponding 
571     // points on the face at z=+dz. Divisions are not allowed. It has 12 
572     // parameters. See SetScale() for units. Default units are geant 3 [cm].
573     // Note: This shape suffers from the same limitations than the TRAP. The
574     // tracking routines assume that the faces are planar, but htis
575     // constraint is not easily expressed in terms of the 12 parameters. 
576     // Additionally, no check on th efaces is performed in this case. Users 
577     // should avoid to use this shape as much as possible, and if they have
578     // to do so, they should make sure that the faces are really planes. 
579     // If this is not the case, the result of the trasport is unpredictable. 
580     // To accelerat ethe computations necessary for trasport, 18 additioanl 
581     // parameters are calculated for this shape are 1 DXODZ dx/dz of the 
582     // line joing the centers of the faces at z=+_dz. 2 DYODZ dy/dz of the 
583     // line joing the centers of the faces at z=+_dz.
584     // 3 XO1    x at z=0 for line joing the + on parallel side, perpendicular 
585     //          corners at z=+_dz.
586     // 4 YO1    y at z=0 for line joing the + on parallel side, + on 
587     //          perpendicular corners at z=+-dz.
588     // 5 DXDZ1  dx/dz for line joing the + on parallel side, + on 
589     //          perpendicular corners at z=+-dz.
590     // 6 DYDZ1  dy/dz for line joing the + on parallel side, + on 
591     //          perpendicular corners at z=+-dz.
592     // 7 X02    x at z=0 for line joing the - on parallel side, + on 
593     //          perpendicular corners at z=+-dz.
594     // 8 YO2    y at z=0 for line joing the - on parallel side, + on 
595     //          perpendicular corners at z=+-dz.
596     // 9 DXDZ2  dx/dz for line joing the - on parallel side, + on 
597     //          perpendicular corners at z=+-dz.
598     // 10 DYDZ2dy/dz for line joing the - on parallel side, + on 
599     //          perpendicular corners at z=+-dz.
600     // 11 XO3   x at z=0 for line joing the - on parallel side, - on 
601     //          perpendicular corners at z=+-dz.
602     // 12 YO3   y at z=0 for line joing the - on parallel side, - on 
603     //          perpendicular corners at z=+-dz.
604     // 13 DXDZ3 dx/dzfor line joing the - on parallel side, - on 
605     //          perpendicular corners at z=+-dz.
606     // 14 DYDZ3 dydz for line joing the - on parallel side, - on 
607     //          perpendicular corners at z=+-dz.
608     // 15 XO4   x at z=0 for line joing the + on parallel side, - on 
609     //          perpendicular corners at z=+-dz.
610     // 16 YO4   y at z=0 for line joing the + on parallel side, - on 
611     //          perpendicular corners at z=+-dz.
612     // 17 DXDZ4 dx/dz for line joing the + on parallel side, - on 
613     //          perpendicular corners at z=+-dz.
614     // 18 DYDZ4 dydz for line joing the + on parallel side, - on 
615     //          perpendicular corners at z=+-dz.
616     // Inputs:
617     //    const char *gnam  3 character geant volume name. The letter "I"
618     //                        is appended to the front to indecate that this
619     //                        is an ITS volume.
620     //    TString &dis        String containging part discription.
621     //    Double_t dz         half-length along the z axis.
622     //    Double_t thet       polar angle of the line joing the center of the 
623     //                        face at -dz to the center of the one at +dz 
624     //                        [degrees].
625     //    Double_t phi        Azymuthal angle of teh line joing the centre of 
626     //                        the face at -dz to the center of the one at +dz 
627     //                        [degrees].
628     //    Double_t twist      Twist angle of the faces parallel to the x-y 
629     //                        plane at z=+-dz around an axis parallel to z 
630     //                        passing through their centre [degrees].
631     //    Double_t h1         Half-length along y of the face at -dz.
632     //    Double_t bl1        half-length along x of the side -h1 in y of the 
633     //                        face at -dz in z.
634     //    Double_t tl1        half-length along x of the side at +h1 in y of 
635     //                        the face at -dz in z.
636     //    Double_t apl1       Angle with respect to the y ais from the center 
637     //                        of the side at -h1 in y to the centere of the 
638     //                        side at +h1 in y of the face at -dz in z 
639     //                        [degrees].
640     //    Double_t h2         half-length along the face at +dz.
641     //    Double_t bl2        half-length along x of the side at -h2 in y of 
642     //                        the face at -dz in z.
643     //    Double_t tl2        half-length along x of the side at +h2 in y of 
644     //                        the face at +dz in z.
645     //    Double_t apl2       angle with respect to the y axis from the 
646     //                        center of the side at -h2 in y to the center 
647     //                        of the side at +h2 in y of the face at +dz in 
648     //                        z [degrees].
649     //    Int_t    med        media index number.
650     // Output:
651     //    none.
652     // Return.
653     //    none.
654     char name[5];
655     Float_t param[12];
656
657     AddVolName(dis);
658     param[0] = fScale*dz;
659     param[1] = thet;
660     param[2] = phi;
661     param[3] = twist;
662     param[4] = fScale*h1;
663     param[5] = fScale*bl1;
664     param[6] = fScale*tl1;
665     param[7] = apl1;
666     param[8] = fScale*h2;
667     param[9] = fScale*bl2;
668     param[10] = fScale*tl2;
669     param[11] = apl2;
670     G3name(gnam,name);
671     gMC->Gsvolu(name,"GTRA",GetMed(med),param,12);
672 }
673 //______________________________________________________________________
674 void AliITSBaseGeometry::TwistedTrapezoid(AliITSTrapezoidTwistedData &d,
675                                           Int_t med){
676     // Interface to TMC->Gsvolu() for ITS GTRA geometries. General twisted 
677     // trapazoid. The faces perpendicular to z are trapazia and their centers 
678     // are not necessarily on a line parallel to the z axis as the TRAP. 
679     // Additionally, the faces may be twisted so that none of their edges are 
680     // parallel. It is a TRAP shape, exept that it is twisted in the x-y 
681     // plane as a function of z. The parallel sides perpendicular to the x 
682     // axis are rotated with respect to the x axis by an angle TWIST, which 
683     // is one of the parameters. The shape is defined by the eight corners 
684     // and is assumed to be constructed of straight lines joingin points on 
685     // the boundry of the trapezoidal face at Z=-dz to the coresponding 
686     // points on the face at z=+dz. Divisions are not allowed. It has 12 
687     // parameters. See SetScale() for units. Default units are geant 3 [cm].
688     // Note: This shape suffers from the same limitations than the TRAP. The
689     // tracking routines assume that the faces are planar, but htis
690     // constraint is not easily expressed in terms of the 12 parameters. 
691     // Additionally, no check on th efaces is performed in this case. Users 
692     // should avoid to use this shape as much as possible, and if they have
693     // to do so, they should make sure that the faces are really planes. 
694     // If this is not the case, the result of the trasport is unpredictable. 
695     // To accelerat ethe computations necessary for trasport, 18 additioanl 
696     // parameters are calculated for this shape are 1 DXODZ dx/dz of the 
697     // line joing the centers of the faces at z=+_dz. 2 DYODZ dy/dz of the 
698     // line joing the centers of the faces at z=+_dz.
699     // 3 XO1    x at z=0 for line joing the + on parallel side, perpendicular 
700     //          corners at z=+_dz.
701     // 4 YO1    y at z=0 for line joing the + on parallel side, + on 
702     //          perpendicular corners at z=+-dz.
703     // 5 DXDZ1  dx/dz for line joing the + on parallel side, + on 
704     //          perpendicular corners at z=+-dz.
705     // 6 DYDZ1  dy/dz for line joing the + on parallel side, + on 
706     //          perpendicular corners at z=+-dz.
707     // 7 X02    x at z=0 for line joing the - on parallel side, + on 
708     //          perpendicular corners at z=+-dz.
709     // 8 YO2    y at z=0 for line joing the - on parallel side, + on 
710     //          perpendicular corners at z=+-dz.
711     // 9 DXDZ2  dx/dz for line joing the - on parallel side, + on 
712     //          perpendicular corners at z=+-dz.
713     // 10 DYDZ2dy/dz for line joing the - on parallel side, + on 
714     //          perpendicular corners at z=+-dz.
715     // 11 XO3   x at z=0 for line joing the - on parallel side, - on 
716     //          perpendicular corners at z=+-dz.
717     // 12 YO3   y at z=0 for line joing the - on parallel side, - on 
718     //          perpendicular corners at z=+-dz.
719     // 13 DXDZ3 dx/dzfor line joing the - on parallel side, - on 
720     //          perpendicular corners at z=+-dz.
721     // 14 DYDZ3 dydz for line joing the - on parallel side, - on 
722     //          perpendicular corners at z=+-dz.
723     // 15 XO4   x at z=0 for line joing the + on parallel side, - on 
724     //          perpendicular corners at z=+-dz.
725     // 16 YO4   y at z=0 for line joing the + on parallel side, - on 
726     //          perpendicular corners at z=+-dz.
727     // 17 DXDZ4 dx/dz for line joing the + on parallel side, - on 
728     //          perpendicular corners at z=+-dz.
729     // 18 DYDZ4 dydz for line joing the + on parallel side, - on 
730     //          perpendicular corners at z=+-dz.
731     // Inputs:
732     //    AliITSTrapezoidTwistedData &d   Structure with the tube parameters
733     //    Int_t                      med  media index number.
734     // Output:
735     //    none.
736     // Return.
737     //    none.
738     char name[5];
739     Float_t param[12];
740     Int_t i,k;
741     char *j = (char *) &k;
742
743     param[0] = fScale*d.DzAt();
744     param[1] = d.Theta();
745     param[2] = d.Phi();
746     param[3] = d.Twist();
747     param[4] = fScale*d.HAt(0);
748     param[5] = fScale*d.Bl(0);
749     param[6] = fScale*d.Tl(0);
750     param[7] = d.Alpha(0);
751     param[8] = fScale*d.HAt(1);
752     param[9] = fScale*d.Bl(1);
753     param[10] = fScale*d.Tl(1);
754     param[11] = d.Alpha(1);
755     d.SetVid(AddVolName((d.GetName())->Data()));
756     k = ITSIndexToITSG3name(d.GetVid());
757     for(i=0;i<4;i++) name[i] = j[i];
758     name[4] = '\0';
759     gMC->Gsvolu(name,"GTRA",GetMed(med),param,12);
760 }
761 //______________________________________________________________________
762 void AliITSBaseGeometry::Tube(const char *gnam,const TString &dis,
763                               Double_t rmin,Double_t rmax,Double_t dz,
764                               Int_t med){
765     // Interface to TMC->Gsvolu() for ITS TUBE geometries. Simple Tube. It has
766     // 3 parameters. See SetScale() 
767     // for units. Default units are geant 3 [cm].
768     // Inputs:
769     //    const char *gnam  3 character geant volume name. The letter "I"
770     //                        is appended to the front to indecate that this
771     //                        is an ITS volume.
772     //    TString &dis        String containging part discription.
773     //    Double_t rmin       Inside Radius.
774     //    Double_t rmax       Outside Radius.
775     //    Double_t dz         half-length along the z-axis
776     //    Int_t    med        media index number.
777     // Output:
778     //    none.
779     // Return.
780     //    none.
781     char name[5];
782     Float_t param[3];
783
784     AddVolName(dis);
785     param[0] = fScale*rmin;
786     param[1] = fScale*rmax;
787     param[2] = fScale*dz;
788     G3name(gnam,name);
789     gMC->Gsvolu(name,"TUBE",GetMed(med),param,3);
790 }
791 //______________________________________________________________________
792 void AliITSBaseGeometry::Tube(AliITSTubeData &d,Int_t med){
793     // Interface to TMC->Gsvolu() for ITS TUBE geometries. Simple Tube. It has
794     // 3 parameters. See SetScale() 
795     // for units. Default units are geant 3 [cm].
796     // Inputs:
797     //    AliITSTubeData &d    Structure with the tube parameters
798     //    Int_t          med   media index number.
799     // Output:
800     //    none.
801     // Return.
802     //    none.
803     char name[5];
804     Float_t param[3];
805     Int_t i,k;
806     char *j = (char *) &k;
807
808     param[0] = fScale*d.Rmin();
809     param[1] = fScale*d.Rmax();
810     param[2] = fScale*d.DzAt();
811     d.SetVid(AddVolName((d.GetName())->Data()));
812     k = ITSIndexToITSG3name(d.GetVid());
813     for(i=0;i<4;i++) name[i] = j[i];
814     name[4] = '\0';
815     gMC->Gsvolu(name,"TUBE",GetMed(med),param,3);
816 }
817 //______________________________________________________________________
818 void AliITSBaseGeometry::TubeSegment(const char *gnam,const TString &dis,
819                                      Double_t rmin,Double_t rmax,Double_t dz,
820                                      Double_t phi1,Double_t phi2,Int_t med){
821     // Interface to TMC->Gsvolu() for ITS TUBE geometries. Phi segment of a 
822     // tube. It has 5  parameters. Phi1 should be smaller than phi2. If this
823     // is not the case, the system adds 360 degrees to phi2. See SetScale() 
824     // for units. Default units are geant 3 [cm].
825     // Inputs:
826     //    const char *gnam  3 character geant volume name. The letter "I"
827     //                        is appended to the front to indecate that this
828     //                        is an ITS volume.
829     //    TString &dis        String containging part discription.
830     //    Double_t rmin       Inside Radius.
831     //    Double_t rmax       Outside Radius.
832     //    Double_t dz         half-length along the z-axis
833     //    Double_t phi1       Starting angle of the segment [degree].
834     //    Double_t phi2       Ending angle of the segment [degree].
835     //    Int_t    med        media index number.
836     // Output:
837     //    none.
838     // Return.
839     //    none.
840     char name[5];
841     Float_t param[5];
842
843     AddVolName(dis);
844     param[0] = fScale*rmin;
845     param[1] = fScale*rmax;
846     param[2] = fScale*dz;
847     param[3] = phi1;
848     param[4] = phi2;
849     G3name(gnam,name);
850     gMC->Gsvolu(name,"TUBS",GetMed(med),param,5);
851 }
852 //______________________________________________________________________
853 void AliITSBaseGeometry::TubeSegment(AliITSTubeSegData &d,Int_t med){
854     // Interface to TMC->Gsvolu() for ITS TUBE geometries. Phi segment of a 
855     // tube. It has 5  parameters. Phi1 should be smaller than phi2. If this
856     // is not the case, the system adds 360 degrees to phi2. See SetScale() 
857     // for units. Default units are geant 3 [cm].
858     // Inputs:
859     //    AliITSTubeSegData &d   Structure with the tube parameters
860     //    Int_t             med  media index number.
861     // Output:
862     //    none.
863     // Return.
864     //    none.
865     char name[5];
866     Float_t param[5];
867     Int_t i,k;
868     char *j = (char *) &k;
869
870     param[0] = fScale*d.Rmin();
871     param[1] = fScale*d.Rmax();
872     param[2] = fScale*d.DzAt();
873     param[3] = d.Phi0();
874     param[4] = d.Phi1();
875     d.SetVid(AddVolName((d.GetName())->Data()));
876     k = ITSIndexToITSG3name(d.GetVid());
877     for(i=0;i<4;i++) name[i] = j[i];
878     name[4] = '\0';
879     gMC->Gsvolu(name,"TUBS",GetMed(med),param,5);
880 }
881 //______________________________________________________________________
882 void AliITSBaseGeometry::CutTube(const char *gnam,const TString &dis,
883                                  Double_t rmin,Double_t rmax,Double_t dz,
884                                  Double_t phi1,Double_t phi2,Double_t lx,
885                                  Double_t ly,Double_t lz,Double_t hx,
886                                  Double_t hy,Double_t hz,Int_t med){
887     // Interface to TMC->Gsvolu() for ITS CTUB geometries. Cut tube. A tube 
888     // cut at the extremities with planes not necessarily perpendicular to 
889     // the z axis. It has 11 parameters. See SetScale() for units. Default 
890     // units are geant 3 [cm]. phi1 should be smaller than phi2. If this is 
891     // not the case, the system adds 360 degrees to phi2.
892     // Inputs:
893     //    const char *gnam  3 character geant volume name. The letter "I"
894     //                        is appended to the front to indecate that this
895     //                        is an ITS volume.
896     //    TString &dis        String containging part discription.
897     //    Double_t rmin       Inner radius at z=0 where tube is narrowest.
898     //    Double_t rmax       Outer radius at z=0 where tube is narrowest.
899     //    Double_t dz         half-length along the z-axis
900     //    Double_t phi1       Starting angle of the segment [degree].
901     //    Double_t phi2       Ending angle of the segment [degree].
902     //    Double_t lx         x component of a unit vector perpendicular to 
903     //                        the face at -dz.
904     //    Double_t ly         y component of a unit vector perpendicular to 
905     //                        the face at -dz.
906     //    Double_t lz         z component of a unit vector perpendicular to 
907     //                        the face at -dz.
908     //    Double_t hx         x component of a unit vector perpendicular to 
909     //                        the face at +dz.
910     //    Double_t hy         y component of a unit vector perpendicular to 
911     //                        the face at +dz.
912     //    Double_t hz         z component of a unit vector perpendicular to 
913     //                        the face at +dz.
914     //    Int_t    med        media index number.
915     // Output:
916     //    none.
917     // Return.
918     //    none.
919     char name[5];
920     Float_t param[11];
921
922     AddVolName(dis);
923     param[0] = fScale*rmin;
924     param[1] = fScale*rmax;
925     param[2] = fScale*dz;
926     param[3] = phi1;
927     param[4] = phi2;
928     param[5] = lx;
929     param[6] = ly;
930     param[7] = lz;
931     param[8] = hx;
932     param[9] = hy;
933     param[10] = hz;
934     G3name(gnam,name);
935     gMC->Gsvolu(name,"CTUB",GetMed(med),param,11);
936 }
937 //______________________________________________________________________
938 void AliITSBaseGeometry::CutTube(AliITSTubeCutData &d,Int_t med){
939     // Interface to TMC->Gsvolu() for ITS CTUB geometries. Cut tube. A tube 
940     // cut at the extremities with planes not necessarily perpendicular to 
941     // the z axis. It has 11 parameters. See SetScale() for units. Default 
942     // units are geant 3 [cm]. phi1 should be smaller than phi2. If this is 
943     // not the case, the system adds 360 degrees to phi2.
944     // Inputs:
945     //    AliITSTubeCutData &d    Structure with the tube parameters
946     //    Int_t             med    media index number.
947     // Output:
948     //    none.
949     // Return.
950     //    none.
951     char name[5];
952     Float_t param[11];
953     Int_t i,k;
954     char *j = (char *) &k;
955
956     param[0] = fScale*d.Rmin();
957     param[1] = fScale*d.Rmax();
958     param[2] = fScale*d.DzAt();
959     param[3] = d.Phi0();
960     param[4] = d.Phi1();
961     param[5] = d.Normal(0,0);
962     param[6] = d.Normal(0,1);
963     param[7] = d.Normal(0,2);
964     param[8] = d.Normal(1,0);
965     param[9] = d.Normal(1,1);
966     param[10] = d.Normal(1,2);
967     d.SetVid(AddVolName((d.GetName())->Data()));
968     k = ITSIndexToITSG3name(d.GetVid());
969     for(i=0;i<4;i++) name[i] = j[i];
970     name[4] = '\0';
971     gMC->Gsvolu(name,"CTUB",GetMed(med),param,11);
972 }
973 //______________________________________________________________________
974 void AliITSBaseGeometry::TubeElliptical(const char *gnam,const TString &dis,
975                                Double_t p1,Double_t p2,Double_t dz,Int_t med){
976     // Interface to TMC->Gsvolu() for ITS ELTU geometries. Elliptical 
977     // cross-section Tube. It has 3 parameters. See SetScale() 
978     // for units. Default units are geant 3 [cm]. The equation of the surface 
979     // is x^2 * p1^-2 + y^2 * p2^-2 = 1.
980     // Inputs:
981     //    const char *gnam  3 character geant volume name. The letter "I"
982     //                        is appended to the front to indecate that this
983     //                        is an ITS volume.
984     //    TString &dis        String containging part discription.
985     //    Double_t p1         semi-axis of the elipse along x.
986     //    Double_t p2         semi-axis of the elipse along y.
987     //    Double_t dz         half-length along the z-axis
988     //    Int_t    med        media index number.
989     // Output:
990     //    none.
991     // Return.
992     //    none.
993     char name[5];
994     Float_t param[3];
995
996     AddVolName(dis);
997     param[0] = fScale*p1;
998     param[1] = fScale*p2;
999     param[2] = fScale*dz;
1000     G3name(gnam,name);
1001     gMC->Gsvolu(name,"ELTU",GetMed(med),param,3);
1002 }
1003 //______________________________________________________________________
1004 void AliITSBaseGeometry::TubeElliptical(AliITSTubeEllipticalData &d,
1005                                         Int_t med){
1006     // Interface to TMC->Gsvolu() for ITS ELTU geometries. Elliptical 
1007     // cross-section Tube. It has 3 parameters. See SetScale() 
1008     // for units. Default units are geant 3 [cm]. The equation of the surface 
1009     // is x^2 * p1^-2 + y^2 * p2^-2 = 1.
1010     // Inputs:
1011     //    AliITSTubeElipticData &d  Structure with the tube parameters
1012     //    Int_t                med  media index number.
1013     // Output:
1014     //    none.
1015     // Return.
1016     //    none.
1017     char name[5];
1018     Float_t param[3];
1019     Int_t i,k;
1020     char *j = (char *) &k;
1021
1022     param[0] = fScale*d.P0();
1023     param[1] = fScale*d.P1();
1024     param[2] = fScale*d.DzAt();
1025     d.SetVid(AddVolName((d.GetName())->Data()));
1026     k = ITSIndexToITSG3name(d.GetVid());
1027     for(i=0;i<4;i++) name[i] = j[i];
1028     name[4] = '\0';
1029     gMC->Gsvolu(name,"ELTU",GetMed(med),param,3);
1030 }
1031 //______________________________________________________________________
1032 void AliITSBaseGeometry::HyperbolicTube(const char *gnam,const TString &dis,
1033                                Double_t rmin,Double_t rmax,Double_t dz,
1034                                Double_t thet,Int_t med){
1035     // Interface to TMC->Gsvolu() for ITS HYPE geometries. Hyperbolic tube. 
1036     // Fore example the inner and outer surfaces are hyperboloids, as would 
1037     // be foumed by a system of cylinderical wires which were then rotated 
1038     // tangentially about their centers. It has 4 parameters. See SetScale() 
1039     // for units. Default units are geant 3 [cm]. The hyperbolic surfaces are 
1040     // given by r^2 = (ztan(thet)^2 + r(z=0)^2.
1041     // Inputs:
1042     //    const char *gnam  3 character geant volume name. The letter "I"
1043     //                        is appended to the front to indecate that this
1044     //                        is an ITS volume.
1045     //    TString &dis        String containging part discription.
1046     //    Double_t rmin       Inner radius at z=0 where tube is narrowest.
1047     //    Double_t rmax       Outer radius at z=0 where tube is narrowest.
1048     //    Double_t dz         half-length along the z-axis
1049     //    Double_t thet       stero angel of rotation of the two faces 
1050     //                       [degrees].
1051     //    Int_t    med        media index number.
1052     // Output:
1053     //    none.
1054     // Return.
1055     //    none.
1056     char name[5];
1057     Float_t param[4];
1058
1059     AddVolName(dis);
1060     param[0] = fScale*rmin;
1061     param[1] = fScale*rmax;
1062     param[2] = fScale*dz;
1063     param[3] = thet;
1064     G3name(gnam,name);
1065     gMC->Gsvolu(name,"HYPE",GetMed(med),param,4);
1066 }
1067 //______________________________________________________________________
1068 void AliITSBaseGeometry::HyperbolicTube(AliITSTubeHyperbolicData &d,
1069                                         Int_t med){
1070     // Interface to TMC->Gsvolu() for ITS HYPE geometries. Hyperbolic tube. 
1071     // Fore example the inner and outer surfaces are hyperboloids, as would 
1072     // be foumed by a system of cylinderical wires which were then rotated 
1073     // tangentially about their centers. It has 4 parameters. See SetScale() 
1074     // for units. Default units are geant 3 [cm]. The hyperbolic surfaces are 
1075     // given by r^2 = (ztan(thet)^2 + r(z=0)^2.
1076     // Inputs:
1077     //    AliITSTubeHyperbolicData &d  Structure with the tube parameters
1078     //    Int_t                    med  media index number.
1079     // Output:
1080     //    none.
1081     // Return.
1082     //    none.
1083     char name[5];
1084     Float_t param[4];
1085     Int_t i,k;
1086     char *j = (char *) &k;
1087
1088     param[0] = fScale*d.Rmin();
1089     param[1] = fScale*d.Rmax();
1090     param[2] = fScale*d.DzAt();
1091     param[3] = d.Theta();
1092     d.SetVid(AddVolName((d.GetName())->Data()));
1093     k = ITSIndexToITSG3name(d.GetVid());
1094     for(i=0;i<4;i++) name[i] = j[i];
1095     name[4] = '\0';
1096     gMC->Gsvolu(name,"HYPE",GetMed(med),param,4);
1097 }
1098 //______________________________________________________________________
1099 void AliITSBaseGeometry::Cone(const char *gnam,const TString &dis,
1100                               Double_t dz,Double_t rmin1,Double_t rmax1,
1101                               Double_t rmin2,Double_t rmax2,Int_t med){
1102     // Interface to TMC->Gsvolu() for ITS Cone geometries. Conical tube. It 
1103     // has 5 parameters. See SetScale() 
1104     // for units. Default units are geant 3 [cm].
1105     // Inputs:
1106     //    const char *gnam  3 character geant volume name. The letter "I"
1107     //                        is appended to the front to indecate that this
1108     //                        is an ITS volume.
1109     //    TString &dis        String containging part discription.
1110     //    Double_t dz         half-length along the z-axis
1111     //    Double_t rmin1      Inside Radius at -dz.
1112     //    Double_t rmax1      Outside Radius at -dz.
1113     //    Double_t rmin2      inside radius at +dz.
1114     //    Double_t rmax2      outside radius at +dz.
1115     //    Int_t    med        media index number.
1116     // Output:
1117     //    none.
1118     // Return.
1119     //    none.
1120     char name[5];
1121     Float_t param[5];
1122
1123     AddVolName(dis);
1124     param[0] = fScale*dz;
1125     param[1] = fScale*rmin1;
1126     param[2] = fScale*rmax1;
1127     param[3] = fScale*rmin2;
1128     param[4] = fScale*rmax2;
1129     G3name(gnam,name);
1130     gMC->Gsvolu(name,"CONS",GetMed(med),param,5);
1131 }
1132 //______________________________________________________________________
1133 void AliITSBaseGeometry::Cone(AliITSConeData &d,Int_t med){
1134     // Interface to TMC->Gsvolu() for ITS Cone geometries. Conical tube. It 
1135     // has 5 parameters. See SetScale() 
1136     // for units. Default units are geant 3 [cm].
1137     // Inputs:
1138     //    AliITSConeData &d  Structure with the tube parameters
1139     //    Int_t         med  media index number.
1140     // Output:
1141     //    none.
1142     // Return.
1143     //    none.
1144     char name[5];
1145     Float_t param[5];
1146     Int_t i,k;
1147     char *j = (char *) &k;
1148
1149     param[0] = fScale*d.DzAt();
1150     param[1] = fScale*d.Rmin0();
1151     param[2] = fScale*d.Rmax0();
1152     param[3] = fScale*d.Rmin1();
1153     param[4] = fScale*d.Rmax1();
1154     d.SetVid(AddVolName((d.GetName())->Data()));
1155     k = ITSIndexToITSG3name(d.GetVid());
1156     for(i=0;i<4;i++) name[i] = j[i];
1157     name[4] = '\0';
1158     gMC->Gsvolu(name,"CONS",GetMed(med),param,5);
1159 }
1160 //______________________________________________________________________
1161 void AliITSBaseGeometry::ConeSegment(const char *gnam,const TString &dis,
1162                                      Double_t dz,Double_t rmin1,
1163                                      Double_t rmax1,Double_t rmin2,
1164                                      Double_t rmax2,Double_t phi1,
1165                                      Double_t phi2,Int_t med){
1166     // Interface to TMC->Gsvolu() for ITS ConS geometries. One segment of a 
1167     // conical tube. It has 7 parameters. Phi1 should be smaller than phi2. 
1168     // If this is not the case, the system adds 360 degrees to phi2. See 
1169     // SetScale() for units. Default units are geant 3 [cm].
1170     // Inputs:
1171     //    const char *gnam  3 character geant volume name. The letter "I"
1172     //                        is appended to the front to indecate that 
1173     //                        this is an ITS volume.
1174     //    TString &dis        String containging part discription.
1175     //    Double_t dz         half-length along the z-axis
1176     //    Double_t rmin1      Inside Radius at -dz.
1177     //    Double_t rmax1      Outside Radius at -dz.
1178     //    Double_t rmin2      inside radius at +dz.
1179     //    Double_t rmax2      outside radius at +dz.
1180     //    Double_t phi1       Starting angle of the segment [degree].
1181     //    Double_t phi2       Ending angle of the segment [degree].
1182     //    Int_t    med        media index number.
1183     // Output:
1184     //    none.
1185     // Return.
1186     //    none.
1187     char name[5];
1188     Float_t param[7];
1189
1190     AddVolName(dis);
1191     param[0] = fScale*dz;
1192     param[1] = fScale*rmin1;
1193     param[2] = fScale*rmax1;
1194     param[3] = fScale*rmin2;
1195     param[4] = fScale*rmax2;
1196     param[5] = phi1;
1197     param[6] = phi2;
1198     G3name(gnam,name);
1199     gMC->Gsvolu(name,"CONS",GetMed(med),param,7);
1200 }
1201 //______________________________________________________________________
1202 void AliITSBaseGeometry::ConeSegment(AliITSConeSegData &d,Int_t med){
1203     // Interface to TMC->Gsvolu() for ITS ConS geometries. One segment of a 
1204     // conical tube. It has 7 parameters. Phi1 should be smaller than phi2. 
1205     // If this is not the case, the system adds 360 degrees to phi2. See 
1206     // SetScale() for units. Default units are geant 3 [cm].
1207     // Inputs:
1208     //    AliITSConeSegData &d   Structure with the tube parameters
1209     //    Int_t             med  media index number.
1210     // Output:
1211     //    none.
1212     // Return.
1213     //    none.
1214     char name[5];
1215     Float_t param[7];
1216     Int_t i,k;
1217     char *j = (char *) &k;
1218
1219     param[0] = fScale*d.DzAt();
1220     param[1] = fScale*d.Rmin0();
1221     param[2] = fScale*d.Rmax0();
1222     param[3] = fScale*d.Rmin1();
1223     param[4] = fScale*d.Rmax1();
1224     param[5] = d.Phi0();
1225     param[6] = d.Phi1();
1226     d.SetVid(AddVolName((d.GetName())->Data()));
1227     k = ITSIndexToITSG3name(d.GetVid());
1228     for(i=0;i<4;i++) name[i] = j[i];
1229     name[4] = '\0';
1230     gMC->Gsvolu(name,"CONS",GetMed(med),param,7);
1231 }
1232 //______________________________________________________________________
1233 void AliITSBaseGeometry::PolyCone(const char *gnam,const TString &dis,
1234                                   Double_t phi1,Double_t dphi,Int_t nz,
1235                                   Double_t *z,Double_t *rmin,Double_t *rmax,
1236                                   Int_t med){
1237     // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9 
1238     // parameters or more. See SetScale() for units. Default units are geant
1239     // 3 [cm].
1240     // Inputs:
1241     //    const char *gnam  3 character geant volume name. The letter "I"
1242     //                        is appended to the front to indecate that this
1243     //                        is an ITS volume.
1244     //    TString &dis        String containging part discription.
1245     //    Double_t phi1       the azimuthal angle at which the volume begins 
1246     //                        (angles are counted clouterclockwise) [degrees].
1247     //    Double_t dphi       opening angle of the volume, which extends from 
1248     //                        phi1 to phi1+dphi [degree].
1249     //    Int_t nz            number of planes perpendicular to the z axis 
1250     //                        where the dimension of the section is given - 
1251     //                        this number should be at least 2 and NP triples 
1252     //                        of number must follow.
1253     //    Double_t *z         Array [nz] of z coordinate of the section.
1254     //    Double_t *rmin      Array [nz] of radius of teh inner circle in the 
1255     //                        cross-section.
1256     //    Double_t *rmax      Array [nz] of radius of the outer circle in the 
1257     //                        cross-section.
1258     //    Int_t    med        media index number.
1259     // Output:
1260     //    none.
1261     // Return.
1262     //    none.
1263     char name[5];
1264     Float_t *param;
1265     Int_t n,i;
1266
1267     AddVolName(dis);
1268     n = 3+3*nz;
1269     param = new Float_t[n];
1270     param[0] = phi1;
1271     param[1] = dphi;
1272     param[2] = (Float_t) nz;
1273     for(i=0;i<nz;i++){
1274         param[3+3*i] = fScale*z[i];
1275         param[4+3*i] = fScale*rmin[i];
1276         param[5+3*i] = fScale*rmax[i];
1277     } // end for i
1278     G3name(gnam,name);
1279     gMC->Gsvolu(name,"PCON",GetMed(med),param,n);
1280
1281     delete[] param;
1282 }
1283 //______________________________________________________________________
1284 void AliITSBaseGeometry::PolyCone(AliITSPConeData &d,Int_t med){
1285     // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9 
1286     // parameters or more. See SetScale() for units. Default units are geant
1287     // 3 [cm].
1288     // Inputs:
1289     //    AliITSPConeData &d  Object with poly cone data stored in it.
1290     //    Int_t    med        media index number.
1291     // Output:
1292     //    none.
1293     // Return.
1294     //    none.
1295     char name[5];
1296     Float_t *param;
1297     Int_t n,i,k;
1298     char *j = (char *) &k;
1299
1300     n = 3+3*d.Nz();
1301     param = new Float_t[n];
1302     param[0] = d.Phi0();
1303     param[1] = d.DPhi();
1304     param[2] = (Float_t) d.Nz();
1305     for(i=0;i<d.Nz();i++){
1306         param[3+3*i] = fScale*d.ZAt(i);
1307         param[4+3*i] = fScale*d.Rmin(i);
1308         param[5+3*i] = fScale*d.Rmax(i);
1309     } // end for if
1310     d.SetVid(AddVolName((d.GetName())->Data()));
1311     k = ITSIndexToITSG3name(d.GetVid());
1312     for(i=0;i<4;i++) name[i] = j[i];
1313     name[4] = '\0';
1314     gMC->Gsvolu(name,"PCON",GetMed(med),param,n);
1315
1316     delete[] param;
1317 }
1318 //______________________________________________________________________
1319 void AliITSBaseGeometry::Sphere(const char *gnam,const TString &dis,
1320                                 Double_t rmin,Double_t rmax,Double_t the1,
1321                                 Double_t the2,Double_t phi1,Double_t phi2,
1322                                 Int_t med){
1323     // Interface to TMC->Gsvolu() for ITS SPHE geometries. Segment of a 
1324     // sphereical shell. It has 6 parameters. See SetScale() 
1325     // for units. Default units are geant 3 [cm].
1326     // Inputs:
1327     //    const char *gnam  3 character geant volume name. The letter "I"
1328     //                        is appended to the front to indecate that this
1329     //                        is an ITS volume.
1330     //    TString &dis        String containging part discription.
1331     //    Double_t rmin       Inside Radius.
1332     //    Double_t rmax       Outside Radius.
1333     //    Double_t the1       staring polar angle of the shell [degree].
1334     //    Double_t the2       ending polar angle of the shell [degree].
1335     //    Double_t phui       staring asimuthal angle of the shell [degree].
1336     //    Double_t phi2       ending asimuthal angle of the shell [degree].
1337     //    Int_t    med        media index number.
1338     // Output:
1339     //    none.
1340     // Return.
1341     //    none.
1342     char name[5];
1343     Float_t param[6];
1344
1345     AddVolName(dis);
1346     param[0] = fScale*rmin;
1347     param[1] = fScale*rmax;
1348     param[2] = the1;
1349     param[3] = the2;
1350     param[4] = phi1;
1351     param[5] = phi2;
1352     G3name(gnam,name);
1353     gMC->Gsvolu(name,"SPHE",GetMed(med),param,6);
1354 }
1355 //______________________________________________________________________
1356 void AliITSBaseGeometry::Sphere(AliITSSphereData &d,Int_t med){
1357     // Interface to TMC->Gsvolu() for ITS SPHE geometries. Segment of a 
1358     // sphereical shell. It has 6 parameters. See SetScale() 
1359     // for units. Default units are geant 3 [cm].
1360     // Inputs:
1361     //    AliITSSphereData &d   Structure with the tube parameters
1362     //    Int_t            med  media index number.
1363     // Output:
1364     //    none.
1365     // Return.
1366     //    none.
1367     char name[5];
1368     Float_t param[6];
1369     Int_t i,k;
1370     char *j = (char *) &k;
1371
1372     param[0] = fScale*d.Rmin();
1373     param[1] = fScale*d.Rmax();
1374     param[2] = d.Theta0();
1375     param[3] = d.Theta1();
1376     param[4] = d.Phi0();
1377     param[5] = d.Phi1();
1378     d.SetVid(AddVolName((d.GetName())->Data()));
1379     k = ITSIndexToITSG3name(d.GetVid());
1380     for(i=0;i<4;i++) name[i] = j[i];
1381     name[4] = '\0';
1382     gMC->Gsvolu(name,"SPHE",GetMed(med),param,6);
1383 }
1384 //______________________________________________________________________
1385 void AliITSBaseGeometry::Parallelepiped(const char *gnam,const TString &dis,
1386                                         Double_t dx,Double_t dy,Double_t dz,
1387                                         Double_t alpha,Double_t thet,
1388                                         Double_t phi,Int_t med){
1389     // Interface to TMC->Gsvolu() for ITS PARA geometries. Parallelepiped. It 
1390     // has 6 parameters. See SetScale() for units. Default units are geant 3 
1391     // [cm].
1392     // Inputs:
1393     //    const char *gnam  3 character geant volume name. The letter "I"
1394     //                        is appended to the front to indecate that this
1395     //                        is an ITS volume.
1396     //    TString &dis        String containging part discription.
1397     //    Double_t dx         half-length allong x-axis
1398     //    Double_t dy         half-length allong y-axis
1399     //    Double_t dz         half-length allong z-axis
1400     //    Double_t alpha      angle formed by the y axis and by the plane 
1401     //                        joining the center of teh faces parallel to the 
1402     //                        z-x plane at -dY and +dy [degree].
1403     //    Double_t thet       polar angle of the line joining the centers of 
1404     //                        the faces at -dz and +dz in z [degree].
1405     //    Double_t phi        azimuthal angle of teh line joing the centers 
1406     //                        of the faaces at -dz and +dz in z [degree].
1407     //    Int_t    med        media index number.
1408     // Output:
1409     //    none.
1410     // Return.
1411     //    none.
1412     char name[5];
1413     Float_t param[6];
1414
1415     AddVolName(dis);
1416     param[0] = fScale*dx;
1417     param[1] = fScale*dy;
1418     param[2] = fScale*dz;
1419     param[3] = alpha;
1420     param[4] = thet;
1421     param[5] = phi;
1422     G3name(gnam,name);
1423     gMC->Gsvolu(name,"PARA",GetMed(med),param,6);
1424 }
1425 //______________________________________________________________________
1426 void AliITSBaseGeometry::Parallelepiped(AliITSParallelpipedData &d,Int_t med){
1427     // Interface to TMC->Gsvolu() for ITS PARA geometries. Parallelepiped. It 
1428     // has 6 parameters. See SetScale() for units. Default units are geant 3 
1429     // [cm].
1430     // Inputs:
1431     //    AliITSParrellepipedData &d  Structre witht the volume data in it.
1432     //    Int_t                   med  media index number.
1433     // Output:
1434     //    none.
1435     // Return.
1436     //    none.
1437     char name[5];
1438     Float_t param[6];
1439     Int_t i,k;
1440     char *j = (char *) &k;
1441
1442     param[0] = fScale*d.DxAt();
1443     param[1] = fScale*d.DyAt();
1444     param[2] = fScale*d.DzAt();
1445     param[3] = d.Alpha();
1446     param[4] = d.Theta();
1447     param[5] = d.Phi();
1448     d.SetVid(AddVolName((d.GetName())->Data()));
1449     k = ITSIndexToITSG3name(d.GetVid());
1450     for(i=0;i<4;i++) name[i] = j[i];
1451     name[4] = '\0';
1452     gMC->Gsvolu(name,"PARA",GetMed(med),param,6);
1453 }
1454 //______________________________________________________________________
1455 void AliITSBaseGeometry::PolyGon(const char *gnam,const TString &dis,
1456                                  Double_t phi1,Double_t dphi,Int_t npdv,
1457                                  Int_t nz,Double_t *z,Double_t *rmin,
1458                                  Double_t *rmax,Int_t med){
1459     // Interface to TMC->Gsvolu() for ITS PGON geometry. Polygon It has 10 
1460     // parameters or more. See SetScale() for units. Default units are geant
1461     // 3 [cm].
1462     // Inputs:
1463     //    const char *gnam  3 character geant volume name. The letter "I"
1464     //                        is appended to the front to indecate that this
1465     //                        is an ITS volume.
1466     //    TString &dis        String containging part discription.
1467     //    Double_t phi1       the azimuthal angle at which the volume begins 
1468     //                        (angles are counted clouterclockwise) [degrees].
1469     //    Double_t dphi       opening angle of the volume, which extends from 
1470     //                        phi1 to phi1+dphi [degree].
1471     //    Int_t npdv          the number of sides of teh cross section 
1472     //                        between the given phi limits.
1473     //    Int_t nz            number of planes perpendicular to the z axis 
1474     //                        where the dimension of the section is given - 
1475     //                        this number should be at least 2 and NP triples 
1476     //                        of number must follow.
1477     //    Double_t *z         array [nz] of z coordiates of the sections..
1478     //    Double_t *rmin      array [nz] of radius of teh circle tangent to 
1479     //                        the sides of the inner polygon in teh 
1480     //                        cross-section.
1481     //    Double_t *rmax      array [nz] of radius of the circle tangent to 
1482     //                        the sides of the outer polygon in the 
1483     //                       cross-section.
1484     //    Int_t    med        media index number.
1485     // Output:
1486     //    none.
1487     // Return.
1488     //    none.
1489     char name[5];
1490     Float_t *param;
1491     Int_t n,i;
1492
1493     AddVolName(dis);
1494     n = 4+3*nz;
1495     param = new Float_t[n];
1496     param[0] = phi1;
1497     param[1] = dphi;
1498     param[2] = (Float_t)npdv;
1499     param[3] = (Float_t)nz;
1500     for(i=0;i<nz;i++){
1501         param[4+3*i] = fScale*z[i];
1502         param[5+3*i] = fScale*rmin[i];
1503         param[6+3*i] = fScale*rmax[i];
1504     } // end for i
1505     G3name(gnam,name);
1506     gMC->Gsvolu(name,"PGON",GetMed(med),param,n);
1507
1508     delete[] param;
1509 }
1510 //______________________________________________________________________
1511 void AliITSBaseGeometry::PolyGon(AliITSPGonData &d,Int_t med){
1512     // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9 
1513     // parameters or more. See SetScale() for units. Default units are geant
1514     // 3 [cm].
1515     // Inputs:
1516     //    AliITSPGonData &d  Object with poly cone data stored in it.
1517     //    Int_t    med        media index number.
1518     // Output:
1519     //    none.
1520     // Return.
1521     //    none.
1522     char name[5];
1523     Float_t *param;
1524     Int_t n,i,k;
1525     char *j = (char *) &k;
1526
1527     n = 4+3*d.Nz();
1528     param = new Float_t[n];
1529     param[0] = d.Phi0();
1530     param[1] = d.DPhi();
1531     param[2] = (Float_t) d.NPhi();
1532     param[3] = (Float_t) d.Nz();
1533     for(i=0;i<d.Nz();i++){
1534         param[4+3*i] = fScale*d.ZAt(i);
1535         param[5+3*i] = fScale*d.Rmin(i);
1536         param[6+3*i] = fScale*d.Rmax(i);
1537     } // end for i
1538     d.SetVid(AddVolName((d.GetName())->Data()));
1539     k = ITSIndexToITSG3name(d.GetVid());
1540     for(i=0;i<4;i++) name[i] = j[i];
1541     name[4] = '\0';
1542     gMC->Gsvolu(name,"PGON",GetMed(med),param,n);
1543
1544     delete[] param;
1545 }
1546 //______________________________________________________________________
1547 void AliITSBaseGeometry::Pos(AliITSBaseVolParams &v,Int_t cn,
1548                              AliITSBaseVolParams &m,
1549                              TVector3 &t,Int_t irot){
1550     // Place a copy of a volume previously defined by a call to GSVOLU inside 
1551     // its mother volulme moth.
1552     // Inputs:
1553     //   const char vol[3]  3 character geant volume name. The letter "I"
1554     //                      is appended to the front to indecate that this
1555     //                      is an ITS volume.
1556     //   const char moth[3] 3 character geant volume name of the mother 
1557     //                      volume in which vol will be placed. The letter 
1558     //                      "I" is appended to the front to indecate that 
1559     //                      this is an ITS volume.
1560     //   Double_t x         The x positon of the volume in the mother's 
1561     //                      reference system
1562     //   Double_t y         The y positon of the volume in the mother's 
1563     //                      reference system
1564     //   Double_t z         The z positon of the volume in the mother's 
1565     //                      reference system
1566     //   Int_t irot         the index for the rotation matrix to be used.
1567     //                      irot=-1 => unit rotation.
1568     // Outputs:
1569     //    none.
1570     // Return:
1571     //    none.
1572     char name[5],mother[5];
1573     Float_t param[3];
1574     Int_t r=0,i;
1575     char *n = (char*)&r;
1576
1577     param[0] = fScale*t.X();
1578     param[1] = fScale*t.Y();
1579     param[2] = fScale*t.Z();
1580     r = ITSIndexToITSG3name(v.GetVid());
1581     for(i=0;i<4;i++) name[i] = n[i]; name[4] ='\0';
1582     r = ITSIndexToITSG3name(m.GetVid());
1583     for(i=0;i<4;i++) mother[i] = n[i]; mother[4] ='\0';
1584     if(irot>0) r = fidrot[irot]; else r=0;
1585     gMC->Gspos(name,cn,mother,param[0],param[1],param[2],r,"ONLY");
1586 }
1587 //______________________________________________________________________
1588 void AliITSBaseGeometry::Pos(const char *vol,Int_t cn,const char *moth,
1589                              Double_t x,Double_t y,Double_t z,Int_t irot){
1590     // Place a copy of a volume previously defined by a call to GSVOLU inside 
1591     // its mother volulme moth.
1592     // Inputs:
1593     //   const char vol[3]  3 character geant volume name. The letter "I"
1594     //                      is appended to the front to indecate that this
1595     //                      is an ITS volume.
1596     //   const char moth[3] 3 character geant volume name of the mother 
1597     //                      volume in which vol will be placed. The letter 
1598     //                      "I" is appended to the front to indecate that 
1599     //                      this is an ITS volume.
1600     //   Double_t x         The x positon of the volume in the mother's 
1601     //                      reference system
1602     //   Double_t y         The y positon of the volume in the mother's 
1603     //                      reference system
1604     //   Double_t z         The z positon of the volume in the mother's 
1605     //                      reference system
1606     //   Int_t irot         the index for the rotation matrix to be used.
1607     //                      irot=-1 => unit rotation.
1608     // Outputs:
1609     //    none.
1610     // Return:
1611     //    none.
1612     char name[5],mother[5];
1613     Float_t param[3];
1614     Int_t r=0;
1615
1616     param[0] = fScale*x;
1617     param[1] = fScale*y;
1618     param[2] = fScale*z;
1619     G3name(vol,name);
1620     G3name(moth,mother);
1621     if(irot>0) r = fidrot[irot];
1622     gMC->Gspos(name,cn,mother,param[0],param[1],param[2],r,"ONLY");
1623 }
1624 //______________________________________________________________________
1625 void AliITSBaseGeometry::Matrix(Int_t irot,Double_t thet1,Double_t phi1,
1626                        Double_t thet2,Double_t phi2,
1627                        Double_t thet3,Double_t phi3){
1628     // Defines a Geant rotation matrix. checks to see if it is the unit
1629     // matrix. If so, then no additonal matrix is defined. Stores rotation 
1630     // matrix irot in the data structure JROTM. If the matrix is not 
1631     // orthonormal, it will be corrected by setting y' perpendicular to x' 
1632     // and z' = x' X y'. A warning message is printed in this case.
1633     // Inputs:
1634     //   Int_t irot     Intex specifing which rotation matrix.
1635     //   Double_t thet1 Polar angle for axisw x [degrees].
1636     //   Double_t phi1  azimuthal angle for axis x [degrees].
1637     //   Double_t thet12Polar angle for axisw y [degrees].
1638     //   Double_t phi2  azimuthal angle for axis y [degrees].
1639     //   Double_t thet3 Polar angle for axisw z [degrees].
1640     //   Double_t phi3  azimuthal angle for axis z [degrees].
1641     // Outputs:
1642     //    none.
1643     // Return:
1644     //    none.
1645     Float_t t1=0.0,p1=0.0,t2=0.0,p2=0.0,t3=0.0,p3=0.0;
1646
1647     if(thet1==90.0&&phi1== 0.0&&
1648        thet2==90.0&&phi2==90.0&&
1649        thet3== 0.0&&phi3== 0.0){
1650         fidrot[irot] = 0; // Unit matrix
1651     }else{
1652         t1 = thet1;
1653         p1 = phi1;
1654         t2 = thet2;
1655         p2 = phi2;
1656         t3 = thet3;
1657         p3 = phi3;
1658         fits->AliMatrix(fidrot[irot],t1,p1,t2,p2,t3,p3);
1659     } // end if
1660     cout << "Matrix:: fidrot["<<irot<<"]="<<fidrot[irot];
1661     cout <<" angles="<<t1<<" "<<p1<<" "<<t2<<" "<<p2<<" "<<t3<< " "<<p3<<endl;
1662 }
1663 //______________________________________________________________________
1664 void AliITSBaseGeometry::Matrix(Int_t irot,Int_t axis,Double_t thet){
1665     // Defines a Geant rotation matrix. checks to see if it is the unit
1666     // matrix. If so, then no additonal matrix is defined. Stores rotation 
1667     // matrix irot in the data structure JROTM. If the matrix is not 
1668     // orthonormal, it will be corrected by setting y' perpendicular to x' 
1669     // and z' = x' X y'. A warning message is printed in this case.
1670     // Inputs:
1671     //   Int_t irot         Intex specifing which rotation matrix.
1672     //   Int_t axis         Axis about which rotation is to be done.
1673     //   Double_t thet      Angle to rotate by [degrees].
1674     // Outputs:
1675     //    none.
1676     // Return:
1677     //    none.
1678
1679     if(thet==0.0){
1680         fidrot[irot] = 0; // Unit matrix
1681     }else{
1682         switch (axis) {
1683         case 0: //Rotate about x-axis, x-axis does not change.
1684             fits->AliMatrix(fidrot[irot],90.0,0.0,90.0+thet,90.0,thet,90.0);
1685             /*
1686             cout << "Matrix:: axis="<<axis<<" fidrot["<<irot<<"]=";
1687             cout <<fidrot[irot];
1688             cout <<" angles="<<90.0<<" "<<0.0<<" "<<90.0+thet<<" "<<90.0;
1689             cout <<" "<<thet<< " "<<90.0<<endl;
1690             */
1691             break;
1692         case 1: //Rotate about y-axis, y-axis does not change.
1693             fits->AliMatrix(fidrot[irot],90.0-thet,0.0,90.0,90.0,-thet,0.0);
1694             /*
1695             cout << "Matrix:: axis="<<axis<<" fidrot["<<irot<<"]=";
1696             cout << fidrot[irot];
1697             cout <<" angles="<<90.-thet<<" "<<0.0<<" "<<90.0<<" "<<90.0;
1698             cout <<" "<<-thet<< " "<<0.0<<endl;
1699             */
1700             break;
1701         case 2: //Rotate about z-axis, z-axis does not change.
1702             fits->AliMatrix(fidrot[irot],90.0,thet,90.0,90.+thet,0.0,0.0);
1703             /*
1704             cout << "Matrix:: axis="<<axis<<" fidrot["<<irot<<"]=";
1705             cout <<fidrot[irot];
1706             cout <<" angles="<<90.0<<" "<<thet<<" "<<90.0<<" "<<90.0+thet;
1707             cout <<" "<<0.0<< " "<<0.0<<endl;
1708             */
1709             break;
1710         default:
1711             Error("Matrix","axis must be either 0, 1, or 2. for matrix=%d",
1712                   irot);
1713             /*
1714             cout << "Matrix:: axis="<<axis<<" fidrot["<<irot<<"]=";
1715             cout <<fidrot[irot];
1716             cout <<" thet=" << thet<< endl;
1717             */
1718             break;
1719         } // end switch
1720     } // end if
1721 }
1722 //______________________________________________________________________
1723 void AliITSBaseGeometry::Matrix(Int_t irot,Double_t rot[3][3]){
1724     // Defines a Geant rotation matrix. checks to see if it is the unit
1725     // matrix. If so, then no additonal matrix is defined. Stores rotation 
1726     // matrix irot in the data structure JROTM. If the matrix is not 
1727     // orthonormal, it will be corrected by setting y' perpendicular to x' 
1728     // and z' = x' X y'. A warning message is printed in this case.
1729     // Inputs:
1730     //   Int_t irot         Intex specifing which rotation matrix.
1731     //   Double_t rot[3][3] The 3 by 3 rotation matrix.
1732     // Outputs:
1733     //    none.
1734     // Return:
1735     //    none.
1736         Double_t si,c=180./TMath::Pi();
1737         Double_t ang[6]={90.0,0.0,90.0,90.0,0.0,0.0};
1738
1739     if(rot[0][0]==1.0&&rot[1][1]==1.0&&rot[2][2]==1.0&&
1740        rot[0][1]==0.0&&rot[0][2]==0.0&&rot[1][0]==0.0&&
1741        rot[1][2]==0.0&&rot[2][0]==0.0&&rot[2][1]==0.0){
1742         fidrot[irot] = 0; // Unit matrix
1743     }else{
1744         ang[1] = TMath::ATan2(rot[0][1],rot[0][0]);
1745         if(TMath::Cos(ang[1])!=0.0) si = rot[0][0]/TMath::Cos(ang[1]);
1746         else si = rot[0][1]/TMath::Sin(ang[1]);
1747         ang[0] = TMath::ATan2(si,rot[0][2]);
1748
1749         ang[3] = TMath::ATan2(rot[1][1],rot[1][0]);
1750         if(TMath::Cos(ang[3])!=0.0) si = rot[1][0]/TMath::Cos(ang[3]);
1751         else si = rot[1][1]/TMath::Sin(ang[3]);
1752         ang[2] = TMath::ATan2(si,rot[1][2]);
1753
1754         ang[5] = TMath::ATan2(rot[2][1],rot[2][0]);
1755         if(TMath::Cos(ang[5])!=0.0) si = rot[2][0]/TMath::Cos(ang[5]);
1756         else si = rot[2][1]/TMath::Sin(ang[5]);
1757         ang[4] = TMath::ATan2(si,rot[2][2]);
1758
1759         for(Int_t i=0;i<6;i++) {ang[i] *= c; if(ang[i]<0.0) ang[i] += 360.;}
1760         fits->AliMatrix(fidrot[irot],ang[0],ang[1],ang[2],ang[3],
1761                         ang[4],ang[5]);
1762     } // end if
1763     cout << "Matrix rot[3][3]:: fidrot["<<irot<<"]="<<fidrot[irot];
1764     cout <<" angles="<<ang[0]<<" "<<ang[1]<<" "<<ang[2]<<" "<<
1765         ang[3]<<" "<<ang[4]<< " "<<ang[5]<<endl;
1766 }
1767 //______________________________________________________________________
1768 Float_t AliITSBaseGeometry::GetA(Int_t z){
1769     // Returns the isotopicaly averaged atomic number.
1770     // Inputs:
1771     //    Int_t z  Elemental number
1772     // Outputs:
1773     //    none.
1774     // Return:
1775     //    The atomic mass number.
1776     const Float_t A[]={
1777           1.00794 ,  4.0026902,  6.941   ,  9.012182 , 10.811   , // H-B
1778          12.01007 , 14.00674  , 15.9994  , 18.9984032, 20.1797  , // C-Ne
1779          22.98970 , 24.3050   , 26.981538, 28.0855   , 30.973761, // Na-P
1780          32.066   , 35.4527   , 39.948   , 39.0983   , 40.078   , // S-Ca
1781          44.95591 , 47.867    , 50.9415  , 51.9961   , 54.938049, // Sc-Mn
1782          55.845   , 58.933200 , 58.6934  , 63.546    , 65.39    , // Fe-Zn
1783          69.723   , 72.61     , 74.92160 , 78.96     , 79.904   , // Ga-Br
1784          83.80    , 85.4678   , 87.62    , 88.9085   , 91.224   , // Kr-Zr
1785          92.90638 , 95.94     , 97.907215, 101.07    ,102.90550 , // Nb-Rh
1786         106.42    ,107.8682   ,112.411   ,114.818    ,118.710   , // Pd-Sn
1787         121.760   ,127.60     ,126.90447 ,131.29     ,132.90545 , // Sb-Cs
1788         137.327   ,138.9055   ,140.116   ,140.90765  ,144.24    , // La-Nd
1789         144.912746,150.36     ,151.964   ,157.25     ,158.92534 , // Pm-Tb
1790         162.50    ,164.93032  ,167.26    ,168.93421  ,173.04    , // Dy-Yb
1791         174.967   ,178.49     ,180.9479 ,183.84      ,186.207   , // Lu-Re
1792         190.23    ,192.217    ,195.078  ,196.96655   ,200.59    , // Os-Hg
1793         204.3833  ,207.2      ,208.98038,208.982415  ,209.987131, // Tl-At
1794         222.017570,223.019731 ,226.025402,227.027747 ,232.0381  , // Rn-Th
1795         231.03588 ,238.0289   }; // Pa,U
1796
1797     if(z<1||z>92){
1798         Error("GetA","z must be 0<z<93. z=%d",z);
1799         return 0.0;
1800     } // end if
1801     return A[z-1];
1802 }
1803 //______________________________________________________________________
1804 Float_t AliITSBaseGeometry::GetStandardMaxStepSize(Int_t istd){
1805     // Returns one of a set of standard Maximum Step Size values.
1806     // Inputs:
1807     //   Int_t istd  Index to indecate which standard.
1808     // Outputs:
1809     //    none.
1810     // Return:
1811     //    The appropreate standard Maximum Step Size value [cm].
1812     Float_t t[]={1.0, // default
1813                  0.0075, // Silicon detectors...
1814                  1.0, // Air in central detectors region
1815                  1.0  // Material in non-centeral region
1816     };
1817     return t[istd];
1818 }
1819 //______________________________________________________________________
1820 Float_t AliITSBaseGeometry::GetStandardThetaMax(Int_t istd){
1821     // Returns one of a set of standard Theata Max values.
1822     // Inputs:
1823     //   Int_t istd  Index to indecate which standard.
1824     // Outputs:
1825     //    none.
1826     // Return:
1827     //    The appropreate standard Theta max value [degrees].
1828     Float_t t[]={0.1, // default
1829                  0.1, // Silicon detectors...
1830                  0.1, // Air in central detectors region
1831                  1.0  // Material in non-centeral region
1832     };
1833     return t[istd];
1834 }
1835 //______________________________________________________________________
1836 Float_t AliITSBaseGeometry::GetStandardEfraction(Int_t istd){
1837     // Returns one of a set of standard E fraction values.
1838     // Inputs:
1839     //   Int_t istd  Index to indecate which standard.
1840     // Outputs:
1841     //    none.
1842     // Return:
1843     //    The appropreate standard E fraction value [#].
1844     Float_t t[]={0.1, // default
1845                  0.1, // Silicon detectors...
1846                  0.1, // Air in central detectors region
1847                  0.5  // Material in non-centeral region
1848     };
1849     return t[istd];
1850 }
1851 //______________________________________________________________________
1852 Float_t AliITSBaseGeometry::GetStandardEpsilon(Int_t istd){
1853     // Returns one of the standard Epsilon valuse
1854     // Inputs:
1855     //    Int_t istd  index of standard cuts to get
1856     // Output:
1857     //    none.
1858     // Return:
1859     //    Float_t the standard Epsilon cut value.
1860     Float_t t[]={1.0E-4, // default
1861                  1.0E-4, // Silicon detectors...
1862                  1.0E-4, // Air in central detector region
1863                  1.0E-3, // Material in non-cneteral regions
1864     };
1865
1866     return t[istd];
1867 }
1868 //______________________________________________________________________
1869 void AliITSBaseGeometry::Element(Int_t imat,const char* name,Int_t z,
1870                                  Double_t dens,Int_t istd){
1871     // Defines a Geant single element material and sets its Geant medium
1872     // proporties. The average atomic A is assumed to be given by their
1873     // natural abundances. Things like the radiation length are calculated
1874     // for you.
1875     // Inputs:
1876     //    Int_t imat       Material number.
1877     //    const char* name Material name. No need to add a $ at the end.
1878     //    Int_t z          The elemental number.
1879     //    Double_t dens    The density of the material [g/cm^3].
1880     //    Int_t istd       Defines which standard set of transport parameters
1881     //                     which should be used.
1882     // Output:
1883     //     none.
1884     // Return:
1885     //     none.
1886     Float_t rad,Z,A=GetA(z),tmax,stemax,deemax,epsilon;
1887     char *name2;
1888     Int_t len;
1889
1890     len = strlen(name)+1;
1891     name2 = new char[len];
1892     strncpy(name2,name,len-1);
1893     name2[len-1] = '\0';
1894     name2[len-2] = '$';
1895     Z = (Float_t)z;
1896     rad = GetRadLength(z)/dens;
1897     fits->AliMaterial(imat,name2,A,Z,dens,rad,0.0,0,0);
1898     tmax    = GetStandardThetaMax(istd);    // degree
1899     stemax  = GetStandardMaxStepSize(istd);  // cm
1900     deemax  = GetStandardEfraction(istd);     // ratio
1901     epsilon = GetStandardEpsilon(istd);       //
1902     fits->AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1903                     gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1904     delete[] name2;
1905 }
1906 //______________________________________________________________________
1907 void AliITSBaseGeometry::MixtureByWeight(Int_t imat,const char* name,Int_t *z,
1908                                 Double_t *w,Double_t dens,Int_t n,Int_t istd){
1909     // Defines a Geant material by a set of elements and weights, and sets 
1910     // its Geant medium proporties. The average atomic A is assumed to be 
1911     // given by their natural abundances. Things like the radiation length 
1912     // are calculated for you.
1913     // Inputs:
1914     //    Int_t imat       Material number.
1915     //    const char* name Material name. No need to add a $ at the end.
1916     //    Int_t *z         Array of The elemental numbers.
1917     //    Double_t *w      Array of relative weights.
1918     //    Double_t dens    The density of the material [g/cm^3].
1919     //    Int_t n          the number of elements making up the mixture.
1920     //    Int_t istd       Defines which standard set of transport parameters
1921     //                     which should be used.   
1922     // Output:
1923     //     none.
1924     // Return:
1925     //     none.
1926     Float_t *Z,*A,*W,tmax,stemax,deemax,epsilon;
1927     char *name2;
1928     Int_t len,i;
1929     Z = new Float_t[n];
1930     A = new Float_t[n];
1931     W = new Float_t[n];
1932
1933     len = strlen(name)+2;
1934     name2 = new char[len];
1935     strncpy(name2,name,len-1);
1936     name2[len-1] = '\0';
1937     name2[len-2] = '$';
1938     for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
1939                      W[i] = (Float_t)w[i];}
1940     fits->AliMixture(imat,name2,A,Z,dens,n,W);
1941     tmax    = GetStandardThetaMax(istd);    // degree
1942     stemax  = GetStandardMaxStepSize(istd);  // cm
1943     deemax  = GetStandardEfraction(istd);     // #
1944     epsilon = GetStandardEpsilon(istd);
1945     fits->AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1946               gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1947     delete[] name2;
1948     delete[] Z;
1949     delete[] A;
1950     delete[] W;
1951 }
1952 //______________________________________________________________________
1953 void AliITSBaseGeometry::MixtureByNumber(Int_t imat,const char* name,Int_t *z,
1954                                 Int_t *w,Double_t dens,Int_t n,Int_t istd){
1955     // Defines a Geant material by a set of elements and number, and sets 
1956     // its Geant medium proporties. The average atomic A is assumed to be 
1957     // given by their natural abundances. Things like the radiation length 
1958     // are calculated for you.
1959     // Inputs:
1960     //    Int_t imat       Material number.
1961     //    const char* name Material name. No need to add a $ at the end.
1962     //    Int_t *z         Array of The elemental numbers.
1963     //    Int_t_t *w       Array of relative number.
1964     //    Double_t dens    The density of the material [g/cm^3].
1965     //    Int_t n          the number of elements making up the mixture.
1966     //    Int_t istd       Defines which standard set of transport parameters
1967     //                     which should be used.   
1968     // Output:
1969     //     none.
1970     // Return:
1971     //     none.
1972     Float_t *Z,*A,*W,tmax,stemax,deemax,epsilon;
1973     char *name2;
1974     Int_t len,i;
1975     Z = new Float_t[n];
1976     A = new Float_t[n];
1977     W = new Float_t[n];
1978
1979     len = strlen(name)+1;
1980     name2 = new char[len];
1981     strncpy(name2,name,len-1);
1982     name2[len-1] = '\0';
1983     name2[len-2] = '$';
1984     for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
1985                      W[i] = (Float_t)w[i];}
1986     fits->AliMixture(imat,name2,A,Z,dens,-n,W);
1987     tmax    = GetStandardThetaMax(istd);    // degree
1988     stemax  = GetStandardMaxStepSize(istd);  // cm
1989     deemax  = GetStandardEfraction(istd);     // #
1990     epsilon = GetStandardEpsilon(istd);
1991     fits->AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1992                     gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1993     delete[] name2;
1994     delete[] Z;
1995     delete[] A;
1996     delete[] W;
1997 }
1998 //______________________________________________________________________
1999 Double_t AliITSBaseGeometry::RadLength(Int_t iz,Double_t a){
2000     // Computes the radiation length in accordance to the PDG 2000 Section
2001     // 23.4.1 p. 166. Transladed from the c code of Flavio Tosello.
2002     // Inputs:
2003     //    Int_t iz    The elemental number
2004     //    Dougle_t    The elemental average atomic mass number
2005     // Outputs:
2006     // Return:
2007     //    Double_t returns the radiation length of the element iz in
2008     //             [gm/cm^2].
2009     Double_t z = (Double_t)iz;
2010     Double_t alphaz = fAlpha*z;
2011     Double_t alphaz2 = alphaz*alphaz;
2012     Double_t c0 = +0.20206,c1 = -0.0369,c2 = +0.0083,c3 = -0.0020;
2013     Double_t z12,z23,l,lp,c;
2014
2015     c = alphaz2*(1./(1.+alphaz2) + c0 + c1*alphaz2 + c2*alphaz2*alphaz2
2016                   +c3*alphaz2*alphaz2*alphaz2);
2017     z12 = TMath::Exp(TMath::Log(z)/3.0);
2018     z23 = z12*z12;
2019     switch (iz){
2020     case 1: //Hydrogen
2021         l  = 5.31;
2022         lp = 6.144;
2023         break;
2024     case 2: //Helium
2025         l  = 4.79;
2026         lp = 5,621;
2027         break;
2028     case 3: //Lithium
2029         l  = 4.74;
2030         lp = 5.805;
2031         break;
2032     case 4: //Berilium
2033         l  = 4.71;
2034         lp = 5.924;
2035         break;
2036     default: //Others
2037         l  = TMath::Log(184.15/z12);
2038         lp = TMath::Log(1194.0/z23);
2039         break;
2040     } // end switch
2041     Double_t re2,b,r,xz;
2042
2043     re2 = fRe*fRe;
2044     b = 4.0*fAlpha*re2*fNa/a;
2045     r = b*z*(z*(l-c)+lp);
2046     xz = 1.0/r;
2047     return xz; // [gm/cm^2]
2048 }
2049 //======================================================================
2050 ClassImp(AliITSBaseVolParams)
2051 //______________________________________________________________________
2052 void AliITSBaseVolParams::Print(ostream *os){
2053     // Prints out the data kept in this class
2054     // Inputs:
2055     //    ostream *os The output stream pointer
2056     // Outputs:
2057     //    none.
2058     // Return:
2059     //    none.
2060
2061     *os<<"Volume Id="<<fVol<<" Copy="<<fCpn<<" Name: "<<fName<<endl;
2062 }
2063 //______________________________________________________________________
2064 void AliITSBaseVolParams::Read(istream *is){
2065     // Read in data kept in this class
2066     // Inputs:
2067     //   istream *is  the input stream
2068     // Outputs:
2069     //   none.
2070     // Return:
2071     //   none.
2072     char s[50];
2073
2074     is->get(s,10);
2075     *is >> fVol;
2076     is->get(s,6);
2077     *is >> fCpn;
2078     is->get(s,7);
2079     *is >> fName;
2080 }
2081 //______________________________________________________________________
2082 ostream &operator<<(ostream &os,AliITSBaseVolParams &p){
2083     // Operator << for C++ like output
2084     // Inputs:
2085     //    ostream &os            The output stream
2086     //    AliITSBaseVolParams &p The class to be outputed
2087     // Output:
2088     //    none.
2089     // Return:
2090     //    ostream &os        The output stream
2091
2092     p.Print(&os);
2093     return os;
2094 }
2095 //______________________________________________________________________
2096 istream &operator>>(istream &is,AliITSBaseVolParams &r){
2097     // Operator << for C++ like output
2098     // Inputs:
2099     //    istream &is            The input stream
2100     //    AliITSBaseVolParams &r The class to be read in
2101     // Output:
2102     //    none.
2103     // Return:
2104     //    istream &is        The input stream
2105
2106     r.Read(&is);
2107     return is;
2108 }
2109 //======================================================================
2110 ClassImp(AliITSBoxData)
2111 //______________________________________________________________________
2112 void AliITSBoxData::Print(ostream *os){
2113     // Prints out the data kept in this class
2114     // Inputs:
2115     //    ostream *os The output stream pointer
2116     // Outputs:
2117     //    none.
2118     // Return:
2119     //    none.
2120
2121 #if defined __GNUC__
2122 #if __GNUC__ > 2
2123     ios::fmtflags fmt;
2124 #else
2125     Int_t fmt;
2126 #endif
2127 #else
2128 #if defined __ICC || defined __ECC
2129     ios::fmtflags fmt;
2130 #else
2131     Int_t fmt;
2132 #endif
2133 #endif
2134
2135     AliITSBaseVolParams::Print(os);
2136     fmt = os->setf(ios::scientific);  // set scientific floating point output
2137     *os << "fDx=" << fDx << " fDy=" << fDy << " fDz=" << fDz << endl;
2138     os->flags(fmt); // reset back to old formating.
2139     return;
2140 }
2141 //______________________________________________________________________
2142 void AliITSBoxData::Read(istream *is){
2143     // Read in data kept in this class
2144     // Inputs:
2145     //   istream *is  the input stream
2146     // Outputs:
2147     //   none.
2148     // Return:
2149     //   none.
2150     char s[50];
2151
2152     AliITSBaseVolParams::Read(is);
2153     is->get(s,4);
2154     *is >> fDx;
2155     is->get(s,5);
2156     *is >> fDy;
2157     is->get(s,5);
2158     *is >> fDz;
2159 }
2160 //______________________________________________________________________
2161 ostream &operator<<(ostream &os,AliITSBoxData &p){
2162     // Operator << for C++ like output
2163     // Inputs:
2164     //    ostream &os      The output stream
2165     //    AliITSBoxData &p The class to be outputed
2166     // Output:
2167     //    none.
2168     // Return:
2169     //    ostream &os        The output stream
2170
2171     p.Print(&os);
2172     return os;
2173 }
2174 //______________________________________________________________________
2175 istream &operator>>(istream &is,AliITSBoxData &r){
2176     // Operator << for C++ like output
2177     // Inputs:
2178     //    istream &is      The input stream
2179     //    AliITSBoxData &r The class to be read in
2180     // Output:
2181     //    none.
2182     // Return:
2183     //    istream &is        The input stream
2184
2185     r.Read(&is);
2186     return is;
2187 }
2188 //======================================================================
2189 ClassImp(AliITSTrapezoid1Data)
2190 //______________________________________________________________________
2191 void AliITSTrapezoid1Data::Print(ostream *os){
2192     // Prints out the data kept in this class
2193     // Inputs:
2194     //    ostream *os The output stream pointer
2195     // Outputs:
2196     //    none.
2197     // Return:
2198     //    none.
2199
2200 #if defined __GNUC__
2201 #if __GNUC__ > 2
2202     ios::fmtflags fmt;
2203 #else
2204     Int_t fmt;
2205 #endif
2206 #else
2207 #if defined __ICC || defined __ECC
2208     ios::fmtflags fmt;
2209 #else
2210     Int_t fmt;
2211 #endif
2212 #endif
2213
2214     AliITSBaseVolParams::Print(os);
2215     fmt = os->setf(ios::scientific);  // set scientific floating point output
2216     *os << "fDx[0]=" << fDx[0]<< " fDx[1]=" << fDx[1]  << " fDy=" << fDy;
2217     *os << " fDz=" << fDz << endl;
2218     os->flags(fmt); // reset back to old formating.
2219     return;
2220 }
2221 //______________________________________________________________________
2222 void AliITSTrapezoid1Data::Read(istream *is){
2223     // Read in data kept in this class
2224     // Inputs:
2225     //   istream *is  the input stream
2226     // Outputs:
2227     //   none.
2228     // Return:
2229     //   none.
2230     char s[50];
2231
2232     AliITSBaseVolParams::Read(is);
2233     is->get(s,7);
2234     *is >> fDx[0];
2235     is->get(s,8);
2236     *is >> fDx[1];
2237     is->get(s,5);
2238     *is >> fDy;
2239     is->get(s,5);
2240     *is >> fDz;
2241 }
2242 //______________________________________________________________________
2243 ostream &operator<<(ostream &os,AliITSTrapezoid1Data &p){
2244     // Operator << for C++ like output
2245     // Inputs:
2246     //    ostream &os      The output stream
2247     //    AliITSBoxData &p The class to be outputed
2248     // Output:
2249     //    none.
2250     // Return:
2251     //    ostream &os        The output stream
2252
2253     p.Print(&os);
2254     return os;
2255 }
2256 //______________________________________________________________________
2257 istream &operator>>(istream &is,AliITSTrapezoid1Data &r){
2258     // Operator << for C++ like output
2259     // Inputs:
2260     //    istream &is       The input stream
2261     //    AliITSPGonData &r The class to be read in
2262     // Output:
2263     //    none.
2264     // Return:
2265     //    istream &is        The input stream
2266
2267     r.Read(&is);
2268     return is;
2269 }
2270 //======================================================================
2271 ClassImp(AliITSTrapezoid2Data)
2272 //______________________________________________________________________
2273 void AliITSTrapezoid2Data::Print(ostream *os){
2274     // Prints out the data kept in this class
2275     // Inputs:
2276     //    ostream *os The output stream pointer
2277     // Outputs:
2278     //    none.
2279     // Return:
2280     //    none.
2281
2282 #if defined __GNUC__
2283 #if __GNUC__ > 2
2284     ios::fmtflags fmt;
2285 #else
2286     Int_t fmt;
2287 #endif
2288 #else
2289 #if defined __ICC || defined __ECC
2290     ios::fmtflags fmt;
2291 #else
2292     Int_t fmt;
2293 #endif
2294 #endif
2295
2296     AliITSBaseVolParams::Print(os);
2297     fmt = os->setf(ios::scientific);  // set scientific floating point output
2298     *os <<  "fDx[0]=" << fDx[0]<< " fDx[1]=" << fDx[1];
2299     *os << " fDy[0]=" << fDy[0] << " fDy[1]=" << fDy[1];
2300     *os << " fDz=" << fDz << endl;
2301     os->flags(fmt); // reset back to old formating.
2302     return;
2303 }
2304 //______________________________________________________________________
2305 void AliITSTrapezoid2Data::Read(istream *is){
2306     // Read in data kept in this class
2307     // Inputs:
2308     //   istream *is  the input stream
2309     // Outputs:
2310     //   none.
2311     // Return:
2312     //   none.
2313     char s[50];
2314
2315     AliITSBaseVolParams::Read(is);
2316     is->get(s,7);
2317     *is >> fDx[0];
2318     is->get(s,8);
2319     *is >> fDx[1];
2320     is->get(s,8);
2321     *is >> fDy[0];
2322     is->get(s,8);
2323     *is >> fDy[1];
2324     is->get(s,5);
2325     *is >> fDz;
2326 }
2327 //______________________________________________________________________
2328 ostream &operator<<(ostream &os,AliITSTrapezoid2Data &p){
2329     // Operator << for C++ like output
2330     // Inputs:
2331     //    ostream &os      The output stream
2332     //    AliITSBoxData &p The class to be outputed
2333     // Output:
2334     //    none.
2335     // Return:
2336     //    ostream &os        The output stream
2337
2338     p.Print(&os);
2339     return os;
2340 }
2341 //______________________________________________________________________
2342 istream &operator>>(istream &is,AliITSTrapezoid2Data &r){
2343     // Operator << for C++ like output
2344     // Inputs:
2345     //    istream &is       The input stream
2346     //    AliITSPGonData &r The class to be read in
2347     // Output:
2348     //    none.
2349     // Return:
2350     //    istream &is        The input stream
2351
2352     r.Read(&is);
2353     return is;
2354 }
2355 //======================================================================
2356 ClassImp(AliITSTrapezoidData)
2357 //______________________________________________________________________
2358 void AliITSTrapezoidData::Print(ostream *os){
2359     // Prints out the data kept in this class
2360     // Inputs:
2361     //    ostream *os The output stream pointer
2362     // Outputs:
2363     //    none.
2364     // Return:
2365     //    none.
2366
2367 #if defined __GNUC__
2368 #if __GNUC__ > 2
2369     ios::fmtflags fmt;
2370 #else
2371     Int_t fmt;
2372 #endif
2373 #else
2374 #if defined __ICC || defined __ECC
2375     ios::fmtflags fmt;
2376 #else
2377     Int_t fmt;
2378 #endif
2379 #endif
2380
2381     AliITSBaseVolParams::Print(os);
2382     fmt = os->setf(ios::scientific);  // set scientific floating point output
2383     *os << "fTheta=" << fTheta << " fPhi=" << fPhi << " fDz=" << fDz;
2384     *os << " fH[0]=" << fH[0]<< " fH[1]=" << fH[1];
2385     *os << " fBl[0]=" << fBl[0] << " fBl[1]=" << fBl[1];
2386     *os << " fTl[0]=" << fTl[0] << " fTl[1]=" << fTl[1];
2387     *os << " fAlp[0]=" << fAlp[0] << " fAlp[1]=" << fAlp[1];
2388     *os << endl;
2389     os->flags(fmt); // reset back to old formating.
2390     return;
2391 }
2392 //______________________________________________________________________
2393 void AliITSTrapezoidData::Read(istream *is){
2394     // Read in data kept in this class
2395     // Inputs:
2396     //   istream *is  the input stream
2397     // Outputs:
2398     //   none.
2399     // Return:
2400     //   none.
2401     char s[50];
2402
2403     AliITSBaseVolParams::Read(is);
2404     is->get(s,6);
2405     *is >> fTheta;
2406     is->get(s,6);
2407     *is >> fPhi;
2408     is->get(s,5);
2409     *is >> fDz;
2410     is->get(s,7);
2411     *is >> fH[0];
2412     is->get(s,7);
2413     *is >> fH[1];
2414     is->get(s,8);
2415     *is >> fBl[0];
2416     is->get(s,8);
2417     *is >> fBl[1];
2418     is->get(s,8);
2419     *is >> fTl[0];
2420     is->get(s,8);
2421     *is >> fTl[1];
2422     is->get(s,9);
2423     *is >> fAlp[0];
2424     is->get(s,9);
2425     *is >> fAlp[1];
2426 }
2427 //______________________________________________________________________
2428 ostream &operator<<(ostream &os,AliITSTrapezoidData &p){
2429     // Operator << for C++ like output
2430     // Inputs:
2431     //    ostream &os      The output stream
2432     //    AliITSBoxData &p The class to be outputed
2433     // Output:
2434     //    none.
2435     // Return:
2436     //    ostream &os        The output stream
2437
2438     p.Print(&os);
2439     return os;
2440 }
2441 //______________________________________________________________________
2442 istream &operator>>(istream &is,AliITSTrapezoidData &r){
2443     // Operator << for C++ like output
2444     // Inputs:
2445     //    istream &is       The input stream
2446     //    AliITSPGonData &r The class to be read in
2447     // Output:
2448     //    none.
2449     // Return:
2450     //    istream &is        The input stream
2451
2452     r.Read(&is);
2453     return is;
2454 }
2455 //======================================================================
2456 ClassImp(AliITSTrapezoidTwistedData)
2457 //______________________________________________________________________
2458 void AliITSTrapezoidTwistedData::Print(ostream *os){
2459     // Prints out the data kept in this class
2460     // Inputs:
2461     //    ostream *os The output stream pointer
2462     // Outputs:
2463     //    none.
2464     // Return:
2465     //    none.
2466
2467 #if defined __GNUC__
2468 #if __GNUC__ > 2
2469     ios::fmtflags fmt;
2470 #else
2471     Int_t fmt;
2472 #endif
2473 #else
2474 #if defined __ICC || defined __ECC
2475     ios::fmtflags fmt;
2476 #else
2477     Int_t fmt;
2478 #endif
2479 #endif
2480
2481     AliITSBaseVolParams::Print(os);
2482     fmt = os->setf(ios::scientific);  // set scientific floating point output
2483     *os << "fTheta=" << fTheta << " fPhi=" << fPhi << " fDz=" << fDz;
2484     *os << " fTwist=" << fTwist;
2485     *os << " fH[0]=" << fH[0]<< " fH[1]=" << fH[1];
2486     *os << " fBl[0]=" << fBl[0] << " fBl[1]=" << fBl[1];
2487     *os << " fTl[0]=" << fTl[0] << " fTl[1]=" << fTl[1];
2488     *os << " fAlp[0]=" << fAlp[0] << " fAlp[1]=" << fAlp[1];
2489     *os << endl;
2490     os->flags(fmt); // reset back to old formating.
2491     return;
2492 }
2493 //______________________________________________________________________
2494 void AliITSTrapezoidTwistedData::Read(istream *is){
2495     // Read in data kept in this class
2496     // Inputs:
2497     //   istream *is  the input stream
2498     // Outputs:
2499     //   none.
2500     // Return:
2501     //   none.
2502     char s[50];
2503
2504     AliITSBaseVolParams::Read(is);
2505     is->get(s,6);
2506     *is >> fTheta;
2507     is->get(s,6);
2508     *is >> fPhi;
2509     is->get(s,5);
2510     *is >> fDz;
2511     is->get(s,8);
2512     *is >> fTwist;
2513     is->get(s,7);
2514     *is >> fH[0];
2515     is->get(s,7);
2516     *is >> fH[1];
2517     is->get(s,8);
2518     *is >> fBl[0];
2519     is->get(s,8);
2520     *is >> fBl[1];
2521     is->get(s,8);
2522     *is >> fTl[0];
2523     is->get(s,8);
2524     *is >> fTl[1];
2525     is->get(s,9);
2526     *is >> fAlp[0];
2527     is->get(s,9);
2528     *is >> fAlp[1];
2529 }
2530 //______________________________________________________________________
2531 ostream &operator<<(ostream &os,AliITSTrapezoidTwistedData &p){
2532     // Operator << for C++ like output
2533     // Inputs:
2534     //    ostream &os      The output stream
2535     //    AliITSBoxData &p The class to be outputed
2536     // Output:
2537     //    none.
2538     // Return:
2539     //    ostream &os        The output stream
2540
2541     p.Print(&os);
2542     return os;
2543 }
2544 //______________________________________________________________________
2545 istream &operator>>(istream &is,AliITSTrapezoidTwistedData &r){
2546     // Operator << for C++ like output
2547     // Inputs:
2548     //    istream &is       The input stream
2549     //    AliITSPGonData &r The class to be read in
2550     // Output:
2551     //    none.
2552     // Return:
2553     //    istream &is        The input stream
2554
2555     r.Read(&is);
2556     return is;
2557 }
2558 //======================================================================
2559 ClassImp(AliITSTubeData)
2560 //______________________________________________________________________
2561 void AliITSTubeData::Print(ostream *os){
2562     // Prints out the data kept in this class
2563     // Inputs:
2564     //    ostream *os The output stream pointer
2565     // Outputs:
2566     //    none.
2567     // Return:
2568     //    none.
2569
2570 #if defined __GNUC__
2571 #if __GNUC__ > 2
2572     ios::fmtflags fmt;
2573 #else
2574     Int_t fmt;
2575 #endif
2576 #else
2577 #if defined __ICC || defined __ECC
2578     ios::fmtflags fmt;
2579 #else
2580     Int_t fmt;
2581 #endif
2582 #endif
2583
2584     AliITSBaseVolParams::Print(os);
2585     fmt = os->setf(ios::scientific);  // set scientific floating point output
2586     *os <<"       Z        ,      Rmin      ,      Rmax      " << endl;
2587     fmt = os->setf(ios::scientific);  // set scientific floating point output
2588     *os << setprecision(16) << fDz <<"\t";
2589     *os << setprecision(16) << fRmin << "\t";
2590     *os << setprecision(16) << fRmax << endl;
2591     os->flags(fmt); // reset back to old formating.
2592     return;
2593 }
2594
2595 //______________________________________________________________________
2596 void AliITSTubeData::Read(istream *is){
2597     // Read in data kept in this class
2598     // Inputs:
2599     //   istream *is  the input stream
2600     // Outputs:
2601     //   none.
2602     // Return:
2603     //   none.
2604     char s[50];
2605
2606     AliITSBaseVolParams::Read(is);
2607
2608     is->getline(s,49);
2609         *is >> fDz >> fRmin >> fRmax;
2610 }
2611 //______________________________________________________________________
2612 ostream &operator<<(ostream &os,AliITSTubeData &p){
2613     // Operator << for C++ like output
2614     // Inputs:
2615     //    ostream &os       The output stream
2616     //    AliITSTubeData &p The class to be outputed
2617     // Output:
2618     //    none.
2619     // Return:
2620     //    ostream &os        The output stream
2621
2622     p.Print(&os);
2623     return os;
2624 }
2625 //______________________________________________________________________
2626 istream &operator>>(istream &is,AliITSTubeData &r){
2627     // Operator << for C++ like output
2628     // Inputs:
2629     //    istream &is       The input stream
2630     //    AliITSTubeData &r The class to be read in
2631     // Output:
2632     //    none.
2633     // Return:
2634     //    istream &is        The input stream
2635
2636     r.Read(&is);
2637     return is;
2638 }
2639 //======================================================================
2640 ClassImp(AliITSTubeSegData)
2641 //______________________________________________________________________
2642 void AliITSTubeSegData::Print(ostream *os){
2643     // Prints out the data kept in this class
2644     // Inputs:
2645     //    ostream *os The output stream pointer
2646     // Outputs:
2647     //    none.
2648     // Return:
2649     //    none.
2650
2651 #if defined __GNUC__
2652 #if __GNUC__ > 2
2653     ios::fmtflags fmt;
2654 #else
2655     Int_t fmt;
2656 #endif
2657 #else
2658 #if defined __ICC || defined __ECC
2659     ios::fmtflags fmt;
2660 #else
2661     Int_t fmt;
2662 #endif
2663 #endif
2664
2665     AliITSBaseVolParams::Print(os);
2666     fmt = os->setf(ios::scientific);  // set scientific floating point output
2667     *os << "fPhi0=" << fPhi0 << " fPhi1=" << fPhi1 << endl;
2668     *os <<"       Z        ,      Rmin      ,      Rmax      " << endl;
2669     fmt = os->setf(ios::scientific);  // set scientific floating point output
2670     *os << setprecision(16) << fDz <<"\t";
2671     *os << setprecision(16) << fRmin << "\t";
2672     *os << setprecision(16) << fRmax << endl;
2673     os->flags(fmt); // reset back to old formating.
2674     return;
2675 }
2676 //______________________________________________________________________
2677 void AliITSTubeSegData::Read(istream *is){
2678     // Read in data kept in this class
2679     // Inputs:
2680     //   istream *is  the input stream
2681     // Outputs:
2682     //   none.
2683     // Return:
2684     //   none.
2685     char s[50];
2686
2687     AliITSBaseVolParams::Read(is);
2688
2689     is->get(s,6);
2690     *is >> fPhi0;
2691     is->get(s,7);
2692     *is >> fPhi1;
2693     is->getline(s,49);
2694         *is >> fDz >> fRmin >> fRmax;
2695 }
2696 //______________________________________________________________________
2697 ostream &operator<<(ostream &os,AliITSTubeSegData &p){
2698     // Operator << for C++ like output
2699     // Inputs:
2700     //    ostream &os       The output stream
2701     //    AliITSTubeData &p The class to be outputed
2702     // Output:
2703     //    none.
2704     // Return:
2705     //    ostream &os        The output stream
2706
2707     p.Print(&os);
2708     return os;
2709 }
2710 //______________________________________________________________________
2711 istream &operator>>(istream &is,AliITSTubeSegData &r){
2712     // Operator << for C++ like output
2713     // Inputs:
2714     //    istream &is       The input stream
2715     //    AliITSTubeData &r The class to be read in
2716     // Output:
2717     //    none.
2718     // Return:
2719     //    istream &is        The input stream
2720
2721     r.Read(&is);
2722     return is;
2723 }
2724 //======================================================================
2725 ClassImp(AliITSTubeCutData)
2726 //______________________________________________________________________
2727 void AliITSTubeCutData::Print(ostream *os){
2728     // Prints out the data kept in this class
2729     // Inputs:
2730     //    ostream *os The output stream pointer
2731     // Outputs:
2732     //    none.
2733     // Return:
2734     //    none.
2735
2736 #if defined __GNUC__
2737 #if __GNUC__ > 2
2738     ios::fmtflags fmt;
2739 #else
2740     Int_t fmt;
2741 #endif
2742 #else
2743 #if defined __ICC || defined __ECC
2744     ios::fmtflags fmt;
2745 #else
2746     Int_t fmt;
2747 #endif
2748 #endif
2749
2750     AliITSBaseVolParams::Print(os);
2751     fmt = os->setf(ios::scientific);  // set scientific floating point output
2752     *os << "fPhi0=" << fPhi0 << " fPhi1=" << fPhi1;
2753     *os << " Norm0=("<<(fNorm[0])[0]<<" "<<(fNorm[0])[1]<<" "<<(fNorm[0])[2];
2754     *os << ") Norm1=("<<(fNorm[1])[0]<<" "<<(fNorm[1])[1]<<" "<<(fNorm[1])[2];
2755     *os << ")"<< endl;
2756     *os <<"       Z        ,      Rmin      ,      Rmax      " << endl;
2757     *os << setprecision(16) << fDz <<"\t";
2758     *os << setprecision(16) << fRmin << "\t";
2759     *os << setprecision(16) << fRmax << endl;
2760     os->flags(fmt); // reset back to old formating.
2761     return;
2762 }
2763 //______________________________________________________________________
2764 void AliITSTubeCutData::Read(istream *is){
2765     // Read in data kept in this class
2766     // Inputs:
2767     //   istream *is  the input stream
2768     // Outputs:
2769     //   none.
2770     // Return:
2771     //   none.
2772     char s[50];
2773
2774     AliITSBaseVolParams::Read(is);
2775
2776     is->get(s,6);
2777     *is >> fPhi0;
2778     is->get(s,7);
2779     *is >> fPhi1;
2780     is->get(s,8);
2781     *is >> (fNorm[0])[0]>>(fNorm[0])[1]>>(fNorm[0])[2];
2782     is->get(s,9);
2783     *is >> (fNorm[1])[0]>>(fNorm[1])[1]>>(fNorm[1])[2];
2784     is->get(s,1);
2785     is->getline(s,49);
2786     *is >> fDz >> fRmin >> fRmax;
2787 }
2788 //______________________________________________________________________
2789 ostream &operator<<(ostream &os,AliITSTubeCutData &p){
2790     // Operator << for C++ like output
2791     // Inputs:
2792     //    ostream &os       The output stream
2793     //    AliITSTubeData &p The class to be outputed
2794     // Output:
2795     //    none.
2796     // Return:
2797     //    ostream &os        The output stream
2798
2799     p.Print(&os);
2800     return os;
2801 }
2802 //______________________________________________________________________
2803 istream &operator>>(istream &is,AliITSTubeCutData &r){
2804     // Operator << for C++ like output
2805     // Inputs:
2806     //    istream &is       The input stream
2807     //    AliITSTubeData &r The class to be read in
2808     // Output:
2809     //    none.
2810     // Return:
2811     //    istream &is        The input stream
2812
2813     r.Read(&is);
2814     return is;
2815 }
2816
2817 //======================================================================
2818 ClassImp(AliITSTubeEllipticalData)
2819 //______________________________________________________________________
2820 void AliITSTubeEllipticalData::Print(ostream *os){
2821     // Prints out the data kept in this class
2822     // Inputs:
2823     //    ostream *os The output stream pointer
2824     // Outputs:
2825     //    none.
2826     // Return:
2827     //    none.
2828
2829 #if defined __GNUC__
2830 #if __GNUC__ > 2
2831     ios::fmtflags fmt;
2832 #else
2833     Int_t fmt;
2834 #endif
2835 #else
2836 #if defined __ICC || defined __ECC
2837     ios::fmtflags fmt;
2838 #else
2839     Int_t fmt;
2840 #endif
2841 #endif
2842
2843     AliITSBaseVolParams::Print(os);
2844     fmt = os->setf(ios::scientific);  // set scientific floating point output
2845     *os <<"       Z        ,  Semi-axis-x      ,  Semi-axis-y      " << endl;
2846     fmt = os->setf(ios::scientific);  // set scientific floating point output
2847     *os << setprecision(16) << fDz <<"\t";
2848     *os << setprecision(16) << fP0 << "\t";
2849     *os << setprecision(16) << fP1 << endl;
2850     os->flags(fmt); // reset back to old formating.
2851     return;
2852 }
2853
2854 //______________________________________________________________________
2855 void AliITSTubeEllipticalData::Read(istream *is){
2856     // Read in data kept in this class
2857     // Inputs:
2858     //   istream *is  the input stream
2859     // Outputs:
2860     //   none.
2861     // Return:
2862     //   none.
2863     char s[50];
2864
2865     AliITSBaseVolParams::Read(is);
2866
2867     is->getline(s,49);
2868     *is >> fDz >> fP0 >> fP1;
2869 }
2870 //______________________________________________________________________
2871 ostream &operator<<(ostream &os,AliITSTubeEllipticalData &p){
2872     // Operator << for C++ like output
2873     // Inputs:
2874     //    ostream &os       The output stream
2875     //    AliITSTubeData &p The class to be outputed
2876     // Output:
2877     //    none.
2878     // Return:
2879     //    ostream &os        The output stream
2880
2881     p.Print(&os);
2882     return os;
2883 }
2884 //______________________________________________________________________
2885 istream &operator>>(istream &is,AliITSTubeEllipticalData &r){
2886     // Operator << for C++ like output
2887     // Inputs:
2888     //    istream &is       The input stream
2889     //    AliITSTubeData &r The class to be read in
2890     // Output:
2891     //    none.
2892     // Return:
2893     //    istream &is        The input stream
2894
2895     r.Read(&is);
2896     return is;
2897 }
2898 //======================================================================
2899 ClassImp(AliITSTubeHyperbolicData)
2900 //______________________________________________________________________
2901 void AliITSTubeHyperbolicData::Print(ostream *os){
2902     // Prints out the data kept in this class
2903     // Inputs:
2904     //    ostream *os The output stream pointer
2905     // Outputs:
2906     //    none.
2907     // Return:
2908     //    none.
2909
2910 #if defined __GNUC__
2911 #if __GNUC__ > 2
2912     ios::fmtflags fmt;
2913 #else
2914     Int_t fmt;
2915 #endif
2916 #else
2917 #if defined __ICC || defined __ECC
2918     ios::fmtflags fmt;
2919 #else
2920     Int_t fmt;
2921 #endif
2922 #endif
2923
2924     AliITSBaseVolParams::Print(os);
2925     fmt = os->setf(ios::scientific);  // set scientific floating point output
2926     *os <<"       Z               Rmin             Rmax         Theta"<<endl;
2927     fmt = os->setf(ios::scientific);  // set scientific floating point output
2928     *os << setprecision(16) << fDz <<"\t";
2929     *os << setprecision(16) << fRmin << "\t";
2930     *os << setprecision(16) << fRmax << "\t";
2931     *os << setprecision(16) << fTheta << endl;
2932     os->flags(fmt); // reset back to old formating.
2933     return;
2934 }
2935
2936 //______________________________________________________________________
2937 void AliITSTubeHyperbolicData::Read(istream *is){
2938     // Read in data kept in this class
2939     // Inputs:
2940     //   istream *is  the input stream
2941     // Outputs:
2942     //   none.
2943     // Return:
2944     //   none.
2945     char s[50];
2946
2947     AliITSBaseVolParams::Read(is);
2948
2949     is->getline(s,49);
2950     *is >> fDz >> fRmin >> fRmax >> fTheta;
2951 }
2952 //______________________________________________________________________
2953 ostream &operator<<(ostream &os,AliITSTubeHyperbolicData &p){
2954     // Operator << for C++ like output
2955     // Inputs:
2956     //    ostream &os       The output stream
2957     //    AliITSTubeData &p The class to be outputed
2958     // Output:
2959     //    none.
2960     // Return:
2961     //    ostream &os        The output stream
2962
2963     p.Print(&os);
2964     return os;
2965 }
2966 //______________________________________________________________________
2967 istream &operator>>(istream &is,AliITSTubeHyperbolicData &r){
2968     // Operator << for C++ like output
2969     // Inputs:
2970     //    istream &is       The input stream
2971     //    AliITSTubeData &r The class to be read in
2972     // Output:
2973     //    none.
2974     // Return:
2975     //    istream &is        The input stream
2976
2977     r.Read(&is);
2978     return is;
2979 }
2980 //======================================================================
2981 ClassImp(AliITSConeData)
2982 //______________________________________________________________________
2983 void AliITSConeData::Print(ostream *os){
2984     // Prints out the data kept in this class
2985     // Inputs:
2986     //    ostream *os The output stream pointer
2987     // Outputs:
2988     //    none.
2989     // Return:
2990     //    none.
2991
2992 #if defined __GNUC__
2993 #if __GNUC__ > 2
2994     ios::fmtflags fmt;
2995 #else
2996     Int_t fmt;
2997 #endif
2998 #else
2999 #if defined __ICC || defined __ECC
3000     ios::fmtflags fmt;
3001 #else
3002     Int_t fmt;
3003 #endif
3004 #endif
3005
3006     AliITSBaseVolParams::Print(os);
3007     fmt = os->setf(ios::scientific);  // set scientific floating point output
3008     *os <<"       Z               Rmin             Rmax" << endl;
3009     fmt = os->setf(ios::scientific);  // set scientific floating point output
3010     *os << setprecision(16) << fDz <<"\t";
3011     *os << setprecision(16) << fRmin0 << "\t";
3012     *os << setprecision(16) << fRmax0 << endl;
3013     *os << setprecision(16) << fDz <<"\t";
3014     *os << setprecision(16) << fRmin1 << "\t";
3015     *os << setprecision(16) << fRmax1 << endl;
3016     os->flags(fmt); // reset back to old formating.
3017     return;
3018 }
3019 //______________________________________________________________________
3020 void AliITSConeData::Read(istream *is){
3021     // Read in data kept in this class
3022     // Inputs:
3023     //   istream *is  the input stream
3024     // Outputs:
3025     //   none.
3026     // Return:
3027     //   none.
3028     char s[50];
3029
3030     AliITSBaseVolParams::Read(is);
3031
3032     is->getline(s,49);
3033     *is >> fDz >> fRmin0 >> fRmax0;
3034     *is >> fDz >> fRmin1 >> fRmax1;
3035 }
3036 //______________________________________________________________________
3037 ostream &operator<<(ostream &os,AliITSConeData &p){
3038     // Operator << for C++ like output
3039     // Inputs:
3040     //    ostream &os       The output stream
3041     //    AliITSTubeData &p The class to be outputed
3042     // Output:
3043     //    none.
3044     // Return:
3045     //    ostream &os        The output stream
3046
3047     p.Print(&os);
3048     return os;
3049 }
3050 //______________________________________________________________________
3051 istream &operator>>(istream &is,AliITSConeData &r){
3052     // Operator << for C++ like output
3053     // Inputs:
3054     //    istream &is       The input stream
3055     //    AliITSTubeData &r The class to be read in
3056     // Output:
3057     //    none.
3058     // Return:
3059     //    istream &is        The input stream
3060
3061     r.Read(&is);
3062     return is;
3063 }
3064 //======================================================================
3065 ClassImp(AliITSConeSegData)
3066 //______________________________________________________________________
3067 void AliITSConeSegData::Print(ostream *os){
3068     // Prints out the data kept in this class
3069     // Inputs:
3070     //    ostream *os The output stream pointer
3071     // Outputs:
3072     //    none.
3073     // Return:
3074     //    none.
3075
3076 #if defined __GNUC__
3077 #if __GNUC__ > 2
3078     ios::fmtflags fmt;
3079 #else
3080     Int_t fmt;
3081 #endif
3082 #else
3083 #if defined __ICC || defined __ECC
3084     ios::fmtflags fmt;
3085 #else
3086     Int_t fmt;
3087 #endif
3088 #endif
3089
3090     AliITSBaseVolParams::Print(os);
3091     fmt = os->setf(ios::scientific);  // set scientific floating point output
3092     *os << "fPhi0=" << fPhi0 << " fPhi1=" << fPhi1 << endl;
3093     *os <<"       Z        ,      Rmin      ,      Rmax      " << endl;
3094     fmt = os->setf(ios::scientific);  // set scientific floating point output
3095     *os << setprecision(16) << fDz <<"\t";
3096     *os << setprecision(16) << fRmin0 << "\t";
3097     *os << setprecision(16) << fRmax0 << endl;
3098     *os << setprecision(16) << fDz <<"\t";
3099     *os << setprecision(16) << fRmin1 << "\t";
3100     *os << setprecision(16) << fRmax1 << endl;
3101     os->flags(fmt); // reset back to old formating.
3102     return;
3103 }
3104 //______________________________________________________________________
3105 void AliITSConeSegData::Read(istream *is){
3106     // Read in data kept in this class
3107     // Inputs:
3108     //   istream *is  the input stream
3109     // Outputs:
3110     //   none.
3111     // Return:
3112     //   none.
3113     char s[50];
3114
3115     AliITSBaseVolParams::Read(is);
3116     is->get(s,6);
3117     *is >> fPhi0;
3118     is->get(s,7);
3119     *is >> fPhi1;
3120     is->getline(s,49);
3121     *is >> fDz >> fRmin0 >> fRmax0;
3122     *is >> fDz >> fRmin1 >> fRmax1;
3123 }
3124 //______________________________________________________________________
3125 ostream &operator<<(ostream &os,AliITSConeSegData &p){
3126     // Operator << for C++ like output
3127     // Inputs:
3128     //    ostream &os        The output stream
3129     //    AliITSConeSegData &p The class to be outputed
3130     // Output:
3131     //    none.
3132     // Return:
3133     //    ostream &os        The output stream
3134
3135     p.Print(&os);
3136     return os;
3137 }
3138 //______________________________________________________________________
3139 istream &operator>>(istream &is,AliITSConeSegData &r){
3140     // Operator << for C++ like output
3141     // Inputs:
3142     //    istream &is        The input stream
3143     //    AliITSConeSegData &r The class to be read in
3144     // Output:
3145     //    none.
3146     // Return:
3147     //    istream &is        The input stream
3148
3149     r.Read(&is);
3150     return is;
3151 }
3152 //======================================================================
3153 ClassImp(AliITSPConeData)
3154 //______________________________________________________________________
3155 void AliITSPConeData::Print(ostream *os){
3156     // Prints out the data kept in this class
3157     // Inputs:
3158     //    ostream *os The output stream pointer
3159     // Outputs:
3160     //    none.
3161     // Return:
3162     //    none.
3163     Int_t i;
3164
3165 #if defined __GNUC__
3166 #if __GNUC__ > 2
3167     ios::fmtflags fmt;
3168 #else
3169     Int_t fmt;
3170 #endif
3171 #else
3172 #if defined __ICC || defined __ECC
3173     ios::fmtflags fmt;
3174 #else
3175     Int_t fmt;
3176 #endif
3177 #endif
3178
3179     AliITSBaseVolParams::Print(os);
3180     fmt = os->setf(ios::scientific);  // set scientific floating point output
3181     *os << "fNz=" << fNz << " fPhi0=" << fPhi0 << " fdPhi=" << fDphi << endl;
3182     *os <<"       Z        ,      Rmin      ,      Rmax      " << endl;
3183     fmt = os->setf(ios::scientific);  // set scientific floating point output
3184     for(i=0;i<fNz;i++){
3185         *os << setprecision(16) << fZ[i] <<"\t";
3186         *os << setprecision(16) << fRmin[i] << "\t";
3187         *os << setprecision(16) << fRmax[i] << endl;
3188     } // end for i
3189     os->flags(fmt); // reset back to old formating.
3190     return;
3191 }
3192 //______________________________________________________________________
3193 void AliITSPConeData::Read(istream *is){
3194     // Read in data kept in this class
3195     // Inputs:
3196     //   istream *is  the input stream
3197     // Outputs:
3198     //   none.
3199     // Return:
3200     //   none.
3201     Int_t i;
3202     char s[50];
3203
3204     AliITSBaseVolParams::Read(is);
3205     is->get(s,4);
3206     *is >> fNz;
3207     is->get(s,6);
3208     *is >> fPhi0;
3209     is->get(s,6);
3210     *is >> fDphi;
3211     is->getline(s,49);
3212     Size(fNz);
3213     for(i=0;i<fNz;i++){
3214         *is >> fZ[i] >> fRmin[i] >> fRmax[i];
3215     } // end for i
3216 }
3217 //______________________________________________________________________
3218 ostream &operator<<(ostream &os,AliITSPConeData &p){
3219     // Operator << for C++ like output
3220     // Inputs:
3221     //    ostream &os        The output stream
3222     //    AliITSPConeData &p The class to be outputed
3223     // Output:
3224     //    none.
3225     // Return:
3226     //    ostream &os        The output stream
3227
3228     p.Print(&os);
3229     return os;
3230 }
3231 //______________________________________________________________________
3232 istream &operator>>(istream &is,AliITSPConeData &r){
3233     // Operator << for C++ like output
3234     // Inputs:
3235     //    istream &is        The input stream
3236     //    AliITSPConeData &r The class to be read in
3237     // Output:
3238     //    none.
3239     // Return:
3240     //    istream &is        The input stream
3241
3242     r.Read(&is);
3243     return is;
3244 }
3245 //======================================================================
3246 ClassImp(AliITSSphereData)
3247 //______________________________________________________________________
3248 void AliITSSphereData::Print(ostream *os){
3249     // Prints out the data kept in this class
3250     // Inputs:
3251     //    ostream *os The output stream pointer
3252     // Outputs:
3253     //    none.
3254     // Return:
3255     //    none.
3256
3257 #if defined __GNUC__
3258 #if __GNUC__ > 2
3259     ios::fmtflags fmt;
3260 #else
3261     Int_t fmt;
3262 #endif
3263 #else
3264 #if defined __ICC || defined __ECC
3265     ios::fmtflags fmt;
3266 #else
3267     Int_t fmt;
3268 #endif
3269 #endif
3270
3271     AliITSBaseVolParams::Print(os);
3272     fmt = os->setf(ios::scientific);  // set scientific floating point output
3273     *os << "fTheta[0]=" << fTheta[0] << " fTheta[1]=" << fTheta[1] << endl;
3274     *os << "fPhi[0]=" << fPhi[0] << " fPhi[1]=" << fPhi[1] << endl;
3275     *os <<"      Rmin      ,      Rmax      " << endl;
3276     fmt = os->setf(ios::scientific);  // set scientific floating point output
3277     *os << setprecision(16) << fRmin << "\t";
3278     *os << setprecision(16) << fRmax << endl;
3279     os->flags(fmt); // reset back to old formating.
3280     return;
3281 }
3282 //______________________________________________________________________
3283 void AliITSSphereData::Read(istream *is){
3284     // Read in data kept in this class
3285     // Inputs:
3286     //   istream *is  the input stream
3287     // Outputs:
3288     //   none.
3289     // Return:
3290     //   none.
3291     char s[50];
3292
3293     AliITSBaseVolParams::Read(is);
3294     is->get(s,10);
3295     *is >> fTheta[0];
3296     is->get(s,11);
3297     *is >> fTheta[1];
3298     is->get(s,8);
3299     *is >> fPhi[0];
3300     is->get(s,9);
3301     *is >> fPhi[1];
3302     is->getline(s,49);
3303     *is >>fRmin >> fRmax;
3304 }
3305 //______________________________________________________________________
3306 ostream &operator<<(ostream &os,AliITSSphereData &p){
3307     // Operator << for C++ like output
3308     // Inputs:
3309     //    ostream &os        The output stream
3310     //    AliITSPConeData &p The class to be outputed
3311     // Output:
3312     //    none.
3313     // Return:
3314     //    ostream &os        The output stream
3315
3316     p.Print(&os);
3317     return os;
3318 }
3319 //______________________________________________________________________
3320 istream &operator>>(istream &is,AliITSSphereData &r){
3321     // Operator << for C++ like output
3322     // Inputs:
3323     //    istream &is        The input stream
3324     //    AliITSPConeData &r The class to be read in
3325     // Output:
3326     //    none.
3327     // Return:
3328     //    istream &is        The input stream
3329
3330     r.Read(&is);
3331     return is;
3332 }
3333 //======================================================================
3334 ClassImp(AliITSParallelpipedData)
3335 //______________________________________________________________________
3336 void AliITSParallelpipedData::Print(ostream *os){
3337     // Prints out the data kept in this class
3338     // Inputs:
3339     //    ostream *os The output stream pointer
3340     // Outputs:
3341     //    none.
3342     // Return:
3343     //    none.
3344
3345 #if defined __GNUC__
3346 #if __GNUC__ > 2
3347     ios::fmtflags fmt;
3348 #else
3349     Int_t fmt;
3350 #endif
3351 #else
3352 #if defined __ICC || defined __ECC
3353     ios::fmtflags fmt;
3354 #else
3355     Int_t fmt;
3356 #endif
3357 #endif
3358
3359     AliITSBaseVolParams::Print(os);
3360     fmt = os->setf(ios::scientific);  // set scientific floating point output
3361     *os << "fDx=" << fDx << " fDy=" << fDy << " fDz=" << fDz << endl;
3362     *os << "fAlpha=" << fAlpha << " fTheta=" << fTheta <<" fPhi="<<fPhi<<endl;
3363     os->flags(fmt); // reset back to old formating.
3364     return;
3365 }
3366 //______________________________________________________________________
3367 void AliITSParallelpipedData::Read(istream *is){
3368     // Read in data kept in this class
3369     // Inputs:
3370     //   istream *is  the input stream
3371     // Outputs:
3372     //   none.
3373     // Return:
3374     //   none.
3375     char s[50];
3376
3377     AliITSBaseVolParams::Read(is);
3378     is->get(s,4);
3379     *is >> fDx;
3380     is->get(s,5);
3381     *is >> fDy;
3382     is->get(s,5);
3383     *is >> fDz;
3384     is->get(s,7);
3385     *is >> fAlpha;
3386     is->get(s,8);
3387     *is >> fTheta;
3388     is->get(s,6);
3389     *is >> fPhi;
3390 }
3391 //______________________________________________________________________
3392 ostream &operator<<(ostream &os,AliITSParallelpipedData &p){
3393     // Operator << for C++ like output
3394     // Inputs:
3395     //    ostream &os      The output stream
3396     //    AliITSBoxData &p The class to be outputed
3397     // Output:
3398     //    none.
3399     // Return:
3400     //    ostream &os        The output stream
3401
3402     p.Print(&os);
3403     return os;
3404 }
3405 //______________________________________________________________________
3406 istream &operator>>(istream &is,AliITSParallelpipedData &r){
3407     // Operator << for C++ like output
3408     // Inputs:
3409     //    istream &is      The input stream
3410     //    AliITSBoxData &r The class to be read in
3411     // Output:
3412     //    none.
3413     // Return:
3414     //    istream &is        The input stream
3415
3416     r.Read(&is);
3417     return is;
3418 }
3419 //======================================================================
3420 ClassImp(AliITSPGonData)
3421 //______________________________________________________________________
3422 void AliITSPGonData::Print(ostream *os){
3423     // Prints out the data kept in this class
3424     // Inputs:
3425     //    ostream *os The output stream pointer
3426     // Outputs:
3427     //    none.
3428     // Return:
3429     //    none.
3430     Int_t i;
3431
3432 #if defined __GNUC__
3433 #if __GNUC__ > 2
3434     ios::fmtflags fmt;
3435 #else
3436     Int_t fmt;
3437 #endif
3438 #else
3439 #if defined __ICC || defined __ECC
3440     ios::fmtflags fmt;
3441 #else
3442     Int_t fmt;
3443 #endif
3444 #endif
3445
3446     AliITSBaseVolParams::Print(os);
3447     fmt = os->setf(ios::scientific);  // set scientific floating point output
3448     fmt = os->setf(ios::scientific);  // set scientific floating point output
3449     *os << "fNz=" << fNz << " fNphi=" << fNphi << " fPhi0=" << fPhi0;
3450     *os << " fdPhi=" << fDphi << endl;
3451     *os <<"       Z        ,      Rmin      ,      Rmax      " << endl;
3452     for(i=0;i<fNz;i++){
3453         *os << setprecision(16) << fZ[i] <<"\t";
3454         *os << setprecision(16) << fRmin[i] << "\t";
3455         *os << setprecision(16) << fRmax[i] << endl;
3456     } // end for i
3457     os->flags(fmt); // reset back to old formating.
3458     return;
3459 }
3460 //______________________________________________________________________
3461 void AliITSPGonData::Read(istream *is){
3462     // Read in data kept in this class
3463     // Inputs:
3464     //   istream *is  the input stream
3465     // Outputs:
3466     //   none.
3467     // Return:
3468     //   none.
3469     Int_t i;
3470     char s[50];
3471
3472     AliITSBaseVolParams::Read(is);
3473     
3474     is->get(s,4);
3475     *is >> fNz;
3476     is->get(s,6);
3477     *is >> fNphi;
3478     is->get(s,6);
3479     *is >> fPhi0;
3480     is->get(s,6);
3481     *is >> fDphi;
3482     is->getline(s,49);
3483
3484     Size(fNz);
3485     for(i=0;i<fNz;i++){
3486         *is >> fZ[i] >> fRmin[i] >> fRmax[i];
3487     } // end for i
3488 }
3489 //______________________________________________________________________
3490 ostream &operator<<(ostream &os,AliITSPGonData &p){
3491     // Operator << for C++ like output
3492     // Inputs:
3493     //    ostream &os       The output stream
3494     //    AliITSPGonData &p The class to be outputed
3495     // Output:
3496     //    none.
3497     // Return:
3498     //    ostream &os        The output stream
3499
3500     p.Print(&os);
3501     return os;
3502 }
3503 //______________________________________________________________________
3504 istream &operator>>(istream &is,AliITSPGonData &r){
3505     // Operator << for C++ like output
3506     // Inputs:
3507     //    istream &is       The input stream
3508     //    AliITSPGonData &r The class to be read in
3509     // Output:
3510     //    none.
3511     // Return:
3512     //    istream &is        The input stream
3513
3514     r.Read(&is);
3515     return is;
3516 }