Manages the input data, including parsing and storing material properties.
More...
Extends the functionalities provided by the ParameterTable
class. It's dedicated to the specific needs of managing input data related to materials and optical properties.
This class follows a global instance pattern and its lifecycle is managed by OMSimDetectorConstruction. It can be accessed by other classes using OMSimInputData::getInstance(). For example:
(see also Minimal example) This class assumes certain conventions in naming and structuring the input files, which aids in automatically identifying and processing them.
|
G4Material * | getMaterial (G4String pName) |
| Retrieves a G4Material based on the given name.
|
|
G4OpticalSurface * | getOpticalSurface (G4String pName) |
|
void | searchFolders () |
| Searches through predefined folders for input data files.
|
|
template<typename T > |
T | getValue (G4String pKey, G4String pParameter) |
| Fetches a value from the table based on a key and parameter.
|
|
G4bool | checkIfTreeNameInTable (G4String pKey) |
| Checks if a key exists within the table.
|
|
G4bool | checkIfKeyInTree (G4String p_treeName, G4String p_key) |
| Checks if a specific key exists in a given JSON tree.
|
|
G4double | getValueWithUnit (G4String pKey, G4String pParameter) |
| Fetches the value associated with a given key and parameter.
|
|
pt::ptree | appendAndReturnTree (G4String pFileName) |
|
pt::ptree | getJSONTree (G4String pKey) |
|
template<typename T > |
void | parseKeyContentToVector (std::vector< T > &pVector, pt::ptree pTree, std::basic_string< char > pKey, G4double pScaling, bool pInverse) |
| Parses the content of a JSON subtree into a vector, scaling values if necessary.
|
|
template<typename T > |
void | parseKeyContentToVector (std::vector< T > &pVector, std::basic_string< char > p_MapKey, std::basic_string< char > pKey, G4double pScaling, bool pInverse) |
| Parses the content of a JSON subtree into a vector, scaling values if necessary.
|
|
|
std::map< G4String, G4OpticalSurface * > | m_opticalSurfaceMap |
| Map that links names with optical surfaces.
|
|
|
enum class | FileType {
IceCubeICE
, Scintillator
, Extra
, Table
,
Surface
, Material
} |
|
|
FileType | getFileType (const std::string &fileName) const |
|
| OMSimInputData (const OMSimInputData &)=delete |
|
OMSimInputData & | operator= (const OMSimInputData &)=delete |
|
void | scannDataDirectory () |
|
void | processFile (const std::string &filePath, const std::string &fileName) |
| Processes a data file based on its name prefix.
|
|
|
G4String | m_dataDirectory |
| The current directory being scanned for data.
|
|
◆ getInstance()
- Returns
- A reference to the OMSimInputData instance.
- Exceptions
-
std::runtime_error | if accessed before initialization or after shutdown. |
◆ getMaterial()
G4Material * OMSimInputData::getMaterial |
( |
G4String |
p_name | ) |
|
Handles both predefined and argument-based materials. For argument materials (prefixed with "arg"), it selects materials based on user-defined indices for glass, gel, and environment. For standard materials, it retrieves from Geant4's material database or NIST manager.
- Parameters
-
pName | Material name or argument material key ("argVesselGlass", "argGel", "argWorld"). |
- Returns
- Pointer to the requested G4Material, or nullptr if not found.
- Note
- Uses OMSimCommandArgsTable for argument-based material selection.
- Warning
- May cause undefined behavior if argument indices are out of bounds.
◆ getOpticalSurface()
G4OpticalSurface * OMSimInputData::getOpticalSurface |
( |
G4String |
p_name | ) |
|
Get a G4OpticalSurface. In order to get custom built materials, method searchFolders() should have already been called.
- Parameters
-
p_name | name of the optical surface or argument reflectors "argReflector" |
- Returns
- G4OpticalSurface
◆ init()
void OMSimInputData::init |
( |
| ) |
|
|
static |
◆ processFile()
void OMSimInputData::processFile |
( |
const std::string & |
p_filePath, |
|
|
const std::string & |
p_fileName |
|
) |
| |
|
private |
The function identifies the type of data file based on the prefix of the filename. It then calls the correct extraction method. For 'Surf' prefixed files, it also updates the m_opticalSurfaceMap. For 'pmt_', 'om_', and 'usr_' prefixed files, it invokes directly appendAndReturnTree without any extra parsing into Geant4 objects.
- Parameters
-
p_filePath | Full path to the file. |
p_fileName | Name of the file (without the path). |
◆ shutdown()
void OMSimInputData::shutdown |
( |
| ) |
|
|
static |
This method is normally called in the destructor ~OMSimDetectorConstruction.
◆ fileTypePrefixes
const std::unordered_map< std::string, OMSimInputData::FileType > OMSimInputData::fileTypePrefixes |
|
staticprivate |
Initial value:= {
{"IceCubeICE", FileType::IceCubeICE},
{"Scint", FileType::Scintillator},
{"Extra", FileType::Extra},
{"pmt_", FileType::Table},
{"usr_", FileType::Table},
{"Surf", FileType::Surface}}
The documentation for this class was generated from the following files: