14 #include "cetlib_except/exception.h" 32 class EDProductGetter;
34 DataViewImpl::~DataViewImpl() =
default;
39 bool const recordParents,
44 ,
md_{mc.moduleDescription()}
52 std::lock_guard lock{
mutex_};
59 std::lock_guard lock{
mutex_};
66 std::lock_guard lock{
mutex_};
73 std::lock_guard lock{
mutex_};
80 std::lock_guard lock{
mutex_};
87 std::lock_guard lock{
mutex_};
94 std::lock_guard lock{
mutex_};
101 std::lock_guard lock{
mutex_};
108 std::lock_guard lock{
mutex_};
115 std::lock_guard lock{
mutex_};
122 std::lock_guard lock{
mutex_};
129 std::lock_guard lock{
mutex_};
136 std::lock_guard lock{
mutex_};
143 std::lock_guard lock{
mutex_};
150 std::lock_guard lock{
mutex_};
158 std::lock_guard lock{
mutex_};
167 <<
" is not found in the ProcessHistoryRegistry.\n" 168 <<
"This file is malformed.\n";
174 return config.has_value();
186 bool const checkProducts,
187 map<TypeLabel, BranchDescription>
const* expectedProducts)
189 std::lock_guard lock{
mutex_};
191 vector<string> missing;
192 for (
auto const& typeLabel_and_bd : *expectedProducts) {
197 desc << typeLabel_and_bd.second;
198 missing.emplace_back(desc.str());
200 if (!missing.empty()) {
201 ostringstream errmsg;
203 errmsg <<
"The following products have been declared with 'produces',\n" 204 <<
"but they have not been placed onto the event:\n" 205 << rule(
'=') <<
'\n';
206 for (
auto const&
desc : missing) {
207 errmsg <<
desc << rule(
'=') <<
'\n';
214 auto& pmvalue = type_label_and_pmvalue.second;
215 unique_ptr<ProductProvenance const> pp;
217 vector<ProductID> gotPIDs;
222 pp = make_unique<ProductProvenance const>(
225 pp = make_unique<ProductProvenance const>(pmvalue.bd_.productID(),
229 make_unique<RangeSet>(pmvalue.rs_) :
230 make_unique<RangeSet>();
233 putProducts_.clear();
239 std::lock_guard lock{
mutex_};
241 auto& pmvalue = type_label_and_pmvalue.second;
242 unique_ptr<ProductProvenance const> pp =
243 make_unique<ProductProvenance const>(pmvalue.bd_.productID(),
246 principal.
put(pmvalue.bd_,
249 make_unique<RangeSet>(pmvalue.rs_));
252 pmvalue.bd_,
move(pp),
move(pmvalue.prod_), make_unique<RangeSet>());
255 putProducts_.clear();
261 return specifiedProcessName ==
"current_process"s ?
md_.
processName() :
262 specifiedProcessName;
269 bool const alwaysEnableLookupOfProducedProducts )
const 271 std::lock_guard lock{
mutex_};
276 pid, alwaysEnableLookupOfProducedProducts);
277 if (!bd || (bd->producedClassName() != type.
className())) {
283 "DataViewImpl::getProductDescription_: error while " 284 "trying to retrieve product description:\n")
285 <<
"No product is registered for\n" 288 <<
" product class name: '" << type.
className() <<
"'\n" 291 <<
" product instance name: '" << instance <<
"'\n" 303 if (grp->productDescription().transient()) {
306 auto const& parents = grp->productProvenance()->parentage().parents();
315 string const& moduleLabel,
316 string const& productInstanceName,
341 remove_if(qrs.begin(), qrs.end(), [&typeID](
auto const& gqr) {
342 auto const group = gqr.result();
343 assert(group->productDescription().supportsView());
347 qrs.erase(new_end, qrs.end());
349 if (qrs.size() != 1) {
351 e <<
"getView: Found " 352 << (qrs.empty() ?
"no products" :
"more than one product")
353 <<
" matching all criteria\n" 354 <<
"Looking for sequence of type: " << typeID <<
"\n" 355 <<
"Looking for module label: " << moduleLabel <<
"\n" 356 <<
"Looking for productInstanceName: " << productInstanceName <<
"\n";
357 if (!processTag.
name().empty()) {
358 e <<
"Looking for processName: " << processTag.
name() <<
"\n";
363 return qrs[0].result();
EventID const & eventID() const
Principal const & principal_
SubRunID subRunID() const
EventNumber_t event() const
EDProductGetter const * productGetter(ProductID const &pid) const
RunID const & runID() const
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
static ConsumesInfo * instance()
std::string friendlyClassName() const
std::string const & getProcessName_(std::string const &) const
Timestamp const & time() const
Timestamp const & beginTime() const
std::string const & moduleLabel() const
EventAuxiliary::ExperimentType ExperimentType() const
ProcessHistory const & processHistory() const
static collection_type const & get() noexcept
const std::string instance
Timestamp const & endTime() const
History const & history() const
bool getProcessParameterSet(std::string const &process, fhicl::ParameterSet &) const
BranchType const branchType_
void movePutProductsToPrincipal(Principal &principal)
EventAuxiliary::ExperimentType experimentType() const
std::string const & processName() const
EventNumber_t event() const
static collection_type const & get()
History const & history() const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
EDProductGetter const * productGetter(ProductID const pid) const
std::set< ProductID > retrievedProducts_
SubRunID subRunID() const
void put(BranchDescription const &, std::unique_ptr< ProductProvenance const > &&, std::unique_ptr< EDProduct > &&, std::unique_ptr< RangeSet > &&)
IDNumber_t< Level::SubRun > SubRunNumber_t
ModuleDescription const & md_
SubRunNumber_t subRun() const
std::string className() const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID) const
std::string canonicalProductName(std::string const &friendlyClassName, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName)
static constexpr double ps
std::vector< cet::exempt_ptr< Group > > getMatchingSequence(ModuleContext const &, SelectorBase const &, ProcessTag const &) const
void validateConsumedProduct(BranchType const, ModuleDescription const &, ProductInfo const &productInfo)
ProcessHistory const & processHistory() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::recursive_mutex mutex_
std::optional< ProcessConfiguration > getConfigurationForProcess(std::string const &name) const
auto const & name() const
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
std::map< TypeLabel, PMValue > putProducts_
cet::exempt_ptr< Group const > getContainerForView_(TypeID const &, std::string const &moduleLabel, std::string const &productInstanceName, ProcessTag const &processTag) const
ProcessHistoryID const & processHistoryID() const noexcept
BranchDescription const & getProductDescription_(TypeID const &type, std::string const &instance, bool const alwaysEnableLookupOfProducedProducts=false) const
ProcessHistoryID const & processHistoryID() const
IDNumber_t< Level::Event > EventNumber_t
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
bool upcastAllowed(std::type_info const &tiFrom, std::type_info const &tiTo)
ModuleContext const & mc_
constexpr bool range_sets_supported(BranchType const bt)
Timestamp const & endTime() const
constexpr ProductStatus present() noexcept
Timestamp const & beginTime() const
SubRunNumber_t subRun() const
std::type_info const & typeInfo() const
bool const recordParents_
IDNumber_t< Level::Run > RunNumber_t
std::vector< GroupQueryResult > resolve_products(std::vector< cet::exempt_ptr< art::Group >> const &groups, art::TypeID const &wrapped_type)