From 4a6513576f0577869c09a255a1919b1aed9513fe Mon Sep 17 00:00:00 2001 From: Nikiforos Nikiforou <Nikiforos.Nikiforou@cern.ch> Date: Wed, 12 Aug 2015 16:03:55 +0000 Subject: [PATCH] Added minor functionality to DDCore/XML/Layering --- DDCore/include/XML/Layering.h | 3 +++ DDCore/src/XML/Layering.cpp | 25 +++++++++++++++++++++++++ doc/release.notes | 9 +++++++++ 3 files changed, 37 insertions(+) diff --git a/DDCore/include/XML/Layering.h b/DDCore/include/XML/Layering.h index 7a482c32e..4c835be78 100644 --- a/DDCore/include/XML/Layering.h +++ b/DDCore/include/XML/Layering.h @@ -154,6 +154,9 @@ namespace DD4hep { return _stack.totalThickness(); } double singleLayerThickness(XML::Element e) const; + double absorberThicknessInLayer(XML::Element e) const; + void sensitivePositionsInLayer(XML::Element e,std::vector<double>& sens_pos) const; + }; /// Namespace containing utilities to parse XML files using XercesC or TinyXML diff --git a/DDCore/src/XML/Layering.cpp b/DDCore/src/XML/Layering.cpp index ca2c7e873..2f014946c 100644 --- a/DDCore/src/XML/Layering.cpp +++ b/DDCore/src/XML/Layering.cpp @@ -121,3 +121,28 @@ double Layering::singleLayerThickness(XML::Element e) const { } return thickness; } + +double Layering::absorberThicknessInLayer(XML::Element e) const { + Component lay = e; + double thickness = 0e0; + for (Collection_t s(lay, _U(slice)); s; ++s) { + Component slice = s; + if (slice.isRadiator()) + thickness += slice.thickness(); + } + return thickness; +} + +void Layering::sensitivePositionsInLayer(XML::Element e, std::vector<double>& sens_pos) const { + Component lay = e; + double pos=-singleLayerThickness(e)/2.0; + for (Collection_t s(lay, _U(slice)); s; ++s) { + Component slice = s; + pos += slice.thickness(); + + if (slice.isSensitive()){ + //store the position at the center of the slice + sens_pos.push_back(pos - slice.thickness()/2.); + } + } +} \ No newline at end of file diff --git a/doc/release.notes b/doc/release.notes index dcda4a9c1..372668225 100644 --- a/doc/release.notes +++ b/doc/release.notes @@ -3,6 +3,15 @@ DD4hep ---- Release Notes ================================= +2015-08-12 N.Nikiforou +----------------------- + - DDCore/XML: Added new helper functions to Layering engine: + - double absorberThicknessInLayer(XML::Element e) : + returns total absorber thickness in given layer + - void sensitivePositionsInLayer(XML::Element e, std::vector<double>& sens_pos) : + provides positions of sensitive slices within a layer with respect to the + center of the layer + 2015-07-25 M.Frank ------------------ -- GitLab