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