8 #ifndef UTIL_CHANGETRACKERS_H 9 #define UTIL_CHANGETRACKERS_H 22 #include <type_traits> 71 if (
same(trk))
return false;
78 operator std::string()
const 99 out << std::string(trk);
138 return sameEvent(as) && (inputLabel() == as.
inputLabel());
167 SetInputLabel(label);
173 if (
same(new_prod))
return false;
181 operator std::string()
const 183 return EventChangeTracker_t::operator std::string() +
" I{" + inputLabel().encode() +
"}";
199 out << std::string(trk);
246 return sameEvent(as) && (
static_cast<geo::TPCID const&
>(planeID()) == as.
planeID());
252 return sameEvent(as) && (planeID() == as.
planeID());
284 if (
same(new_prod))
return false;
292 operator std::string()
const 294 return DataProductChangeTracker_t::operator std::string() +
" " + std::string(planeID());
310 out << std::string(trk);
316 #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)
bool operator==(PlaneDataChangeTracker_t const &as) const
Returns whether data product and TPC plane are the same as in "as".
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".
bool operator!=(DataProductChangeTracker_t const &than) const
Returns whether the event or input label are different than in "than".
bool operator!=(PlaneDataChangeTracker_t const &than) const
Returns whether data product or TPC plane are different than in "than".
bool operator==(DataProductChangeTracker_t const &as) const
Returns whether the event and input label are the same as in "as".
Detects the presence of a new event.
void clear()
Set a new event and data product label as current.
std::ostream & operator<<(std::ostream &out, EventChangeTracker_t const &trk)
art::InputTag const & inputLabel() const
Returns whether we are in the same event (the rest could differ)
void clear()
Sets the current event ID.
bool update(EventChangeTracker_t const &trk)
Sets the current event, and returns true if it is changed.
void SetInputLabel(art::InputTag const &label)
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
void SetPlaneID(geo::PlaneID const &pid)
DataProductChangeTracker_t(art::Event const &evt, art::InputTag const &label)
Constructor: specifies current event and data product label.
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
Returns whether this tracker is in the same state as another.
void clear()
Set a new event and data product label as current.
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".
DataProductChangeTracker_t(art::EventID const &evt_id, art::InputTag const &label)
Constructor: specifies current event ID and data product label.
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.
geo::PlaneID const & planeID() const
Returns the current plane ID.
bool isValid() const
Returns whether there is a current event and data product.
Event finding and building.
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.