67 : theSolid(0), thePhysicalVolume(0),
68 UseSphere(true), ModelOfSurfaceSource(
"OnSolid"),
69 AreaOfExtSurfaceOfThePhysicalVolume(0.), CosThDirComparedToNormal(0.)
80 for (
unsigned int i=0; i< thePhysVolStore->size();i++){
81 G4String vol_name =(*thePhysVolStore)[i]->GetName();
83 vol_name = (*thePhysVolStore)[i]->GetLogicalVolume()->GetName();
85 if (vol_name == aName){
96 G4cout<<
"The physical volume with name "<<aName<<
" does not exist!!"<<std::endl;
97 G4cout<<
"Before generating a source on an external surface of a volume you should select another physical volume"<<std::endl;
189 area=area*double(i)/double(j);
206 area=area*double(i)/double(j);
221 p+= 0.999999*direction*dist_to_in;
229 G4double minX,maxX,minY,maxY,minZ,maxZ;
248 G4double r=scale*std::sqrt(dX*dX+dY*dY+dZ*dZ);
251 G4double theta = std::acos(std::sqrt(cos_th2));
253 direction.setRThetaPhi(1.,theta,phi);
254 direction=-direction;
256 theta = std::acos(cos_th);
259 p.setRThetaPhi(r,theta,phi);
261 direction.rotateY(theta);
262 direction.rotateZ(phi);
263 return 4.*3.1415926*r*r;;
270 G4double ran_var,px,py,pz,minX,maxX,minY,maxY,minZ,maxZ;
284 minX-=scale*std::abs(minX);
285 minY-=scale*std::abs(minY);
286 minZ-=scale*std::abs(minZ);
287 maxX+=scale*std::abs(maxX);
288 maxY+=scale*std::abs(maxY);
289 maxZ+=scale*std::abs(maxZ);
298 G4double area=XY_prob+YZ_prob+ZX_prob;
305 G4double sth = std::sqrt(1.-cos_th2);
311 if (ran_var <=XY_prob){
322 ranX=(ran_var1-0.5)*2.;
325 px=minX+(maxX-minX)*ranX;
326 py=minY+(maxY-minY)*ranY;
328 else if (ran_var <=(XY_prob+YZ_prob)){
329 G4double ran_var1=(ran_var-XY_prob)/YZ_prob;
339 ranY=(ran_var1-0.5)*2.;
342 py=minY+(maxY-minY)*ranY;
343 pz=minZ+(maxZ-minZ)*ranZ;
347 G4double ran_var1=(ran_var-XY_prob-YZ_prob)/ZX_prob;
357 ranZ=(ran_var1-0.5)*2.;
360 px=minX+(maxX-minX)*ranX;
361 pz=minZ+(maxZ-minZ)*ranZ;
372 G4cout<<
"Before generating a source on an external surface of volume you should select a physical volume"<<std::endl;
398 for (
unsigned int i=0; i< thePhysVolStore->size();i++){
399 if ((*thePhysVolStore)[i]->GetLogicalVolume() == mother){
400 daughter = (*thePhysVolStore)[i];
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
~G4AdjointPosOnPhysVolGenerator()
G4AdjointPosOnPhysVolGenerator()
G4double ComputeAreaOfExtSurface()
static const G4double kInfinity
CLHEP::Hep3Vector G4ThreeVector
void GenerateAPositionOnTheExtSurfaceOfASolid(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
void GenerateAPositionOnTheExtSurfaceOfTheSolid(G4ThreeVector &p, G4ThreeVector &direction)
static const G4double eps
G4double ComputeAreaOfExtSurfaceStartingFromSphere(G4VSolid *aSolid, G4int NStat)
G4AffineTransform theTransformationFromPhysVolToWorld
static G4PhysicalVolumeStore * GetInstance()
G4VPhysicalVolume * thePhysicalVolume
const G4RotationMatrix * GetFrameRotation() const
G4GLOB_DLL std::ostream G4cout
static G4ThreadLocal G4AdjointPosOnPhysVolGenerator * theInstance
void ComputeTransformationFromPhysVolToWorld()
G4double GenerateAPositionOnABoxBoundary(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4LogicalVolume * GetMotherLogical() const
G4String ModelOfSurfaceSource
void GenerateAPositionOnASolidBoundary(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
G4double ComputeAreaOfExtSurfaceStartingFromBox(G4VSolid *aSolid, G4int NStat)
G4LogicalVolume * GetLogicalVolume() const
void GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector &p, G4ThreeVector &direction)
G4double GenerateAPositionOnASphereBoundary(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
void DefinePhysicalVolume1(const G4String &aName)
static G4AdjointPosOnPhysVolGenerator * GetInstance()
G4ThreeVector GetObjectTranslation() const
G4double CosThDirComparedToNormal
G4VPhysicalVolume * DefinePhysicalVolume(const G4String &aName)
G4VSolid * GetSolid() const