31 :
VGM::IMaterialFactory(),
50 :
VGM::IMaterialFactory(rhs)
61 for (
unsigned int i = 0; i < fIsotopes.size(); i++) {
66 for (
unsigned int i = 0; i < fElements.size(); i++) {
71 for (
unsigned int j = 0; j < fMaterials.size(); j++) {
76 for (
unsigned int k = 0; k < fMedia.size(); k++) {
94 std::cout <<
"Exporting isotope: ";
95 if (Debug() > 1) std::cout << isotope;
96 std::cout << std::endl;
98 std::cout << *isotope << std::endl;
102 isotope->
Name(), isotope->
Z(), isotope->
N(), isotope->
A());
115 std::cout <<
"Exporting element: ";
116 if (Debug() > 1) std::cout << element;
117 std::cout << std::endl;
119 std::cout << *element << std::endl;
125 element->
Name(), element->
Symbol(), element->
Z(), element->
A());
136 isotopes.push_back(newIsotope);
137 relAbundances.push_back(relAbundance);
140 element->
Name(), element->
Symbol(), isotopes, relAbundances);
149 ElementMap* elementMap)
const
156 std::cout <<
"Exporting material: ";
157 if (Debug() > 1) std::cout << material;
158 std::cout << std::endl;
160 std::cout << *material << std::endl;
165 if (nofElements == 1) {
175 for (
int i = 0; i < material->
NofElements(); i++) {
180 elements.push_back(newElement);
181 massFractions.push_back(massFraction);
201 std::cout <<
"Exporting medium: ";
202 if (Debug() > 1) std::cout << medium;
203 std::cout << std::endl;
205 std::cout << *medium << std::endl;
212 double* parameters =
new double[nofParameters];
213 for (
int i = 0; i < nofParameters; i++) parameters[i] = medium->
Parameter(i);
216 medium->
Name(), medium->
Id(), newMaterial, nofParameters, parameters);
226 MaterialMap* materialMap)
const
233 std::cout <<
"Generation medium for material: ";
234 if (Debug() > 1) std::cout << material;
235 std::cout << std::endl;
237 std::cout << *material << std::endl;
242 int nofParameters = 0;
243 double* parameters =
new double[nofParameters];
246 material->
Name(), mediumId, newMaterial, nofParameters, parameters);
254BaseVGM::VMaterialFactory::IsotopeMap*
260 IsotopeMap* isotopeMap =
new IsotopeMap();
262 for (
unsigned int i = 0; i < Isotopes().size(); i++) {
268 (*isotopeMap)[isotope] = newIsotope;
275BaseVGM::VMaterialFactory::ElementMap*
276BaseVGM::VMaterialFactory::ExportElements(
282 ElementMap* elementMap =
new ElementMap();
284 for (
unsigned int i = 0; i < Elements().size(); i++) {
287 VGM::IElement* newElement = ExportElement(element, factory, isotopeMap);
290 (*elementMap)[element] = newElement;
297BaseVGM::VMaterialFactory::MaterialMap*
298BaseVGM::VMaterialFactory::ExportMaterials(
304 MaterialMap* materialMap =
new MaterialMap();
306 for (
unsigned int i = 0; i < Materials().size(); i++) {
309 VGM::IMaterial* newMaterial = ExportMaterial(material, factory, elementMap);
312 (*materialMap)[material] = newMaterial;
319void BaseVGM::VMaterialFactory::ExportMedia(
325 for (
unsigned int i = 0; i < Media().size(); i++) {
327 ExportMedium(medium, factory, materialMap);
334void BaseVGM::VMaterialFactory::GenerateMedia(
341 for (
unsigned int i = 0; i < Materials().size(); i++) {
343 GenerateMedium(material, i, factory, materialMap);
355 const std::string& name)
const
360 for (
unsigned int i = 0; i < Isotopes().size(); i++) {
362 if (isotope->
Name() == name)
return isotope;
370 const std::string& name)
const
375 for (
unsigned int i = 0; i < Elements().size(); i++) {
377 if (element->
Name() == name)
return element;
385 const std::string& name)
const
390 for (
unsigned int i = 0; i < Materials().size(); i++) {
392 if (material->
Name() == name)
return material;
400 const std::string& name)
const
405 for (
unsigned int i = 0; i < Media().size(); i++) {
407 if (medium->
Name() == name)
return medium;
418 IsotopeMap* isotopeMap = ExportIsotopes(factory);
419 ElementMap* elementMap = ExportElements(factory, isotopeMap);
420 MaterialMap* materialMap = ExportMaterials(factory, elementMap);
421 if (Media().size() > 0)
422 ExportMedia(factory, materialMap);
424 GenerateMedia(factory, materialMap);
436 for (
unsigned i = 0; i < isotopes.size(); i++) {
438 std::cout << i <<
"th isotope: " << std::endl;
439 std::cout << *isotopes[i] << std::endl;
450 for (
unsigned i = 0; i < elements.size(); i++) {
452 std::cout << i <<
"th element: " << std::endl;
453 std::cout << *elements[i] << std::endl;
464 for (
unsigned i = 0; i < materials.size(); i++) {
466 std::cout << i <<
"th material: " << std::endl;
467 std::cout << *materials[i] << std::endl;
478 for (
unsigned i = 0; i < media.size(); i++) {
480 std::cout << i <<
"th medium: " << std::endl;
481 std::cout << *media[i] << std::endl;
The abstract base class to material factory.
virtual const VGM::IMedium * Medium(const std::string &name) const
Return medium specified by name.
virtual const VGM::IMaterial * Material(const std::string &name) const
Return material specified by name.
virtual const VGM::IElement * Element(const std::string &name) const
Return element specified by name.
virtual const VGM::IIsotope * Isotope(const std::string &name) const
Return isotope specified by name.
virtual void PrintMaterials() const
Print all materials.
virtual bool Export(VGM::IMaterialFactory *factory) const
Export materials to the specified material factory.
virtual void PrintMedia() const
Print all media.
virtual void PrintElements() const
Print all elements.
virtual void PrintIsotopes() const
Print all isotopes.
virtual ~VMaterialFactory()
The VGM interface to elements.
virtual IIsotope * Isotope(int i) const =0
Return the i-th isotope constituing this element.
virtual int NofIsotopes() const =0
Return the number of isotopes constituing this element.
virtual double Z() const =0
Return the effective atomic number.
virtual double RelAbundance(int i) const =0
Return the relative abundance (the fraction of nb of atomes per volume) of the i-th isotope constitui...
virtual std::string Name() const =0
Return the name of this element.
virtual std::string Symbol() const =0
Return the symbol of this element.
virtual double A() const =0
Return the effective effective mass of a mole in g/mole.
The VGM interface to elements.
virtual int N() const =0
Return the effective number of nucleons.
virtual std::string Name() const =0
Return the name of this element.
virtual double A() const =0
Return the effective effective mass of a mole in g/mole.
virtual int Z() const =0
Return the effective atomic number.
The VGM interface to material factory providing functions for material conversions.
virtual IElement * CreateElement(const std::string &name, const std::string &symbol, double z, double a)=0
Create a chemical element.
virtual IMedium * CreateMedium(const std::string &name, int mediumId, VGM::IMaterial *material, int nofParameters, double *parameters)=0
Create a tracking medium.
virtual IMaterial * CreateMaterial(const std::string &name, double density, VGM::IElement *element, double radlen, double intlen)=0
Create a material.
virtual IIsotope * CreateIsotope(const std::string &name, int z, int n, double a=0.)=0
Create a chemical isotope.
The VGM interface to materials.
virtual double Pressure() const =0
Return the density in atmosphere.
virtual IElement * Element(int iel) const =0
Return the i-th element constituing this material.
virtual double NuclearInterLength() const =0
Return the nuclear interaction length in mm.
virtual double Density() const =0
Return the density in g/cm3.
virtual double Temperature() const =0
Return the temperature in kelvins.
virtual std::string Name() const =0
Return the name of this element.
virtual double RadiationLength() const =0
Return the radiation length in mm.
virtual MaterialState State() const =0
Return the material state.
virtual double MassFraction(int iel) const =0
Return the mass fraction of the i-th element constituing this material.
virtual int NofElements() const =0
Return the number of elements constituing this material.
The VGM interface to tracking medium.
virtual IMaterial * Material() const =0
Return its associated material.
virtual int NofParameters() const =0
Return the number of defined parameters.
virtual double Parameter(int i) const =0
Return the i-th parameter.
virtual int Id() const =0
Return its unique identifier.
virtual std::string Name() const =0
Return its name.
void DebugInfo()
Debug printing.
std::vector< IMaterial * > MaterialStore
std::vector< double > RelAbundanceVector
std::vector< double > MassFractionVector
std::vector< IElement * > ElementVector
std::vector< IMedium * > MediumStore
std::vector< IIsotope * > IsotopeStore
std::vector< IIsotope * > IsotopeVector
std::vector< IElement * > ElementStore