Skip to content

Commit fe3131d

Browse files
committed
Merge branch 'release/v3_11_01'
2 parents c186cc5 + f9a9cff commit fe3131d

File tree

12 files changed

+80
-31
lines changed

12 files changed

+80
-31
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1515

1616
find_package(cetmodules 2.13.00 REQUIRED)
17-
project(art VERSION 3.11.00 LANGUAGES CXX C)
17+
project(art VERSION 3.11.01 LANGUAGES CXX C)
1818

1919
include(CetCMakeEnv)
2020
cet_cmake_env()

art/Framework/IO/Sources/SourceHelper.cc

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,31 @@ art::SourceHelper::throwIfProductsNotRegistered_() const
3131
}
3232

3333
art::ProcessHistoryID
34-
art::SourceHelper::processHistoryID_(BranchType const bt,
35-
ProcessConfiguration const& pc) const
34+
art::SourceHelper::updatedProcessHistoryID_(
35+
ProcessHistoryID const& processHistoryID,
36+
BranchType const bt,
37+
ProcessConfiguration const& pc) const
3638
{
37-
art::ProcessHistory processHistory{};
3839
// If no products are present for this branch type, we do not
39-
// register the process history.
40+
// update the process history.
4041
if (presentProducts_->descriptions(bt).empty()) {
41-
return processHistory.id();
42+
return processHistoryID;
4243
}
4344

45+
art::ProcessHistory processHistory{};
46+
if (processHistoryID.isValid()) {
47+
bool const found =
48+
ProcessHistoryRegistry::get(processHistoryID, processHistory);
49+
if (!found) {
50+
throw Exception(
51+
errors::LogicError,
52+
"Error while attempting to create principal from SourceHelper.\n")
53+
<< "The provided process-history ID\n"
54+
<< " " << processHistory << '\n'
55+
<< "does not correspond to a known process history.\n"
56+
"Please contact artists@fnal.gov for guidance.";
57+
}
58+
}
4459
processHistory.push_back(pc);
4560
auto const phid = processHistory.id();
4661
art::ProcessHistoryRegistry::emplace(phid, processHistory);
@@ -60,8 +75,8 @@ art::SourceHelper::makePrincipal_(typename T::Auxiliary aux) const
6075
{
6176
throwIfProductsNotRegistered_();
6277
constexpr auto branch_type = T::branch_type;
63-
aux.setProcessHistoryID(
64-
processHistoryID_(branch_type, md_.processConfiguration()));
78+
aux.setProcessHistoryID(updatedProcessHistoryID_(
79+
aux.processHistoryID(), branch_type, md_.processConfiguration()));
6580
auto principal =
6681
new T{aux, md_.processConfiguration(), &presentProducts_->get(branch_type)};
6782
if (aux.processHistoryID().isValid()) {

art/Framework/IO/Sources/SourceHelper.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ class art::SourceHelper {
8181
template <typename T>
8282
T* makePrincipal_(typename T::Auxiliary aux) const;
8383
void throwIfProductsNotRegistered_() const;
84-
ProcessHistoryID processHistoryID_(BranchType,
85-
ProcessConfiguration const&) const;
84+
ProcessHistoryID updatedProcessHistoryID_(ProcessHistoryID const&,
85+
BranchType,
86+
ProcessConfiguration const&) const;
8687
void setPresentProducts(cet::exempt_ptr<ProductTables const> presentProducts);
8788
cet::exempt_ptr<ProductTables const> presentProducts_{nullptr};
8889
ModuleDescription md_;

art/Framework/Principal/Event.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ namespace art {
6161
using ProductRetriever::getValidHandle;
6262
using ProductRetriever::getView;
6363

64+
using ProductRetriever::getProcessParameterSet;
6465
using ProductRetriever::getProductDescription;
65-
using ProductRetriever::getProductID;
66+
using ProductRetriever::getProductProvenance;
6667

67-
using ProductRetriever::getProcessParameterSet;
68+
using ProductRetriever::getProductID;
6869
using ProductRetriever::productGetter;
6970

7071
// Obsolete interface (will be deprecated)

art/Framework/Principal/Principal.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ namespace art {
436436
string const& processName = processConfiguration_.processName();
437437
for (auto const& val : processHistory_) {
438438
if (processName == val.processName()) {
439-
throw art::Exception(errors::Configuration)
439+
throw Exception(errors::Configuration)
440440
<< "The process name " << processName
441441
<< " was previously used on these products.\n"
442442
<< "Please modify the configuration file to use a "
@@ -726,8 +726,7 @@ namespace art {
726726
auto group = getGroupLocal(bd.productID());
727727
assert(group);
728728
if (group->anyProduct() != nullptr) {
729-
throw art::Exception(art::errors::ProductRegistrationFailure,
730-
"Principal::put:")
729+
throw Exception(errors::ProductRegistrationFailure, "Principal::put:")
731730
<< "Problem found during put of " << branchType_
732731
<< " product: product already put for " << bd.branchName() << '\n';
733732
}

art/Framework/Principal/ProductRetriever.cc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace art {
4949
return principal_.productGetter(pid);
5050
}
5151

52-
std::optional<fhicl::ParameterSet>
52+
std::optional<fhicl::ParameterSet const>
5353
ProductRetriever::getProcessParameterSet(std::string const& processName) const
5454
{
5555
std::lock_guard lock{mutex_};
@@ -74,6 +74,23 @@ namespace art {
7474
end(retrievedProducts_));
7575
}
7676

77+
std::optional<Provenance const>
78+
ProductRetriever::getProductProvenance(ProductID const pid) const
79+
{
80+
auto gqr = principal_.getByProductID(pid);
81+
if (gqr.failed()) {
82+
return std::nullopt;
83+
}
84+
85+
auto group = gqr.result();
86+
if (!group->productProvenance()) {
87+
// This can happen if someone tries to access the provenance
88+
// before the product has been produced.
89+
return std::nullopt;
90+
}
91+
return std::make_optional<Provenance const>(group);
92+
}
93+
7794
cet::exempt_ptr<BranchDescription const>
7895
ProductRetriever::getProductDescription(ProductID const pid) const
7996
{

art/Framework/Principal/ProductRetriever.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "art/Framework/Principal/Group.h"
66
#include "art/Framework/Principal/Handle.h"
77
#include "art/Framework/Principal/ProcessTag.h"
8+
#include "art/Framework/Principal/Provenance.h"
89
#include "art/Framework/Principal/Selector.h"
910
#include "art/Framework/Principal/fwd.h"
1011
#include "art/Persistency/Common/GroupQueryResult.h"
@@ -57,11 +58,6 @@ namespace art {
5758
ProductRetriever& operator=(ProductRetriever const&) = delete;
5859
ProductRetriever& operator=(ProductRetriever&) = delete;
5960

60-
// Miscellaneous functionality
61-
EDProductGetter const* productGetter(ProductID const pid) const;
62-
std::optional<fhicl::ParameterSet> getProcessParameterSet(
63-
std::string const& process) const;
64-
6561
// Product retrieval
6662
template <typename PROD>
6763
PROD const& getProduct(InputTag const& tag) const;
@@ -156,13 +152,17 @@ namespace art {
156152

157153
std::vector<ProductID> retrievedPIDs() const;
158154

159-
// Product ID and description
160-
template <typename T>
161-
ProductID getProductID(std::string const& instance_name = "") const;
162-
155+
// Miscellaneous functionality
156+
std::optional<Provenance const> getProductProvenance(ProductID) const;
157+
std::optional<fhicl::ParameterSet const> getProcessParameterSet(
158+
std::string const& process) const;
163159
cet::exempt_ptr<BranchDescription const> getProductDescription(
164160
ProductID) const;
165161

162+
EDProductGetter const* productGetter(ProductID const pid) const;
163+
template <typename T>
164+
ProductID getProductID(std::string const& instance_name = "") const;
165+
166166
private:
167167
void recordAsParent_(cet::exempt_ptr<Group const> grp) const;
168168
cet::exempt_ptr<Group const> getContainerForView_(

art/Framework/Principal/Results.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ namespace art {
3838
using ProductRetriever::getValidHandle;
3939
using ProductRetriever::getView;
4040

41+
using ProductRetriever::getProcessParameterSet;
4142
using ProductRetriever::getProductDescription;
43+
using ProductRetriever::getProductProvenance;
44+
4245
using ProductRetriever::getProductID;
4346
using ProductRetriever::productGetter;
4447

art/Framework/Principal/Run.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ namespace art {
6262
using ProductRetriever::getValidHandle;
6363
using ProductRetriever::getView;
6464

65+
using ProductRetriever::getProcessParameterSet;
6566
using ProductRetriever::getProductDescription;
66-
using ProductRetriever::getProductID;
67+
using ProductRetriever::getProductProvenance;
6768

68-
using ProductRetriever::getProcessParameterSet;
69+
using ProductRetriever::getProductID;
6970
using ProductRetriever::productGetter;
7071

7172
// Obsolete interface (will be deprecated)

art/Framework/Principal/SubRun.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ namespace art {
6666
using ProductRetriever::getView;
6767

6868
Run const& getRun() const;
69+
using ProductRetriever::getProcessParameterSet;
6970
using ProductRetriever::getProductDescription;
70-
using ProductRetriever::getProductID;
71+
using ProductRetriever::getProductProvenance;
7172

73+
using ProductRetriever::getProductID;
7274
using ProductRetriever::productGetter;
7375

7476
// Obsolete interface (will be deprecated)

0 commit comments

Comments
 (0)