File indexing completed on 2025-01-18 09:28:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #pragma once
0011
0012 #include "ActsDD4hep/ActsExtension.hpp"
0013
0014 #include <DD4hep/DetElement.h>
0015 #include <DD4hep/DetFactoryHelper.h>
0016
0017 #include "XML/XMLElements.h"
0018 #include <boost/foreach.hpp>
0019 #include <boost/tokenizer.hpp>
0020
0021 namespace Acts {
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 void xmlToProtoSurfaceMaterial(const xml_comp_t& x_material,
0035 ActsExtension& actsExtension,
0036 const std::string& baseTag);
0037 }
0038
0039 inline void Acts::xmlToProtoSurfaceMaterial(const xml_comp_t& x_material,
0040 ActsExtension& actsExtension,
0041 const std::string& baseTag) {
0042
0043 actsExtension.addType(baseTag);
0044
0045 std::string mSurface = x_material.attr<std::string>("surface");
0046 std::string mBinning = x_material.attr<std::string>("binning");
0047 boost::char_separator<char> sep(",");
0048 boost::tokenizer binTokens(mBinning, sep);
0049 const auto n = std::distance(binTokens.begin(), binTokens.end());
0050 if (n == 2) {
0051
0052 auto bin = binTokens.begin();
0053 std::string bin0 = *(bin);
0054 std::string bin1 = *(++bin);
0055 size_t nBins0 = x_material.attr<int>("bins0");
0056 size_t nBins1 = x_material.attr<int>("bins1");
0057
0058 std::string btmSurface = baseTag + std::string("_") + mSurface;
0059 actsExtension.addValue(nBins0, bin0, btmSurface);
0060 actsExtension.addValue(nBins1, bin1, btmSurface);
0061 }
0062 }