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