Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:50

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // Implementation of inline methods of G4Paraboloid
0027 // --------------------------------------------------------------------
0028 
0029 inline 
0030 G4double G4Paraboloid::GetZHalfLength() const
0031 {
0032   return dz;
0033 }
0034 
0035 inline 
0036 G4double G4Paraboloid::GetRadiusPlusZ() const
0037 {
0038   return r2;
0039 }
0040 
0041 inline
0042 G4double G4Paraboloid::GetRadiusMinusZ() const
0043 {
0044   return r1;
0045 }
0046 
0047 inline
0048 void G4Paraboloid::SetZHalfLength(G4double pDz)
0049 {
0050   if(pDz <= 0)
0051   {
0052     G4Exception("G4Paraboloid::SetZHalfLength()", "GeomSolids0002", 
0053                 FatalException, "Invalid dimensions.");
0054   }
0055   else
0056   {
0057     dz = pDz;
0058     k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
0059     k2 = (sqr(r2) + sqr(r1)) / 2;
0060 
0061     // This informs GetSurfaceArea() and GetCubicVolume() that it needs
0062     // to recalculate buffered value.
0063     //
0064     fSurfaceArea = 0.; 
0065     fCubicVolume = 0.;
0066     fRebuildPolyhedron = true;
0067   }
0068 }
0069 
0070 inline
0071 void G4Paraboloid::SetRadiusPlusZ(G4double pR2)
0072 {
0073   if(pR2 <= 0 || pR2 <= r1)
0074   {
0075     G4Exception("G4Paraboloid::SetRadiusPlusZ()", "GeomSolids0002", 
0076                 FatalException, "Invalid dimensions.");
0077   }
0078   else
0079   {
0080     r2 = pR2;
0081     k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
0082     k2 = (sqr(r2) + sqr(r1)) / 2;
0083 
0084     // This informs GetSurfaceArea() and GetCubicVolume() that it needs
0085     // to recalculate buffered value.
0086     //
0087     fSurfaceArea = 0.; 
0088     fCubicVolume = 0.;
0089     fRebuildPolyhedron = true;
0090   }
0091 }
0092 
0093 inline
0094 void G4Paraboloid::SetRadiusMinusZ(G4double pR1)
0095 {
0096   if(pR1 < 0 || pR1 >= r2)
0097   {
0098     G4Exception("G4Paraboloid::SetRadiusMinusZ()", "GeomSolids0002", 
0099                 FatalException, "Invalid dimensions.");
0100   }
0101   else
0102   {
0103     r1 = pR1;
0104     k1 = (sqr(r2) - sqr(r1)) / (2 * dz);
0105     k2 = (sqr(r2) + sqr(r1)) / 2;
0106 
0107     // This informs GetSurfaceArea() and GetCubicVolume() that it needs
0108     // to recalculate buffered value.
0109     //
0110     fSurfaceArea = 0.; 
0111     fCubicVolume = 0.;
0112     fRebuildPolyhedron = true;
0113   }
0114 }
0115 
0116 inline
0117 G4double G4Paraboloid::GetCubicVolume()
0118 {
0119   if(fCubicVolume != 0. ) {;}
0120   else
0121   {
0122     fCubicVolume = CLHEP::twopi * k2 * dz;
0123   }
0124   return fCubicVolume;
0125 }
0126 
0127 
0128 inline
0129 G4double G4Paraboloid::CalculateSurfaceArea() const
0130 {
0131   G4double h1, h2, A1, A2;
0132 
0133   h1 = k2/k1 + dz;
0134   h2 = k2/k1 - dz;
0135 
0136   // Calculate surface area for the paraboloid full paraboloid
0137   // cutoff at z = dz (not the cutoff area though).
0138 
0139   A1 = sqr(r2) + 4 * sqr(h1);
0140   A1 *= sqr(A1); // Sets A1 = A1^3
0141   A1 = CLHEP::pi * r2 /6 / sqr(h1) * ( std::sqrt(A1) - r2 * r2 * r2);
0142 
0143   // Calculate surface area for the paraboloid full paraboloid
0144   // cutoff at z = -dz (not the cutoff area though).
0145 
0146   A2 = sqr(r1) + 4 * sqr(h2);
0147   A2 *= sqr(A2);// Sets A2 = A2^3
0148 
0149   if(h2 != 0)
0150     { A2 = CLHEP::pi * r1 /6 / sqr(h2) * ( std::sqrt(A2) - r1 * r1 * r1); }
0151   else
0152     { A2 = 0.; }
0153 
0154   return fSurfaceArea = A1 - A2 + (sqr(r1) + sqr(r2))*CLHEP::pi;
0155 }
0156 
0157 inline
0158 G4double G4Paraboloid::GetSurfaceArea()
0159 {
0160   if(fSurfaceArea == 0.) CalculateSurfaceArea();
0161 
0162   return fSurfaceArea;
0163 }