27 #include "GaudiKernel/MsgStream.h"
37 std::unique_ptr<Volume> vol1,
38 std::unique_ptr<Volume> vol2,
41 , m_first(std::move(vol1))
42 , m_second(std::move(vol2))
45 , m_boundsOrientation()
51 , m_first{bobo.
m_first->clone()}
52 , m_second{bobo.m_second->clone()}
53 , m_intersection(bobo.m_intersection)
54 , m_objectAccessor(bobo.m_objectAccessor)
55 , m_boundsOrientation(bobo.m_boundsOrientation)
64 m_first.reset(bobo.
m_first->clone());
65 m_second.reset(bobo.
m_second->clone());
73 std::vector<std::unique_ptr<Trk::Surface>>
76 auto retsf = std::vector<std::unique_ptr<Trk::Surface>>();
84 std::vector<std::unique_ptr<Trk::Surface>> firstSurfaces =
87 std::vector<std::unique_ptr<Trk::Surface>> secondSurfaces =
88 m_second->volumeBounds().decomposeToSurfaces(transf * m_second->transform());
89 unsigned int nSurf = firstSurfaces.size() + secondSurfaces.size();
90 m_boundsOrientation.resize(nSurf);
92 std::vector<unsigned int> subtrSecond;
96 for (
unsigned int out = 0;
out < firstSurfaces.size();
out++) {
112 else if (cylVol && clo &&
out == 3){
113 m_boundsOrientation[
out] =
false;
115 else if (spbVol &&
out == 0){
116 m_boundsOrientation[
out] =
false;
119 m_boundsOrientation[
out] =
true;
122 std::unique_ptr<Trk::Volume> secondSub(createSubtractedVolume(
138 throw std::logic_error(
"Not a VolumeExcluder");
141 auto firstSub = std::make_unique<Trk::Volume>(*volExcl->
volume());
143 std::unique_ptr<Trk::Volume> comb_sub{};
144 if (!shared && !m_intersection){
145 comb_sub = std::make_unique<Trk::Volume>(
147 std::make_shared<Trk::CombinedVolumeBounds>(std::move(secondSub), std::move(firstSub), m_intersection));
149 if (!shared && m_intersection){
150 comb_sub = std::make_unique<Trk::Volume>(
152 std::make_shared<Trk::SubtractedVolumeBounds>(std::move(secondSub), std::move(firstSub)));
154 if (shared && m_intersection){
155 comb_sub = std::make_unique<Trk::Volume>(
157 std::make_shared<Trk::CombinedVolumeBounds>(std::move(secondSub), std::move(firstSub), m_intersection));
159 if (shared && !m_intersection){
160 comb_sub = std::make_unique<Trk::Volume>(
162 std::make_shared<Trk::SubtractedVolumeBounds>(std::move(firstSub), std::move(secondSub)));
164 auto volEx = std::make_shared<const Trk::VolumeExcluder>(std::move(comb_sub));
165 bool new_shared = shared;
170 retsf.push_back(std::make_unique<Trk::SubtractedPlaneSurface>(*splo, std::move(volEx), new_shared));
173 retsf.push_back(std::make_unique<Trk::SubtractedCylinderSurface>(*sclo, std::move(volEx), new_shared));
175 }
else if (plo || clo || dlo) {
176 auto volEx = std::make_shared<const Trk::VolumeExcluder>(std::move(secondSub));
178 retsf.push_back(std::make_unique<Trk::SubtractedPlaneSurface>(*plo, std::move(volEx), m_intersection));
181 retsf.push_back(std::make_unique<Trk::SubtractedCylinderSurface>(*clo, std::move(volEx), m_intersection));
186 throw std::logic_error(
"Not DiscBounds");
188 auto eb = std::make_shared<EllipseBounds>(
db->rMin(),
db->rMin(),
db->rMax(),
db->rMax(),
db->halfPhiSector());
189 retsf.push_back( std::make_unique<Trk::SubtractedPlaneSurface>(
195 throw std::runtime_error(
196 "Unhandled surface in CombinedVolumeBounds::decomposeToSurfaces.");
203 &(m_second->volumeBounds()));
207 &(m_second->volumeBounds()));
208 unsigned int nOut = firstSurfaces.size();
210 for (
unsigned int in = 0; in < secondSurfaces.size(); in++) {
226 else if (cylVol && cli && in == 3){
227 m_boundsOrientation[nOut + in] =
false;
229 else if (spbVol && in == 0){
230 m_boundsOrientation[nOut + in] =
false;
233 m_boundsOrientation[nOut + in] =
true;
236 std::unique_ptr<Trk::Volume> firstSub(createSubtractedVolume(
251 throw std::logic_error(
"Not a VolumeExcluder");
253 auto secondSub = std::make_unique<Trk::Volume>(*volExcl->
volume());
255 std::unique_ptr<Trk::Volume> comb_sub{};
256 if (!shared && !m_intersection){
257 comb_sub = std::make_unique<Trk::Volume>(
259 std::make_shared<Trk::CombinedVolumeBounds>(std::move(firstSub), std::move(secondSub), m_intersection));
261 if (!shared && m_intersection){
262 comb_sub = std::make_unique<Trk::Volume>(
264 std::make_shared<Trk::SubtractedVolumeBounds>(std::move(firstSub), std::move(secondSub)));
266 if (shared && m_intersection){
267 comb_sub = std::make_unique<Trk::Volume>(
269 std::make_shared<Trk::CombinedVolumeBounds>(std::move(firstSub), std::move(secondSub), m_intersection));
271 if (shared && !m_intersection){
272 comb_sub = std::make_unique<Trk::Volume>(
274 std::make_shared<Trk::SubtractedVolumeBounds>(std::move(secondSub), std::move(firstSub)));
276 auto volEx = std::make_shared<const Trk::VolumeExcluder>(std::move(comb_sub));
277 bool new_shared = shared;
282 retsf.push_back(std::make_unique<Trk::SubtractedPlaneSurface>(*spli, std::move(volEx), new_shared));
285 retsf.push_back( std::make_unique<Trk::SubtractedCylinderSurface>(*scli, std::move(volEx), new_shared));
287 }
else if (pli || cli || dli) {
288 auto volEx = std::make_shared<const Trk::VolumeExcluder>(std::move(firstSub));
290 retsf.push_back(std::make_unique<Trk::SubtractedPlaneSurface>(*pli, std::move(volEx), m_intersection));
293 retsf.push_back(std::make_unique<Trk::SubtractedCylinderSurface>(*cli, std::move(volEx), m_intersection));
298 throw std::logic_error(
"Not DiscBounds");
300 auto eb = std::make_shared<EllipseBounds>(
db->rMin(),
db->rMin(),
db->rMax(),
db->rMax(),
db->halfPhiSector());
302 retsf.push_back(std::make_unique<Trk::SubtractedPlaneSurface>(pliN, std::move(volEx), m_intersection));
305 throw std::runtime_error(
306 "Unhandled surface in CombinedVolumeBounds::decomposeToSurfaces.");
317 std::stringstream temp_sl;
318 temp_sl << std::setiosflags(std::ios::fixed);
319 temp_sl << std::setprecision(7);
320 temp_sl <<
"Trk::CombinedVolumeBounds: first,second ";
322 std::as_const(*m_first).volumeBounds().dump(sl);
323 std::as_const(*m_second).volumeBounds().dump(sl);
330 std::stringstream temp_sl;
331 temp_sl << std::setiosflags(std::ios::fixed);
332 temp_sl << std::setprecision(7);
333 temp_sl <<
"Trk::CombinedVolumeBounds: first,second ";
335 std::as_const(*m_first).volumeBounds().dump(sl);
336 std::as_const(*m_second).volumeBounds().dump(sl);