8 #ifndef UTIL_CHANGETRACKERS_H
9 #define UTIL_CHANGETRACKERS_H
15 #include "canvas/Utilities/InputTag.h"
16 #include "canvas/Persistency/Provenance/EventID.h"
17 #include "art/Framework/Principal/Event.h"
22 #include <type_traits>
57 {
return !
same(than); }
74 if (
same(trk))
return false;
81 operator std::string()
const
104 inline std::ostream&
operator<<
106 { out << std::string(trk);
return out; }
124 (art::Event
const&
evt, art::InputTag
const& label):
130 (art::EventID
const& evt_id, art::InputTag
const& label):
161 {
return !
same(than); }
172 void set(art::Event
const& evt, art::InputTag
const& label)
178 if (
same(new_prod))
return false;
186 operator std::string()
const
188 return EventChangeTracker_t::operator std::string()
205 inline std::ostream&
operator<<
207 { out << std::string(trk);
return out; }
226 art::Event
const& evt, art::InputTag
const& label,
geo::PlaneID const& pid
233 art::EventID
const& evt_id, art::InputTag
const& label,
273 {
return !
same(than); }
285 art::Event
const& evt, art::InputTag
const& label,
geo::PlaneID const& pid
292 if (
same(new_prod))
return false;
300 operator std::string()
const
302 return DataProductChangeTracker_t::operator std::string()
303 +
" " + std::string(
planeID());
318 inline std::ostream&
operator<<
320 { out << std::string(trk);
return out; }
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.
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...)
void set(art::Event const &evt)
Sets the current event ID from the given event.
Detects the presence of a new event or data product.
The data type to uniquely identify a Plane.
bool isValid
Whether this ID points to a valid element.
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".
void set(art::Event const &evt, art::InputTag const &label, geo::PlaneID const &pid)
Set a new event and data product label as current.
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.
art::InputTag const & inputLabel() const
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)
DataProductChangeTracker_t()=default
Default constructor: no current data product.
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
std::string to_string(WindowPattern const &pattern)
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".
PlaneDataChangeTracker_t()=default
Default constructor: no current plane data.
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.
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.