ROOT logo
// @(#)root/geom:$Id: TGeoHype.h 24879 2008-07-18 08:04:40Z brun $
// Author: Mihaela Gheata   20/11/04

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGeoHype
#define ROOT_TGeoHype

#ifndef ROOT_TGeoTube
#include "TGeoTube.h"
#endif

///////////////////////////////////////////////////////////////////////////////
//                                                                        
// TGeoHype - Hyperboloid class defined by 5 parameters. Bounded by:
//            - Two z planes at z=+/-dz
//            - Inner and outer lateral surfaces. These represent the surfaces 
//              described by the revolution of 2 hyperbolas about the Z axis:
//               r^2 - (t*z)^2 = a^2
//
//            r = distance between hyperbola and Z axis at coordinate z
//            t = tangent of the stereo angle (angle made by hyperbola
//                asimptotic lines and Z axis). t=0 means cylindrical surface.
//            a = distance between hyperbola and Z axis at z=0
//
//          The inner hyperbolic surface is described by:
//              r^2 - (tin*z)^2 = rin^2 
//           - absence of the inner surface (filled hyperboloid can be forced 
//             by rin=0 and sin=0
//          The outer hyperbolic surface is described by:
//              r^2 - (tout*z)^2 = rout^2
//  TGeoHype parameters: dz[cm], rin[cm], sin[deg], rout[cm], sout[deg].
//    MANDATORY conditions:
//           - rin < rout
//           - rout > 0
//           - rin^2 + (tin*dz)^2 > rout^2 + (tout*dz)^2
//                                                                        
///////////////////////////////////////////////////////////////////////////////


class TGeoHype : public TGeoTube
{
protected :
// data members inherited from TGeoTube:
//   Double_t              fRmin; // inner radius at z=0
//   Double_t              fRmax; // outer radius at z=0
//   Double_t              fDz;   // half length
   Double_t              fStIn;   // Stereo angle for inner surface
   Double_t              fStOut;  // Stereo angle for inner surface

private :
// Precomputed parameters:
   Double_t              fTin;    // Tangent of stereo angle for inner surface
   Double_t              fTout;   // Tangent of stereo angle for outer surface
   Double_t              fTinsq;  // Squared tangent of stereo angle for inner surface
   Double_t              fToutsq; // Squared tangent of stereo angle for outer surface

public:
   // constructors
   TGeoHype();
   TGeoHype(Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz);
   TGeoHype(const char *name, Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz);
   TGeoHype(Double_t *params);
   // destructor
   virtual ~TGeoHype();
   // methods

