LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
geo_types.cxx
Go to the documentation of this file.
1 
8 // header library
10 
11 // C++ standard libraries
12 #include <ostream>
13 #include <stdexcept> // std::logic_error
14 
15 namespace geo {
16 
17  std::ostream& operator<<(std::ostream& os, Coordinate const coordinate)
18  {
19  switch (coordinate) {
20  case Coordinate::X: os << 'X'; break;
21  case Coordinate::Y: os << 'Y'; break;
22  case Coordinate::Z: os << 'Z'; break;
23  }
24  return os;
25  }
26 
27  std::ostream& operator<<(std::ostream& os, DriftSign const sign)
28  {
29  switch (sign) {
30  case DriftSign::Positive: os << '+'; break;
31  case DriftSign::Negative: os << '-'; break;
32  case DriftSign::Unknown: os << '?'; break;
33  }
34  return os;
35  }
36 
37  bool operator==(DriftAxis const a, DriftAxis const b)
38  {
39  return a.coordinate == b.coordinate and a.sign == b.sign;
40  }
41 
42  bool operator!=(DriftAxis const a, DriftAxis const b)
43  {
44  return not(a == b);
45  }
46 
47  std::ostream& operator<<(std::ostream& os, DriftAxis const driftAxis)
48  {
49  return os << driftAxis.sign << driftAxis.coordinate;
50  }
51 
52  std::string SignalTypeName(SigType_t sigType)
53  {
54  switch (sigType) {
55  case kInduction: return "induction";
56  case kCollection: return "collection";
57  case kMysteryType: return "unknown";
58  } // switch
59  throw std::logic_error("geo::SignalTypeName(): unexpected signal type #" +
60  std::to_string(static_cast<int>(sigType)));
61  }
62 }
63 
64 // -----------------------------------------------------------------------------
DriftSign sign
Definition: geo_types.h:174
Coordinate
Enumerate the possible plane projections.
Definition: geo_types.h:122
Who knows?
Definition: geo_types.h:149
bool operator!=(DriftAxis const a, DriftAxis const b)
Enumerate the possible plane projections.
Definition: geo_types.cxx:42
bool operator==(DriftAxis const a, DriftAxis const b)
Enumerate the possible plane projections.
Definition: geo_types.cxx:37
Signal from induction planes.
Definition: geo_types.h:147
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
Drift towards negative values.
Definition of data types for geometry description.
int sign(double val)
Definition: UtilFunc.cxx:104
Drift towards positive values.
DriftSign
Drift sign: positive or negative.
Definition: geo_types.h:155
std::ostream & operator<<(std::ostream &out, WireReadoutDumper::StreamAdapter const &dumpAdapter)
Helper for geo::WireReadoutDumper::toStream().
ROOT libraries.
Coordinate coordinate
Definition: geo_types.h:173
Drift direction is unknown.
std::string SignalTypeName(SigType_t sigType)
Returns the name of the specified signal type.
Definition: geo_types.cxx:52
Signal from collection planes.
Definition: geo_types.h:148