OMSim
Geant4 for IceCube optical module studies
OMSimMaterialHandler.hh
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <G4NistManager.hh>
9 #include <G4SystemOfUnits.hh>
10 #include <G4OpticalSurface.hh>
11 #include <G4PhysicalConstants.hh>
12 #include <boost/property_tree/json_parser.hpp>
13 #include <OMSimCommandArgsTable.hh>
14 
15 class ParameterTable;
16 using ProcessorFunction = void(ParameterTable *, const boost::property_tree::ptree &, G4MaterialPropertiesTable *);
17 
28 {
29 public:
30  OMSimMaterialHandler(const G4String &filename);
32 
33  void processMaterial();
34  G4OpticalSurface *processSurface();
36  void processSpecial(ProcessorFunction *processor);
37  G4String GetName() { return m_objectName; };
38 
39 private:
40  ParameterTable *m_fileData;
41  G4double m_hc_eVnm = h_Planck * c_light / nm;
42  G4String m_filePath;
43  G4String m_objectName;
44  boost::property_tree::ptree m_jsonTree;
45  G4Material *m_material;
46  G4MaterialPropertiesTable *m_MPT;
47  G4OpticalSurface *m_opticalSurface;
48 
49  void readJsonFile();
50  void createMaterial();
51  void processProperties();
53  void findMaterialPropertyTable(G4String p_name);
54  void addProperty(const G4String &key, G4double energyUnit, G4double valueUnit, bool invertX, const boost::property_tree::ptree &propertyTree);
55 
56  // Helper functions for optical surface
57  G4OpticalSurfaceFinish getOpticalSurfaceFinish(const std::string &finish);
58  G4OpticalSurfaceModel getOpticalSurfaceModel(const std::string &model);
59  G4SurfaceType getSurfaceType(const std::string &type);
60  G4State getState(const std::string &type);
61 };
62 
64 {
65  void process(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT);
66  void extractSpectrum(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT);
67  void getLifeTimeTemperatureRange(const boost::property_tree::ptree &p_jsonTree, double &pMinTemp, double &pMaxTemp);
68  std::pair<std::vector<G4double>, std::vector<G4double>> extractLifeTimesForTemperature(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4String pTemperature);
69  void weightLifeTimesAmplitudes(std::vector<G4double> &pAmp, double pT1, double pT2);
70  void extractLifeTimes(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT, G4String pTemperature);
71  void extractYield(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT,
72  G4String pTemperature, G4String pYieldPropertyName, G4String pArgKey, G4String pTreeKeyTemperature, G4String pTreeKeyYield);
73  void extractYieldAlpha(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT, G4String pTemperature);
74  void extractYieldElectron(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT, G4String pTemperature);
75 }
76 
77 namespace IceProcessor
78 {
79  void process(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT);
80  G4double spiceTemperature(G4double p_depth);
81  G4double spiceAbsorption(G4double p_lambda, const std::vector<G4double> &p_spicea400inv, const std::vector<G4double> &p_spiceDepth);
82  G4double spiceRefraction(G4double p_lambda);
83  G4double mieScattering(G4double p_lambda, const std::vector<G4double> &p_spicebe400inv);
84 }
Definition of the OMSimCommandArgsTable singleton class, which controls user args.
Handles the creation and processing of materials from json files.
Definition: OMSimMaterialHandler.hh:28
void processConstProperties()
Process constant properties defined in the input file and add them to the material.
Definition: OMSimMaterialHandler.cc:152
void processProperties()
Process the properties defined in the input file and add them to the material.
Definition: OMSimMaterialHandler.cc:132
G4OpticalSurface * processSurface()
Process and return an optical surface defined in the input file.
Definition: OMSimMaterialHandler.cc:42
G4OpticalSurfaceModel getOpticalSurfaceModel(const std::string &model)
Get the G4OpticalSurfaceModel enum value from a string.
Definition: OMSimMaterialHandler.cc:294
void processExtraProperties()
Process extra properties for an existing material.
Definition: OMSimMaterialHandler.cc:228
void addProperty(const G4String &key, G4double energyUnit, G4double valueUnit, bool invertX, const boost::property_tree::ptree &propertyTree)
Add a property to the material properties table.
Definition: OMSimMaterialHandler.cc:170
void createMaterial()
Create a new Geant4 material based on the input data.
Definition: OMSimMaterialHandler.cc:95
void processMaterial()
Process the material defined in the input file.
Definition: OMSimMaterialHandler.cc:24
void findMaterialPropertyTable(G4String p_name)
Find the material property table for an existing material.
Definition: OMSimMaterialHandler.cc:210
G4SurfaceType getSurfaceType(const std::string &type)
Get the G4SurfaceType enum value from a string.
Definition: OMSimMaterialHandler.cc:313
void processSpecial(ProcessorFunction *processor)
Process special material types using a provided function.
Definition: OMSimMaterialHandler.cc:84
G4State getState(const std::string &type)
Get the G4State enum value from a string.
Definition: OMSimMaterialHandler.cc:339
G4OpticalSurfaceFinish getOpticalSurfaceFinish(const std::string &finish)
Get the G4OpticalSurfaceFinish enum value from a string.
Definition: OMSimMaterialHandler.cc:243
A utility class for managing JSON-based data tables.
Definition: OMSimInputData.hh:39
Namespace containing functions for processing IceCube ice properties from file.
Definition: OMSimMaterialHandler.hh:78
G4double spiceTemperature(G4double p_depth)
Calculate temperature of ice depending on the depth.
Definition: OMSimMaterialHandler.cc:627
G4double spiceAbsorption(G4double p_lambda, const std::vector< G4double > &p_spicea400inv, const std::vector< G4double > &p_spiceDepth)
Calculate absorption length of IceCube's ice for a specific wavelength.
Definition: OMSimMaterialHandler.cc:639
G4double mieScattering(G4double p_lambda, const std::vector< G4double > &p_spicebe400inv)
Calculate mie scattering length of IceCube's ice for a specific wavelength.
Definition: OMSimMaterialHandler.cc:671
G4double spiceRefraction(G4double p_lambda)
Calculate refraction index of IceCube's ice for a specific wavelength.
Definition: OMSimMaterialHandler.cc:657
void process(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT)
Process IceCube ice properties and create corresponding materials.
Definition: OMSimMaterialHandler.cc:585
Namespace containing functions for processing files with scintillation properties.
Definition: OMSimMaterialHandler.hh:64
void weightLifeTimesAmplitudes(std::vector< G4double > &pAmp, double pT1, double pT2)
Adjusts amplitudes of lifetimes based on distance to investigated temperature.
Definition: OMSimMaterialHandler.cc:439
void extractLifeTimes(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT, G4String pTemperature)
Extracts the scintillation lifetimes from the file and weights them for a specific temperature.
Definition: OMSimMaterialHandler.cc:453
void extractYieldAlpha(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT, G4String pTemperature)
Extracts and interpolates the alpha particle scintillation yield for a given temperature.
Definition: OMSimMaterialHandler.cc:540
void extractSpectrum(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT)
Extracts the scintillation spectrum from the data file and adds it to the material properties table.
Definition: OMSimMaterialHandler.cc:388
void process(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT)
Process scintillation properties and add them to the material properties table.
Definition: OMSimMaterialHandler.cc:367
std::pair< std::vector< G4double >, std::vector< G4double > > extractLifeTimesForTemperature(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4String pTemperature)
Extracts lifetimes and amplitudes for a given temperature from the data.
Definition: OMSimMaterialHandler.cc:423
void extractYieldElectron(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT, G4String pTemperature)
Extracts and interpolates the electron scintillation yield for a given temperature....
Definition: OMSimMaterialHandler.cc:552
void getLifeTimeTemperatureRange(const boost::property_tree::ptree &p_jsonTree, double &pMinTemp, double &pMaxTemp)
Retrieves the range of temperatures available for scintillation lifetimes.
Definition: OMSimMaterialHandler.cc:402
void extractYield(ParameterTable *p_dataFile, const boost::property_tree::ptree &p_jsonTree, G4MaterialPropertiesTable *p_MPT, G4String pTemperature, G4String pYieldPropertyName, G4String pArgKey, G4String pTreeKeyTemperature, G4String pTreeKeyYield)
Extract the yield from json tree.
Definition: OMSimMaterialHandler.cc:505