LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Exceptions.h
Go to the documentation of this file.
1 
14 #ifndef LARCOREALG_GEOMETRY_EXCEPTIONS_H
15 #define LARCOREALG_GEOMETRY_EXCEPTIONS_H
16 
17 // LArSoft libraries
18 #include "larcoreobj/SimpleTypesAndConstants/geo_types.h" // geo::PlaneID, ...
19 
20 // Framework libraries
21 #include "cetlib_except/exception.h"
22 
23 // C/C++ standard library
24 #include <limits> // std::numeric_limits<>
25 
26 namespace geo {
27 
40  public:
42  static constexpr int InvalidWireNo = std::numeric_limits<int>::max();
43 
45  InvalidWireError(std::string cat, geo::PlaneID const& planeID, int badWireNo, int betterWireNo)
46  : cet::exception(cat), fPlaneID(planeID), fWireNumber(badWireNo), fBetterWireNo(betterWireNo)
47  {}
48 
50  InvalidWireError(std::string cat, geo::PlaneID const& planeID, int badWireNo)
51  : cet::exception(cat), fPlaneID(planeID), fWireNumber(badWireNo)
52  {}
53 
55  InvalidWireError(std::string cat, int badWireNo, int betterWireNo)
56  : cet::exception(cat), fWireNumber(badWireNo), fBetterWireNo(betterWireNo)
57  {}
58 
60  InvalidWireError(std::string cat, int badWireNo) : cet::exception(cat), fWireNumber(badWireNo)
61  {}
62 
65 
67  bool hasBadWire() const { return fWireNumber != InvalidWireNo; }
68 
70  int badWire() const { return fWireNumber; }
71 
74 
76 
79 
81  bool hasSuggestedWire() const { return fBetterWireNo != InvalidWireNo; }
82 
84  int suggestedWire() const { return fBetterWireNo; }
85 
88 
90 
93 
95  bool hasPlane() const { return fPlaneID.isValid; }
96 
98  geo::PlaneID const& planeID() const { return fPlaneID; }
99 
101 
102  private:
104 
107 
110 
112  geo::WireID makeWireID(int wireNo) const { return {fPlaneID, (geo::WireID::WireID_t)wireNo}; }
113 
114  }; // class InvalidWireError
115 
116 } // namespace geo
117 
118 #endif // LARCOREALG_GEOMETRY_EXCEPTIONS_H
int suggestedWire() const
Returns a better wire number.
Definition: Exceptions.h:84
bool hasBadWire() const
Returns whether we known the bad wire number.
Definition: Exceptions.h:67
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:210
int badWire() const
Returns the bad wire number.
Definition: Exceptions.h:70
InvalidWireError(std::string cat, int badWireNo, int betterWireNo)
Constructor: no plane information.
Definition: Exceptions.h:55
int fBetterWireNo
a suggestion for a good wire number
Definition: Exceptions.h:109
InvalidWireError(std::string cat, int badWireNo)
Constructor: no plane information and no suggestion.
Definition: Exceptions.h:60
InvalidWireError(std::string cat, geo::PlaneID const &planeID, int badWireNo, int betterWireNo)
Constructor with the complete information.
Definition: Exceptions.h:45
geo::PlaneID fPlaneID
plane the wire belongs to
Definition: Exceptions.h:103
geo::PlaneID const & planeID() const
Return the plane ID recorded with the exception.
Definition: Exceptions.h:98
InvalidWireError(std::string cat, geo::PlaneID const &planeID, int badWireNo)
Constructor: no wire suggestions.
Definition: Exceptions.h:50
Definition of data types for geometry description.
geo::WireID badWireID() const
Returns the bad wire ID.
Definition: Exceptions.h:73
static constexpr int InvalidWireNo
Value used to represent an invalid wire number.
Definition: Exceptions.h:42
bool hasPlane() const
Return whether a plane is recorded with the exception.
Definition: Exceptions.h:95
geo::WireID makeWireID(int wireNo) const
Transform a wire number into wire ID.
Definition: Exceptions.h:112
Exception thrown on invalid wire number.
Definition: Exceptions.h:39
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:546
geo::WireID suggestedWireID() const
Returns a better wire ID.
Definition: Exceptions.h:87
Namespace collecting geometry-related classes utilities.
bool hasSuggestedWire() const
Returns whether we known a better wire number.
Definition: Exceptions.h:81
int fWireNumber
the invalid wire number
Definition: Exceptions.h:106
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33