File indexing completed on 2025-02-27 09:18:30
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 #ifndef GRDetectorConstruction_H
0044 #define GRDetectorConstruction_H 1
0045
0046 #include "G4VUserDetectorConstruction.hh"
0047 #include "globals.hh"
0048 #include "G4ThreeVector.hh"
0049
0050 class G4GDMLParser;
0051 class GRDetectorConstructionMessenger;
0052 class GRGeomImpBiasWorld;
0053
0054 class GRDetectorConstruction : public G4VUserDetectorConstruction
0055 {
0056 friend class GRGeomImpBiasWorld;
0057
0058 public:
0059 GRDetectorConstruction();
0060 virtual ~GRDetectorConstruction();
0061 virtual G4VPhysicalVolume* Construct();
0062 virtual void ConstructSDAndField();
0063
0064 private:
0065 GRDetectorConstructionMessenger* messenger;
0066 G4GDMLParser* parser;
0067 G4String gdmlFile;
0068 G4VPhysicalVolume* fWorld;
0069 G4bool initialized;
0070
0071 static G4double worldSize;
0072
0073 public:
0074 G4bool SetGDMLFile(G4String&);
0075 const G4String& GetGDMLFile()
0076 { return gdmlFile; }
0077
0078 static G4double GetWorldSize()
0079 { return worldSize; }
0080
0081 private:
0082 void Read();
0083
0084 public:
0085 void ListSolids(G4int);
0086 void ListLogVols(G4int);
0087 void ListPhysVols(G4int);
0088 void ListRegions(G4int);
0089 G4bool CreateRegion(G4String&,G4String&);
0090 G4bool CheckOverlap(G4String&,G4int,G4int,G4double);
0091
0092 public:
0093 void ListAllMaterial();
0094 G4bool ListMaterial(G4String&);
0095 void DumpNistMaterials();
0096 G4bool CreateMaterial(G4String&);
0097 G4bool GetMaterial(G4String&);
0098 G4int SetMaterial(G4String&,G4String&);
0099
0100 private:
0101 G4bool applyGeomImpBias = false;
0102 GRGeomImpBiasWorld* geomImpBiasWorld = nullptr;
0103 struct GeomImpParameters
0104 {
0105 G4double radius = -1.;
0106 G4ThreeVector pos0;
0107 G4int nLayer = 0;
0108 G4double radiusT = -1.;
0109 G4ThreeVector posT;
0110 G4int factor = 2;
0111 G4double prob = 1.;
0112 } geoImpP;
0113
0114 public:
0115 void GeomImp(G4int n,G4double r)
0116 {
0117 applyGeomImpBias = true;
0118 geoImpP.nLayer = n;
0119 geoImpP.radius = r;
0120 }
0121 G4bool ApplyGeomImpBias() const
0122 { return applyGeomImpBias; }
0123 void GeomImpLocate(G4ThreeVector p0)
0124 { geoImpP.pos0 = p0; }
0125 G4double GeomImpInnerRadius(G4double rt)
0126 {
0127 if(rt>geoImpP.radius)
0128 { return -rt; }
0129 geoImpP.radiusT = rt;
0130 return rt;
0131 }
0132 G4double GeomImpLocateTgt(G4ThreeVector pT)
0133 {
0134 G4ThreeVector dp = geoImpP.pos0 - pT;
0135 G4double rt = geoImpP.radiusT;
0136 if(rt<0.)
0137 { rt = geoImpP.radius / geoImpP.nLayer; }
0138 if(dp.mag() >= (geoImpP.radius - rt))
0139 { return (geoImpP.radius - rt); }
0140 geoImpP.posT = pT;
0141 return 0.;
0142 }
0143 void GeomImpFactor(G4int f)
0144 { geoImpP.factor = f; }
0145 void GeomImpProb(G4double p)
0146 { geoImpP.prob = p; }
0147 };
0148
0149 #endif