File indexing completed on 2026-04-10 07:50:31
0001 #pragma once
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <sstream>
0012 #include <string>
0013 #include <iomanip>
0014
0015 class G4OpticalSurface ;
0016
0017 struct U4OpticalSurface
0018 {
0019 static G4OpticalSurface* FromLogical(G4LogicalSurface* Surface );
0020 static std::string Desc(const G4OpticalSurface* surf) ;
0021 };
0022
0023 #include "U4SurfaceType.h"
0024 #include "U4OpticalSurfaceModel.h"
0025 #include "U4OpticalSurfaceFinish.h"
0026
0027
0028 inline G4OpticalSurface* U4OpticalSurface::FromLogical(G4LogicalSurface* Surface )
0029 {
0030 G4OpticalSurface* OpticalSurface = Surface ? dynamic_cast<G4OpticalSurface*>(Surface->GetSurfaceProperty()) : nullptr ;
0031 return OpticalSurface ;
0032 }
0033
0034 inline std::string U4OpticalSurface::Desc(const G4OpticalSurface* surf)
0035 {
0036 G4SurfaceType type = surf->GetType();
0037 G4OpticalSurfaceModel model = surf->GetModel();
0038 G4OpticalSurfaceFinish finish = surf->GetFinish() ;
0039 G4double polish = surf->GetPolish();
0040 G4double sigma_alpha = surf->GetSigmaAlpha();
0041
0042 std::stringstream ss ;
0043 ss << "U4OpticalSurface::Desc"
0044 << " " << std::setw(20) << surf->GetName()
0045 << " type:" << U4SurfaceType::Name(type)
0046 << " model:" << U4OpticalSurfaceModel::Name(model)
0047 << " finish:" << U4OpticalSurfaceFinish::Name(finish)
0048 ;
0049
0050 if(model == glisur) ss << " polish:" << polish ;
0051 else ss << " sigma_alpha:" << sigma_alpha ;
0052
0053 std::string s = ss.str();
0054 return s ;
0055 }
0056
0057
0058
0059