1 #include <G4TransportationManager.hh> 2 #include <G4Navigator.hh> 3 #include <G4VPhysicalVolume.hh> 4 #include <G4LogicalVolume.hh> 5 #include <G4Material.hh> 6 #include <G4VisExtent.hh> 7 #include <Randomize.hh> 20 const G4MaterialTable* mTable = G4Material::GetMaterialTable();
28 G4Navigator* navigator
29 = G4TransportationManager::GetTransportationManager()
30 ->GetNavigatorForTracking();
31 for (
int finiteLoop = 0; finiteLoop<100000; ++finiteLoop) {
35 G4VPhysicalVolume*
volume = navigator->LocateGlobalPointAndSetup(vtx);
38 if (!volume)
continue;
42 = volume->GetLogicalVolume()->GetMaterial()->GetDensity();
50 EDepSimError(
"EDepSim::DensityPositionGenerator::GetPosition:" 51 <<
" No valid position found");
virtual bool ValidPosition(const G4LorentzVector &vtx)
Return true if the vertex is valid. This is used in the derived class.
double fMaximumDensity
The maximum density in the detector.
static const std::string volume[nvol]
G4LorentzVector TrialPosition()
Generate a trial position uniformly in the sample box.
Construct a module from components.
static int max(int a, int b)
DensityPositionGenerator(const G4String &name)
#define EDepSimError(outStream)
virtual bool ForcePosition()
virtual ~DensityPositionGenerator()
virtual G4LorentzVector GetPosition()
Return a candidate vertex.