Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:50:31

0001 #pragma once
0002 /**
0003 U4OpticalSurfaceModel.h : string consts for G4OpticalSurfaceModel   { glisur, unified, ... }
0004 =================================================================================================
0005 
0006 Basis G4OpticalSurfaceModel enum { glisur, unified, ... } is defined in G4OpticalSurface.hh
0007 
0008 Note that support is only being attempted for glisur and unified
0009 
0010 **/
0011 
0012 #include <cstring>
0013 #include <cassert>
0014 #include "G4OpticalSurface.hh"
0015 
0016 struct U4OpticalSurfaceModel
0017 {
0018     static const char* Name(unsigned model); 
0019     static unsigned    Model(const char* name);
0020 
0021     static constexpr const char* glisur_    = "glisur" ;   // original GEANT3 model
0022     static constexpr const char* unified_   = "unified" ;  // UNIFIED model
0023     static constexpr const char* LUT_       = "LUT" ;      // Look-Up-Table model
0024     static constexpr const char* DAVIS_     = "DAVIS" ;    // DAVIS model
0025     static constexpr const char* dichroic_  = "dichroic" ; // dichroic filter 
0026 };
0027 
0028 inline const char* U4OpticalSurfaceModel::Name(unsigned model)
0029 {
0030     const char* n = nullptr ; 
0031     switch(model)
0032     {
0033         case glisur:    n = glisur_      ; break ; 
0034         case unified:   n = unified_     ; break ; 
0035         case LUT:       n = LUT_         ; break ; 
0036         case DAVIS:     n = DAVIS_       ; break ; 
0037         case dichroic:  n = dichroic_    ; break ; 
0038     }
0039     return n ; 
0040 }
0041 
0042 inline unsigned U4OpticalSurfaceModel::Model(const char* name)
0043 {
0044     assert(name); 
0045     unsigned model = glisur ; 
0046     if(strcmp(name,glisur_)== 0  )    model = glisur ; 
0047     if(strcmp(name,unified_)== 0  )   model = unified ; 
0048     if(strcmp(name,LUT_)== 0  )       model = LUT ; 
0049     if(strcmp(name,DAVIS_)== 0  )     model = DAVIS ; 
0050     if(strcmp(name,dichroic_)== 0  )  model = dichroic ; 
0051     return model ; 
0052 }
0053 
0054