20#include "BDSException.hh"
21#include "BDSMaterials.hh"
22#include "BDSParser.hh"
23#include "BDSUtilities.hh"
24#include "BDSWarning.hh"
26#include "G4MaterialTable.hh"
28#include "G4NistManager.hh"
29#include "G4Version.hh"
46BDSMaterials::BDSMaterials()
49 G4cout <<
"BDSMaterials: G4 predefined units: " << G4endl;
50 G4cout <<
"g= " << CLHEP::g << G4endl;
51 G4cout <<
"m= " << CLHEP::m << G4endl;
52 G4cout <<
"mole= " << CLHEP::mole << G4endl;
53 G4cout <<
"kelvin= " << CLHEP::kelvin << G4endl;
71#if G4VERSION_NUMBER < 1011
72 G4double NTP_Temperature = 293.15;
95 std::list<int> singleElement = {1};
96 AddMaterial(
"graphite", 2.265, kStateSolid, NTP_Temperature, 1, {
"C"}, singleElement);
97 AddMaterial(
"graphitefoam", 0.61, kStateSolid, NTP_Temperature, 1, {
"C"}, singleElement);
98 AddMaterial(
"solidhydrogen",8.96, kStateSolid, NTP_Temperature, 1, {
"H"}, singleElement);
99 AddMaterial(
"solidnitrogen",8.96, kStateSolid, NTP_Temperature, 1, {
"N"}, singleElement);
100 AddMaterial(
"solidoxygen", 8.96, kStateSolid, NTP_Temperature, 1, {
"O"}, singleElement);
101 AddMaterial(
"weightiron", 7.87, kStateSolid, NTP_Temperature, 1, {
"Fe"}, singleElement);
106 kStateSolid, NTP_Temperature, 1,
108 std::list<int>{1, 1, 4});
114 std::list<double>{0.338, 0.662});
121 std::list<double>{0.025, 0.03, 0.945});
127 {
"C",
"Mn",
"P",
"S",
"Fe"},
128 std::list<double>{0.0017, 0.0045, 0.0004, 0.0005, 0.9929});
134 {
"Cu",
"Be",
"Co",
"Al",
"Fe",
"Ni"},
135 std::list<double>{0.991, 0.0031, 0.00500, 0.0004, 0.0003, 0.0002});
141 {
"C",
"Mn",
"Si",
"P",
"S",
"Cr",
"Mo",
"Ni",
"N",
"Fe"},
142 std::list<double>{0.0003, 0.02, 0.0075, 0.00045, 0.0003, 0.17, 0.025, 0.12, 0.001, 0.65545});
148 {
"Fe",
"Cr",
"Ni",
"Mn",
"Si",
"P",
"S",
"C"},
149 std::list<double>{0.67145, 0.185, 0.1125, 0.02, 0.01, 0.00045, 0.0003, 0.0003});
155 {
"Fe",
"Cr",
"Ni",
"Mn",
"Si",
"P",
"S",
"C"},
156 std::list<double>{0.67145, 0.185, 0.1125, 0.02, 0.01, 0.00045, 0.0003, 0.0003});
162 {
"Fe",
"Cr",
"Ni",
"Mn",
"Si",
"P",
"S",
"C"},
163 std::list<double>{0.67145, 0.185, 0.1125, 0.02, 0.01, 0.00045, 0.0003, 0.0003});
170 {
"Fe",
"Cr",
"Ni",
"Mo",
"Mn",
"Si",
"Ti",
"N",
"Nb",
171 "Cu",
"Co",
"P",
"C",
"S",
"Ta",
"B"},
172 std::list<double>{0.65093, 0.1700, 0.12000, 0.02500, 0.0200, 0.00750,
173 0.00150, 0.0014, 0.00100, 0.00100, 0.0005, 0.00045,
174 0.00030, 0.0003, 0.00010, 0.00002});
181 {
"Fe",
"Cr",
"Ni",
"Mo",
"Mn",
"Si",
"Ti",
"N",
182 "Nb",
"Cu",
"Co",
"P",
"C",
"S",
"Ta",
"B"},
183 std::list<double>{0.65093, 0.1700, 0.12000, 0.02500, 0.0200,
184 0.00750, 0.00150, 0.0014, 0.00100, 0.00100,
185 0.0005, 0.00045, 0.00030, 0.0003, 0.00010,
193 {
"Fe",
"Cr",
"Ni",
"Mo",
"Mn",
"Si",
"Ti",
"N",
194 "Nb",
"Cu",
"Co",
"P",
"C",
"S",
"Ta",
"B"},
195 std::list<double>{0.65093, 0.1700, 0.12000, 0.02500, 0.0200,
196 0.00750, 0.00150, 0.0014, 0.00100, 0.00100,
197 0.0005, 0.00045, 0.00030, 0.0003, 0.00010,
202 AddMaterial(
"mild_steel", 8.000, kStateSolid, 295, 1,
203 {
"C",
"Mn",
"Si",
"Fe"},
204 std::list<double>{0.002, 0.005, 0.0015, 0.99150});
213 std::list<double>{0.97, 0.02, 0.01});
220 std::list<double>{0.90, 0.05, 0.05});
227 std::list<double>{0.925, 0.0375, 0.0375});
234 std::list<double>{0.95, 0.025, 0.025});
240 AddMaterial(
"niobium_2k", 8.57 , kStateSolid, 2, 1, {
"Nb"}, std::list<int>{1});
243 AddMaterial(
"nbti_4k", 5.6 , kStateSolid, 4, 1, {
"Nb",
"Ti"}, std::list<int>{1,1});
252 {
"B",
"Ni",
"O",
"Ca",
"Si"},
253 std::list<double>{0.383249242, 0.472071387, 0.0366276887, 0.0228923054, 0.0851593762});
260 std::list<int>{1,3,1});
267 std::list<int>{1,9,2,4});
271 kStateSolid, 300, 1, {
"Si",
"O",
"H",
"Ca",
"Al",
"Fe"},
272 std::list<double>{0.227915, 0.60541, 0.09972, 0.04986, 0.014245, 0.00285});
276 G4Material* tmpMaterial =
new G4Material(
"fusedsilica",
277 1.032*CLHEP::g/CLHEP::cm3,
282 const G4int FusedSilica_NUMENTRIES = 3;
283 G4double FusedSilica_RIND[FusedSilica_NUMENTRIES]={1.49,1.49,1.49};
284 G4double FusedSilica_AbsLength[FusedSilica_NUMENTRIES]={420.*CLHEP::cm,420.*CLHEP::cm,420.*CLHEP::cm};
285 G4double FusedSilica_Energy[FusedSilica_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
287 fsMaterialPropertiesTable->AddProperty(
"ABSLENGTH",FusedSilica_Energy,FusedSilica_AbsLength,FusedSilica_NUMENTRIES);
288 fsMaterialPropertiesTable->AddProperty(
"RINDEX",FusedSilica_Energy,FusedSilica_RIND,FusedSilica_NUMENTRIES);
289 tmpMaterial->SetMaterialPropertiesTable(fsMaterialPropertiesTable);
299 std::list<double>{0.59984,0.31961,0.08055});
306 std::list<double>{0.35,0.65});
313 std::list<double>{0.026362,0.691133,0.073270,0.209235});
316 tmpMaterial =
new G4Material(
"n-bk7", 1.032*CLHEP::g/CLHEP::cm3, 2, kStateSolid);
319 const G4int N_Bk7_NUMENTRIES = 3;
320 G4double N_Bk7_RIND[N_Bk7_NUMENTRIES]={1.51680,1.51680,1.51680};
321 G4double N_Bk7_AbsLength[N_Bk7_NUMENTRIES]={420.*CLHEP::cm,420.*CLHEP::cm,420.*CLHEP::cm};
322 G4double N_Bk7_Energy[N_Bk7_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
324 nbk7MaterialPropertiesTable->AddProperty(
"ABSLENGTH",N_Bk7_Energy,N_Bk7_AbsLength,N_Bk7_NUMENTRIES);
325 nbk7MaterialPropertiesTable->AddProperty(
"RINDEX",N_Bk7_Energy,N_Bk7_RIND,N_Bk7_NUMENTRIES);
326 tmpMaterial->SetMaterialPropertiesTable(nbk7MaterialPropertiesTable);
330 AddMaterial(
"quartz", 2.655, kStateSolid, 300, 1, {
"Si",
"O"}, std::list<int>{1,2});
336 {
"clay",
"calciumCarbonate"},
337 std::list<double>{0.5,0.5});
343 {
"clay",
"calciumCarbonate"},
344 std::list<double>{0.65,0.35});
350 {
"clay",
"calciumCarbonate"},
351 std::list<double>{0.35,0.65});
358 std::list<double>{0.33377483443708611, 0.57218543046357617, 0.022516556291390728, 0.071523178807947022});
362 AddMaterial(
"aralditef", 1.175, kStateSolid, 300, 1, {
"C",
"H",
"O"},std::list<int>{12,18,4});
365 AddMaterial(
"hy906", 1.225, kStateSolid, 300, 1, {
"C",
"H",
"O"},std::list<int>{10,5,3});
368 AddMaterial(
"dy061", 1.025, kStateSolid, 300, 1, {
"C",
"H",
"O",
"N"},std::list<int>{15,25,1,3});
375 {
"aralditef",
"hy906",
"dy061"},
376 std::list<double>{0.497512,0.497512,0.004976});
379 tmpMaterial = G4NistManager::Instance()->FindOrBuildMaterial(
"G4_CELLULOSE_CELLOPHANE",
true,
true);
380 const G4int Cellulose_NUMENTRIES = 3;
381 G4double Cellulose_RIND[Cellulose_NUMENTRIES] = {1.532,1.532,1.532};
382 G4double Cellulose_Energy[Cellulose_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
384 celluloseMaterialPropertiesTable->AddProperty(
"RINDEX",Cellulose_Energy, Cellulose_RIND, Cellulose_NUMENTRIES);
385 tmpMaterial->SetMaterialPropertiesTable(celluloseMaterialPropertiesTable);
391 kStateSolid, NTP_Temperature, 1,
393 std::list<int>{6,10,2,4});
401 std::list<int>{2,4});
407 G4Material* tmpMaterial =
new G4Material(
"yag", 4.56*CLHEP::g/CLHEP::cm3, 3);
410 tmpMaterial->AddElement(
GetElement(
"O") , 12);
411 G4double birks = 0.08*CLHEP::mm/CLHEP::MeV;
412 tmpMaterial->GetIonisation()->SetBirksConstant(birks);
415 const G4int nEntries = 9;
416 G4double PhotonEnergyYAG[nEntries];
417 G4double dNEntries2=(G4double)nEntries;
418 G4double energyMin=1.91*CLHEP::eV;
419 G4double energyMax=2.76*CLHEP::eV;
420 G4double deltaEnergy=(energyMax-energyMin)/(dNEntries2-1.0);
421 G4double energy=energyMin;
422 for (G4int i=0; i<nEntries; energy += deltaEnergy, i++)
423 {PhotonEnergyYAG[i]=energy;}
425 G4double RefractiveIndexYAG[nEntries] =
426 { 1.82, 1.82, 1.82, 1.82, 1.82, 1.82, 1.82,
429 mpt_YAG->AddProperty(
"RINDEX",PhotonEnergyYAG, RefractiveIndexYAG, nEntries);
430#if G4VERSION_NUMBER < 1079
431 G4double scintFastYAG[nEntries] =
432 { 0, 0.25, 2.0, 14.0, 13.0, 7.0, 4.0, 2.0, 0.0 };
434 mpt_YAG->AddProperty(
"FASTCOMPONENT",PhotonEnergyYAG, scintFastYAG, nEntries)->SetSpline(
true);
435 mpt_YAG->AddConstProperty(
"FASTTIMECONSTANT",70.*CLHEP::ns);
436 mpt_YAG->AddConstProperty(
"YIELDRATIO",1.0);
438 mpt_YAG->AddConstProperty(
"SCINTILLATIONYIELD",8000./CLHEP::MeV);
439 mpt_YAG->AddConstProperty(
"RESOLUTIONSCALE",2.0);
440 tmpMaterial->SetMaterialPropertiesTable(mpt_YAG);
445 G4NistManager* nistManager = G4NistManager::Instance();
446 G4Material* polystyrene = nistManager->FindOrBuildMaterial(
"G4_POLYSTYRENE",
true,
true);
447 tmpMaterial =
new G4Material(
"ups923a",polystyrene->GetDensity(),1);
448 tmpMaterial->AddMaterial(polystyrene,1);
449 tmpMaterial->SetName(
"ups923a");
450 std::vector<G4double> ups923a_PhotonEnergy = {
451 3.35, 3.31, 3.28, 3.26, 3.25, 3.23, 3.23,
452 3.22, 3.21, 3.19, 3.18, 3.17, 3.16, 3.15,
453 3.14, 3.14, 3.13, 3.11, 3.1, 3.09, 3.09,
454 3.08, 3.07, 3.04, 3.02, 3.02, 3.01, 2.99,
455 2.98, 2.97, 2.97, 2.95, 2.95, 2.93, 2.93,
456 2.92, 2.92, 2.91, 2.89, 2.88, 2.87, 2.86,
457 2.85, 2.83, 2.81, 2.8, 2.79, 2.78, 2.76,
458 2.74, 2.72, 2.71, 2.68, 2.66, 2.64, 2.62,
459 2.61, 2.58, 2.55, 2.53, 2.5, 2.48, 2.46,
460 2.44, 2.41, 2.38, 2.35 };
461 std::reverse(ups923a_PhotonEnergy.begin(), ups923a_PhotonEnergy.end());
465 std::vector<G4double> ups923a_RINDEX(ups923a_PhotonEnergy.size(), 1.52);
466 std::vector<G4double> ups923a_ABSLENGTH(ups923a_PhotonEnergy.size(), 1*CLHEP::m);
469#if G4VERSION_NUMBER < 1070
470 ups923a_mt->AddProperty(
"RINDEX", ups923a_PhotonEnergy.data(), ups923a_RINDEX.data(), (
int)ups923a_PhotonEnergy.size());
471 ups923a_mt->AddProperty(
"ABSLENGTH", ups923a_PhotonEnergy.data(), ups923a_ABSLENGTH.data(), (
int)ups923a_PhotonEnergy.size());
473 ups923a_mt->AddProperty(
"RINDEX", ups923a_PhotonEnergy, ups923a_RINDEX);
474 ups923a_mt->AddProperty(
"ABSLENGTH", ups923a_PhotonEnergy, ups923a_ABSLENGTH);
477 birks = (0.014/1.06)*CLHEP::cm/CLHEP::MeV;
478 tmpMaterial->GetIonisation()->SetBirksConstant(birks);
479#if G4VERSION_NUMBER < 1079
480 const G4int ups923a_numentries = 67;
481 G4double ups923a_emission[ups923a_numentries] = {
482 0, 0.04, 0.11, 0.2, 0.3, 0.4, 0.52,
483 0.62, 0.67, 0.68, 0.67, 0.62, 0.53, 0.48,
484 0.44, 0.42, 0.4, 0.41, 0.42, 0.51, 0.46,
485 0.57, 0.67, 0.78, 0.91, 0.93, 0.95, 0.96,
486 0.94, 0.91, 0.85, 0.76, 0.67, 0.61, 0.57,
487 0.55, 0.52, 0.51, 0.52, 0.54, 0.57, 0.58,
488 0.6, 0.6, 0.59, 0.58, 0.55, 0.48, 0.42,
489 0.37, 0.33, 0.31, 0.29, 0.28, 0.26, 0.24,
490 0.2, 0.17, 0.12, 0.09, 0.08, 0.07,
491 0.06, 0.04, 0.02, 0.01, 0.01 };
492 ups923a_mt->AddConstProperty(
"FASTTIMECONSTANT",3.3*CLHEP::ns);
493 ups923a_mt->AddProperty(
"FASTCOMPONENT",ups923a_PhotonEnergy.data(), ups923a_emission, ups923a_numentries)->SetSpline(
true);
494 ups923a_mt->AddConstProperty(
"YIELDRATIO",1.0);
496 ups923a_mt->AddConstProperty(
"RESOLUTIONSCALE",2.0);
497 G4double scintYieldAnthracene=14200;
498 G4double scintYieldUPS923A=scintYieldAnthracene*0.60;
499 ups923a_mt->AddConstProperty(
"SCINTILLATIONYIELD",scintYieldUPS923A/CLHEP::MeV);
501 tmpMaterial->SetMaterialPropertiesTable(ups923a_mt);
505 G4double pet_density=1.4*CLHEP::g/CLHEP::cm3;
506 G4int pet_nelements=3;
507 G4State pet_state=kStateSolid;
508 tmpMaterial=
new G4Material(
"pet",
512 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"C",
true),10);
513 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"H",
true),8);
514 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"O",
true),4);
515 const G4int Pet_NUMENTRIES = 3;
516 G4double Pet_RIND[Pet_NUMENTRIES] = {1.570,1.570,1.570};
517 G4double Pet_Energy[Pet_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
519 petMaterialPropertiesTable->AddProperty(
"RINDEX",Pet_Energy, Pet_RIND, Pet_NUMENTRIES);
520 tmpMaterial->SetMaterialPropertiesTable(petMaterialPropertiesTable);
524 tmpMaterial=
new G4Material(
"pet_opaque",
528 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"C",
true),10);
529 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"H",
true),8);
530 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"O",
true),4);
531 const G4int Pet_Opaque_NUMENTRIES = 3;
532 G4double Pet_Opaque_RIND[Pet_Opaque_NUMENTRIES] = {1.570,1.570,1.570};
533 G4double Pet_Opaque_Energy[Pet_Opaque_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
534 G4double Pet_Opaque_abslen[]={1*CLHEP::um, 1*CLHEP::um, 1*CLHEP::um};
536 pet_opaqueMaterialPropertiesTable->AddProperty(
"RINDEX",Pet_Opaque_Energy, Pet_Opaque_RIND, Pet_Opaque_NUMENTRIES);
537 pet_opaqueMaterialPropertiesTable->AddProperty(
"ABSLENGTH",Pet_Opaque_Energy, Pet_Opaque_abslen, Pet_Opaque_NUMENTRIES);
538 tmpMaterial->SetMaterialPropertiesTable(pet_opaqueMaterialPropertiesTable);
542 G4Material* GOS = nistManager->FindOrBuildMaterial(
"G4_GADOLINIUM_OXYSULFIDE",
true,
true);
545 G4double fill_factor=0.5;
546 G4double lanex_density=fill_factor*GOS->GetDensity()+(1-fill_factor)*
GetMaterial(
"polyurethane")->GetDensity();
547 G4double gos_fraction_by_mass=fill_factor*GOS->GetDensity()/lanex_density;
548 G4double pur_fraction_by_mass=1-gos_fraction_by_mass;
550 tmpMaterial =
new G4Material(
"lanex", lanex_density, 2);
551 tmpMaterial->AddMaterial(GOS, gos_fraction_by_mass);
552 tmpMaterial->AddMaterial(
GetMaterial(
"polyurethane"), pur_fraction_by_mass);
555 const G4int nentLanex=2;
556 G4double rindex=1.50;
557 G4double energytab[]={2.239*CLHEP::eV, 2.241*CLHEP::eV};
558 G4double rindextab[]={rindex, rindex};
559 G4double abslen[]={7*CLHEP::mm, 7*CLHEP::mm};
560 mptLanex->AddProperty(
"RINDEX",energytab, rindextab, nentLanex);
561 mptLanex->AddProperty(
"ABSLENGTH", energytab, abslen, nentLanex);
562#if G4VERSION_NUMBER < 1079
563 mptLanex->AddConstProperty(
"MIEHG", 60.3e-3*CLHEP::mm);
564 G4double emitspec[]={1.0, 1.0};
565 mptLanex->AddProperty(
"FASTCOMPONENT",energytab, emitspec, nentLanex);
566 mptLanex->AddConstProperty(
"FASTTIMECONSTANT", 1.*CLHEP::ns);
568 G4double scintScalingFactor=1;
569 mptLanex->AddConstProperty(
"SCINTILLATIONYIELD",7.8e4/CLHEP::MeV);
570 mptLanex->AddConstProperty(
"RESOLUTIONSCALE",1.0);
571 mptLanex->AddConstProperty(
"MIEHG_FORWARD", 0.91);
572 mptLanex->AddConstProperty(
"MIEHG_BACKWARD", 0.91);
573 mptLanex->AddConstProperty(
"MIEHG_FORWARD_RATIO", 1.0);
574 tmpMaterial->SetMaterialPropertiesTable(mptLanex);
578 tmpMaterial =
new G4Material(
"lanex2", lanex_density, 2);
579 tmpMaterial->AddMaterial(GOS, gos_fraction_by_mass);
580 tmpMaterial->AddMaterial(
GetMaterial(
"polyurethane"), pur_fraction_by_mass);
582 mptLanex2->AddProperty(
"RINDEX",energytab, rindextab, nentLanex);
583 mptLanex2->AddProperty(
"ABSLENGTH", energytab, abslen, nentLanex);
584#if G4VERSION_NUMBER < 1079
585 mptLanex2->AddConstProperty(
"MIEHG", 60.3e-3*CLHEP::mm);
586 mptLanex2->AddProperty(
"FASTCOMPONENT",energytab, emitspec, nentLanex);
587 mptLanex2->AddConstProperty(
"FASTTIMECONSTANT", 1.*CLHEP::ns);
589 mptLanex2->AddConstProperty(
"SCINTILLATIONYIELD",8.9e4/CLHEP::MeV);
590 mptLanex2->AddConstProperty(
"RESOLUTIONSCALE",1.0);
591 mptLanex2->AddConstProperty(
"MIEHG_FORWARD", 0.91);
592 mptLanex2->AddConstProperty(
"MIEHG_BACKWARD", 0.91);
593 mptLanex2->AddConstProperty(
"MIEHG_FORWARD_RATIO", 0.5);
594 tmpMaterial->SetMaterialPropertiesTable(mptLanex);
598 G4double gos_lanex_density=GOS->GetDensity();
599 tmpMaterial =
new G4Material(
"gos_lanex", gos_lanex_density, 1);
600 tmpMaterial->AddMaterial(GOS, 1.0);
602 const G4int nentGOSLanex=2;
603 G4double rindexGOSLanex=1.50;
604 G4double energyGOSLanexTab[]={2.239*CLHEP::eV, 2.241*CLHEP::eV};
605 G4double rindexGOSLanexTab[]={rindexGOSLanex, rindexGOSLanex};
606 G4double abslenGOSLanex[]={7*CLHEP::mm, 7*CLHEP::mm};
607 G4double gosLanexMiehgForward=0.911;
608 G4double gosLanexMiehgBackward=0.911;
609 G4double gosLanexMiehgForwardRatio=0.5;
610#if G4VERSION_NUMBER < 1079
611 G4double mieHgTimeConst=1.0*CLHEP::ns;
612 G4double emitspecGOSLanex[]={1.0, 1.0};
613 G4double mieScatteringLengthGOSLanex=60.3*CLHEP::um;
614 mptGOSLanex->AddProperty(
"FASTCOMPONENT",energyGOSLanexTab, emitspecGOSLanex, nentGOSLanex);
615 mptGOSLanex->AddConstProperty(
"FASTTIMECONSTANT", mieHgTimeConst);
616 mptGOSLanex->AddConstProperty(
"YIELDRATIO", 1.0);
617 mptGOSLanex->AddConstProperty(
"MIEHG", mieScatteringLengthGOSLanex);
619 mptGOSLanex->AddConstProperty(
"SCINTILLATIONYIELD",8.9e4/CLHEP::MeV);
620 mptGOSLanex->AddConstProperty(
"RESOLUTIONSCALE", 1.0);
621 mptGOSLanex->AddConstProperty(
"MIEHG_FORWARD", gosLanexMiehgForward);
622 mptGOSLanex->AddConstProperty(
"MIEHG_BACKWARD", gosLanexMiehgBackward);
623 mptGOSLanex->AddConstProperty(
"MIEHG_FORWARD_RATIO", gosLanexMiehgForwardRatio);
624 mptGOSLanex->AddProperty(
"RINDEX",energyGOSLanexTab, rindexGOSLanexTab, nentGOSLanex);
625 mptGOSLanex->AddProperty(
"ABSLENGTH", energyGOSLanexTab, abslenGOSLanex, nentGOSLanex);
626 tmpMaterial->SetMaterialPropertiesTable(mptGOSLanex);
630 tmpMaterial =
new G4Material(
"gos_ri1", gos_lanex_density, 1);
631 tmpMaterial->AddMaterial(GOS, 1.0);
633 G4double rindexGOSLanexRi1Tab[]={1.0, 1.0};
634#if G4VERSION_NUMBER < 1079
635 mptGOSLanexRi1->AddProperty(
"FASTCOMPONENT",energyGOSLanexTab, emitspecGOSLanex, nentGOSLanex);
636 mptGOSLanexRi1->AddConstProperty(
"FASTTIMECONSTANT", mieHgTimeConst);
637 mptGOSLanexRi1->AddConstProperty(
"YIELDRATIO", 1.0);
638 mptGOSLanexRi1->AddConstProperty(
"MIEHG", mieScatteringLengthGOSLanex);
640 mptGOSLanexRi1->AddConstProperty(
"SCINTILLATIONYIELD",8.9e4/CLHEP::MeV);
641 mptGOSLanexRi1->AddConstProperty(
"RESOLUTIONSCALE", 1.0);
642 mptGOSLanexRi1->AddConstProperty(
"MIEHG_FORWARD", gosLanexMiehgForward);
643 mptGOSLanexRi1->AddConstProperty(
"MIEHG_BACKWARD", gosLanexMiehgBackward);
644 mptGOSLanexRi1->AddConstProperty(
"MIEHG_FORWARD_RATIO", gosLanexMiehgForwardRatio);
645 mptGOSLanexRi1->AddProperty(
"RINDEX",energyGOSLanexTab, rindexGOSLanexRi1Tab, nentGOSLanex);
646 mptGOSLanexRi1->AddProperty(
"ABSLENGTH", energyGOSLanexTab, abslenGOSLanex, nentGOSLanex);
647 tmpMaterial->SetMaterialPropertiesTable(mptGOSLanexRi1);
651 G4double pet_lanex_density=
GetMaterial(
"polyurethane")->GetDensity();
652 tmpMaterial =
new G4Material(
"pet_lanex", pet_lanex_density, 1);
653 tmpMaterial->AddMaterial(
GetMaterial(
"polyurethane"), 1.0);
655 mptPETLanex->AddConstProperty(
"MIEHG_FORWARD", gosLanexMiehgForward);
656 mptPETLanex->AddConstProperty(
"MIEHG_BACKWARD", gosLanexMiehgBackward);
657 mptPETLanex->AddConstProperty(
"MIEHG_FORWARD_RATIO", gosLanexMiehgForwardRatio);
658#if G4VERSION_NUMBER < 1079
659 mptPETLanex->AddConstProperty(
"MIEHG", mieScatteringLengthGOSLanex);
661 mptPETLanex->AddProperty(
"RINDEX",energyGOSLanexTab, rindexGOSLanexTab, nentGOSLanex);
662 mptPETLanex->AddProperty(
"ABSLENGTH", energyGOSLanexTab, abslenGOSLanex, nentGOSLanex);
663 tmpMaterial->SetMaterialPropertiesTable(mptPETLanex);
668 G4double medex_density=fill_factor*GOS->GetDensity()+(1-fill_factor)*
GetMaterial(
"polyurethane")->GetDensity();
669 G4double medex_gos_fraction_by_mass=fill_factor*GOS->GetDensity()/medex_density;
670 G4double medex_pur_fraction_by_mass=1-medex_gos_fraction_by_mass;
671 tmpMaterial =
new G4Material(
"medex", medex_density, 2);
672 tmpMaterial->AddMaterial(GOS, medex_gos_fraction_by_mass);
673 tmpMaterial->AddMaterial(
GetMaterial(
"polyurethane"), medex_pur_fraction_by_mass);
675 const G4int nentMedex=2;
678 G4double medexRindextab[]={rindex, rindex};
680 G4double medexAbslen[]={7*CLHEP::mm, 7*CLHEP::mm};
681 mptMedex->AddProperty(
"RINDEX",energytab, medexRindextab, nentMedex);
682 mptMedex->AddProperty(
"ABSLENGTH", energytab, medexAbslen, nentMedex);
683#if G4VERSION_NUMBER < 1079
684 mptMedex->AddConstProperty(
"MIEHG", 230e-3*CLHEP::mm);
685 G4double medexEmitspec[]={1.0, 1.0};
686 mptMedex->AddProperty(
"FASTCOMPONENT",energytab, medexEmitspec, nentMedex);
687 mptMedex->AddConstProperty(
"FASTTIMECONSTANT", 1.*CLHEP::ns);
689 mptMedex->AddConstProperty(
"SCINTILLATIONYIELD",scintScalingFactor*2.94e4/CLHEP::MeV);
690 mptMedex->AddConstProperty(
"RESOLUTIONSCALE",1.0);
691 mptMedex->AddConstProperty(
"MIEHG_FORWARD", 0.93);
692 mptMedex->AddConstProperty(
"MIEHG_BACKWARD", 0.93);
693 mptMedex->AddConstProperty(
"MIEHG_FORWARD_RATIO", 1.0);
694 tmpMaterial->SetMaterialPropertiesTable(mptMedex);
698 G4double frac_graph=0.5;
699 G4double frac_poly=0.5;
701 G4Material* poly=
GetMaterial(
"G4_POLYACRYLONITRILE");
702 G4double dens_graph=graph->GetDensity();
703 G4double dens_poly=poly->GetDensity();
705 G4double dens_cf =frac_graph*dens_graph+frac_poly*dens_poly;
706 G4double frac_graph_bw=frac_graph*dens_graph/dens_cf;
707 G4double frac_poly_bw=frac_poly*dens_poly/dens_cf;
708 tmpMaterial =
new G4Material(
"carbonfiber", dens_cf, 2);
709 tmpMaterial->AddMaterial(graph, frac_graph_bw);
710 tmpMaterial->AddMaterial(poly, frac_poly_bw);
712 const G4int nentCarbonfiber=2;
713 G4double energytab_cf[]={2.239*CLHEP::eV, 2.241*CLHEP::eV};
714 G4double carbonfiberRindextab[]={2.6, 2.6};
715 G4double carbonfiberAbslen[]={2.1*CLHEP::um, 2.1*CLHEP::um};
716 mptCarbonfiber->AddProperty(
"RINDEX",energytab_cf, carbonfiberRindextab, nentCarbonfiber);
717 mptCarbonfiber->AddProperty(
"ABSLENGTH", energytab_cf, carbonfiberAbslen, nentCarbonfiber);
718 tmpMaterial->SetMaterialPropertiesTable(mptCarbonfiber);
727 {
"H",
"C",
"O",
"Na",
"Mg",
"Al",
"Si",
"K",
"Ca",
"Fe",
"P",
"S",
728 "Ti",
"Mn",
"Zn",
"Zr",
"Ba",
"Pb",
"Sr",
"Eu"},
729 std::list<double>{0.59785345499811 *CLHEP::perCent,
730 5.59989402848226 *CLHEP::perCent,
731 49.1111702720319 *CLHEP::perCent,
732 0.45137935852357 *CLHEP::perCent,
733 0.66062806777291 *CLHEP::perCent,
734 2.05561946276849 *CLHEP::perCent,
735 18.7995018924154 *CLHEP::perCent,
736 0.65365311079793 *CLHEP::perCent,
737 20.0191229406116 *CLHEP::perCent,
738 1.11400027114647 *CLHEP::perCent,
739 0.04782827639985 *CLHEP::perCent,
740 0.01195706909996 *CLHEP::perCent,
741 0.3457585814739 *CLHEP::perCent,
742 0.03856154784738 *CLHEP::perCent,
743 0.02401378044242 *CLHEP::perCent,
744 0.00737352594498 *CLHEP::perCent,
745 0.01783596140744 *CLHEP::perCent,
746 0.04623400051985 *CLHEP::perCent,
747 0.39757254757374 *CLHEP::perCent,
748 4.184974185E-05 *CLHEP::perCent});
754 {
"H",
"Na",
"Si",
"Fe",
"C",
"Mg",
"K",
"O",
"Al",
"Ca"},
755 std::list<double>{0.006, 0.01, 0.2, 0.014, 0.03, 0.005, 0.01, 0.5, 0.03, 0.195});
760 std::list<int> singleElement = {1};
764 kStateLiquid, 1.9, 1,
765 {
"He"}, singleElement);
770 kStateSolid , 87 , 1,
771 {
"Nb"}, singleElement);
777 {
"Ti"}, singleElement);
782 kStateSolid , 87 , 1,
784 std::list<double>{0.53,0.47});
790 {
"Cu"}, singleElement);
796 {
"Cu"}, singleElement);
802 {
"nbti_87k",
"cu_4k"},
803 std::list<double>{1.0/5.4, 4.4/5.4});
810 std::list<double>{0.32, 0.68});
818 std::list<int>{1, 1});
824 AddMaterial(
"liquidhelium", 0.12498, kStateLiquid, 4.15, 1, {
"He"}, std::list<int>{1});
831 const G4int nEntries = 9;
833 G4double photonEnergy[nEntries];
834 G4double dNEntries = (G4double)nEntries;
835 G4double energyMin = 1.*CLHEP::eV;
836 G4double energyMax = 3.*CLHEP::eV;
837 G4double deltaEnergy = (energyMax-energyMin)/(dNEntries-1.0);
838 G4double energy = energyMin;
839 for (G4int i = 0; i < nEntries; energy += deltaEnergy, i++)
840 {photonEnergy[i] = energy;}
841 G4double refractiveIndex[nEntries] = {1.325, 1.325, 1.326, 1.327, 1.328, 1.33, 1.333, 1.336, 1.343};
842 waterProperties->AddProperty(
"RINDEX", photonEnergy, refractiveIndex, nEntries);
843 water->SetMaterialPropertiesTable(waterProperties);
853 const G4int airNEntries = 3;
856 G4double airRefractiveIndex[airNEntries] = {1.000292,1.000292,1.000292};
857 G4double airEnergy[airNEntries] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
859 airProperties->AddProperty(
"RINDEX", airEnergy, airRefractiveIndex, airNEntries);
860 g4AirMaterial->SetMaterialPropertiesTable(airProperties);
864 G4double temperature = 300*CLHEP::kelvin;
865 G4double pressure = 1.0*CLHEP::atmosphere;
866 G4double airDensity = 0.001225;
867 G4Material* tmpMaterial =
new G4Material(
"airbdsim",
868 airDensity*CLHEP::g/CLHEP::cm3,
873 tmpMaterial->AddElement(
GetElement(
"O"), 0.2);
874 tmpMaterial->AddElement(
GetElement(
"N"), 0.8);
875 tmpMaterial->SetMaterialPropertiesTable(airProperties);
879 G4double coDensity = 0.001145;
886 std::list<int>{1,1});
889 G4double bp_pressure = 0.0133e-9 * (CLHEP::bar/CLHEP::atmosphere);
896 std::list<int>{1,1});
903 G4double a = 85.4678*CLHEP::g/CLHEP::mole;
904 G4double density = 1e-7 * CLHEP::g/CLHEP::cm3;
905 G4Material* tmpMaterial =
new G4Material(
"awakeplasma", 37., a, density);
912 G4double vacpressure;
917 {vacpressure=1e-12*CLHEP::bar;}
918 G4double temperature = 300*CLHEP::kelvin;
919 G4double density = (CLHEP::STP_Temperature/temperature) * (vacpressure/(1.*CLHEP::atmosphere)) * 29*CLHEP::g/(22.4*1.e-3*CLHEP::m3);
921 G4Material* tmpMaterial =
new G4Material(
"vacuum",
924 temperature, vacpressure);
925 tmpMaterial->AddElement(
GetElement(
"H"), 0.482);
926 tmpMaterial->AddElement(
GetElement(
"C"), 0.221);
927 tmpMaterial->AddElement(
GetElement(
"O"), 0.297);
930 const G4int Vac_NUMENTRIES = 3;
932 G4double Vac_RIND[Vac_NUMENTRIES] = {1.000,1.000,1.000};
933 G4double Vac_Energy[Vac_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
935 vacMaterialPropertiesTable->AddProperty(
"RINDEX",Vac_Energy, Vac_RIND, Vac_NUMENTRIES);
936 tmpMaterial->SetMaterialPropertiesTable(vacMaterialPropertiesTable);
942 G4Material* laservac =
new G4Material(
"laservac",
943 regularVacuum->GetDensity(),
946 regularVacuum->GetTemperature(),
947 regularVacuum->GetPressure());
956 materials[name] = material;
960 {
throw BDSException(__METHOD_NAME__,
"Material \"" + name +
"\" already exists");}
967 G4Material* material =
GetMaterial(existingMaterialName);
968 aliases[alias] = material;
983 G4double temperature,
990 G4Material* tmpMaterial =
new G4Material(name,
992 A*CLHEP::g/CLHEP::mole,
993 density*CLHEP::g/CLHEP::cm3,
995 temperature*CLHEP::kelvin,
996 pressure*CLHEP::atmosphere);
1000template <
typename Type>
1004 G4double temperature,
1006 const std::list<G4String>& components,
1007 const std::list<Type>& componentFractions)
1012 G4Material* tmpMaterial =
new G4Material(name,
1013 density*CLHEP::g/CLHEP::cm3,
1014 (G4int)components.size(),
1016 temperature*CLHEP::kelvin,
1017 pressure*CLHEP::atmosphere);
1018 std::list<G4String>::const_iterator sIter;
1019 typename std::list<Type>::const_iterator dIter;
1020 for (sIter = components.begin(), dIter = componentFractions.begin();
1021 sIter != components.end();
1025 G4cout <<
"BDSMaterials::AddMaterial: " << *sIter << G4endl;
1029 {tmpMaterial->AddElement(element, (*dIter));}
1031 {tmpMaterial->AddMaterial(
GetMaterial(*sIter), (*dIter));}
1038 if (material.empty())
1039 {
throw BDSException(__METHOD_NAME__,
"empty material name");}
1040 G4String materialOriginal = material;
1043 G4String nistString (
"G4_");
1044 if (material.length() <= 2)
1045#if G4VERSION_NUMBER > 1099
1046 {material = nistString + material;}
1048 {material.prepend(nistString);}
1051 G4String start = material.substr(0,3);
1052 if (nistString == start)
1055 G4cout <<
"Using NIST material " << material << G4endl;
1057 G4Material* mat = G4NistManager::Instance()->FindOrBuildMaterial(material,
true,
true);
1059 {
throw BDSException(__METHOD_NAME__,
"\"" + material +
"\" could not be found by NIST.");}
1069 {
return materials.at(material);}
1071 {
return aliases.at(material);}
1076 {
return externalMaterials.at(material);}
1080 throw BDSException(__METHOD_NAME__,
"\"" + materialOriginal +
"\" is unknown.");
1087 const G4String& componentName)
const
1089 G4MaterialTable* table = G4Material::GetMaterialTable();
1091 G4bool check =
false;
1092 std::map<G4String, G4int> nameCount;
1093 for (
const auto& mat : *table)
1095 G4String name = mat->GetName();
1096 auto search = nameCount.find(name);
1097 if (search == nameCount.end())
1098 {nameCount[name] = 0;}
1099 nameCount[name] += 1;
1100 check = check || nameCount[name] > 1;
1105 for (
const auto& nc: nameCount)
1109 G4String msg =
"the material \"" + nc.first +
"\" has been defined more\n";
1110 msg +=
"than once now and will cause the wrong material to be used for any future usages.\n";
1111 msg +=
"Error caused by GDML file \""+geometryFileName+
"\" in component \""+componentName+
"\"\n";
1112 msg +=
"This is most likely due to a material name in the GDML file conflicting with a predefined one in BDSIM.";
1114 {BDS::Warning(msg);}
1127 for (
const auto& kv : materialsGDML)
1135 if (
BDS::StartsWith(nameLower,
"g4_") || materials.find(nameLower) != materials.end())
1140 G4String msg =
"the material \""+kv.first+
"\" is already defined and has\n";
1141 msg +=
"already been loaded from a previous GDML file(s) and is ambiguous.\n";
1142 msg +=
"Please prepend with the BDSIM element used to load the file to be explicit.";
1149 externalMaterials[nameLower] = kv.second;
1157 {
throw BDSException(__METHOD_NAME__,
"Element \"" + symbol +
"\" already exists.");}
1159 elements.insert(make_pair(symbol, element));
1161 G4cout <<
"New element : " << symbol << G4endl;
1166 const G4String& symbol,
1170 G4Element* tmpElement =
new G4Element(name, symbol, Z, A*CLHEP::g/CLHEP::mole);
1175 const G4String& materialName)
const
1179 G4String msg =
"material \"" + materialName +
"\"has a density higher than 100g/cm3! Perhaps check this!\n";
1180 msg +=
"Density: " + std::to_string(density) +
" g/cm3... proceeding";
1181 BDS::Warning(__METHOD_NAME__, msg);
1190 {
return (*iter).second;}
1193 G4Element* element = G4NistManager::Instance()->FindOrBuildElement(symbol,
true);
1202 {
throw BDSException(__METHOD_NAME__,
"Element \"" + symbol +
"\" could not be found.");}
1209 for (G4int i = 0; i < (G4int)material->GetNumberOfElements(); i++)
1211 G4cout << (*(material->GetElementVector()))[i]->GetName() <<
"\t "
1212 << (material->GetFractionVector()[i])/CLHEP::perCent <<
" %" << G4endl;
1218 auto flagsCache(G4cout.flags());
1219 G4cout << __METHOD_NAME__ << G4endl;
1222 G4cout<<
"\"vacuum\" composition: " << G4endl;
1224 G4cout<<
"pressure = " << vacuum->GetPressure()/CLHEP::bar <<
" bar" << G4endl;
1225 G4cout<<
"temperature = " << vacuum->GetTemperature()/CLHEP::kelvin <<
" K" << G4endl;
1226 G4cout<<
"density = " << vacuum->GetDensity()/(CLHEP::g/CLHEP::cm3)<<
" g/cm^3" << G4endl << G4endl;
1228 G4cout <<
"All elements are available with their 1 or 2 letter chemical symbol. ie C or G4_C" << G4endl << G4endl;
1232 G4cout <<
"Extra defined elements are:" << G4endl;
1233 for (
const auto& element :
elements)
1234 {G4cout << std::left << std::setw(12) << element.second->GetName() <<
" - " << element.second->GetSymbol() << G4endl;}
1238 G4cout <<
"Defined materials are:" << G4endl;
1239 for (
const auto& material : materials)
1241 G4cout << material.first;
1242 G4String realName = material.second->GetName();
1243 if (realName != material.first)
1244 {G4cout <<
" (" << material.second->GetName() <<
")" << G4endl;}
1251 const auto v = aliasSearch->second;
1252 G4cout <<
"Aliases: ";
1253 for (
const auto& n : v)
1254 {G4cout <<
"\"" << n <<
"\" ";}
1259 G4cout <<
"All aliases: (alias, real name)" << G4endl;
1260 for (
const auto& aliasMaterial : aliases)
1262 G4cout << aliasMaterial.first <<
" : " << aliasMaterial.second->GetName() << G4endl;}
1264 G4cout <<
"Available NIST materials are:" << G4endl;
1265 G4NistManager::Instance()->ListMaterials(
"all");
1266 G4cout.flags(flagsCache);
1269BDSMaterials::~BDSMaterials()
1271 for (
auto& material : materials)
1272 {
delete material.second;}
1281 {
delete element.second;}
1295 G4bool debug =
true;
1297 G4bool debug =
false;
1301 if (verbose || debug)
1302 {G4cout << __METHOD_NAME__ <<
"parsing the atom list..." << G4endl;}
1305 if (verbose || debug)
1309 if (verbose || debug)
1310 {G4cout <<
"parsing the material list..."<< G4endl;}
1314 if (it.state==
"solid")
1315 {itsState = kStateSolid;}
1316 else if (it.state==
"liquid")
1317 {itsState = kStateLiquid;}
1318 else if (it.state==
"gas")
1319 {itsState = kStateGas;}
1322 G4cout <<
"Unknown material state "<< it.state
1323 <<
", setting it to default (solid)"
1326 itsState = kStateSolid;
1330 G4cout <<
"---->adding Material, ";
1344 else if(!(it.components.empty()))
1346 std::list<G4String> tempComponents;
1347 for (
const auto& jt : it.components)
1348 {tempComponents.emplace_back(G4String(jt));}
1350 if(it.componentsWeights.size()==it.components.size())
1358 it.componentsWeights);
1360 else if(it.componentsFractions.size()==it.components.size())
1368 it.componentsFractions);
1371 {
throw BDSException(__METHOD_NAME__,
"Badly defined material - number of components is not equal to number of weights or mass fractions!");}
1374 {
throw BDSException(__METHOD_NAME__,
"Badly defined material - need more information!");}
1376 if (verbose || debug)
1382 G4MaterialPropertiesTable* table =
new G4MaterialPropertiesTable();
General exception with possible name of object and message.
A class for all material definitions known to BDSIM. Additional materials can be added in the parser ...
void DefineMetals()
Methods called by constructor.
std::set< G4String > aliasNames
Map of other names to existing materials. To avoid double deletion. Also in lower case.
void DefineLHCComponents()
Methods called by constructor.
std::map< G4Material *, std::vector< G4String > > materialToAliases
Keep a vector of possible aliases for every material for print out and user feedback.
void DefineGases()
Methods called by constructor.
void DefineNonMetalSolids()
Methods called by constructor.
void DensityCheck(G4double density, const G4String &materialName) const
Print warning if density suspiciously high. Should be in g/cm3 in G4 units already.
void DefineScintillators()
Methods called by constructor.
void DefineVacuums()
Methods called by constructor.
static BDSMaterials * Instance()
Singleton pattern access.
G4MaterialPropertiesTable * CreatePropertiesTable()
Create new properties table and store in vector.
static BDSMaterials * instance
Singleton instance.
std::set< G4String > materialNames
Map of materials, convention name lowercase.
std::map< G4String, G4Element * > elements
Map of elements, no lowercase convention.
void DefineLiquids()
Methods called by constructor.
G4Material * GetMaterial(G4String material) const
Get material by name.
void PrepareRequiredMaterials(G4bool verbose=false)
converts parser material list
void CacheMaterialsFromGDML(const std::map< G4String, G4Material * > &materialsGDML)
Introduce materials loaded from GDML into this instance.
void ListMaterials() const
output available materials
void DefinePlasmas()
Methods called by constructor.
std::set< G4String > externalMaterialNames
Keep hold of externally constructed materials to indicate conflicts to the user but not to delete.
void CheckForConflictingMaterialsAfterLoad(const G4String &geometryFileName, const G4String &componentName) const
void AddElement(G4Element *element, const G4String &symbol)
Add a G4Element.
void AddMaterial(G4Material *material, G4String name)
Add G4Material.
void DefineSuperconductors()
Methods called by constructor.
G4Element * CheckElement(const G4String &symbol) const
Return element if defined (nullptr if not)
void AddExistingMaterialAlias(const G4String &existingMaterialName, G4String alias)
Add alias to a material.
G4Element * GetElement(const G4String &symbol) const
Get element by name.
void PrintBasicMaterialMassFraction(G4Material *material) const
Print mass fractions of consituents of a given material.
std::vector< G4MaterialPropertiesTable * > propertiesTables
Material tables for storing pointers.
static BDSParser * Instance()
Access method.
std::vector< GMAD::Atom > GetAtoms() const
Return the parser list of that object.
static bool IsInitialised()
Returns if parser is initialised.
const GMAD::Options & GetOptions() const
Return options.
std::vector< GMAD::Material > GetMaterials() const
Return the parser list of that object.
G4String LowerCase(const G4String &str)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
G4bool StartsWith(const std::string &expression, const std::string &prefix)
Return true if a string "expression" starts with "prefix".