26 const bool useActiveBoundingBox)
29 if (!listOfGaps.empty())
30 throw cet::exception(
"LArPandora")
31 <<
" LArPandoraGeometry::LoadDetectorGaps --- the list of gaps already exists ";
39 for (LArDriftVolumeList::const_iterator iter1 = driftVolumeList.begin(),
40 iterEnd1 = driftVolumeList.end();
45 for (LArDriftVolumeList::const_iterator iter2 = iter1, iterEnd2 = driftVolumeList.end();
62 const float gapX(deltaX - widthX);
63 const float gapY(deltaY - widthY);
64 const float gapZ(deltaZ - widthZ);
81 geo::Vector_t gaps(gapX, gapY, gapZ), deltas(deltaX, deltaY, deltaZ);
83 geo::Point_t point1(X1, Y1, Z1), point2(X2, Y2, Z2);
84 geo::Vector_t widths(widthX, widthY, widthZ);
225 const bool useActiveBoundingBox)
229 if (!driftVolumeList.empty())
230 throw cet::exception(
"LArPandora")
231 <<
" LArPandoraGeometry::LoadGeometry --- detector geometry has already been loaded ";
233 typedef std::set<unsigned int> UIntSet;
236 art::ServiceHandle<geo::Geometry const> theGeometry;
238 const float wirePitchU(detType->
WirePitchU());
239 const float wirePitchV(detType->
WirePitchV());
240 const float wirePitchW(detType->
WirePitchW());
241 const float maxDeltaTheta(0.01f);
244 for (
auto const& cryostat : theGeometry->Iterate<geo::CryostatGeo>()) {
245 auto const icstat = cryostat.ID().Cryostat;
249 for (
auto const& theTpc1 : theGeometry->Iterate<geo::TPCGeo>(cryostat.ID())) {
250 auto const itpc1 = theTpc1.ID().TPC;
251 if (cstatList.end() != cstatList.find(itpc1))
continue;
254 cstatList.insert(itpc1);
256 const float wireAngleU(detType->
WireAngleU(itpc1, icstat));
257 const float wireAngleV(detType->
WireAngleV(itpc1, icstat));
258 const float wireAngleW(detType->
WireAngleW(itpc1, icstat));
260 auto const worldCoord1 = theTpc1.GetCenter();
262 float driftMinX(useActiveBoundingBox ? theTpc1.ActiveBoundingBox().MinX() :
263 (worldCoord1.X() - theTpc1.ActiveHalfWidth()));
264 float driftMaxX(useActiveBoundingBox ? theTpc1.ActiveBoundingBox().MaxX() :
265 (worldCoord1.X() + theTpc1.ActiveHalfWidth()));
266 float driftMinY(useActiveBoundingBox ? theTpc1.ActiveBoundingBox().MinY() :
267 (worldCoord1.Y() - theTpc1.ActiveHalfHeight()));
268 float driftMaxY(useActiveBoundingBox ? theTpc1.ActiveBoundingBox().MaxY() :
269 (worldCoord1.Y() + theTpc1.ActiveHalfHeight()));
270 float driftMinZ(useActiveBoundingBox ? theTpc1.ActiveBoundingBox().MinZ() :
271 (worldCoord1.Z() - 0.5f * theTpc1.ActiveLength()));
272 float driftMaxZ(useActiveBoundingBox ? theTpc1.ActiveBoundingBox().MaxZ() :
273 (worldCoord1.Z() + 0.5f * theTpc1.ActiveLength()));
276 useActiveBoundingBox ?
277 (0.5 * (driftMinX + driftMaxX) - 0.25 * std::fabs(driftMaxX - driftMinX)) :
278 (worldCoord1.X() - 0.5 * theTpc1.ActiveHalfWidth()));
280 useActiveBoundingBox ?
281 (0.5 * (driftMinX + driftMaxX) + 0.25 * std::fabs(driftMaxX - driftMinX)) :
282 (worldCoord1.X() + 0.5 * theTpc1.ActiveHalfWidth()));
284 const bool isPositiveDrift(theTpc1.DriftDirection() == geo::kPosX);
287 tpcList.insert(itpc1);
292 0.5f * (driftMaxX + driftMinX),
293 0.5f * (driftMaxY + driftMinY),
294 0.5f * (driftMaxZ + driftMinZ),
295 (driftMaxX - driftMinX),
296 (driftMaxY - driftMinY),
297 (driftMaxZ - driftMinZ)));
300 for (
auto const& theTpc2 : theGeometry->Iterate<geo::TPCGeo>(cryostat.ID())) {
301 auto const itpc2 = theTpc2.ID().TPC;
302 if (cstatList.end() != cstatList.find(itpc2))
continue;
304 if (theTpc1.DriftDirection() != theTpc2.DriftDirection())
continue;
306 const float dThetaU(detType->
WireAngleU(itpc1, icstat) -
308 const float dThetaV(detType->
WireAngleV(itpc1, icstat) -
310 const float dThetaW(detType->
WireAngleW(itpc1, icstat) -
312 if (dThetaU > maxDeltaTheta || dThetaV > maxDeltaTheta || dThetaW > maxDeltaTheta)
315 auto const worldCoord2 = theTpc2.GetCenter();
317 const float driftMinX2(useActiveBoundingBox ?
318 theTpc2.ActiveBoundingBox().MinX() :
319 (worldCoord2.X() - theTpc2.ActiveHalfWidth()));
320 const float driftMaxX2(useActiveBoundingBox ?
321 theTpc2.ActiveBoundingBox().MaxX() :
322 (worldCoord2.X() + theTpc2.ActiveHalfWidth()));
325 useActiveBoundingBox ?
326 (0.5 * (driftMinX2 + driftMaxX2) - 0.25 * std::fabs(driftMaxX2 - driftMinX2)) :
327 (worldCoord2.X() - 0.5 * theTpc2.ActiveHalfWidth()));
329 useActiveBoundingBox ?
330 (0.5 * (driftMinX2 + driftMaxX2) + 0.25 * std::fabs(driftMaxX2 - driftMinX2)) :
331 (worldCoord2.X() + 0.5 * theTpc2.ActiveHalfWidth()));
333 if ((min2 > max1) || (min1 > max2))
continue;
335 cstatList.insert(itpc2);
336 tpcList.insert(itpc2);
338 const float driftMinY2(useActiveBoundingBox ?
339 theTpc2.ActiveBoundingBox().MinY() :
340 (worldCoord2.Y() - theTpc2.ActiveHalfHeight()));
341 const float driftMaxY2(useActiveBoundingBox ?
342 theTpc2.ActiveBoundingBox().MaxY() :
343 (worldCoord2.Y() + theTpc2.ActiveHalfHeight()));
344 const float driftMinZ2(useActiveBoundingBox ?
345 theTpc2.ActiveBoundingBox().MinZ() :
346 (worldCoord2.Z() - 0.5f * theTpc2.ActiveLength()));
347 const float driftMaxZ2(useActiveBoundingBox ?
348 theTpc2.ActiveBoundingBox().MaxZ() :
349 (worldCoord2.Z() + 0.5f * theTpc2.ActiveLength()));
351 driftMinX = std::min(driftMinX, driftMinX2);
352 driftMaxX = std::max(driftMaxX, driftMaxX2);
353 driftMinY = std::min(driftMinY, driftMinY2);
354 driftMaxY = std::max(driftMaxY, driftMaxY2);
355 driftMinZ = std::min(driftMinZ, driftMinZ2);
356 driftMaxZ = std::max(driftMaxZ, driftMaxZ2);
360 0.5f * (driftMaxX2 + driftMinX2),
361 0.5f * (driftMaxY2 + driftMinY2),
362 0.5f * (driftMaxZ2 + driftMinZ2),
363 (driftMaxX2 - driftMinX2),
364 (driftMaxY2 - driftMinY2),
365 (driftMaxZ2 - driftMinZ2)));
369 driftVolumeList.emplace_back(driftVolumeList.size(),
377 0.5f * (driftMaxX + driftMinX),
378 0.5f * (driftMaxY + driftMinY),
379 0.5f * (driftMaxZ + driftMinZ),
380 (driftMaxX - driftMinX),
381 (driftMaxY - driftMinY),
382 (driftMaxZ - driftMinZ),
383 (wirePitchU + wirePitchV + wirePitchW + 0.1f),
388 if (driftVolumeList.empty())
389 throw cet::exception(
"LArPandora") <<
" LArPandoraGeometry::LoadGeometry --- failed to find "
390 "any drift volumes in this detector geometry ";
403 if (!daughterVolumeList.empty())
404 throw cet::exception(
"LArPandora") <<
" LArPandoraGeometry::LoadGlobalDaughterGeometry --- "
405 "daughter geometry has already been loaded ";
407 if (driftVolumeList.empty())
408 throw cet::exception(
"LArPandora") <<
" LArPandoraGeometry::LoadGlobalDaughterGeometry --- "
409 "detector geometry has not yet been loaded ";
411 std::cout <<
"The size of the drif list is: " << driftVolumeList.size() << std::endl;
415 std::cout <<
"Looking at dau vol: " << count++ << std::endl;
418 const float daughterWirePitchU(switchViews ? driftVolume.GetWirePitchV() :
419 driftVolume.GetWirePitchU());
420 const float daughterWirePitchV(switchViews ? driftVolume.GetWirePitchU() :
421 driftVolume.GetWirePitchV());
422 const float daughterWirePitchW(driftVolume.GetWirePitchW());
423 const float daughterWireAngleU(switchViews ? driftVolume.GetWireAngleV() :
424 driftVolume.GetWireAngleU());
425 const float daughterWireAngleV(switchViews ? driftVolume.GetWireAngleU() :
426 driftVolume.GetWireAngleV());
427 const float daughterWireAngleW(driftVolume.GetWireAngleW());
429 daughterVolumeList.push_back(
LArDriftVolume(driftVolume.GetVolumeID(),
430 driftVolume.IsPositiveDrift(),
437 driftVolume.GetCenterX(),
438 driftVolume.GetCenterY(),
439 driftVolume.GetCenterZ(),
440 driftVolume.GetWidthX(),
441 driftVolume.GetWidthY(),
442 driftVolume.GetWidthZ(),
443 driftVolume.GetSigmaUVZ(),
444 driftVolume.GetTpcVolumeList()));
447 if (daughterVolumeList.empty())
448 throw cet::exception(
"LArPandora") <<
" LArPandoraGeometry::LoadGlobalDaughterGeometry --- "
449 "failed to create daughter geometry list ";
LArDriftVolume(const unsigned int volumeID, const bool isPositiveDrift, const float wirePitchU, const float wirePitchV, const float wirePitchW, const float wireAngleU, const float wireAngleV, const float wireAngleW, const float centerX, const float centerY, const float centerZ, const float widthX, const float widthY, const float widthZ, const float sigmaUVZ, const LArDaughterDriftVolumeList &tpcVolumeList)
Constructor.