   virtual Double_t      Capacity() const;
   virtual void          ComputeBBox();
   virtual void          ComputeNormal(Double_t *point, Double_t *dir, Double_t *norm);
   virtual Bool_t        Contains(Double_t *point) const;
   virtual Double_t      DistFromInside(Double_t *point, Double_t *dir, Int_t iact=1, 
                                   Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
   virtual Double_t      DistFromOutside(Double_t *point, Double_t *dir, Int_t iact=1, 
                                   Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
   Int_t                 DistToHype(Double_t *point, Double_t *dir, Double_t *s, Bool_t inner) const;
   virtual Int_t         DistancetoPrimitive(Int_t px, Int_t py);
   virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
                                Double_t start, Double_t step);
   virtual Double_t      GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
   virtual void          GetBoundingCylinder(Double_t *param) const;
   virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
   virtual Int_t         GetByteCount() const {return 64;}
   virtual Bool_t        GetPointsOnSegments(Int_t /*npoints*/, Double_t * /*array*/) const {return kFALSE;}
   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
   virtual void          GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
   virtual Int_t         GetNmeshVertices() const;
   Double_t              GetStIn() const {return fStIn;}
   Double_t              GetStOut() const {return fStOut;}
   Bool_t                HasInner() const {return !TestShapeBit(kGeoRSeg);}
   Double_t              RadiusHypeSq(Double_t z, Bool_t inner) const;
   Double_t              ZHypeSq(Double_t r, Bool_t inner) const;
   virtual void          InspectShape() const;
   virtual Bool_t        IsCylType() const {return kTRUE;}
   virtual TBuffer3D    *MakeBuffer3D() const;
   //virtual void          Paint(Option_t *option);
   virtual Double_t      Safety(Double_t *point, Bool_t in=kTRUE) const;
   Double_t              SafetyToHype(Double_t *point, Bool_t inner, Bool_t in) const;
   virtual void          SavePrimitive(ostream &out, Option_t *option = "");
   void                  SetHypeDimensions(Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz);
   virtual void          SetDimensions(Double_t *param);
   virtual void          SetPoints(Double_t *points) const;
   virtual void          SetPoints(Float_t *points) const;
   virtual void          SetSegsAndPols(TBuffer3D &buff) const;
   virtual void          Sizeof3D() const;

   ClassDef(TGeoHype, 1)         // hyperboloid class

};

#endif
 TGeoHype.h:1
 TGeoHype.h:2
 TGeoHype.h:3
 TGeoHype.h:4
 TGeoHype.h:5
 TGeoHype.h:6
 TGeoHype.h:7
 TGeoHype.h:8
 TGeoHype.h:9
 TGeoHype.h:10
 TGeoHype.h:11
 TGeoHype.h:12
 TGeoHype.h:13
 TGeoHype.h:14
 TGeoHype.h:15
 TGeoHype.h:16
 TGeoHype.h:17
 TGeoHype.h:18
 TGeoHype.h:19
 TGeoHype.h:20
 TGeoHype.h:21
 TGeoHype.h:22
 TGeoHype.h:23
 TGeoHype.h:24
 TGeoHype.h:25
 TGeoHype.h:26
 TGeoHype.h:27
 TGeoHype.h:28
 TGeoHype.h:29
 TGeoHype.h:30
 TGeoHype.h:31
 TGeoHype.h:32
 TGeoHype.h:33
 TGeoHype.h:34
 TGeoHype.h:35
 TGeoHype.h:36
 TGeoHype.h:37
 TGeoHype.h:38
 TGeoHype.h:39
 TGeoHype.h:40
 TGeoHype.h:41
 TGeoHype.h:42
 TGeoHype.h:43
 TGeoHype.h:44
 TGeoHype.h:45
 TGeoHype.h:46
 TGeoHype.h:47
 TGeoHype.h:48
 TGeoHype.h:49
 TGeoHype.h:50
 TGeoHype.h:51
 TGeoHype.h:52
 TGeoHype.h:53
 TGeoHype.h:54
 TGeoHype.h:55
 TGeoHype.h:56
 TGeoHype.h:57
 TGeoHype.h:58
 TGeoHype.h:59
 TGeoHype.h:60
 TGeoHype.h:61
 TGeoHype.h:62
 TGeoHype.h:63
 TGeoHype.h:64
 TGeoHype.h:65
 TGeoHype.h:66
 TGeoHype.h:67
 TGeoHype.h:68
 TGeoHype.h:69
 TGeoHype.h:70
 TGeoHype.h:71
 TGeoHype.h:72
 TGeoHype.h:73
 TGeoHype.h:74
 TGeoHype.h:75
 TGeoHype.h:76
 TGeoHype.h:77
 TGeoHype.h:78
 TGeoHype.h:79
 TGeoHype.h:80
 TGeoHype.h:81
 TGeoHype.h:82
 TGeoHype.h:83
 TGeoHype.h:84
 TGeoHype.h:85
 TGeoHype.h:86
 TGeoHype.h:87
 TGeoHype.h:88
 TGeoHype.h:89
 TGeoHype.h:90
 TGeoHype.h:91
 TGeoHype.h:92
 TGeoHype.h:93
 TGeoHype.h:94
 TGeoHype.h:95
 TGeoHype.h:96
 TGeoHype.h:97
 TGeoHype.h:98
 TGeoHype.h:99
 TGeoHype.h:100
 TGeoHype.h:101
 TGeoHype.h:102
 TGeoHype.h:103
 TGeoHype.h:104
 TGeoHype.h:105
 TGeoHype.h:106
 TGeoHype.h:107
 TGeoHype.h:108
 TGeoHype.h:109
 TGeoHype.h:110
 TGeoHype.h:111
 TGeoHype.h:112
 TGeoHype.h:113
 TGeoHype.h:114
 TGeoHype.h:115
 TGeoHype.h:116
 TGeoHype.h:117