Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:29

0001 #pragma once
0002 /**
0003 S4Surface.h
0004 ============
0005 
0006 Extract a few methods from U4Surface.h as needed for both old and new workflows. 
0007 
0008 **/
0009 #include <string>
0010 #include <cstring>
0011 
0012 class G4LogicalSurface ; 
0013 class G4VPhysicalVolume ; 
0014 
0015 struct S4Surface
0016 {
0017     static G4LogicalSurface* Find( const G4VPhysicalVolume* thePrePV, const G4VPhysicalVolume* thePostPV ) ;  
0018 };
0019 
0020 
0021 /**
0022 S4Surface::Find
0023 -----------------
0024 
0025 Note that U4Surface::Find does the same as this. But duplicated
0026 here as need this whilst trying to get osut implicit boundaries
0027 to work in old workflow.  
0028 
0029 Looks for a border or skin surface in the same way 
0030 as G4OpBoundaryProcess::PostStepDoIt which the code
0031 is based on. 
0032 
0033 **/
0034 
0035 inline G4LogicalSurface* S4Surface::Find( const G4VPhysicalVolume* thePrePV, const G4VPhysicalVolume* thePostPV ) 
0036 {
0037     if(thePostPV == nullptr || thePrePV == nullptr ) return nullptr ;  // surface on world volume not allowed 
0038     G4LogicalSurface* Surface = G4LogicalBorderSurface::GetSurface(thePrePV, thePostPV);
0039     if(Surface == nullptr)
0040     {
0041         G4bool enteredDaughter = thePostPV->GetMotherLogical() == thePrePV->GetLogicalVolume();
0042         if(enteredDaughter)
0043         {
0044             Surface = G4LogicalSkinSurface::GetSurface(thePostPV->GetLogicalVolume());
0045             if(Surface == nullptr)
0046                 Surface = G4LogicalSkinSurface::GetSurface(thePrePV->GetLogicalVolume());
0047         }    
0048         else 
0049         {
0050             Surface = G4LogicalSkinSurface::GetSurface(thePrePV->GetLogicalVolume());
0051             if(Surface == nullptr)
0052                 Surface = G4LogicalSkinSurface::GetSurface(thePostPV->GetLogicalVolume());
0053         }    
0054     }    
0055     return Surface ; 
0056 }
0057 
0058