17 std::vector<Acts::Svg::ProtoAssociations> >
26 const auto& surfaces = surfaceArray.
surfaces();
30 auto axes = surfaceArray.
getAxes();
32 enum ViewType { cylinder, polar, planar, none };
33 ViewType vType = none;
35 if (not binning.empty() and binning.size() == 2 and axes.size() == 2) {
37 std::vector<Acts::ActsScalar> edges0;
38 std::vector<Acts::ActsScalar> edges1;
40 auto convertGridEdges = [](
const std::vector<Acts::ActsScalar>& actsEdges)
41 -> std::vector<actsvg::scalar> {
42 std::vector<actsvg::scalar> svgEdges;
43 svgEdges.reserve(actsEdges.size());
44 for (
const auto ae : actsEdges) {
45 svgEdges.push_back(static_cast<actsvg::scalar>(ae));
51 if (binning[0] ==
binPhi and binning[1] ==
binZ) {
54 edges1 = axes[0]->getBinEdges();
55 edges0 = axes[1]->getBinEdges();
56 pGrid._type = actsvg::proto::grid::e_z_phi;
57 }
else if (binning[0] ==
binPhi and binning[1] ==
binR) {
60 edges1 = axes[0]->getBinEdges();
61 edges0 = axes[1]->getBinEdges();
62 pGrid._type = actsvg::proto::grid::e_r_phi;
63 }
else if (binning[0] ==
binZ and binning[1] ==
binPhi) {
66 edges0 = axes[0]->getBinEdges();
67 edges1 = axes[1]->getBinEdges();
68 pGrid._type = actsvg::proto::grid::e_z_phi;
69 }
else if (binning[0] ==
binR and binning[1] ==
binPhi) {
72 edges0 = axes[0]->getBinEdges();
73 edges1 = axes[1]->getBinEdges();
74 pGrid._type = actsvg::proto::grid::e_r_phi;
77 pGrid._edges_0 = convertGridEdges(edges0);
78 pGrid._edges_1 = convertGridEdges(edges1);
82 std::vector<actsvg::svg::object> templateObjects;
83 std::vector<const SurfaceBounds*> templateBounds;
85 for (
const auto& sf : surfaces) {
90 return ((*
test) == sBounds);
94 std::find_if(templateBounds.begin(), templateBounds.end(), sameBounds);
96 if (tBounds == templateBounds.end()) {
103 sOptions.
style = *sfStyle;
108 auto referenceObject =
111 templateBounds.push_back(&sBounds);
112 templateObjects.push_back(referenceObject);
120 for (
const auto& sf : surfaces) {
129 sOptions.style = *sfStyle;
140 if (vType == cylinder) {
144 return ((*
test) == sBounds);
147 auto tBounds = std::find_if(templateBounds.begin(), templateBounds.end(),
150 if (tBounds != templateBounds.end()) {
151 size_t tObject =
std::distance(templateBounds.begin(), tBounds);
152 cSurface._template_object = templateObjects[tObject];
156 if (vType == planar or vType == polar) {
168 auto surfaceCenter = sf->center(gctx);
170 cSurface._transform._tr = {
static_cast<actsvg::scalar
>(surfaceCenter[0]),
171 static_cast<actsvg::scalar>(surfaceCenter[1])};
172 cSurface._transform._rot = {
static_cast<actsvg::scalar
>(
alpha), 0., 0.};
177 radius /= surfaces.size();
180 for (
unsigned int il0 = 1; il0 < pGrid._edges_0.size(); ++il0) {
181 ActsScalar p0 = 0.5 * (pGrid._edges_0[il0] + pGrid._edges_0[il0 - 1]);
182 for (
unsigned int il1 = 1; il1 < pGrid._edges_1.size(); ++il1) {
183 ActsScalar p1 = 0.5 * (pGrid._edges_1[il1] + pGrid._edges_1[il1 - 1]);
186 if (vType == polar) {
187 bCenter =
Vector3(p0 * std::cos(p1), p0 * std::sin(p1), 0.);
188 }
else if (vType == cylinder) {
189 bCenter =
Vector3(radius * std::cos(p1), radius * std::sin(p1), p0);
192 auto bSurfaces = surfaceArray.
neighbors(bCenter);
193 std::vector<size_t> binnAssoc;
194 for (
const auto& bs : bSurfaces) {
195 auto candidate = std::find(surfaces.begin(), surfaces.end(), bs);
196 if (candidate != surfaces.end()) {
197 binnAssoc.push_back(
std::distance(surfaces.begin(), candidate));
200 pAssociations.push_back(binnAssoc);
204 std::vector<ProtoSurfaces> pSurfaceBatches = {pSurfaces};
205 std::vector<ProtoAssociations> pAssociationBatchs = {pAssociations};
206 return std::tie(pSurfaceBatches, pGrid, pAssociationBatchs);