TTRAP.cxx

Go to the documentation of this file.
00001 // @(#)root/g3d:$Id: TTRAP.cxx 31635 2009-12-08 10:35:17Z couet $
00002 // Author: Nenad Buncic   19/09/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "TTRAP.h"
00013 #include "TNode.h"
00014 #include "TMath.h"
00015 
00016 ClassImp(TTRAP)
00017 
00018 
00019 //______________________________________________________________________________
00020 // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/trap.gif"> </P> End_Html
00021 // TRAP is a general trapezoid. The faces perpendicular to z are trapezia and
00022 // their centres are not necessarily on a line parallel to the z axis.
00023 // This shape has 14 parameters.
00024 //
00025 //     - name       name of the shape
00026 //     - title      shape's title
00027 //     - material  (see TMaterial)
00028 //     - dz         half-length along the z axis
00029 //     - theta      polar angle of the line joining the centre of the face
00030 //                  at -DZ to the centre of the one at +DZ
00031 //     - phi        azimuthal angle of the line joining the centre of the face
00032 //                  at -DZ to the centre of the one at +DZ
00033 //     - h1         half-length along y of the face at -DZ
00034 //     - bl1        half-length along x of the side at -H1 in y of the face
00035 //                  at -DZ in z
00036 //     - tl1        half-length along x of the side at +H1 in y of the face
00037 //                  at -DZ in z
00038 //     - alpha1     angle with respect to the y axis from the centre of the
00039 //                  side at -H1 in y to the centre of the side at +H1 in y
00040 //                  of the face at -DZ in z
00041 //     - h2         half-length along y of the face at +DZ
00042 //     - bl2        half-length along x of the side at -H2 in y of the
00043 //                  face at +DZ in z
00044 //     - tl2        half-length along x of the side at +H2 in y of the face
00045 //                  at +DZ in z
00046 //     - alpha2     angle with respect to the y axis from the centre of the side
00047 //                  at -H2 in y to the centre of the side at +H2 in y of the
00048 //                  face at +DZ in z
00049 
00050 
00051 //______________________________________________________________________________
00052 TTRAP::TTRAP()
00053 {
00054    // TRAP shape default constructor
00055 
00056    fH1     = 0.;
00057    fBl1    = 0.;
00058    fTl1    = 0.;
00059    fAlpha1 = 0.;
00060    fH2     = 0.;
00061    fBl2    = 0.;
00062    fTl2    = 0.;
00063    fAlpha2 = 0.;
00064 }
00065 
00066 
00067 //______________________________________________________________________________
00068 TTRAP::TTRAP(const char *name, const char *title, const char *material, Float_t dz, Float_t theta, Float_t phi,
00069              Float_t h1, Float_t bl1, Float_t tl1, Float_t alpha1, Float_t h2,
00070              Float_t bl2, Float_t tl2, Float_t alpha2) : TBRIK(name, title,material,theta,phi,dz)
00071 {
00072    // TRAP shape normal constructor
00073 
00074    fH1     = h1;
00075    fBl1    = bl1;
00076    fTl1    = tl1;
00077    fAlpha1 = alpha1;
00078    fH2     = h2;
00079    fBl2    = bl2;
00080    fTl2    = tl2;
00081    fAlpha2 = alpha2;
00082 }
00083 
00084 
00085 //______________________________________________________________________________
00086 TTRAP::~TTRAP()
00087 {
00088    // TRAP shape default destructor
00089 }
00090 
00091 //______________________________________________________________________________
00092 void TTRAP::SetPoints(Double_t *points) const
00093 {
00094    // Create TRAP points
00095 
00096    const Float_t pi = Float_t (TMath::Pi());
00097    Float_t alpha1 = fAlpha1    * pi/180.0;
00098    Float_t alpha2 = fAlpha2    * pi/180.0;
00099    Float_t theta  = TBRIK::fDx * pi/180.0;
00100    Float_t phi    = TBRIK::fDy * pi/180.0;
00101    Float_t tth    = TMath::Tan(theta);
00102    Float_t tx     = tth*TMath::Cos(phi);
00103    Float_t ty     = tth*TMath::Sin(phi);
00104    Float_t tth1   = TMath::Tan(alpha1);
00105    Float_t tth2   = TMath::Tan(alpha2);
00106 
00107    if (points) {
00108       points[ 0] = -fDz*tx-tth1*fH1-fBl1 ; points[ 1] = -fH1-fDz*ty ; points[ 2] = -fDz;
00109       points[ 3] = -fDz*tx+tth1*fH1-fTl1 ; points[ 4] =  fH1-fDz*ty ; points[ 5] = -fDz;
00110       points[ 6] = -fDz*tx+tth1*fH1+fTl1 ; points[ 7] =  fH1-fDz*ty ; points[ 8] = -fDz;
00111       points[ 9] = -fDz*tx-tth1*fH1+fBl1 ; points[10] = -fH1-fDz*ty ; points[11] = -fDz;
00112       points[12] =  fDz*tx-tth2*fH2-fBl2 ; points[13] = -fH2+fDz*ty ; points[14] = fDz;
00113       points[15] =  fDz*tx+tth2*fH2-fTl2 ; points[16] =  fH2+fDz*ty ; points[17] = fDz;
00114       points[18] =  fDz*tx+tth2*fH2+fTl2 ; points[19] =  fH2+fDz*ty ; points[20] = fDz;
00115       points[21] =  fDz*tx-tth2*fH2+fBl2 ; points[22] = -fH2+fDz*ty ; points[23] = fDz;
00116    }
00117    
00118 }

Generated on Tue Jul 5 14:16:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1