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"
45BDSMaterials::BDSMaterials()
48 G4cout <<
"BDSMaterials: G4 predefined units: " << G4endl;
49 G4cout <<
"g= " << CLHEP::g << G4endl;
50 G4cout <<
"m= " << CLHEP::m << G4endl;
51 G4cout <<
"mole= " << CLHEP::mole << G4endl;
52 G4cout <<
"kelvin= " << CLHEP::kelvin << G4endl;
70#if G4VERSION_NUMBER < 1011
71 G4double NTP_Temperature = 293.15;
94 std::list<int> singleElement = {1};
95 AddMaterial(
"graphite", 2.265, kStateSolid, NTP_Temperature, 1, {
"C"}, singleElement);
96 AddMaterial(
"graphitefoam", 0.61, kStateSolid, NTP_Temperature, 1, {
"C"}, singleElement);
97 AddMaterial(
"solidhydrogen",8.96, kStateSolid, NTP_Temperature, 1, {
"H"}, singleElement);
98 AddMaterial(
"solidnitrogen",8.96, kStateSolid, NTP_Temperature, 1, {
"N"}, singleElement);
99 AddMaterial(
"solidoxygen", 8.96, kStateSolid, NTP_Temperature, 1, {
"O"}, singleElement);
100 AddMaterial(
"weightiron", 7.87, kStateSolid, NTP_Temperature, 1, {
"Fe"}, singleElement);
105 kStateSolid, NTP_Temperature, 1,
107 std::list<int>{1, 1, 4});
113 std::list<double>{0.338, 0.662});
120 std::list<double>{0.025, 0.03, 0.945});
126 {
"C",
"Mn",
"P",
"S",
"Fe"},
127 std::list<double>{0.0017, 0.0045, 0.0004, 0.0005, 0.9929});
133 {
"Cu",
"Be",
"Co",
"Al",
"Fe",
"Ni"},
134 std::list<double>{0.991, 0.0031, 0.00500, 0.0004, 0.0003, 0.0002});
140 {
"C",
"Mn",
"Si",
"P",
"S",
"Cr",
"Mo",
"Ni",
"N",
"Fe"},
141 std::list<double>{0.0003, 0.02, 0.0075, 0.00045, 0.0003, 0.17, 0.025, 0.12, 0.001, 0.65545});
147 {
"Fe",
"Cr",
"Ni",
"Mn",
"Si",
"P",
"S",
"C"},
148 std::list<double>{0.67145, 0.185, 0.1125, 0.02, 0.01, 0.00045, 0.0003, 0.0003});
154 {
"Fe",
"Cr",
"Ni",
"Mn",
"Si",
"P",
"S",
"C"},
155 std::list<double>{0.67145, 0.185, 0.1125, 0.02, 0.01, 0.00045, 0.0003, 0.0003});
161 {
"Fe",
"Cr",
"Ni",
"Mn",
"Si",
"P",
"S",
"C"},
162 std::list<double>{0.67145, 0.185, 0.1125, 0.02, 0.01, 0.00045, 0.0003, 0.0003});
169 {
"Fe",
"Cr",
"Ni",
"Mo",
"Mn",
"Si",
"Ti",
"N",
"Nb",
170 "Cu",
"Co",
"P",
"C",
"S",
"Ta",
"B"},
171 std::list<double>{0.65093, 0.1700, 0.12000, 0.02500, 0.0200, 0.00750,
172 0.00150, 0.0014, 0.00100, 0.00100, 0.0005, 0.00045,
173 0.00030, 0.0003, 0.00010, 0.00002});
180 {
"Fe",
"Cr",
"Ni",
"Mo",
"Mn",
"Si",
"Ti",
"N",
181 "Nb",
"Cu",
"Co",
"P",
"C",
"S",
"Ta",
"B"},
182 std::list<double>{0.65093, 0.1700, 0.12000, 0.02500, 0.0200,
183 0.00750, 0.00150, 0.0014, 0.00100, 0.00100,
184 0.0005, 0.00045, 0.00030, 0.0003, 0.00010,
192 {
"Fe",
"Cr",
"Ni",
"Mo",
"Mn",
"Si",
"Ti",
"N",
193 "Nb",
"Cu",
"Co",
"P",
"C",
"S",
"Ta",
"B"},
194 std::list<double>{0.65093, 0.1700, 0.12000, 0.02500, 0.0200,
195 0.00750, 0.00150, 0.0014, 0.00100, 0.00100,
196 0.0005, 0.00045, 0.00030, 0.0003, 0.00010,
201 AddMaterial(
"mild_steel", 8.000, kStateSolid, 295, 1,
202 {
"C",
"Mn",
"Si",
"Fe"},
203 std::list<double>{0.002, 0.005, 0.0015, 0.99150});
212 std::list<double>{0.97, 0.02, 0.01});
219 std::list<double>{0.90, 0.05, 0.05});
226 std::list<double>{0.925, 0.0375, 0.0375});
233 std::list<double>{0.95, 0.025, 0.025});
239 AddMaterial(
"niobium_2k", 8.57 , kStateSolid, 2, 1, {
"Nb"}, std::list<int>{1});
242 AddMaterial(
"nbti_4k", 5.6 , kStateSolid, 4, 1, {
"Nb",
"Ti"}, std::list<int>{1,1});
251 {
"B",
"Ni",
"O",
"Ca",
"Si"},
252 std::list<double>{0.383249242, 0.472071387, 0.0366276887, 0.0228923054, 0.0851593762});
259 std::list<int>{1,3,1});
266 std::list<int>{1,9,2,4});
270 kStateSolid, 300, 1, {
"Si",
"O",
"H",
"Ca",
"Al",
"Fe"},
271 std::list<double>{0.227915, 0.60541, 0.09972, 0.04986, 0.014245, 0.00285});
275 G4Material* tmpMaterial =
new G4Material(
"fusedsilica",
276 1.032*CLHEP::g/CLHEP::cm3,
281 const G4int FusedSilica_NUMENTRIES = 3;
282 G4double FusedSilica_RIND[FusedSilica_NUMENTRIES]={1.49,1.49,1.49};
283 G4double FusedSilica_AbsLength[FusedSilica_NUMENTRIES]={420.*CLHEP::cm,420.*CLHEP::cm,420.*CLHEP::cm};
284 G4double FusedSilica_Energy[FusedSilica_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
286 fsMaterialPropertiesTable->AddProperty(
"ABSLENGTH",FusedSilica_Energy,FusedSilica_AbsLength,FusedSilica_NUMENTRIES);
287 fsMaterialPropertiesTable->AddProperty(
"RINDEX",FusedSilica_Energy,FusedSilica_RIND,FusedSilica_NUMENTRIES);
288 tmpMaterial->SetMaterialPropertiesTable(fsMaterialPropertiesTable);
298 std::list<double>{0.59984,0.31961,0.08055});
305 std::list<double>{0.35,0.65});
312 std::list<double>{0.026362,0.691133,0.073270,0.209235});
315 tmpMaterial =
new G4Material(
"n-bk7", 1.032*CLHEP::g/CLHEP::cm3, 2, kStateSolid);
318 const G4int N_Bk7_NUMENTRIES = 3;
319 G4double N_Bk7_RIND[N_Bk7_NUMENTRIES]={1.51680,1.51680,1.51680};
320 G4double N_Bk7_AbsLength[N_Bk7_NUMENTRIES]={420.*CLHEP::cm,420.*CLHEP::cm,420.*CLHEP::cm};
321 G4double N_Bk7_Energy[N_Bk7_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
323 nbk7MaterialPropertiesTable->AddProperty(
"ABSLENGTH",N_Bk7_Energy,N_Bk7_AbsLength,N_Bk7_NUMENTRIES);
324 nbk7MaterialPropertiesTable->AddProperty(
"RINDEX",N_Bk7_Energy,N_Bk7_RIND,N_Bk7_NUMENTRIES);
325 tmpMaterial->SetMaterialPropertiesTable(nbk7MaterialPropertiesTable);
329 AddMaterial(
"quartz", 2.655, kStateSolid, 300, 1, {
"Si",
"O"}, std::list<int>{1,2});
335 {
"clay",
"calciumCarbonate"},
336 std::list<double>{0.5,0.5});
342 {
"clay",
"calciumCarbonate"},
343 std::list<double>{0.65,0.35});
349 {
"clay",
"calciumCarbonate"},
350 std::list<double>{0.35,0.65});
357 std::list<double>{0.33377483443708611, 0.57218543046357617, 0.022516556291390728, 0.071523178807947022});
361 AddMaterial(
"aralditef", 1.175, kStateSolid, 300, 1, {
"C",
"H",
"O"},std::list<int>{12,18,4});
364 AddMaterial(
"hy906", 1.225, kStateSolid, 300, 1, {
"C",
"H",
"O"},std::list<int>{10,5,3});
367 AddMaterial(
"dy061", 1.025, kStateSolid, 300, 1, {
"C",
"H",
"O",
"N"},std::list<int>{15,25,1,3});
374 {
"aralditef",
"hy906",
"dy061"},
375 std::list<double>{0.497512,0.497512,0.004976});
378 tmpMaterial = G4NistManager::Instance()->FindOrBuildMaterial(
"G4_CELLULOSE_CELLOPHANE",
true,
true);
379 const G4int Cellulose_NUMENTRIES = 3;
380 G4double Cellulose_RIND[Cellulose_NUMENTRIES] = {1.532,1.532,1.532};
381 G4double Cellulose_Energy[Cellulose_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
383 celluloseMaterialPropertiesTable->AddProperty(
"RINDEX",Cellulose_Energy, Cellulose_RIND, Cellulose_NUMENTRIES);
384 tmpMaterial->SetMaterialPropertiesTable(celluloseMaterialPropertiesTable);
390 kStateSolid, NTP_Temperature, 1,
392 std::list<int>{6,10,2,4});
400 std::list<int>{2,4});
406 G4Material* tmpMaterial =
new G4Material(
"yag", 4.56*CLHEP::g/CLHEP::cm3, 3);
409 tmpMaterial->AddElement(
GetElement(
"O") , 12);
410 G4double birks = 0.08*CLHEP::mm/CLHEP::MeV;
411 tmpMaterial->GetIonisation()->SetBirksConstant(birks);
414 const G4int nEntries = 9;
415 G4double PhotonEnergyYAG[nEntries];
416 G4double dNEntries2=(G4double)nEntries;
417 G4double energyMin=1.91*CLHEP::eV;
418 G4double energyMax=2.76*CLHEP::eV;
419 G4double deltaEnergy=(energyMax-energyMin)/(dNEntries2-1.0);
420 G4double energy=energyMin;
421 for (G4int i=0; i<nEntries; energy += deltaEnergy, i++)
422 {PhotonEnergyYAG[i]=energy;}
424 G4double RefractiveIndexYAG[nEntries] =
425 { 1.82, 1.82, 1.82, 1.82, 1.82, 1.82, 1.82,
428 mpt_YAG->AddProperty(
"RINDEX",PhotonEnergyYAG, RefractiveIndexYAG, nEntries);
429#if G4VERSION_NUMBER < 1079
430 G4double scintFastYAG[nEntries] =
431 { 0, 0.25, 2.0, 14.0, 13.0, 7.0, 4.0, 2.0, 0.0 };
433 mpt_YAG->AddProperty(
"FASTCOMPONENT",PhotonEnergyYAG, scintFastYAG, nEntries)->SetSpline(
true);
434 mpt_YAG->AddConstProperty(
"FASTTIMECONSTANT",70.*CLHEP::ns);
435 mpt_YAG->AddConstProperty(
"YIELDRATIO",1.0);
437 mpt_YAG->AddConstProperty(
"SCINTILLATIONYIELD",8000./CLHEP::MeV);
438 mpt_YAG->AddConstProperty(
"RESOLUTIONSCALE",2.0);
439 tmpMaterial->SetMaterialPropertiesTable(mpt_YAG);
444 G4NistManager* nistManager = G4NistManager::Instance();
445 G4Material* polystyrene = nistManager->FindOrBuildMaterial(
"G4_POLYSTYRENE",
true,
true);
446 tmpMaterial =
new G4Material(
"ups923a",polystyrene->GetDensity(),1);
447 tmpMaterial->AddMaterial(polystyrene,1);
448 tmpMaterial->SetName(
"ups923a");
449 std::vector<G4double> ups923a_PhotonEnergy = {
450 3.35, 3.31, 3.28, 3.26, 3.25, 3.23, 3.23,
451 3.22, 3.21, 3.19, 3.18, 3.17, 3.16, 3.15,
452 3.14, 3.14, 3.13, 3.11, 3.1, 3.09, 3.09,
453 3.08, 3.07, 3.04, 3.02, 3.02, 3.01, 2.99,
454 2.98, 2.97, 2.97, 2.95, 2.95, 2.93, 2.93,
455 2.92, 2.92, 2.91, 2.89, 2.88, 2.87, 2.86,
456 2.85, 2.83, 2.81, 2.8, 2.79, 2.78, 2.76,
457 2.74, 2.72, 2.71, 2.68, 2.66, 2.64, 2.62,
458 2.61, 2.58, 2.55, 2.53, 2.5, 2.48, 2.46,
459 2.44, 2.41, 2.38, 2.35 };
460 std::reverse(ups923a_PhotonEnergy.begin(), ups923a_PhotonEnergy.end());
464 std::vector<G4double> ups923a_RINDEX(ups923a_PhotonEnergy.size(), 1.52);
465 std::vector<G4double> ups923a_ABSLENGTH(ups923a_PhotonEnergy.size(), 1*CLHEP::m);
468#if G4VERSION_NUMBER < 1070
469 ups923a_mt->AddProperty(
"RINDEX", ups923a_PhotonEnergy.data(), ups923a_RINDEX.data(), (
int)ups923a_PhotonEnergy.size());
470 ups923a_mt->AddProperty(
"ABSLENGTH", ups923a_PhotonEnergy.data(), ups923a_ABSLENGTH.data(), (
int)ups923a_PhotonEnergy.size());
472 ups923a_mt->AddProperty(
"RINDEX", ups923a_PhotonEnergy, ups923a_RINDEX);
473 ups923a_mt->AddProperty(
"ABSLENGTH", ups923a_PhotonEnergy, ups923a_ABSLENGTH);
476 birks = (0.014/1.06)*CLHEP::cm/CLHEP::MeV;
477 tmpMaterial->GetIonisation()->SetBirksConstant(birks);
478#if G4VERSION_NUMBER < 1079
479 const G4int ups923a_numentries = 67;
480 G4double ups923a_emission[ups923a_numentries] = {
481 0, 0.04, 0.11, 0.2, 0.3, 0.4, 0.52,
482 0.62, 0.67, 0.68, 0.67, 0.62, 0.53, 0.48,
483 0.44, 0.42, 0.4, 0.41, 0.42, 0.51, 0.46,
484 0.57, 0.67, 0.78, 0.91, 0.93, 0.95, 0.96,
485 0.94, 0.91, 0.85, 0.76, 0.67, 0.61, 0.57,
486 0.55, 0.52, 0.51, 0.52, 0.54, 0.57, 0.58,
487 0.6, 0.6, 0.59, 0.58, 0.55, 0.48, 0.42,
488 0.37, 0.33, 0.31, 0.29, 0.28, 0.26, 0.24,
489 0.2, 0.17, 0.12, 0.09, 0.08, 0.07,
490 0.06, 0.04, 0.02, 0.01, 0.01 };
491 ups923a_mt->AddConstProperty(
"FASTTIMECONSTANT",3.3*CLHEP::ns);
492 ups923a_mt->AddProperty(
"FASTCOMPONENT",ups923a_PhotonEnergy.data(), ups923a_emission, ups923a_numentries)->SetSpline(
true);
493 ups923a_mt->AddConstProperty(
"YIELDRATIO",1.0);
495 ups923a_mt->AddConstProperty(
"RESOLUTIONSCALE",2.0);
496 G4double scintYieldAnthracene=14200;
497 G4double scintYieldUPS923A=scintYieldAnthracene*0.60;
498 ups923a_mt->AddConstProperty(
"SCINTILLATIONYIELD",scintYieldUPS923A/CLHEP::MeV);
500 tmpMaterial->SetMaterialPropertiesTable(ups923a_mt);
504 G4double pet_density=1.4*CLHEP::g/CLHEP::cm3;
505 G4int pet_nelements=3;
506 G4State pet_state=kStateSolid;
507 tmpMaterial=
new G4Material(
"pet",
511 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"C",
true),10);
512 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"H",
true),8);
513 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"O",
true),4);
514 const G4int Pet_NUMENTRIES = 3;
515 G4double Pet_RIND[Pet_NUMENTRIES] = {1.570,1.570,1.570};
516 G4double Pet_Energy[Pet_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
518 petMaterialPropertiesTable->AddProperty(
"RINDEX",Pet_Energy, Pet_RIND, Pet_NUMENTRIES);
519 tmpMaterial->SetMaterialPropertiesTable(petMaterialPropertiesTable);
523 tmpMaterial=
new G4Material(
"pet_opaque",
527 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"C",
true),10);
528 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"H",
true),8);
529 tmpMaterial->AddElement(nistManager->FindOrBuildElement(
"O",
true),4);
530 const G4int Pet_Opaque_NUMENTRIES = 3;
531 G4double Pet_Opaque_RIND[Pet_Opaque_NUMENTRIES] = {1.570,1.570,1.570};
532 G4double Pet_Opaque_Energy[Pet_Opaque_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
533 G4double Pet_Opaque_abslen[]={1*CLHEP::um, 1*CLHEP::um, 1*CLHEP::um};
535 pet_opaqueMaterialPropertiesTable->AddProperty(
"RINDEX",Pet_Opaque_Energy, Pet_Opaque_RIND, Pet_Opaque_NUMENTRIES);
536 pet_opaqueMaterialPropertiesTable->AddProperty(
"ABSLENGTH",Pet_Opaque_Energy, Pet_Opaque_abslen, Pet_Opaque_NUMENTRIES);
537 tmpMaterial->SetMaterialPropertiesTable(pet_opaqueMaterialPropertiesTable);
541 G4Material* GOS = nistManager->FindOrBuildMaterial(
"G4_GADOLINIUM_OXYSULFIDE",
true,
true);
544 G4double fill_factor=0.5;
545 G4double lanex_density=fill_factor*GOS->GetDensity()+(1-fill_factor)*
GetMaterial(
"polyurethane")->GetDensity();
546 G4double gos_fraction_by_mass=fill_factor*GOS->GetDensity()/lanex_density;
547 G4double pur_fraction_by_mass=1-gos_fraction_by_mass;
549 tmpMaterial =
new G4Material(
"lanex", lanex_density, 2);
550 tmpMaterial->AddMaterial(GOS, gos_fraction_by_mass);
551 tmpMaterial->AddMaterial(
GetMaterial(
"polyurethane"), pur_fraction_by_mass);
554 const G4int nentLanex=2;
555 G4double rindex=1.50;
556 G4double energytab[]={2.239*CLHEP::eV, 2.241*CLHEP::eV};
557 G4double rindextab[]={rindex, rindex};
558 G4double abslen[]={7*CLHEP::mm, 7*CLHEP::mm};
559 mptLanex->AddProperty(
"RINDEX",energytab, rindextab, nentLanex);
560 mptLanex->AddProperty(
"ABSLENGTH", energytab, abslen, nentLanex);
561#if G4VERSION_NUMBER < 1079
562 mptLanex->AddConstProperty(
"MIEHG", 60.3e-3*CLHEP::mm);
563 G4double emitspec[]={1.0, 1.0};
564 mptLanex->AddProperty(
"FASTCOMPONENT",energytab, emitspec, nentLanex);
565 mptLanex->AddConstProperty(
"FASTTIMECONSTANT", 1.*CLHEP::ns);
567 G4double scintScalingFactor=1;
568 mptLanex->AddConstProperty(
"SCINTILLATIONYIELD",7.8e4/CLHEP::MeV);
569 mptLanex->AddConstProperty(
"RESOLUTIONSCALE",1.0);
570 mptLanex->AddConstProperty(
"MIEHG_FORWARD", 0.91);
571 mptLanex->AddConstProperty(
"MIEHG_BACKWARD", 0.91);
572 mptLanex->AddConstProperty(
"MIEHG_FORWARD_RATIO", 1.0);
573 tmpMaterial->SetMaterialPropertiesTable(mptLanex);
577 tmpMaterial =
new G4Material(
"lanex2", lanex_density, 2);
578 tmpMaterial->AddMaterial(GOS, gos_fraction_by_mass);
579 tmpMaterial->AddMaterial(
GetMaterial(
"polyurethane"), pur_fraction_by_mass);
581 mptLanex2->AddProperty(
"RINDEX",energytab, rindextab, nentLanex);
582 mptLanex2->AddProperty(
"ABSLENGTH", energytab, abslen, nentLanex);
583#if G4VERSION_NUMBER < 1079
584 mptLanex2->AddConstProperty(
"MIEHG", 60.3e-3*CLHEP::mm);
585 mptLanex2->AddProperty(
"FASTCOMPONENT",energytab, emitspec, nentLanex);
586 mptLanex2->AddConstProperty(
"FASTTIMECONSTANT", 1.*CLHEP::ns);
588 mptLanex2->AddConstProperty(
"SCINTILLATIONYIELD",8.9e4/CLHEP::MeV);
589 mptLanex2->AddConstProperty(
"RESOLUTIONSCALE",1.0);
590 mptLanex2->AddConstProperty(
"MIEHG_FORWARD", 0.91);
591 mptLanex2->AddConstProperty(
"MIEHG_BACKWARD", 0.91);
592 mptLanex2->AddConstProperty(
"MIEHG_FORWARD_RATIO", 0.5);
593 tmpMaterial->SetMaterialPropertiesTable(mptLanex);
597 G4double gos_lanex_density=GOS->GetDensity();
598 tmpMaterial =
new G4Material(
"gos_lanex", gos_lanex_density, 1);
599 tmpMaterial->AddMaterial(GOS, 1.0);
601 const G4int nentGOSLanex=2;
602 G4double rindexGOSLanex=1.50;
603 G4double energyGOSLanexTab[]={2.239*CLHEP::eV, 2.241*CLHEP::eV};
604 G4double rindexGOSLanexTab[]={rindexGOSLanex, rindexGOSLanex};
605 G4double abslenGOSLanex[]={7*CLHEP::mm, 7*CLHEP::mm};
606 G4double gosLanexMiehgForward=0.911;
607 G4double gosLanexMiehgBackward=0.911;
608 G4double gosLanexMiehgForwardRatio=0.5;
609#if G4VERSION_NUMBER < 1079
610 G4double mieHgTimeConst=1.0*CLHEP::ns;
611 G4double emitspecGOSLanex[]={1.0, 1.0};
612 G4double mieScatteringLengthGOSLanex=60.3*CLHEP::um;
613 mptGOSLanex->AddProperty(
"FASTCOMPONENT",energyGOSLanexTab, emitspecGOSLanex, nentGOSLanex);
614 mptGOSLanex->AddConstProperty(
"FASTTIMECONSTANT", mieHgTimeConst);
615 mptGOSLanex->AddConstProperty(
"YIELDRATIO", 1.0);
616 mptGOSLanex->AddConstProperty(
"MIEHG", mieScatteringLengthGOSLanex);
618 mptGOSLanex->AddConstProperty(
"SCINTILLATIONYIELD",8.9e4/CLHEP::MeV);
619 mptGOSLanex->AddConstProperty(
"RESOLUTIONSCALE", 1.0);
620 mptGOSLanex->AddConstProperty(
"MIEHG_FORWARD", gosLanexMiehgForward);
621 mptGOSLanex->AddConstProperty(
"MIEHG_BACKWARD", gosLanexMiehgBackward);
622 mptGOSLanex->AddConstProperty(
"MIEHG_FORWARD_RATIO", gosLanexMiehgForwardRatio);
623 mptGOSLanex->AddProperty(
"RINDEX",energyGOSLanexTab, rindexGOSLanexTab, nentGOSLanex);
624 mptGOSLanex->AddProperty(
"ABSLENGTH", energyGOSLanexTab, abslenGOSLanex, nentGOSLanex);
625 tmpMaterial->SetMaterialPropertiesTable(mptGOSLanex);
629 tmpMaterial =
new G4Material(
"gos_ri1", gos_lanex_density, 1);
630 tmpMaterial->AddMaterial(GOS, 1.0);
632 G4double rindexGOSLanexRi1Tab[]={1.0, 1.0};
633#if G4VERSION_NUMBER < 1079
634 mptGOSLanexRi1->AddProperty(
"FASTCOMPONENT",energyGOSLanexTab, emitspecGOSLanex, nentGOSLanex);
635 mptGOSLanexRi1->AddConstProperty(
"FASTTIMECONSTANT", mieHgTimeConst);
636 mptGOSLanexRi1->AddConstProperty(
"YIELDRATIO", 1.0);
637 mptGOSLanexRi1->AddConstProperty(
"MIEHG", mieScatteringLengthGOSLanex);
639 mptGOSLanexRi1->AddConstProperty(
"SCINTILLATIONYIELD",8.9e4/CLHEP::MeV);
640 mptGOSLanexRi1->AddConstProperty(
"RESOLUTIONSCALE", 1.0);
641 mptGOSLanexRi1->AddConstProperty(
"MIEHG_FORWARD", gosLanexMiehgForward);
642 mptGOSLanexRi1->AddConstProperty(
"MIEHG_BACKWARD", gosLanexMiehgBackward);
643 mptGOSLanexRi1->AddConstProperty(
"MIEHG_FORWARD_RATIO", gosLanexMiehgForwardRatio);
644 mptGOSLanexRi1->AddProperty(
"RINDEX",energyGOSLanexTab, rindexGOSLanexRi1Tab, nentGOSLanex);
645 mptGOSLanexRi1->AddProperty(
"ABSLENGTH", energyGOSLanexTab, abslenGOSLanex, nentGOSLanex);
646 tmpMaterial->SetMaterialPropertiesTable(mptGOSLanexRi1);
650 G4double pet_lanex_density=
GetMaterial(
"polyurethane")->GetDensity();
651 tmpMaterial =
new G4Material(
"pet_lanex", pet_lanex_density, 1);
652 tmpMaterial->AddMaterial(
GetMaterial(
"polyurethane"), 1.0);
654 mptPETLanex->AddConstProperty(
"MIEHG_FORWARD", gosLanexMiehgForward);
655 mptPETLanex->AddConstProperty(
"MIEHG_BACKWARD", gosLanexMiehgBackward);
656 mptPETLanex->AddConstProperty(
"MIEHG_FORWARD_RATIO", gosLanexMiehgForwardRatio);
657#if G4VERSION_NUMBER < 1079
658 mptPETLanex->AddConstProperty(
"MIEHG", mieScatteringLengthGOSLanex);
660 mptPETLanex->AddProperty(
"RINDEX",energyGOSLanexTab, rindexGOSLanexTab, nentGOSLanex);
661 mptPETLanex->AddProperty(
"ABSLENGTH", energyGOSLanexTab, abslenGOSLanex, nentGOSLanex);
662 tmpMaterial->SetMaterialPropertiesTable(mptPETLanex);
667 G4double medex_density=fill_factor*GOS->GetDensity()+(1-fill_factor)*
GetMaterial(
"polyurethane")->GetDensity();
668 G4double medex_gos_fraction_by_mass=fill_factor*GOS->GetDensity()/medex_density;
669 G4double medex_pur_fraction_by_mass=1-medex_gos_fraction_by_mass;
670 tmpMaterial =
new G4Material(
"medex", medex_density, 2);
671 tmpMaterial->AddMaterial(GOS, medex_gos_fraction_by_mass);
672 tmpMaterial->AddMaterial(
GetMaterial(
"polyurethane"), medex_pur_fraction_by_mass);
674 const G4int nentMedex=2;
677 G4double medexRindextab[]={rindex, rindex};
679 G4double medexAbslen[]={7*CLHEP::mm, 7*CLHEP::mm};
680 mptMedex->AddProperty(
"RINDEX",energytab, medexRindextab, nentMedex);
681 mptMedex->AddProperty(
"ABSLENGTH", energytab, medexAbslen, nentMedex);
682#if G4VERSION_NUMBER < 1079
683 mptMedex->AddConstProperty(
"MIEHG", 230e-3*CLHEP::mm);
684 G4double medexEmitspec[]={1.0, 1.0};
685 mptMedex->AddProperty(
"FASTCOMPONENT",energytab, medexEmitspec, nentMedex);
686 mptMedex->AddConstProperty(
"FASTTIMECONSTANT", 1.*CLHEP::ns);
688 mptMedex->AddConstProperty(
"SCINTILLATIONYIELD",scintScalingFactor*2.94e4/CLHEP::MeV);
689 mptMedex->AddConstProperty(
"RESOLUTIONSCALE",1.0);
690 mptMedex->AddConstProperty(
"MIEHG_FORWARD", 0.93);
691 mptMedex->AddConstProperty(
"MIEHG_BACKWARD", 0.93);
692 mptMedex->AddConstProperty(
"MIEHG_FORWARD_RATIO", 1.0);
693 tmpMaterial->SetMaterialPropertiesTable(mptMedex);
697 G4double frac_graph=0.5;
698 G4double frac_poly=0.5;
700 G4Material* poly=
GetMaterial(
"G4_POLYACRYLONITRILE");
701 G4double dens_graph=graph->GetDensity();
702 G4double dens_poly=poly->GetDensity();
704 G4double dens_cf =frac_graph*dens_graph+frac_poly*dens_poly;
705 G4double frac_graph_bw=frac_graph*dens_graph/dens_cf;
706 G4double frac_poly_bw=frac_poly*dens_poly/dens_cf;
707 tmpMaterial =
new G4Material(
"carbonfiber", dens_cf, 2);
708 tmpMaterial->AddMaterial(graph, frac_graph_bw);
709 tmpMaterial->AddMaterial(poly, frac_poly_bw);
711 const G4int nentCarbonfiber=2;
712 G4double energytab_cf[]={2.239*CLHEP::eV, 2.241*CLHEP::eV};
713 G4double carbonfiberRindextab[]={2.6, 2.6};
714 G4double carbonfiberAbslen[]={2.1*CLHEP::um, 2.1*CLHEP::um};
715 mptCarbonfiber->AddProperty(
"RINDEX",energytab_cf, carbonfiberRindextab, nentCarbonfiber);
716 mptCarbonfiber->AddProperty(
"ABSLENGTH", energytab_cf, carbonfiberAbslen, nentCarbonfiber);
717 tmpMaterial->SetMaterialPropertiesTable(mptCarbonfiber);
726 {
"H",
"C",
"O",
"Na",
"Mg",
"Al",
"Si",
"K",
"Ca",
"Fe",
"P",
"S",
727 "Ti",
"Mn",
"Zn",
"Zr",
"Ba",
"Pb",
"Sr",
"Eu"},
728 std::list<double>{0.59785345499811 *CLHEP::perCent,
729 5.59989402848226 *CLHEP::perCent,
730 49.1111702720319 *CLHEP::perCent,
731 0.45137935852357 *CLHEP::perCent,
732 0.66062806777291 *CLHEP::perCent,
733 2.05561946276849 *CLHEP::perCent,
734 18.7995018924154 *CLHEP::perCent,
735 0.65365311079793 *CLHEP::perCent,
736 20.0191229406116 *CLHEP::perCent,
737 1.11400027114647 *CLHEP::perCent,
738 0.04782827639985 *CLHEP::perCent,
739 0.01195706909996 *CLHEP::perCent,
740 0.3457585814739 *CLHEP::perCent,
741 0.03856154784738 *CLHEP::perCent,
742 0.02401378044242 *CLHEP::perCent,
743 0.00737352594498 *CLHEP::perCent,
744 0.01783596140744 *CLHEP::perCent,
745 0.04623400051985 *CLHEP::perCent,
746 0.39757254757374 *CLHEP::perCent,
747 4.184974185E-05 *CLHEP::perCent});
753 {
"H",
"Na",
"Si",
"Fe",
"C",
"Mg",
"K",
"O",
"Al",
"Ca"},
754 std::list<double>{0.006, 0.01, 0.2, 0.014, 0.03, 0.005, 0.01, 0.5, 0.03, 0.195});
759 std::list<int> singleElement = {1};
763 kStateLiquid, 1.9, 1,
764 {
"He"}, singleElement);
769 kStateSolid , 87 , 1,
770 {
"Nb"}, singleElement);
776 {
"Ti"}, singleElement);
781 kStateSolid , 87 , 1,
783 std::list<double>{0.53,0.47});
789 {
"Cu"}, singleElement);
795 {
"Cu"}, singleElement);
801 {
"nbti_87k",
"cu_4k"},
802 std::list<double>{1.0/5.4, 4.4/5.4});
809 std::list<double>{0.32, 0.68});
817 std::list<int>{1, 1});
823 AddMaterial(
"liquidhelium", 0.12498, kStateLiquid, 4.15, 1, {
"He"}, std::list<int>{1});
830 const G4int nEntries = 9;
832 G4double photonEnergy[nEntries];
833 G4double dNEntries = (G4double)nEntries;
834 G4double energyMin = 1.*CLHEP::eV;
835 G4double energyMax = 3.*CLHEP::eV;
836 G4double deltaEnergy = (energyMax-energyMin)/(dNEntries-1.0);
837 G4double energy = energyMin;
838 for (G4int i = 0; i < nEntries; energy += deltaEnergy, i++)
839 {photonEnergy[i] = energy;}
840 G4double refractiveIndex[nEntries] = {1.325, 1.325, 1.326, 1.327, 1.328, 1.33, 1.333, 1.336, 1.343};
841 waterProperties->AddProperty(
"RINDEX", photonEnergy, refractiveIndex, nEntries);
842 water->SetMaterialPropertiesTable(waterProperties);
852 const G4int airNEntries = 3;
855 G4double airRefractiveIndex[airNEntries] = {1.000292,1.000292,1.000292};
856 G4double airEnergy[airNEntries] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
858 airProperties->AddProperty(
"RINDEX", airEnergy, airRefractiveIndex, airNEntries);
859 g4AirMaterial->SetMaterialPropertiesTable(airProperties);
863 G4double temperature = 300*CLHEP::kelvin;
864 G4double pressure = 1.0*CLHEP::atmosphere;
865 G4double airDensity = 0.001225;
866 G4Material* tmpMaterial =
new G4Material(
"airbdsim",
867 airDensity*CLHEP::g/CLHEP::cm3,
872 tmpMaterial->AddElement(
GetElement(
"O"), 0.2);
873 tmpMaterial->AddElement(
GetElement(
"N"), 0.8);
874 tmpMaterial->SetMaterialPropertiesTable(airProperties);
878 G4double coDensity = 0.001145;
885 std::list<int>{1,1});
888 G4double bp_pressure = 0.0133e-9 * (CLHEP::bar/CLHEP::atmosphere);
895 std::list<int>{1,1});
902 G4double a = 85.4678*CLHEP::g/CLHEP::mole;
903 G4double density = 1e-7 * CLHEP::g/CLHEP::cm3;
904 G4Material* tmpMaterial =
new G4Material(
"awakeplasma", 37., a, density);
911 G4double vacpressure;
916 {vacpressure=1e-12*CLHEP::bar;}
917 G4double temperature = 300*CLHEP::kelvin;
918 G4double density = (CLHEP::STP_Temperature/temperature) * (vacpressure/(1.*CLHEP::atmosphere)) * 29*CLHEP::g/(22.4*1.e-3*CLHEP::m3);
920 G4Material* tmpMaterial =
new G4Material(
"vacuum",
923 temperature, vacpressure);
924 tmpMaterial->AddElement(
GetElement(
"H"), 0.482);
925 tmpMaterial->AddElement(
GetElement(
"C"), 0.221);
926 tmpMaterial->AddElement(
GetElement(
"O"), 0.297);
929 const G4int Vac_NUMENTRIES = 3;
931 G4double Vac_RIND[Vac_NUMENTRIES] = {1.000,1.000,1.000};
932 G4double Vac_Energy[Vac_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
934 vacMaterialPropertiesTable->AddProperty(
"RINDEX",Vac_Energy, Vac_RIND, Vac_NUMENTRIES);
935 tmpMaterial->SetMaterialPropertiesTable(vacMaterialPropertiesTable);
941 G4Material* laservac =
new G4Material(
"laservac",
942 regularVacuum->GetDensity(),
945 regularVacuum->GetTemperature(),
946 regularVacuum->GetPressure());
953 if (
materials.insert(make_pair(name, material)).second)
956 G4cout <<
"New material : " << name << G4endl;
960 {
throw BDSException(__METHOD_NAME__,
"Material \"" + name +
"\" already exists");}
967 G4Material* material =
GetMaterial(existingMaterialName);
976 G4double temperature,
983 G4Material* tmpMaterial =
new G4Material(name,
985 A*CLHEP::g/CLHEP::mole,
986 density*CLHEP::g/CLHEP::cm3,
988 temperature*CLHEP::kelvin,
989 pressure*CLHEP::atmosphere);
993template <
typename Type>
997 G4double temperature,
999 const std::list<G4String>& components,
1000 const std::list<Type>& componentFractions)
1005 G4Material* tmpMaterial =
new G4Material(name,
1006 density*CLHEP::g/CLHEP::cm3,
1007 (G4int)components.size(),
1009 temperature*CLHEP::kelvin,
1010 pressure*CLHEP::atmosphere);
1011 std::list<G4String>::const_iterator sIter;
1012 typename std::list<Type>::const_iterator dIter;
1013 for (sIter = components.begin(), dIter = componentFractions.begin();
1014 sIter != components.end();
1018 G4cout <<
"BDSMaterials::AddMaterial: " << *sIter << G4endl;
1022 {tmpMaterial->AddElement(element, (*dIter));}
1024 {tmpMaterial->AddMaterial(
GetMaterial(*sIter), (*dIter));}
1031 if (material.empty())
1032 {
throw BDSException(__METHOD_NAME__,
"empty material name");}
1033 G4String materialOriginal = material;
1036 G4String nistString (
"G4_");
1037 if (material.length() <= 2)
1038#if G4VERSION_NUMBER > 1099
1039 {material = nistString + material;}
1041 {material.prepend(nistString);}
1044 G4String start = material.substr(0,3);
1045 if (nistString == start)
1048 G4cout <<
"Using NIST material " << material << G4endl;
1050 G4Material* mat = G4NistManager::Instance()->FindOrBuildMaterial(material,
true,
true);
1052 {
throw BDSException(__METHOD_NAME__,
"\"" + material +
"\" could not be found by NIST.");}
1062 if (search->second > 1)
1064 throw BDSException(__METHOD_NAME__,
"material \"" + materialOriginal
1065 +
"\" has been loaded from multiple GDML files and is ambiguous.\n"
1066 +
"Please prepend with the BDSIM element used to load the file to be explicit.");
1071 {
return (*iter).second;}
1075 auto iter2 =
aliases.find(material);
1077 {
return iter2->second;}
1081 throw BDSException(__METHOD_NAME__,
"\"" + materialOriginal +
"\" is unknown.");
1088 const G4String& prepend,
1089 G4bool prependWasUsed)
1093 for (
const auto& kv : materialsGDML)
1099 aliases[nameLower] = kv.second;
1103 G4String nameCopy = kv.first;
1104 nameCopy.erase(0, prepend.size() + 1);
1106 aliases[nameCopy] = kv.second;
1115 {
throw BDSException(__METHOD_NAME__,
"Element \"" + symbol +
"\" already exists.");}
1117 elements.insert(make_pair(symbol, element));
1119 G4cout <<
"New element : " << symbol << G4endl;
1124 const G4String& symbol,
1128 G4Element* tmpElement =
new G4Element(name, symbol, Z, A*CLHEP::g/CLHEP::mole);
1133 const G4String& materialName)
const
1137 G4String msg =
"material \"" + materialName +
"\"has a density higher than 100g/cm3! Perhaps check this!\n";
1138 msg +=
"Density: " + std::to_string(density) +
" g/cm3... proceeding";
1139 BDS::Warning(__METHOD_NAME__, msg);
1148 {
return (*iter).second;}
1151 G4Element* element = G4NistManager::Instance()->FindOrBuildElement(symbol,
true);
1160 {
throw BDSException(__METHOD_NAME__,
"Element \"" + symbol +
"\" could not be found.");}
1167 for (G4int i = 0; i < (G4int)material->GetNumberOfElements(); i++)
1169 G4cout << (*(material->GetElementVector()))[i]->GetName() <<
"\t "
1170 << (material->GetFractionVector()[i])/CLHEP::perCent <<
" %" << G4endl;
1176 auto flagsCache(G4cout.flags());
1177 G4cout << __METHOD_NAME__ << G4endl;
1180 G4cout<<
"\"vacuum\" composition: " << G4endl;
1182 G4cout<<
"pressure = " << vacuum->GetPressure()/CLHEP::bar <<
" bar" << G4endl;
1183 G4cout<<
"temperature = " << vacuum->GetTemperature()/CLHEP::kelvin <<
" K" << G4endl;
1184 G4cout<<
"density = " << vacuum->GetDensity()/(CLHEP::g/CLHEP::cm3)<<
" g/cm^3" << G4endl << G4endl;
1186 G4cout <<
"All elements are available with their 1 or 2 letter chemical symbol. ie C or G4_C" << G4endl << G4endl;
1190 G4cout <<
"Extra defined elements are:" << G4endl;
1191 for (
const auto& element :
elements)
1192 {G4cout << std::left << std::setw(12) << element.second->GetName() <<
" - " << element.second->GetSymbol() << G4endl;}
1196 G4cout <<
"Defined materials are:" << G4endl;
1199 G4cout << material.first;
1200 G4String realName = material.second->GetName();
1201 if (realName != material.first)
1202 {G4cout <<
" (" << material.second->GetName() <<
")" << G4endl;}
1207 G4cout <<
"Available NIST materials are:" << G4endl;
1208 G4NistManager::Instance()->ListMaterials(
"all");
1209 G4cout.flags(flagsCache);
1212BDSMaterials::~BDSMaterials()
1215 {
delete material.second;}
1219 {
delete element.second;}
1233 G4bool debug =
true;
1235 G4bool debug =
false;
1239 if (verbose || debug)
1240 {G4cout << __METHOD_NAME__ <<
"parsing the atom list..." << G4endl;}
1243 if (verbose || debug)
1247 if (verbose || debug)
1248 {G4cout <<
"parsing the material list..."<< G4endl;}
1252 if (it.state==
"solid")
1253 {itsState = kStateSolid;}
1254 else if (it.state==
"liquid")
1255 {itsState = kStateLiquid;}
1256 else if (it.state==
"gas")
1257 {itsState = kStateGas;}
1260 G4cout <<
"Unknown material state "<< it.state
1261 <<
", setting it to default (solid)"
1264 itsState = kStateSolid;
1268 G4cout <<
"---->adding Material, ";
1282 else if(!(it.components.empty()))
1284 std::list<G4String> tempComponents;
1285 for (
const auto& jt : it.components)
1286 {tempComponents.emplace_back(G4String(jt));}
1288 if(it.componentsWeights.size()==it.components.size())
1296 it.componentsWeights);
1298 else if(it.componentsFractions.size()==it.components.size())
1306 it.componentsFractions);
1309 {
throw BDSException(__METHOD_NAME__,
"Badly defined material - number of components is not equal to number of weights or mass fractions!");}
1312 {
throw BDSException(__METHOD_NAME__,
"Badly defined material - need more information!");}
1314 if (verbose || debug)
1320 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.
void DefineLHCComponents()
Methods called by constructor.
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.
std::map< G4String, G4Material * > aliases
Maps of other names to existing materials. To avoid double deletion. Also in lower case.
static BDSMaterials * instance
Singleton instance.
std::map< G4String, G4Material * > materials
<ap of materials, convention name lowercase.
std::map< G4String, G4Element * > elements
Map of elements, no lowercase convention.
void DefineLiquids()
Methods called by constructor.
void CacheMaterialsFromGDML(const std::map< G4String, G4Material * > &materialsGDML, const G4String &prepend, G4bool prependWasUsed)
G4Material * GetMaterial(G4String material) const
Get material by name.
void PrepareRequiredMaterials(G4bool verbose=false)
converts parser material list
void ListMaterials() const
output available materials
void DefinePlasmas()
Methods called by constructor.
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.
std::map< G4String, G4int > possibleDuplicates
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 vector of atom objects.
static bool IsInitialised()
Returns if parser is initialised.
const GMAD::Options & GetOptions() const
Return options.
std::vector< GMAD::Material > GetMaterials() const
Return material list.
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".