This commit was generated by cvs2svn to compensate for changes in r209,
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 20 Jul 1999 14:02:39 +0000 (14:02 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 20 Jul 1999 14:02:39 +0000 (14:02 +0000)
which included commits to RCS files with non-trunk default branches.

33 files changed:
GEODB/AliGBox.cxx [new file with mode: 0644]
GEODB/AliGBox.h [new file with mode: 0644]
GEODB/AliGCone.cxx [new file with mode: 0644]
GEODB/AliGCone.h [new file with mode: 0644]
GEODB/AliGConfig.cxx [new file with mode: 0644]
GEODB/AliGConfig.h [new file with mode: 0644]
GEODB/AliGEODB.cxx [new file with mode: 0644]
GEODB/AliGEODB.h [new file with mode: 0644]
GEODB/AliGMaterial.cxx [new file with mode: 0644]
GEODB/AliGMaterial.h [new file with mode: 0644]
GEODB/AliGNode.cxx [new file with mode: 0644]
GEODB/AliGNode.h [new file with mode: 0644]
GEODB/AliGPCone.cxx [new file with mode: 0644]
GEODB/AliGPCone.h [new file with mode: 0644]
GEODB/AliGShape.cxx [new file with mode: 0644]
GEODB/AliGShape.h [new file with mode: 0644]
GEODB/AliGSphere.cxx [new file with mode: 0644]
GEODB/AliGSphere.h [new file with mode: 0644]
GEODB/AliGSuperShape.cxx [new file with mode: 0644]
GEODB/AliGSuperShape.h [new file with mode: 0644]
GEODB/AliGTRD1.cxx [new file with mode: 0644]
GEODB/AliGTRD1.h [new file with mode: 0644]
GEODB/AliGTransform.cxx [new file with mode: 0644]
GEODB/AliGTransform.h [new file with mode: 0644]
GEODB/AliGTube.cxx [new file with mode: 0644]
GEODB/AliGTube.h [new file with mode: 0644]
GEODB/AliGeometry.cxx [new file with mode: 0644]
GEODB/AliGeometry.h [new file with mode: 0644]
GEODB/ConfigGeo.C [new file with mode: 0644]
GEODB/GEODBLinkDef.h [new file with mode: 0644]
GEODB/Makefile [new file with mode: 0644]
GEODB/geotest.C [new file with mode: 0644]
GEODB/html.C [new file with mode: 0644]

diff --git a/GEODB/AliGBox.cxx b/GEODB/AliGBox.cxx
new file mode 100644 (file)
index 0000000..47797db
--- /dev/null
@@ -0,0 +1,225 @@
+// -*- C++ -*-
+// 
+// 1998/10/19
+// ---------------------------------------------------------------------------
+//
+// AliGBox Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo & company...
+//
+// ---------------------------------------------------------------------------
+
+#include <TView.h>
+#include <TCanvas.h>
+#include <TVirtualPad.h>
+#include <iostream.h>
+#include <TGLKernelABC.h>
+#include "AliGBox.h"
+#include <TROOT.h>
+
+ClassImp(AliGBox)
+
+
+//-------------------------------------------------------------------------
+
+AliGBox::AliGBox(Text_t* name,Text_t* title, Float_t Dx, Float_t Dy, Float_t Dz) : AliGShape(name, title)
+{
+    /* Constructor */
+    fDx = Dx;
+    fDy = Dy;
+    fDz = Dz;
+}
+
+//-------------------------------------------------------------------------   
+
+AliGBox::AliGBox( AliGBox* box )
+{
+    if( box ) {
+        /* Copy Constructor */
+        fDx    = box->fDx;
+        fDy    = box->fDy; 
+        fDz    = box->fDz;
+        fName  = box->fName;
+        fTitle = box->fTitle;
+        fColor = box->fColor;
+    }
+    else{
+        /* Default Constructor */
+        fDx    = 0;
+        fDy    = 0;
+        fDz    = 0;
+        fName  = "";
+        fTitle = "";
+    }
+}
+
+//-------------------------------------------------------------------------
+
+AliGBox* AliGBox::operator=(const AliGBox *box)
+{
+    /* Operator = */
+    if( this == box) return this; // special case.
+
+    fDx    = box->fDx;
+    fDy    = box->fDy; 
+    fDz    = box->fDz; 
+    fName  = box->fName;
+    fTitle = box->fTitle;
+    fColor = box->fColor;
+
+    return this;
+}
+
+//-------------------------------------------------------------------------
+
+void AliGBox::DrawShape(Option_t *option)
+{
+    Draw(option);
+    gPad->Update();
+}
+
+//-------------------------------------------------------------------------
+
+void AliGBox::Paint(Option_t *option)
+{
+    SetLineColor( GetCol() );
+    const Int_t numpoints = 8;
+
+    //*-* Allocate memory for points *-*
+
+    Float_t *points = new Float_t[3*numpoints];
+    if (!points) return;
+
+    SetPoints(points);
+
+    if (gPad->GetView3D()) PaintGLPoints(points);
+
+    //==  for (Int_t i = 0; i < numpoints; i++)
+    //            gNode->Local2Master(&points[3*i],&points[3*i]);
+
+    Int_t c = ((GetLineColor() % 8) - 1) * 4;     // Basic colors: 0, 1, ... 7
+    if (c < 0) c = 0;
+
+    //*-* Allocate memory for segments *-*
+
+    X3DBuffer *buff = new X3DBuffer;
+    if (buff) {
+        buff->numPoints = 8;
+        buff->numSegs   = 12;
+        buff->numPolys  = 6;
+    }
+
+//*-* Allocate memory for points *-*
+
+    buff->points = points;
+    buff->segs = new Int_t[buff->numSegs*3];
+    if (buff->segs) {
+        buff->segs[ 0] = c;    buff->segs[ 1] = 0;    buff->segs[ 2] = 1;
+        buff->segs[ 3] = c+1;  buff->segs[ 4] = 1;    buff->segs[ 5] = 2;
+        buff->segs[ 6] = c+1;  buff->segs[ 7] = 2;    buff->segs[ 8] = 3;
+        buff->segs[ 9] = c;    buff->segs[10] = 3;    buff->segs[11] = 0;
+        buff->segs[12] = c+2;  buff->segs[13] = 4;    buff->segs[14] = 5;
+        buff->segs[15] = c+2;  buff->segs[16] = 5;    buff->segs[17] = 6;
+        buff->segs[18] = c+3;  buff->segs[19] = 6;    buff->segs[20] = 7;
+        buff->segs[21] = c+3;  buff->segs[22] = 7;    buff->segs[23] = 4;
+        buff->segs[24] = c;    buff->segs[25] = 0;    buff->segs[26] = 4;
+        buff->segs[27] = c+2;  buff->segs[28] = 1;    buff->segs[29] = 5;
+        buff->segs[30] = c+1;  buff->segs[31] = 2;    buff->segs[32] = 6;
+        buff->segs[33] = c+3;  buff->segs[34] = 3;    buff->segs[35] = 7;
+    }
+
+//*-* Allocate memory for polygons *-*
+
+    buff->polys = new Int_t[buff->numPolys*6];
+    if (buff->polys) {
+        buff->polys[ 0] = c;   buff->polys[ 1] = 4;  buff->polys[ 2] = 0;
+        buff->polys[ 3] = 9;   buff->polys[ 4] = 4;  buff->polys[ 5] = 8;
+        buff->polys[ 6] = c+1; buff->polys[ 7] = 4;  buff->polys[ 8] = 1;
+        buff->polys[ 9] = 10;  buff->polys[10] = 5;  buff->polys[11] = 9;
+        buff->polys[12] = c;   buff->polys[13] = 4;  buff->polys[14] = 2;
+        buff->polys[15] = 11;  buff->polys[16] = 6;  buff->polys[17] = 10;
+        buff->polys[18] = c+1; buff->polys[19] = 4;  buff->polys[20] = 3;
+        buff->polys[21] = 8;   buff->polys[22] = 7;  buff->polys[23] = 11;
+        buff->polys[24] = c+2; buff->polys[25] = 4;  buff->polys[26] = 0;
+        buff->polys[27] = 3;   buff->polys[28] = 2;  buff->polys[29] = 1;
+        buff->polys[30] = c+3; buff->polys[31] = 4;  buff->polys[32] = 4;
+        buff->polys[33] = 5;   buff->polys[34] = 6;  buff->polys[35] = 7;
+    }
+
+    //*-* Paint in the pad
+    Bool_t rangeView = strcmp(option,"range")==0 ? kTRUE : kFALSE;
+    PaintShape(buff,rangeView);
+
+    if (strstr(option, "x3d")) {
+        if(buff && buff->points && buff->segs)
+            FillX3DBuffer(buff);
+        else {
+            gSize3D.numPoints -= buff->numPoints;
+            gSize3D.numSegs   -= buff->numSegs;
+            gSize3D.numPolys  -= buff->numPolys;
+        }
+    }
+
+    delete [] points;
+    if (buff->segs)     delete [] buff->segs;
+    if (buff->polys)    delete [] buff->polys;
+    if (buff)           delete    buff;
+   
+
+}
+
+
+
+
+// ---------------------------------------------------------------------------
+
+void AliGBox::PaintGLPoints(Float_t *vertex)
+{
+//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Paint BRIK via OpenGL *-*-*-*-*-*-*-*-*-*-*-*-*
+//*-*                            =====================
+    gGLKernel->PaintBrik(vertex);
+}
+
+
+// ---------------------------------------------------------------------------
+
+void AliGBox::SetPoints(Float_t *buff)
+{
+//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Create AliGBox points*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+//*-*                            =====================
+    if (buff) {
+        buff[ 0] = -fDx;    buff[ 1] = -fDy;    buff[ 2] = -fDz;
+        buff[ 3] =  fDx;    buff[ 4] = -fDy;    buff[ 5] = -fDz;
+        buff[ 6] =  fDx;    buff[ 7] =  fDy;    buff[ 8] = -fDz;
+        buff[ 9] = -fDx;    buff[10] =  fDy;    buff[11] = -fDz;
+        buff[12] = -fDx;    buff[13] = -fDy;    buff[14] =  fDz;
+        buff[15] =  fDx;    buff[16] = -fDy;    buff[17] =  fDz;
+        buff[18] =  fDx;    buff[19] =  fDy;    buff[20] =  fDz;
+        buff[21] = -fDx;    buff[22] =  fDy;    buff[23] =  fDz;
+    }
+}
+
+//-------------------------------------------------------------------------
+
+void AliGBox::Sizeof3D() const
+{
+//*-*-*-*-*-*-*Return total X3D size of this shape with its attributes*-*-*-*-*-*
+//*-*          =======================================================
+
+  //cout << " Entra en AliGBox::Sizeof3D() " << endl;
+
+    gSize3D.numPoints += 8;
+    gSize3D.numSegs   += 12;
+    gSize3D.numPolys  += 6;
+}
+
+
+
+
+
+
+
+
diff --git a/GEODB/AliGBox.h b/GEODB/AliGBox.h
new file mode 100644 (file)
index 0000000..3e9ae51
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef ALIGBOX_H
+#define ALIGBOX_H
+
+/* -*- C++ -*-
+// 
+// 1998/10/19
+// ---------------------------------------------------------------------------
+//
+// AliGBox Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo
+//
+// ---------------------------------------------------------------------------
+// AliGBox is a subclass of AliGShape. Its dimensions are:
+//      - Dx    half-length of the bosx along X-axis
+//      - Dy    hlf-length of the box along Y-axis
+//      - Dz    half-length of the box along Z-axis */
+
+
+#include "AliGShape.h"
+
+class AliGBox: public AliGShape {
+
+    protected:
+        Float_t fDx; /* X half Dimension */
+        Float_t fDy; /* Y half Dimension */
+        Float_t fDz; /* Z half Dimension */
+
+    public:
+        AliGBox( Text_t* name,Text_t* title, Float_t Dx, Float_t Dy, Float_t Dz ); /* Constructor */
+        AliGBox( AliGBox* box=NULL ); /* Copy or Default Constructor */
+        AliGBox* operator=( const AliGBox *box ); /* Operator = */
+        virtual ~AliGBox() {} /* Destructor */
+
+        //virtual void Draw( Option_t* option );
+        virtual void    DrawShape( Option_t* option ); // *MENU*
+               Float_t GetX() {return fDx;}
+               Float_t GetY() {return fDy;}
+               Float_t GetZ() {return fDz;}
+        virtual void    Paint( Option_t* option );
+        virtual void    PaintGLPoints( Float_t* vertex );
+        virtual void    SetPoints( Float_t* buff );
+               void    SetX(Float_t Dx) {fDx = Dx;}
+               void    SetY(Float_t Dy) {fDy = Dy;}
+               void    SetZ(Float_t Dz) {fDz = Dz;}
+        virtual void    Sizeof3D() const;
+        //void Streamer(TBuffer &b);
+
+    ClassDef(AliGBox,1) // Simple box class
+};
+
+#endif
+
diff --git a/GEODB/AliGCone.cxx b/GEODB/AliGCone.cxx
new file mode 100644 (file)
index 0000000..2a1daf9
--- /dev/null
@@ -0,0 +1,177 @@
+// -*- C++ -*-
+// 
+// 1998/10/19
+// ---------------------------------------------------------------------------
+//
+// AliGCone Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// By:  Joana E. Santo & David Collados
+//
+// ---------------------------------------------------------------------------
+
+#include <TView.h>
+#include <TVirtualPad.h>
+#include <iostream.h>
+#include <TGLKernelABC.h>
+#include <TCanvas.h>
+#include "AliGCone.h"
+#include "TROOT.h"
+
+ClassImp(AliGCone)
+
+AliGCone::AliGCone() : AliGTube()
+{
+    /* Default Constructor */
+    fRmax2 = 0.;      // outside radius at the high z limit
+    fRmin2 = 0.;      // inside radius at the high z limit
+
+    //SetLineColor(5);  // Yellow
+}
+
+//-------------------------------------------------------------------------
+
+AliGCone::AliGCone(Text_t *name, Text_t *title, Float_t dz, Float_t rmin1, Float_t rmax1, Float_t rmin2, Float_t rmax2) : AliGTube(name, title, rmin1, rmax1, dz)
+{
+    /* Constructor */
+    fRmax2 = rmax2;
+    fRmin2 = rmin2;
+
+    //SetLineColor(5); // Yellow
+}
+
+//-------------------------------------------------------------------------
+
+AliGCone::AliGCone(AliGCone *cone) 
+{
+    /* Copy Constructor */
+    fRmax2 = cone->fRmax2;
+    fRmin2 = cone->fRmin2;
+    fColor = cone->fColor;
+    
+    //SetLineColor(5); // Yellow
+}
+
+//-------------------------------------------------------------------------
+
+AliGCone::AliGCone(Text_t *name, Text_t *title, Float_t dz, Float_t rmax1, Float_t rmax2) : AliGTube(name, title, 0, rmax1, dz)
+{
+    /* Simplified Constructor */
+    fRmin2 = 0;
+    fRmax2 = rmax2;
+
+    //SetLineColor(5); // Yellow
+}
+
+//-------------------------------------------------------------------------
+
+AliGCone::~AliGCone() {
+    /* Destructor */
+}
+
+//-------------------------------------------------------------------------
+
+void AliGCone::DrawShape(Option_t *option)
+{
+    Draw(option);
+    gPad->Update();
+}
+
+//-------------------------------------------------------------------------
+
+void AliGCone::Draw(Option_t *option)
+{
+    cout << " Entra en " << this->GetName() << "::Draw " << endl;
+    TString opt = option;
+    opt.ToLower();
+
+    if( !gPad ) {
+      //TCanvas* Cone = new TCanvas("AliGCone","AliGCone",0,0,400,300);
+        gPad = new TCanvas("AliGCone","AliGCone",0,0,400,300);
+        gPad->Range(0,0,1,1);
+        gPad->SetFillColor(32); // Light Green
+        gPad->SetBorderSize(3);
+        gPad->SetBorderMode(0); // -1 (down) 0 (no) 1 (up)
+    }
+    else {
+        if( !opt.Contains("same") ) {
+            gPad->Clear();
+            gPad->SetName("AliGCone");
+            gPad->SetTitle("AliGCone");
+        }
+        else {
+            gPad->SetName("AliShapes");
+            gPad->SetTitle("AliShapes"); 
+        }
+    }
+
+    AppendPad(option);
+    TView *view = gPad->GetView();
+
+    if (!view)
+        view = new TView(1);
+
+    view->SetAutoRange(kTRUE);
+    Paint(option);
+    view->SetAutoRange(kFALSE);
+    cout << " Sale de " << this->GetName() << "::Draw " << endl;
+}
+
+//-------------------------------------------------------------------------
+
+void AliGCone::SetPoints(Float_t *buff)
+{
+//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Create CONE points*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+//*-*                            ==================
+
+    //cout << " Entra en " << this->GetName() << "::Paint " << endl;
+    SetLineColor( GetCol() );
+
+    Float_t rmin1, rmax1, dz;
+    Int_t j, n;
+
+    n = GetNumberOfDivisions();
+
+    rmin1 = AliGTube::fRmin;
+    rmax1 = AliGTube::fRmax;
+    dz    = AliGTube::fDz;
+
+    Int_t indx = 0;
+
+//*-* We've to checxk whether the table does exist and create it
+//*-* since fCoTab/fSiTab are not saved with any TShape::Streamer function
+    if (!fCoTab)   MakeTableOfCoSin();
+
+    if (buff) {
+        for (j = 0; j < n; j++) {
+            buff[indx++] = rmin1 * fCoTab[j];
+            buff[indx++] = rmin1 * fSiTab[j];
+            buff[indx++] = -dz;
+        }
+        for (j = 0; j < n; j++) {
+
+            buff[indx++] = rmax1 * fCoTab[j];
+            buff[indx++] = rmax1 * fSiTab[j];
+            buff[indx++] = -dz;
+        }
+
+        for (j = 0; j < n; j++) {
+            buff[indx++] = fRmin2 * fCoTab[j];
+            buff[indx++] = fRmin2 * fSiTab[j];
+            buff[indx++] = dz;
+        }
+
+        for (j = 0; j < n; j++) {
+            buff[indx++] = fRmax2 * fCoTab[j];
+            buff[indx++] = fRmax2 * fSiTab[j];
+            buff[indx++] = dz;
+        }
+    }
+
+    //cout << " Sale de " << this->GetName() << "::Paint " << endl;   
+}
+
+//-------------------------------------------------------------------------
+
+
diff --git a/GEODB/AliGCone.h b/GEODB/AliGCone.h
new file mode 100644 (file)
index 0000000..5ff668c
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef ALIGCONE_H
+#define ALIGCONE_H
+
+#include "AliGTube.h"
+
+class AliGCone: public AliGTube {
+
+    protected:
+        Float_t fRmax2;  /* outside radius at the high z limit */
+        Float_t fRmin2;  /* inside radius at the high z limit  */
+
+    public:
+        AliGCone(); /* Default Constructor */
+        AliGCone( Text_t *name, Text_t *title, Float_t dz, Float_t rmin1, Float_t rmax1, Float_t rmin2, Float_t rmax2 );
+        AliGCone( Text_t *name, Text_t *title, Float_t dz, Float_t rmax1, Float_t rmax2=0 );
+        AliGCone(AliGCone *cone);
+       virtual ~AliGCone(); /* Destructor */
+
+        Float_t GetRmin2() {return fRmin2;}
+        Float_t GetRmax2() {return fRmax2;}
+
+        virtual void  DrawShape(Option_t *option); // *MENU*
+        virtual void  Draw(Option_t *option);
+        virtual void  SetPoints(Float_t *buff);
+
+    ClassDef(AliGCone,1) // Simple cone class
+};
+#endif
diff --git a/GEODB/AliGConfig.cxx b/GEODB/AliGConfig.cxx
new file mode 100644 (file)
index 0000000..92d214d
--- /dev/null
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+// 
+// 1998/11/25
+// ---------------------------------------------------------------------------
+//
+// AliGConfig Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo/David Collados/Antonino Bajeli
+//
+// ---------------------------------------------------------------------------
+
+#include <iostream.h>
+#include "AliGConfig.h"
+
+ClassImp(AliGConfig)
+
+//-------------------------------------------------------------------------
+
+AliGConfig::AliGConfig( Text_t* name, Text_t* title, TStringLong formula, Text_t* detail, const Text_t* shapetype, const Text_t* shapename, const Text_t* materialname, Int_t beg, Int_t end ) : TNamed(name, title)
+{
+    /* Constructor */
+    fBeg.Set(beg,0000);           // Time validity of node version
+    fDetail       = detail;       // Level of detail
+    fEnd.Set(end,0000);           // Time validity of node version
+
+    fFormula      = formula;      //Formula describing the node structure below
+    fMaterialName = materialname;
+    fShapeName    = shapename;
+    fShapeType    = shapetype;
+}
+
+//-------------------------------------------------------------------------
+
+AliGConfig::AliGConfig( AliGConfig* Config )
+{
+    if( Config ) {
+        /* Copy Constructor */
+        fBeg.Copy(Config->fBeg);                // Time validity of node version
+        fDetail       = Config->fDetail.Copy(); // Level of detail
+        fEnd.Copy(Config->fEnd);                // Time validity of node version
+
+        fFormula      = Config->fFormula.Copy();
+        fMaterialName = Config->fMaterialName.Copy();
+        fName         = Config->fName.Copy();
+        fShapeName    = Config->fShapeName.Copy();
+        fShapeType    = Config->fShapeType.Copy();
+        fTitle        = Config->fTitle.Copy();
+    }
+    else {
+        /* Default Constructor */
+        fBeg.Set();           // Time validity of node version
+        fDetail       = "";   // Level of detail
+        fEnd.Set();           // Time validity of node version
+        fFormula      = "";   // Formula describing the node structure below         
+        fMaterialName = "";
+        fName         = "";
+        fShapeName    = "";
+        fShapeType    = "";
+        fTitle        = "";
+    }
+}
+
+//-------------------------------------------------------------------------
+
+AliGConfig::~AliGConfig() 
+{
+    /* Destructor */
+}
+
+//-------------------------------------------------------------------------
+
+AliGConfig* AliGConfig::operator=( AliGConfig* Config )
+{
+    /* Operator = */
+    if( this == Config) return this; // special case.
+
+    Config->fBeg.Copy(this->fBeg);     // Time validity of node version
+    fDetail       = Config->fDetail;   // Level of detail
+    Config->fEnd.Copy(this->fEnd);     // Time validity of node version
+
+    fFormula      = Config->fFormula.Copy();
+    fMaterialName = Config->fMaterialName.Copy();
+    fName         = Config->fName.Copy();
+    fShapeName    = Config->fShapeName.Copy();
+    fShapeType    = Config->fShapeType.Copy();
+    fTitle        = Config->fTitle.Copy();
+
+    return this;
+}
+
+//-------------------------------------------------------------------------
+
diff --git a/GEODB/AliGConfig.h b/GEODB/AliGConfig.h
new file mode 100644 (file)
index 0000000..b68609e
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef ALIGConfig_H
+#define ALIGConfig_H
+
+#include <TNamed.h>
+#include <TString.h>
+#include <TStringLong.h>
+#include <TDatime.h>
+
+class AliGConfig: public TNamed {
+
+    protected:
+        TDatime     fBeg;        // Time validity of node version
+        TString     fDetail;     // Level of detail
+        TDatime     fEnd;        // Time validity of node version
+        //char*       fFormula;    // Formula describing the node structure below         
+        TStringLong fFormula;    // Formula describing the node structure below         
+        TString     fMaterialName;
+        TString     fShapeName;
+        TString     fShapeType;
+
+    public:
+        AliGConfig( Text_t* name, Text_t* title, TStringLong formula, Text_t* detail=NULL, const Text_t* shapetype=NULL, const Text_t* shapename=NULL, const Text_t* materialname=NULL, Int_t beg=0, Int_t end=0 );
+        AliGConfig( AliGConfig* Config=NULL ); /* Copy Constructor */
+        virtual ~AliGConfig(); /* Destructor */
+        AliGConfig* operator=( AliGConfig* Config ); /* Operator = */
+
+        TStringLong GetFormula()      const { return fFormula;      }
+        TString     GetMaterialName() const { return fMaterialName; }
+        TString     GetShapeName()    const { return fShapeName;    }
+        TString     GetShapeType()    const { return fShapeType;    }
+
+    ClassDef(AliGConfig,1)   //Config class
+};
+#endif
diff --git a/GEODB/AliGEODB.cxx b/GEODB/AliGEODB.cxx
new file mode 100644 (file)
index 0000000..eac26df
--- /dev/null
@@ -0,0 +1,1968 @@
+//////////////////////////////////////////////////////
+//  C++ dummy interface to Geant3 basic routines    //
+//////////////////////////////////////////////////////
+
+#include <iostream.h>
+#include <TBrowser.h>
+#include <TCanvas.h>
+#include "AliGEODB.h"
+#include "AliGNode.h"
+#include "AliGShape.h"
+#include "AliGMaterial.h"
+#include "AliGTransform.h"
+#include "AliGTube.h"
+#include "AliGBox.h"
+#include "AliGTRD1.h"
+#include "AliGPCone.h"
+#include "AliGeometry.h"
+
+//---------------------------------------------------------
+
+#define MAXMAT 1000
+
+struct Mater{
+    char*    fName;
+    Float_t  fA;
+    Float_t  fZ;
+    Float_t  fDens;
+    Float_t  fRadl;
+    Float_t  fAbsl;
+    Float_t* fBuf;
+    Int_t    fNwbuf;
+};
+
+Mater* AliMaterials[MAXMAT]; // Array of Mater structs containing the AliMaterial parameters.
+
+struct Med{
+    char*    fName;
+    Int_t    fNmat;
+    Int_t    fIsvol;
+    Int_t    fIfield;
+    Float_t  fFieldm;
+    Float_t  fTmaxfd;
+    Float_t  fStemax;
+    Float_t  fDeemax;
+    Float_t  fEpsil;
+    Float_t  fStmin;
+    Float_t* fUbuf;
+    Int_t    fNbuf;
+};
+
+Med* AliMediums[MAXMAT]; // Array of Med structs containing the AliMedium parameters.
+
+struct NodePosp{
+    char* name;
+    char* shape;
+    Int_t nmed;
+};
+
+NodePosp* Posp[MAXMAT];
+
+AliGMaterial* Mat[MAXMAT]; // List of Pointers to my AliGMaterials created
+
+Int_t  MateCount   = 0;
+Int_t  MedCount    = 0;
+Int_t  MatrCount   = 0;
+Int_t  PospCount   = 0;
+Int_t  Color       = 2;
+
+TList* listNodes     = new TList(); // List of Nodes
+TList* listTransf    = new TList();
+TList* listShapes    = new TList();
+TList* listMaterials = new TList();
+
+AliGNode* TopNode    = NULL;
+
+/***********************************************************************/
+
+ClassImp(AliGEODB)
+
+/***********************************************************************/
+
+AliGEODB::AliGEODB(const char *title, Int_t) : AliMC("AliGEODB",title)
+{
+    //cout << " AliGEODB" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::DefaultRange() 
+{
+    cout << " DefaultRange" << endl;
+}
+//=======================functions from GBASE
+
+/***********************************************************************/
+
+void    AliGEODB::Gfile(const char*, const char*) 
+{
+    cout << " Gfile" << endl;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::GeomIter() 
+{
+    cout << " GeomIter" << endl;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::CurrentMaterial(Float_t &, Float_t &, Float_t &, Float_t &, Float_t &) const 
+{
+    cout << " CurrentMaterial" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::NextVolUp(Text_t*, Int_t&) 
+{
+    cout << " NextVolUp" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::CurrentVol(Text_t*, Int_t&) const 
+{
+    cout << " CurrentVol" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::NofVolumes() const 
+{
+    cout << " NofVolumes" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::CurrentVolOff(Int_t, Text_t*, Int_t&) const 
+{
+    cout << " CurrentVolOff" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::TrackPosition(Float_t*) const 
+{
+    cout << " TrackPosition" << endl;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::TrackMomentum(Float_t*) const 
+{
+    cout << " TrackMomentum" << endl;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::VolId( Text_t* name ) const 
+{
+    cout << " VolId" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+const char* AliGEODB::VolName(Int_t ) const 
+{
+    cout << " VolName" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+    
+Float_t AliGEODB::TrackCharge() const 
+{
+    cout << " TrackCharge" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Float_t AliGEODB::TrackMass() const 
+{
+    cout << " TrackMass" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Bool_t  AliGEODB::TrackInside() const 
+{
+    cout << " TrackInside" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Bool_t  AliGEODB::TrackEntering() const 
+{
+    cout << " TrackEntering" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Bool_t  AliGEODB::TrackExiting() const 
+{
+    cout << " TrackExiting" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Bool_t  AliGEODB::TrackOut() const 
+{
+    cout << " TrackOut" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Bool_t  AliGEODB::TrackDisappear() const 
+{
+    cout << " TrackDisappear" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Bool_t  AliGEODB::TrackStop() const 
+{
+    cout << " TrackStop" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::NSecondaries() const 
+{
+    cout << " NSecondaries" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::ProdProcess(char*) const 
+{
+    cout << " ProdProcess" << endl;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::GetSecondary(Int_t, Int_t&, Float_t*, Float_t*)
+{
+    cout << " GetSecondary" << endl;
+}
+
+/***********************************************************************/
+
+Float_t AliGEODB::MaxStep() const 
+{
+    cout << " MaxStep" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::SetMaxStep(Float_t ) 
+{
+    cout << " SetMaxStep" << endl;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::GetParticle(const Int_t, char*, Float_t&) const 
+{
+    cout << " GetParticle" << endl;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::CurrentEvent() const 
+{
+    cout << " CurrentEvent" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::GetMedium() const 
+{
+    cout << " GetMedium" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Float_t AliGEODB::Edep() const 
+{
+    cout << " Edep" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+    
+Float_t AliGEODB::Etot() const 
+{
+    cout << " Etot" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::Rndm(Float_t*, const Int_t) const 
+{
+    cout << " Rndm" << endl;
+}
+
+/***********************************************************************/
+
+Float_t AliGEODB::TrackStep() const 
+{
+    cout << " TrackStep" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+    
+Float_t AliGEODB::TrackLength() const 
+{
+    cout << " TrackLength" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Float_t AliGEODB::TrackTime() const 
+{
+    cout << " TrackTime" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::TrackPid() const 
+{
+    cout << " TrackPid" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+    
+Bool_t  AliGEODB::TrackAlive() const 
+{
+    cout << " TrackAlive" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::StopTrack() 
+{
+    cout << " StopTrack" << endl;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::StopEvent() 
+{
+    cout << " StopEvent" << endl;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::SetMaxNStep(Int_t) 
+{
+    cout << " SetMaxNStep" << endl;
+}
+
+/***********************************************************************/
+
+void    AliGEODB::SetColors() 
+{
+    cout << " SetColors" << endl;
+}
+
+/***********************************************************************/
+
+Int_t   AliGEODB::GetMaxNStep() const 
+{
+    cout << " GetMaxNStep" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+void AliGEODB::Material( Int_t& kmat, const char* name, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl,Float_t* buf, Int_t nwbuf )
+{
+    if( MateCount >= MAXMAT ) {
+        printf( " ERROR: Material number: %d bigger that MAXMAT: %d => Out of array\n", MateCount, MAXMAT );
+        exit(0);
+    }
+
+    Mater*   AliMat = new Mater;
+    char*    fname  = new char[strlen(name)+1];
+    Float_t* fbuf   = new Float_t[nwbuf];
+
+    strcpy( fname, name );
+    fname[strlen(name)] = '\x0';
+
+    AliMat->fName  = fname;
+    AliMat->fA     = a;
+    AliMat->fZ     = z;
+    AliMat->fDens  = dens;
+    AliMat->fRadl  = radl;
+    AliMat->fAbsl  = absl;
+    AliMat->fNwbuf = nwbuf;
+
+    for( int i=0; i<nwbuf; i++ )
+        fbuf[i] = buf[i];
+
+    AliMat->fBuf = fbuf;
+    
+    AliMaterials[MateCount] = AliMat;
+
+    kmat = MateCount++;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Mixture( Int_t& imat, const char* name, Float_t* a, Float_t* z, Float_t dens, Int_t nlmat, Float_t* wmat )
+{
+    if( MateCount >= MAXMAT ) {
+        printf( " ERROR: Mixture number: %d bigger that MAXMAT: %d => Out of array\n", MateCount, MAXMAT );
+        exit(0);
+    }
+
+    Mater* AliMat   = new Mater;
+    char*    fname  = new char[strlen(name)+1];
+
+    strcpy( fname, name );
+    fname[strlen(name)] = '\x0';
+
+    AliMat->fName   = fname;
+    Float_t MidA    = 0.;
+    Float_t MidZ    = 0.;
+    Float_t SUMwmat = 0.;
+
+    for( int i=0; i<nlmat; i++ ) {
+        MidA    += wmat[i]*a[i];
+        MidZ    += wmat[i]*z[i];
+        SUMwmat += wmat[i];
+    }
+
+    MidA            = MidA/SUMwmat;
+    MidZ            = MidZ/SUMwmat;
+
+    AliMat->fA      = MidA;
+    AliMat->fZ      = MidZ;
+    AliMat->fDens   = dens;
+    AliMat->fRadl   = 0.;
+    AliMat->fAbsl   = 0.;
+    AliMat->fNwbuf  = 0;
+
+    AliMat->fBuf    = NULL;
+
+    AliMaterials[MateCount] = AliMat;
+
+    imat = MateCount++;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Medium( Int_t& numed, const char* name, Int_t nmat, Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax, Float_t epsil, Float_t stmin, Float_t* ubuf, Int_t nbuf )
+{
+    if( MedCount >= MAXMAT ) {
+        printf( " ERROR: Medium number: %d bigger that MAXMAT: %d => Out of array\n", MedCount, MAXMAT );
+        exit(0);
+    }
+
+    Med*     AliMed = new Med;
+    char*    fname  = new char[strlen(name)+1];
+    Float_t* fUbuf  = new Float_t[nbuf];
+
+    strcpy( fname, name );
+    fname[strlen(name)] = '\x0';
+    
+    AliMed->fName   = fname;
+    AliMed->fNmat   = nmat;
+    AliMed->fIsvol  = isvol;
+    AliMed->fIfield = ifield;
+    AliMed->fFieldm = fieldm;
+    AliMed->fTmaxfd = tmaxfd;
+    AliMed->fStemax = stemax;
+    AliMed->fDeemax = deemax;
+    AliMed->fEpsil  = epsil;
+    AliMed->fStmin  = stmin;
+    AliMed->fNbuf   = nbuf;
+    
+    for( int i=0; i<nbuf; i++ )
+        fUbuf[i] = ubuf[i];
+
+    AliMed->fUbuf = fUbuf;
+
+    AliMediums[MedCount] = AliMed;
+
+    numed = MedCount++;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Matrix( Int_t &nmate , Float_t theta1, Float_t phi1, Float_t theta2, Float_t phi2, Float_t theta3, Float_t phi3 ) 
+{
+    char* transname = new char[10];
+    sprintf(transname, "%s%d", "tra", MatrCount);
+
+    AliGTransform* tra = new AliGTransform( transname, transname, theta1, phi1, theta2, phi2, theta3, phi3 );
+
+    //printf( " Created new AliGTransform( %s, %s, %f, %f, %f, %f, %f, %f );\n", transname, transname, theta1, phi1, theta2, phi2, theta3, phi3 );
+
+    listTransf->AddAt( tra, MatrCount );
+
+    nmate = ++MatrCount;
+
+}
+
+/***********************************************************************/
+
+void  AliGEODB::WriteEuclid(const char*, const char*, Int_t, Int_t) 
+{
+    cout << " WriteEuclid" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gpcxyz() 
+{
+    cout << " Gpcxyz " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Ggclos() 
+{
+
+    for( int i=0; i<listNodes->GetSize(); i++ ) {
+        AliGNode* node = (AliGNode*) listNodes->At(i);
+        char* name = new char[strlen(node->GetName())+1];
+        strcpy(name, node->GetName());
+        name[strlen(node->GetName())] = '\x0';
+        node->AddConfig(name, name,"detail",981201,991201);
+    }
+
+    printf( " Total number of nodes = %d\n", listNodes->GetSize() );
+
+    SetVisibility( "TPC_1",   1 );
+    SetVisibility( "TGAS_1",  1 );
+    SetVisibility( "TPSG_1",  1 );
+    SetVisibility( "TPHV_1",  1 );
+    SetVisibility( "TRCS_1",  1 );
+    SetVisibility( "TSGA_1",  1 );
+    SetVisibility( "TRCL_1",  1 );
+    SetVisibility( "TLGA_1",  1 );
+    SetVisibility( "TSST_1",  1 );
+    SetVisibility( "TSST_2",  1 );
+    SetVisibility( "TSST_3",  1 );
+    SetVisibility( "TSST_4",  1 );
+    SetVisibility( "TSST_5",  1 );
+    SetVisibility( "TSST_6",  1 );
+    SetVisibility( "TSST_7",  1 );
+    SetVisibility( "TSST_8",  1 );
+    SetVisibility( "TSST_9",  1 );
+    SetVisibility( "TSST_10", 1 );
+    SetVisibility( "TSST_11", 1 );
+    SetVisibility( "TSST_12", 1 );
+    SetVisibility( "TSST_13", 1 );
+    SetVisibility( "TSST_14", 1 );
+    SetVisibility( "TSST_15", 1 );
+    SetVisibility( "TSST_16", 1 );
+    SetVisibility( "TSST_17", 1 );
+    SetVisibility( "TSST_18", 1 );
+    SetVisibility( "TSST_19", 1 );
+    SetVisibility( "TSST_20", 1 );
+    SetVisibility( "TSST_21", 1 );
+    SetVisibility( "TSST_22", 1 );
+    SetVisibility( "TSST_23", 1 );
+    SetVisibility( "TLST_1",  1 );
+    SetVisibility( "TLST_2",  1 );
+    SetVisibility( "TLST_3",  1 );
+    SetVisibility( "TLST_4",  1 );
+    SetVisibility( "TLST_5",  1 );
+    SetVisibility( "TLST_6",  1 );
+    SetVisibility( "TLST_7",  1 );
+    SetVisibility( "TLST_8",  1 );
+    SetVisibility( "TLST_9",  1 );
+    SetVisibility( "TLST_10", 1 );
+    SetVisibility( "TLST_11", 1 );
+    SetVisibility( "TLST_12", 1 );
+    SetVisibility( "TLST_13", 1 );
+    SetVisibility( "TLST_14", 1 );
+    SetVisibility( "TLST_15", 1 );
+    SetVisibility( "TLST_16", 1 );
+    SetVisibility( "TLST_17", 1 );
+    SetVisibility( "TLST_18", 1 );
+    SetVisibility( "TLST_19", 1 );
+    SetVisibility( "TLST_20", 1 );
+    SetVisibility( "TLST_21", 1 );
+    SetVisibility( "TLST_22", 1 );
+    SetVisibility( "TLST_23", 1 );
+    SetVisibility( "TLST_24", 1 );
+    SetVisibility( "TLST_25", 1 );
+    SetVisibility( "TLST_26", 1 );
+    SetVisibility( "TLST_27", 1 );
+    SetVisibility( "TLST_28", 1 );
+    SetVisibility( "TLST_29", 1 );
+    SetVisibility( "TLST_30", 1 );
+    SetVisibility( "TLST_31", 1 );
+    SetVisibility( "TLST_32", 1 );
+    SetVisibility( "TLST_33", 1 );
+    SetVisibility( "TLST_34", 1 );
+    SetVisibility( "TLST_35", 1 );
+    SetVisibility( "TLST_36", 1 );
+    SetVisibility( "TLST_37", 1 );
+    SetVisibility( "TLST_38", 1 );
+    SetVisibility( "TLST_39", 1 );
+    SetVisibility( "TLST_40", 1 );
+    SetVisibility( "TLST_41", 1 );
+    SetVisibility( "TLST_42", 1 );
+    SetVisibility( "TLST_43", 1 );
+    SetVisibility( "TLST_44", 1 );
+    SetVisibility( "TLST_45", 1 );
+    SetVisibility( "TLST_46", 1 );
+    SetVisibility( "TLST_47", 1 );
+    SetVisibility( "TLST_48", 1 );
+    SetVisibility( "TLST_49", 1 );
+    SetVisibility( "TLST_50", 1 );
+    SetVisibility( "TLST_51", 1 );
+    SetVisibility( "TLST_52", 1 );
+    SetVisibility( "TSWS_1",  1 );
+    SetVisibility( "TSWS_2",  1 );
+    SetVisibility( "TSWS_3",  1 );
+    SetVisibility( "TPW1_1",  1 );
+    SetVisibility( "TPW2_1",  1 );
+    SetVisibility( "TPW3_1",  1 );
+    SetVisibility( "TPW4_1",  1 );
+    SetVisibility( "TSPI_1",  1 );
+    SetVisibility( "TSP1_1",  1 );
+    SetVisibility( "TSPO_1",  1 );
+    SetVisibility( "TSP2_1",  1 );
+    SetVisibility( "TSWH_1",  1 );
+    SetVisibility( "TSW1_1",  1 );
+    SetVisibility( "TCOV_1",  1 );
+    SetVisibility( "TPOI_1",  1 );
+    SetVisibility( "TSWS_4",  1 );
+    SetVisibility( "TSWS_5",  1 );
+    SetVisibility( "TSWS_6",  1 );
+    SetVisibility( "TSWS_7",  1 );
+    SetVisibility( "TSWS_8",  1 );
+    SetVisibility( "TSWS_9",  1 );
+    SetVisibility( "TSWS_10", 1 );
+    SetVisibility( "TSWS_11", 1 );
+    SetVisibility( "TSWS_12", 1 );
+    SetVisibility( "TSWS_13", 1 );
+    SetVisibility( "TPIV_1",  1 );
+    SetVisibility( "TPVD_1",  1 );
+
+    printf( " Visibilities activated \n" );
+
+    AliGeometry* Geom1 = new AliGeometry( "Geom1", "Geom1", TopNode, 0 );
+
+    TCanvas* c1 = new TCanvas( "TPC", "Geometry Shapes", 100, 100, 750, 750 );
+    c1->Range(0,0,1,1);
+    c1->SetFillColor(32); // Light Green
+    c1->SetBorderSize(3);
+    c1->SetBorderMode(0); // -1 (down) 0 (no) 1 (up)
+
+    TopNode->Draw("same");
+
+    TFile* file1 = new TFile( "GeoDB.root", "RECREATE" );
+    cout << endl << " Storing GeoDB.root file.  Please, be patient...    :-)" << endl;
+    TopNode->SaveAll(file1);
+
+    file1->cd();
+
+    if( Geom1 ) {
+        Geom1->Write();
+        cout << " Geometry saved in disk " << endl;
+    }
+
+    file1->Write();
+    file1->Close();
+
+    TFile* file2 = new TFile( "GeoDB.root", "READ" );
+    file2->cd();
+    AliGeometry* Geom2  = new AliGeometry( (AliGeometry*) file2->Get("Geom1") );
+
+    // Retrieve the memory tree structure from AliGeoDB.root and stores it in memory, being tree_root the top node
+    AliGNode* tree_root = new AliGNode( Geom2->FileToMemTree( file2 ) );
+    //AliGNode* tree_root = new AliGNode( Geom2->FileToMemTree( "GeoDB.root", "Geom1" ) );
+
+    TFile* file3 = new TFile( "GeoDB2.root", "RECREATE" );
+    cout << " Storing GeoDB2.root file. Please, be patient again...   :-)" << endl;
+    tree_root->SaveAll( file3 ); // Memory tree structure saved in disk (second time)
+
+    file3->cd();
+
+    if( Geom2 ) {
+        Geom2->Write();
+        cout << " Geometry saved in disk " << endl;
+    }
+
+    file3->Write();
+    file3->Close();
+
+    file2->Close();
+
+    cout << " The two databases are stored in disk." << endl;
+
+    TFile* file4 = new TFile( "GeoDB.root" , "READ" );
+    TFile* file5 = new TFile( "GeoDB2.root", "READ" );
+
+    TBrowser* a = new TBrowser();
+
+    //DrawTree( TopNode, 0 );
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetVisibility(Text_t* name, Int_t val)
+{
+   AliGNode* node = (AliGNode*) listNodes->FindObject( name );
+
+   if( node )
+       node->SetVis(val);
+   else
+       printf( " ERROR!!! I couldn't find the node %s in the listNodes.\n", name );
+}
+
+/***********************************************************************/
+
+void AliGEODB::DrawTree( AliGNode* topnode, Int_t tabs )
+{
+
+    for( int i=0; topnode->GetNodeFromfNode(i); i++ ) {
+        for( int j=0; j<tabs; j++ )
+            cout << " ";
+        cout << topnode->GetNodeFromfNode(i)->GetName() << endl;
+        tabs+=5;
+        DrawTree( topnode->GetNodeFromfNode(i), tabs );
+        tabs-=5;
+    }
+
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Glast() 
+{
+    cout << " Glast " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gprint(const char*) 
+{
+    cout << " Gprint " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Grun() 
+{
+    cout << " Grun " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gtrig() 
+{
+    cout << " Gtrig " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gtrigc() 
+{
+    cout << " Gtrigc " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gtrigi() 
+{
+    cout << " Gtrigi " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gwork(Int_t) 
+{
+    cout << " Gwork " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gzinit() 
+{
+    cout << " Gzinit " << endl;
+}
+
+//=======================functions from GCONS
+
+/***********************************************************************/
+
+void  AliGEODB::Gfmate(Int_t, char*, Float_t&, Float_t&, Float_t&, Float_t&, Float_t&, Float_t*, Int_t&)
+{
+    cout << " Gfmate " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gfpart(Int_t, char*, Int_t&, Float_t&, Float_t&, Float_t&)
+{
+    cout << " Gfpart " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gftmed(Int_t, char*, Int_t&, Int_t&, Int_t&, Float_t&, Float_t&,Float_t&, Float_t&, Float_t&, Float_t&, Float_t*, Int_t*)
+{
+    cout << " Gftmed " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gmate() {
+    cout << " Gmate " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gpart() 
+{
+    AliGTransform* Identity = new AliGTransform("Identity","Identity","rot 0. 0. 0.");
+    //printf( " Created new AliGTransform( Identity, Identity, rot 0. 0. 0. );\n" );
+
+    listTransf->AddAt( Identity, MatrCount );
+    MatrCount++;
+
+    AliGBox*  box  = new AliGBox("box","box", 400,400,400);
+    AliGNode* ALIC = new AliGNode( "ALIC", 1,"ALIC", box);
+    TopNode = ALIC;
+
+    listNodes->Add(ALIC);
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsdk(Int_t, Float_t*, Int_t*) {
+    cout << " Gsdk " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsmate(Int_t, const char*, Float_t, Float_t, Float_t, Float_t, Float_t) {
+    cout << " Gsmate " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsmixt(Int_t, const char*, Float_t*, Float_t*, Float_t, Int_t, Float_t*) {
+    cout << " Gsmixt " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gspart(Int_t, const char*, Int_t,   Float_t, Float_t, Float_t) {
+    cout << " Gspart " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gstmed(Int_t, const char*, Int_t, Int_t, Int_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t) {
+    cout << " Gstmed " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gstpar(Int_t, const char*, Float_t) 
+{
+    //cout << " Gstpar " << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsckov(Int_t, Int_t, Float_t *, Float_t *, Float_t *, Float_t *) 
+{
+    cout << " Gsclov " << endl;
+}
+
+/***********************************************************************/
+
+//=======================functions from GKINE
+
+void  AliGEODB::Gfkine(Int_t, Float_t*, Float_t*, Int_t&, Int_t&) 
+{
+    cout << " Gfkine" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gfvert(Int_t, Float_t*, Int_t&, Int_t&, Float_t&) 
+{
+    cout << " Gfvert" << endl;
+}
+
+/***********************************************************************/
+
+Int_t AliGEODB::Gskine(Float_t*, Int_t, Int_t, Float_t*, Int_t)
+{
+    cout << " Gskine" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+Int_t AliGEODB::Gsvert(Float_t*, Int_t, Int_t, Float_t*, Int_t)
+{
+    cout << " Gsvert" << endl;
+    return 0;
+}
+
+/***********************************************************************/
+
+//=======================functions from GPHYS
+
+void  AliGEODB::Gphysi() 
+{
+    cout << " Gphysi" << endl;
+}
+
+/***********************************************************************/
+
+//=======================functions from GTRAK
+
+void  AliGEODB::Gdebug() 
+{
+    cout << " Gdebug" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gekbin() 
+{
+    cout << " Gekbin" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gfinds() 
+{
+    cout << " Gfinds" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsking(Int_t) 
+{
+    cout << " Gsking" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gskpho(Int_t) 
+{
+    cout << " Gskpho" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsstak(Int_t) 
+{
+    cout << " Gsstak" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsxyz() 
+{
+    cout << " Gsxyz" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gtrack() 
+{
+    cout << " Gtrack" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gtreve() 
+{
+    cout << " Gtreve" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Grndm(Float_t*, const Int_t) const 
+{
+    cout << " Grndm" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Grndmq(Int_t&, Int_t&, const Int_t, const Text_t*) 
+{
+    cout << " Grndmq" << endl;
+}
+
+/***********************************************************************/
+
+//=======================functions from GDRAW
+
+void  AliGEODB::Gdxyz(Int_t ) 
+{
+    cout << " Gdxyz" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdcxyz() 
+{
+    cout << " Gdcxyz" << endl;
+}
+
+/***********************************************************************/
+
+//=======================functions from GGEOM
+
+void  AliGEODB::Gdtom(Float_t*, Float_t*, Int_t) 
+{
+  printf( " Gdtom.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Glmoth(const char*, Int_t, Int_t&, Int_t*, Int_t*) 
+{
+  printf( " Glmoth.\n" );
+
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gmedia(Float_t*, Int_t&) 
+{
+  printf( " Gmedia.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gmtod(Float_t*, Float_t*, Int_t) 
+{
+  printf( " Gmtod.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsdvn(const char* name, const char* parentname, Int_t ndiv, Int_t iaxis) 
+{
+    cout << " Inside Gsdvn " << endl;
+    /* Divides one node in Ndiv nodes in the iaxis direction*/
+
+    char* transfname = new char[10];
+    char* nodename   = new char[10];
+
+    AliGNode* parent = (AliGNode*) listNodes->FindObject(parentname);
+
+    /* Find the shape that will result from the division*/
+
+    /* BOX */
+    if( parent->GetShape()->ClassName() == "AliGBox" ) {
+        AliGMaterial* material = new AliGMaterial(parent->GetMaterial());
+
+        Float_t Dx, Dy, Dz;
+
+        switch (iaxis) {
+            case 1 : Dx = ((AliGBox*)(parent->GetShape()))->GetX() / ndiv;
+                    Dy = ((AliGBox*)(parent->GetShape()))->GetY();
+                    Dz = ((AliGBox*)(parent->GetShape()))->GetZ();
+                     break;
+                    
+            case 2 : Dx = ((AliGBox*)(parent->GetShape()))->GetX() ;
+                     Dy = ((AliGBox*)(parent->GetShape()))->GetY()/ ndiv;
+                     Dz = ((AliGBox*)(parent->GetShape()))->GetZ();
+                     break;
+
+            case 3 : Dx = ((AliGBox*)(parent->GetShape()))->GetX() ;
+                     Dy = ((AliGBox*)(parent->GetShape()))->GetY();
+                     Dz = ((AliGBox*)(parent->GetShape()))->GetZ()/ ndiv;
+                     break;
+                     
+            default: Dx = Dy = Dz = 0.;
+        };
+
+        AliGBox* box = new AliGBox("box","box", Dx, Dy, Dz);
+
+        /* Create the nodes son*/
+
+        Float_t x, y, z;
+        Text_t* expression;
+        
+        for( int i=0; i<ndiv; i++ ) {
+            //nodename = "Node";
+            nodename[4] = '\x0';
+            sprintf( nodename, "%s%d", nodename, i );
+            transfname = "trans";
+            transfname[5] = '\x0';
+            sprintf( transfname, "%s%d", transfname, i );
+
+            switch (iaxis) {
+                case 'X' :
+                case 'x' : x = ndiv *i;
+                          y = 0;
+                           z = 0;
+                          break;
+                case 'Y' :
+                case 'y' : x = 0;
+                          y = ndiv *i;
+                          z = 0;
+                          break;
+
+                case 'Z' :
+                case 'z' : x = 0;
+                          y = 0;
+                          z = ndiv *i;
+                          break;
+            };
+
+            /* Positioning the sons (only translations) and adding them to the parent*/
+    
+            sprintf( expression, "%s %f %f %f", "tra", x, y, z );
+            AliGTransform* tran = new AliGTransform( transfname, transfname, expression );
+
+            char* nodname = new char[strlen(name)];
+            strcpy( nodname, name );
+            AliGNode* son = new AliGNode( nodname, i, nodname, box, material );
+            if( nodname ) delete [] nodname;
+            
+            parent->Add( son, tran );
+            parent->AddConfig("","");
+            listNodes->AddLast(son);
+        }
+    }
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsdvn2(const char*, const char*, Int_t, Int_t, Float_t, Int_t) 
+{
+  printf( " Gsdvn2.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsdvs(const char*, const char*, Float_t, Int_t, Int_t) 
+{
+  printf( " Gsdvs.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsdvs2(const char*, const char*, Float_t, Int_t, Float_t, Int_t) 
+{
+  printf( " Gsdvs2.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsdvt(const char*, const char*, Float_t, Int_t, Int_t, Int_t) 
+{
+  printf( " Gsdvt.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsdvt2(const char *, const char *, Float_t, Int_t, Float_t, Int_t, Int_t) 
+{
+  printf( " Gsdvt2.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsord(const char*, Int_t) 
+{
+  // Aqui entra pero dice Federico que Dummy.
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gspos( const char *name, Int_t nr, const char *mother, Float_t x, Float_t y, Float_t z, Int_t irot, const char* konly ) 
+{
+
+    if( !strcmp(mother, "ALIC") )
+        mother = "ALIC_1";
+
+    AliGNode* son    = NULL;
+    AliGNode* parent = NULL;
+
+    char* nodename   = new char[strlen(name)+1];
+    strcpy( nodename, name );
+    nodename[strlen(name)] = '\x0';
+
+    TObjLink *lnk = listNodes->FirstLink();
+    int quit=0;
+
+    while( (lnk) && (!quit) ) {
+        TObject *obj = lnk->GetObject();
+
+        if( obj->GetName() ) {
+            char* NodeName = new char[strlen(obj->GetName())+1];
+            strcpy( NodeName, obj->GetName() );
+            NodeName[strlen(obj->GetName())] = '\x0';
+
+            int i;
+            for( i=0; NodeName[i]!='_'; i++ );
+
+            if( !strncmp(nodename, NodeName, i) )
+                son = (AliGNode*) obj;
+            else
+                if( !strncmp(mother, NodeName, i) )
+                    parent = (AliGNode*) obj;
+
+            if( NodeName ) delete [] NodeName;
+
+            if( (son != NULL) && (parent != NULL) )
+                quit = 1;
+        }
+
+        lnk = lnk->Next();
+    }
+
+    if( son == NULL ) {
+        cout << " ERROR in Gspos. Couldn't find node " << nodename << " inside listNodes." << endl;
+        exit(1);
+    }
+    else
+        if( parent == NULL) {
+            cout << " ERROR in Gspos. Couldn't find node " << mother << " inside listNodes." << endl;
+            exit(1);
+        }
+
+    AliGTransform* tra = (AliGTransform*)listTransf->At(MatrCount - 1);
+
+    TVector* matrix = tra->GetMatrix();
+    char* transname = new char[10];
+    sprintf(transname, "%s%d", "tra", MatrCount );
+
+    TVector &mat = *matrix;
+    AliGTransform* newtra = new AliGTransform(transname, transname, mat(0), mat(1),  mat(2), mat(4), mat(5), mat(6),mat(8), mat(9), mat(10), x, y, z);
+
+    //printf( "\n Created new AliGTransform( %s, %s, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f );\n", transname, transname, mat(0), mat(1), mat(2), mat(4), mat(5), mat(6), mat(8), mat(9), mat(10), x, y, z );
+
+    listTransf->AddAt(newtra, MatrCount);
+    MatrCount++;
+
+    parent->Add(son, newtra);
+    //printf( " %s->Add( %s, %s );\n", parent->GetName(), son->GetName(), newtra->GetName() );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsposp( const char* nodename, Int_t nr, const char* mother, Float_t x, Float_t y, Float_t z, Int_t irot, const char* konly, Float_t* upar, Int_t np ) 
+{
+    //printf( "\n" );
+
+    Int_t i;
+    
+    for( i=0; i<PospCount; i++ )
+        if( !strcmp(Posp[i]->name, nodename) )
+           break;
+
+    char* shapename  = Posp[i]->shape;
+    Int_t nmed       = Posp[i]->nmed;
+
+    char* fnodename  = new char[strlen(nodename)+1];
+    strcpy(fnodename, nodename);
+    fnodename[strlen(nodename)] = '\x0';
+
+    char* fmother    = new char[strlen(mother)+1];
+    strcpy(fmother, mother);
+    fmother[strlen(mother)] = '\x0';
+    
+    AliGNode* parent = NULL;
+
+    TObjLink *lnk = listNodes->FirstLink();
+    int quit=0;
+
+    while( (lnk) && (!quit) ) {
+        TObject *obj = lnk->GetObject();
+
+        if( obj->GetName() ) {
+            char* NodeName = new char[strlen(obj->GetName())];
+            strcpy( NodeName, obj->GetName() );
+
+            int i;
+            for( i=0; NodeName[i]!='_'; i++ );
+
+            if( !strncmp(fmother, NodeName, i) )
+                    parent = (AliGNode*) obj ;
+            if( NodeName ) delete [] NodeName;
+
+            if( parent != NULL )
+                quit = 1;
+        }
+
+        lnk = lnk->Next();
+    }
+
+    if( parent == NULL) {
+        cout << " ERROR in Gsposp. Couldn't find node " << mother << " inside listNodes." << endl;
+        exit(1);
+    }
+
+    Int_t nmat = AliMediums[nmed]->fNmat;
+
+    AliGMaterial* MyMaterial = NULL;
+    
+    for( int j=0; j<listMaterials->GetSize(); j++ )
+        if( ((AliGMaterial*) listMaterials->At(j))->GetfImat() == nmat ) {
+            MyMaterial = (AliGMaterial*) listMaterials->At(j);
+            /*printf( " AliGMaterial( %d, %s, %s, %d, %d, %f, %f, %f, %f, %f, %f, *fUbuf, %d, %f, %f, %f, %f, %f, *fBuf, %d ); already existed.\n", nmat,AliMaterials[nmat]->fName, AliMaterials[nmat]->fName, AliMediums[nmed]->fIsvol, AliMediums[nmed]->fIfield, AliMediums[nmed]->fFieldm, AliMediums[nmed]->fTmaxfd, AliMediums[nmed]->fStemax, AliMediums[nmed]->fDeemax, AliMediums[nmed]->fEpsil, AliMediums[nmed]->fStmin, AliMediums[nmed]->fNbuf, AliMaterials[nmat]->fA, AliMaterials[nmat]->fZ, AliMaterials[nmat]->fDens, AliMaterials[nmat]->fRadl, AliMaterials[nmat]->fAbsl, AliMaterials[nmat]->fNwbuf );*/
+            break;
+        }
+    
+    if( MyMaterial == NULL ) {
+        MyMaterial = new AliGMaterial( nmat, AliMaterials[nmat]->fName, AliMaterials[nmat]->fName, AliMediums[nmed]->fIsvol, AliMediums[nmed]->fIfield, AliMediums[nmed]->fFieldm, AliMediums[nmed]->fTmaxfd, AliMediums[nmed]->fStemax, AliMediums[nmed]->fDeemax, AliMediums[nmed]->fEpsil, AliMediums[nmed]->fStmin, AliMediums[nmed]->fUbuf, AliMediums[nmed]->fNbuf,  AliMaterials[nmat]->fA, AliMaterials[nmat]->fZ, AliMaterials[nmat]->fDens, AliMaterials[nmat]->fRadl, AliMaterials[nmat]->fAbsl, AliMaterials[nmat]
+->fBuf, AliMaterials[nmat]->fNwbuf );
+
+        /*printf( " Created new AliGMaterial( %d, %s, %s, %d, %d, %f, %f, %f, %f, %f, %f, *fUbuf, %d, %f, %f, %f, %f, %f, *fBuf, %d );\n", nmat,AliMaterials[nmat]->fName, AliMaterials[nmat]->fName, AliMediums[nmed]->fIsvol, AliMediums[nmed]->fIfield, AliMediums[nmed]->fFieldm, AliMediums[nmed]->fTmaxfd, AliMediums[nmed]->fStemax, AliMediums[nmed]->fDeemax, AliMediums[nmed]->fEpsil, AliMediums[nmed]->fStmin, AliMediums[nmed]->fNbuf, AliMaterials[nmat]->fA, AliMaterials[nmat]->fZ, AliMaterials[nmat]->fDens, AliMaterials[nmat]->fRadl, AliMaterials[nmat]->fAbsl, AliMaterials[nmat]->fNwbuf );*/
+
+        listMaterials->Add( MyMaterial );
+    }
+
+    AliGNode* son = NULL;
+
+    // Different constructor depending on the shape
+    if( !strncmp(shapename, "TUBE", 4) ) {
+
+        AliGTube* Shape = NULL;
+        
+        for( int j=0; j<listShapes->GetSize(); j++ )
+            if( ((AliGShape*) listShapes->At(j))->GetName() == shapename ) {
+                Shape = (AliGTube*) listShapes->At(j);
+                //printf( " AliGTube( %s, %s, %f, %f, %f ); already existed.\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                break;
+            }
+
+        if( Shape == NULL ) {
+            Shape = new AliGTube( shapename, shapename, upar[0], upar[1], upar[2] );
+            //printf( " Created new AliGTube( %s, %s, %f, %f, %f );\n", shapename, shapename, upar[0], upar[1], upar[2] );
+            listShapes->Add(Shape);
+        }
+
+        Shape->SetCol(Color);
+        son = new AliGNode( fnodename, nr, fnodename, Shape, MyMaterial );
+    }
+    else
+        if( !strncmp(shapename, "BOX", 3) ) {
+
+            AliGBox* Shape = NULL;
+        
+            for( int j=0; j<listShapes->GetSize(); j++ )
+                if( ((AliGShape*) listShapes->At(j))->GetName() == shapename ) {
+                    Shape = (AliGBox*) listShapes->At(j);
+                    //printf( " AliGBox( %s, %s, %f, %f, %f ); already existed.\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                    break;
+                }
+
+            if( Shape == NULL ) {
+                Shape = new AliGBox( shapename, shapename, upar[0], upar[1], upar[2] );
+                //printf( " Created new AliGBox( %s, %s, %f, %f, %f );\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                listShapes->Add(Shape);
+            }
+            
+            Shape->SetCol(Color);
+            son = new AliGNode( fnodename, nr, fnodename, Shape, MyMaterial );
+        }
+        else
+            if( !strncmp(shapename, "TRD1", 4) ) {
+
+                AliGTRD1* Shape = NULL;
+        
+                for( int j=0; j<listShapes->GetSize(); j++ )
+                    if( ((AliGShape*) listShapes->At(j))->GetName() == shapename ) {
+                        Shape = (AliGTRD1*) listShapes->At(j);
+                        //printf( " AliGTRD1( %s, %s, %f, %f, %f, %f ); already existed.\n", shapename, shapename, upar[0], upar[1], upar[2], upar[3] );
+                        break;
+                    }
+
+                if( Shape == NULL ) {
+                    Shape = new AliGTRD1( shapename, shapename, upar[0], upar[1], upar[2], upar[3] );
+                    //printf( " Created new AliGTRD1( %s, %s, %f, %f, %f, %f );\n", shapename, shapename, upar[0], upar[1], upar[2], upar[3] );
+                    listShapes->Add(Shape);
+                }
+
+                Shape->SetCol(Color);
+                son = new AliGNode( fnodename, nr, fnodename, Shape, MyMaterial );
+            }
+            else
+                if( !strncmp(shapename, "PCON", 4) ) {
+
+                    AliGPCone* Shape = NULL;
+        
+                    for( int j=0; j<listShapes->GetSize(); j++ )
+                        if( ((AliGShape*) listShapes->At(j))->GetName() == shapename ) {
+                            Shape = (AliGPCone*) listShapes->At(j);
+                            //printf( " AliGPCone( %s, %s, %f, %f, %f ); already existed.\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                            break;
+                        }
+
+                    if( Shape == NULL ) {
+                        Shape = new AliGPCone( shapename, shapename, upar, np );
+                        //printf( " Created new AliGPCone( %s, %s, %f, %f, %f );\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                        listShapes->Add(Shape);
+                    }
+
+                    Shape->SetCol(Color);
+                    son = new AliGNode( fnodename, nr, fnodename, Shape, MyMaterial );
+                }
+
+    Color++;
+    if( Color == 50 )
+        Color = 0;
+
+    AliGTransform* tra = (AliGTransform*) listTransf->At(0);
+
+    TVector* matrix = tra->GetMatrix();
+
+    char* transname = new char[10];
+    sprintf( transname, "%s%d", "tra", MatrCount );
+    
+    TVector &mat = *matrix;
+    AliGTransform* newtra = new AliGTransform(transname, transname, mat(0), mat(1),  mat(2), mat(4), mat(5), mat(6), mat(8), mat(9), mat(10), x, y, z);
+
+    //printf( " Created new AliGTransform( %s, %s, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f );\n", transname, transname, mat(0), mat(1), mat(2), mat(4), mat(5), mat(6), mat(8), mat(9), mat(10), x, y, z );
+
+    listTransf->AddAt(newtra, MatrCount);
+    MatrCount++;
+
+    parent->Add(son, newtra);
+
+    //printf( " %s->Add( %s, %s );\n", parent->GetName(), son->GetName(), newtra->GetName() );
+
+    listNodes->Add(son);
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsrotm(Int_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t) 
+{
+  printf( " Gsrotm.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gprotm(Int_t)
+{
+  printf( " Gprotm.\n" );
+}
+
+/***********************************************************************/
+
+Int_t AliGEODB::Gsvolu(const char* vname, const char* shape, Int_t nmed, Float_t* upar, Int_t np)
+{
+    Int_t lenvname = strlen(vname);
+    
+    char* nodename = new char[lenvname+1];
+    strcpy( nodename, vname );
+    nodename[lenvname] = '\x0';
+
+    int pos;
+    for( pos=0; pos<lenvname; pos++ )
+        if( (nodename[pos] == '\x0') || (nodename[pos] == ' ') )
+            break;
+
+    if( pos < lenvname ) {
+        if( nodename ) delete [] nodename;
+        nodename = new char[pos+1];
+        strncpy( nodename, vname, pos );
+        nodename[pos] = '\x0';
+    }
+
+    char* shapename = new char[strlen(shape)+1];
+    strcpy( shapename, shape );
+    shapename[strlen(shape)] = '\x0';
+
+    //printf( "\n Trying to build node: %s with shape: %s, nmed: %d, upar[0]: %f and np: %d\n", nodename, shapename, nmed, upar[0], np );
+
+    if( !np ) {
+        /* if number of parameters is 0, stores the nodename, shapename and nmed to be used in GSPOSP */
+        NodePosp* AliPosp = new NodePosp;
+       AliPosp->name     = nodename;
+       AliPosp->shape    = shapename;
+       AliPosp->nmed     = nmed;
+        Posp[PospCount]   = AliPosp;
+        PospCount++;
+        return 0;
+    }
+
+    if( (listNodes) && (listNodes->FindObject(nodename)) ) { // Trying to find the node inside listNodes
+        // The node existed in listNodes.
+        printf( "\n ERROR!!! Node %s already existed in listNodes\n", nodename );
+        exit(1);
+    }
+    else {
+        // It's a new node.
+        Int_t nmat = AliMediums[nmed]->fNmat;
+
+        AliGMaterial* MyMaterial = NULL;
+    
+        for( int j=0; j<listMaterials->GetSize(); j++ )
+            if( ((AliGMaterial*) listMaterials->At(j))->GetfImat() == nmat ) {
+                MyMaterial = (AliGMaterial*) listMaterials->At(j);
+                /*printf( " AliGMaterial( %d, %s, %s, %d, %d, %f, %f, %f, %f, %f, %f, *fUbuf, %d, %f, %f, %f, %f, %f, *fBuf, %d ); already existed.\n", nmat,AliMaterials[nmat]->fName, AliMaterials[nmat]->fName, AliMediums[nmed]->fIsvol, AliMediums[nmed]->fIfield, AliMediums[nmed]->fFieldm, AliMediums[nmed]->fTmaxfd, AliMediums[nmed]->fStemax, AliMediums[nmed]->fDeemax, AliMediums[nmed]->fEpsil, AliMediums[nmed]->fStmin, AliMediums[nmed]->fNbuf, AliMaterials[nmat]->fA, AliMaterials[nmat]->fZ, AliMaterials[nmat]->fDens, AliMaterials[nmat]->fRadl, AliMaterials[nmat]->fAbsl, AliMaterials[nmat]->fNwbuf );*/
+                break;
+            }
+    
+        if( MyMaterial == NULL ) {
+            MyMaterial = new AliGMaterial( nmat, AliMaterials[nmat]->fName, AliMaterials[nmat]->fName, AliMediums[nmed]->fIsvol, AliMediums[nmed]->fIfield, AliMediums[nmed]->fFieldm, AliMediums[nmed]->fTmaxfd, AliMediums[nmed]->fStemax, AliMediums[nmed]->fDeemax, AliMediums[nmed]->fEpsil, AliMediums[nmed]->fStmin, AliMediums[nmed]->fUbuf, AliMediums[nmed]->fNbuf,  AliMaterials[nmat]->fA, AliMaterials[nmat]->fZ, AliMaterials[nmat]->fDens, AliMaterials[nmat]->fRadl, AliMaterials[nmat]->fAbsl, AliMaterials[nmat]->fBuf, AliMaterials[nmat]->fNwbuf );
+
+            listMaterials->Add( MyMaterial );
+
+            /*printf( " Created new AliGMaterial( %d, %s, %s, %d, %d, %f, %f, %f, %f, %f, %f, *fUbuf, %d, %f, %f, %f, %f, %f, *fBuf, %d );\n", nmat,AliMaterials[nmat]->fName, AliMaterials[nmat]->fName, AliMediums[nmed]->fIsvol, AliMediums[nmed]->fIfield, AliMediums[nmed]->fFieldm, AliMediums[nmed]->fTmaxfd, AliMediums[nmed]->fStemax, AliMediums[nmed]->fDeemax, AliMediums[nmed]->fEpsil, AliMediums[nmed]->fStmin, AliMediums[nmed]->fNbuf, AliMaterials[nmat]->fA, AliMaterials[nmat]->fZ, AliMaterials[nmat]->fDens, AliMaterials[nmat]->fRadl, AliMaterials[nmat]->fAbsl, AliMaterials[nmat]->fNwbuf );*/
+        }
+
+        // Different constructor depending on the shape
+        AliGNode* node = NULL;
+
+        if( !strncmp(shapename, "TUBE", 4) ) {
+
+            AliGTube* Shape = NULL;
+        
+            for( int j=0; j<listShapes->GetSize(); j++ )
+                if( ((AliGShape*) listShapes->At(j))->GetName() == shapename ) {
+                    Shape = (AliGTube*) listShapes->At(j);
+                    printf( " AliGTube( %s, %s, %f, %f, %f ); already existed.\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                    break;
+                }
+
+            if( Shape == NULL ) {
+                Shape = new AliGTube( shapename, shapename, upar[0], upar[1], upar[2] );
+                //printf( " Created new AliGTube( %s, %s, %f, %f, %f );\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                listShapes->Add(Shape);
+            }
+
+            Shape->SetCol(Color);
+            node = new AliGNode( nodename, 1, nodename, Shape, MyMaterial );
+        }
+        else
+            if( !strncmp(shapename, "BOX", 3) ) {
+
+                AliGBox* Shape = NULL;
+        
+                for( int j=0; j<listShapes->GetSize(); j++ )
+                    if( ((AliGShape*) listShapes->At(j))->GetName() == shapename ) {
+                        Shape = (AliGBox*) listShapes->At(j);
+                        printf( " AliGBox( %s, %s, %f, %f, %f ); already existed.\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                        break;
+                    }
+
+                if( Shape == NULL ) {
+                    Shape = new AliGBox( shapename, shapename, upar[0], upar[1], upar[2] );
+                    //printf( " Created new AliGBox( %s, %s, %f, %f, %f );\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                    listShapes->Add(Shape);
+                }
+
+                Shape->SetCol(Color);
+                node = new AliGNode( nodename, 1, nodename, Shape, MyMaterial );
+            }
+            else
+                if( !strncmp(shapename, "TRD1", 4) ) {
+
+                    AliGTRD1* Shape = NULL;
+
+                    for( int j=0; j<listShapes->GetSize(); j++ )
+                        if( ((AliGShape*) listShapes->At(j))->GetName() == shapename ) {
+                            Shape = (AliGTRD1*) listShapes->At(j);
+
+                            break;
+                        }
+
+                    if( Shape == NULL ) {
+                        Shape = new AliGTRD1( shapename, shapename, upar[0], upar[1], upar[2], upar[3] );
+                        //printf( " Created new AliGTRD1( %s, %s, %f, %f, %f, %f );\n", shapename, shapename, upar[0], upar[1], upar[2], upar[3] );
+                        listShapes->Add(Shape);
+                    }
+
+                    Shape->SetCol(Color);
+                    node = new AliGNode( nodename, 1, nodename, Shape, MyMaterial );
+                }
+                else
+                    if( !strncmp(shapename, "PCON", 4) ) {
+
+                        AliGPCone* Shape = NULL;
+
+                        for( int j=0; j<listShapes->GetSize(); j++ )
+                            if( ((AliGShape*) listShapes->At(j))->GetName() == shapename ) {
+                                Shape = (AliGPCone*) listShapes->At(j);
+                                break;
+                            }
+
+                        if( Shape == NULL ) {
+                            Shape = new AliGPCone( shapename, shapename, upar, np );
+                            //printf( " Created new AliGPCone( %s, %s, %f, %f, %f );\n", shapename, shapename, upar[0], upar[1], upar[2] );
+                            listShapes->Add(Shape);
+                        }
+
+                        Shape->SetCol(Color);
+                        node = new AliGNode( nodename, 1, nodename, Shape, MyMaterial );
+                    }
+
+        //printf( " Created new AliGNode( %s, %d, %s, %s, %s );\n", nodename, 1+listNodes->GetSize(), nodename, shapename, MyMaterial->GetName() );
+
+        listNodes->Add(node);
+
+        //printf( " node->fShape->Color = %d\n", node->GetShape()->GetCol() );
+
+        Color++;
+        if( Color == 50 )
+            Color = 1;
+    }
+
+    return 0;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gsatt(const char*, const char*, Int_t) 
+{
+  printf( " Gsatt.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gfpara(const char*, Int_t, Int_t, Int_t&, Int_t&, Float_t*, Float_t*) 
+{
+  printf( " Gfpara.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gckpar(Int_t, Int_t, Float_t*) 
+{
+  printf( " Gckpar.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gckmat(Int_t, char*) 
+{
+  printf( " Gckmat.\n" );
+}
+
+/***********************************************************************/
+
+//=======================DRAW functions
+
+void  AliGEODB::InitHIGZ() 
+{
+    printf( "InitHIGZ.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdopen(Int_t) 
+{
+    printf( "Gdopen.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdclose() 
+{
+    printf( "Gdclose.\n" );
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdelete(Int_t) 
+{
+    cout << " Gdelete" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdshow(Int_t) 
+{
+    cout << " Gdshow" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdopt(const char *,const char *) 
+{
+    cout << " Gdopt" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdraw(const char *,Float_t, Float_t, Float_t,Float_t,Float_t,Float_t,Float_t) 
+{
+    cout << " Gdraw" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdrawc(const char *,Int_t, Float_t,Float_t,Float_t,Float_t,Float_t) 
+{
+    cout << " Gdrawc" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdrawx(const char *,Float_t, Float_t, Float_t, Float_t, Float_t,Float_t,Float_t,Float_t,Float_t) 
+{
+    cout << " Gdrawx" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdhead(Int_t, const char *, Float_t) 
+{
+    cout << " Gdhead" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdman(Float_t, Float_t, const char *) 
+{
+    cout << " Gdman" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdspec(const char *) 
+{
+    cout << " Gdspec" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::DrawOneSpec(const char *) 
+{
+    cout << " DrawOneSpec" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::Gdtree(const char *,Int_t,Int_t) 
+{
+    cout << " Gdtree" << endl;
+}
+
+/***********************************************************************/
+
+void  AliGEODB::GdtreeParent(const char *,Int_t,Int_t) 
+{
+    cout << " GdtreeParent" << endl;
+}
+
+/***********************************************************************/
+
+//=======================Set functions
+
+void AliGEODB::SetABAN(Int_t)
+{
+    cout << " SetABAN" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetANNI(Int_t)
+{
+    cout << " SetANNI" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetAUTO(Int_t)
+{
+    cout << " SetAUTO" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetBOMB(Float_t)
+{
+    cout << " SetBOMB" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetBREM(Int_t)
+{
+    cout << " SetBREM" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetCKOV(Int_t)
+{
+    cout << " SetCKOV" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetClipBox(const char *,Float_t,Float_t, Float_t,Float_t,Float_t,Float_t) 
+{
+    cout << " SetClipBox" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetCOMP(Int_t)
+{
+    cout << " SetCOMP" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetCUTS( Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t )
+{
+    cout << " SetCUTS" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetDCAY(Int_t)
+{
+    cout << " SetDCAY" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetDEBU(Int_t, Int_t, Int_t)
+{
+    cout << " SetDEBU" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetDRAY(Int_t)
+{
+    cout << " SetDRAY" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetHADR(Int_t)
+{
+    cout << " SetHADR" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetKINE(Int_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t,Float_t ) 
+{
+    cout << " SetKINE" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetLOSS(Int_t)
+{
+    cout << " SetLOSS" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetMULS(Int_t)
+{
+    cout << " SetMULS" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetMUNU(Int_t)
+{
+    cout << " SetMUNU" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetOPTI(Int_t)
+{
+    cout << " SetOPTI" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetPAIR(Int_t)
+{
+    cout << " SetPAIR" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetPFIS(Int_t)
+{
+    cout << " SetPFIS" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetPHOT(Int_t)
+{
+    cout << " SetPHOT" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetRAYL(Int_t)
+{
+    cout << " SetRAYL" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetSWIT(Int_t , Int_t)
+{
+    cout << " SetSWIT" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::SetTRIG(Int_t)
+{
+    cout << " SetTRIG" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::Vname(const char *, char *) 
+{
+    cout << " Vname" << endl;
+}
+
+/***********************************************************************/
+
+void AliGEODB::InitLego() 
+{
+    cout << " InitLego" << endl;
+}
+
+/***********************************************************************/
+
+extern "C" void sxpart_(){}
diff --git a/GEODB/AliGEODB.h b/GEODB/AliGEODB.h
new file mode 100644 (file)
index 0000000..ad6598b
--- /dev/null
@@ -0,0 +1,228 @@
+#ifndef AliGEODB_H 
+#define AliGEODB_H 
+//////////////////////////////////////////////// 
+//  C++ interface to Geant3 basic routines    // 
+//////////////////////////////////////////////// 
+#include <AliMC.h> 
+#include "AliGNode.h"
+  
+class AliGEODB : public AliMC { 
+
+public: 
+  AliGEODB() {}
+  AliGEODB(const char *title, Int_t nwgeant=0); 
+  virtual ~AliGEODB() {} 
+
+///////////////////////////////////////////////////////////////////////
+//                                                                   //
+//                                                                   //
+//     Here are the service routines from the geometry               //
+//     which could be implemented also in other geometries           //
+//                                                                   //
+//                                                                   //
+///////////////////////////////////////////////////////////////////////
+
+  void  GeomIter();
+  Int_t CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens, Float_t &radl, Float_t &absl) const;
+  Int_t NextVolUp(Text_t *name, Int_t &copy);
+  Int_t CurrentVol(Text_t *name, Int_t &copy) const;
+  Int_t CurrentVolOff(Int_t off, Text_t *name, Int_t &copy) const;
+  Int_t VolId(Text_t *name) const;
+  const char* VolName(Int_t id) const;
+  void  TrackPosition(Float_t *xyz) const;
+  void  TrackMomentum(Float_t *xyz) const;  
+  Int_t NofVolumes() const;
+  Float_t TrackTime() const;  
+  Float_t TrackCharge() const;
+  Float_t TrackMass() const;
+  Float_t TrackStep() const;
+  Float_t TrackLength() const;
+  Int_t   TrackPid() const;
+  Bool_t TrackInside() const;
+  Bool_t TrackEntering() const;
+  Bool_t TrackExiting() const;
+  Bool_t TrackOut() const;
+  Bool_t TrackDisappear() const;
+  Bool_t TrackStop() const;
+  Bool_t TrackAlive() const;
+  Int_t   NSecondaries() const;
+  Int_t   CurrentEvent() const;
+  void    ProdProcess(char*) const;
+  void    GetSecondary(Int_t, Int_t&, Float_t*, Float_t*);
+  void   StopTrack();
+  void   StopEvent();
+  Float_t MaxStep() const;
+  void   SetColors();
+  void  SetMaxStep(Float_t maxstep);
+  void  SetMaxNStep(Int_t maxnstp);
+  Int_t GetMaxNStep() const;
+  void GetParticle(const Int_t ipart, char *name, Float_t &mass) const;
+  virtual Int_t GetMedium() const;
+  virtual Float_t Edep() const;
+  virtual Float_t Etot() const;
+  virtual void    Rndm(Float_t* r, const Int_t n) const;
+  virtual void    Material(Int_t&, const char*, Float_t, Float_t, Float_t, Float_t,
+                           Float_t, Float_t* buf=0, Int_t nwbuf=0);
+  virtual void    Mixture(Int_t&, const char*, Float_t*, Float_t*, Float_t, Int_t, Float_t*);
+  virtual void    Medium(Int_t&, const char*, Int_t, Int_t, Int_t, Float_t, Float_t, 
+                  Float_t, Float_t, Float_t, Float_t, Float_t* ubuf=0, Int_t nbuf=0);
+  virtual void    Matrix(Int_t&, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t);
+
+      // functions from GBASE 
+   virtual  void  Gpcxyz(); 
+   virtual  void  Ggclos(); 
+
+   virtual  void  SetVisibility(Text_t* name, Int_t val);
+   virtual  void  DrawTree( AliGNode* topnode, Int_t tabs );
+
+   virtual  void  Gfile(const char *filename, const char *option="I"); 
+   virtual  void  Glast(); 
+   virtual  void  Gprint(const char *name); 
+   virtual  void  Grun(); 
+   virtual  void  Gtrig(); 
+   virtual  void  Gtrigc(); 
+   virtual  void  Gtrigi(); 
+   virtual  void  Gwork(Int_t nwork); 
+   virtual  void  Gzinit(); 
+      // functions from GCONS 
+   virtual  void  Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, Float_t &dens, 
+                         Float_t &radl, Float_t &absl, Float_t* ubuf, Int_t& nbuf); 
+   virtual  void  Gfpart(Int_t ipart, char *name, Int_t &itrtyp,  
+                         Float_t &amass, Float_t &charge, Float_t &tlife); 
+   virtual  void  Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,  
+                         Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd, 
+                         Float_t &stemax, Float_t &deemax, Float_t &epsil, 
+                         Float_t &stmin, Float_t *buf=0, Int_t *nbuf=0); 
+   virtual  void  Gmate(); 
+   virtual  void  Gpart(); 
+   virtual  void  Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
+                        Float_t *absco, Float_t *effic, Float_t *rindex); 
+   virtual  void  Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode); 
+   virtual  void  Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,  
+                         Float_t dens, Float_t radl, Float_t absl); 
+   virtual  void  Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,  
+                         Float_t dens, Int_t nlmat, Float_t *wmat); 
+   virtual  void  Gspart(Int_t ipart, const char *name, Int_t itrtyp,  
+                         Float_t amass, Float_t charge, Float_t tlife); 
+   virtual  void  Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,  
+                         Int_t ifield, Float_t fieldm, Float_t tmaxfd, 
+                         Float_t stemax, Float_t deemax, Float_t epsil, 
+                         Float_t stmin); 
+   virtual  void  Gstpar(Int_t itmed, const char *param, Float_t parval); 
+      // functions from GKINE 
+   virtual  void  Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, 
+                         Int_t &ipart, Int_t &nvert); 
+   virtual  void  Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg, Float_t &tofg); 
+   virtual  Int_t Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *ubuf=0, Int_t nwbuf=0); 
+   virtual  Int_t Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf=0, Int_t nwbuf=0); 
+      // functions from GPHYS 
+   virtual  void  Gphysi(); 
+      // functions from GTRAK 
+   virtual  void  Gdebug(); 
+   virtual  void  Gekbin(); 
+   virtual  void  Gfinds(); 
+   virtual  void  Gsking(Int_t igk); 
+   virtual  void  Gskpho(Int_t igk); 
+   virtual  void  Gsstak(Int_t iflag); 
+   virtual  void  Gsxyz(); 
+   virtual  void  Gtrack(); 
+   virtual  void  Gtreve(); 
+   virtual  void  Grndm(Float_t *rvec, const Int_t len) const; 
+   virtual  void  Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq, const Text_t *chopt); 
+      // functions from GGEOM 
+   virtual  void  Gdxyz(Int_t ); 
+   virtual  void  Gdcxyz(); 
+
+      // functions from GGEOM 
+   virtual  void  Gdtom(Float_t *xd, Float_t *xm, Int_t iflag); 
+   virtual  void  Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, 
+                         Int_t *lvols, Int_t *lindx); 
+   virtual  void  Gmedia(Float_t *x, Int_t &numed); 
+   virtual  void  Gmtod(Float_t *xm, Float_t *xd, Int_t iflag); 
+   virtual  void  Gsdvn(const char *name, const char *mother, Int_t ndiv, Int_t iaxis); 
+   virtual  void  Gsdvn2(const char *name, const char *mother, Int_t ndiv, Int_t iaxis, Float_t c0i, Int_t numed); 
+   virtual  void  Gsdvs(const char *name, const char *mother, Float_t step, Int_t iaxis, Int_t numed); 
+   virtual  void  Gsdvs2(const char *name, const char *mother, Float_t step, Int_t iaxis, Float_t c0, Int_t numed); 
+   virtual  void  Gsdvt(const char *name, const char *mother, Float_t step, Int_t iaxis, Int_t numed, Int_t ndvmx); 
+   virtual  void  Gsdvt2(const char *name, const char *mother, Float_t step, Int_t iaxis,
+                        Float_t c0, Int_t numed, Int_t ndvmx); 
+   virtual  void  Gsord(const char *name, Int_t iax); 
+   virtual  void  Gspos(const char *name, Int_t nr, const char *mother,  
+                         Float_t x, Float_t y, Float_t z, Int_t irot, const char *konly="ONLY"); 
+   virtual  void  Gsposp(const char *nodename, Int_t nr, const char *mother,  
+                         Float_t x, Float_t y, Float_t z, Int_t irot, const char *konly, Float_t *upar, Int_t np); 
+   virtual  void  Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2, Float_t phi2, 
+                         Float_t theta3, Float_t phi3); 
+   virtual  void  Gprotm(Int_t nmat=0); 
+   virtual  Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,  
+                         Float_t *upar, Int_t np); 
+   virtual  void  Gsatt(const char *name, const char *att, Int_t val);
+   virtual  void  Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
+                        Int_t& natt, Float_t* par, Float_t* att);
+   virtual  void  Gckpar(Int_t, Int_t, Float_t*);
+   virtual  void  Gckmat(Int_t, char*);
+    
+      // functions from GDRAW 
+   virtual  void  DefaultRange();
+   virtual  void  InitHIGZ();
+   virtual  void  Gdopen(Int_t view);
+   virtual  void  Gdclose();
+   virtual  void  Gdelete(Int_t view);
+   virtual  void  Gdshow(Int_t view);
+   virtual  void  Gdopt(const char *name,const char *value);
+   virtual  void  Gdraw(const char *name,Float_t theta=30, Float_t phi=30, Float_t psi=0,Float_t u0=10,Float_t v0=10,Float_t ul=0.01,Float_t vl=0.01);
+   virtual  void  Gdrawc(const char *name,Int_t axis=1, Float_t cut=0,Float_t u0=10,Float_t v0=10,Float_t ul=0.01,Float_t vl=0.01);
+   virtual  void  Gdrawx(const char *name,Float_t cutthe, Float_t cutphi, Float_t cutval,
+                         Float_t theta=30, Float_t phi=30,Float_t u0=10,Float_t v0=10,Float_t ul=0.01,Float_t vl=0.01);
+   virtual  void  Gdhead(Int_t isel, const char *name, Float_t chrsiz=0.6);   
+   virtual  void  Gdman(Float_t u0, Float_t v0, const char *type="MAN");
+   virtual  void  Gdspec(const char *name);
+   virtual  void  DrawOneSpec(const char *name);
+   virtual  void  Gdtree(const char *name,Int_t levmax=15,Int_t ispec=0);
+   virtual  void  GdtreeParent(const char *name,Int_t levmax=15,Int_t ispec=0);
+
+   virtual  void  WriteEuclid(const char*, const char*, Int_t, Int_t);
+
+   virtual  void  SetABAN(Int_t par=1);
+   virtual  void  SetANNI(Int_t par=1);
+   virtual  void  SetAUTO(Int_t par=1);
+   virtual  void  SetBOMB(Float_t bomb=1);
+   virtual  void  SetBREM(Int_t par=1);
+   virtual  void  SetCKOV(Int_t par=1);
+   virtual  void  SetClipBox(const char *name,Float_t xmin=-9999,Float_t xmax=0, Float_t ymin=-9999,Float_t ymax=0,Float_t zmin=-9999,Float_t zmax=0);
+   virtual  void  SetCOMP(Int_t par=1);
+   virtual  void  SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,Float_t cuthad,
+                      Float_t cutmuo ,Float_t bcute ,Float_t bcutm ,Float_t dcute ,
+                      Float_t dcutm ,Float_t ppcutm, Float_t tofmax);
+   virtual  void  SetDCAY(Int_t par=1);
+   virtual  void  SetDEBU(Int_t emin=1, Int_t emax=999, Int_t emod=1);
+   virtual  void  SetDRAY(Int_t par=1);
+   virtual  void  SetHADR(Int_t par=1);
+   virtual  void  SetKINE(Int_t kine, Float_t xk1=0, Float_t xk2=0, Float_t xk3=0, Float_t xk4=0,
+                         Float_t xk5=0, Float_t xk6=0, Float_t xk7=0, Float_t xk8=0, Float_t xk9=0,
+                         Float_t xk10=0);
+   virtual  void  SetLOSS(Int_t par=2);
+   virtual  void  SetMULS(Int_t par=1);
+   virtual  void  SetMUNU(Int_t par=1);
+   virtual  void  SetOPTI(Int_t par=2);
+   virtual  void  SetPAIR(Int_t par=1);
+   virtual  void  SetPFIS(Int_t par=1);
+   virtual  void  SetPHOT(Int_t par=1);
+   virtual  void  SetRAYL(Int_t par=1);
+   virtual  void  SetSWIT(Int_t sw, Int_t val=1);
+   virtual  void  SetTRIG(Int_t nevents=1);
+
+   virtual  void  Vname(const char *name, char *vname);
+
+   virtual  void  InitLego();
+        
+   ClassDef(AliGEODB,1)  //C++ interface to Geant basic routines 
+}; 
+
+#endif 
diff --git a/GEODB/AliGMaterial.cxx b/GEODB/AliGMaterial.cxx
new file mode 100644 (file)
index 0000000..9b46b8d
--- /dev/null
@@ -0,0 +1,212 @@
+// -*- C++ -*-
+// 
+// 1998/10/19
+// ---------------------------------------------------------------------------
+//
+// AliGMaterial Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo
+//
+// ---------------------------------------------------------------------------
+
+#include "AliGMaterial.h"
+
+ClassImp(AliGMaterial)
+
+
+//-------------------------------------------------------------------------
+
+AliGMaterial::AliGMaterial( Int_t imat, Text_t* name, Text_t* title, Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax, Float_t epsil, Float_t stmin, Float_t* ubuf, Int_t nbuf, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl, Float_t* buf, Int_t nwbuf ) : TNamed(name, title)
+{
+    /* VIC: Very Important Constructor */
+
+    fImat   = imat;
+    fIsvol  = isvol;
+    fIfield = ifield;
+    fFieldm = fieldm;
+    fTmaxfd = tmaxfd;
+    fStemax = stemax;
+    fDeemax = deemax;
+    fEpsil  = epsil;
+    fStmin  = stmin;
+
+    fUbuf   = new Float_t[nbuf];
+    
+    for( int i=0; i<nbuf; i++ )
+        fUbuf[i] = ubuf[i];
+        
+    fNbuf   = nbuf;
+    fA      = a;
+    fZ      = z;
+    fDens   = dens;
+    fRadl   = radl;
+    fAbsl   = absl;
+    
+    fBuf    = new Float_t[nwbuf];
+
+    for( int j=0; j<nwbuf; j++ )
+        fBuf[j] = buf[j];
+        
+    fNwbuf  = nwbuf;
+}
+
+//-------------------------------------------------------------------------
+
+AliGMaterial::AliGMaterial(Text_t* name, Text_t* title, Float_t A, Float_t Z, Float_t rho) : TNamed(name, title)
+{
+    /* Constructor */
+    fA   = A;
+    fRho = rho;
+    fZ   = Z;
+}
+
+//-------------------------------------------------------------------------
+
+AliGMaterial::AliGMaterial( AliGMaterial* Mat )
+{
+    /* Copy Constructor */
+    if( Mat ) {
+        fImat   = Mat->fImat;
+        fIsvol  = Mat->fIsvol;
+        fIfield = Mat->fIfield;
+        fFieldm = Mat->fFieldm;
+        fTmaxfd = Mat->fTmaxfd;
+        fStemax = Mat->fStemax;
+        fDeemax = Mat->fDeemax;
+        fEpsil  = Mat->fEpsil;
+        fStmin  = Mat->fStmin;
+
+        fUbuf   = new Float_t[Mat->fNbuf];
+    
+        for( int i=0; i<Mat->fNbuf; i++ )
+            fUbuf[i] = Mat->fUbuf[i];
+        
+        fNbuf   = Mat->fNbuf;
+        fA      = Mat->fA;
+        fZ      = Mat->fZ;
+        fDens   = Mat->fDens;
+        fRadl   = Mat->fRadl;
+        fAbsl   = Mat->fAbsl;
+    
+        fBuf    = new Float_t[Mat->fNwbuf];
+
+        for( int j=0; j<Mat->fNwbuf; j++ )
+            fBuf[j] = Mat->fBuf[j];
+        
+        fNwbuf  = Mat->fNwbuf;
+
+        fName  = Mat->GetName();
+        fTitle = Mat->GetTitle();
+    }
+    else {
+        /* Default Constructor */
+        fImat   = 0;
+        fIsvol  = 0;
+        fIfield = 0;
+        fFieldm = 0.;
+        fTmaxfd = 0.;
+        fStemax = 0.;
+        fDeemax = 0.;
+        fEpsil  = 0.;
+        fStmin  = 0.;
+
+        fUbuf   = NULL;
+        
+        fNbuf   = 0;
+        fA      = 0.;
+        fZ      = 0.;
+        fDens   = 0.;
+        fRadl   = 0.;
+        fAbsl   = 0.;
+    
+        fBuf    = NULL;
+
+        fNwbuf  = 0;
+
+        fName  = "";
+        fTitle = "";
+    }
+}
+
+//-------------------------------------------------------------------------
+
+AliGMaterial::~AliGMaterial()
+{   /* Destructor */
+
+    if( fUbuf ) delete [] fUbuf;
+    if( fBuf  ) delete [] fBuf;
+}
+
+//-------------------------------------------------------------------------
+
+AliGMaterial* AliGMaterial::operator=( const AliGMaterial* Mat )
+{
+    /* Operator = */
+    if( this == Mat ) return this; // special case.
+
+    fA     = Mat->fA;
+    fName  = Mat->GetName();
+    fRho   = Mat->fRho;
+    fTitle = Mat->GetTitle();
+    fZ     = Mat->fZ;
+
+    return this;
+}
+
+//-------------------------------------------------------------------------
+
+void AliGMaterial::Streamer(TBuffer &R__b)
+{
+   // Stream an object of class AliGMaterial.
+
+   if (R__b.IsReading()) {
+      Version_t R__v = R__b.ReadVersion(); if (R__v) { }
+      TNamed::Streamer(R__b);
+      R__b >> fImat;
+      R__b >> fIsvol;
+      R__b >> fIfield;
+      R__b >> fFieldm;
+      R__b >> fTmaxfd;
+      R__b >> fStemax;
+      R__b >> fDeemax;
+      R__b >> fEpsil;
+      R__b >> fStmin;
+      R__b.ReadArray(fUbuf); //
+      R__b >> fNbuf;
+      R__b >> fA;
+      R__b >> fZ;
+      R__b >> fDens;
+      R__b >> fRadl;
+      R__b >> fAbsl;
+      R__b.ReadArray(fBuf); //
+      R__b >> fNwbuf;
+      R__b >> fRho;
+   } else {
+      R__b.WriteVersion(AliGMaterial::IsA());
+      TNamed::Streamer(R__b);
+      R__b << fImat;
+      R__b << fIsvol;
+      R__b << fIfield;
+      R__b << fFieldm;
+      R__b << fTmaxfd;
+      R__b << fStemax;
+      R__b << fDeemax;
+      R__b << fEpsil;
+      R__b << fStmin;
+      R__b.WriteArray(fUbuf, fNbuf); //
+      R__b << fNbuf;
+      R__b << fA;
+      R__b << fZ;
+      R__b << fDens;
+      R__b << fRadl;
+      R__b << fAbsl;
+      R__b.WriteArray(fBuf, fNbuf); //
+      R__b << fNwbuf;
+      R__b << fRho;
+   }
+}
+
+//-------------------------------------------------------------------------
+
diff --git a/GEODB/AliGMaterial.h b/GEODB/AliGMaterial.h
new file mode 100644 (file)
index 0000000..36025b1
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef ALIGMATERIAL_H
+#define ALIGMATERIAL_H
+
+#include <TNamed.h>
+
+class AliGMaterial: public TNamed {
+    private:
+        Int_t    fImat;
+        Int_t    fIsvol;
+        Int_t    fIfield;
+        Float_t  fFieldm;
+        Float_t  fTmaxfd;
+        Float_t  fStemax;
+        Float_t  fDeemax;
+        Float_t  fEpsil;
+        Float_t  fStmin; 
+
+        Float_t* fUbuf; 
+        
+        Int_t    fNbuf;
+        Float_t  fA;
+        Float_t  fZ;
+        Float_t  fDens;
+        Float_t  fRadl;
+        Float_t  fAbsl;
+    
+
+        Float_t* fBuf;
+        
+        Int_t    fNwbuf;
+        Float_t  fRho; /* Density of material */
+
+    public:
+        AliGMaterial( Int_t imat, Text_t* name, Text_t* title, Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax, Float_t epsil, Float_t stmin, Float_t *ubuf, Int_t nbuf, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl, Float_t *buf, Int_t nwbuf );
+        AliGMaterial( Text_t* name, Text_t* title, Float_t A=0., Float_t Z=0., Float_t Rho=0. ); /* Constructor */
+        AliGMaterial( AliGMaterial* Mat=NULL ); /* Copy or Default Constructor */
+        ~AliGMaterial(); /* Destructor */
+        AliGMaterial* operator=( const AliGMaterial* Mat );
+        Int_t GetfImat() {return fImat;}
+    ClassDef(AliGMaterial,1) //Material Class
+};
+
+#endif
diff --git a/GEODB/AliGNode.cxx b/GEODB/AliGNode.cxx
new file mode 100644 (file)
index 0000000..8251b8a
--- /dev/null
@@ -0,0 +1,768 @@
+/**********************************************/
+/*                                            */
+/* FILE: AliGNode.cxx                         */
+/* PURPOSE: Tree elemnt of the geometry       */
+/* LANGUAGE: C++                              */
+/* COMPILER: CC for HP-UX 9.x and 10.         */
+/* AUTHOR: Joana && David                     */
+/* DATE: May 28, 1999                         */
+/* ADDRESS: jesanto@cern.ch, dcollado@cern.ch */
+/*                                            */
+/**********************************************/
+
+#include <TCanvas.h>
+#include <TView.h>
+#include <TPadView3D.h>
+#include <iostream.h>
+#include <TFile.h>
+#include <TROOT.h>
+#include "AliGeometry.h"
+#include "AliGBox.h"
+#include "AliGCone.h"
+#include "AliGPCone.h"
+#include "AliGSphere.h"
+#include "AliGNode.h"
+
+const Int_t kSonsInvisible = BIT(17);
+Text_t* ROOT_FILE = "AliGeoDB.root";
+
+ClassImp(AliGNode)
+
+//----------------------------------------------------------------------
+
+AliGNode::AliGNode( AliGNode* node ) 
+{
+
+    if( node ) {
+        /* Copy Constructor */
+        fConfig   = new AliGConfig( node->fConfig );
+        fId       = node->fId;
+        fMaterial = new AliGMaterial( node->fMaterial );
+        fName     = node->fName;
+        fNcopy    = new TArrayI( *(node->fNcopy) );
+        fNname    = node->fNname;
+        fNnode    = new TArrayI( *(node->fNnode) );
+        fNode     = new TObjArray( *(node->fNode) );
+        fNsons    = node->fNsons;
+        fNtrans   = new TArrayI( *(node->fNtrans) );
+       fParent   = node->fParent;
+       fVis      = node->fVis;
+        fTitle    = node->fTitle;
+        fTrans    = new TObjArray(*(node->fTrans));
+       //        fParent   = new AliGNode(node->fParent);
+
+        if (node->fShape) {
+            if( !strcmp(node->fShape->ClassName(), "AliGBox") ) {
+                fShape = new AliGBox( (AliGBox*) node->fShape );
+                //fShape = new AliGBox(*(AliGBox*)node->fShape);
+            }
+            else {
+                if( !strcmp(node->fShape->ClassName(), "AliGSphere") )
+                    fShape = new AliGSphere( (AliGSphere*) node->fShape );
+                else {
+                    if( !strcmp(node->fShape->ClassName(), "AliGTube") )
+                        fShape = new AliGTube( (AliGTube*) node->fShape );
+                    else {
+                        if( !strcmp(node->fShape->ClassName(), "AliGCone") )
+                            fShape = new AliGCone( (AliGCone*) node->fShape );
+                       else {
+                            if( !strcmp(node->fShape->ClassName(), "AliGPCone") )
+                                fShape = new AliGPCone( (AliGPCone*) node->fShape );
+                           else {
+                                if( !strcmp(node->fShape->ClassName(), "AliGTRD1") ) 
+                                    fShape = new AliGTRD1( (AliGTRD1*) node->fShape );
+                           }
+                       }
+                    }
+                }
+            }
+       }
+        else
+            fShape = NULL;
+
+        /*cout << endl << " Comparacion." << endl;
+        cout << " El que paso por parametro:" << endl;
+        node->Dump();
+        cout << " El resultado de la copia:" << endl;
+        this->Dump();*/
+
+    }
+    else {
+        /* Default Constructor */
+        fConfig   = NULL;
+        fId       = 0;
+        fMaterial = NULL;
+        fName     = "";
+        fNcopy    = NULL;
+        fNname    = "";
+        fNnode    = NULL;
+        fNode     = new TObjArray();
+        fNsons    = 0;
+        fNtrans   = NULL;
+        fParent   = NULL;
+        fShape    = NULL;
+        fTitle    = "";
+        fTrans    = new TObjArray();
+       fVis      = 0;
+    }
+}
+
+//----------------------------------------------------------------------
+
+AliGNode::AliGNode( Text_t* name, Int_t id, Text_t* title, AliGBox* box, AliGMaterial *material, const Text_t *matrixname, AliGConfig* config )
+{
+    /* AliGNode Constructor for AliGBox shape */
+
+    if( box )
+        fShape = new AliGBox(box); // Shape inside node
+    else
+        fShape = NULL;
+
+    EndConstructor( name, id, title, material, matrixname, config );
+}
+
+//----------------------------------------------------------------------
+
+AliGNode::AliGNode( Text_t* name, Int_t id, Text_t* title, AliGSphere* sphere, AliGMaterial *material, const Text_t *matrixname, AliGConfig* config )
+{
+    /* AliGNode Constructor for AliGSphere shape */
+
+    if( sphere )
+        fShape = new AliGSphere(sphere); // Shape inside node
+    else
+        fShape = NULL;
+
+    EndConstructor( name, id, title, material, matrixname, config );
+}
+
+//----------------------------------------------------------------------
+
+AliGNode::AliGNode( Text_t* name, Int_t id, Text_t* title, AliGTube* tube, AliGMaterial *material, const Text_t *matrixname, AliGConfig* config )
+{
+    /* AliGNode Constructor for AliGTube shape */
+
+    if( tube )
+        fShape = new AliGTube(tube); // Shape inside node
+    else
+        fShape = NULL;
+
+    EndConstructor( name, id, title, material, matrixname, config );
+}
+
+//----------------------------------------------------------------------
+
+AliGNode::AliGNode( Text_t* name, Int_t id, Text_t* title, AliGCone* cone, AliGMaterial *material, const Text_t *matrixname, AliGConfig* config )
+{
+    /* AliGNode Constructor for AliGCone shape */
+
+    if( cone )
+        fShape = new AliGCone(cone); // Shape inside node
+    else
+        fShape = NULL;
+
+    EndConstructor( name, id, title, material, matrixname, config );
+}
+
+//----------------------------------------------------------------------
+
+
+AliGNode::AliGNode( Text_t* name, Int_t id, Text_t* title, AliGPCone* pcone, AliGMaterial *material, const Text_t *matrixname, AliGConfig* config )
+{
+    /* AliGNode Constructor for AliGPCone shape */
+
+    if( pcone )
+        fShape = new AliGPCone(pcone); // Shape inside node
+    else
+        fShape = NULL;
+
+    EndConstructor( name, id, title, material, matrixname, config );
+}
+
+//----------------------------------------------------------------------
+
+
+AliGNode::AliGNode( Text_t* name, Int_t id, Text_t* title, AliGTRD1* trd1, AliGMaterial *material, const Text_t *matrixname, AliGConfig* config )
+{
+    /* AliGNode Constructor for AliGTRD1 shape */
+
+    if( trd1 )
+       fShape = new AliGTRD1(trd1); // Shape inside node
+    else
+        fShape = NULL;
+
+    EndConstructor( name, id, title, material, matrixname, config );
+}
+
+//----------------------------------------------------------------------
+
+void AliGNode::EndConstructor( Text_t* name, Int_t id, Text_t* title, AliGMaterial *material, const Text_t *matrixname, AliGConfig* config )
+{
+    /* Finish the construction of AliGNodes */
+    
+    fConfig   = new AliGConfig(config);
+    fId       = id;                         // Node id number
+    fMaterial = new AliGMaterial(material); // Material inside shape
+
+    char*  TmpName  = new char[strlen(name)+int(TMath::Log10((double) id)+3)];
+    sprintf(TmpName,"%s_%d",name,id);
+    fName     = TmpName;             // Complete node name
+    delete [] TmpName;
+
+    fNcopy    = new TArrayI(50);            // Array of integers containing the copy number (by family name)
+    fNname    = name;                       // Node family name
+    fNnode    = new TArrayI(50);            // Array of integers containing every node son index
+    fNode     = new TObjArray(100,0);       // Array containing every (different)node son   
+    fNsons    = 0;
+    fNtrans   = new TArrayI(50);            // Array of integers containing every transformation index
+    fParent   = NULL;
+    fTitle    = title;
+    fTrans    = new TObjArray(100,0);       // Array containing every (different)transformation used
+    fVis      = 1;
+
+}
+
+//-----------------------------------------------------------------------
+
+AliGNode::AliGNode( Text_t* name, Int_t id, Text_t* title, AliGShape* shape, AliGMaterial* material, const Text_t* matrixname, AliGConfig* config ) 
+{
+    /* AliGNode Constructor for an AliGShape */
+
+    fShape = NULL;
+
+    EndConstructor( name, id, title, material, matrixname, config );
+}
+
+
+//----------------------------------------------------------------------
+
+AliGNode::~AliGNode()
+{
+    /* Destructor */
+
+    if(fConfig)   delete fConfig;
+    if(fMaterial) delete fMaterial;
+    if(fNcopy)    delete fNcopy;
+    if(fNnode)    delete fNnode;
+    if(fNode)     delete fNode;
+    if(fNtrans)   delete fNtrans;
+    if(fShape)    delete fShape;
+    if(fTrans)    delete fTrans;
+}
+
+//----------------------------------------------------------------------
+
+AliGNode* AliGNode::operator=( const AliGNode* node )
+{
+    if( this == node ) return this; // special case.
+
+    fConfig   = node->fConfig;
+    fId       = node->fId;
+    fMaterial = node->fMaterial;
+    fName     = node->fName;
+    fNcopy    = node->fNcopy;
+    fNname    = node->fNname;
+    fNnode    = node->fNnode;
+
+    if( fNode ) fNode->Delete();
+
+    if( node->fNode ) {
+      //for( int i=0; i<node->fNode->GetSize(); i++ )
+        for( int i=0; i<node->fNode->GetSize(); i++ )
+            fNode->AddLast(node->fNode->At(i));
+    }
+
+    fNsons    = node->fNsons;
+    fNtrans   = node->fNtrans;
+    fParent   = node->fParent;
+    fShape    = node->fShape;
+    fTitle    = node->fTitle;
+
+    if( fTrans ) fTrans->Delete();
+    if( node->fTrans ) {
+        for( int i=0; i<node->fTrans->GetSize(); i++ )
+            fTrans->AddLast(node->fTrans->At(i));
+    }
+    //fTrans    = node->fTrans;
+
+    return this;
+}
+
+//----------------------------------------------------------------------
+
+void AliGNode::Add(AliGNode* son, AliGTransform* tran)
+{
+    
+    Int_t index = fNode->IndexOf((TObject*)son);
+    
+    if( index == -1 ) {
+        fNode->Add(son);  // fNode is TObjArray
+        index = fNode->IndexOf((TObject*)son);
+        son->fParent = this;
+    }
+
+    Int_t tranumber = fTrans->IndexOf((TObject*)tran); 
+    if( tranumber == -1 ) {
+        fTrans->Add( tran );
+        tranumber = fTrans->IndexOf((TObject*)tran);
+    }
+
+    Int_t Nsons = this->GetfNsons();
+    Int_t copy = 1;
+   
+    for( Int_t i = 0; i<Nsons; i++ ) {
+        if( index == fNnode->At(i) ) {
+            if( fNtrans->At(i) == tranumber ) {
+             cout << "Error: Node already exists!";
+               return;
+            }
+        }
+       
+       
+        if( ((AliGNode*)fNode->At(fNnode->At(i)))->fNname == son->fNname ) 
+           copy++;
+           
+    }
+
+    if( fNnode->GetSize() == Nsons ) {
+    
+        IncreaseSize( Nsons+100, *fNnode  );
+        IncreaseSize( Nsons+100, *fNtrans );
+        IncreaseSize( Nsons+100, *fNcopy  );
+       
+    }
+    fNnode->AddAt( index, Nsons ); // Add value of index at position Nsons
+    
+    fNtrans->AddAt( tranumber, Nsons ); 
+    fNcopy->AddAt( copy, Nsons );
+    fNsons++; // Because we have added a new node
+   
+}
+
+//----------------------------------------------------------------------   
+
+void AliGNode::IncreaseSize(Int_t total,TArrayI &array)
+{
+    TArrayI *newarray = new TArrayI(array);
+    array.Set(total);    
+
+    for( int i=0; i<newarray->GetSize(); i++ )
+        array[i] = (*newarray)[i];
+        
+    delete newarray;
+}
+
+//----------------------------------------------------------------------
+
+Text_t* AliGNode::GetPath()
+{
+    const int kMAXDEPTH = 128;
+    const AliGNode* d[kMAXDEPTH];
+    AliGNode* node = this;
+    int depth = 0, len = 0;
+
+    d[depth++] = node;
+    len = strlen(node->GetName()) + 1;
+
+    while (node->fParent && depth < kMAXDEPTH) {
+        node = node->fParent;     
+        d[depth++] = node;
+        len += strlen (node->GetName()) + 1;
+    }
+
+    char* path = new char[len + 2];
+
+    for (int i = depth-1; i>=0; i--) {
+        if (i == depth-1) {   // file or TROOT name 
+            strcpy(path, d[i]->GetName());
+            if (i == 0) strcat(path, "/");
+        } 
+        else {
+            strcat(path, "/");
+            strcat(path, d[i]->GetName());
+        }
+    }
+    return path;  
+} 
+
+
+//----------------------------------------------------------------------
+
+void AliGNode::Save( TFile* file )
+{
+    if( fParent ) { // it's not the root node
+        // So I must check if the father node is in disk
+
+        if( file->cd(fParent->GetPath()) ) {
+
+            if( !gDirectory->Get(GetName()) )
+                file->mkdir( GetName() );
+
+            file->cd( GetPath() );
+
+            if( !gDirectory->Get( fShape->GetName() ) )
+                if ( fShape ) {
+/*                    const Text_t* shapetype = fShape->ClassName();
+                    if( !strcmp(shapetype,"AliGBox") ) {
+                        fShape->Write();
+                    }
+                    else {
+                        if (!strcmp(shapetype,"AliGSphere")) {
+                            fShape->Write();
+                        }
+                        else {
+                           if (!strcmp(shapetype,"AliGTube")) {
+                                fShape->Write();
+                           }
+                            else {
+                               if (!strcmp(shapetype,"AliGCone")) {
+                                    fShape->Write();
+                                }
+                                else {
+                                    if (!strcmp(shapetype,"AliGPCone")) {
+                                        cout << " Saving an AliGPCone:" << endl;
+                                        fShape->Dump();
+                                        cout << endl;
+                                        fShape->Write();
+                                    }
+                                    else {
+                                        if (!strcmp(shapetype,"AliGTRD1")) {
+                                            fShape->Write();
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }*/
+                    fShape->Write();
+                }
+
+
+            if( !gDirectory->Get( fMaterial->GetName() ) )
+                if ( fMaterial )
+                    fMaterial->Write();
+
+            if ( fConfig ) {
+                /*cout << " Con capacidad: " << fConfig->GetFormula().Capacity() << " voy a grabar esta configuracion: " << fConfig->GetFormula().Data() << endl;*/
+                fConfig->Write();
+            }
+
+            if ( fTrans )
+                fTrans->Write();
+        }
+        else
+           cout << " ERROR : Father exists but I can't find it. See AliGNode::Save, please..." << endl;
+    }
+    else { // if it's the root node
+        file->mkdir( GetName() );
+        file->cd( GetPath() );
+
+        if ( fShape )
+            fShape->Write();
+
+        if ( fMaterial )
+            fMaterial->Write();
+
+        if ( fConfig ) {
+            /*cout << " Con capacidad: " << fConfig->GetFormula().Capacity() << " voy a grabar esta configuracion: " << fConfig->GetFormula().Data() << endl;*/
+            fConfig->Write();
+        }
+
+        if ( fTrans )
+            fTrans->Write();
+    }
+
+    fflush(stdout);
+    file->Write();
+}
+
+//----------------------------------------------------------------------
+
+void AliGNode::SaveAll( TFile* file )
+{
+/*    if( fParent )
+        file->cd( fParent->GetPath() );
+    else
+        file->cd();
+
+    Save( file );
+
+    for( int i=0; i<fNsons; i++ ) {
+        cout << " Saving node: " << GetPath() << " with copy number " << << endl;
+        GetNodeFromfNnode(i)->SaveAll( file );
+    }
+*/
+
+    if( !gDirectory->Get(GetName()) ) {
+        Save( file );
+
+        for( int i=0; i<fNsons; i++ )
+           GetNodeFromfNnode(i)->SaveAll( file );
+    }
+
+/*    if (!file->cd(GetPath()))  {
+        Save( file );
+
+        for( int i=0; i<fNsons; i++ )
+           GetNodeFromfNnode(i)->SaveAll( file );
+    }
+*/
+}
+
+//----------------------------------------------------------------------
+
+void AliGNode::AddConfig( Text_t* name, Text_t* title, Text_t* detail, Int_t beg, Int_t end )
+{
+    Int_t Nsons = GetfNsons();
+
+    TStringLong formula = "";
+
+    for( int i=0; i<Nsons; i++ ) {
+        Int_t index = fNnode->At(i);  // Gets every node son's index
+        const Text_t* NodeName = ((AliGNode*)fNode->At(index))->GetName();
+        Int_t tranumber = fNtrans->At(i); // And the correspondent transform
+        const Text_t* TransfName = ((AliGTransform*)fTrans->At(tranumber))->GetName();
+
+        formula.Append(NodeName);
+        formula.Append(":");
+        formula.Append(TransfName);
+
+        if( i != fNsons-1 )
+            formula.Append("+");
+    }
+
+    //cout << " Acabo de crear la formula: " << formula << endl << endl;
+
+    const Text_t* shapetype    = fShape->ClassName();
+    const Text_t* shapename    = fShape->GetName();
+    const Text_t* materialname = fMaterial->GetName();
+
+    AliGConfig* tmp = new AliGConfig( name, title, formula, detail, shapetype, shapename, materialname, beg, end );
+
+    //if(fConfig) delete fConfig;
+
+    fConfig = tmp;
+}
+
+//----------------------------------------------------------------------
+
+/*void AliGNode::AddConfig( Text_t* name, Text_t* title, Text_t* detail, Int_t beg, Int_t end )
+{
+    // Creates the configuration of a node using the information passed as arguments
+    // and building the formula of the level below by building the list of its sons
+    // recursively.
+
+    Int_t Nsons = GetfNsons();
+
+    char* formula = NULL;
+
+    cout << " Nsons = " << Nsons << endl;
+
+    for( int i=0; i<Nsons; i++ ) {
+        Int_t index = fNnode->At(i);  // Gets every node son's index
+        const Text_t* NodeName = ((AliGNode*)fNode->At(index))->GetName();
+        Int_t tranumber = fNtrans->At(i); // And the correspondent transform
+        const Text_t* TransfName = ((AliGTransform*)fTrans->At(tranumber))->GetName();
+
+        int lenF, lenN, lenT;
+        lenF = lenN = lenT = 0;
+
+        cout << " i = " << i << " and fNsons = " << fNsons << endl;
+
+        if ( formula ) {
+            lenF = strlen(formula);
+            cout << " formula = #" << formula << "#" << endl;
+        }
+        
+        if ( NodeName ) {
+            lenN = strlen(NodeName);
+            cout << " NodeName = #" << NodeName << "#" << endl;
+        }
+        
+        if ( TransfName ) {
+            lenT = strlen(TransfName);
+            cout << " TransfName = #" << TransfName << "#" << endl;
+        }
+        
+        cout << " lenF: " << lenF << " - lenN: " << lenN << " - lenT: " << lenT << endl;
+
+        char* formula2;
+
+        if( i != fNsons-1 ) {
+            cout << " Arriba" << endl;
+            formula2 = new char[lenF+lenN+lenT+2];
+        }
+        else {
+            cout << " Embaixo" << endl;
+            formula2 = new char[lenF+lenN+lenT+1];
+        }
+        
+        formula2[0] = '\x0';
+
+        cout << "@@@ :) @@@" << endl;
+
+        if ( formula ) {
+            strcpy( formula2, formula );
+            cout << "1 formula2 = #" << formula2 << "#" << endl;
+        }
+
+        if( NodeName ) {
+            strcat( formula2, NodeName );
+            cout << "2 formula2 = #" << formula2 << "#" << endl;
+        }
+      
+        strcat( formula2, ":" );
+
+        if( TransfName ) {
+            strcat( formula2, TransfName );
+            cout << "3 formula2 = #" << formula2 << "#" << endl;
+        }
+
+        if( i != fNsons-1 ) {
+            strcat( formula2, "+" );
+            cout << "4 formula2 = #" << formula2 << "#" << endl;
+        }
+
+        //strcat( formula2, "\x0" );
+        //cout << "5 formula2 = #" << formula2 << "#" << endl;        
+
+        cout << " Y formula2 tiene un tamanyo de: " << strlen(formula2) << " caracteres." << endl;
+
+        //if( formula )  delete [] formula;
+        formula = new char[strlen(formula2)];
+        strcpy( formula, formula2 );
+        if( formula2 ) delete [] formula2;
+    }
+
+    const Text_t* shapetype    = fShape->ClassName();
+    const Text_t* shapename    = fShape->GetName();
+    const Text_t* materialname = fMaterial->GetName();
+
+    AliGConfig* tmp = new AliGConfig( name, title, formula, detail, shapetype, shapename, materialname, beg, end );
+
+    if(fConfig) delete fConfig;
+
+    fConfig = tmp;
+}
+*/
+
+//-------------------------------------------------------------------------
+
+void AliGNode::DrawShape(Option_t *option)
+{
+    Draw(option);
+    gPad->Update();
+}
+
+//----------------------------------------------------------------------
+
+void AliGNode::Draw(Option_t* option)
+{
+
+   TString opt = option;
+   opt.ToLower();
+//*-*- Clear pad if option "same" not given
+   if (!gPad) {
+      if (!gROOT->GetMakeDefCanvas()) return;
+      (gROOT->GetMakeDefCanvas())();
+   }
+   if (!opt.Contains("same")) gPad->Clear();
+
+//*-*- Draw Referenced node
+   //gGeometry->SetGeomLevel();
+   //gGeometry->UpdateTempMatrix();
+
+   AppendPad(option);
+
+//*-*- Create a 3-D View
+   TView *view = gPad->GetView();
+   if (!view) {
+      view = new TView(1);
+      view->SetAutoRange(kTRUE);
+      Paint(option);
+      view->SetAutoRange(kFALSE);
+   }
+}
+
+//------------------------------------------------------------------
+
+void AliGNode::Paint(Option_t *option)
+{ 
+  //     Print();
+     TPadView3D *view3D=gPad->GetView3D();
+
+   //Int_t level = gGeometry->GeomLevel();
+// restrict the levels for "range" option
+   //if (level > 3 && strcmp(option,"range") == 0) return;
+//*-*- Update translation vector and rotation matrix for new level
+   //if (level) {
+   //   gGeometry->UpdateTempMatrix(fX,fY,fZ,fMatrix->GetMatrix(),fMatrix->IsReflection());
+   //   if (view3D)
+   //       view3D->UpdateNodeMatrix(this,option);
+  // }
+  
+//*-*- Paint Referenced shape
+//   Int_t vis = fShape->GetVisibility();
+//   if ( vis == -1) return;
+//   if (vis == -3) {
+//     if (nsons == 0) vis = 1;
+//     else            vis = 0;
+//   }
+
+  // TAttLine::Modify();
+  // TAttFill::Modify();
+   //if (fVisibility && fShape->GetVisibility()) {
+      gNode = this;
+      //fShape->SetLineColor(GetLineColor());
+      //fShape->SetLineStyle(GetLineStyle());
+      //fShape->SetLineWidth(GetLineWidth());
+      //fShape->SetFillColor(GetFillColor());
+      //fShape->SetFillStyle(GetFillStyle());
+      
+   Int_t nsons = 0;
+   if (fNnode) nsons = GetfNsons();
+      if (view3D)
+         view3D->SetAttNode((TNode*)this,option);
+      
+     
+    if(fVis) {
+        if( fShape )
+            fShape->Paint(option);
+        else
+            cout << " Intente dibujar donde no habia shape!!! " << endl;
+   }
+   //}
+   if ( TestBit(kSonsInvisible) ) return;
+
+//*-*- Paint all sons
+   if(!nsons) return;
+    
+   //gGeometry->PushLevel();
+   for( int i=0; i<nsons; i++ ) {
+      
+       gAliGeometry->PushMatrix(gMatrix);
+
+        AliGNode* node = (AliGNode*) fNode->At(fNnode->At(i));
+       
+       AliGTransform* trans = (AliGTransform*) fTrans->At(fNtrans->At(i));
+        gAliGeometry->UpdateMatrix(trans);
+        node->Paint(option);
+       gAliGeometry->PopMatrix();
+       
+    }
+   //gGeometry->PopLevel();
+   
+}
+   
+   
+//--------------------------------------------------------------------
+
+Int_t AliGNode::DistancetoPrimitive(Int_t px, Int_t py)
+{
+    TView *view = gPad->GetView();
+    gPad->SetSelected(view);
+    return 0;
+}
+
+//--------------------------------------------------------------------
+
diff --git a/GEODB/AliGNode.h b/GEODB/AliGNode.h
new file mode 100644 (file)
index 0000000..474bf3b
--- /dev/null
@@ -0,0 +1,99 @@
+#ifndef ALIGNODE_H
+#define ALIGNODE_H
+
+#include <TObjArray.h>
+#include <TNamed.h>
+#include <TArrayI.h>
+#include <TFile.h>
+#include "AliGTransform.h"
+#include "AliGShape.h"
+#include "AliGBox.h"
+#include "AliGSphere.h"
+#include "AliGTube.h"
+#include "AliGCone.h"
+#include "AliGPCone.h"
+#include "AliGTRD1.h"
+#include "AliGMaterial.h"
+#include "AliGConfig.h"
+
+class AliGNode : public TNamed {
+
+protected:
+    AliGConfig*   fConfig;
+    Int_t         fId;        /* node id number                                    */
+    AliGMaterial* fMaterial;  /* material                                          */
+    TArrayI*      fNcopy;     /* copy numbers list (associated with the sons list) */
+    TString       fNname;     /* node 'short' name                                 */
+    TArrayI*      fNnode;     /* Sons list                                         */
+    TObjArray*    fNode;      /* list of all nodes below                           */
+    Int_t         fNsons;     /* Number of elements in fNnode                      */
+    TArrayI*      fNtrans;    /* transf list (associated with the sons list)       */
+    AliGNode*     fParent;    /* Pointer to the parent node                        */
+    AliGShape*    fShape;     /* shape                                             */
+    TObjArray*    fTrans;     /* list of all the transformations involved          */
+    Int_t         fVis;              /* Visibility                                        */
+    
+
+public:
+    AliGNode( AliGNode* node=NULL ); /* Copy or Default Constructor */
+
+    AliGNode( Text_t* name, Int_t id, Text_t* title, AliGBox* box, AliGMaterial* material=NULL, const Text_t* matrixname="", AliGConfig* config=NULL ); /* AliGNode Constructor for AliGBox shape */
+
+    AliGNode( Text_t* name, Int_t id, Text_t* title, AliGSphere* sphere, AliGMaterial* material=NULL, const Text_t* matrixname="", AliGConfig* config=NULL ); /* AliGNode Constructor for AliGSphere shape */
+
+    AliGNode( Text_t* name, Int_t id, Text_t* title, AliGTube* tube, AliGMaterial* material=NULL, const Text_t* matrixname="", AliGConfig* config=NULL ); /* AliGNode Constructor for AliGTube shape */
+
+    AliGNode( Text_t* name, Int_t id, Text_t* title, AliGCone* cone, AliGMaterial* material=NULL, const Text_t* matrixname="", AliGConfig* config=NULL ); /* AliGNode Constructor for AliGCone shape */
+    
+    AliGNode( Text_t* name, Int_t id, Text_t* title, AliGPCone* pcone,AliGMaterial* material=NULL, const Text_t* matrixname="", AliGConfig* config=NULL ); /* AliGNode Constructor for AliGPCone shape */
+    
+    AliGNode( Text_t* name, Int_t id, Text_t* title, AliGShape* shape, AliGMaterial* material=NULL, const Text_t* matrixname="", AliGConfig* config=NULL ); /* AliGNode Constructor for an AliGShape */
+
+    AliGNode( Text_t* name, Int_t id, Text_t* title, AliGTRD1* trd1, AliGMaterial* material=NULL, const Text_t* matrixname="", AliGConfig* config=NULL );
+
+    virtual ~AliGNode(); /* Destructor */
+    AliGNode* operator=( const AliGNode* node ); /* Operator = */
+    virtual AliGMaterial *Material() const { return fMaterial;}
+            void           Add(AliGNode *son,AliGTransform *tran);
+            void           AddConf(AliGConfig* configname) { fConfig = configname;}
+            void           AddConfig(Text_t* name, Text_t* title, Text_t* detail="",Int_t beg=0, Int_t end=0);
+            void           AddMaterial(AliGMaterial* materialname) { fMaterial = materialname;}
+            void           AddShape( AliGShape* shapename) { fShape = shapename;}
+            Int_t          DistancetoPrimitive( Int_t px, Int_t py);
+            void           Draw( Option_t* option);
+            void           DrawShape( Option_t* option); /* MENU   */
+            void           EndConstructor( Text_t* name, Int_t id, Text_t* title, AliGMaterial *material, const Text_t *matrixname, AliGConfig* config );
+            AliGConfig*    GetConfig() {return fConfig;}
+           
+           TArrayI*       GetfNnode() {return fNnode;}
+           TObjArray*     GetfNode()  {return fNode;}
+            Int_t          GetfNsons() {return fNsons;}
+           TArrayI*       GetfNtrans(){return fNtrans;}
+           TArrayI*       GetfNcopy(){return fNcopy;}
+           TObjArray*     GetfTrans() {return fTrans;}
+           AliGMaterial*  GetMaterial() {return fMaterial;}
+            AliGNode*      GetNodeFromfNnode(int position) {return (AliGNode*)
+           this->fNode->At(fNnode->At(position));}
+           const Text_t*        GetFamName() {return fNname;}
+           AliGNode*      GetNodeFromfNode(int position) {return (AliGNode*)
+           this->fNode->At(position);}
+            AliGNode*      GetParent() {return fParent;}
+            Text_t*        GetPath();
+            AliGShape*     GetShape()  {return fShape;}
+            AliGTransform* GetTransFromfTrans(int position) {return (AliGTransform*) this->fTrans->At(position);}
+            //void           IncreaseSize(const Int_t total, TArrayI** array);
+            void          IncreaseSize(Int_t total,TArrayI &array);
+           void           Paint( Option_t *option);
+            void           Save(TFile* file);
+            void           SaveAll(TFile* file);
+            Int_t          SizefNode() {return this->fNode->GetSize();}
+            //void           Streamer(TBuffer &b);
+           void           SetVis(Int_t val) {fVis = val;}
+
+    ClassDef(AliGNode,1) //Node class
+};
+
+//R__EXTERN TArrayF* gMatrix;
+
+#endif
diff --git a/GEODB/AliGPCone.cxx b/GEODB/AliGPCone.cxx
new file mode 100644 (file)
index 0000000..4236d69
--- /dev/null
@@ -0,0 +1,559 @@
+// -*- C++ -*-
+// 
+// 1998/10/19
+// ---------------------------------------------------------------------------
+//
+// AliGPCone Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// By:  Joana E. Santo & David Collados
+//
+// ---------------------------------------------------------------------------
+
+#include <TView.h>
+#include <TVirtualPad.h>
+#include <iostream.h>
+#include <TGLKernelABC.h>
+#include <TCanvas.h>
+#include "AliGPCone.h"
+#include "TROOT.h"
+
+ClassImp(AliGPCone)
+
+AliGPCone::AliGPCone() : AliGShape()
+{
+    /* Default Constructor */
+    
+    fPhi1  = 0.;
+    fDphi1 = 0.;
+    fNz    = 0;
+    fNdiv  = 0;
+    fRmin  = NULL;
+    fRmax  = NULL;
+    fDz    = NULL;
+    fCoTab = NULL;
+    fSiTab = NULL;
+}
+
+//-------------------------------------------------------------------------
+
+AliGPCone::AliGPCone( AliGPCone* pcone )
+{
+    /* Copy Constructor */
+    if( pcone->fNz < 2 ) {
+        Error( pcone->GetName(), "number of z planes for %s must be at least two !", pcone->GetName() );
+        return;
+    }
+
+    fName  = pcone->fName;
+    fTitle = pcone->fTitle;
+
+    fColor = pcone->fColor;
+    fPhi1  = pcone->fPhi1;
+    fDphi1 = pcone->fDphi1;
+    fNz    = pcone->fNz;
+    fNdiv  = pcone->fNdiv;
+
+    fRmin  = new Float_t [fNz+1];
+    fRmax  = new Float_t [fNz+1];
+    fDz    = new Float_t [fNz+1];
+
+    fCoTab = NULL;
+    fSiTab = NULL;
+
+    while (fDphi1 > 360) fDphi1 -= 360;
+
+    MakeTableOfCoSin();
+
+    for( int k=0; k<fNz; k++ ) {
+        fDz[k]   = pcone->fDz[k];
+        fRmin[k] = pcone->fRmin[k];
+        fRmax[k] = pcone->fRmax[k];
+    }
+
+}
+
+//-------------------------------------------------------------------------
+
+AliGPCone::AliGPCone( Text_t *name, Text_t *title,  Float_t phi1, Float_t dphi1, Int_t nz ) : AliGShape(name, title)
+{
+    /* Constructor */
+    
+    if (nz < 2 ) {
+        Error(name, "number of z planes for %s must be at least two !", name);
+        return;
+    }
+
+    fPhi1  = phi1;
+    fDphi1 = dphi1;
+    fNz    = nz;
+    fNdiv  = 0;
+    fRmin  = new Float_t [fNz+1];
+    fRmax  = new Float_t [fNz+1];
+    fDz    = new Float_t [fNz+1];
+
+    fCoTab = NULL;
+    fSiTab = NULL;
+
+    while (fDphi1 > 360) fDphi1 -= 360;
+
+    MakeTableOfCoSin();
+}
+
+//---------------------------------------------------------------------------
+
+AliGPCone::AliGPCone( Text_t *name, Text_t* title,  Float_t *upar, Int_t np) : AliGShape(name, title)
+{
+    if (upar[2] < 2 ) {
+        Error(name, "number of z planes for %s must be at least two !", name);
+        return;
+    }
+
+    fPhi1  = upar[0];
+    fDphi1 = upar[1];
+    fNz    = (Int_t) upar[2];
+    fNdiv  = 0;
+    fRmin  = new Float_t [fNz+1];
+    fRmax  = new Float_t [fNz+1];
+    fDz    = new Float_t [fNz+1];
+    fCoTab = NULL;
+    fSiTab = NULL;
+
+    while (fDphi1 > 360) fDphi1 -= 360;
+
+    MakeTableOfCoSin();
+
+    for( int j=3, k=0; k<fNz; k++ ) {
+        fDz[k]   = upar[j];
+        fRmin[k] = upar[j+1];
+        fRmax[k] = upar[j+2];
+        j+=3;
+    }
+}
+
+//-------------------------------------------------------------------------
+
+AliGPCone::AliGPCone( Text_t *name, Text_t* title,  Float_t phi1, Float_t dphi1, Int_t nz, Float_t Z[10], Float_t RMIN[10], Float_t RMAX[10] ) : AliGShape(name, title)
+{       
+     cout << " ENTRA EN EL CONSTRUCTOR CHUNGO !!!!!! " << endl;
+    
+     //AliGPCone(name, title,  phi1, dphi1, nz);
+     
+     //for (int i= 0; i<nz; i++)
+         //DefineSection(i, Z[i], RMIN[i], RMAX[i]);
+}
+
+//---------------------------------------------------------------------------
+
+AliGPCone::~AliGPCone() 
+{
+    /* Destructor */
+    
+    if( fRmin  ) delete [] fRmin;
+    if( fRmax  ) delete [] fRmax;
+    if( fDz    ) delete [] fDz;
+    //if( fSiTab ) delete fSiTab;
+    //if( fCoTab ) delete fCoTab;
+
+    fRmin  = NULL;
+    fRmax  = NULL;
+    fDz    = NULL;
+    //fCoTab = NULL;
+    //fSiTab = NULL;
+}
+
+//-------------------------------------------------------------------------
+
+void AliGPCone::DrawShape(Option_t *option)
+{
+    Draw(option);
+    gPad->Update();
+}
+
+//-------------------------------------------------------------------------
+
+void AliGPCone::Draw(Option_t *option)
+{
+    //cout << " Entra en " << this->GetName() << "::Draw " << endl;
+
+    TString opt = option;
+    opt.ToLower();
+
+    if( !gPad ) {
+      //TCanvas* Cone = new TCanvas("AliGPCone","AliGPCone",0,0,400,300);
+        gPad = new TCanvas("AliGPCone","AliGPCone",0,0,400,300);
+        gPad->Range(0,0,1,1);
+        gPad->SetFillColor(32); // Light Green
+        gPad->SetBorderSize(3);
+        gPad->SetBorderMode(0); // -1 (down) 0 (no) 1 (up)
+    }
+    else {
+        if( !opt.Contains("same") ) {
+            gPad->Clear();
+            gPad->SetName("AliGPCone");
+            gPad->SetTitle("AliGPCone");
+        }
+        else {
+            gPad->SetName("AliShapes");
+            gPad->SetTitle("AliShapes"); 
+        }
+    }
+
+    AppendPad(option);
+    TView *view = gPad->GetView();
+
+    if (!view)
+        view = new TView(1);
+
+    view->SetAutoRange(kTRUE);
+    Paint(option);
+    view->SetAutoRange(kFALSE);
+    //cout << " Sale de " << this->GetName() << "::Draw " << endl;
+}
+
+//-------------------------------------------------------------------------
+
+void AliGPCone::SetPoints(Float_t *buff)
+{
+  //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Create PCON points*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+//*-*                            ==================
+
+    Int_t i, j;
+    Int_t indx = 0;
+
+    if (buff) {
+
+        Int_t n            = GetNumberOfDivisions()+1;
+
+//*-* We've to check whether the table does exist and create it
+//*-* since fCoTab/fSiTab are not saved with any TShape::Streamer function
+        if (!fCoTab)   MakeTableOfCoSin();
+
+        for (i = 0; i < fNz; i++)
+        {
+            for (j = 0; j < n; j++)
+            {
+                buff[indx++] = fRmin[i] * fCoTab[j];
+                buff[indx++] = fRmin[i] * fSiTab[j];
+                buff[indx++] = fDz[i];
+            }
+            for (j = 0; j < n; j++)
+            {
+                buff[indx++] = fRmax[i] * fCoTab[j];
+                buff[indx++] = fRmax[i] * fSiTab[j];
+                buff[indx++] = fDz[i];
+            }
+        }
+    }
+}
+
+//-------------------------------------------------------------------------
+
+void AliGPCone::Paint(Option_t *option)
+{
+
+//*-*-*-*-*-*-*-*Paint this 3-D shape with its current attributes*-*-*-*-*-*-*-*
+//*-*            ================================================
+
+    Int_t i, j;
+    if (fNz < 2) return;
+    const Int_t n = GetNumberOfDivisions()+1;
+
+    SetLineColor( GetCol() );
+    
+    Int_t numpoints = fNz*2*n;
+    if (numpoints <= 0) return;
+    //*-* Allocate memory for points *-*
+
+    Float_t *points = new Float_t[3*numpoints];
+    if (!points) return;
+    SetPoints(points);
+
+    Bool_t rangeView = strcmp(option,"range")==0 ? kTRUE : kFALSE;
+    if (!rangeView && gPad->GetView3D()) PaintGLPoints(points);
+
+    //==  for (i = 0; i < numpoints; i++)
+    //==          gNode->Local2Master(&points[3*i],&points[3*i]);
+
+    Bool_t specialCase = kFALSE;
+
+    if (fDphi1 == 360)           //mark this as a very special case, when
+        specialCase = kTRUE;     //we have to draw this PCON like a TUBE
+
+    X3DBuffer *buff = new X3DBuffer;
+
+    if (buff) {
+        buff->numPoints = numpoints;
+        buff->numSegs   = 4*(fNz*n-1+(specialCase == kTRUE));
+        buff->numPolys  = 2*(fNz*n-1+(specialCase == kTRUE));
+    }
+
+    //*-* Allocate memory for points *-*
+
+    buff->points = points;
+
+    Int_t c = ((GetLineColor() % 8) - 1) * 4;     // Basic colors: 0, 1, ... 7
+    if (c < 0) c = 0;
+
+    //*-* Allocate memory for segments *-*
+
+    Int_t indx, indx2, k;
+    indx = indx2 = 0;
+
+    buff->segs = new Int_t[buff->numSegs*3];
+    if (buff->segs) {
+
+        //inside & outside circles, number of segments: 2*fNz*(n-1)
+        //             special case number of segments: 2*fNz*n
+        for (i = 0; i < fNz*2; i++) {
+            indx2 = i*n;
+            for (j = 1; j < n; j++) {
+                buff->segs[indx++] = c;
+                buff->segs[indx++] = indx2+j-1;
+                buff->segs[indx++] = indx2+j;
+            }
+            if (specialCase) {
+                buff->segs[indx++] = c;
+                buff->segs[indx++] = indx2+j-1;
+                buff->segs[indx++] = indx2;
+            }
+        }
+
+        //bottom & top lines, number of segments: 2*n
+        for (i = 0; i < 2; i++) {
+            indx2 = i*(fNz-1)*2*n;
+            for (j = 0; j < n; j++) {
+                buff->segs[indx++] = c;
+                buff->segs[indx++] = indx2+j;
+                buff->segs[indx++] = indx2+n+j;
+            }
+        }
+
+        //inside & outside cilindres, number of segments: 2*(fNz-1)*n
+        for (i = 0; i < (fNz-1); i++) {
+
+            //inside cilinder
+            indx2 = i*n*2;
+            for (j = 0; j < n; j++) {
+                buff->segs[indx++] = c+2;
+                buff->segs[indx++] = indx2+j;
+                buff->segs[indx++] = indx2+n*2+j;
+            }
+            //outside cilinder
+            indx2 = i*n*2+n;
+            for (j = 0; j < n; j++) {
+                buff->segs[indx++] = c+3;
+                buff->segs[indx++] = indx2+j;
+                buff->segs[indx++] = indx2+n*2+j;
+            }
+        }
+
+        //left & right sections, number of segments: 2*(fNz-2)
+        //          special case number of segments: 0
+        if (!specialCase) {
+            for (i = 1; i < (fNz-1); i++) {
+                for (j = 0; j < 2; j++) {
+                    buff->segs[indx++] = c;
+                    buff->segs[indx++] =  2*i    * n + j*(n-1);
+                    buff->segs[indx++] = (2*i+1) * n + j*(n-1);
+                }
+            }
+        }
+    }
+
+
+    Int_t m = n - 1 + (specialCase == kTRUE);
+
+//*-* Allocate memory for polygons *-*
+
+    indx = 0;
+
+    buff->polys = new Int_t[buff->numPolys*6];
+
+    if (buff->polys) {
+
+        //bottom & top, number of polygons: 2*(n-1)
+        // special case number of polygons: 2*n
+        for (i = 0; i < 2; i++) {
+            for (j = 0; j < n-1; j++) {
+                buff->polys[indx++] = c+3;
+                buff->polys[indx++] = 4;
+                buff->polys[indx++] = 2*fNz*m+i*n+j;
+                buff->polys[indx++] = i*(fNz*2-2)*m+m+j;
+                buff->polys[indx++] = 2*fNz*m+i*n+j+1;
+                buff->polys[indx++] = i*(fNz*2-2)*m+j;
+            }
+            if (specialCase) {
+                buff->polys[indx++] = c+3;
+                buff->polys[indx++] = 4;
+                buff->polys[indx++] = 2*fNz*m+i*n+j;
+                buff->polys[indx++] = i*(fNz*2-2)*m+m+j;
+                buff->polys[indx++] = 2*fNz*m+i*n;
+                buff->polys[indx++] = i*(fNz*2-2)*m+j;
+            }
+        }
+
+
+        //inside & outside, number of polygons: (fNz-1)*2*(n-1)
+        for (k = 0; k < (fNz-1); k++) {
+            for (i = 0; i < 2; i++) {
+                for (j = 0; j < n-1; j++) {
+                    buff->polys[indx++] = c+i;
+                    buff->polys[indx++] = 4;
+                    buff->polys[indx++] = (2*k+i*1)*m+j;
+                    buff->polys[indx++] = fNz*2*m+(2*k+i*1+2)*n+j;
+                    buff->polys[indx++] = (2*k+i*1+2)*m+j;
+                    buff->polys[indx++] = fNz*2*m+(2*k+i*1+2)*n+j+1;
+                }
+                if (specialCase) {
+                    buff->polys[indx++] = c+i;
+                    buff->polys[indx++] = 4;
+                    buff->polys[indx++] = (2*k+i*1)*m+j;
+                    buff->polys[indx++] = fNz*2*m+(2*k+i*1+2)*n+j;
+                    buff->polys[indx++] = (2*k+i*1+2)*m+j;
+                    buff->polys[indx++] = fNz*2*m+(2*k+i*1+2)*n;
+                }
+            }
+        }
+
+
+        //left & right sections, number of polygons: 2*(fNz-1)
+        //          special case number of polygons: 0
+        if (!specialCase) {
+            indx2 = fNz*2*(n-1);
+            for (k = 0; k < (fNz-1); k++) {
+                for (i = 0; i < 2; i++) {
+                    buff->polys[indx++] = c+2;
+                    buff->polys[indx++] = 4;
+                    buff->polys[indx++] = k==0 ? indx2+i*(n-1) : indx2+2*fNz*n+2*(k-1)+i;
+                    buff->polys[indx++] = indx2+2*(k+1)*n+i*(n-1);
+                    buff->polys[indx++] = indx2+2*fNz*n+2*k+i;
+                    buff->polys[indx++] = indx2+(2*k+3)*n+i*(n-1);
+                }
+            }
+            buff->polys[indx-8] = indx2+n;
+            buff->polys[indx-2] = indx2+2*n-1;
+        }
+    }
+
+    //*-* Paint in the pad
+    
+    PaintShape(buff,rangeView);
+  
+    if (strstr(option, "x3d")) {
+        if(buff && buff->points && buff->segs)
+            FillX3DBuffer(buff);
+        else {
+            gSize3D.numPoints -= buff->numPoints;
+            gSize3D.numSegs   -= buff->numSegs;
+            gSize3D.numPolys  -= buff->numPolys;
+        }
+    }
+
+    delete [] points;
+    if (buff->segs)     delete [] buff->segs;
+    if (buff->polys)    delete [] buff->polys;
+    if (buff)           delete    buff;
+    
+    }
+    
+//------------------------------------------------------------------------- 
+
+void AliGPCone::MakeTableOfCoSin()
+{
+    const Double_t PI  = TMath::ATan(1) * 4.0;
+    const Double_t ragrad  = PI/180.0;
+
+    Int_t j;
+    Int_t n = GetNumberOfDivisions () + 1;
+    if (fCoTab)
+        delete [] fCoTab; // Delete the old tab if any
+        fCoTab = new Double_t [n];
+    if (!fCoTab ) return;
+
+    if (fSiTab)
+        delete [] fSiTab; // Delete the old tab if any
+    fSiTab = new Double_t [n];
+    if (!fSiTab ) return;
+
+    Double_t range   = Double_t(fDphi1 * ragrad);
+    Double_t phi1    = Double_t(fPhi1  * ragrad);
+    Double_t angstep = range/(n-1);
+
+    Double_t ph = phi1;
+    for (j = 0; j < n; j++)
+    {
+        ph = phi1 + j*angstep;
+        fCoTab[j] = TMath::Cos(ph);
+        fSiTab[j] = TMath::Sin(ph);
+    }
+
+}
+//----------------------------------------------------    
+    
+void AliGPCone::SetNumberOfDivisions (Int_t p)
+{
+    if (GetNumberOfDivisions () == p) return;
+    fNdiv=p;
+    MakeTableOfCoSin();
+}   
+    
+//-------------------------------------------------------   
+
+void AliGPCone::DefineSection(Int_t secNum, Float_t z, Float_t rmin, Float_t rmax )
+{
+
+//*-*-*-*-*-*-*-*-*-*Defines section secNum of the polycone*-*-*-*-*-*-*-*-*-*-*
+//*-*                ======================================
+//
+//     - rmin  radius of the inner circle in the cross-section
+//
+//     - rmax  radius of the outer circle in the cross-section
+//
+//     - z     z coordinate of the section
+
+    if ((secNum < 0) || (secNum >= fNz)) return;
+
+    fRmin[secNum] = rmin;
+    fRmax[secNum] = rmax;
+    fDz[secNum]   = z;
+}
+
+//-------------------------------------------------------   
+
+void AliGPCone::Streamer(TBuffer &R__b)
+{
+   // Stream an object of class AliGPCone.
+
+   if (R__b.IsReading()) {
+      Version_t R__v = R__b.ReadVersion(); if (R__v) { }
+      AliGShape::Streamer(R__b);
+      R__b.ReadArray(fSiTab); //
+      R__b.ReadArray(fCoTab); //
+      R__b >> fPhi1;
+      R__b >> fDphi1;
+      R__b >> fNz;
+      R__b.ReadArray(fRmin); //
+      R__b.ReadArray(fRmax); //
+      R__b.ReadArray(fDz); //
+      R__b >> fNdiv;
+   } else {
+      R__b.WriteVersion(AliGPCone::IsA());
+      AliGShape::Streamer(R__b);
+      R__b.WriteArray(fSiTab, GetNumberOfDivisions()+1); //
+      R__b.WriteArray(fCoTab, GetNumberOfDivisions()+1); //
+      R__b << fPhi1;
+      R__b << fDphi1;
+      R__b << fNz;
+      R__b.WriteArray(fRmin, fNz+1); //
+      R__b.WriteArray(fRmax, fNz+1); //
+      R__b.WriteArray(fDz, fNz+1); //
+      R__b << fNdiv;
+   }
+}
+
+//-------------------------------------------------------   
+
+
diff --git a/GEODB/AliGPCone.h b/GEODB/AliGPCone.h
new file mode 100644 (file)
index 0000000..ffc3d86
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef AliGPCone_H
+#define AliGPCone_H
+
+#include "AliGTube.h"
+const Int_t kDiv = 20;               //default number of divisions
+
+class AliGPCone: public AliGShape {
+
+    private:
+
+      Double_t* fSiTab;  //Table of sin(fPhi1) .... sin(fPhil+fDphi1)
+      Double_t* fCoTab;  //Table of cos(fPhi1) .... cos(fPhil+fDphi1)
+
+    protected:
+
+       Float_t  fPhi1;   //lower phi limit
+       Float_t  fDphi1;  //range in phi
+       Int_t    fNz;       //number of z segments
+       Float_t* fRmin;  // pointer to array of inside radiuses
+       Float_t* fRmax;  // pointer to array of outside radiuses
+       Float_t* fDz;    // pointer to array of half lengths in z
+       Int_t    fNdiv;     //number of divisions
+
+    public:
+        AliGPCone(); /* Default Constructor */
+        AliGPCone( Text_t *name, Text_t* title,  Float_t phi1, Float_t dphi1, Int_t nz);
+       AliGPCone( AliGPCone* pcone );
+       AliGPCone( Text_t *name, Text_t* title,  Float_t phi1, Float_t dphi1,
+       Int_t nz, Float_t Z[10], Float_t RMIN[10], Float_t RMAX[10]);
+        AliGPCone( Text_t *name, Text_t* title,  Float_t *upar, Int_t np);
+        virtual ~AliGPCone(); /* Destructor */
+
+        //Float_t GetRmin2() {return fRmin2;}
+        //Float_t GetRmax2() {return fRmax2;}
+               void  DefineSection(Int_t secNum, Float_t z, Float_t rmin, Float_t rmax);
+        virtual void  Draw(Option_t *option);
+        virtual void  DrawShape(Option_t *option); // *MENU*
+        virtual Int_t GetNumberOfDivisions () const {if (fNdiv) return fNdiv; else return kDiv;}
+               void  MakeTableOfCoSin();
+                void  Paint(Option_t *option);
+               void  SetNumberOfDivisions (Int_t p);
+        virtual void  SetPoints(Float_t *buff);
+
+
+    ClassDef(AliGPCone,1) // Polycone class
+};
+#endif
diff --git a/GEODB/AliGShape.cxx b/GEODB/AliGShape.cxx
new file mode 100644 (file)
index 0000000..0336c0e
--- /dev/null
@@ -0,0 +1,134 @@
+// -*- C++ -*-
+// 
+// 1998/10/22
+// ---------------------------------------------------------------------------
+//
+// AliGShape Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo
+//
+// ---------------------------------------------------------------------------
+
+#include <TView.h>
+#include <TVirtualPad.h>
+#include <iostream.h>
+#include "AliGShape.h"
+#include "AliGNode.h"
+#include "AliGeometry.h"
+
+//---------------------------------------------------------------------------
+
+ClassImp(AliGShape)
+
+AliGShape::AliGShape()
+{
+    /* Default Constructor */
+    fName  = "";
+    fTitle = "";
+}
+
+//---------------------------------------------------------------------------
+
+AliGShape::AliGShape(Text_t* name, Text_t* title): TNamed(name, title), TAttLine(), TAttFill()
+{
+   /* Constructor */
+}
+
+//---------------------------------------------------------------------------
+
+AliGShape::AliGShape( AliGShape* shape )
+{
+    /* Copy Constructor */
+    fColor = shape->fColor;
+}
+
+
+//---------------------------------------------------------------------------
+
+void AliGShape::Paint(Option_t *)
+{
+   // This method must be overridden by the real shape implementation.
+   // AbstractMethod("Paint");
+}
+
+// ---------------------------------------------------------------------------
+
+Int_t AliGShape::DistancetoPrimitive(Int_t, Int_t)
+{
+    TView *view = gPad->GetView();
+    gPad->SetSelected(view);
+    return 0;
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGShape::PaintShape(X3DBuffer *buff, Bool_t rangeView)
+{
+//*-*-*-*-*Paint 3-D shape in current pad with its current attributes*-*-*-*-*
+//*-*      ==========================================================
+
+    if (!buff) return;
+
+    Float_t *point = &(buff->points[0]);
+    for (Int_t j = 0; j < buff->numPoints; j++) {
+      //           printf("Before %f %f %f\n",point[3*j],point[3*j+1],point[3*j+2]);
+           gAliGeometry->Local2Master(&point[3*j],&point[3*j]);
+          //           printf("After %f %f %f\n",point[3*j],point[3*j+1],point[3*j+2]);
+    }
+          
+    Float_t points[6], x0, y0, z0, x1, y1, z1;
+    const Int_t kExpandView = 2;
+    int i0;
+
+    x0 = y0 = z0 = x1 = y1 = z1 = buff->points[0];
+
+    TAttLine::Modify();  //Change line attributes only if necessary
+    TAttFill::Modify();  //Change fill area attributes only if necessary
+
+    for (Int_t i = 0; i < buff->numSegs; i++) {
+        i0 = 3*buff->segs[3*i+1];
+        points[0] = buff->points[i0++];
+        points[1] = buff->points[i0++];
+        points[2] = buff->points[i0];
+
+        i0 = 3*buff->segs[3*i+2];
+        points[3] = buff->points[i0++];
+        points[4] = buff->points[i0++];
+        points[5] = buff->points[i0];
+
+        x0 = points[0] < x0 ? points[0] : x0;
+        y0 = points[1] < y0 ? points[1] : y0;
+        z0 = points[2] < z0 ? points[2] : z0;
+        x1 = points[0] > x1 ? points[0] : x1;
+        y1 = points[1] > y1 ? points[1] : y1;
+        z1 = points[2] > z1 ? points[2] : z1;
+
+        Float_t *ptpoints_0 = &points[0];
+        Float_t *ptpoints_3 = &points[3];
+
+       //printf("Painting from %f to %f\n",*ptpoints_0, *ptpoints_3);
+       
+        gPad->PaintLine3D(ptpoints_0, ptpoints_3);
+//        gPad->PaintLine3D(&points[0], &points[3]);
+    }
+    
+    TView *view = gPad->GetView();
+    //cout << "x0,y0,x1,y1=" << x0 << y0 << x1 << y1 << endl;
+    if (view->GetAutoRange()) view->SetRange(-500,-500,-500,500,500,500,kExpandView);
+    
+    // if (view->GetAutoRange()) view->SetRange(-1,-1,-1,1,1,1,kExpandView);
+}
+
+
+
+// ---------------------------------------------------------------------------
+
+void AliGShape::SetPoints(Float_t *) {
+    AbstractMethod("SetPoints(Float_t *buffer)");
+}
+
+// ---------------------------------------------------------------------------
+
+
diff --git a/GEODB/AliGShape.h b/GEODB/AliGShape.h
new file mode 100644 (file)
index 0000000..d0e44bc
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef ALIGSHAPE_H
+#define ALIGSHAPE_H
+
+/* -*- C++ -*- */
+/*             */
+/* 1998/10/22  */
+/* --------------------------------------------------------------------------  */
+/*                                                                             */
+/* AliGShape Class                                                             */
+/*                                                                             */
+/* This file is part of the ALICE Geometry Database .                          */
+/*                                                                             */
+/* Author:  Joana E. Santo                                                     */
+/*                                                                             */
+/* --------------------------------------------------------------------------  */
+/* The shape virtual class represents the basic elements used in this          */
+/* geometry to build the constituents of a detector. Deriving from this        */
+/* class there are simple shapes like box, sphere, cone and thorus,            */
+/* supershapes that are obtained from the previous by Boolean operations       */
+/* and also user defined shapes.                                               */
+
+#ifndef ROOT_TNamed
+#include <TNamed.h>
+
+#endif
+
+//#ifndef ROOT_TMaterial
+//#include <TMaterial.h>
+//#endif
+
+#ifndef ROOT_TAttLine
+#include <TAttLine.h>
+#endif
+
+#ifndef ROOT_TAttFill
+#include <TAttFill.h>
+#endif
+
+#ifndef ROOT_X3DBuffer
+#include <X3DBuffer.h>
+#endif
+
+#ifndef ROOT_TPolyLine3D
+#include <TPolyLine3D.h>
+#endif
+
+#include "TVector.h"
+class AliGNode;
+extern "C" { void FillX3DBuffer (X3DBuffer *buff); }
+
+class AliGShape: public TNamed, public TAttLine, public TAttFill { 
+    protected:
+        Int_t fColor;
+
+    public:
+        AliGShape(Text_t* name, Text_t* title);
+        AliGShape();
+        AliGShape( AliGShape* shape ); // Copy Constructor
+        virtual ~AliGShape() {}
+
+                Int_t   DistancetoPrimitive(Int_t, Int_t);
+                Int_t   GetCol() { return fColor; }
+        virtual Bool_t  Is3D () {return kTRUE;}
+        virtual void    Paint(Option_t *option="");
+        virtual void    PaintGLPoints(Float_t *vertex);
+        virtual void    PaintShape(X3DBuffer *buff, Bool_t rangeView);
+                void    SetCol( Int_t color ) { fColor = color; }
+        virtual void    SetName(const Text_t *name);
+        virtual void    SetPoints(Float_t *buffer);
+
+    ClassDef(AliGShape,1) //Generic shape class
+};
+
+R__EXTERN AliGNode* gNode;
+R__EXTERN TVector*  gMatrix;
+R__EXTERN Size3D    gSize3D;
+
+inline void AliGShape::PaintGLPoints(Float_t *) { }
+inline void AliGShape::SetName(const Text_t *) { }
+
+#endif
diff --git a/GEODB/AliGSphere.cxx b/GEODB/AliGSphere.cxx
new file mode 100644 (file)
index 0000000..d5a154e
--- /dev/null
@@ -0,0 +1,581 @@
+   // -*- C++ -*-
+// 
+// 1998/07/23
+// ---------------------------------------------------------------------------
+//
+// AliGSphere Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo
+//
+// ---------------------------------------------------------------------------
+
+#include <TView.h>
+#include <TVirtualPad.h>
+#include <iostream.h>
+#include <TCanvas.h>
+#include <TGLKernelABC.h>
+#include "TROOT.h"
+#include "AliGSphere.h"
+
+
+ClassImp(AliGSphere)
+
+AliGSphere::AliGSphere()
+{
+    /* Default Constructor */
+    faX          = 1.;  // Coeff along Ox
+    faY          = 1.;  // Coeff along Oy
+    faZ          = 1.;  // Coeff along Oz
+    fAspectRatio = 1.;  // Relation between asumth and grid size (by default 1.0)
+    fCoTab       = NULL;// Table of cos(fPhimin) .... cos(Phi)
+    fCoThetaTab  = NULL;// Table of sin(gThemin) .... cos(Theta)
+    fName        = "";
+    fNdiv        = 0;   // number of divisions
+    fNz          = 0;   // number of sections
+    fPhimax      = 0.;  // maximum phi
+    fPhimin      = 0.;  // minimum phi
+    fRmax        = 0.;  // maximum radius
+    fRmin        = 0.;  // minimum radius
+    fSiTab       = NULL;// Table of sin(fPhimin) .... sin(Phi)
+    fThemax      = 0.;  // maximum theta
+    fThemin      = 0.;  // minimum theta
+    fTitle       = "";
+}
+
+// ---------------------------------------------------------------------------
+
+AliGSphere::AliGSphere(Text_t *name, Text_t *title, Float_t rmin, Float_t rmax, Float_t themin, Float_t themax, Float_t phimin, Float_t phimax) : AliGShape(name, title)
+{
+    /* Constructor */
+    faX          = 1.;    // Coeff along Ox
+    faY          = 1.;    // Coeff along Oy
+    faZ          = 1.;    // Coeff along Oz
+    fAspectRatio = 1.;    // Relation between asumth and grid size (by default 1.0)
+    fCoTab       = NULL;  // Table of cos(fPhimin) .... cos(Phi)
+    fCoThetaTab  = NULL;  // Table of sin(gThemin) .... cos(Theta)
+    fNdiv        = 0;     // number of divisions
+    fNz          = 0;     // number of sections
+    fPhimax      = phimax;// maximum phi
+    fPhimin      = phimin;// minimum phi
+    fRmax        = rmax;  // maximum radius
+    fRmin        = rmin;  // minimum radius
+    fSiTab       = NULL;  // Table of sin(fPhimin) .... sin(Phi)
+    fThemax      = themax;// maximum theta
+    fThemin      = themin;// minimum theta
+
+    SetNumberOfDivisions (20);
+}
+
+// ---------------------------------------------------------------------------
+
+AliGSphere::AliGSphere(AliGSphere *sphere) 
+{
+    /* Copy Constructor */
+    faX          = 1.;    // Coeff along Ox
+    faY          = 1.;    // Coeff along Oy
+    faZ          = 1.;    // Coeff along Oz
+    fAspectRatio = 1.;    // Relation between asumth and grid size (by default 1.0)
+    fColor       = sphere->fColor;
+    fCoTab       = NULL;  // Table of cos(fPhimin) .... cos(Phi)
+    fCoThetaTab  = NULL;  // Table of sin(gThemin) .... cos(Theta)
+    fNdiv        = 0;     // number of divisions
+    fNz          = 0;     // number of sections
+    fPhimax      = sphere->fPhimax;// maximum phi
+    fPhimin      = sphere->fPhimin;// minimum phi
+    fRmax        = sphere->fRmax;  // maximum radius
+    fRmin        = sphere->fRmin;  // minimum radius
+    fSiTab       = NULL;  // Table of sin(fPhimin) .... sin(Phi)
+    fThemax      = sphere->fThemax;// maximum theta
+    fThemin      = sphere->fThemin;// minimum theta
+
+    SetNumberOfDivisions (20);
+}
+// ---------------------------------------------------------------------------
+
+AliGSphere::AliGSphere(Text_t *name, Text_t *title, Float_t rmax) : AliGShape(name, title)
+{
+    /* Simplified Constructor */
+    faX          = 1.;   // Coeff along Ox
+    faY          = 1.;   // Coeff along Oy
+    faZ          = 1.;   // Coeff along Oz
+    fAspectRatio = 1.;   // Relation between asumth and grid size (by default 1.0)
+    fCoTab       = NULL; // Table of cos(fPhimin) .... cos(Phi)
+    fCoThetaTab  = NULL; // Table of sin(gThemin) .... cos(Theta)
+    fNdiv        = 0;    // number of divisions
+    fNz          = 0;    // number of sections
+    fPhimax      = 360.; // maximum phi
+    fPhimin      = 0.;   // minimum phi
+    fRmax        = rmax; // maximum radius
+    fRmin        = 0.;   // minimum radius
+    fSiTab       = NULL; // Table of sin(fPhimin) .... sin(Phi)
+    fThemax      = 180.; // maximum theta
+    fThemin      = 0.;   // minimum theta
+
+    SetNumberOfDivisions (20);
+}
+
+// ---------------------------------------------------------------------------
+
+AliGSphere::~AliGSphere() {
+    /* Destructor */
+    delete [] fCoThetaTab;  // Table of sin(gThemin) .... cos(Theta)
+    delete [] fCoTab;
+    delete [] fSiTab;
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGSphere::DrawShape(Option_t *option)
+{
+    Draw(option);
+    gPad->Update();
+}
+
+//-------------------------------------------------------------------------
+
+//void AliGSphere::Draw()
+void AliGSphere::Draw(Option_t *option)
+{
+    TString opt = option;
+    opt.ToLower();
+
+    if( !gPad ) {
+        gPad = new TCanvas("AliGSphere","AliGSphere",0,0,400,300);
+        gPad->Range(0,0,1,1);
+        gPad->SetFillColor(32); // Light Green
+        gPad->SetBorderSize(3);
+        gPad->SetBorderMode(0); // -1 (down) 0 (no) 1 (up)
+    }
+    else {
+        if( !opt.Contains("same") ) {
+            gPad->Clear();
+            gPad->SetName("AliGSphere");
+            gPad->SetTitle("AliGSphere");
+        }
+        else {
+            gPad->SetName("AliShapes");
+            gPad->SetTitle("AliShapes"); 
+        }
+    }
+
+    AppendPad(option);
+    TView *view = gPad->GetView();
+
+    if (!view)
+        view = new TView(1);
+
+    view->SetAutoRange(kTRUE);
+    Paint(option);
+    view->SetAutoRange(kFALSE);   
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGSphere::Paint(Option_t *option)
+{
+//*-*-*-*-*-*-*-*Paint this 3-D shape with its current attributes*-*-*-*-*-*-*-*
+//*-*            ================================================
+
+    SetLineColor( GetCol() );
+
+    Int_t i, j;
+    const Int_t n = GetNumberOfDivisions()+1;
+    Int_t nz = fNz+1;
+    Int_t numpoints = 2*n*nz;
+    if (nz < 2) return;
+
+    if (numpoints <= 0) return;
+    //*-* Allocate memory for points *-*
+
+    Float_t *points = new Float_t[3*numpoints];
+    if (!points) return;
+    SetPoints(points);
+
+    if (gPad->GetView3D()) PaintGLPoints(points);
+
+ //==  for (i = 0; i < numpoints; i++)
+ //==          gNode->Local2Master(&points[3*i],&points[3*i]);
+
+    Bool_t specialCase = kFALSE;
+
+    if (TMath::Abs(TMath::Sin(2*(fPhimax - fPhimin))) <= 0.01)  //mark this as a very special case, when
+        specialCase = kTRUE;                                  //we have to draw this PCON like a TUBE
+
+    X3DBuffer *buff = new X3DBuffer;
+    if (buff) {
+        buff->numPoints = numpoints;
+        buff->numSegs   = 4*(nz*n-1+(specialCase == kTRUE));
+        buff->numPolys  = 2*(nz*n-1+(specialCase == kTRUE));
+    }
+
+//*-* Allocate memory for points *-*
+
+    buff->points = points;
+
+    Int_t c = ((GetLineColor() % 8) - 1) * 4;     // Basic colors: 0, 1, ... 7
+    if (c < 0) c = 0;
+
+//*-* Allocate memory for segments *-*
+
+    Int_t indx, indx2, k;
+    indx = indx2 = 0;
+
+    buff->segs = new Int_t[buff->numSegs*3];
+    if (buff->segs) {
+
+        //inside & outside spheres, number of segments: 2*nz*(n-1)
+        //             special case number of segments: 2*nz*n
+        for (i = 0; i < nz*2; i++) {
+            indx2 = i*n;
+            for (j = 1; j < n; j++) {
+                buff->segs[indx++] = c;
+                buff->segs[indx++] = indx2+j-1;
+                buff->segs[indx++] = indx2+j;
+            }
+            if (specialCase) {
+                buff->segs[indx++] = c;
+                buff->segs[indx++] = indx2+j-1;
+                buff->segs[indx++] = indx2;
+            }
+        }
+
+        //bottom & top lines, number of segments: 2*n
+        for (i = 0; i < 2; i++) {
+            indx2 = i*(nz-1)*2*n;
+            for (j = 0; j < n; j++) {
+                buff->segs[indx++] = c;
+                buff->segs[indx++] = indx2+j;
+                buff->segs[indx++] = indx2+n+j;
+            }
+        }
+
+        //inside & outside spheres, number of segments: 2*(nz-1)*n
+        for (i = 0; i < (nz-1); i++) {
+
+            //inside sphere
+            indx2 = i*n*2;
+            for (j = 0; j < n; j++) {
+                buff->segs[indx++] = c+2;
+                buff->segs[indx++] = indx2+j;
+                buff->segs[indx++] = indx2+n*2+j;
+            }
+            //outside sphere
+            indx2 = i*n*2+n;
+            for (j = 0; j < n; j++) {
+                buff->segs[indx++] = c+3;
+                buff->segs[indx++] = indx2+j;
+                buff->segs[indx++] = indx2+n*2+j;
+            }
+        }
+
+        //left & right sections, number of segments: 2*(nz-2)
+        //          special case number of segments: 0
+        /*if (!specialCase) {
+            for (i = 1; i < (nz-1); i++) {
+                for (j = 0; j < 2; j++) {
+                    buff->segs[indx++] = c;
+                    buff->segs[indx++] =  2*i    * n + j*(n-1);
+                    buff->segs[indx++] = (2*i+1) * n + j*(n-1);
+                }
+            }
+        }*/
+    }
+
+
+    Int_t m = n - 1 + (specialCase == kTRUE);
+
+//*-* Allocate memory for polygons *-*
+
+    indx = 0;
+
+    buff->polys = new Int_t[buff->numPolys*6];
+
+    if (buff->polys) {
+        //bottom & top, number of polygons: 2*(n-1)
+        // special case number of polygons: 2*n
+        for (i = 0; i < 2; i++) {
+            for (j = 0; j < n-1; j++) {
+                buff->polys[indx++] = c+3;
+                buff->polys[indx++] = 4;
+                buff->polys[indx++] = 2*nz*m+i*n+j;
+                buff->polys[indx++] = i*(nz*2-2)*m+m+j;
+                buff->polys[indx++] = 2*nz*m+i*n+j+1;
+                buff->polys[indx++] = i*(nz*2-2)*m+j;
+            }
+            if (specialCase) {
+                buff->polys[indx++] = c+3;
+                buff->polys[indx++] = 4;
+                buff->polys[indx++] = 2*nz*m+i*n+j;
+                buff->polys[indx++] = i*(nz*2-2)*m+m+j;
+                buff->polys[indx++] = 2*nz*m+i*n;
+                buff->polys[indx++] = i*(nz*2-2)*m+j;
+            }
+        }
+
+
+        //inside & outside, number of polygons: (nz-1)*2*(n-1)
+        for (k = 0; k < (nz-1); k++) {
+            for (i = 0; i < 2; i++) {
+                for (j = 0; j < n-1; j++) {
+                    buff->polys[indx++] = c+i;
+                    buff->polys[indx++] = 4;
+                    buff->polys[indx++] = (2*k+i*1)*m+j;
+                    buff->polys[indx++] = nz*2*m+(2*k+i*1+2)*n+j;
+                    buff->polys[indx++] = (2*k+i*1+2)*m+j;
+                    buff->polys[indx++] = nz*2*m+(2*k+i*1+2)*n+j+1;
+                }
+                if (specialCase) {
+                    buff->polys[indx++] = c+i;
+                    buff->polys[indx++] = 4;
+                    buff->polys[indx++] = (2*k+i*1)*m+j;
+                    buff->polys[indx++] = nz*2*m+(2*k+i*1+2)*n+j;
+                    buff->polys[indx++] = (2*k+i*1+2)*m+j;
+                    buff->polys[indx++] = nz*2*m+(2*k+i*1+2)*n;
+                }
+            }
+        }
+
+        //left & right sections, number of polygons: 2*(nz-1)
+        //          special case number of polygons: 0
+        /*if (!specialCase) {
+            indx2 = nz*2*(n-1);
+            for (k = 0; k < (nz-1); k++) {
+                for (i = 0; i < 2; i++) {
+                    buff->polys[indx++] = c+2;
+                    buff->polys[indx++] = 4;
+                    buff->polys[indx++] = k==0 ? indx2+i*(n-1) : indx2+2*nz*n+2*(k-1)+i;
+                    buff->polys[indx++] = indx2+2*(k+1)*n+i*(n-1);
+                    buff->polys[indx++] = indx2+2*nz*n+2*k+i;
+                    buff->polys[indx++] = indx2+(2*k+3)*n+i*(n-1);
+                }
+            }
+            buff->polys[indx-8] = indx2+n;
+            buff->polys[indx-2] = indx2+2*n-1;
+        }*/
+    }
+
+    //*-* Paint in the pad
+    //*-* Paint in the pad
+    Bool_t rangeView = strcmp(option,"range")==0 ? kTRUE : kFALSE;
+    PaintShape(buff,rangeView);
+    //PaintShape(buff);
+
+    if (strstr(option, "x3d")) {
+        if(buff && buff->points && buff->segs)
+            FillX3DBuffer(buff);
+        else {
+            gSize3D.numPoints -= buff->numPoints;
+            gSize3D.numSegs   -= buff->numSegs;
+            gSize3D.numPolys  -= buff->numPolys;
+        }
+    }
+
+    delete [] points;
+    if (buff->segs)     delete [] buff->segs;
+    if (buff->polys)    delete [] buff->polys;
+    if (buff)           delete    buff;
+
+    
+
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGSphere::SetEllipse(Float_t *factors)
+{
+  if (factors[0] > 0) faX = factors[0];
+  if (factors[1] > 0) faY = factors[1];
+  if (factors[2] > 0) faZ = factors[2];
+  MakeTableOfCoSin();
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGSphere::SetNumberOfDivisions (Int_t p)
+{
+    if (GetNumberOfDivisions () == p)
+        return;
+    fNdiv = p;
+    fNz   = Int_t(fAspectRatio*fNdiv*(fThemax - fThemin )/(fPhimax - fPhimin )) + 1;
+    MakeTableOfCoSin();
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGSphere::SetPoints(Float_t *buff)
+{
+//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Create SPHE points*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+//*-*                            ==================
+    Int_t i, j;
+    Int_t indx = 0;
+
+    if (buff) {
+        Int_t n = GetNumberOfDivisions()+1;
+
+//*-* We've to check whether the table does exist and create it
+//*-* since fCoTab/fSiTab are not saved with any TShape::Streamer function
+        if (!fCoTab)   MakeTableOfCoSin();
+
+        Float_t z;
+        for (i = 0; i < fNz+1; i++)
+        {
+            z = fRmin * fCoThetaTab[i]; // fSinPhiTab[i];
+            Float_t sithet = TMath::Sqrt(TMath::Abs(1-fCoThetaTab[i]*fCoThetaTab[i]));
+            Float_t zi = fRmin*sithet;
+            for (j = 0; j < n; j++)
+            {
+                buff[indx++] = zi * fCoTab[j];
+                buff[indx++] = zi * fSiTab[j];
+                buff[indx++] = z;
+            }
+            z = fRmax * fCoThetaTab[i];
+            zi = fRmax*sithet;
+            for (j = 0; j < n; j++)
+            {
+                buff[indx++] = zi * fCoTab[j];
+                buff[indx++] = zi * fSiTab[j];
+                buff[indx++] = z;
+            }
+        }
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGSphere::MakeTableOfCoSin()
+{
+    const Double_t PI  = TMath::ATan(1) * 4.0;
+    const Double_t ragrad  = PI/180.0;
+
+    Float_t dphi = fPhimax - fPhimin;
+    while (dphi > 360) dphi -= 360;
+
+    Float_t dtet = fThemax - fThemin;
+    while (dtet > 180) dtet -= 180;
+
+    Int_t j;
+    Int_t n = GetNumberOfDivisions () + 1;
+    if (fCoTab)
+        delete [] fCoTab; // Delete the old tab if any
+        fCoTab = new Double_t [n];
+    if (!fCoTab ) return;
+
+    if (fSiTab)
+        delete [] fSiTab; // Delete the old tab if any
+    fSiTab = new Double_t [n];
+    if (!fSiTab ) return;
+
+    Double_t range   = Double_t(dphi * ragrad);
+    Double_t phi1    = Double_t(fPhimin  * ragrad);
+    Double_t angstep = range/(n-1);
+
+    Double_t ph = phi1;
+    for (j = 0; j < n; j++)
+    {
+        ph = phi1 + j*angstep;
+        fCoTab[j] = TMath::Cos(ph);
+        fSiTab[j] = TMath::Sin(ph);
+    }
+
+    n  = fNz + 1;
+
+    if (fCoThetaTab)
+        delete [] fCoThetaTab; // Delete the old tab if any
+    fCoThetaTab = new Double_t [n];
+    if (!fCoThetaTab ) return;
+
+    range   = Double_t(dtet * ragrad);
+    phi1    = Double_t(fThemin  * ragrad);
+    angstep = range/(n-1);
+
+    ph = phi1;
+    for (j = 0; j < n; j++)
+    {
+        fCoThetaTab[n-j-1] = TMath::Cos(ph);
+        ph += angstep;
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGSphere::PaintGLPoints(Float_t *vertex)
+{
+    gGLKernel->PaintCone(vertex,-(GetNumberOfDivisions()+1),fNz+1);
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGSphere::Sizeof3D() const
+{
+//*-*-*-*-*-*-*Return total X3D size of this shape with its attributes*-*-*-*-*-*
+//*-*          =======================================================
+
+    cout << " Entra en AliGSphere::Sizeof3D() " << endl;
+
+    Int_t n;
+
+    n = GetNumberOfDivisions()+1;
+    Int_t nz = fNz+1;
+
+    //cout << " n = " << n << "   y   nz = " << nz << endl;
+
+    Bool_t specialCase = kFALSE;
+
+    if (TMath::Abs(TMath::Sin(2*(fPhimax - fPhimin))) <= 0.01)  //mark this as a very special case, when
+          specialCase = kTRUE;                                  //we have to draw this PCON like a TUBE
+
+    gSize3D.numPoints += 2*n*nz;
+    gSize3D.numSegs   += 4*(nz*n-1+(specialCase == kTRUE));
+    gSize3D.numPolys  += 2*(nz*n-1+(specialCase == kTRUE));
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGSphere::Streamer(TBuffer &R__b)
+{
+   // Stream an object of class AliGSphere.
+
+   if (R__b.IsReading()) {
+      Version_t R__v = R__b.ReadVersion(); if (R__v) { }
+      AliGShape::Streamer(R__b);
+      R__b >> fAspectRatio;
+      R__b.ReadArray(fCoTab); //
+      R__b.ReadArray(fCoThetaTab); //
+      R__b >> fNdiv;
+      R__b >> fNz;
+      R__b.ReadArray(fSiTab); //
+      R__b >> faX;
+      R__b >> faY;
+      R__b >> faZ;
+      R__b >> fPhimax;
+      R__b >> fPhimin;
+      R__b >> fRmax;
+      R__b >> fRmin;
+      R__b >> fThemax;
+      R__b >> fThemin;
+   } else {
+      R__b.WriteVersion(AliGSphere::IsA());
+      AliGShape::Streamer(R__b);
+      R__b << fAspectRatio;
+      R__b.WriteArray(fCoTab, GetNumberOfDivisions()+1); //
+      R__b.WriteArray(fCoThetaTab, fNz+1); //
+      R__b << fNdiv;
+      R__b << fNz;
+      R__b.WriteArray(fSiTab, GetNumberOfDivisions()+1); //
+      R__b << faX;
+      R__b << faY;
+      R__b << faZ;
+      R__b << fPhimax;
+      R__b << fPhimin;
+      R__b << fRmax;
+      R__b << fRmin;
+      R__b << fThemax;
+      R__b << fThemin;
+   }
+}
+
+// ---------------------------------------------------------------------------
+
diff --git a/GEODB/AliGSphere.h b/GEODB/AliGSphere.h
new file mode 100644 (file)
index 0000000..f4695cf
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef ALIGSPHERE_H
+#define ALIGSPHERE_H
+
+#include "AliGShape.h"
+
+class AliGSphere: public AliGShape {
+
+    private:
+        Float_t   fAspectRatio; // Relation between asumth and grid size (by default 1.0)
+        Double_t* fCoTab;       // Table of cos(fPhimin) .... cos(Phi)
+        Double_t* fCoThetaTab;  // Table of sin(gThemin) .... cos(Theta)
+        Int_t     fNdiv;        // number of divisions
+        Int_t     fNz;          // number of sections
+        Double_t* fSiTab;       // Table of sin(fPhimin) .... sin(Phi)
+
+    protected:
+        Float_t faX;      // Coeff along Ox
+        Float_t faY;      // Coeff along Oy
+        Float_t faZ;      // Coeff along Oz
+        Float_t fPhimax;  // maximum phi
+        Float_t fPhimin;  // minimum phi
+        Float_t fRmax;    // maximum radius
+        Float_t fRmin;    // minimum radius
+        Float_t fThemax;  // maximum theta
+        Float_t fThemin;  // minimum theta
+
+        virtual void  MakeTableOfCoSin();  // Create the table of the fSiTab; fCoTab
+        virtual void  PaintGLPoints(Float_t *vertex);
+
+    public:
+        AliGSphere();
+        AliGSphere(Text_t *name, Text_t *title, Float_t rmin, Float_t rmax, Float_t themin, Float_t themax, Float_t phimin, Float_t phimax);
+        AliGSphere(Text_t *name, Text_t *title, Float_t rmax);
+        AliGSphere(AliGSphere *sphere);
+       virtual ~AliGSphere(); // Destructor
+
+        virtual void  Draw(Option_t *option);
+        virtual void  DrawShape(Option_t *option); // *MENU*
+        virtual Int_t GetNumberOfDivisions () const {if (fNdiv) return fNdiv; else return 0; /*kDiv;*/}
+        virtual void  Paint(Option_t *option);
+        virtual void  SetEllipse(Float_t *factors);
+        virtual void  SetNumberOfDivisions (Int_t p);
+        virtual void  SetPoints(Float_t *buff);
+                void  Sizeof3D() const;
+
+   ClassDef(AliGSphere,1) //Simple sphere class
+};
+#endif
diff --git a/GEODB/AliGSuperShape.cxx b/GEODB/AliGSuperShape.cxx
new file mode 100644 (file)
index 0000000..996b7b0
--- /dev/null
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+// 
+// 1998/10/22
+// ---------------------------------------------------------------------------
+//
+// AliGSuperShape Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo
+//
+
+#include "AliGSuperShape.h"
+#include <TString.h>
+
+ClassImp(AliGSuperShape)
+
+//----------------------------------------------------------------------
+
+AliGSuperShape::AliGSuperShape()
+{
+    /* Default Constructor */
+    fExpression = "";
+    fName       = "";
+    fShapes     = NULL;
+    fTitle      = "";
+    fTransf     = NULL;
+}
+
+//----------------------------------------------------------------------
+
+AliGSuperShape::AliGSuperShape( Text_t* name, Text_t* title, AliGShape* shapes, AliGTransform* trans, Text_t* expression ):AliGShape(name,title)
+{
+    /* Constructor */
+    fExpression = expression;
+    fShapes     = new TObjArray();
+    fTransf     = new TObjArray();
+}
+
+//----------------------------------------------------------------------
+
+AliGSuperShape::~AliGSuperShape(){
+    /* Destructor */
+    if(fShapes)     delete fShapes;
+    if(fTransf)     delete fTransf;
+}
+
+//----------------------------------------------------------------------
+
+void AliGSuperShape::Add( AliGShape *shape )
+{
+
+}
+
+//----------------------------------------------------------------------
+
+void AliGSuperShape::Add( AliGTransform *trans )
+{
+
+}
+
+//----------------------------------------------------------------------
+
+void AliGSuperShape::Add( Text_t *expression )
+{
+
+}
+
+//----------------------------------------------------------------------  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GEODB/AliGSuperShape.h b/GEODB/AliGSuperShape.h
new file mode 100644 (file)
index 0000000..90f0504
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef ALIGSUPERSHAPE_H
+#define ALIGSUPERSHAPE_H
+
+
+#include <TObjArray.h>
+#include <TNamed.h>
+#include "AliGShape.h"
+#include "AliGTransform.h"
+
+class AliGSuperShape : public AliGShape {
+    protected:
+        TString    fExpression;
+        TObjArray* fShapes;
+        TObjArray* fTransf;
+
+    public:
+        AliGSuperShape(); /* Default Constructor */
+        AliGSuperShape( Text_t* name, Text_t* title, AliGShape* shapes=NULL, AliGTransform* trans=NULL, Text_t* expression=NULL); /* Constructor */
+        virtual ~AliGSuperShape(); /* Destructor */
+
+        void Add( AliGShape* shape );
+        void Add( AliGTransform* trans );
+        void Add( Text_t* expression );
+
+    ClassDef(AliGSuperShape,1) //SuperShape class
+};
+#endif
+
+
+
+
diff --git a/GEODB/AliGTRD1.cxx b/GEODB/AliGTRD1.cxx
new file mode 100644 (file)
index 0000000..b43cac1
--- /dev/null
@@ -0,0 +1,178 @@
+// -*- C++ -*-
+// 
+// 1998/10/19
+// ---------------------------------------------------------------------------
+//
+// AliGTRD1 Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo & company...
+//
+// ---------------------------------------------------------------------------
+
+#include <TView.h>
+#include <TCanvas.h>
+#include <TVirtualPad.h>
+#include <iostream.h>
+#include <TGLKernelABC.h>
+#include "AliGTRD1.h"
+#include <TROOT.h>
+
+ClassImp(AliGTRD1)
+
+//-------------------------------------------------------------------------
+
+AliGTRD1::AliGTRD1(Text_t *name, Text_t *title, Float_t dx1, Float_t dx2, Float_t dy, Float_t dz) : AliGShape(name, title)
+{
+//*-*-*-*-*-*-*-*-*-*-*-*-*AliGTRD1 shape normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*
+//*-*                      =============================
+
+    fDx2 = dx2;
+    fDx1 = dx1;
+    fDy  = dy;
+    fDz  = dz;
+}
+
+//-------------------------------------------------------------------------   
+
+AliGTRD1::AliGTRD1()
+{
+    /* Default Constructor */
+
+    fDx2   = 0;        
+    fName  = "";
+    fTitle = "";
+}
+
+//-------------------------------------------------------------------------
+
+AliGTRD1::AliGTRD1( AliGTRD1* trd1 )
+{
+    /* Copy Constructor */
+    fColor     = trd1->fColor;
+    fDx1       = trd1->fDx1;
+    fDx2       = trd1->fDx2;
+    fDy        = trd1->fDy; 
+    fDz        = trd1->fDz;
+    fName      = trd1->fName;
+    fTitle     = trd1->fTitle;
+}
+
+//----------------------------------------------------------------------------
+
+void AliGTRD1::SetPoints(Float_t *buff)
+{
+//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Create AliGTRD1 points*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+//*-*                            ==================
+
+    Float_t dx1, dx2, dy, dz;
+
+    dx1 = fDx1;
+    dx2 = fDx2;
+    dy  = fDy;
+    dz  = fDz;
+    
+    if (buff) {
+        buff[ 0] = -dx1;  buff[ 1] = -dy;  buff[ 2] = -dz;
+        buff[ 3] =  dx1;  buff[ 4] = -dy;  buff[ 5] = -dz;
+        buff[ 6] =  dx1;  buff[ 7] =  dy;  buff[ 8] = -dz;
+        buff[ 9] = -dx1;  buff[10] =  dy;  buff[11] = -dz;
+        buff[12] = -dx2;  buff[13] = -dy;  buff[14] =  dz;
+        buff[15] =  dx2;  buff[16] = -dy;  buff[17] =  dz;
+        buff[18] =  dx2;  buff[19] =  dy;  buff[20] =  dz;
+        buff[21] = -dx2;  buff[22] =  dy;  buff[23] =  dz;
+    }
+}
+
+//-------------------------------------------------------------------------
+
+void AliGTRD1::Paint(Option_t *option)
+{
+    SetLineColor( GetCol() );
+
+    const Int_t numpoints = 8;
+
+    //*-* Allocate memory for points *-*
+
+    Float_t *points = new Float_t[3*numpoints];
+    if (!points) return;
+
+    SetPoints(points);
+
+    if (gPad->GetView3D()) PaintGLPoints(points);
+
+    //==  for (Int_t i = 0; i < numpoints; i++)
+    //            gNode->Local2Master(&points[3*i],&points[3*i]);
+
+    Int_t c = ((GetLineColor() % 8) - 1) * 4;     // Basic colors: 0, 1, ... 7
+    if (c < 0) c = 0;
+
+    //*-* Allocate memory for segments *-*
+
+    X3DBuffer *buff = new X3DBuffer;
+    if (buff) {
+        buff->numPoints = 8;
+        buff->numSegs   = 12;
+        buff->numPolys  = 6;
+    }
+
+//*-* Allocate memory for points *-*
+
+    buff->points = points;
+    buff->segs = new Int_t[buff->numSegs*3];
+
+    if (buff->segs) {
+        buff->segs[ 0] = c;    buff->segs[ 1] = 0;    buff->segs[ 2] = 1;
+        buff->segs[ 3] = c+1;  buff->segs[ 4] = 1;    buff->segs[ 5] = 2;
+        buff->segs[ 6] = c+1;  buff->segs[ 7] = 2;    buff->segs[ 8] = 3;
+        buff->segs[ 9] = c;    buff->segs[10] = 3;    buff->segs[11] = 0;
+        buff->segs[12] = c+2;  buff->segs[13] = 4;    buff->segs[14] = 5;
+        buff->segs[15] = c+2;  buff->segs[16] = 5;    buff->segs[17] = 6;
+        buff->segs[18] = c+3;  buff->segs[19] = 6;    buff->segs[20] = 7;
+        buff->segs[21] = c+3;  buff->segs[22] = 7;    buff->segs[23] = 4;
+        buff->segs[24] = c;    buff->segs[25] = 0;    buff->segs[26] = 4;
+        buff->segs[27] = c+2;  buff->segs[28] = 1;    buff->segs[29] = 5;
+        buff->segs[30] = c+1;  buff->segs[31] = 2;    buff->segs[32] = 6;
+        buff->segs[33] = c+3;  buff->segs[34] = 3;    buff->segs[35] = 7;
+    }
+
+//*-* Allocate memory for polygons *-*
+
+    buff->polys = new Int_t[buff->numPolys*6];
+
+    if (buff->polys) {
+        buff->polys[ 0] = c;   buff->polys[ 1] = 4;  buff->polys[ 2] = 0;
+        buff->polys[ 3] = 9;   buff->polys[ 4] = 4;  buff->polys[ 5] = 8;
+        buff->polys[ 6] = c+1; buff->polys[ 7] = 4;  buff->polys[ 8] = 1;
+        buff->polys[ 9] = 10;  buff->polys[10] = 5;  buff->polys[11] = 9;
+        buff->polys[12] = c;   buff->polys[13] = 4;  buff->polys[14] = 2;
+        buff->polys[15] = 11;  buff->polys[16] = 6;  buff->polys[17] = 10;
+        buff->polys[18] = c+1; buff->polys[19] = 4;  buff->polys[20] = 3;
+        buff->polys[21] = 8;   buff->polys[22] = 7;  buff->polys[23] = 11;
+        buff->polys[24] = c+2; buff->polys[25] = 4;  buff->polys[26] = 0;
+        buff->polys[27] = 3;   buff->polys[28] = 2;  buff->polys[29] = 1;
+        buff->polys[30] = c+3; buff->polys[31] = 4;  buff->polys[32] = 4;
+        buff->polys[33] = 5;   buff->polys[34] = 6;  buff->polys[35] = 7;
+    }
+
+    //*-* Paint in the pad
+    Bool_t rangeView = strcmp(option,"range")==0 ? kTRUE : kFALSE;
+    PaintShape(buff,rangeView);
+
+    if (strstr(option, "x3d")) {
+        if(buff && buff->points && buff->segs)
+            FillX3DBuffer(buff);
+        else {
+            gSize3D.numPoints -= buff->numPoints;
+            gSize3D.numSegs   -= buff->numSegs;
+            gSize3D.numPolys  -= buff->numPolys;
+        }
+    }
+
+    delete [] points;
+    if (buff->segs)     delete [] buff->segs;
+    if (buff->polys)    delete [] buff->polys;
+    if (buff)           delete    buff;
+}
+
diff --git a/GEODB/AliGTRD1.h b/GEODB/AliGTRD1.h
new file mode 100644 (file)
index 0000000..35eb5dc
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef AliGTRD1_H
+#define AliGTRD1_H
+
+/* -*- C++ -*-
+// 
+// 1998/10/19
+// ---------------------------------------------------------------------------
+//
+// AliGTRD1 Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo
+//
+// ---------------------------------------------------------------------------
+//AliGTRD1 is a subclass of AliGShape. Its dimensions are:
+//      - Dx    half-length of the bosx along X-axis
+//      - Dy    hlf-length of the box along Y-axis
+//      - Dz    half-length of the box along Z-axis */
+
+
+#include "AliGShape.h"
+
+class AliGTRD1: public AliGShape {
+    
+    protected:
+        Float_t fDx2;  //half length in x at the high z surface
+        Float_t fDx1;
+        Float_t fDy;
+        Float_t fDz;
+
+    public:
+        AliGTRD1( Text_t* name,Text_t* title, Float_t dx1,Float_t dx2, Float_t dy, Float_t  dz ); /* Constructor */
+        AliGTRD1( ); /* Default Constructor */
+       AliGTRD1( AliGTRD1* trd1 );
+        virtual ~AliGTRD1() {} /* Destructor */
+               
+               Float_t GetDx1() {return fDx1;}
+                Float_t GetDx2() {return fDx2;}
+               Float_t GetDy() {return fDy;}
+               Float_t GetDz() {return fDz;}
+                void    Paint(Option_t *option);
+               void    SetDx1(Float_t dx1) {fDx1 = dx1;}
+               void    SetDx2(Float_t dx2) {fDx2 = dx2;}
+               void    SetDy(Float_t dy) {fDy = dy;}
+               void    SetDz(Float_t dz) {fDz = dz;}
+                void    SetPoints( Float_t* buff );
+
+    ClassDef(AliGTRD1,1) // Simple trapezoid class
+};
+
+#endif
+
diff --git a/GEODB/AliGTransform.cxx b/GEODB/AliGTransform.cxx
new file mode 100644 (file)
index 0000000..5dcd1a8
--- /dev/null
@@ -0,0 +1,339 @@
+/**********************************************/
+/*                                            */
+/* FILE: AliGTransform.cxx                    */
+/* PURPOSE: To define the relative positions  */
+/*          of AliGNodes.                     */
+/* LANGUAGE: C++                              */
+/* COMPILER: CC for HP-UX 9.x and 10.         */
+/* AUTHOR: Joana && David                     */
+/* DATE: May 28, 1999                         */
+/* ADDRESS: jesanto@cern.ch, dcollado@cern.ch */
+/*                                            */
+/**********************************************/
+
+
+#include <TMath.h>
+#include <TVector.h>
+#include <iostream.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include "AliGTransform.h"
+
+ClassImp(AliGTransform)
+
+//----------------------------------------------------------------------
+
+AliGTransform::AliGTransform()
+{
+    /* Default Constructor */
+    fExpression = "";
+    fMatrix     = NULL;
+    fName       = "";
+    fTitle      = "";
+    fX          = 0.;
+    fY          = 0.;
+    fZ          = 0.;
+    fTheta     = 0.;
+    fPsi       = 0.;
+    fPhi       = 0.;
+    
+}
+
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+
+AliGTransform::AliGTransform(AliGTransform *tra)
+{
+    /* Copy Constructor */
+    
+    fMatrix     = tra->fMatrix;
+    fName       = tra->fName;
+    fTitle      = tra->fTitle;
+    
+    
+ }   
+   
+//----------------------------------------------------------------------}
+
+AliGTransform::AliGTransform(Text_t* name, Text_t* title) : TNamed(name,title)
+{
+    /* Constructor */
+    fExpression = "";
+    //float matrix[16] = {1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.}
+    fMatrix = new TVector(0,15,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1., "END");
+    fX          = 0.;
+    fY          = 0.;
+    fZ          = 0.;
+    fTheta     = 0.;
+    fPsi       = 0.;
+    fPhi       = 0.;
+}
+
+//----------------------------------------------------------------------
+
+AliGTransform::AliGTransform(Text_t* name, Text_t* title, Text_t *expression): TNamed(name, title)
+{
+    /* Constructor */
+    fExpression = expression;
+    
+    //float matrix[16] = {1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.};
+    //fMatrix     = new TArrayF(16,matrix);
+    fMatrix = new TVector(0,15,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.,
+    "END");
+    CheckExpression();
+    BuildMatrix(fX,fY,fZ,fTheta,fPsi,fPhi);
+    
+}
+
+//----------------------------------------------------------------------
+
+AliGTransform::AliGTransform(Text_t* name,Text_t* title, Text_t *axis, Float_t angle) : TNamed(name, title)
+{
+    /* Constructor */
+    fX=fY=fZ=0.;
+   
+    
+        if (!strcmp(axis,"X")) {  
+                   
+            fTheta     = 90;
+            fPsi       = angle;
+            fPhi       = -90;
+           }
+       if (!strcmp(axis,"Y")) {   
+                   
+            fTheta     = 0.;
+            fPsi       = angle;
+            fPhi       = 0.;
+            }
+       if (!strcmp(axis,"Z")) {  
+                   
+            fTheta     = 0.;
+            fPsi       = 0.;
+            fPhi       = angle;
+            }
+
+ //cout << "fTheta" << fTheta << endl;
+ //cout << "fPsi" << fPsi << endl;
+ //cout << "fPhi" << fPhi << endl;
+
+       
+       BuildMatrix(fX,fY,fZ,fTheta,fPsi,fPhi);
+            
+        
+} 
+  
+//----------------------------------------------------------------------
+  
+AliGTransform::AliGTransform( Text_t* name, Text_t* title, Float_t theta1,Float_t phi1, 
+                                                   Float_t theta2,
+                                                   Float_t phi2, 
+                                                   Float_t theta3,Float_t phi3
+                                                   ) : TNamed(name,title)
+{
+   const Double_t degrad = 0.0174532925199432958;
+   float a1=0.,a2=0.,a3=0.,b1=0.,b2=0.,b3=0.,c1=0.,c2=0.,c3=0.;
+   fX  = 0;
+   fY  = 0;
+   fZ  = 0;
+
+   a1 = TMath::Sin(theta1*degrad)*TMath::Cos(phi1*degrad);
+   a2 = TMath::Sin(theta1*degrad)*TMath::Sin(phi1*degrad);
+   a3 = TMath::Cos(theta1*degrad);
+   b1 = TMath::Sin(theta2*degrad)*TMath::Cos(phi2*degrad);
+   b2 = TMath::Sin(theta2*degrad)*TMath::Sin(phi2*degrad);
+   b3 = TMath::Cos(theta2*degrad);
+   c1 = TMath::Sin(theta3*degrad)*TMath::Cos(phi3*degrad);
+   c2 = TMath::Sin(theta3*degrad)*TMath::Sin(phi3*degrad);
+   c3 = TMath::Cos(theta3*degrad);
+   
+   // fMatrix = new TVector(0,15,a1,a2,a3,0.,b1,b2,b3,0.,c1,c2,c3,0.,0.,0.,0.,1., "END");
+   fMatrix = new TVector(0,15,a1,b1,c1,0.,a2,b2,c2,0.,a3,b3,c3,0.,0.,0.,0.,1., "END");
+}                                                     
+//----------------------------------------------------------------------
+AliGTransform::AliGTransform( Text_t* name, Text_t* title, Float_t a1,Float_t a2,Float_t a3,Float_t b1,Float_t b2,
+       Float_t b3,Float_t c1,Float_t c2,Float_t c3,Float_t Dx,Float_t
+       Dy,Float_t Dz) : TNamed(name,title)
+{
+
+
+fMatrix = new TVector(0,15,a1,a2,a3,Dx,b1,b2,b3,Dy,c1,c2,c3,Dz,0.,0.,0.,1., "END");
+
+}
+
+//----------------------------------------------------------------------
+
+AliGTransform::~AliGTransform() {
+    /* Destructor */
+    if(fMatrix)     delete fMatrix;
+}
+
+//----------------------------------------------------------------------
+
+void AliGTransform::CheckExpression() 
+/*Extracts the transformation arguments from the expression given in the
+constructor*/
+
+{
+    TString* string = new TString(fExpression);
+    string->ToUpper();
+    float Dx, Dy, Dz,theta, psi,phi;
+  
+    
+    if (strstr(*string, "+")) {
+         sscanf( *string, "TRA %f %f %f + ROT %f %f %f ", &Dx, &Dy, &Dz, &theta, &psi, &phi );
+        
+        if( sscanf(*string, "TRA %f %f %f", &Dx, &Dy, &Dz ) == EOF ) 
+            printf( "Error! Must introduce 3 distances\n" );
+
+        if( sscanf(*string, "ROT %f %f %f", &theta, &psi, &phi ) == EOF ) 
+            printf( "Error! Must introduce 3 angles\n" );
+        fX     = Dx;
+        fY     = Dy;
+        fZ     = Dz;
+        fTheta = theta;
+        fPsi   = psi;
+        fPhi   = phi;
+        
+    } else {
+  
+        if( strstr(*string,"TRA") ) {
+            sscanf( *string, "TRA %f %f %f", &Dx, &Dy, &Dz );
+            
+            if( sscanf(*string, "TRA %f %f %f", &Dx, &Dy, &Dz ) == EOF ) 
+                printf( "Error! Must introduce 3 distances\n" );
+               
+           fX          = Dx;
+           fY          = Dy;
+           fZ          = Dz;
+               
+       } else {
+               
+            if( strstr(*string,"ROT") ) {
+            sscanf( *string, "ROT %f %f %f", &theta, &psi, &phi );
+
+            if( sscanf(*string, "ROT %f %f %f", &theta, &psi, &phi ) == EOF ) 
+                printf( "Error! Must introduce 3 angles\n" );
+               
+             fTheta    = theta;
+            fPsi       = psi;
+            fPhi       = phi;
+               
+             }
+       }
+     }
+}
+
+//----------------------------------------------------------------------
+
+void AliGTransform::BuildMatrix(Float_t Dx=0., Float_t Dy=0., Float_t Dz=0., Float_t
+theta=0., Float_t psi=0.,Float_t phi=0.  ) 
+{
+/* Builds the 4X4 matrix of a transformation */
+
+   
+    float a1=0.,a2=0.,a3=0.,b1=0.,b2=0.,b3=0.,c1=0.,c2=0.,c3=0.;
+    
+       const Double_t degrad = 0.0174532925199432958;
+       
+        a1 =
+       TMath::Cos(phi*degrad)*TMath::Cos(psi*degrad)*TMath::Cos(theta*degrad) -
+       TMath::Sin(phi*degrad)*TMath::Sin(theta*degrad);
+        a2 =
+       TMath::Cos(phi*degrad)*TMath::Cos(psi*degrad)*TMath::Sin(theta*degrad) +
+       TMath::Sin(phi*degrad)*TMath::Cos(theta*degrad);
+        a3 = - TMath::Cos(phi*degrad)*TMath::Sin(psi*degrad);
+        b1 = - TMath::Sin(phi*degrad)*TMath::Cos(psi*degrad)*TMath::Cos(theta*degrad) -
+       TMath::Cos(phi*degrad)*TMath::Sin(theta*degrad);
+        b2 = - TMath::Sin(phi*degrad)*TMath::Cos(psi*degrad)*TMath::Sin(theta*degrad) +
+       TMath::Cos(phi*degrad)*TMath::Cos(theta*degrad);
+        b3 = TMath::Sin(phi*degrad)*TMath::Sin(psi*degrad);
+        c1 = TMath::Sin(psi*degrad)*TMath::Cos(theta*degrad);
+        c2 = TMath::Sin(psi*degrad)*TMath::Sin(theta*degrad);
+        c3 = TMath::Cos(psi*degrad);
+        
+       /*
+       a1 =
+       TMath::Cos(psi*degrad)*TMath::Cos(phi*degrad);
+        a2 =
+       TMath::Cos(psi*degrad)*TMath::Sin(phi*degrad); 
+        a3 = - TMath::Sin(psi*degrad);
+        b1 = TMath::Sin(theta*degrad)*TMath::Sin(psi*degrad)*TMath::Cos(phi*degrad) -
+       TMath::Cos(theta*degrad)*TMath::Sin(phi*degrad);
+        b2 = TMath::Sin(theta*degrad)*TMath::Sin(psi*degrad)*TMath::Sin(phi*degrad) +
+       TMath::Cos(theta*degrad)*TMath::Cos(phi*degrad);
+        b3 = TMath::Sin(theta*degrad)*TMath::Cos(psi*degrad);
+        c1 =
+       TMath::Cos(theta*degrad)*TMath::Sin(psi*degrad)*TMath::Cos(phi*degrad) +
+       TMath::Sin(theta*degrad)*TMath::Sin(phi*degrad);
+        c2 =
+       TMath::Cos(theta*degrad)*TMath::Sin(psi*degrad)*TMath::Sin(phi*degrad) -
+       TMath::Sin(theta*degrad)*TMath::Cos(phi*degrad);
+        c3 = TMath::Cos(theta*degrad)*TMath::Sin(psi*degrad);
+       */
+       fMatrix = new TVector(0,15,a1,a2,a3,Dx,b1,b2,b3,Dy,c1,c2,c3,Dz,0.,0.,0.,1., "END");
+       
+}
+
+//----------------------------------------------------------------------
+
+/*
+
+void AliGTransform::CheckExpression( Text_t* expression ) 
+{
+    char axis;
+    float theta, phi, psi,Dx, Dy, Dz;
+
+    TString* string = new TString( expression );
+    string->ToUpper();
+
+    if( strstr(*string,"ROT") ) {
+        sscanf( *string, "ROT%c", &axis );
+
+        switch (axis) {
+            case 'A':
+               sscanf( *string, "ROTA%f %f %f", &phi, &psi, &theta );
+               if( (!psi) || (!theta) || (!phi) )
+                    printf("Error! Must introduce 3 angles\n");
+               break;
+
+            case 'X':
+                sscanf( *string, "ROTX%f", &theta );
+                if( !theta ) 
+                    printf("Error! Must introduce 1 angle\n");
+                break;
+
+            case 'Y':
+                sscanf( *string, "ROTY%f", &theta);
+                if( !theta ) 
+                    printf("Error! Must introduce 1 angle\n");
+                break;
+
+            case 'Z':
+                sscanf( *string, "ROTZ%f", &theta );
+                if( !theta )
+                    printf("Error! Must introduce 1 angle\n");
+                break;
+
+            default:
+               printf("Unrecognised rotation around axis %c\n",axis);
+        } 
+    }
+    else {
+        if( strstr(*string, "TRA") ) {
+            sscanf( *string, "TRA %f %f %f", &Dx, &Dy, &Dz );
+            if( sscanf(*string, "TRA %f %f %f", &Dx, &Dy, &Dz) == EOF )
+                printf("Error! Must introduce 3 distances\n");
+            printf( "%f%f%f\n", Dx, Dy, Dz );
+        }
+        else 
+            printf( "ERROR!\n" );
+    }
+
+    delete string;
+}
+
+*/
diff --git a/GEODB/AliGTransform.h b/GEODB/AliGTransform.h
new file mode 100644 (file)
index 0000000..1373fff
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef ALIGTRANSFORM_H
+#define ALIGTRANSFORM_H
+
+/* -*- C++ -*-                                                                  */
+/*                                                                              */
+/* 1999/01/13                                                                   */
+/* ---------------------------------------------------------------------------  */
+/*                                                                              */
+/* AliGTransform Class                                                          */
+/*                                                                              */
+/* This file is part of the ALICE Geometry Database .                           */
+/*                                                                              */
+/* Author:  Joana E. Santo                                                      */
+/*                                                                              */
+/* ---------------------------------------------------------------------------  */
+/* This class represents the transformations applied to regions to position them*/
+/* in the node structure.                                                       */
+
+
+#include <TNamed.h>
+#include <TVector.h>
+#include <TSystem.h>
+#include <TString.h>
+
+class AliGTransform: public TNamed {
+
+    private:
+        TString  fExpression;
+        TVector* fMatrix;
+        Float_t  fX;
+        Float_t  fY;
+        Float_t  fZ;
+       Float_t  fTheta;
+        Float_t  fPsi;
+        Float_t  fPhi;
+
+    public:
+        AliGTransform(); /* Default Constructor */
+       AliGTransform(AliGTransform *tra);
+        AliGTransform( Text_t* name, Text_t* title );
+        AliGTransform( Text_t* name, Text_t* title, Text_t *expression );
+        AliGTransform( Text_t* name, Text_t* title, Text_t *axis, Float_t angle);
+       AliGTransform( Text_t* name, Text_t* title, Float_t theta1,Float_t phi1, 
+                                                   Float_t theta2,
+                                                   Float_t phi2, 
+                                                   Float_t theta3,Float_t
+phi3);
+                                                  
+       AliGTransform( Text_t* name, Text_t* title, Float_t a1,Float_t a2,Float_t a3,Float_t b1,Float_t b2,
+       Float_t b3,Float_t c1,Float_t c2,Float_t c3,Float_t Dx,Float_t Dy,Float_t Dz);
+        virtual ~AliGTransform(); /* Destructor */
+
+        void     BuildMatrix(Float_t Dx=0., Float_t Dy=0., Float_t Dz=0., Float_t
+theta=0., Float_t psi=0.,Float_t phi=0. );
+        void     CheckExpression();
+        TVector* GetMatrix() {return fMatrix;}
+
+    ClassDef(AliGTransform,1) //Transformation class (Rotation and Translation)
+};
+#endif
diff --git a/GEODB/AliGTube.cxx b/GEODB/AliGTube.cxx
new file mode 100644 (file)
index 0000000..f84014d
--- /dev/null
@@ -0,0 +1,416 @@
+// -*- C++ -*-
+// 
+// 1998/10/19
+// ---------------------------------------------------------------------------
+//
+// AliTube Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// By:  Joana E. Santo & David Collados
+//
+// ---------------------------------------------------------------------------
+
+#include <TVirtualPad.h>
+#include <TView.h>
+#include <TCanvas.h>
+#include <iostream.h>
+#include <TGLKernelABC.h>
+#include "TROOT.h"
+#include "AliGTube.h"
+#include "AliGShape.h"
+
+ClassImp(AliGTube)
+
+AliGTube::AliGTube()
+{
+    /* Default Constructor */
+    fCoTab = NULL;    // Table of cos(fPhi1) .... cos(fPhil+fDphi1)
+    fAspectRatio = 1; // defines  (the ellipse semi-axis in Y)/(the ellipse semi-axis in X)
+    fDz    = 0.;      // half length in z
+    fName  = "";
+    fNdiv  = 0;       // number of segments (precision)
+    fRmax  = 0.;      // ellipse  semi-axis   in  X outside
+    fRmin  = 0.;      // ellipse  semi-axis   in  X inside
+    fSiTab = NULL;    // Table of sin(fPhi1) .... sin(fPhil+fDphi1)
+    fTitle = "";
+}
+
+//-------------------------------------------------------------------------
+
+AliGTube::AliGTube( Text_t *name, Text_t *title, Float_t rmin, Float_t rmax, Float_t dz, Float_t aspect ) : AliGShape(name, title)
+{
+    /* Constructor */
+    fCoTab       = NULL; // Table of cos(fPhi1) .... cos(fPhil+fDphi1)
+    fAspectRatio = aspect; // defines  (the ellipse semi-axis in Y)/(the ellipse semi-axis in X)
+    fDz          = dz;   // half length in z
+    fNdiv        = 0;    // number of segments (precision)
+    fRmax        = rmax; // ellipse  semi-axis   in  X outside
+    fRmin        = rmin; // ellipse  semi-axis   in  X inside
+    fSiTab       = NULL; // Table of sin(fPhi1) .... sin(fPhil+fDphi1)
+
+    MakeTableOfCoSin();
+}
+
+
+//-------------------------------------------------------------------------
+
+AliGTube::AliGTube( AliGTube *tube ) 
+{
+    /* Copy Constructor */
+    fCoTab       = NULL; // Table of cos(fPhi1) .... cos(fPhil+fDphi1)
+    fAspectRatio = tube->fAspectRatio; // defines  (the ellipse semi-axis in Y)/(the ellipse semi-axis in X)
+    fDz          = tube->fDz;   // half length in z
+    fColor       = tube->fColor;
+    fName        = tube->fName;
+    fNdiv        = 0;    // number of segments (precision)
+    fRmax        = tube->fRmax; // ellipse  semi-axis   in  X outside
+    fRmin        = tube->fRmin; // ellipse  semi-axis   in  X inside
+    fSiTab       = NULL; // Table of sin(fPhi1) .... sin(fPhil+fDphi1)
+    fTitle       = tube->fTitle;
+
+    MakeTableOfCoSin();
+}
+
+//-------------------------------------------------------------------------
+
+AliGTube::AliGTube(Text_t *name, Text_t *title, Float_t rmax, Float_t dz) : AliGShape(name, title)
+{
+    /* Tube simplified constructor */
+    fCoTab       = NULL; // Table of cos(fPhi1) .... cos(fPhil+fDphi1)
+    fAspectRatio = 1;    // defines  (the ellipse semi-axis in Y)/(the ellipse semi-axis in X)
+    fDz          = dz;   // half length in z
+    fNdiv        = 0;    // number of segments (precision)
+    fRmax        = rmax; // ellipse  semi-axis   in  X outside
+    fRmin        = 0.;   // ellipse  semi-axis   in  X inside
+    fSiTab       = NULL; // Table of sin(fPhi1) .... sin(fPhil+fDphi1)
+
+    MakeTableOfCoSin();
+}
+
+//-------------------------------------------------------------------------
+
+AliGTube::~AliGTube()
+{
+    /* Destructor */
+    delete [] fCoTab;
+    delete [] fSiTab;
+}
+
+//-------------------------------------------------------------------------
+
+void AliGTube::MakeTableOfCoSin()
+{
+    const Double_t PI    = TMath::ATan(1) * 4.0;
+    const Double_t TWOPI = 2*PI;
+
+    Int_t j;
+    Int_t n = GetNumberOfDivisions ();
+
+    if (fCoTab)
+        delete [] fCoTab; // Delete the old tab if any
+    fCoTab = new Double_t [n];
+
+    if (!fCoTab ) {
+        Error("MakeTableOfCoSin()","No cos table done");
+        return;
+    }
+
+    if (fSiTab)
+        delete [] fSiTab; // Delete the old tab if any
+    fSiTab = new Double_t [n];
+
+    if (!fSiTab )
+    {
+        Error("MakeTableOfCoSin()","No sin table done");
+        return;
+    }
+
+    Double_t range   = TWOPI;
+    Double_t angstep = range/n;
+
+    Double_t ph = 0;
+    for (j = 0; j < n; j++)
+    {
+        ph = j*angstep;
+        fCoTab[j] = TMath::Cos(ph);
+        fSiTab[j] = TMath::Sin(ph);
+    }
+
+}
+
+//-------------------------------------------------------------------------
+
+void AliGTube::DrawShape(Option_t *option)
+{
+    Draw(option);
+    gPad->Update();
+}
+
+//-------------------------------------------------------------------------
+
+void AliGTube::Draw(Option_t *option)
+{
+    //cout << " Entra en " << this->GetName() << "::Draw " << endl;
+    TString opt = option;
+    opt.ToLower();
+
+    if( !gPad ) {
+        gPad = new TCanvas("AliGTube","AliGTube",0,0,400,300);
+        gPad->Range(0,0,1,1);
+        gPad->SetFillColor(32); // Light Green
+        gPad->SetBorderSize(3);
+        gPad->SetBorderMode(0); // -1 (down) 0 (no) 1 (up)
+    }
+    else {
+        if( !opt.Contains("same") ) {
+            gPad->Clear();
+            gPad->SetName("AliGTube");
+            gPad->SetTitle("AliGTube");
+        }
+        else {
+            gPad->SetName("AliShapes");
+            gPad->SetTitle("AliShapes"); 
+        }
+    }
+
+    AppendPad(option);
+    TView *view = gPad->GetView();
+
+    if (!view)
+        view = new TView(1);
+
+    view->SetAutoRange(kTRUE);
+    Paint(option);
+    view->SetAutoRange(kFALSE);
+
+    cout << " Sale de " << this->GetName() << "::Draw " << endl;
+}
+
+//-------------------------------------------------------------------------
+
+void AliGTube::Paint(Option_t *option)
+{
+//*-*-*-*-*-*-*-*Paint this 3-D shape with its current attributes*-*-*-*-*-*-*-*
+//*-*            ================================================
+
+    SetLineColor( GetCol() );
+        
+    Int_t i, j;
+    Int_t n = GetNumberOfDivisions();
+    const Int_t numpoints = 4*n;
+
+//*-* Allocate memory for points *-*
+
+    Float_t *points = new Float_t[3*numpoints];
+    if (!points) return;
+  
+    SetPoints(points);
+
+    if (gPad->GetView3D()) PaintGLPoints(points);
+
+//==   for (i = 0; i < numpoints; i++)
+//==            gNode->Local2Master(&points[3*i],&points[3*i]);
+
+    X3DBuffer *buff = new X3DBuffer;
+    if (buff) {
+        buff->numPoints = numpoints;
+        buff->numSegs   = n*8;
+        buff->numPolys  = n*4;
+    }
+
+
+//*-* Allocate memory for points *-*
+
+    buff->points = points;
+
+    Int_t c = ((GetLineColor() % 8) - 1) * 4;     // Basic colors: 0, 1, ... 7
+    if (c < 0) c = 0;
+
+//*-* Allocate memory for segments *-*
+
+    buff->segs = new Int_t[buff->numSegs*3];
+    if (buff->segs) {
+        for (i = 0; i < 4; i++) {
+            for (j = 0; j < n; j++) {
+                buff->segs[(i*n+j)*3  ] = c;
+                buff->segs[(i*n+j)*3+1] = i*n+j;
+                buff->segs[(i*n+j)*3+2] = i*n+j+1;
+            }
+            buff->segs[(i*n+j-1)*3+2] = i*n;
+        }
+        for (i = 4; i < 6; i++) {
+            for (j = 0; j < n; j++) {
+                buff->segs[(i*n+j)*3  ] = c+1;
+                buff->segs[(i*n+j)*3+1] = (i-4)*n+j;
+                buff->segs[(i*n+j)*3+2] = (i-2)*n+j;
+            }
+        }
+        for (i = 6; i < 8; i++) {
+            for (j = 0; j < n; j++) {
+                buff->segs[(i*n+j)*3  ] = c;
+                buff->segs[(i*n+j)*3+1] = 2*(i-6)*n+j;
+                buff->segs[(i*n+j)*3+2] = (2*(i-6)+1)*n+j;
+            }
+        }
+    }
+
+//*-* Allocate memory for polygons *-*
+
+    Int_t indx = 0;
+
+    buff->polys = new Int_t[buff->numPolys*6];
+    if (buff->polys) {
+        for (i = 0; i < 2; i++) {
+            for (j = 0; j < n; j++) {
+                indx = 6*(i*n+j);
+                buff->polys[indx  ] = c;
+                buff->polys[indx+1] = 4;
+                buff->polys[indx+2] = i*n+j;
+                buff->polys[indx+3] = (4+i)*n+j;
+                buff->polys[indx+4] = (2+i)*n+j;
+                buff->polys[indx+5] = (4+i)*n+j+1;
+            }
+            buff->polys[indx+5] = (4+i)*n;
+        }
+        for (i = 2; i < 4; i++) {
+            for (j = 0; j < n; j++) {
+                indx = 6*(i*n+j);
+                buff->polys[indx  ] = c+(i-2)*2+1;
+                buff->polys[indx+1] = 4;
+                buff->polys[indx+2] = (i-2)*2*n+j;
+                buff->polys[indx+3] = (4+i)*n+j;
+                buff->polys[indx+4] = ((i-2)*2+1)*n+j;
+                buff->polys[indx+5] = (4+i)*n+j+1;
+            }
+            buff->polys[indx+5] = (4+i)*n;
+        }
+    }
+
+    //*-* Paint in the pad
+    //*-* Paint in the pad
+    Bool_t rangeView = strcmp(option,"range")==0 ? kTRUE : kFALSE;
+   
+    PaintShape(buff,rangeView);
+    //PaintShape(buff);
+
+    if (strstr(option, "x3d")) {
+        if(buff && buff->points && buff->segs)
+            FillX3DBuffer(buff);
+        else {
+            gSize3D.numPoints -= buff->numPoints;
+            gSize3D.numSegs   -= buff->numSegs;
+            gSize3D.numPolys  -= buff->numPolys;
+        }
+    }
+    
+   if( points ) delete [] points;
+  
+    //if (buff->points)   delete [] buff->points;
+    
+    if (buff->segs)     delete [] buff->segs;
+    
+    if (buff->polys)    delete [] buff->polys;
+    
+    if (buff)           delete    buff;
+      
+}
+
+//-------------------------------------------------------------------------
+
+void AliGTube::PaintGLPoints(Float_t *vertex)
+{
+//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Paint BRIK via OpenGL *-*-*-*-*-*-*-*-*-*-*-*-*
+//*-*                            =====================
+    gGLKernel->PaintCone(vertex,GetNumberOfDivisions(),2);
+}
+
+//-------------------------------------------------------------------------
+
+void AliGTube::SetPoints(Float_t *buff)
+{
+//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Create TUBE points*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+//*-*                          ==================
+
+    Float_t dz;
+    Int_t j, n;
+
+    n = GetNumberOfDivisions();
+
+    dz = fDz;
+
+    Int_t indx = 0;
+
+    if (buff) {
+//*-* We've to checxk whether the table does exist and create it
+//*-* since fCoTab/fSiTab are not saved with any TShape::Streamer function
+        if (!fCoTab)   MakeTableOfCoSin();
+
+        for (j = 0; j < n; j++) {
+            buff[indx+6*n] = buff[indx] = fRmin * fCoTab[j];
+            indx++;
+            buff[indx+6*n] = buff[indx] = fAspectRatio*fRmin * fSiTab[j];
+            indx++;
+            buff[indx+6*n] = dz;
+            buff[indx]     =-dz;
+            indx++;
+        }
+        for (j = 0; j < n; j++) {
+            buff[indx+6*n] = buff[indx] = fRmax * fCoTab[j];
+            indx++;
+            buff[indx+6*n] = buff[indx] = fAspectRatio*fRmax * fSiTab[j];
+            indx++;
+            buff[indx+6*n]= dz;
+            buff[indx]    =-dz;
+            indx++;
+        }
+    }
+}
+
+//-------------------------------------------------------------------------
+
+void AliGTube::Sizeof3D() const
+{
+//*-*-*-*-*-*Return total X3D size of this shape with its attributes*-*-*-*-*-*-*
+//*-*        =======================================================
+
+  cout << " Entra en AliGTube::Sizeof3D() " << endl;
+
+    Int_t n = GetNumberOfDivisions();
+
+    gSize3D.numPoints += n*4;
+    gSize3D.numSegs   += n*8;
+    gSize3D.numPolys  += n*4;
+}
+
+//-------------------------------------------------------------------------
+
+void AliGTube::Streamer(TBuffer &R__b)
+{
+   // Stream an object of class AliGTube.
+
+   if (R__b.IsReading()) {
+      Version_t R__v = R__b.ReadVersion(); if (R__v) { }
+      AliGShape::Streamer(R__b);
+      R__b.ReadArray(fCoTab); //
+      R__b >> fAspectRatio;
+      R__b >> fDz;
+      R__b >> fNdiv;
+      R__b >> fRmax;
+      R__b >> fRmin;
+      R__b.ReadArray(fSiTab); //
+   } else {
+      R__b.WriteVersion(AliGTube::IsA());
+      AliGShape::Streamer(R__b);
+      R__b.WriteArray(fCoTab, GetNumberOfDivisions()); //
+      R__b << fAspectRatio;
+      R__b << fDz;
+      R__b << fNdiv;
+      R__b << fRmax;
+      R__b << fRmin;
+      R__b.WriteArray(fSiTab, GetNumberOfDivisions()); //
+   }
+}
+
+//-------------------------------------------------------------------------
+
diff --git a/GEODB/AliGTube.h b/GEODB/AliGTube.h
new file mode 100644 (file)
index 0000000..66c3ca9
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef ALIGTUBE_H
+#define ALIGTUBE_H
+
+#include "AliGShape.h"
+
+const Int_t kDivNum = 20;    //default number of divisions
+
+class AliGTube: public AliGShape {
+
+    protected:
+        Double_t* fCoTab;       // Table of cos(fPhi1) .... cos(fPhil+fDphi1)
+        Float_t   fAspectRatio; // defines  (the ellipse semi-axis in Y)/(the ellipse semi-axis in X)
+        Float_t   fDz;          // half length in z
+        Int_t     fNdiv;        // number of segments (precision)
+        Float_t   fRmax;        // ellipse  semi-axis   in  X outside
+        Float_t   fRmin;        // ellipse  semi-axis   in  X inside
+        Double_t* fSiTab;       // Table of sin(fPhi1) .... sin(fPhil+fDphi1)
+        
+        virtual void MakeTableOfCoSin();  // Create the table of the fSiTab; fCoTab
+
+    public:
+        AliGTube(); /* Default Constructor */
+        AliGTube( Text_t *name, Text_t *title, Float_t rmin, Float_t rmax, Float_t dz, Float_t aspect=1); /* Constructor*/
+        AliGTube( Text_t *name, Text_t *title, Float_t rmax, Float_t dz); /* Constructor */
+        AliGTube( AliGTube *tube ); 
+       ~AliGTube(); /* Destructor */
+
+                void    Draw(Option_t *option);
+                void    DrawShape(Option_t *option); // *MENU* 
+                Float_t GetAspectRatio(){return fAspectRatio;}
+                Float_t GetDz()    {return fDz;}
+                Int_t   GetNdiv()  {return fNdiv;}
+                Int_t   GetNumberOfDivisions () const {if (fNdiv) return fNdiv; else return kDivNum;}
+               Float_t GetRmax() {return fRmax;}
+               Float_t GetRmin() {return fRmin;}
+                void    Paint(Option_t *option);
+                void    PaintGLPoints(Float_t *vertex);
+                void    SetDz(Float_t dz)    {fDz= dz;}
+                void    SetPoints(Float_t *buff);
+               void    SetRmin(Float_t rmin) {fRmin= rmin;}
+                void    SetRmax(Float_t rmax) {fRmax= rmax;}
+                void    Sizeof3D() const;
+
+    ClassDef(AliGTube,1) // Simple cone class
+};
+
+#endif
diff --git a/GEODB/AliGeometry.cxx b/GEODB/AliGeometry.cxx
new file mode 100644 (file)
index 0000000..8a42556
--- /dev/null
@@ -0,0 +1,509 @@
+/**********************************************/
+/*                                            */
+/* FILE: AliGeometry.cxx                      */
+/* PURPOSE: To store and retrieve a complete  */
+/*          geometry in/from a root file.     */
+/* LANGUAGE: C++                              */
+/* COMPILER: CC for HP-UX 9.x and 10.         */
+/* AUTHOR: Joana && David                     */
+/* DATE: May 28, 1999                         */
+/* ADDRESS: jesanto@cern.ch, dcollado@cern.ch */
+/*                                            */
+/**********************************************/
+
+#include <iostream.h>
+#include <TFile.h>
+#include <TROOT.h>
+#include "AliGConfig.h"
+#include "AliGeometry.h"
+#include "AliGBox.h"
+#include "AliGSphere.h"
+#include "AliGCone.h"
+#include "AliGTube.h"
+#include "AliGTransform.h"
+
+#define FormLeng 80
+
+//float matrix[16] = {1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.};
+//TArrayF* gMatrix = new TArrayF( 16, matrix );
+TVector *gMatrix = new TVector(0,15,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1., "END");
+AliGeometry *gAliGeometry = 0;
+
+ClassImp(AliGeometry)
+
+
+// ---------------------------------------------------------------------------
+
+AliGeometry::AliGeometry( AliGeometry* Geom )
+{
+    if( Geom ) {
+        /* Copy Constructor */
+        fBomb           = Geom->fBomb; //Bomb factor for exploded geometry
+        fGeomLevel      = Geom->fGeomLevel;
+        fMaxDepth       = Geom->fMaxDepth;
+        fName           = Geom->fName;
+
+        fRules          = new TList();
+        if( Geom->fRules ) {
+            for( int i=0; i<Geom->fRules->GetSize(); i++ )
+                fRules->AddLast(Geom->fRules->At(i));
+        }
+
+        fTitle          = Geom->fTitle;
+        fTopNode        = Geom->fTopNode;
+
+        gAliGeometry    = this;
+        fTransformation = new TList();
+        if( Geom->fTransformation ) {
+            for( int i=0; i<Geom->fTransformation->GetSize(); i++ )
+                fTransformation->AddLast(Geom->fTransformation->At(i));
+        }
+    }
+    else {
+        /* Default constructor */
+        fBomb           = 1.; //Bomb factor for exploded geometry
+        fGeomLevel      = 0;
+        fMaxDepth       = 0; // 0 = No Depth limitation
+        fName           = "";
+        fRules          = new TList(); // Antes estaba a NULL
+        fTitle          = "";
+        fTopNode        = "";
+        fTransformation = new TList(); // Antes estaba a NULL
+       gAliGeometry = this;
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+AliGeometry::~AliGeometry()
+{
+    /* Destructor */
+    
+    if( fRules ) {
+        fRules->Delete();
+        fRules = NULL;
+    }
+
+    if( fTransformation ) {
+        fTransformation->Delete();
+        fTransformation = NULL;
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+AliGeometry* AliGeometry::operator=( const AliGeometry* Geom )
+{
+    /* Operator = */
+    if( this == Geom ) return this; // special case.
+
+    fBomb           = Geom->fBomb; //Bomb factor for exploded geometry
+    fGeomLevel      = Geom->fGeomLevel;
+    fMaxDepth       = Geom->fMaxDepth;
+    fName           = Geom->fName;
+    gAliGeometry    = this;
+
+    if( fRules )
+        fRules->Delete();
+
+    if( Geom->fRules ) {
+        for( int i=0; i<Geom->fRules->GetSize(); i++ )
+            fRules->AddLast(Geom->fRules->At(i));
+    }
+
+    fTitle   = Geom->fTitle;
+    fTopNode = Geom->fTopNode;
+
+    if( fTransformation )
+        fTransformation->Delete();
+
+    fTransformation = new TList();
+
+    if( Geom->fTransformation ) {
+        for( int i=0; i<Geom->fTransformation->GetSize(); i++ )
+            fTransformation->AddLast(Geom->fTransformation->At(i));
+    }
+
+    return this;
+}
+
+// ---------------------------------------------------------------------------
+
+AliGNode* AliGeometry::FileToMemTree( TFile* file )
+{
+    // Geometry constructor that retrieves a whole geometry from the root file
+    // and stores it in memory as a tree structure
+
+    // Read the name of my geometry's first node
+    file->cd();
+    const char* node_name = (const char*) GetTop().Data();
+
+    // Call recursion
+    AliGNode* new_node = new AliGNode( RecurToMem( node_name, file, NULL, NULL ) );
+
+    return new_node;
+}
+
+// ---------------------------------------------------------------------------
+
+AliGNode* AliGeometry::RecurToMem( const char* node_name, TFile* file, AliGNode* father, char *subtransf ) 
+{
+    // Recursive function used to retrieve the root_file structure into memory
+
+    const int LenName = strlen(node_name);
+
+    int i;
+    for( i=0; i<LenName; i++ )
+        if( node_name[i] == '_' )
+            break;
+    
+    char* name = new char[i+1];
+    strncpy( name, node_name, i );
+    name[i] = '\x0';
+
+    char* ids = new char[LenName-i];
+    for( int g1=0, g2=i+1; g2<LenName; g1++, g2++ )
+        ids[g1] = node_name[g2];
+
+    ids[LenName-i-1] = '\x0';
+
+    const int id = atoi( ids );
+    if( ids )
+        delete [] ids;
+
+    AliGNode* node = NULL;
+
+    int new_node = 1;
+
+    if (father) {
+        AliGTransform* trans = NULL;
+
+        int l;
+        for( l=0; father->GetNodeFromfNode(l); l++ ) {
+            // check if the node has been already added
+            if ( !strcmp( node_name, (father->GetNodeFromfNode(l))->GetName()) ) {
+                new_node = 0;
+                break;
+            }
+            else
+                node = new AliGNode( (Text_t*)name, id, (Text_t*)name, (AliGBox*) NULL );
+        }
+
+        int new_trans = 1;
+        int m;
+        for( m=0; father->GetTransFromfTrans(m); m++ ) {
+            // check if this tranformations has already been used with this father
+            if (!strcmp(subtransf,(father->GetTransFromfTrans(m))->GetName()))  {
+                new_trans=0;
+                break;
+            }
+            else {
+                trans = new AliGTransform();
+                file->cd(father->GetPath());
+                trans->Read(subtransf);
+            }
+        }
+
+        if ( l == 0 ) node = new AliGNode( (Text_t*)name, id, (Text_t*)name, (AliGBox*) NULL );
+        if ( m == 0 ) {
+            trans = new AliGTransform();
+            trans->Read(subtransf);
+        }
+
+        if (new_node) {
+            if(!new_trans) {
+                father->Add(node,father->GetTransFromfTrans(m));
+                file->cd(node->GetPath());
+            }
+            else {
+                father->Add(node,trans);
+                file->cd(node->GetPath());
+             }
+        }
+        else {
+            if(!new_trans) {
+                father->Add(father->GetNodeFromfNode(l),father->GetTransFromfTrans(m));
+                file->cd(father->GetPath());
+            }
+            else {
+                father->Add(father->GetNodeFromfNode(l),trans);
+                file->cd(father->GetPath());
+            }
+        }
+
+        //if( trans ) delete trans;
+    }
+    else { // There is no father
+        node = new AliGNode( (Text_t*)name, id, (Text_t*)name, (AliGBox*) NULL );
+        file->cd(node->GetPath());
+    }
+
+    if( name )
+        delete [] name;
+
+    if( new_node ) {
+        // Read the configuration name
+        char* configs = NULL;
+
+        if( fRules ) {
+            for( int k=0; k<fRules->GetSize(); k++ ) {
+                char* rule = new char[strlen((char*)fRules->At(k)->GetName())];
+                strcpy( rule, (char*)fRules->At(k)->GetName() );
+
+                int w;
+                for( w=0; w<strlen(rule); w++ )
+                    if( rule[w] == '/' )
+                        break;
+    
+                configs = new char[w+1];
+                strncpy( configs, rule, w );
+                configs[w] = '\x0';
+
+                if( !strcmp(node->GetName(), configs) ) {
+                    delete [] rule;
+                    break;
+                }
+                else {
+                    delete [] configs;
+                    configs = NULL;
+                }
+                
+                delete [] rule;
+            }
+        }
+        else {
+            printf( " ERROR: I couldn't find the fRule inside RecurToMem.\n" );
+            return NULL;
+        }
+
+        // Build Configuration
+        AliGConfig* Config = new AliGConfig();
+        
+        Config->Read(configs);
+        node->AddConf(Config);
+
+        // Read Shape, material and formula from configuration
+        const Text_t* shapetype = Config->GetShapeType().Data();
+        const Text_t* shapename = Config->GetShapeName().Data();
+
+        // Build Shape
+
+        if( !strcmp(shapetype,"AliGBox") ) {
+            AliGBox* shape = new AliGBox();
+            shape->Read(shapename);
+            node->AddShape(shape);
+        }
+        else {
+            if (!strcmp(shapetype,"AliGSphere")) {
+                AliGSphere* shape = new AliGSphere();
+                shape->Read(shapename);
+                node->AddShape(shape);
+            }
+            else {
+               if (!strcmp(shapetype,"AliGTube")) {
+                    AliGTube* shape = new AliGTube();
+                    shape->Read(shapename);
+                    node->AddShape(shape);
+               }
+                else {
+                   if (!strcmp(shapetype,"AliGCone")) {
+                        AliGCone* shape = new AliGCone();
+                        shape->Read(shapename);
+                        node->AddShape(shape);
+                    }
+                    else {
+                        if (!strcmp(shapetype,"AliGPCone")) {
+                            AliGPCone* shape = new AliGPCone();
+                            shape->Read(shapename);
+                            node->AddShape(shape);
+                        }    
+                        else {
+                            if (!strcmp(shapetype,"AliGTRD1")) {
+                                AliGTRD1* shape = new AliGTRD1();
+                                shape->Read(shapename);
+                                node->AddShape(shape);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        // Build Material
+        const Text_t* materialname = Config->GetMaterialName().Data();
+        AliGMaterial *material = new AliGMaterial();
+        material->Read(materialname);
+        node->AddMaterial(material);
+
+        // Read formula
+        const char* formula = Config->GetFormula();
+
+        int Len = strlen(formula);
+        int j = 0;
+
+        while( formula[j] ) {
+            char* subnode   = new char[Len];
+            char* subtransf = new char[Len];
+            int k;
+
+            for( k=0; formula[j] != ':'; k++, j++ )
+                subnode[k] = formula[j];
+
+            subnode[k] = '\x0';
+            if( formula[j] ) j++;
+
+            for( k=0; formula[j] && formula[j] != '+'; k++, j++ )
+                subtransf[k] = formula[j];
+
+            subtransf[k] = '\x0';
+            if( formula[j] ) j++;
+
+            AliGNode* node1 = this->RecurToMem( subnode, file, node, subtransf );
+       }
+    }
+
+    return node;
+}
+
+// ---------------------------------------------------------------------------
+
+AliGeometry::AliGeometry( Text_t* name, Text_t* title, AliGNode* topNode, int maxDepth ): TNamed(name, title)
+{
+    /* Geometry constructor that stores in the root file the geometry file that corresponds to one geometry */
+
+    gAliGeometry    = this;
+    fBomb           = 1.; //Bomb factor for exploded geometry
+    fGeomLevel      = 0;
+    fMaxDepth       = maxDepth;
+    fRules          = new TList();
+    fTopNode        = topNode->GetName();
+    fTransformation = new TList();
+
+    RulesList( fRules, topNode, 0 );
+
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGeometry::RulesList( TList *fRules, AliGNode* node, int position ) 
+{
+    /* Recursive function used to create the list of rules for the Geometry file */
+
+    int len = strlen(node->GetName()) + strlen(node->GetConfig()->GetName());
+
+    char* path = new char[len+2];
+    strcpy( path, node->GetName() );
+    strcat( path, "/" );
+    strcat( path, node->GetConfig()->GetName());
+    TNamed* rule = new TNamed( path, "" );
+    delete [] path;
+
+    fRules->AddLast( rule );
+    //cout << " Rule: " << rule->GetName() << " added." << endl;
+    //if( rule ) delete rule;
+
+    while( (position < node->SizefNode()) && (node->GetNodeFromfNode(position) != NULL) ) {
+        this->RulesList( fRules, node->GetNodeFromfNode(position), 0 );
+        position++;
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGeometry::UpdateMatrix(AliGTransform* trans)
+{
+//    Update global rotation matrix/translation vector for this node
+//   this function must be called before invoking Local2Master
+
+        TVector* matrix = trans->GetMatrix(); // Get father's transf. matrix
+       TVector* temp = new TVector( 0,15,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,1., "END");
+      
+
+       //      printf("Inside updatematrix, this is the son's matrix\n");
+       //      matrix->Print();
+       //      printf("Inside updatematrix, this is the global matrix before\n");
+       //      gMatrix->Print();
+        /* Multiplication of matrices*/
+        for( int i=0; i<4; i++ )
+            for( int j=0; j<4; j++ ) {
+              double tmp = 0;
+               for( int k=0; k<4; k++ ) 
+                 //        tmp += (*matrix)(i*4+k) * (*gMatrix)(j + k*4);
+                   tmp += (*gMatrix)(i*4+k) * (*matrix)(j + k*4);
+               (*temp)(i*4+j)= tmp;
+            }
+       //if(gMatrix) delete gMatrix;
+           gMatrix = temp;
+       
+           //  printf("Inside updatematrix, this is the global matrix after\n");
+           //  gMatrix->Print();
+       
+           //  for (int k = 0; k < 16; k++) {
+           //cout << "gMatrix[" << k << "]" << (*gMatrix)(k) << endl;
+           //cout << "matrix[" << k << "]" << (*matrix)(k) << endl;
+           //}
+
+           //if (temp)   delete [] temp;
+        //if (matrix) delete [] matrix;
+}
+
+// ---------------------------------------------------------------------------
+
+void AliGeometry::Local2Master(Float_t *local, Float_t *master)
+{
+// *-*-*-*-*Convert one point from local system to master reference system*-*-*
+// *-*      ==============================================================
+//  Note that before invoking this function, the  matrix of the transformation
+//  for this node must have been computed.
+//  AliGeometry::UpdateMatrix should be called before.
+
+
+  //    gMatrix->Print();
+    if( gNode->GetParent() && gMatrix) {
+        
+        Double_t tmp;
+       Float_t loc[4];
+
+       for(int i=0;i<3;i++) loc[i]=local[i];
+       loc[3]=1;
+       
+       TVector &mat = *gMatrix;
+
+        for (int i=0; i<3; i++) {
+           tmp=0;
+            for (int j=0; j<4; j++) tmp+= mat(i*4+j) * loc[j];
+           master[i] = tmp;
+        }
+    }
+    else
+        memcpy( master, local, sizeof(Double_t)* kVectorSize );         
+}
+
+//----------------------------------------------------------------------------
+
+void AliGeometry::PushMatrix(TVector* matrix)
+{
+    //if( fTransformation == NULL )
+        //fTransformation = new TList();
+
+    //cout << " Va a dar error " << endl;
+    if (matrix) fTransformation->AddLast((TObject*)matrix);
+    //cout << " Ves como aqui no llega? :-) " << endl;
+}
+
+//----------------------------------------------------------------------------
+
+TVector* AliGeometry::PopMatrix()
+{
+  
+  gMatrix = (TVector*)fTransformation->Last();
+  fTransformation->Remove(fTransformation->Last());
+  return gMatrix;
+}
+
+//----------------------------------------------------------------------------
+
+
+
diff --git a/GEODB/AliGeometry.h b/GEODB/AliGeometry.h
new file mode 100644 (file)
index 0000000..a9cc476
--- /dev/null
@@ -0,0 +1,69 @@
+// -*- C++ -*-
+// 
+// 1999/01/05
+// ---------------------------------------------------------------------------
+//
+// AliGeometry Class
+//
+// This file is part of the ALICE Geometry Database .
+//
+// Author:  Joana E. Santo
+//
+// ---------------------------------------------------------------------------
+// The Geometry class holds the detector,s geometry. Essentially it has a pointer
+// to the Top Level AliGNode and an array of pointers to rules that specify the
+// complete desgn below that node.
+
+#ifndef ALIGEOMETRY_H
+#define ALIGEOMETRY_H
+
+#include <TFile.h>
+#include <TNamed.h>
+#include <TObjString.h>
+#include <TList.h>
+#include "AliGNode.h"
+
+const Int_t kMAXLEVELS  = 20;
+const Int_t kMatrixSize = 16;
+const Int_t kVectorSize =  4;
+
+class AliGeometry: public TNamed {
+
+    protected:
+        Float_t  fBomb;     //Bomb factor for exploded geometry
+        Int_t    fGeomLevel;
+        Int_t    fMaxDepth;
+        TList*   fRules;
+        TString  fTopNode;
+        TList*   fTransformation;
+
+    public:
+        AliGeometry( Text_t* name, Text_t* title, AliGNode* topNode, int maxDepth=0 ); // Constructor
+        AliGeometry( AliGeometry* Geom=NULL ); // Copy or Default Constructor
+        virtual ~AliGeometry(); // Destructor
+        AliGeometry* operator=( const AliGeometry* Geom );
+
+                TList*       GetfTransf() const {return fTransformation;}
+                Float_t      GetBomb() const {return fBomb;}
+                TString      GetTop() const {return fTopNode;}
+                TList*       GetRules() const {return fRules;}
+                AliGNode*    FileToMemTree( TFile* file );
+                //AliGNode*   FileToMemTree( Text_t* root_file, Text_t* geom_file );
+                void         Local2Master( Float_t *local, Float_t *master);
+        virtual Int_t        PopLevel(){return fGeomLevel>0?fGeomLevel--:0;}
+        virtual Int_t        PushLevel(){return fGeomLevel++;}
+                TVector*     PopMatrix();
+                void         PushMatrix(TVector* matrix);
+                AliGNode*    RecurToMem( const char* node_name, TFile* file, AliGNode* father, char* subtransf );
+                void         RulesList( TList *fRules, AliGNode* node, int position );
+        virtual void         SetBomb(Float_t bomb=1.4) {fBomb = bomb;}
+                void         UpdateMatrix(AliGTransform* trans);
+
+
+    ClassDef(AliGeometry,1) //Generic Geometry class
+};
+
+R__EXTERN AliGeometry *gAliGeometry;
+R__EXTERN TVector* gMatrix;
+
+#endif
diff --git a/GEODB/ConfigGeo.C b/GEODB/ConfigGeo.C
new file mode 100644 (file)
index 0000000..eada22f
--- /dev/null
@@ -0,0 +1,437 @@
+void Config()
+{
+
+new AliGEODB("Test with the GEO database");
+
+gSystem->Load("/home/dcollado/AliRoot/pro/lib/libGEODB");
+//=======================================================================
+//  Create the output file
+   
+//TFile *rootfile = new TFile("GeoDB.root","recreate");
+//rootfile->SetCompressionLevel(2);
+
+AliGEODB* geant3 = (AliGEODB*) gMC;
+
+Int_t iMAG=0;
+Int_t iITS=0;
+Int_t iTPC=1;
+Int_t iTOF=0;
+Int_t iRICH=0;
+Int_t iZDC=0;
+Int_t iCASTOR=0;
+Int_t iTRD=0;
+Int_t iABSO=0;
+Int_t iDIPO=0;
+Int_t iHALL=0;
+Int_t iFRAME=0;
+Int_t iSHIL=0;
+Int_t iPIPE=0;
+Int_t iFMD=0;
+Int_t iMUON=0;
+Int_t iPHOS=0;
+Int_t iPMD=0;
+
+//=================== Alice BODY parameters =============================
+
+//AliBODY *BODY = new AliBODY("BODY","Alice envelop");
+
+
+if(iMAG) {
+//=================== MAG parameters ============================
+// --- Start with Magnet since detector layouts may be depending ---
+// --- on the selected Magnet dimensions ---
+AliMAG *MAG  = new AliMAG("MAG","Magnet");
+}
+
+if(iITS) {
+//=================== ITS parameters ============================
+//
+// EUCLID is a flag to output (=1) both geometry and media to two ASCII files 
+// (called by default ITSgeometry.euc and ITSgeometry.tme) in a format
+// understandable to the CAD system EUCLID. The default (=0) means that you 
+// dont want to use this facility.
+//
+AliITS *ITS  = new AliITSv3("ITS","normal ITS");
+ITS->SetEUCLID(1);
+}
+
+if(iTPC) {
+    //============================ TPC parameters ================================
+    // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
+    // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
+    // --- sectors are specified, any value other than that requires at least one 
+    // --- sector (lower or upper)to be specified!
+    // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
+    // ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
+    // --- SecLows - number of lower sectors specified (up to 6)
+    // --- SecUps - number of upper sectors specified (up to 12)
+    // --- Sens - sensitive strips for the Slow Simulator !!!
+    // --- This does NOT work if all S or L-sectors are specified, i.e.
+    // --- if SecAL or SecAU < 0
+    //
+    //
+    //-----------------------------------------------------------------------------
+
+    AliTPC *TPC  = new AliTPCv1("TPC","Normal TPC");
+    TPC->SetSecAL(1);
+    TPC->SetSecAU(1);
+    TPC->SetSecLows(1, -1, -1, -1, -1, -1);
+    TPC->SetSecUps(25, 26, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+    TPC->SetSens(1);
+}
+
+if(iTOF) {
+//=================== TOF parameters ============================
+AliTOF *TOF  = new AliTOFv2("TOF","normal TOF");
+}
+
+if(iRICH) {
+//=================== RICH parameters ===========================
+
+
+AliRICH *RICH  = new AliRICHv1("RICH","normal RICH");
+RICH->SetSP(40);
+RICH->SetFEED(0.04);
+RICH->SetSIGM(0.18);
+RICH->SetTRIG(0);
+}
+
+if(iZDC) {
+//=================== ZDC parameters ============================
+
+AliZDC *ZDC  = new AliZDCv1("ZDC","normal ZDC");
+}
+
+if(iCASTOR) {
+//=================== CASTOR parameters ============================
+
+AliCASTOR *CASTOR  = new AliCASTORv1("CASTOR","normal CASTOR");
+}
+
+if(iTRD) {
+//=================== TRD parameters ============================
+
+AliTRD *TRD  = new AliTRDv2("TRD","TRD version 2");
+}
+
+
+if(iABSO) {
+//=================== ABSO parameters ============================
+AliABSO *ABSO  = new AliABSO("ABSO","Muon Absorber");
+}
+
+if(iDIPO) {
+//=================== DIPO parameters ============================
+
+AliDIPO *DIPO  = new AliDIPOv2("DIPO","Dipole version 2");
+}
+
+if(iHALL) {
+//=================== HALL parameters ============================
+
+AliHALL *HALL  = new AliHALL("HALL","Alice Hall");
+}
+
+
+if(iFRAME) {
+//=================== FRAME parameters ============================
+AliFRAME *FRAME  = new AliFRAMEv0("FRAME","Space Frame");
+}
+
+if(iSHIL) {
+//=================== SHIL parameters ============================
+
+AliSHIL *SHIL  = new AliSHIL("SHIL","Shielding");
+}
+
+
+if(iPIPE) {
+//=================== PIPE parameters ============================
+
+AliPIPE *PIPE  = new AliPIPEv0("PIPE","Beam Pipe");
+}
+
+
+if(iFMD) {
+//=================== FMD parameters ============================
+
+AliFMD *FMD  = new AliFMDv1("FMD","normal FMD");
+}
+
+if(iMUON) {
+//=================== MUON parameters ===========================
+
+AliMUON *MUON  = new AliMUONv0("MUON","normal MUON");
+
+MUON->SetSMAXAR(0.03);
+MUON->SetSMAXAL(-1);
+//
+// Version 0
+//
+// First define the number of planes that are segmented (1 or 2) by a call
+// to SetNsec. 
+// Then chose for each chamber (chamber plane) the segmentation 
+// and response model.
+// They should be equal for the two chambers of each station. In a future
+// version this will be enforced.
+//
+//  
+ Int_t chamber;
+ Int_t station;
+// Default Segmentation
+ AliMUONsegmentationV0* segV0 = new AliMUONsegmentationV0;
+// Default response
+ AliMUONresponseV0* response0 = new AliMUONresponseV0;
+ response0->SetSqrtKx3(0.761577);
+ response0->SetKx2(0.972655);
+ response0->SetKx4(0.3841);
+ response0->SetSqrtKy3(0.714143);
+ response0->SetKy2(1.0099);
+ response0->SetKy4(0.403);
+ response0->SetPitch(0.25);
+ response0->SetRSIGM(10.);
+ response0->SetMUCHSP(5.);
+ response0->SetMUSIGM(0.18, 0.18);
+ response0->SetMAXADC( 1024);
+//--------------------------------------------------------
+// Configuration for Chamber TC1/2  (Station 1) ----------           
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ Float_t rseg[4]={17.5, 55.2, 71.3, 95.5};
+ Int_t   nseg[4]={4, 4, 2, 1};
+
+ chamber=1;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+//
+ AliMUONsegmentationV01 *seg11=new AliMUONsegmentationV01;
+ seg11->SetSegRadii(rseg);
+ seg11->SetPADSIZ(3.048, 0.508);
+ seg11->SetPadDivision(nseg);
+ MUON->SetSegmentationModel(chamber-1, 1, seg11);
+//
+ AliMUONsegmentationV01 *seg12=new AliMUONsegmentationV01;
+ seg12->SetSegRadii(rseg); 
+ seg12->SetPADSIZ(2.032, 0.762);
+ seg12->SetPadDivision(nseg);
+
+ MUON->SetSegmentationModel(chamber-1, 2, seg12);
+
+ chamber=2;
+//^^^^^^^^^
+ MUON->SetNsec(chamber-1,2);
+ MUON->SetSegmentationModel(chamber-1, 1, seg11);
+ MUON->SetSegmentationModel(chamber-1, 2, seg12);
+
+ station=1;
+//^^^^^^^^^ 
+ MUON->SetResponseModel(0, response0);     
+ MUON->SetResponseModel(1, response0);     
+//
+//--------------------------------------------------------
+// Configuration for Chamber TC3/4 -----------------------
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ chamber=3;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg34=new AliMUONsegmentationV0;
+ seg34->SetDAnod(0.51/3.);
+ MUON->SetSegmentationModel(chamber-1, 1, seg34);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=4;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg34);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Station 2
+ station=2;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.51);
+ MUON->SetMUCHSP(station, 5.);
+ MUON->SetMUSIGM(station, 0.18, 0.18);
+ MUON->SetRSIGM(station, 10.);
+ MUON->SetMAXADC(station, 1024);
+
+//
+//--------------------------------------------------------
+// Configuration for Chamber TC5/6 -----------------------
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ seg5 =  new AliMUONsegmentationV1;
+ AliMUONresponseV0* response5 =  new AliMUONresponseV0;
+ // K3 = 0.62
+ response5->SetSqrtKx3(0.78740079);
+ response5->SetKx2(0.95237319); //  0.5 * kPI * (1- 0.5*sqrtky3 )
+ response5->SetKx4(0.37480633); // 0.25/TMath::ATan(sqrtkx3)
+ // K3 = 0.55
+ response5->SetSqrtKy3(0.74161985);
+ response5->SetKy2(0.98832946);
+ response5->SetKy4(0.39177817);
+ response5->SetPitch(0.325);
+ response5->SetRSIGM(10.);
+ response5->SetMUCHSP(5.);
+ response5->SetMUSIGM( 0.4, 0.4);
+ response5->SetMAXADC( 1024);
+
+ chamber=5;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg5);
+ MUON->SetResponseModel(chamber-1, response5);     
+
+ chamber=6;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg5);
+ MUON->SetResponseModel(chamber-1, response5);     
+//
+// Station 3
+ station=3;
+ MUON->SetPADSIZ(station, 1, 0.975, 0.55);
+
+//
+//--------------------------------------------------------
+// Configuration for Chamber TC7/8/9/10-------------------
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ chamber=7;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg78=new AliMUONsegmentationV0;
+ seg78->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg78);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=8;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg78);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Station 4
+ station=4;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+
+ chamber=9;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg910=new AliMUONsegmentationV0;
+ seg910->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg910);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=10;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg910);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Station 5
+ station=5;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+
+ chamber=11;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg1112=new AliMUONsegmentationV0;
+ seg1112->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg1112);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=12;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg1112);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Trigger Station 1
+ station=6;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+
+ chamber=13;
+ MUON->SetNsec(chamber-1,1);
+ AliMUONsegmentationV0 *seg1314=new AliMUONsegmentationV0;
+ seg1314->SetDAnod(0.51/3.);
+
+ MUON->SetSegmentationModel(chamber-1, 1, seg1314);
+ MUON->SetResponseModel(chamber-1, response0);     
+
+ chamber=14;
+ MUON->SetNsec(chamber-1,1);
+ MUON->SetSegmentationModel(chamber-1, 1, seg1314);
+ MUON->SetResponseModel(chamber-1, response0);     
+//
+// Trigger Station 2
+ station=7;
+ MUON->SetPADSIZ(station, 1, 0.75, 0.5);
+}
+
+if(iPHOS) {
+//=================== PHOS parameters ===========================
+
+AliPHOS *PHOS  = new AliPHOSv1("PHOS","normal PHOS");
+// * PHOSflags:    YES: X<>0   NO: X=0
+// * PHOSflags(1) : -----X  Create branch for TObjArray of AliPHOSCradle
+// *                ----X-  Create file (ftn03 on HP-UX) with list of SHAKER particles (7Mb/event)
+// *                
+PHOS->SetFlags(000001);
+PHOS->SetRadius(460); //Distance from beam to PHOS crystals.
+// (crystal_side_size,crystal_length,wrap_thikness,air_thikness,PIN_size,PIN length)
+PHOS->SetCell(2.2,          18.,         0.01,        0.01,        1.,      0.1);
+PHOS->SetCradleSize(104, 88, 4); // Nz (along beam), Nphi, Ncradles
+PHOS->SetCradleA(0);   //Angle between Cradles
+PHOS->SetCPV(1., 2.); //CPV thikness, CPV-PHOS distance
+// *  ===============
+// * PHOS extra parameters (contact Maxim Volkov volkov@mail.cern.ch)
+// * 1. STE_THICK         Steel cover thickness
+// * 2. SUP_Y             Crystal support height
+// * 3. FTIU_THICK        Thermo Insulating outer cover Upper plate thickness
+// * 4. UFP_Y             Upper Polystyrene Foam plate thickness
+// * 5. TCB_THICK         Thermo insulating Crystal Block wall thickness
+// * 6. UCP_Y             Upper Cooling Plate thickness
+// * 7. ASP_Y             Al Support Plate thickness
+// * 8. TIP_Y             Lower Thermo Insulating Plate thickness
+// * 9. TXP_Y             Lower Textolit Plate thickness
+PHOS->SetExtra(0.001, 6.95, 4., 5., 2., 0.06, 10., 3., 1.);   
+PHOS->SetTextolitWall(209., 71., 250.);    //Textolit Wall box dimentions
+PHOS->SetInnerAir(206.,    66.,     244.); //Inner AIR volume dimensions
+// *  ===============================
+// * 1. FTI_X             Foam Thermo Insulating outer cover dimensions
+// * 2. FTI_Y             ==//==
+// * 3. FTI_Z             ==//==
+// * 4. FTI_R             Distance from IP to Foam Thermo Insulating top plate
+PHOS->SetFoam(214.6,  80.,  260., 467.); 
+//    =================================
+// *******************************************************************************
+// * KINE 700  - SHAKER generator
+// * KINE 700 x y z NDNDY YLIM PTLIM ChargeFlag
+// *     JWEAK=0
+// *     JPI0=JETA=1
+// *     JPIC=JPRO=JKAC=JKA0=JRHO=JOME=JPHI=JPSI=JDRY=ChargeFlag
+// *     Int_t               JWEI;           // Unweighted generation
+// *     Int_t               NDNDY;          // Density of charged particles
+// *     Float_t             YLIM;           // Rapidity Limit
+// *     Float_t             PTLIM;          // Pt limit in GeV/c
+// *     Int_t               JWEAK;          // Disable weak decays
+// *     Int_t               JPI0;           // pi0 generation
+// *     Int_t               JETA;           // eta generation
+// *     Int_t               JPIC;           // pi+/- generation
+// *     Int_t               JPRO;           // proton generation
+// *     Int_t               JKAC;           // K+/- generation
+// *     Int_t               JKA0;           // K0 generation
+// *     Int_t               JRHO;           // rho generation
+// *     Int_t               JOME;           // omega generation
+// *     Int_t               JPHI;           // phi generation
+// *     Int_t               JPSI;           // J/psi generation
+// *     Int_t               JDRY;           // Drell-Yan generation
+// * KINE  700     5.    175.    0.          800. 1.5 5. 1.
+// *******************************************************************************
+}
+
+if(iPMD) {
+//=================== PMD parameters ============================
+
+//         Must be defined AFTER PHOS
+AliPMD *PMD  = new AliPMDv1("PMD","normal PMD");
+PMD->SetPAR(1., 1., 0.8, 0.02);
+PMD->SetIN(6., 20., 600., 27., 27.);
+PMD->SetGEO(0.0, 0.2, 4.);
+PMD->SetPadSize(0.8, 1.0, 1.2, 1.5);
+}
+
+}
diff --git a/GEODB/GEODBLinkDef.h b/GEODB/GEODBLinkDef.h
new file mode 100644 (file)
index 0000000..cd36db8
--- /dev/null
@@ -0,0 +1,25 @@
+#ifdef __CINT__
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ global gAlice;
+
+#pragma link C++ class  AliGShape;
+#pragma link C++ class  AliGBox;
+#pragma link C++ class  AliGSphere-;
+#pragma link C++ class  AliGTransform;
+#pragma link C++ class  AliGMaterial-;
+#pragma link C++ class  AliGSuperShape;
+#pragma link C++ class  AliGConfig;
+#pragma link C++ class  AliGNode;
+#pragma link C++ class  AliGCone;
+#pragma link C++ class  AliGTube-;
+#pragma link C++ class  AliGPCone-;
+#pragma link C++ class  AliGTRD1;
+#pragma link C++ class  AliGeometry;
+
+#pragma link C++ class  AliGEODB;
+
+#endif
diff --git a/GEODB/Makefile b/GEODB/Makefile
new file mode 100644 (file)
index 0000000..5a51034
--- /dev/null
@@ -0,0 +1,71 @@
+############################### GEODB Makefile ################################
+
+# Include machine specific definitions
+
+include $(ALICE_ROOT)/conf/GeneralDef
+include $(ALICE_ROOT)/conf/MachineDef.$(ALICE_TARGET)
+
+PACKAGE = GEODB
+
+# C++ sources
+
+SRCS          = AliGBox.cxx AliGCone.cxx AliGConfig.cxx \
+         AliGMaterial.cxx AliGNode.cxx AliGShape.cxx AliGSphere.cxx \
+         AliGSuperShape.cxx AliGTransform.cxx AliGTube.cxx AliGPCone.cxx \
+         AliGTRD1.cxx AliGeometry.cxx AliGEODB.cxx
+
+
+# C++ Headers
+
+HDRS          = $(SRCS:.cxx=.h) GEODBLinkDef.h
+
+# Library dictionary
+
+DICT          = GEODBCint.cxx
+DICTH         = $(DICT:.cxx=.h)
+DICTO         = $(patsubst %.cxx,tgt_$(ALICE_TARGET)/%.o,$(DICT))
+
+# FORTRAN Objectrs
+
+FOBJS         = $(FSRCS:.f=.o)
+
+# C Objects
+
+COBJS         = $(CSRCS:.c=.o)
+
+# C++ Objects
+
+OBJS          = $(patsubst %.cxx,tgt_$(ALICE_TARGET)/%.o,$(SRCS)) $(DICTO)
+
+# C++ compilation flags
+
+CXXFLAGS      = $(CXXOPTS) -I$(ROOTSYS)/include -I. -I$(ALICE_ROOT)/include/
+# FORTRAN compilation flags
+
+FFLAGS      = $(FOPT)
+
+##### TARGETS #####
+# Target
+
+SLIBRARY       = $(LIBDIR)/libGEODB.$(SL)
+ALIBRARY       = $(LIBDIR)/libGEODB.a
+
+default:       $(SLIBRARY) headers
+
+$(LIBDIR)/libGEODB.$(SL):      $(OBJS)
+
+$(DICT):                       $(HDRS)
+
+depend:                                $(SRCS)
+
+TOCLEAN                        = $(OBJS) *Cint.cxx *Cint.h
+
+############################### General Macros ################################
+
+include $(ALICE_ROOT)/conf/GeneralMacros
+
+############################ Dependencies #####################################
+
+-include Make-depend 
diff --git a/GEODB/geotest.C b/GEODB/geotest.C
new file mode 100644 (file)
index 0000000..cc9bf86
--- /dev/null
@@ -0,0 +1,207 @@
+/**********************************************/
+/*                                            */
+/* FILE: geotest.C                            */
+/* PURPOSE: To "experiment" with geometric's  */
+/*          databases and ROOT.               */
+/* LANGUAGE: C++                              */
+/* COMPILER: CC for HP-UX 9.x and 10.         */
+/* AUTHOR: Joana && David                     */
+/* DATE: December 2, 1998                     */
+/* ADDRESS: jesanto@cern.ch, dcollado@cern.ch */
+/*                                            */
+/**********************************************/
+
+geotest () {
+    gSystem->Load("./libGEODB");
+    AliGBox* box1 = new AliGBox("box1", "box1", 0.2, 0.2, 0.2);
+    AliGMaterial *mat1 = new AliGMaterial("mat1", "mat1", 2.3,4.5,6.7);
+    AliGNode *node1 = new AliGNode("Node1", 1, "My first node", box1, mat1 );
+
+    AliGBox* box2 = new AliGBox("box2", "box2", 0.3,0.3,0.3);
+
+    AliGTube* tube = new AliGTube("tube", "tube", 0.150,0.200,0.400);
+    AliGMaterial *mat2 = new AliGMaterial("mat2", "mat2", 1.3,7.5,8.7);
+    AliGNode *node2 = new AliGNode("Node2", 2, "My second node", /*tube*/ box2, mat2);
+
+    //AliGBox* box3 = new AliGBox("box3", "box3", 3.0,2.0,4.0);
+    AliGSphere* sphere = new AliGSphere("sphere", "sphere", 0.25);
+    AliGMaterial *mat3 = new AliGMaterial("mat3", "mat3", 0.3,3.5,2.7);
+    //AliGNode *node3 = new AliGNode("Node3", 3, "My third node", box3, mat3);
+    AliGNode *node3 = new AliGNode("Node3", 3, "My third node", sphere, mat3);
+
+    //AliGBox* box4 = new AliGBox("box4", "box4", 4.0,2.0,6.0);
+    AliGCone* cone = new AliGCone("cone", "cone", 0.05,0.07,0.12,0.15,0.1);
+    AliGMaterial *mat4 = new AliGMaterial("mat4", "mat4", 0.4,3.2,8.7);
+    //AliGNode *node4 = new AliGNode("Node4", 4, "My fourth node", box4, mat4);
+    AliGNode *node4 = new AliGNode("Node4", 4, "My fourth node", cone, mat4);
+
+    AliGTransform *tran1 = new AliGTransform("tran1","tran1","tra 1. 0. 0.");
+    AliGTransform *tran2 = new AliGTransform("tran2","tran2","tra 0.5 0. 0.");
+    AliGTransform *tran3 = new AliGTransform("tran3","tran3","tra 0.25 0. 0.");
+
+    node1->Add(node2,tran1);       // TUBE
+    node1->Add(node2,tran2);//
+    node1->Add(node3,tran1);//
+    node1->Add(node3,tran2);       // SPHERE
+    node2->Add(node4,tran1);//
+    node2->Add(node4,tran2);       // CONE
+    node2->Add(node4,tran3);//
+
+    node1->AddConfig("config1","config1","coarse",981201,991201);
+    node2->AddConfig("config2","config2","detail",981201,991201);
+    node3->AddConfig("config3","config3","",981201,991201);
+    node4->AddConfig("config4","config4","",981201,991201);
+    
+    AliGeometry* geom1 = new AliGeometry( "geom1", "geom1", node1, 0 ); /* Build geometry in memory from Node1 */
+    
+    TFile* file = new TFile( "AliGeoDB.root", "RECREATE","Alice Geometry Database");
+    
+    node1->SaveAll( file ); /* Memory tree structure saved in disk */
+    
+    
+    file->Close();
+
+    TFile* file = new TFile( "AliGeoDB.root", "UPDATE" );
+
+    AliGeometry* geom1 = new AliGeometry( "geom1", "geom1", node1, 0 ); /* Build geometry in memory from Node1 */
+
+    geom1->Write(); /* Save geometry in disk */
+    file->Write();
+   
+    file->Close();  /* Everything saved in disk */
+    file = new TFile("AliGeoDB.root","read");
+     a = TBrowser() ;
+    printf( " The end of geotest.C \n" );
+
+    //if( geom1 ) delete geom1;
+    //if( node4 ) delete node4;
+    //if( node3 ) delete node3;
+    //if( node2 ) delete node2;
+    //if( node1 ) delete node1;
+
+
+    //AliGeometry* geom3  = new AliGeometry();
+    /* Retrieve the memory tree structure from AliGeoDB.root and stores it in memory, being new_tree the top node */
+    //AliGNode* tree_root = new AliGNode(geom3->FileToMemTree( "AliGeoDB.root", "geom1" ));
+
+    //TFile* file2 = new TFile( "AliGeoDB2.root", "RECREATE","Alice Geometry Database");
+    //tree_root->SaveAll( file2 ); /* Memory tree structure saved in disk (second time) */
+
+    
+    //TFile* file = new TFile( "AliGeoDB.root", "READ" );
+    
+    //AliGeometry* geom2 = new AliGeometry((AliGeometry*) file->Get("geom1"));
+    //file->Close();
+    //file2->cd();
+    //geom2.Write();
+    //file2->Write();
+    //file2->Close();
+
+    //gROOT->Reset();
+    //file3 = new TFile( "AliGeoDB.root", "READ" );
+    //file4 = new TFile( "AliGeoDB2.root", "READ" );
+    //a = TBrowser();
+
+    //gPad->Update();
+
+
+
+
+
+
+
+
+
+    /*    AliGNode *obj;
+
+    TIter next(gPad->GetListOfPrimitives());
+    while (obj = (AliGNode*)next()) {
+        if(obj.GetShape()->Is3D()) {
+            obj.GetShape()->Sizeof3D();
+           printf("\n It is a 3D Object\n");
+            printf("Total size of x3d primitives:\n");
+            Size3D size = obj.GetShape()->GetSize3D();
+            printf("     gSize3D.numPoints=%d\n", size.numPoints);
+            //printf("     gSize3D.numSegs  =%d\n", gPad->gSize3D.numSegs);
+            //printf("     gSize3D.numPolys =%d\n", gSize3D.numPolys);
+        }
+        else
+           printf("\n It's not a 3D Object\n");
+    }
+
+    gPad->x3d();*/
+
+    /*
+    c1 = new TCanvas("c1","Common Shapes.",0,0,1202,846);
+    c1->Range(0,0,1,1);
+    c1->SetFillColor(32); // Light Green
+    c1->SetBorderSize(3);
+    c1->SetBorderMode(0); // -1 (down) 0 (no) 1 (up)
+
+    // Create a TitleBar in Main Window
+    title = new TPaveLabel(0.3,0.93,0.7,0.98,"View Of Different Shapes");
+    title->SetFillColor(34); // Grey
+    title->Draw();
+
+    // Text for Pads
+    TText *t = new TText();
+    t->SetTextFont(32); // Light Green
+    t->SetTextColor(1); // Black
+    t->SetTextSize(0.03);
+    t->DrawText( 0.19, 0.89, "AliGBox" );
+    t->DrawText( 0.70, 0.89, "AliGSphere" );
+    t->DrawText( 0.19, 0.43, "AliGTube" );
+    t->DrawText( 0.70, 0.43, "AliGCone" );
+
+    // Define and Draw Pads of Main Window
+    Pad1 = new TPad("Pad1","AliGBox Shape",0.05,0.48,0.45,0.88,28);
+    Pad1->SetFillColor(34); // Grey
+    Pad2 = new TPad("Pad2","AliGSphere Shape",0.55,0.48,0.95,0.88,28);
+    Pad2->SetFillColor(34); // Grey
+    Pad3 = new TPad("Pad3","AliGTube Shape",0.05,0.02,0.45,0.42,28);
+    Pad3->SetFillColor(34); // Grey
+    Pad4 = new TPad("Pad4","AliGCone Shape",0.55,0.02,0.95,0.42,28);
+    Pad4->SetFillColor(34); // Grey
+    Pad1->Draw();
+    Pad2->Draw();
+    Pad3->Draw();
+    Pad4->Draw();
+
+    //  Define some volumes
+    AliGTube* tube = new AliGTube("tube", "tube", 150,200,400);
+    AliGCone* cone = new AliGCone("cone", "cone", 50,70,120,100,150);
+    AliGSphere* sphere = new AliGSphere("sphere", "sphere", 75);
+    AliGThorus* thorus = new AliGThorus("thorus", "thorus", 150,200,400);
+    
+    //  Set shapes attributes
+    box1->SetLineColor(2);  // Red
+    sphere->SetLineColor(4); // Blue
+    tube->SetLineColor(3); // Bright Green
+    cone->SetLineColor(5); // Yellow
+    thorus->SetLineColor(2);  // Red
+
+    // Draw inside Pad1
+    Pad1->cd(); // Set current pad
+    box1->Draw();
+
+    // Draw inside Pad2
+    Pad2->cd(); //Set current Pad
+    sphere->Draw();
+
+    // Draw inside Pad3
+    Pad3->cd(); //Set current Pad
+    tube->Draw();
+
+    // Draw inside Pad4
+    Pad4->cd(); //Set current Pad
+    cone->Draw();
+
+    c1->cd();
+    c1->Update();  // Update Canvas
+    */
+}
+
+
+
diff --git a/GEODB/html.C b/GEODB/html.C
new file mode 100644 (file)
index 0000000..069f6f6
--- /dev/null
@@ -0,0 +1,12 @@
+{
+// to run this macro, you must have the correct .rootrc file
+// in your galice directory.
+// The gAlice classes summary documentation go to directory html
+// The gAlice classes source  documentation go to directory html/src
+// The example macros documentation go to directory html/examples
+   
+   gSystem->Load("./libGeoAlice.so"); 
+   THtml html;
+   html.MakeAll(1);
+
+}