17 #include "Geant4/G4LogicalSkinSurface.hh"
18 #include "Geant4/G4LogicalVolume.hh"
19 #include "Geant4/G4LogicalVolumeStore.hh"
20 #include "Geant4/G4Material.hh"
21 #include "Geant4/G4MaterialPropertiesTable.hh"
22 #include "Geant4/G4OpticalSurface.hh"
24 #include "messagefacility/MessageLogger/MessageLogger.h"
32 std::map<double, double> PropertyVector,
35 std::map<double, double> PropVectorWithUnit;
36 for (std::map<double, double>::const_iterator it = PropertyVector.begin();
37 it != PropertyVector.end();
39 PropVectorWithUnit[it->first * CLHEP::eV] = it->second * Unit;
43 mf::LogInfo(
"MaterialPropertyLoader") <<
"Added property " << Material <<
" " << Property;
55 mf::LogInfo(
"MaterialPropertyLoader")
56 <<
"Added const property " << Material <<
" " << Property <<
" = " << PropertyValue;
65 mf::LogInfo(
"MaterialPropertyLoader") <<
"Set Birks constant " <<
Material;
72 std::map<std::string, G4MaterialPropertiesTable*> MaterialTables;
73 std::map<std::string, bool> MaterialsSet;
76 mf::LogInfo(
"MaterialPropertyLoader") <<
"UPDATING GEOMETRY";
79 for (std::map<std::string, std::map<std::string, std::map<double, double>>>::const_iterator i =
85 MaterialTables[
Material] =
new G4MaterialPropertiesTable;
90 for (std::map<std::string, std::map<std::string, double>>::const_iterator i =
95 if (!MaterialsSet[Material]) {
97 MaterialTables[
Material] =
new G4MaterialPropertiesTable;
105 for (std::map<std::string, std::map<std::string, std::map<double, double>>>::const_iterator i =
110 for (std::map<std::string, std::map<double, double>>::const_iterator j = i->second.begin();
111 j != i->second.end();
113 std::string Property = j->first;
114 std::vector<G4double> g4MomentumVector;
115 std::vector<G4double> g4PropertyVector;
117 for (std::map<double, double>::const_iterator
k = j->second.begin();
k != j->second.end();
119 g4MomentumVector.push_back(
k->first);
120 g4PropertyVector.push_back(
k->second);
122 int NoOfElements = g4MomentumVector.size();
123 MaterialTables[
Material]->AddProperty(
124 Property.c_str(), &g4MomentumVector[0], &g4PropertyVector[0], NoOfElements);
126 mf::LogInfo(
"MaterialPropertyLoader")
127 <<
"Added property " << Property <<
" to material table " <<
Material;
132 for (std::map<std::string, std::map<std::string, double>>::const_iterator i =
137 for (std::map<std::string, double>::const_iterator j = i->second.begin();
138 j != i->second.end();
140 std::string Property = j->first;
141 G4double PropertyValue = j->second;
142 MaterialTables[
Material]->AddConstProperty(Property.c_str(), PropertyValue);
144 mf::LogInfo(
"MaterialPropertyLoader")
145 <<
"Added const property " << Property <<
" to material table " <<
Material;
150 for (G4LogicalVolumeStore::iterator i = lvs->begin(); i != lvs->end(); ++i) {
151 G4LogicalVolume* volume = (*i);
152 G4Material* TheMaterial = volume->GetMaterial();
153 std::string
Material = TheMaterial->GetName();
161 G4MaterialPropertyVector* PropertyPointer = 0;
162 if (MaterialTables[Material])
163 PropertyPointer = MaterialTables[
Material]->GetProperty(
"REFLECTIVITY");
165 if (Material ==
"Copper") {
166 std::cout <<
"copper foil surface set " << volume->GetName() << std::endl;
167 if (PropertyPointer) {
168 std::cout <<
"defining Copper optical boundary " << std::endl;
169 G4OpticalSurface* refl_opsurfc =
170 new G4OpticalSurface(
"Surface copper", glisur, ground, dielectric_metal);
171 refl_opsurfc->SetMaterialPropertiesTable(MaterialTables[Material]);
172 refl_opsurfc->SetPolish(0.2);
173 new G4LogicalSkinSurface(
"refl_surfacec", volume, refl_opsurfc);
176 std::cout <<
"Warning: Copper surface in the geometry without REFLECTIVITY assigned"
180 if (Material ==
"G10") {
181 std::cout <<
"G10 surface set " << volume->GetName() << std::endl;
182 if (PropertyPointer) {
183 std::cout <<
"defining G10 optical boundary " << std::endl;
184 G4OpticalSurface* refl_opsurfg =
185 new G4OpticalSurface(
"g10 Surface", glisur, ground, dielectric_metal);
186 refl_opsurfg->SetMaterialPropertiesTable(MaterialTables[Material]);
187 refl_opsurfg->SetPolish(0.1);
188 new G4LogicalSkinSurface(
"refl_surfaceg", volume, refl_opsurfg);
191 std::cout <<
"Warning: G10 surface in the geometry without REFLECTIVITY assigned"
195 if (Material ==
"vm2000") {
196 std::cout <<
"vm2000 surface set " << volume->GetName() << std::endl;
197 if (PropertyPointer) {
198 std::cout <<
"defining vm2000 optical boundary " << std::endl;
199 G4OpticalSurface* refl_opsurf =
new G4OpticalSurface(
200 "Reflector Surface", unified, groundfrontpainted, dielectric_dielectric);
201 refl_opsurf->SetMaterialPropertiesTable(MaterialTables[Material]);
202 G4double sigma_alpha = 0.8;
203 refl_opsurf->SetSigmaAlpha(sigma_alpha);
204 new G4LogicalSkinSurface(
"refl_surface", volume, refl_opsurf);
207 std::cout <<
"Warning: vm2000 surface in the geometry without REFLECTIVITY assigned"
210 if (Material ==
"ALUMINUM_Al") {
211 std::cout <<
"ALUMINUM_Al surface set " << volume->GetName() << std::endl;
212 if (PropertyPointer) {
213 std::cout <<
"defining ALUMINUM_Al optical boundary " << std::endl;
214 G4OpticalSurface* refl_opsurfs =
215 new G4OpticalSurface(
"Surface Aluminum", glisur, ground, dielectric_metal);
216 refl_opsurfs->SetMaterialPropertiesTable(MaterialTables[Material]);
217 refl_opsurfs->SetPolish(0.5);
218 new G4LogicalSkinSurface(
"refl_surfaces", volume, refl_opsurfs);
221 std::cout <<
"Warning: ALUMINUM_Al surface in the geometry without REFLECTIVITY assigned"
224 if (Material ==
"STEEL_STAINLESS_Fe7Cr2Ni") {
225 std::cout <<
"STEEL_STAINLESS_Fe7Cr2Ni surface set " << volume->GetName() << std::endl;
226 if (PropertyPointer) {
227 std::cout <<
"defining STEEL_STAINLESS_Fe7Cr2Ni optical boundary " << std::endl;
228 G4OpticalSurface* refl_opsurfs =
229 new G4OpticalSurface(
"Surface Steel", glisur, ground, dielectric_metal);
230 refl_opsurfs->SetMaterialPropertiesTable(MaterialTables[Material]);
231 refl_opsurfs->SetPolish(0.5);
232 new G4LogicalSkinSurface(
"refl_surfaces", volume, refl_opsurfs);
235 std::cout <<
"Warning: STEEL_STAINLESS_Fe7Cr2Ni surface in the geometry without "
236 "REFLECTIVITY assigned"
244 for (std::map<std::string, G4MaterialPropertiesTable*>::const_iterator j =
245 MaterialTables.begin();
246 j != MaterialTables.end();
248 if (Material == j->first) {
249 TheMaterial->SetMaterialPropertiesTable(j->second);
252 TheMaterial->GetIonisation()->SetBirksConstant(
fBirksConstants[Material]);
253 volume->SetMaterial(TheMaterial);
262 std::map<std::string, std::map<double, double>> Reflectances,
263 std::map<std::string, std::map<double, double>> DiffuseFractions)
265 std::map<double, double> ReflectanceToStore;
266 std::map<double, double> DiffuseToStore;
268 for (std::map<std::string, std::map<double, double>>::const_iterator itMat =
269 Reflectances.begin();
270 itMat != Reflectances.end();
272 std::string ReflectancePropName = std::string(
"REFLECTANCE_") + itMat->first;
273 ReflectanceToStore.clear();
274 for (std::map<double, double>::const_iterator itEn = itMat->second.begin();
275 itEn != itMat->second.end();
277 ReflectanceToStore[itEn->first] = itEn->second;
282 for (std::map<std::string, std::map<double, double>>::const_iterator itMat =
283 DiffuseFractions.begin();
284 itMat != DiffuseFractions.end();
286 std::string DiffusePropName = std::string(
"DIFFUSE_REFLECTANCE_FRACTION_") + itMat->first;
287 DiffuseToStore.clear();
288 for (std::map<double, double>::const_iterator itEn = itMat->second.begin();
289 itEn != itMat->second.end();
291 DiffuseToStore[itEn->first] = itEn->second;
299 std::map<std::string, std::map<double, double>> Reflectances)
301 std::map<double, double> ReflectanceToStore;
303 for (std::map<std::string, std::map<double, double>>::const_iterator itMat =
304 Reflectances.begin();
305 itMat != Reflectances.end();
307 ReflectanceToStore.clear();
308 for (std::map<double, double>::const_iterator itEn = itMat->second.begin();
309 itEn != itMat->second.end();
311 ReflectanceToStore[itEn->first] = itEn->second;
333 "SCINTILLATIONYIELD",
virtual double ScintFastTimeConst() const =0
virtual std::map< double, double > TpbAbs() const =0
Utilities related to art service access.
virtual double ScintSlowTimeConst() const =0
void SetMaterialProperty(std::string Material, std::string Property, std::map< double, double > Values, double Unit)
Stores the specified emergy-dependent material property.
virtual double ProtonScintYieldRatio() const =0
virtual std::map< std::string, std::map< double, double > > SurfaceReflectances() const =0
void GetPropertiesFromServices(detinfo::DetectorPropertiesData const &detProp)
Imports properties from LArSoft services.
virtual double PionScintYieldRatio() const =0
virtual double KaonScintYield(bool prescale=false) const =0
virtual std::map< double, double > AbsLengthSpectrum() const =0
std::map< std::string, std::map< std::string, std::map< double, double > > > fPropertyList
virtual std::map< double, double > TpbEm() const =0
virtual bool ExtraMatProperties() const =0
void SetMaterialConstProperty(std::string Material, std::string Property, double Value, double Unit)
Stores the specified material property.
util::quantities::megaelectronvolt MeV
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
virtual std::map< double, double > SlowScintSpectrum() const =0
kilovolt_as<> kilovolt
Type of potential stored in kilovolt, in double precision.
virtual double AlphaScintYieldRatio() const =0
double Efield(unsigned int planegap=0) const
kV/cm
virtual double TpbTimeConstant() const =0
virtual double MuonScintYieldRatio() const =0
std::map< std::string, std::map< std::string, double > > fConstPropertyList
virtual double ScintYieldRatio() const =0
virtual double ElectronScintYield(bool prescale=false) const =0
virtual std::map< double, double > RayleighSpectrum() const =0
virtual std::map< double, double > RIndexSpectrum() const =0
virtual std::map< std::string, std::map< double, double > > SurfaceReflectanceDiffuseFractions() const =0
BEGIN_PROLOG supported so Material
virtual double PionScintYield(bool prescale=false) const =0
virtual double KaonScintYieldRatio() const =0
virtual double ProtonScintYield(bool prescale=false) const =0
void UpdateGeometry(G4LogicalVolumeStore *lvs)
Updates the material properties with the collected values.
bool SimpleBoundary() const
virtual std::map< double, double > FastScintSpectrum() const =0
virtual double ScintBirksConstant() const =0
virtual double ElectronScintYieldRatio() const =0
void SetReflectances(std::string, std::map< std::string, std::map< double, double >>, std::map< std::string, std::map< double, double >>)
virtual double ScintYield(bool prescale=false) const =0
virtual double MuonScintYield(bool prescale=false) const =0
virtual double ScintResolutionScale() const =0
virtual bool ScintByParticleType() const =0
void SetBirksConstant(std::string, double, double)
std::map< std::string, double > fBirksConstants
virtual double AlphaScintYield(bool prescale=false) const =0
BEGIN_PROLOG could also be cout