Geant4  10.02.p02
G4Para.icc
Go to the documentation of this file.
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 83572 2014-09-01 15:23:27Z gcosmo $
28 //
29 // --------------------------------------------------------------------
30 // GEANT 4 inline definitions file
31 //
32 // G4Para.icc
33 //
34 // Implementation of inline methods of G4Para
35 // --------------------------------------------------------------------
36 
37 inline
38 G4double G4Para::GetZHalfLength() const
39 {
40  return fDz ;
41 }
42 
43 inline
44 G4ThreeVector G4Para::GetSymAxis() const
45 {
46  G4double cosTheta = 1.0/std::sqrt(1+fTthetaCphi*fTthetaCphi +
47  fTthetaSphi*fTthetaSphi) ;
48 
49  return G4ThreeVector(fTthetaCphi*cosTheta,
50  fTthetaSphi*cosTheta,
51  cosTheta) ;
52 }
53 
54 inline
55 G4double G4Para::GetYHalfLength() const
56 {
57  return fDy ;
58 }
59 
60 inline
61 G4double G4Para::GetXHalfLength() const
62 {
63  return fDx ;
64 }
65 
66 inline
67 G4double G4Para::GetTanAlpha() const
68 {
69  return fTalpha ;
70 }
71 
72 inline
73 void G4Para::SetXHalfLength(G4double val)
74 {
75  fDx= val;
76  fCubicVolume= 0.;
77  fSurfaceArea= 0.;
78  fRebuildPolyhedron = true;
79 }
80 
81 inline
82 void G4Para::SetYHalfLength(G4double val)
83 {
84  fDy= val;
85  fCubicVolume= 0.;
86  fSurfaceArea= 0.;
87  fRebuildPolyhedron = true;
88 }
89 
90 inline
91 void G4Para::SetZHalfLength(G4double val)
92 {
93  fDz= val;
94  fCubicVolume= 0.;
95  fSurfaceArea= 0.;
96  fRebuildPolyhedron = true;
97 }
98 
99 inline
100 void G4Para::SetAlpha(G4double alpha)
101 {
102  fTalpha= std::tan(alpha);
103  fSurfaceArea= 0.;
104  fCubicVolume= 0.;
105  fRebuildPolyhedron = true;
106 }
107 
108 inline
109 void G4Para::SetTanAlpha(G4double val)
110 {
111  fTalpha= val;
112  fCubicVolume= 0.;
113  fSurfaceArea= 0.;
114  fRebuildPolyhedron = true;
115 }
116 
117 inline
118 void G4Para::SetThetaAndPhi(double pTheta, double pPhi)
119 {
120  fTthetaCphi=std::tan(pTheta)*std::cos(pPhi);
121  fTthetaSphi=std::tan(pTheta)*std::sin(pPhi);
122  fCubicVolume= 0.;
123  fSurfaceArea= 0.;
124  fRebuildPolyhedron = true;
125 }
126 
127 inline
128 G4double G4Para::GetCubicVolume()
129 {
130  //
131  // It is like G4Box, since para transformations keep the volume to be const
132 
133  if(fCubicVolume != 0.) {;}
134  else fCubicVolume = 8*fDx*fDy*fDz;
135  return fCubicVolume;
136 }
137 
138 inline
139 G4double G4Para::GetSurfaceArea()
140 {
141  if(fSurfaceArea != 0.) {;}
142  else
143  {
144  fSurfaceArea = 8*(fDx*fDy
145  + fDx*fDz*std::sqrt(1+fTthetaSphi*fTthetaSphi)
146  + fDy*fDz*std::sqrt(1+fTalpha*fTalpha
147  +std::pow(fTthetaCphi-fTthetaSphi*fTalpha, 2)) );
148  }
149  return fSurfaceArea;
150 }