source: trunk/source/geometry/solids/CSG/include/G4Para.icc @ 1119

Last change on this file since 1119 was 1058, checked in by garnier, 15 years ago

file release beta

File size: 3.9 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: G4Para.icc,v 1.7 2006/10/19 15:33:37 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30// --------------------------------------------------------------------
31// GEANT 4 inline definitions file
32//
33// G4Para.icc
34//
35// Implementation of inline methods of G4Para
36// --------------------------------------------------------------------
37
38inline
39G4double G4Para::GetZHalfLength() const
40{
41  return fDz ;
42}
43
44inline
45G4ThreeVector G4Para::GetSymAxis() const
46{
47  G4double cosTheta = 1.0/std::sqrt(1+fTthetaCphi*fTthetaCphi +
48                               fTthetaSphi*fTthetaSphi) ;
49
50  return G4ThreeVector(fTthetaCphi*cosTheta,
51                       fTthetaSphi*cosTheta,
52                       cosTheta) ;
53}
54
55inline
56G4double G4Para::GetYHalfLength() const
57{
58  return fDy ;
59}
60
61inline
62G4double G4Para::GetXHalfLength() const
63{
64  return fDx ;
65}
66
67inline
68G4double G4Para::GetTanAlpha() const
69{
70  return fTalpha ;
71}
72   
73inline
74void G4Para::SetXHalfLength(G4double val)
75{
76  fDx= val;
77  fCubicVolume= 0.;
78  fSurfaceArea= 0.;
79  fpPolyhedron = 0;
80}
81
82inline
83void G4Para::SetYHalfLength(G4double val)
84{
85  fDy= val;
86  fCubicVolume= 0.;
87  fSurfaceArea= 0.;
88  fpPolyhedron = 0;
89}
90
91inline
92void G4Para::SetZHalfLength(G4double val)
93{
94  fDz= val;
95  fCubicVolume= 0.;
96  fSurfaceArea= 0.;
97  fpPolyhedron = 0;
98}
99
100inline
101void G4Para::SetAlpha(G4double alpha)
102{
103  fTalpha= std::tan(alpha);
104  fSurfaceArea= 0.;
105  fCubicVolume= 0.;
106  fpPolyhedron = 0;
107}
108
109inline
110void G4Para::SetTanAlpha(G4double val)
111{
112  fTalpha= val;
113  fCubicVolume= 0.;
114  fSurfaceArea= 0.;
115  fpPolyhedron = 0;
116}
117
118inline
119void G4Para::SetThetaAndPhi(double pTheta, double pPhi)   
120{
121  fTthetaCphi=std::tan(pTheta)*std::cos(pPhi);
122  fTthetaSphi=std::tan(pTheta)*std::sin(pPhi);
123  fCubicVolume= 0.;
124  fSurfaceArea= 0.;
125  fpPolyhedron = 0;
126}
127
128inline
129G4double G4Para::GetCubicVolume()
130{
131  //
132  // It is like G4Box, since para transformations keep the volume to be const
133
134  if(fCubicVolume != 0.) {;}
135  else   fCubicVolume = 8*fDx*fDy*fDz;
136  return fCubicVolume;
137}
138
139inline
140G4double G4Para::GetSurfaceArea()
141{
142  if(fSurfaceArea != 0.) {;}
143  else
144  { 
145     fSurfaceArea = 8*(fDx*fDy
146                     + fDx*fDz*std::sqrt(1+fTthetaSphi*fTthetaSphi)
147                     + fDy*fDz*std::sqrt(1+fTalpha*fTalpha
148                              +std::pow(fTthetaCphi-fTthetaSphi*fTalpha, 2)) );
149  }
150  return fSurfaceArea;
151}
Note: See TracBrowser for help on using the repository browser.