File indexing completed on 2025-01-18 09:57:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 #ifndef G4AdjointPosOnPhysVolGenerator_hh
0050 #define G4AdjointPosOnPhysVolGenerator_hh 1
0051
0052 #include "G4VPhysicalVolume.hh"
0053 #include "G4AffineTransform.hh"
0054 #include "G4ThreeVector.hh"
0055
0056 class G4VSolid;
0057
0058 class G4AdjointPosOnPhysVolGenerator
0059 {
0060
0061 public:
0062
0063
0064 static G4AdjointPosOnPhysVolGenerator* GetInstance();
0065
0066 G4VPhysicalVolume* DefinePhysicalVolume(const G4String& aName);
0067 void DefinePhysicalVolume1(const G4String& aName);
0068 G4double ComputeAreaOfExtSurface();
0069 G4double ComputeAreaOfExtSurface(G4int NStat);
0070 G4double ComputeAreaOfExtSurface(G4double epsilon);
0071 G4double ComputeAreaOfExtSurface(G4VSolid* aSolid);
0072 G4double ComputeAreaOfExtSurface(G4VSolid* aSolid,G4int NStat);
0073 G4double ComputeAreaOfExtSurface(G4VSolid* aSolid,G4double epsilon);
0074
0075 void GenerateAPositionOnTheExtSurfaceOfASolid(G4VSolid* aSolid,
0076 G4ThreeVector& p,
0077 G4ThreeVector& direction);
0078 void GenerateAPositionOnTheExtSurfaceOfTheSolid(G4ThreeVector& p,
0079 G4ThreeVector& direction);
0080 void GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector& p,
0081 G4ThreeVector& direction);
0082 void GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector& p,
0083 G4ThreeVector& direction,
0084 G4double& costh_to_normal);
0085
0086 inline void SetSolid(G4VSolid* aSolid)
0087 { theSolid=aSolid; }
0088 inline G4double GetAreaOfExtSurfaceOfThePhysicalVolume()
0089 { return AreaOfExtSurfaceOfThePhysicalVolume; }
0090 inline G4double GetCosThDirComparedToNormal()
0091 { return CosThDirComparedToNormal; }
0092
0093
0094 private:
0095
0096 G4AdjointPosOnPhysVolGenerator() = default;
0097 ~G4AdjointPosOnPhysVolGenerator() = default;
0098 G4double ComputeAreaOfExtSurfaceStartingFromSphere(G4VSolid* aSolid,
0099 G4int NStat);
0100 G4double ComputeAreaOfExtSurfaceStartingFromBox(G4VSolid* aSolid,
0101 G4int NStat);
0102 void GenerateAPositionOnASolidBoundary(G4VSolid* aSolid,
0103 G4ThreeVector& p,
0104 G4ThreeVector& direction);
0105 G4double GenerateAPositionOnASphereBoundary(G4VSolid* aSolid,
0106 G4ThreeVector& p,
0107 G4ThreeVector& direction);
0108 G4double GenerateAPositionOnABoxBoundary(G4VSolid* aSolid,
0109 G4ThreeVector& p,
0110 G4ThreeVector& direction);
0111 void ComputeTransformationFromPhysVolToWorld();
0112
0113
0114 private:
0115
0116
0117 static G4ThreadLocal G4AdjointPosOnPhysVolGenerator* theInstance;
0118 G4VSolid* theSolid = nullptr;
0119 G4VPhysicalVolume* thePhysicalVolume = nullptr;
0120
0121 G4bool UseSphere{true};
0122 G4String ModelOfSurfaceSource{"OnSolid"};
0123 G4AffineTransform theTransformationFromPhysVolToWorld;
0124 G4double AreaOfExtSurfaceOfThePhysicalVolume{0.};
0125 G4double CosThDirComparedToNormal{0.};
0126 };
0127
0128 #endif