10 #ifndef ICARUSALG_UTILITIES_CANVASUTILS_H
11 #define ICARUSALG_UTILITIES_CANVASUTILS_H
14 #include "canvas/Persistency/Common/Ptr.h"
15 #include "canvas/Persistency/Provenance/BranchDescription.h"
16 #include "canvas/Persistency/Provenance/ProductID.h"
17 #include "canvas/Utilities/Exception.h"
20 #include <type_traits>
52 template <
typename Event>
53 art::InputTag
inputTagOf(Event
const& event, art::ProductID
const& productID);
70 template <
typename Event,
typename Handle>
72 std::is_void_v<std::void_t<typename Handle::HandleTag>>,
92 template <
typename Event,
typename T>
93 art::InputTag
inputTagOf(Event
const& event, art::Ptr<T>
const& ptr)
106 template <
typename Event>
108 (Event
const& event, art::ProductID
const& productID)
111 cet::exempt_ptr<art::BranchDescription const> metaDescr
112 =
event.getProductDescription(productID);
113 if (metaDescr)
return metaDescr->inputTag();
115 throw art::Exception(art::errors::ProductNotFound)
116 <<
"Branch (and input tag) not found for product ID " << productID;
124 #endif // ICARUSALG_UTILITIES_CANVASUTILS_H
typename std::enable_if< B, T >::type enable_if_t
art::InputTag inputTagOf(Event const &event, art::ProductID const &productID)
Reads and returns the input tag of the producer of productID.