51 G4AdjointCrossSurfChecker::G4AdjointCrossSurfChecker()
56 G4AdjointCrossSurfChecker::~G4AdjointCrossSurfChecker()
77 if (r1<=sphere_radius && r2>sphere_radius){
81 else if (r2<=sphere_radius && r1>sphere_radius){
94 c = r12-sphere_radius*sphere_radius;
95 d=std::sqrt(b*b-4.*a*c);
97 if (l > 1.) l=(-b-
d)/2./a;
98 crossing_pos=pos1+l*dr;
99 cos_th = std::abs(dr.cosTheta(crossing_pos));
111 if (step_at_boundary){
114 if (preStepTouchable && postStepTouchable && postStepTouchable->
GetVolume() && preStepTouchable->
GetVolume()){
118 if (post_vol_name == volume_name ){
122 else if (pre_vol_name == volume_name){
139 if (step_at_boundary){
142 if (preStepTouchable && postStepTouchable && postStepTouchable->
GetVolume() && preStepTouchable->
GetVolume()){
147 if (post_vol_name == volume_name && pre_log_vol_name == mother_logical_vol_name){
151 else if (pre_vol_name == volume_name && post_log_vol_name == mother_logical_vol_name ){
166 G4int ind = FindRegisteredSurface(surface_name);
177 G4String surf_type = ListOfSurfaceType[ind];
178 G4double radius = ListOfSphereRadius[ind];
180 G4String vol1 = ListOfVol1Name[ind];
181 G4String vol2 = ListOfVol2Name[ind];
184 if (surf_type ==
"Sphere"){
185 did_cross =
CrossingASphere(aStep, radius, center,crossing_pos, cos_to_surface, GoingIn);
187 else if (surf_type ==
"ExternalSurfaceOfAVolume"){
193 else if (surf_type ==
"BoundaryBetweenTwoVolumes"){
205 for (
size_t i=0;i <ListOfSurfaceName.size();i++){
207 surface_name = ListOfSurfaceName[i];
219 if (step_at_boundary){
222 if (preStepTouchable && postStepTouchable){
230 if ( pre_vol_name == vol1_name && post_vol_name == vol2_name){
234 else if (pre_vol_name == vol2_name && post_vol_name == vol1_name){
249 G4int ind = FindRegisteredSurface(SurfaceName);
250 Area= 4.*
pi*radius*radius;
252 ListOfSurfaceType[ind]=
"Sphere";
253 ListOfSphereRadius[ind]=radius;
254 ListOfSphereCenter[ind]=pos;
255 ListOfVol1Name[ind]=
"";
256 ListOfVol2Name[ind]=
"";
257 AreaOfSurface[ind]=Area;
260 ListOfSurfaceName.push_back(SurfaceName);
261 ListOfSurfaceType.push_back(
"Sphere");
262 ListOfSphereRadius.push_back(radius);
263 ListOfSphereCenter.push_back(pos);
264 ListOfVol1Name.push_back(
"");
265 ListOfVol2Name.push_back(
"");
266 AreaOfSurface.push_back(Area);
277 for (
unsigned int i=0; i< thePhysVolStore->size();i++){
278 if ((*thePhysVolStore)[i]->GetName() == volume_name){
279 thePhysicalVolume = (*thePhysVolStore)[i];
283 if (thePhysicalVolume){
288 theTransformationFromPhysVolToWorld *=
294 for (
unsigned int i=0; i< thePhysVolStore->size();i++){
295 if ((*thePhysVolStore)[i]->GetLogicalVolume() == mother){
296 daughter = (*thePhysVolStore)[i];
304 G4cout<<
"Center of the spherical surface is at the position: "<<center/
cm<<
" cm"<<std::endl;
308 G4cout<<
"The physical volume with name "<<volume_name<<
" does not exist!!"<<std::endl;
318 G4int ind = FindRegisteredSurface(SurfaceName);
322 for (
unsigned int i=0; i< thePhysVolStore->size();i++){
323 if ((*thePhysVolStore)[i]->GetName() == volume_name){
324 thePhysicalVolume = (*thePhysVolStore)[i];
328 if (!thePhysicalVolume){
329 G4cout<<
"The physical volume with name "<<volume_name<<
" does not exist!!"<<std::endl;
336 if (theMother) mother_vol_name= theMother->
GetName();
338 ListOfSurfaceType[ind]=
"ExternalSurfaceOfAVolume";
339 ListOfSphereRadius[ind]=0.;
341 ListOfVol1Name[ind]=volume_name;
342 ListOfVol2Name[ind]=mother_vol_name;
343 AreaOfSurface[ind]=Area;
346 ListOfSurfaceName.push_back(SurfaceName);
347 ListOfSurfaceType.push_back(
"ExternalSurfaceOfAVolume");
348 ListOfSphereRadius.push_back(0.);
350 ListOfVol1Name.push_back(volume_name);
351 ListOfVol2Name.push_back(mother_vol_name);
352 AreaOfSurface.push_back(Area);
360 G4int ind = FindRegisteredSurface(SurfaceName);
363 ListOfSurfaceType[ind]=
"BoundaryBetweenTwoVolumes";
364 ListOfSphereRadius[ind]=0.;
366 ListOfVol1Name[ind]=volume_name1;
367 ListOfVol2Name[ind]=volume_name2;
368 AreaOfSurface[ind]=Area;
372 ListOfSurfaceName.push_back(SurfaceName);
373 ListOfSurfaceType.push_back(
"BoundaryBetweenTwoVolumes");
374 ListOfSphereRadius.push_back(0.);
376 ListOfVol1Name.push_back(volume_name1);
377 ListOfVol2Name.push_back(volume_name2);
378 AreaOfSurface.push_back(Area);
386 ListOfSurfaceName.clear();
387 ListOfSurfaceType.clear();
388 ListOfSphereRadius.clear();
389 ListOfSphereCenter.clear();
390 ListOfVol1Name.clear();
391 ListOfVol2Name.clear();
398 for (
size_t i = 0; i<ListOfSurfaceName.size();i++){
399 if (name == ListOfSurfaceName[i]) {
G4bool AddaSphericalSurface(const G4String &SurfaceName, G4double radius, G4ThreeVector pos, G4double &area)
G4bool GoingInOrOutOfaVolumeByExtSurface(const G4Step *aStep, const G4String &volume_name, const G4String &mother_log_vol_name, G4double &cos_to_surface, G4bool &GoingIn)
CLHEP::Hep3Vector G4ThreeVector
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4StepStatus GetStepStatus() const
const G4VTouchable * GetTouchable() const
static G4PhysicalVolumeStore * GetInstance()
G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String &SurfaceName, G4double radius, const G4String &volume_name, G4ThreeVector ¢er, G4double &area)
G4StepPoint * GetPreStepPoint() const
const G4RotationMatrix * GetFrameRotation() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
const G4ThreeVector & GetPosition() const
G4bool CrossingASphere(const G4Step *aStep, G4double sphere_radius, G4ThreeVector sphere_center, G4ThreeVector &crossing_pos, G4double &cos_to_surface, G4bool &GoingIn)
G4bool GoingInOrOutOfaVolume(const G4Step *aStep, const G4String &volume_name, G4double &cos_to_surface, G4bool &GoingIn)
G4LogicalVolume * GetMotherLogical() const
G4bool CrossingAnInterfaceBetweenTwoVolumes(const G4Step *aStep, const G4String &vol1_name, const G4String &vol2_name, G4ThreeVector &crossing_pos, G4double &cos_to_surface, G4bool &GoingIn)
static G4AdjointCrossSurfChecker * GetInstance()
G4bool AddanExtSurfaceOfAvolume(const G4String &SurfaceName, const G4String &volume_name, G4double &area)
G4LogicalVolume * GetLogicalVolume() const
G4bool CrossingOneOfTheRegisteredSurface(const G4Step *aStep, G4String &surface_name, G4ThreeVector &crossing_pos, G4double &cos_to_surface, G4bool &GoingIn)
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4StepPoint * GetPostStepPoint() const
void ClearListOfSelectedSurface()
G4ThreeVector GetObjectTranslation() const
G4bool CrossingAGivenRegisteredSurface(const G4Step *aStep, const G4String &surface_name, G4ThreeVector &crossing_pos, G4double &cos_to_surface, G4bool &GoingIn)
virtual G4double GetSurfaceArea()
G4VSolid * GetSolid() const
G4bool AddanInterfaceBetweenTwoVolumes(const G4String &SurfaceName, const G4String &volume_name1, const G4String &volume_name2, G4double &area)