Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #pragma once
0002 /**
0003 S4TreeBorder.h
0004 ===============
0005 
0006 Extract some of the functionality of U4TreeBorder.h whilst trying 
0007 to get implicit osur surfaces to work in old workflow. 
0008 
0009 **/
0010 
0011 struct S4TreeBorder
0012 {
0013     const G4LogicalVolume* const lv ;
0014     const G4LogicalVolume* const lv_p ;
0015     const G4Material* const imat_ ;
0016     const G4Material* const omat_ ;
0017     const char* imat ;
0018     const char* omat ;
0019     const G4VSolid* isolid_ ;
0020     const G4VSolid* osolid_ ;
0021     G4String isolid ; // unavoidable, because G4VSolid::GetName returns by value 
0022     G4String osolid ;
0023     const char* _isolid ;
0024     const char* _osolid ;
0025     const std::string& inam ; // inner pv name
0026     const std::string& onam ; // outer pv name
0027 
0028     const G4MaterialPropertyVector* i_rindex ;
0029     const G4MaterialPropertyVector* o_rindex ;
0030 
0031     const G4LogicalSurface* const osur_ ;
0032     const G4LogicalSurface* const isur_ ;
0033 
0034     int  implicit_idx ;
0035     bool implicit_isur ;
0036     bool implicit_osur ;
0037 
0038     const char* flagged_isolid ;
0039 
0040     S4TreeBorder(
0041         const G4VPhysicalVolume* const pv,
0042         const G4VPhysicalVolume* const pv_p
0043         );
0044 
0045     std::string desc() const ;
0046     bool is_flagged() const ; 
0047 
0048 };
0049 
0050 inline S4TreeBorder::S4TreeBorder(
0051     const G4VPhysicalVolume* const pv, 
0052     const G4VPhysicalVolume* const pv_p )
0053     :   
0054     lv(pv->GetLogicalVolume()),
0055     lv_p(pv_p ? pv_p->GetLogicalVolume() : lv),
0056     imat_(lv->GetMaterial()),
0057     omat_(lv_p ? lv_p->GetMaterial() : imat_), // top omat -> imat 
0058     imat(imat_->GetName().c_str()),
0059     omat(omat_->GetName().c_str()),
0060     isolid_(lv->GetSolid()),
0061     osolid_(lv_p->GetSolid()),
0062     isolid(isolid_->GetName()),
0063     osolid(osolid_->GetName()),
0064     _isolid(isolid.c_str()),
0065     _osolid(osolid.c_str()),
0066     inam(pv->GetName()), 
0067     onam(pv_p ? pv_p->GetName() : inam), 
0068     i_rindex(S4Mat::GetRINDEX( imat_ )), 
0069     o_rindex(S4Mat::GetRINDEX( omat_ )), 
0070     osur_(S4Surface::Find( pv_p, pv )),    // look for border or skin surface, HMM: maybe disable for o_rindex == nullptr ?
0071     isur_( i_rindex == nullptr ? nullptr : S4Surface::Find( pv, pv_p )), // disable isur from absorbers without RINDEX
0072     implicit_idx(-1),
0073     implicit_isur(i_rindex != nullptr && o_rindex == nullptr),  
0074     implicit_osur(o_rindex != nullptr && i_rindex == nullptr),
0075     flagged_isolid(ssys::getenvvar("S4TreeBorder__FLAGGED_ISOLID", "sStrutBallhead"))
0076 {
0077 }
0078 
0079 
0080 inline std::string S4TreeBorder::desc() const
0081 {
0082     std::stringstream ss ;
0083     ss << "S4TreeBorder::desc" << std::endl
0084        << " omat " << omat << std::endl
0085        << " imat " << imat << std::endl
0086        << " osolid " << osolid << std::endl
0087        << " isolid " << isolid << std::endl
0088        << " is_flagged " << ( is_flagged() ? "YES" : "NO " )
0089        ;
0090     std::string str = ss.str();
0091     return str ;
0092 }
0093 
0094 inline bool S4TreeBorder::is_flagged() const
0095 {
0096     return _isolid && flagged_isolid && strcmp(_isolid, flagged_isolid ) == 0 ;
0097 }
0098 
0099 
0100