DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Layering.h
Go to the documentation of this file.
1 // $Id$
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 #ifndef DD4hep_LAYERING_H
16 #define DD4hep_LAYERING_H
17 
18 // Framework include files
19 #include "XML/XMLElements.h"
20 
21 // C/C++ include files
22 #include <vector>
23 
25 namespace DD4hep {
26 
28 
33  class LayerSlice {
34  public:
35  bool _sensitive;
36  double _thickness;
37  std::string _material;
39  LayerSlice(bool s, double t, const std::string& m);
41  LayerSlice(const LayerSlice& c);
43  LayerSlice& operator=(const LayerSlice& c);
44  };
45 
47  inline LayerSlice::LayerSlice(bool s, double t, const std::string& m)
48  : _sensitive(s), _thickness(t), _material(m) {
49  }
52  : _sensitive(c._sensitive), _thickness(c._thickness), _material(c._material) {
53  }
54 
56 
61  class Layer {
62  public:
63  double _thickness;
64  double _preOffset;
65  std::vector<LayerSlice> _slices;
66 
68  Layer();
70  Layer(const Layer& c);
72  Layer& operator=(const Layer& c);
73 
74  void compute();
75  double thickness() const {
76  return _thickness;
77  }
78  double thicknessWithPreOffset() const {
79  return _thickness + _preOffset;
80  }
81  void add(const LayerSlice& s) {
82  _slices.push_back(s);
83  }
84  };
85 
87  inline Layer::Layer() : _thickness(0.), _preOffset(0.) {
88  }
89 
90 
92 
97  class LayerStack {
98  public:
99  std::vector<Layer*> _layers;
101  LayerStack();
103  LayerStack(const LayerStack& c);
106  }
109  if ( &c != this ) _layers = c._layers;
110  return *this;
111  }
112  std::vector<Layer*>& layers() {
113  return _layers;
114  }
115  const std::vector<Layer*>& layers() const {
116  return _layers;
117  }
118  double sectionThickness(size_t is, size_t ie) const;
119  double totalThickness() const {
120  return sectionThickness(0, _layers.size() - 1);
121  }
122  };
123 
126  }
129  : _layers(c._layers) {
130  }
131 
133 
138  class Layering {
139  public:
142  Layering();
146  virtual ~Layering();
147 
148  std::vector<Layer*>& layers() {
149  return _stack.layers();
150  }
151  const Layer* layer(size_t which) const;
152 
153  double totalThickness() const {
154  return _stack.totalThickness();
155  }
156  double singleLayerThickness(XML::Element e) const;
158  void sensitivePositionsInLayer(XML::Element e,std::vector<double>& sens_pos) const;
159 
160  };
161 
163  namespace XML {
164 
166 
171  class LayeringCnv: public Element {
172  public:
176  void fromCompact(Layering& layering) const;
177  };
178 
181  : Element(e) {
182  }
183 
184  }
185 
186 } /* End namespace DD4hep */
187 #endif /* DD4hep_LAYERING_H */
std::vector< Layer * > _layers
Definition: Layering.h:99
double totalThickness() const
Definition: Layering.h:119
std::vector< Layer * > & layers()
Definition: Layering.h:112
Layer()
Default constructor.
Definition: Layering.h:87
void sensitivePositionsInLayer(XML::Element e, std::vector< double > &sens_pos) const
Definition: Layering.cpp:136
LayerStack()
Default constructor.
Definition: Layering.h:125
Class to convert a layering object from the compact notation.
Definition: Layering.h:138
void fromCompact(Layering &layering) const
Invoke converter.
Definition: Layering.cpp:90
double sectionThickness(size_t is, size_t ie) const
Definition: Layering.cpp:58
const Layer * layer(size_t which) const
Definition: Layering.cpp:86
double thicknessWithPreOffset() const
Definition: Layering.h:78
const std::vector< Layer * > & layers() const
Definition: Layering.h:115
LayerSlice(bool s, double t, const std::string &m)
Initializing constructor.
Definition: Layering.h:47
TGeoShape * s
Definition: Volumes.cpp:294
User abstraction class to manipulate XML elements within a document.
Definition: XMLElements.h:686
void add(const LayerSlice &s)
Definition: Layering.h:81
return e
Definition: Volumes.cpp:297
std::vector< LayerSlice > _slices
Definition: Layering.h:65
double singleLayerThickness(XML::Element e) const
Definition: Layering.cpp:115
double _preOffset
Definition: Layering.h:64
Class to describe one layer in a layering stack.
Definition: Layering.h:61
virtual ~Layering()
Default destructor.
Definition: Layering.cpp:83
double _thickness
Definition: Layering.h:63
double absorberThicknessInLayer(XML::Element e) const
Definition: Layering.cpp:125
LayerStack _stack
Definition: Layering.h:140
double totalThickness() const
Definition: Layering.h:153
double thickness() const
Definition: Layering.h:75
~LayerStack()
Default destructor.
Definition: Layering.h:105
Class to describe the slice of one layer in a layering stack.
Definition: Layering.h:33
std::string _material
Definition: Layering.h:37
LayeringCnv(Element e)
Initializing constructor.
Definition: Layering.h:180
Class to describe a layering stack.
Definition: Layering.h:97
Layering()
Default constructor.
Definition: Layering.cpp:76
std::vector< Layer * > & layers()
Definition: Layering.h:148
double _thickness
Definition: Layering.h:36
LayerSlice & operator=(const LayerSlice &c)
Assignment operator.
Definition: Layering.cpp:30
XML converter for layering objects.
Definition: Layering.h:171
Layer & operator=(const Layer &c)
Assignment operator.
Definition: Layering.cpp:43
void compute()
Definition: Layering.cpp:52
LayerStack & operator=(const LayerStack &c)
Assignment operator.
Definition: Layering.h:108
TGeoShape TGeoMedium * m
Definition: Volumes.cpp:294