8 #ifndef UTIL_CHANGETRACKERS_H 9 #define UTIL_CHANGETRACKERS_H 22 #include <type_traits> 32 class EventChangeTracker_t {
47 {
return as.eventID() ==
eventID(); }
57 {
return !
same(than); }
74 if (
same(trk))
return false;
104 inline std::ostream&
operator<<
146 {
return sameEvent(as) && (inputLabel() == as.
inputLabel()); }
161 {
return !
same(than); }
178 if (
same(new_prod))
return false;
188 return EventChangeTracker_t::operator
std::string()
189 +
" I{" + inputLabel().encode() +
"}";
205 inline std::ostream&
operator<<
261 {
return sameEvent(as) && (planeID() == as.
planeID()); }
273 {
return !
same(than); }
292 if (
same(new_prod))
return false;
302 return DataProductChangeTracker_t::operator
std::string()
318 inline std::ostream&
operator<<
325 #endif // UTIL_CHANGETRACKERS_H EventChangeTracker_t(art::Event const &evt)
Constructor: current event as specified.
void set(art::EventID const &evt_id)
Sets the current event ID.
art::EventID event_id
ID of the current event.
bool isValid() const
Returns whether there is a current event.
Namespace for general, non-LArSoft-specific utilities.
bool sameProduct(PlaneDataChangeTracker_t const &as) const
Returns whether we are in the same event (the rest could differ)
PlaneDataChangeTracker_t(art::EventID const &evt_id, art::InputTag const &label, geo::PlaneID const &pid)
Constructor: specifies current data product and TPC plane.
art::EventID const & eventID() const
Returns the current event ID (it might be made public...)
Detects the presence of a new event or data product.
The data type to uniquely identify a Plane.
bool sameTPC(PlaneDataChangeTracker_t const &as) const
Returns whether we have the same data product and TPC as "as".
Detects the presence of a new event.
art::InputTag const & inputLabel() const
static constexpr double as
bool update(EventChangeTracker_t const &trk)
Sets the current event, and returns true if it is changed.
void SetInputLabel(art::InputTag const &label)
void SetPlaneID(geo::PlaneID const &pid)
bool operator!=(EventChangeTracker_t const &than) const
Returns whether this tracker is in a different state than another.
EventChangeTracker_t()=default
Default constructor: no current event, next event is a new one.
bool isValid() const
Returns whether there is a data product and plane.
art::InputTag input_label
The data type to uniquely identify a TPC.
Definition of data types for geometry description.
LocalState_t state
local state of the tracker (may inherit some more)
Detects the presence of a new event, data product or wire plane.
EventChangeTracker_t(art::EventID const &evt_id)
Constructor: current event as specified by the event ID.
bool update(PlaneDataChangeTracker_t const &new_prod)
Update to a new data product, return true if it has changed.
bool same(EventChangeTracker_t const &as) const
void set(art::Event const &evt, art::InputTag const &label)
Set a new event and data product label as current.
bool same(PlaneDataChangeTracker_t const &as) const
Returns whether we have the same plane data as "as".
bool same(DataProductChangeTracker_t const &as) const
Returns whether we have same data product as in "as".
bool update(DataProductChangeTracker_t const &new_prod)
Update to a new data product, return true if it has changed.
std::string to_string(ModuleType const mt)
geo::PlaneID const & planeID() const
Returns the current plane ID.
bool isValid() const
Returns whether there is a current event and data product.
PlaneDataChangeTracker_t(art::Event const &evt, art::InputTag const &label, geo::PlaneID const &pid)
Constructor: specifies current data product and TPC plane.
bool sameEvent(DataProductChangeTracker_t const &as) const
Returns whether we are in the same event (the rest could differ)
bool operator==(EventChangeTracker_t const &as) const
Returns whether this tracker is in the same state as another.