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;
179 if ( Nstat <= 0 )
return 0.;
190 area=area*double(i)/double(j);
197 if ( Nstat <= 0 )
return 0.;
208 area=area*double(i)/double(j);
222 p+= 0.999999*direction*dist_to_in;
249 G4double r=scale*std::sqrt(dX*dX+dY*dY+dZ*dZ);
252 G4double theta = std::acos(std::sqrt(cos_th2));
255 direction=-direction;
257 theta = std::acos(cos_th);
264 return 4.*3.1415926*r*r;;
285 minX-=scale*std::abs(minX);
286 minY-=scale*std::abs(minY);
287 minZ-=scale*std::abs(minZ);
288 maxX+=scale*std::abs(maxX);
289 maxY+=scale*std::abs(maxY);
290 maxZ+=scale*std::abs(maxZ);
299 G4double area=XY_prob+YZ_prob+ZX_prob;
306 G4double sth = std::sqrt(1.-cos_th2);
312 if (ran_var <=XY_prob){
323 ranX=(ran_var1-0.5)*2.;
326 px=minX+(maxX-minX)*ranX;
327 py=minY+(maxY-
minY)*ranY;
329 else if (ran_var <=(XY_prob+YZ_prob)){
330 G4double ran_var1=(ran_var-XY_prob)/YZ_prob;
340 ranY=(ran_var1-0.5)*2.;
343 py=minY+(maxY-
minY)*ranY;
344 pz=minZ+(maxZ-minZ)*ranZ;
348 G4double ran_var1=(ran_var-XY_prob-YZ_prob)/ZX_prob;
358 ranZ=(ran_var1-0.5)*2.;
361 px=minX+(maxX-minX)*ranX;
362 pz=minZ+(maxZ-minZ)*ranZ;
373 G4cout<<
"Before generating a source on an external surface of volume you should select a physical volume"<<std::endl;
399 for (
unsigned int i=0; i< thePhysVolStore->size();i++){
400 if ((*thePhysVolStore)[i]->GetLogicalVolume() == mother){
401 daughter = (*thePhysVolStore)[i];
const G4RotationMatrix * GetFrameRotation() const
G4VPhysicalVolume * DefinePhysicalVolume(const G4String &aName)
CLHEP::Hep3Vector G4ThreeVector
G4double ComputeAreaOfExtSurfaceStartingFromSphere(G4VSolid *aSolid, G4int NStat)
G4LogicalVolume * GetLogicalVolume() const
static const G4double kInfinity
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
G4String ModelOfSurfaceSource
G4double ComputeAreaOfExtSurface()
G4double CosThDirComparedToNormal
G4AdjointPosOnPhysVolGenerator()
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4double ComputeAreaOfExtSurfaceStartingFromBox(G4VSolid *aSolid, G4int NStat)
void GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector &p, G4ThreeVector &direction)
void ComputeTransformationFromPhysVolToWorld()
G4double GenerateAPositionOnASphereBoundary(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
G4LogicalVolume * GetMotherLogical() const
static G4ThreadLocal G4AdjointPosOnPhysVolGenerator * theInstance
void DefinePhysicalVolume1(const G4String &aName)
G4double GenerateAPositionOnABoxBoundary(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
void GenerateAPositionOnASolidBoundary(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
G4VPhysicalVolume * thePhysicalVolume
void GenerateAPositionOnTheExtSurfaceOfASolid(G4VSolid *aSolid, G4ThreeVector &p, G4ThreeVector &direction)
G4AffineTransform theTransformationFromPhysVolToWorld
Hep3Vector & rotateZ(double)
~G4AdjointPosOnPhysVolGenerator()
static G4PhysicalVolumeStore * GetInstance()
void setRThetaPhi(double r, double theta, double phi)
static G4AdjointPosOnPhysVolGenerator * GetInstance()
G4GLOB_DLL std::ostream G4cout
G4VSolid * GetSolid() const
void GenerateAPositionOnTheExtSurfaceOfTheSolid(G4ThreeVector &p, G4ThreeVector &direction)
static const G4double eps
G4ThreeVector GetObjectTranslation() const
Hep3Vector & rotateY(double)