65 : UseSphere(true), ModelOfSurfaceSource(
"OnSolid"),
66 AreaOfExtSurfaceOfThePhysicalVolume(0.), CosThDirComparedToNormal(0.)
78 for (
unsigned int i=0; i< thePhysVolStore->size(); ++i )
80 G4String vol_name =(*thePhysVolStore)[i]->GetName();
83 vol_name = (*thePhysVolStore)[i]->GetLogicalVolume()->GetName();
85 if (vol_name == aName)
97 G4cout <<
"The physical volume with name " << aName
98 <<
" does not exist!!" <<
G4endl;
99 G4cout <<
"Before generating a source on an external surface " <<
G4endl
100 <<
"of a volume you should select another physical volume."
215 if ( Nstat <= 0 ) {
return 0.; }
235 if ( Nstat <= 0 ) {
return 0.; }
271 p += 0.999999*direction*dist_to_in;
302 G4double r=scale*std::sqrt(dX*dX+dY*dY+dZ*dZ);
305 G4double theta = std::acos(std::sqrt(cos_th2));
308 direction=-direction;
310 theta = std::acos(cos_th);
327 G4double ran_var,px,py,pz,minX,maxX,minY,maxY,minZ,
maxZ;
341 minX-=scale*std::abs(minX);
342 minY-=scale*std::abs(minY);
343 minZ-=scale*std::abs(minZ);
344 maxX+=scale*std::abs(maxX);
345 maxY+=scale*std::abs(maxY);
355 G4double area=XY_prob+YZ_prob+ZX_prob;
362 G4double sth = std::sqrt(1.-cos_th2);
368 if (ran_var <=XY_prob)
382 ranX=(ran_var1-0.5)*2.;
385 px=minX+(maxX-minX)*ranX;
386 py=minY+(maxY-minY)*ranY;
388 else if (ran_var <=(XY_prob+YZ_prob))
390 G4double ran_var1=(ran_var-XY_prob)/YZ_prob;
402 ranY=(ran_var1-0.5)*2.;
405 py=minY+(maxY-minY)*ranY;
406 pz=minZ+(
maxZ-minZ)*ranZ;
410 G4double ran_var1=(ran_var-XY_prob-YZ_prob)/ZX_prob;
422 ranZ=(ran_var1-0.5)*2.;
425 px=minX+(maxX-minX)*ranX;
426 pz=minZ+(
maxZ-minZ)*ranZ;
441 G4cout <<
"Before generating a source on an external surface" <<
G4endl
442 <<
"of volume you should select a physical volume" <<
G4endl;
469 while (mother !=
nullptr)
474 for (
unsigned int i=0; i<thePhysVolStore->size(); ++i )
476 if ((*thePhysVolStore)[i]->GetLogicalVolume() == mother)
478 daughter = (*thePhysVolStore)[i];
static const G4double eps
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
Hep3Vector & rotateY(double)
Hep3Vector & rotateZ(double)
void setRThetaPhi(double r, double theta, double phi)
void GenerateAPositionOnTheExtSurfaceOfTheSolid(G4ThreeVector &p, G4ThreeVector &direction)
void GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector &p, G4ThreeVector &direction)
G4VPhysicalVolume * DefinePhysicalVolume(const G4String &aName)
void DefinePhysicalVolume1(const G4String &aName)
G4AffineTransform theTransformationFromPhysVolToWorld
void GenerateAPositionOnASolidBoundary(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
static G4ThreadLocal G4AdjointPosOnPhysVolGenerator * theInstance
G4double ComputeAreaOfExtSurfaceStartingFromSphere(G4VSolid *aSolid, G4int NStat)
G4String ModelOfSurfaceSource
void GenerateAPositionOnTheExtSurfaceOfASolid(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
~G4AdjointPosOnPhysVolGenerator()
G4double CosThDirComparedToNormal
G4double ComputeAreaOfExtSurfaceStartingFromBox(G4VSolid *aSolid, G4int NStat)
G4double ComputeAreaOfExtSurface()
G4double GenerateAPositionOnASphereBoundary(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
void ComputeTransformationFromPhysVolToWorld()
G4double GenerateAPositionOnABoxBoundary(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
G4AdjointPosOnPhysVolGenerator()
G4VPhysicalVolume * thePhysicalVolume
static G4AdjointPosOnPhysVolGenerator * GetInstance()
G4VSolid * GetSolid() const
static G4PhysicalVolumeStore * GetInstance()
G4LogicalVolume * GetMotherLogical() const
G4LogicalVolume * GetLogicalVolume() const
const G4RotationMatrix * GetFrameRotation() const
G4ThreeVector GetObjectTranslation() const
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
static const G4double kInfinity
static constexpr double twopi
static constexpr double pi