OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Material.h
Go to the documentation of this file.
1//
2// Class Material
3// Base class for representing materials
4//
5// Copyright (c) 2019 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved
7//
8// This file is part of OPAL.
9//
10// OPAL is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// You should have received a copy of the GNU General Public License
16// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17//
18#ifndef MATERIAL_H
19#define MATERIAL_H
20
21#include <map>
22#include <array>
23#include <string>
24#include <memory>
25#include <cmath>
26
27namespace Physics {
28 class Material {
29 public:
30 enum FitCoeffs {
31 A1 = 0,
40 B5
41 };
42
43 Material(double atomicNumber,
44 double atomicMass,
45 double massDensity,
46 double radiationLength,
47 double meanExcitationEnergy,
48 std::array<double, 10> fitCoefficients):
49 atomicNumber_m(atomicNumber),
50 atomicMass_m(atomicMass),
51 massDensity_m(massDensity),
52 radiationLength_m(radiationLength / massDensity / 100),
53 meanExcitationEnergy_m(meanExcitationEnergy),
54 stoppingPowerFitCoefficients_m(fitCoefficients)
55 { }
56
57 double getAtomicNumber() const; // [1]
58 double getAtomicMass() const; // [u]
59 double getMassDensity() const; // [g cm^-3]
60 double getRadiationLength() const; // [m]
61 double getMeanExcitationEnergy() const; // [eV]
63
64 static std::shared_ptr<Material> getMaterial(const std::string& name);
65 static std::shared_ptr<Material> addMaterial(const std::string& name,
66 std::shared_ptr<Material> mat_ptr);
67 private:
68 static
69 std::map<std::string, std::shared_ptr<Material> > protoTable_sm;
70
71 const double atomicNumber_m;
72 const double atomicMass_m;
73 const double massDensity_m;
74 const double radiationLength_m;
76 const std::array<double,10> stoppingPowerFitCoefficients_m;
77 };
78
79 inline
81 return atomicNumber_m;
82 }
83
84 inline
85 double Material::getAtomicMass() const {
86 return atomicMass_m;
87 }
88
89 inline
90 double Material::getMassDensity() const {
91 return massDensity_m;
92 }
93
94 inline
96 return radiationLength_m;
97 }
98
99 inline
102 }
103
104 inline
107 }
108
109 // inline
110 // double Material::getMeanExcitationEnergy() const {
111 // double Z = getAtomicNumber();
112 // if (Z < 13.0)
113 // return 12 * Z + 7;
114
115 // return 9.76 * Z + 58.8 * std::pow(Z, -.19);
116 // }
117}
118#endif
const std::string name
Definition: Air.h:27
const double atomicNumber_m
Definition: Material.h:71
Material(double atomicNumber, double atomicMass, double massDensity, double radiationLength, double meanExcitationEnergy, std::array< double, 10 > fitCoefficients)
Definition: Material.h:43
double getAtomicMass() const
Definition: Material.h:85
static std::shared_ptr< Material > addMaterial(const std::string &name, std::shared_ptr< Material > mat_ptr)
Definition: Material.cpp:42
const double radiationLength_m
Definition: Material.h:74
double getStoppingPowerFitCoefficients(FitCoeffs n) const
Definition: Material.h:105
double getAtomicNumber() const
Definition: Material.h:80
const double meanExcitationEnergy_m
Definition: Material.h:75
double getRadiationLength() const
Definition: Material.h:95
const std::array< double, 10 > stoppingPowerFitCoefficients_m
Definition: Material.h:76
static std::map< std::string, std::shared_ptr< Material > > protoTable_sm
Definition: Material.h:69
const double atomicMass_m
Definition: Material.h:72
const double massDensity_m
Definition: Material.h:73
static std::shared_ptr< Material > getMaterial(const std::string &name)
Definition: Material.cpp:53
double getMassDensity() const
Definition: Material.h:90
double getMeanExcitationEnergy() const
Definition: Material.h:100