ProtoDUNEDualPhase.cxx
Go to the documentation of this file.
1 /**
2  * @file larpandora/LArPandoraInterface/Detectors/ProtoDUNEDualPhase.cxx
3  *
4  * @brief Implementation of the ProtoDUNE dual phase interface
5  *
6  * $Log: $
7  */
8 
10 
11 namespace lar_pandora {
12 
13  void
15  const float maxDisplacement,
16  LArDetectorGapList& listOfGaps) const
17  {
19  iterDghtr1 = driftVolume.GetTpcVolumeList().begin(),
20  iterDghtrEnd1 = driftVolume.GetTpcVolumeList().end();
21  iterDghtr1 != iterDghtrEnd1;
22  ++iterDghtr1) {
23  const LArDaughterDriftVolume& tpcVolume1(*iterDghtr1);
24 
26  iterDghtr2 = iterDghtr1,
27  iterDghtrEnd2 = driftVolume.GetTpcVolumeList().end();
28  iterDghtr2 != iterDghtrEnd2;
29  ++iterDghtr2) {
30  const LArDaughterDriftVolume& tpcVolume2(*iterDghtr2);
31 
32  if (tpcVolume1.GetTpc() == tpcVolume2.GetTpc()) continue;
33 
34  const float deltaX(std::fabs(tpcVolume1.GetCenterX() - tpcVolume2.GetCenterX()));
35  const float deltaY(std::fabs(tpcVolume1.GetCenterY() - tpcVolume2.GetCenterY()));
36  const float deltaZ(std::fabs(tpcVolume1.GetCenterZ() - tpcVolume2.GetCenterZ()));
37 
38  const float widthX(0.5f * (tpcVolume1.GetWidthX() + tpcVolume2.GetWidthX()));
39  const float widthY(0.5f * (tpcVolume1.GetWidthY() + tpcVolume2.GetWidthY()));
40  const float widthZ(0.5f * (tpcVolume1.GetWidthZ() + tpcVolume2.GetWidthZ()));
41 
42  const float gapX(deltaX - widthX);
43  const float gapY(deltaY - widthY);
44  const float gapZ(deltaZ - widthZ);
45 
46  const float X1((tpcVolume1.GetCenterX() < tpcVolume2.GetCenterX()) ?
47  (tpcVolume1.GetCenterX() + 0.5f * tpcVolume1.GetWidthX()) :
48  (tpcVolume2.GetCenterX() + 0.5f * tpcVolume2.GetWidthX()));
49  const float X2((tpcVolume1.GetCenterX() > tpcVolume2.GetCenterX()) ?
50  (tpcVolume1.GetCenterX() - 0.5f * tpcVolume1.GetWidthX()) :
51  (tpcVolume2.GetCenterX() - 0.5f * tpcVolume2.GetWidthX()));
52  const float Y1(std::min((tpcVolume1.GetCenterY() - 0.5f * tpcVolume1.GetWidthY()),
53  (tpcVolume2.GetCenterY() - 0.5f * tpcVolume2.GetWidthY())));
54  const float Y2(std::max((tpcVolume1.GetCenterY() + 0.5f * tpcVolume1.GetWidthY()),
55  (tpcVolume2.GetCenterY() + 0.5f * tpcVolume2.GetWidthY())));
56  const float Z1(std::min((tpcVolume1.GetCenterZ() - 0.5f * tpcVolume1.GetWidthZ()),
57  (tpcVolume2.GetCenterZ() - 0.5f * tpcVolume2.GetWidthZ())));
58  const float Z2(std::max((tpcVolume1.GetCenterZ() + 0.5f * tpcVolume1.GetWidthZ()),
59  (tpcVolume2.GetCenterZ() + 0.5f * tpcVolume2.GetWidthZ())));
60 
61  geo::Vector_t gaps(gapX, gapY, gapZ), deltas(deltaX, deltaY, deltaZ);
62  if (this->CheckDetectorGapSize(gaps, deltas, maxDisplacement)) {
63  geo::Point_t point1(X1, Y1, Z1), point2(X2, Y2, Z2);
64  geo::Vector_t widths(widthX, widthY, widthZ);
65  listOfGaps.emplace_back(this->CreateDetectorGap(point1, point2, widths));
66  }
67  }
68  }
69 
70  return;
71  }
72 
73 } // namespace lar_pandora
float GetCenterZ() const
Return Z position at centre of tpc volume.
float GetWidthY() const
Return Y span of tpc volume.
bool CheckDetectorGapSize(const geo::Vector_t &gaps, const geo::Vector_t &deltas, const float maxDisplacement) const override
Check whether a gap size is small enough to be registered as a detector gap.
daughter drift volume class to hold properties of daughter drift volumes
float GetWidthZ() const
Return Z span of tpc volume.
float GetWidthX() const
Return X span of tpc volume.
Detector interface for ProtoDUNE dual phase.
void LoadDaughterDetectorGaps(const LArDriftVolume &driftVolume, const float maxDisplacement, LArDetectorGapList &listOfGaps) const override
Create detector gaps for all daughter volumes in a logical TPC volume.
intermediate_table::const_iterator const_iterator
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
const LArDaughterDriftVolumeList & GetTpcVolumeList() const
Return list of daughter drift volumes associated with this drift volume.
float GetCenterX() const
Return X position at centre of tpc volume.
static int max(int a, int b)
float GetCenterY() const
Return Y position at centre of tpc volume.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
std::vector< LArDetectorGap > LArDetectorGapList
drift volume class to hold properties of drift volume
LArDetectorGap CreateDetectorGap(const geo::Point_t &point1, const geo::Point_t &point2, const geo::Vector_t &widths) const override
Create a detector gap.
unsigned int GetTpc() const
Return tpc ID.