Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:30:25

0001 // @(#)root/g3d:$Id$
0002 // Author: Nenad Buncic   18/09/95
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TTUBE
0013 #define ROOT_TTUBE
0014 
0015 
0016 ////////////////////////////////////////////////////////////////////////////
0017 //                                                                        //
0018 // TTUBE                                                                  //
0019 //                                                                        //
0020 // This tube has 3 parameters, the inside radius, the outside radius, and //
0021 // the half length in z. Optional parameter is number of segments, also   //
0022 // known as precision (default value is 20).                              //
0023 //                                                                        //
0024 ////////////////////////////////////////////////////////////////////////////
0025 
0026 #include "TShape.h"
0027 
0028 
0029 const Int_t kDivNum = 20;               //default number of divisions
0030 
0031 
0032 class TTUBE : public TShape {
0033 protected:
0034 
0035    Float_t fRmin;        // ellipse  semi-axis   in  X inside
0036    Float_t fRmax;        // ellipse  semi-axis   in  X outside
0037 
0038    Float_t fDz;          // half length in z
0039    Int_t   fNdiv;        // number of segments (precision)
0040 
0041    Float_t fAspectRatio; // defines  (the ellipse semi-axis in Y)/(the ellipse semi-axis in X)
0042 
0043    // Internal cache
0044    mutable Double_t   *fSiTab;   //! Table of sin(fPhi1) .... sin(fPhil+fDphi1)
0045    mutable Double_t   *fCoTab;   //! Table of cos(fPhi1) .... cos(fPhil+fDphi1)
0046 
0047    TTUBE(const TTUBE&);
0048    TTUBE& operator=(const TTUBE&);
0049 
0050    virtual void    MakeTableOfCoSin() const;  // Create the table of the fSiTab; fCoTab
0051    void    SetPoints(Double_t *points) const override;
0052    virtual void    SetSegsAndPols(TBuffer3D & buffer) const;
0053 
0054 public:
0055    TTUBE();
0056    TTUBE(const char *name, const char *title, const char *material, Float_t rmin, Float_t rmax, Float_t dz, Float_t aspect=1);
0057    TTUBE(const char *name, const char *title, const char *material, Float_t rmax, Float_t dz);
0058    ~TTUBE() override;
0059 
0060    Int_t   DistancetoPrimitive(Int_t px, Int_t py) override;
0061    const TBuffer3D &GetBuffer3D(Int_t reqSections) const override;
0062    virtual Float_t GetRmin() const  {return fRmin;}
0063    virtual Float_t GetRmax() const  {return fRmax;}
0064    virtual Float_t GetDz()   const  {return fDz;}
0065    virtual Int_t   GetNdiv() const  {return fNdiv;}
0066    virtual Float_t GetAspectRatio() const {return fAspectRatio;}
0067    virtual Int_t   GetNumberOfDivisions () const {if (fNdiv) return fNdiv; else return kDivNum;}
0068    virtual void    SetNumberOfDivisions (Int_t ndiv);
0069    virtual void    SetAspectRatio(Float_t factor=1){fAspectRatio = factor;}
0070    void    Sizeof3D() const override;
0071 
0072    ClassDefOverride(TTUBE,3)  //TUBE shape
0073 };
0074 
0075 #endif