ROOT  6.06/09
Reference Guide
TCONS.cxx
Go to the documentation of this file.
1 // @(#)root/g3d:$Id$
2 // Author: Nenad Buncic 18/09/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TCONS.h"
13 #include "TNode.h"
14 
16 
17 /** \class TCONS
18 \ingroup g3d
19 A segment of a conical tube.
20 
21 \image html g3d_cons.png
22 
23 It has 10 parameters:
24 
25  - name: name of the shape
26  - title: shape's title
27  - material: (see TMaterial)
28  - dz: half-length in z
29  - rmin1: inside radius at -DZ in z
30  - rmax1: outside radius at -DZ in z
31  - rmin2: inside radius at +DZ in z
32  - rmax2: outside radius at +DZ in z
33  - phi1: starting angle of the segment
34  - phi2: ending angle of the segment
35 
36 NOTE: phi1 should be smaller than phi2. If this is not the case,
37  the system adds 360 degrees to phi2.
38 */
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// CONS shape default constructor
42 
43 TCONS::TCONS()
44 {
45  fRmin2 = 0.;
46  fRmax2 = 0.;
47 }
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 /// CONS shape normal constructor
51 
52 TCONS::TCONS(const char *name, const char *title, const char *material, Float_t dz, Float_t rmin1, Float_t rmax1, Float_t rmin2, Float_t rmax2,
53  Float_t phi1, Float_t phi2)
54  : TTUBS(name,title,material,rmin1,rmax1,dz,phi1,phi2)
55 {
56  fRmin2 = rmin2;
57  fRmax2 = rmax2;
58 }
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// CONS shape normal constructor
62 
63 TCONS::TCONS(const char *name, const char *title, const char *material, Float_t rmax1, Float_t dz
64  , Float_t phi1, Float_t phi2, Float_t rmax2)
65  : TTUBS(name,title,material,rmax1,dz,phi1,phi2)
66 {
67  fRmin2 = 0;
68  fRmax2 = rmax2;
69 }
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// CONS shape default destructor
73 
75 {
76 }
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// Create CONS points
80 
82 {
83  Int_t j, n;
84  Float_t rmin1, rmax1, dz;
85 
86  n = GetNumberOfDivisions()+1;
87 
88  rmin1 = TTUBE::fRmin;
89  rmax1 = TTUBE::fRmax;
90  dz = TTUBE::fDz;
91 
92  Int_t indx = 0;
93 
94  if (!fCoTab) MakeTableOfCoSin();
95 
96  if (points) {
97  for (j = 0; j < n; j++) {
98  points[indx++] = rmin1 * fCoTab[j];
99  points[indx++] = rmin1 * fSiTab[j];
100  points[indx++] = -dz;
101  }
102  for (j = 0; j < n; j++) {
103  points[indx++] = rmax1 * fCoTab[j];
104  points[indx++] = rmax1 * fSiTab[j];
105  points[indx++] = -dz;
106  }
107  for (j = 0; j < n; j++) {
108  points[indx++] = fRmin2 * fCoTab[j];
109  points[indx++] = fRmin2 * fSiTab[j];
110  points[indx++] = dz;
111  }
112  for (j = 0; j < n; j++) {
113  points[indx++] = fRmax2 * fCoTab[j];
114  points[indx++] = fRmax2 * fSiTab[j];
115  points[indx++] = dz;
116  }
117  }
118 }
A segment of a conical tube.
Definition: TCONS.h:29
float Float_t
Definition: RtypesCore.h:53
int Int_t
Definition: RtypesCore.h:41
Float_t fDz
Definition: TTUBE.h:40
Float_t fRmin2
Definition: TCONS.h:32
Float_t fRmax2
Definition: TCONS.h:33
point * points
Definition: X3DBuffer.c:20
Float_t fRmax
Definition: TTUBE.h:38
virtual ~TCONS()
CONS shape default destructor.
Definition: TCONS.cxx:74
Float_t fRmin
Definition: TTUBE.h:37
#define ClassImp(name)
Definition: Rtypes.h:279
double Double_t
Definition: RtypesCore.h:55
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual void MakeTableOfCoSin() const
Make table of sine and cosine.
Definition: TTUBS.cxx:80
const Int_t n
Definition: legend1.C:16
Double_t * fSiTab
Definition: TTUBE.h:46
virtual Int_t GetNumberOfDivisions() const
Definition: TTUBE.h:69
Double_t * fCoTab
Table of sin(fPhi1) .... sin(fPhil+fDphi1)
Definition: TTUBE.h:47
A segment of a tube.
Definition: TTUBS.h:31
virtual void SetPoints(Double_t *points) const
Create CONS points.
Definition: TCONS.cxx:81