20 for (
auto& cv :
container.value().constituentVolumes) {
22 cv.extendUp(ptVolume);
29 for (
auto& cv :
container.value().constituentVolumes) {
30 cv.extent.set(bValue, extent.min(bValue), cv.extent.max(bValue));
31 cv.propagateMinDown(bValue);
38 for (
auto& cv :
container.value().constituentVolumes) {
39 cv.extent.set(bValue, cv.extent.min(bValue), extent.max(bValue));
40 cv.propagateMaxDown(bValue);
46 extent.addConstrain(ptVolume.
extent);
48 for (
auto& cv :
container.value().constituentVolumes) {
49 cv.extent.addConstrain(extent);
55 std::vector<BinningValue> otherConstrains;
59 not
container.value().constituentVolumes.empty()) {
62 if (cts.constituentBinning.empty()) {
65 throw std::runtime_error(errorMsg);
69 bool layersPresent =
false;
70 for (
const auto& cv : cts.constituentVolumes) {
71 if (cv.internal.has_value()) {
78 auto binValue = cts.constituentBinning[0].binvalue;
80 auto& fVolume = cts.constituentVolumes.front();
81 auto& lVolume = cts.constituentVolumes.back();
83 std::vector<float> borders = {};
87 if (obValue !=
binValue and extent.constrains(obValue)) {
88 otherConstrains.push_back(obValue);
93 if (not layersPresent) {
100 borders.push_back(static_cast<float>(fVolume.extent.min(
binValue)));
101 for (
unsigned int iv = 1; iv < cts.constituentVolumes.size(); ++iv) {
102 auto& lv = cts.constituentVolumes[iv - 1
u];
106 auto& hv = cts.constituentVolumes[iv];
112 borders.push_back(mid);
114 borders.push_back(cts.constituentVolumes.back().extent.max(
binValue));
116 }
else if (layersPresent and not legacy) {
118 std::size_t gaps = 0;
119 std::vector<float> boundaries = {};
121 std::vector<ProtoVolume> updatedConstituents;
123 if (fVolume.extent.min(
binValue) > containerMin) {
127 updatedConstituents.push_back(gap);
128 borders.push_back(static_cast<float>(containerMin));
131 for (
unsigned int iv = 1; iv < cts.constituentVolumes.size(); ++iv) {
132 auto& lv = cts.constituentVolumes[iv - 1
u];
134 updatedConstituents.push_back(lv);
135 borders.push_back(static_cast<float>(lv.extent.min(
binValue)));
138 auto& hv = cts.constituentVolumes[iv];
144 updatedConstituents.push_back(gap);
145 borders.push_back(static_cast<float>(low));
149 updatedConstituents.push_back(lVolume);
150 borders.push_back(static_cast<float>(constituentsMax));
153 if (constituentsMax < containerMax) {
157 updatedConstituents.push_back(gap);
158 borders.push_back(static_cast<float>(containerMax));
160 cts.constituentVolumes = updatedConstituents;
161 }
else if (legacy and layersPresent) {
164 cts.constituentBinning = {
168 for (
auto& cv : cts.constituentVolumes) {
169 cv.extent.extend(extent, otherConstrains);
170 cv.harmonize(legacy);
177 std::stringstream ss;
178 ss << indent <<
"> volume: " <<
name <<
'\n';
179 ss << indent <<
" extent: ";
180 ss << extent.toString(indent) <<
'\n';
183 if (not cts.constituentVolumes.empty()) {
184 ss << indent <<
" container of " << cts.constituentVolumes.size()
185 <<
" constituents. " <<
'\n';
186 ss << indent <<
" constituent binning:" <<
'\n';
187 for (
const auto&
cb : cts.constituentBinning) {
188 ss <<
cb.toString(indent) <<
'\n';
190 ss << indent <<
" constituents are:" <<
'\n';
191 for (
const auto& cv : cts.constituentVolumes) {
192 ss << cv.toString(indent + subIndent) <<
'\n';
201 std::stringstream ss;
202 ss << indent <<
"> detector: " <<
name <<
'\n';
203 ss << worldVolume.toString(indent + subIndent) <<
'\n';