LArPandoraDetectorType.cxx
Go to the documentation of this file.
1 /**
2  * @file larpandora/LArPandoraInterface/Detectors/LArPandoraDetectorType.cxx
3  *
4  * @brief Implementation of the interface for handling detector-specific details, as well as some helper functions
5  *
6  * $Log: $
7  */
8 
11 
16 
17 #include <limits>
18 
19 namespace lar_pandora {
20 
21  LArPandoraDetectorType*
23  {
25 
26  const unsigned int nPlanes(geo->MaxPlanes());
27  std::set<geo::_plane_proj> planeSet;
28  for (unsigned int iPlane = 0; iPlane < nPlanes; ++iPlane)
29  (void)planeSet.insert(geo->TPC(0, 0).Plane(iPlane).View());
30 
31  if (nPlanes == 3 && planeSet.count(geo::kU) && planeSet.count(geo::kY) &&
32  planeSet.count(geo::kZ)) {
33  return new DUNEFarDetVDThreeView; //TODO Address bare pointer
34  }
35  else if (nPlanes == 3 && planeSet.count(geo::kU) && planeSet.count(geo::kV) &&
36  planeSet.count(geo::kW)) {
37  return new VintageLArTPCThreeView;
38  }
39  else if (nPlanes == 3 && planeSet.count(geo::kU) && planeSet.count(geo::kV) &&
40  planeSet.count(geo::kY)) {
41  return new ICARUS;
42  }
43  else if (nPlanes == 2 && planeSet.count(geo::kW) && planeSet.count(geo::kY)) {
44  return new ProtoDUNEDualPhase;
45  }
46 
47  throw cet::exception("LArPandora") << "LArPandoraDetectorType::GetDetectorType --- unable to "
48  "determine the detector type from the geometry GDML";
49  }
50 
51  //------------------------------------------------------------------------------------------------------------------------------------------
52 
53  float
55  const geo::TPCID::TPCID_t tpc,
57  const art::ServiceHandle<geo::Geometry>& larsoftGeometry)
58  {
59  return (0.5f * M_PI - larsoftGeometry->WireAngleToVertical(view, tpc, cstat));
60  }
61 
62  //------------------------------------------------------------------------------------------------------------------------------------------
63 
64  PandoraApi::Geometry::LineGap::Parameters
66  {
67  PandoraApi::Geometry::LineGap::Parameters parameters;
68  parameters.m_lineGapType = pandora::TPC_DRIFT_GAP;
69  parameters.m_lineStartX = gap.GetX1();
70  parameters.m_lineEndX = gap.GetX2();
71  parameters.m_lineStartZ = -std::numeric_limits<float>::max();
72  parameters.m_lineEndZ = std::numeric_limits<float>::max();
73 
74  return parameters;
75  }
76 
77  //------------------------------------------------------------------------------------------------------------------------------------------
78 
79  PandoraApi::Geometry::LineGap::Parameters
81  const float lastPoint,
82  const float xFirst,
83  const float xLast,
84  const float halfWirePitch,
85  const pandora::LineGapType gapType)
86  {
87  PandoraApi::Geometry::LineGap::Parameters parameters;
88  parameters.m_lineGapType = gapType;
89  parameters.m_lineStartX = xFirst;
90  parameters.m_lineEndX = xLast;
91  parameters.m_lineStartZ = std::min(firstPoint, lastPoint) - halfWirePitch;
92  parameters.m_lineEndZ = std::max(firstPoint, lastPoint) + halfWirePitch;
93 
94  return parameters;
95  }
96 
97 } // namespace lar_pandora
Detector interface for an older-style 3view, horizontal drift, single-phase LArTPC (e...
Detector interface for ProtoDUNE dual phase.
Detector interface DUNE&#39;s vertical drift far detector.
Helper functions for extracting detector geometry for use in reconsruction.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:130
Detector interface for ProtoDUNE dual phase.
Detector interface for DUNE&#39;s vertical drift, 3 view far detector.
Planes which measure Z direction.
Definition: geo_types.h:132
Planes which measure Y direction.
Definition: geo_types.h:133
Detector interface for ICARUS.
Definition: ICARUS.h:19
Planes which measure U.
Definition: geo_types.h:129
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:184
Detector interface for a 3view, horizontal drift, single-phase LArTPC.
unsigned int MaxPlanes() const
Returns the largest number of planes among all TPCs in this detector.
static int max(int a, int b)
float GetX1() const
Get lower X coordinate.
#define M_PI
Definition: includeROOT.h:54
PandoraApi::Geometry::LineGap::Parameters CreateDriftGapParameters(const LArDetectorGap &gap)
Make the drift gap parameters for the Pandora API.
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
float WireAngle(const geo::View_t view, const geo::TPCID::TPCID_t tpc, const geo::CryostatID::CryostatID_t cstat, const art::ServiceHandle< geo::Geometry > &larsoftGeometry)
Calculate the wire angle of a LArTPC view in a given TPC/cryostat.
PandoraApi::Geometry::LineGap::Parameters CreateReadoutGapParameters(const float firstPoint, const float lastPoint, const float xFirst, const float xLast, const float halfWirePitch, const pandora::LineGapType gapType)
Make the readout gap parameters for the Pandora API.
Detector interface for ICARUS.
LArPandoraDetectorType * GetDetectorType()
Factory class that returns the correct detector type interface.
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:387
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
Planes which measure W (third view for Bo, MicroBooNE, etc).
Definition: geo_types.h:131
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:263
LArSoft geometry interface.
Definition: ChannelGeo.h:16
Helper functions for extracting detector geometry for use in reconsruction.
double WireAngleToVertical(geo::View_t view, geo::TPCID const &tpcid) const
Returns the angle of the wires in the specified view from vertical.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
drift volume class to hold properties of drift volume
float GetX2() const
Get upper X coordinate.