File indexing completed on 2025-01-18 10:15:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef XML_LAYERING_H
0015 #define XML_LAYERING_H
0016
0017
0018 #include <XML/XMLElements.h>
0019
0020
0021 #include <vector>
0022
0023
0024 namespace dd4hep {
0025
0026
0027
0028
0029
0030
0031
0032 class LayerSlice {
0033 public:
0034 bool _sensitive;
0035 double _thickness;
0036 std::string _material;
0037
0038 LayerSlice(bool sens, double thick, const std::string& mat);
0039
0040 LayerSlice(const LayerSlice& copy) = default;
0041
0042 LayerSlice& operator=(const LayerSlice& copy) = default;
0043 };
0044
0045
0046 inline LayerSlice::LayerSlice(bool sens, double thick, const std::string& mat)
0047 : _sensitive(sens), _thickness(thick), _material(mat) {
0048 }
0049
0050
0051
0052
0053
0054
0055
0056 class Layer {
0057 public:
0058 double _thickness = 0.0;
0059 double _preOffset = 0.0;
0060 std::vector<LayerSlice> _slices;
0061
0062
0063 Layer() = default;
0064
0065 Layer(const Layer& copy) = default;
0066
0067 Layer& operator=(const Layer& copy) = default;
0068
0069 void compute();
0070 double thickness() const {
0071 return _thickness;
0072 }
0073 double thicknessWithPreOffset() const {
0074 return _thickness + _preOffset;
0075 }
0076 void add(const LayerSlice& slice) {
0077 _slices.emplace_back(slice);
0078 }
0079 };
0080
0081
0082
0083
0084
0085
0086
0087 class LayerStack {
0088 public:
0089 std::vector<Layer*> _layers;
0090
0091 LayerStack() = default;
0092
0093 LayerStack(const LayerStack& copy) = default;
0094
0095 ~LayerStack() = default;
0096
0097 LayerStack& operator=(const LayerStack& copy) = default;
0098 std::vector<Layer*>& layers() {
0099 return _layers;
0100 }
0101 const std::vector<Layer*>& layers() const {
0102 return _layers;
0103 }
0104 double sectionThickness(size_t is, size_t ie) const;
0105 double totalThickness() const {
0106 return sectionThickness(0, _layers.size() - 1);
0107 }
0108 };
0109
0110
0111
0112
0113
0114
0115
0116 class Layering {
0117 public:
0118 LayerStack _stack;
0119
0120 Layering() = default;
0121
0122 Layering(xml::Element element);
0123
0124 ~Layering();
0125
0126 std::vector<Layer*>& layers() {
0127 return _stack.layers();
0128 }
0129 const Layer* layer(size_t which) const;
0130
0131 double totalThickness() const {
0132 return _stack.totalThickness();
0133 }
0134 double singleLayerThickness(xml::Element e) const;
0135 double absorberThicknessInLayer(xml::Element e) const;
0136 void sensitivePositionsInLayer(xml::Element e,std::vector<double>& sens_pos) const;
0137
0138 };
0139
0140
0141 namespace xml {
0142
0143
0144
0145
0146
0147
0148
0149 class LayeringCnv: public Element {
0150 public:
0151
0152 LayeringCnv(Element e);
0153
0154 void fromCompact(Layering& layering) const;
0155 };
0156
0157
0158 inline LayeringCnv::LayeringCnv(Element e)
0159 : Element(e) {
0160 }
0161 }
0162 }
0163 #endif