LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
Exceptions.h
Go to the documentation of this file.
1 
12 #ifndef LARCOREALG_GEOMETRY_EXCEPTIONS_H
13 #define LARCOREALG_GEOMETRY_EXCEPTIONS_H
14 
15 // LArSoft libraries
16 #include "larcoreobj/SimpleTypesAndConstants/geo_types.h" // geo::PlaneID, ...
17 
18 // Framework libraries
19 #include "cetlib_except/exception.h"
20 
21 // C/C++ standard library
22 #include <limits> // std::numeric_limits<>
23 
24 namespace geo {
25 
38  public:
40  static constexpr int InvalidWireNo = std::numeric_limits<int>::max();
41 
43  InvalidWireError(std::string cat, PlaneID const& planeID, int badWireNo, int betterWireNo)
44  : cet::exception(cat), fPlaneID(planeID), fWireNumber(badWireNo), fBetterWireNo(betterWireNo)
45  {}
46 
48  InvalidWireError(std::string cat, PlaneID const& planeID, int badWireNo)
49  : cet::exception(cat), fPlaneID(planeID), fWireNumber(badWireNo)
50  {}
51 
53  InvalidWireError(std::string cat, int badWireNo, int betterWireNo)
54  : cet::exception(cat), fWireNumber(badWireNo), fBetterWireNo(betterWireNo)
55  {}
56 
58  InvalidWireError(std::string cat, int badWireNo) : cet::exception(cat), fWireNumber(badWireNo)
59  {}
60 
63 
65  bool hasBadWire() const { return fWireNumber != InvalidWireNo; }
66 
68  int badWire() const { return fWireNumber; }
69 
71  WireID badWireID() const { return makeWireID(fWireNumber); }
72 
74 
77 
79  bool hasSuggestedWire() const { return fBetterWireNo != InvalidWireNo; }
80 
82  int suggestedWire() const { return fBetterWireNo; }
83 
86 
88 
91 
93  bool hasPlane() const { return fPlaneID.isValid; }
94 
96  PlaneID const& planeID() const { return fPlaneID; }
97 
99 
100  private:
102 
105 
108 
110  WireID makeWireID(int wireNo) const { return {fPlaneID, (WireID::WireID_t)wireNo}; }
111 
112  }; // class InvalidWireError
113 
114 } // namespace geo
115 
116 #endif // LARCOREALG_GEOMETRY_EXCEPTIONS_H
int suggestedWire() const
Returns a better wire number.
Definition: Exceptions.h:82
PlaneID fPlaneID
plane the wire belongs to
Definition: Exceptions.h:101
WireID suggestedWireID() const
Returns a better wire ID.
Definition: Exceptions.h:85
bool hasBadWire() const
Returns whether we known the bad wire number.
Definition: Exceptions.h:65
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:194
int badWire() const
Returns the bad wire number.
Definition: Exceptions.h:68
InvalidWireError(std::string cat, int badWireNo, int betterWireNo)
Constructor: no plane information.
Definition: Exceptions.h:53
WireID badWireID() const
Returns the bad wire ID.
Definition: Exceptions.h:71
int fBetterWireNo
a suggestion for a good wire number
Definition: Exceptions.h:107
PlaneID const & planeID() const
Return the plane ID recorded with the exception.
Definition: Exceptions.h:96
InvalidWireError(std::string cat, int badWireNo)
Constructor: no plane information and no suggestion.
Definition: Exceptions.h:58
Definition of data types for geometry description.
InvalidWireError(std::string cat, PlaneID const &planeID, int badWireNo, int betterWireNo)
Constructor with the complete information.
Definition: Exceptions.h:43
InvalidWireError(std::string cat, PlaneID const &planeID, int badWireNo)
Constructor: no wire suggestions.
Definition: Exceptions.h:48
static constexpr int InvalidWireNo
Value used to represent an invalid wire number.
Definition: Exceptions.h:40
bool hasPlane() const
Return whether a plane is recorded with the exception.
Definition: Exceptions.h:93
Exception thrown on invalid wire number.
Definition: Exceptions.h:37
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:422
WireID makeWireID(int wireNo) const
Transform a wire number into wire ID.
Definition: Exceptions.h:110
ROOT libraries.
bool hasSuggestedWire() const
Returns whether we known a better wire number.
Definition: Exceptions.h:79
int fWireNumber
the invalid wire number
Definition: Exceptions.h:104
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33