| 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: G4Cons.icc,v 1.6 2006/10/19 15:33:37 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: HEAD $
|
|---|
| 29 | //
|
|---|
| 30 | // --------------------------------------------------------------------
|
|---|
| 31 | // GEANT 4 inline definitions file
|
|---|
| 32 | //
|
|---|
| 33 | // G4Cons.icc
|
|---|
| 34 | //
|
|---|
| 35 | // Implementation of inline methods of G4Cons
|
|---|
| 36 | // --------------------------------------------------------------------
|
|---|
| 37 |
|
|---|
| 38 | inline
|
|---|
| 39 | G4double G4Cons::GetInnerRadiusMinusZ() const
|
|---|
| 40 | {
|
|---|
| 41 | return fRmin1 ;
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | inline
|
|---|
| 45 | G4double G4Cons::GetOuterRadiusMinusZ() const
|
|---|
| 46 | {
|
|---|
| 47 | return fRmax1 ;
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | inline
|
|---|
| 51 | G4double G4Cons::GetInnerRadiusPlusZ() const
|
|---|
| 52 | {
|
|---|
| 53 | return fRmin2 ;
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | inline
|
|---|
| 57 | G4double G4Cons::GetOuterRadiusPlusZ() const
|
|---|
| 58 | {
|
|---|
| 59 | return fRmax2 ;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | inline
|
|---|
| 63 | G4double G4Cons::GetZHalfLength() const
|
|---|
| 64 | {
|
|---|
| 65 | return fDz ;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | inline
|
|---|
| 69 | G4double G4Cons::GetStartPhiAngle() const
|
|---|
| 70 | {
|
|---|
| 71 | return fSPhi ;
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | inline
|
|---|
| 75 | G4double G4Cons::GetDeltaPhiAngle() const
|
|---|
| 76 | {
|
|---|
| 77 | return fDPhi;
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | inline
|
|---|
| 81 | void G4Cons::SetInnerRadiusMinusZ( G4double Rmin1 )
|
|---|
| 82 | {
|
|---|
| 83 | fRmin1= Rmin1 ;
|
|---|
| 84 | fCubicVolume= 0.;
|
|---|
| 85 | fSurfaceArea= 0.;
|
|---|
| 86 | fpPolyhedron = 0;
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | inline
|
|---|
| 90 | void G4Cons::SetOuterRadiusMinusZ( G4double Rmax1 )
|
|---|
| 91 | {
|
|---|
| 92 | fRmax1= Rmax1 ;
|
|---|
| 93 | fCubicVolume= 0.;
|
|---|
| 94 | fSurfaceArea= 0.;
|
|---|
| 95 | fpPolyhedron = 0;
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | inline
|
|---|
| 99 | void G4Cons::SetInnerRadiusPlusZ ( G4double Rmin2 )
|
|---|
| 100 | {
|
|---|
| 101 | fRmin2= Rmin2 ;
|
|---|
| 102 | fCubicVolume= 0.;
|
|---|
| 103 | fSurfaceArea= 0.;
|
|---|
| 104 | fpPolyhedron = 0;
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | inline
|
|---|
| 108 | void G4Cons::SetOuterRadiusPlusZ ( G4double Rmax2 )
|
|---|
| 109 | {
|
|---|
| 110 | fRmax2= Rmax2 ;
|
|---|
| 111 | fCubicVolume= 0.;
|
|---|
| 112 | fSurfaceArea= 0.;
|
|---|
| 113 | fpPolyhedron = 0;
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | inline
|
|---|
| 117 | void G4Cons::SetZHalfLength ( G4double newDz )
|
|---|
| 118 | {
|
|---|
| 119 | fDz= newDz ;
|
|---|
| 120 | fCubicVolume= 0.;
|
|---|
| 121 | fSurfaceArea= 0.;
|
|---|
| 122 | fpPolyhedron = 0;
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | inline
|
|---|
| 126 | void G4Cons::SetStartPhiAngle ( G4double newSPhi )
|
|---|
| 127 | {
|
|---|
| 128 | fSPhi= newSPhi;
|
|---|
| 129 | fCubicVolume= 0.;
|
|---|
| 130 | fSurfaceArea= 0.;
|
|---|
| 131 | fpPolyhedron = 0;
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | void G4Cons::SetDeltaPhiAngle ( G4double newDPhi )
|
|---|
| 135 | {
|
|---|
| 136 | fDPhi= newDPhi;
|
|---|
| 137 | fCubicVolume= 0.;
|
|---|
| 138 | fSurfaceArea= 0.;
|
|---|
| 139 | fpPolyhedron = 0;
|
|---|
| 140 | }
|
|---|
| 141 |
|
|---|
| 142 | // Old access methods ...
|
|---|
| 143 |
|
|---|
| 144 | inline
|
|---|
| 145 | G4double G4Cons::GetRmin1() const
|
|---|
| 146 | {
|
|---|
| 147 | return GetInnerRadiusMinusZ();
|
|---|
| 148 | }
|
|---|
| 149 |
|
|---|
| 150 | inline
|
|---|
| 151 | G4double G4Cons::GetRmax1() const
|
|---|
| 152 | {
|
|---|
| 153 | return GetOuterRadiusMinusZ();
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 | inline
|
|---|
| 157 | G4double G4Cons::GetRmin2() const
|
|---|
| 158 | {
|
|---|
| 159 | return GetInnerRadiusPlusZ();
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | inline
|
|---|
| 163 | G4double G4Cons::GetRmax2() const
|
|---|
| 164 | {
|
|---|
| 165 | return GetOuterRadiusPlusZ();
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | inline
|
|---|
| 169 | G4double G4Cons::GetDz() const
|
|---|
| 170 | {
|
|---|
| 171 | return GetZHalfLength();
|
|---|
| 172 | }
|
|---|
| 173 |
|
|---|
| 174 | inline
|
|---|
| 175 | G4double G4Cons::GetSPhi() const
|
|---|
| 176 | {
|
|---|
| 177 | return GetStartPhiAngle();
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 | inline
|
|---|
| 181 | G4double G4Cons::GetDPhi() const
|
|---|
| 182 | {
|
|---|
| 183 | return GetDeltaPhiAngle();
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| 186 | inline
|
|---|
| 187 | G4double G4Cons::GetCubicVolume()
|
|---|
| 188 | {
|
|---|
| 189 | if(fCubicVolume != 0.) {;}
|
|---|
| 190 | else
|
|---|
| 191 | {
|
|---|
| 192 | G4double Rmean, rMean, deltaR, deltar;
|
|---|
| 193 |
|
|---|
| 194 | Rmean = 0.5*(fRmax1+fRmax2);
|
|---|
| 195 | deltaR = fRmax1-fRmax2;
|
|---|
| 196 |
|
|---|
| 197 | rMean = 0.5*(fRmin1+fRmin2);
|
|---|
| 198 | deltar = fRmin1-fRmin2;
|
|---|
| 199 | fCubicVolume = fDPhi*fDz*(Rmean*Rmean-rMean*rMean
|
|---|
| 200 | +(deltaR*deltaR-deltar*deltar)/12);
|
|---|
| 201 | }
|
|---|
| 202 | return fCubicVolume;
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | inline
|
|---|
| 206 | G4double G4Cons::GetSurfaceArea()
|
|---|
| 207 | {
|
|---|
| 208 | if(fSurfaceArea != 0.) {;}
|
|---|
| 209 | else
|
|---|
| 210 | {
|
|---|
| 211 | G4double mmin, mmax, dmin, dmax;
|
|---|
| 212 |
|
|---|
| 213 | mmin= (fRmin1+fRmin2)*0.5;
|
|---|
| 214 | mmax= (fRmax1+fRmax2)*0.5;
|
|---|
| 215 | dmin= (fRmin2-fRmin1);
|
|---|
| 216 | dmax= (fRmax2-fRmax1);
|
|---|
| 217 |
|
|---|
| 218 | fSurfaceArea = fDPhi*( mmin * std::sqrt(dmin*dmin+4*fDz*fDz)
|
|---|
| 219 | + mmax * std::sqrt(dmax*dmax+4*fDz*fDz)
|
|---|
| 220 | + 0.5*(fRmax1*fRmax1-fRmin1*fRmin1
|
|---|
| 221 | +fRmax2*fRmax2-fRmin2*fRmin2 ));
|
|---|
| 222 | if(fDPhi < twopi )
|
|---|
| 223 | {
|
|---|
| 224 | fSurfaceArea = fSurfaceArea+4*fDz*(mmax-mmin);
|
|---|
| 225 | }
|
|---|
| 226 | }
|
|---|
| 227 | return fSurfaceArea;
|
|---|
| 228 | }
|
|---|