Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:16:36

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 
0027 // --------------------------------------------------------------------
0028 // GEANT 4 class header file
0029 //
0030 // 
0031 // FastAerosolSolid
0032 //
0033 // Class description:
0034 //
0035 //   A FastAerosolSolid is a collection of fDroplet solids
0036 //   with positions set randomly by FastAerosol in a
0037 //   volume given by a bulk shape given by FastAerosol member
0038 //   
0039 //   The FastAerosol member fCloud handles the optimization
0040 //   (finding nearest droplet, populating the cloud) needed for
0041 //   efficient simulations.
0042 //
0043 //   This class is heavily based on system solids.
0044 //
0045 // Author: A.Knaian (ara@nklabs.com), N.MacFadden (natemacfadden@gmail.com)
0046 // --------------------------------------------------------------------
0047 
0048 #ifndef FastAerosolSolid_HH
0049 #define FastAerosolSolid_HH
0050 
0051 #include "FastAerosol.hh"
0052 
0053 #include "G4Polyhedron.hh"
0054 
0055 // rotations
0056 #include <functional>
0057 #include "G4RotationMatrix.hh"
0058 
0059 class FastAerosolSolid : public G4VSolid
0060 {
0061 public: 
0062  FastAerosolSolid(const G4String& pName, FastAerosol* pCloud,
0063               G4VSolid* pDroplet,
0064                             std::function<G4RotationMatrix (G4ThreeVector)> pRotation);
0065 
0066  FastAerosolSolid(const G4String& pName, FastAerosol* pCloud,
0067            G4VSolid* pDroplet);
0068  ~FastAerosolSolid()=default;
0069 
0070 // Access functions
0071  inline G4double GetCubicVolume();
0072  inline G4double GetSurfaceArea();
0073 
0074 // Solid standard methods
0075  G4bool CalculateExtent(const EAxis pAxis,
0076                 const G4VoxelLimits& pVoxelLimit,
0077                 const G4AffineTransform& pTransform,
0078                 G4double& pmin, G4double& pmax) const;
0079 
0080  EInside Inside(const G4ThreeVector& p) const;
0081  
0082  G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const;
0083  
0084  G4double DistanceToIn(const G4ThreeVector& p,
0085                 const G4ThreeVector& v) const;
0086 
0087  G4double DistanceToIn(const G4ThreeVector& p) const;
0088  G4double DistanceToOut(const G4ThreeVector& p, 
0089                        const G4ThreeVector& v,  
0090                        const G4bool calcNorm=G4bool(false), 
0091                        G4bool *validNorm=0, G4ThreeVector *n=0) const;
0092         
0093  G4double DistanceToOut(const G4ThreeVector& p) const;
0094 
0095  G4GeometryType GetEntityType() const;
0096 
0097  G4VSolid* Clone() const;
0098 
0099  std::ostream& StreamInfo(std::ostream& os) const;
0100 
0101  G4ThreeVector GetPointOnSurface() const;
0102 
0103  G4Polyhedron* GetPolyhedron () const;
0104  void DescribeYourselfTo(G4VGraphicsScene& scene) const;
0105  G4VisExtent GetExtent() const;
0106  G4Polyhedron* CreatePolyhedron() const;
0107 
0108 public:  // without description
0109  FastAerosolSolid(__void__&);
0110 //
0111 // Fake default constructor for usage restricted to direct object
0112 // persistency for clients requiring preallocation of memory for
0113 // persistifiable objects.
0114 
0115  FastAerosolSolid(const FastAerosolSolid& rhs);
0116  FastAerosolSolid& operator=(const FastAerosolSolid& rhs); 
0117  // Copy constructor and assignment operator.
0118 
0119  inline void SetStepLim(G4double newLim);
0120  
0121  private:
0122 
0123  inline void Initialize();
0124 //
0125 // Reset relevant values to zero
0126 
0127  G4double fStepLim = DBL_MAX; // Maximum step length. Allows speed up in droplet search
0128 
0129  FastAerosol* fCloud; // FastAerosol which handles brunt of work
0130  G4VSolid* fDroplet; // Droplet shape
0131  G4VSolid* fBulk;   // Aerosol bulk
0132 
0133  G4double fR = 0.0; // Droplet bounding radius
0134 
0135  G4double fVisDx, fVisDy, fVisDz; // Visual extent
0136 
0137  G4double fCubicVolume = 0.0; // Cubic volume of all droplets
0138  G4double fSurfaceArea = 0.0; // Surface area of all droplets
0139 
0140  G4double farFromCloudDist;
0141 
0142  std::function<G4RotationMatrix (G4ThreeVector)> fRotation; 
0143  // rotation function
0144 
0145  protected:  // without description
0146 
0147  mutable G4bool fRebuildPolyhedron;
0148  mutable G4Polyhedron* fpPolyhedron;
0149 };
0150 
0151 #include "FastAerosolSolid.icc"
0152 
0153 #endif