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" 31 std::map<double, double> PropertyVector,
34 std::map<double, double> PropVectorWithUnit;
36 it != PropertyVector.end();
38 PropVectorWithUnit[it->first * CLHEP::eV] = it->second * Unit;
42 mf::LogInfo(
"MaterialPropertyLoader") <<
"Added property " << Material <<
" " << Property;
54 <<
"Added const property " << Material <<
" " << Property <<
" = " << PropertyValue;
64 mf::LogInfo(
"MaterialPropertyLoader") <<
"Set Birks constant " << Material;
70 std::map<std::string, G4MaterialPropertiesTable*> MaterialTables;
71 std::map<std::string, bool> MaterialsSet;
74 mf::LogInfo(
"MaterialPropertyLoader") <<
"UPDATING GEOMETRY";
77 for (std::map<std::string, std::map<std::string, std::map<double, double>>>::
const_iterator i =
81 std::string Material = i->first;
82 MaterialsSet[Material] =
true;
83 MaterialTables[Material] =
new G4MaterialPropertiesTable;
88 for (std::map<std::string, std::map<std::string, double>>::
const_iterator i =
92 std::string Material = i->first;
93 if (!MaterialsSet[Material]) {
94 MaterialsSet[Material] =
true;
95 MaterialTables[Material] =
new G4MaterialPropertiesTable;
103 for (std::map<std::string, std::map<std::string, std::map<double, double>>>::
const_iterator i =
107 std::string Material = i->first;
108 for (std::map<std::string, std::map<double, double>>::
const_iterator j = i->second.begin();
109 j != i->second.end();
111 std::string Property = j->first;
112 std::vector<G4double> g4MomentumVector;
113 std::vector<G4double> g4PropertyVector;
117 g4MomentumVector.push_back(k->first);
118 g4PropertyVector.push_back(k->second);
120 int NoOfElements = g4MomentumVector.size();
121 MaterialTables[Material]->AddProperty(
122 Property.c_str(), &g4MomentumVector[0], &g4PropertyVector[0], NoOfElements);
125 <<
"Added property " << Property <<
" to material table " << Material;
130 for (std::map<std::string, std::map<std::string, double>>::
const_iterator i =
134 std::string Material = i->first;
136 j != i->second.end();
138 std::string Property = j->first;
139 G4double PropertyValue = j->second;
140 MaterialTables[Material]->AddConstProperty(Property.c_str(), PropertyValue);
143 <<
"Added const property " << Property <<
" to material table " << Material;
149 G4LogicalVolume* volume = (*i);
150 G4Material* TheMaterial = volume->GetMaterial();
151 std::string Material = TheMaterial->GetName();
159 G4MaterialPropertyVector* PropertyPointer = 0;
160 if (MaterialTables[Material])
161 PropertyPointer = MaterialTables[Material]->GetProperty(
"REFLECTIVITY");
163 if (Material ==
"Copper") {
164 std::cout <<
"copper foil surface set " << volume->GetName() << std::endl;
165 if (PropertyPointer) {
166 std::cout <<
"defining Copper optical boundary " << std::endl;
167 G4OpticalSurface* refl_opsurfc =
168 new G4OpticalSurface(
"Surface copper", glisur, ground, dielectric_metal);
169 refl_opsurfc->SetMaterialPropertiesTable(MaterialTables[Material]);
170 refl_opsurfc->SetPolish(0.2);
171 new G4LogicalSkinSurface(
"refl_surfacec", volume, refl_opsurfc);
174 std::cout <<
"Warning: Copper surface in the geometry without REFLECTIVITY assigned" 178 if (Material ==
"G10") {
179 std::cout <<
"G10 surface set " << volume->GetName() << std::endl;
180 if (PropertyPointer) {
181 std::cout <<
"defining G10 optical boundary " << std::endl;
182 G4OpticalSurface* refl_opsurfg =
183 new G4OpticalSurface(
"g10 Surface", glisur, ground, dielectric_metal);
184 refl_opsurfg->SetMaterialPropertiesTable(MaterialTables[Material]);
185 refl_opsurfg->SetPolish(0.1);
186 new G4LogicalSkinSurface(
"refl_surfaceg", volume, refl_opsurfg);
189 std::cout <<
"Warning: G10 surface in the geometry without REFLECTIVITY assigned" 193 if (Material ==
"vm2000") {
194 std::cout <<
"vm2000 surface set " << volume->GetName() << std::endl;
195 if (PropertyPointer) {
196 std::cout <<
"defining vm2000 optical boundary " << std::endl;
197 G4OpticalSurface* refl_opsurf =
new G4OpticalSurface(
198 "Reflector Surface", unified, groundfrontpainted, dielectric_dielectric);
199 refl_opsurf->SetMaterialPropertiesTable(MaterialTables[Material]);
200 G4double sigma_alpha = 0.8;
201 refl_opsurf->SetSigmaAlpha(sigma_alpha);
202 new G4LogicalSkinSurface(
"refl_surface", volume, refl_opsurf);
205 std::cout <<
"Warning: vm2000 surface in the geometry without REFLECTIVITY assigned" 208 if (Material ==
"ALUMINUM_Al") {
209 std::cout <<
"ALUMINUM_Al surface set " << volume->GetName() << std::endl;
210 if (PropertyPointer) {
211 std::cout <<
"defining ALUMINUM_Al optical boundary " << std::endl;
212 G4OpticalSurface* refl_opsurfs =
213 new G4OpticalSurface(
"Surface Aluminum", glisur, ground, dielectric_metal);
214 refl_opsurfs->SetMaterialPropertiesTable(MaterialTables[Material]);
215 refl_opsurfs->SetPolish(0.5);
216 new G4LogicalSkinSurface(
"refl_surfaces", volume, refl_opsurfs);
219 std::cout <<
"Warning: ALUMINUM_Al surface in the geometry without REFLECTIVITY assigned" 222 if (Material ==
"STEEL_STAINLESS_Fe7Cr2Ni") {
223 std::cout <<
"STEEL_STAINLESS_Fe7Cr2Ni surface set " << volume->GetName() << std::endl;
224 if (PropertyPointer) {
225 std::cout <<
"defining STEEL_STAINLESS_Fe7Cr2Ni optical boundary " << std::endl;
226 G4OpticalSurface* refl_opsurfs =
227 new G4OpticalSurface(
"Surface Steel", glisur, ground, dielectric_metal);
228 refl_opsurfs->SetMaterialPropertiesTable(MaterialTables[Material]);
229 refl_opsurfs->SetPolish(0.5);
230 new G4LogicalSkinSurface(
"refl_surfaces", volume, refl_opsurfs);
233 std::cout <<
"Warning: STEEL_STAINLESS_Fe7Cr2Ni surface in the geometry without " 234 "REFLECTIVITY assigned" 243 MaterialTables.begin();
244 j != MaterialTables.end();
246 if (Material == j->first) {
247 TheMaterial->SetMaterialPropertiesTable(j->second);
250 TheMaterial->GetIonisation()->SetBirksConstant(
fBirksConstants[Material]);
251 volume->SetMaterial(TheMaterial);
259 std::map<std::string, std::map<double, double>> Reflectances,
260 std::map<std::string, std::map<double, double>> DiffuseFractions)
262 std::map<double, double> ReflectanceToStore;
263 std::map<double, double> DiffuseToStore;
265 for (std::map<std::string, std::map<double, double>>::
const_iterator itMat =
266 Reflectances.begin();
267 itMat != Reflectances.end();
269 std::string ReflectancePropName = std::string(
"REFLECTANCE_") + itMat->first;
270 ReflectanceToStore.clear();
272 itEn != itMat->second.end();
274 ReflectanceToStore[itEn->first] = itEn->second;
279 for (std::map<std::string, std::map<double, double>>::
const_iterator itMat =
280 DiffuseFractions.begin();
281 itMat != DiffuseFractions.end();
283 std::string DiffusePropName = std::string(
"DIFFUSE_REFLECTANCE_FRACTION_") + itMat->first;
284 DiffuseToStore.clear();
286 itEn != itMat->second.end();
288 DiffuseToStore[itEn->first] = itEn->second;
295 std::map<std::string, std::map<double, double>> Reflectances)
297 std::map<double, double> ReflectanceToStore;
299 for (std::map<std::string, std::map<double, double>>::
const_iterator itMat =
300 Reflectances.begin();
301 itMat != Reflectances.end();
303 ReflectanceToStore.clear();
305 itEn != itMat->second.end();
307 ReflectanceToStore[itEn->first] = itEn->second;
329 "SCINTILLATIONYIELD",
350 "LAr",
"PROTONSCINTILLATIONYIELD", LarProp->
ProtonScintYield(
true), 1. / CLHEP::MeV);
353 "LAr",
"MUONSCINTILLATIONYIELD", LarProp->
MuonScintYield(
true), 1. / CLHEP::MeV);
356 "LAr",
"KAONSCINTILLATIONYIELD", LarProp->
KaonScintYield(
true), 1. / CLHEP::MeV);
359 "LAr",
"PIONSCINTILLATIONYIELD", LarProp->
PionScintYield(
true), 1. / CLHEP::MeV);
362 "LAr",
"ELECTRONSCINTILLATIONYIELD", LarProp->
ElectronScintYield(
true), 1. / CLHEP::MeV);
365 "LAr",
"ALPHASCINTILLATIONYIELD", LarProp->
AlphaScintYield(
true), 1. / CLHEP::MeV);
virtual double ElectronScintYieldRatio() const =0
virtual double ScintYieldRatio() const =0
virtual double AlphaScintYield(bool prescale=false) const =0
virtual std::map< double, double > AbsLengthSpectrum() const =0
Utilities related to art service access.
void SetMaterialProperty(std::string Material, std::string Property, std::map< double, double > Values, double Unit)
Stores the specified emergy-dependent material property.
virtual std::map< double, double > RayleighSpectrum() const =0
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
virtual std::map< double, double > RIndexSpectrum() const =0
virtual double AlphaScintYieldRatio() const =0
void GetPropertiesFromServices(detinfo::DetectorPropertiesData const &detProp)
Imports properties from LArSoft services.
virtual double ScintSlowTimeConst() const =0
std::map< std::string, std::map< std::string, std::map< double, double > > > fPropertyList
virtual double ScintFastTimeConst() const =0
virtual double ProtonScintYieldRatio() const =0
void SetMaterialConstProperty(std::string Material, std::string Property, double Value, double Unit)
Stores the specified material property.
kilovolt_as<> kilovolt
Type of potential stored in kilovolt, in double precision.
virtual double ScintResolutionScale() const =0
double Efield(unsigned int planegap=0) const
kV/cm
virtual double ProtonScintYield(bool prescale=false) const =0
virtual double PionScintYieldRatio() const =0
std::map< std::string, std::map< std::string, double > > fConstPropertyList
virtual bool ExtraMatProperties() const =0
virtual double ScintBirksConstant() const =0
virtual double ElectronScintYield(bool prescale=false) const =0
virtual double PionScintYield(bool prescale=false) const =0
virtual std::map< double, double > TpbEm() const =0
virtual double TpbTimeConstant() const =0
virtual std::map< std::string, std::map< double, double > > SurfaceReflectances() const =0
void UpdateGeometry(G4LogicalVolumeStore *lvs)
Updates the material properties with the collected values.
bool SimpleBoundary() const
virtual std::map< double, double > SlowScintSpectrum() const =0
virtual double MuonScintYield(bool prescale=false) const =0
virtual double KaonScintYield(bool prescale=false) const =0
virtual std::map< double, double > TpbAbs() const =0
virtual double ScintYield(bool prescale=false) const =0
virtual double MuonScintYieldRatio() const =0
void SetReflectances(std::string, std::map< std::string, std::map< double, double >>, std::map< std::string, std::map< double, double >>)
virtual std::map< std::string, std::map< double, double > > SurfaceReflectanceDiffuseFractions() const =0
void SetBirksConstant(std::string, double, double)
virtual double KaonScintYieldRatio() const =0
std::map< std::string, double > fBirksConstants
virtual bool ScintByParticleType() const =0
virtual std::map< double, double > FastScintSpectrum() const =0