DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Layering.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 #ifndef XML_LAYERING_H
15 #define XML_LAYERING_H
16 
17 // Framework include files
18 #include <XML/XMLElements.h>
19 
20 // C/C++ include files
21 #include <vector>
22 
24 namespace dd4hep {
25 
27 
32  class LayerSlice {
33  public:
34  bool _sensitive;
35  double _thickness;
36  std::string _material;
38  LayerSlice(bool sens, double thick, const std::string& mat);
40  LayerSlice(const LayerSlice& copy) = default;
42  LayerSlice& operator=(const LayerSlice& copy) = default;
43  };
44 
46  inline LayerSlice::LayerSlice(bool sens, double thick, const std::string& mat)
47  : _sensitive(sens), _thickness(thick), _material(mat) {
48  }
49 
51 
56  class Layer {
57  public:
58  double _thickness = 0.0;
59  double _preOffset = 0.0;
60  std::vector<LayerSlice> _slices;
61 
63  Layer() = default;
65  Layer(const Layer& copy) = default;
67  Layer& operator=(const Layer& copy) = default;
68 
69  void compute();
70  double thickness() const {
71  return _thickness;
72  }
73  double thicknessWithPreOffset() const {
74  return _thickness + _preOffset;
75  }
76  void add(const LayerSlice& slice) {
77  _slices.emplace_back(slice);
78  }
79  };
80 
82 
87  class LayerStack {
88  public:
89  std::vector<Layer*> _layers;
91  LayerStack() = default;
93  LayerStack(const LayerStack& copy) = default;
95  ~LayerStack() = default;
97  LayerStack& operator=(const LayerStack& copy) = default;
98  std::vector<Layer*>& layers() {
99  return _layers;
100  }
101  const std::vector<Layer*>& layers() const {
102  return _layers;
103  }
104  double sectionThickness(size_t is, size_t ie) const;
105  double totalThickness() const {
106  return sectionThickness(0, _layers.size() - 1);
107  }
108  };
109 
111 
116  class Layering {
117  public:
120  Layering() = default;
122  Layering(xml::Element element);
124  ~Layering();
125 
126  std::vector<Layer*>& layers() {
127  return _stack.layers();
128  }
129  const Layer* layer(size_t which) const;
130 
131  double totalThickness() const {
132  return _stack.totalThickness();
133  }
134  double singleLayerThickness(xml::Element e) const;
135  double absorberThicknessInLayer(xml::Element e) const;
136  void sensitivePositionsInLayer(xml::Element e,std::vector<double>& sens_pos) const;
137 
138  };
139 
141  namespace xml {
142 
144 
149  class LayeringCnv: public Element {
150  public:
152  LayeringCnv(Element e);
154  void fromCompact(Layering& layering) const;
155  };
156 
159  : Element(e) {
160  }
161  }
162 } /* End namespace dd4hep */
163 #endif // XML_LAYERING_H
dd4hep::Layering::totalThickness
double totalThickness() const
Definition: Layering.h:131
dd4hep::Layering::absorberThicknessInLayer
double absorberThicknessInLayer(xml::Element e) const
Definition: Layering.cpp:86
dd4hep::Layering::Layering
Layering()=default
Default constructor.
dd4hep::Layer::operator=
Layer & operator=(const Layer &copy)=default
Assignment operator.
dd4hep::LayerStack::LayerStack
LayerStack()=default
Default constructor.
dd4hep::Layering::layer
const Layer * layer(size_t which) const
Definition: Layering.cpp:72
dd4hep::xml::LayeringCnv::fromCompact
void fromCompact(Layering &layering) const
Invoke converter.
Definition: Layering.cpp:43
dd4hep::Layer::thicknessWithPreOffset
double thicknessWithPreOffset() const
Definition: Layering.h:73
dd4hep::LayerStack
Class to describe a layering stack.
Definition: Layering.h:87
dd4hep::xml::LayeringCnv
XML converter for layering objects.
Definition: Layering.h:149
dd4hep::LayerSlice::LayerSlice
LayerSlice(const LayerSlice &copy)=default
Copy constructor.
dd4hep::LayerSlice::LayerSlice
LayerSlice(bool sens, double thick, const std::string &mat)
Initializing constructor.
Definition: Layering.h:46
dd4hep::Layer
Class to describe one layer in a layering stack.
Definition: Layering.h:56
dd4hep::Layer::Layer
Layer()=default
Default constructor.
dd4hep::LayerStack::totalThickness
double totalThickness() const
Definition: Layering.h:105
dd4hep::LayerStack::layers
std::vector< Layer * > & layers()
Definition: Layering.h:98
dd4hep::Layering::sensitivePositionsInLayer
void sensitivePositionsInLayer(xml::Element e, std::vector< double > &sens_pos) const
Definition: Layering.cpp:97
dd4hep::Layering::_stack
LayerStack _stack
Definition: Layering.h:118
dd4hep::Layer::add
void add(const LayerSlice &slice)
Definition: Layering.h:76
dd4hep::xml
Namespace for the AIDA detector description toolkit supporting XML utilities.
Definition: ConditionsTags.h:27
dd4hep::LayerSlice::_sensitive
bool _sensitive
Definition: Layering.h:34
dd4hep::LayerSlice::_material
std::string _material
Definition: Layering.h:36
dd4hep::LayerStack::sectionThickness
double sectionThickness(size_t is, size_t ie) const
Definition: Layering.cpp:27
dd4hep::LayerStack::LayerStack
LayerStack(const LayerStack &copy)=default
Copy constructor.
dd4hep::LayerSlice::_thickness
double _thickness
Definition: Layering.h:35
dd4hep::Layering
Class to convert a layering object from the compact notation.
Definition: Layering.h:116
dd4hep::Layer::thickness
double thickness() const
Definition: Layering.h:70
dd4hep::LayerSlice
Class to describe the slice of one layer in a layering stack.
Definition: Layering.h:32
dd4hep::Layer::_preOffset
double _preOffset
Definition: Layering.h:59
dd4hep::LayerStack::~LayerStack
~LayerStack()=default
Default destructor.
XMLElements.h
dd4hep::xml::Element
User abstraction class to manipulate XML elements within a document.
Definition: XMLElements.h:769
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::LayerStack::operator=
LayerStack & operator=(const LayerStack &copy)=default
Assignment operator.
dd4hep::LayerStack::layers
const std::vector< Layer * > & layers() const
Definition: Layering.h:101
dd4hep::Layering::singleLayerThickness
double singleLayerThickness(xml::Element e) const
Definition: Layering.cpp:76
dd4hep::Layering::layers
std::vector< Layer * > & layers()
Definition: Layering.h:126
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::Layer::compute
void compute()
Definition: Layering.cpp:21
dd4hep::Layer::_slices
std::vector< LayerSlice > _slices
Definition: Layering.h:60
dd4hep::LayerSlice::operator=
LayerSlice & operator=(const LayerSlice &copy)=default
Assignment operator.
dd4hep::LayerStack::_layers
std::vector< Layer * > _layers
Definition: Layering.h:89
dd4hep::xml::LayeringCnv::LayeringCnv
LayeringCnv(Element e)
Initializing constructor.
Definition: Layering.h:158
dd4hep::Layering::~Layering
~Layering()
Default destructor.
Definition: Layering.cpp:111
dd4hep::Layer::Layer
Layer(const Layer &copy)=default
Copy constructor.
dd4hep::Layer::_thickness
double _thickness
Definition: Layering.h:58