Skip to content

Commit 3b2822e

Browse files
committed
Remove InputFileCatalog::logicalFileNames as unnecessary
The logicalFileNames() was not used, so removing the member allows avoiding one copy of the LFNs.
1 parent cff58ae commit 3b2822e

File tree

6 files changed

+10
-35
lines changed

6 files changed

+10
-35
lines changed

FWCore/Catalog/interface/InputFileCatalog.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,19 @@ namespace edm {
4242

4343
~InputFileCatalog();
4444
std::vector<FileCatalogItem> const& fileCatalogItems() const { return fileCatalogItems_; }
45-
std::vector<std::string> const& logicalFileNames() const { return logicalFileNames_; }
4645
std::vector<std::string> fileNames(unsigned iCatalog) const;
4746
bool empty() const { return fileCatalogItems_.empty(); }
4847
static bool isPhysical(std::string const& name) { return (name.empty() || name.find(':') != std::string::npos); }
4948

5049
private:
51-
void init(std::string const& override, bool useLFNasPFNifLFNnotFound, edm::CatalogType catType);
50+
void init(std::vector<std::string> logicalFileNames,
51+
std::string const& override,
52+
bool useLFNasPFNifLFNnotFound,
53+
edm::CatalogType catType);
5254
void findFile(std::string const& lfn,
5355
std::vector<std::string>& pfns,
5456
bool useLFNasPFNifLFNnotFound,
5557
edm::CatalogType catType);
56-
std::vector<std::string> logicalFileNames_;
5758
std::vector<FileCatalogItem> fileCatalogItems_;
5859
edm::propagate_const<std::unique_ptr<FileLocator>> overrideFileLocator_;
5960

FWCore/Catalog/src/InputFileCatalog.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ namespace edm {
2121
std::string const& override,
2222
bool useLFNasPFNifLFNnotFound,
2323
edm::CatalogType catType)
24-
: logicalFileNames_(fileNames), fileCatalogItems_(), overrideFileLocator_() {
25-
init(override, useLFNasPFNifLFNnotFound, catType);
24+
: fileCatalogItems_(), overrideFileLocator_() {
25+
init(fileNames, override, useLFNasPFNifLFNnotFound, catType);
2626
}
2727

2828
InputFileCatalog::~InputFileCatalog() {}
@@ -36,7 +36,8 @@ namespace edm {
3636
return tmp;
3737
}
3838

39-
void InputFileCatalog::init(std::string const& inputOverride,
39+
void InputFileCatalog::init(std::vector<std::string> logicalFileNames,
40+
std::string const& inputOverride,
4041
bool useLFNasPFNifLFNnotFound,
4142
edm::CatalogType catType) {
4243
typedef std::vector<std::string>::iterator iter;
@@ -123,7 +124,7 @@ namespace edm {
123124
throw ex;
124125
}
125126

126-
for (auto& lfn : logicalFileNames_) {
127+
for (auto& lfn : logicalFileNames) {
127128
boost::trim(lfn);
128129
std::vector<std::string> pfns;
129130
if (lfn.empty()) {
@@ -147,7 +148,7 @@ namespace edm {
147148
}
148149
lfn.shrink_to_fit(); // try to release memory
149150

150-
fileCatalogItems_.emplace_back(std::move(pfns), lfn);
151+
fileCatalogItems_.emplace_back(std::move(pfns), std::move(lfn));
151152
}
152153
}
153154

FWCore/Catalog/test/InputFileCatalog_t.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ TEST_CASE("InputFileCatalog with Rucio data catalog", "[FWCore/Catalog]") {
2525

2626
edm::InputFileCatalog catalog(std::vector<std::string>{"/store/foo/bar", " file:/foo/bar", "root://foobar "}, "");
2727

28-
SECTION("logicalFileNames") {
29-
auto const& lfns = catalog.logicalFileNames();
30-
REQUIRE(lfns.size() == 3);
31-
CHECK(lfns[0] == "/store/foo/bar");
32-
CHECK(lfns[1] == ""); // was PFN
33-
CHECK(lfns[2] == ""); // was PFN
34-
}
35-
3628
SECTION("fileNames") {
3729
SECTION("Catalog 0") {
3830
auto const names = catalog.fileNames(0);
@@ -76,14 +68,6 @@ TEST_CASE("InputFileCatalog with Rucio data catalog", "[FWCore/Catalog]") {
7668
edm::InputFileCatalog catalog(std::vector<std::string>{"/store/foo/bar", " file:/foo/bar", "root://foobar "},
7769
"T1_US_FNAL,,T1_US_FNAL,FNAL_dCache_EOS,XRootD");
7870

79-
SECTION("logicalFileNames") {
80-
auto const& lfns = catalog.logicalFileNames();
81-
REQUIRE(lfns.size() == 3);
82-
CHECK(lfns[0] == "/store/foo/bar");
83-
CHECK(lfns[1] == ""); // was PFN
84-
CHECK(lfns[2] == ""); // was PFN
85-
}
86-
8771
SECTION("fileNames") {
8872
auto const names = catalog.fileNames(0);
8973
REQUIRE(names.size() == 3);
@@ -116,14 +100,6 @@ TEST_CASE("InputFileCatalog with Rucio data catalog", "[FWCore/Catalog]") {
116100
edm::InputFileCatalog catalog(
117101
std::vector<std::string>{"/store/foo/bar", "/tmp/foo/bar", "root://foobar "}, "", true);
118102

119-
SECTION("logicalFileNames") {
120-
auto const& lfns = catalog.logicalFileNames();
121-
REQUIRE(lfns.size() == 3);
122-
CHECK(lfns[0] == "/store/foo/bar");
123-
CHECK(lfns[1] == "/tmp/foo/bar");
124-
CHECK(lfns[2] == ""); // was PFN
125-
}
126-
127103
SECTION("fileNames") {
128104
SECTION("Catalog 0") {
129105
auto const names = catalog.fileNames(0);

FWCore/Sources/interface/FromFiles.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ namespace edm {
1818
FromFiles(ParameterSet const& pset);
1919
~FromFiles();
2020

21-
std::vector<std::string> const& logicalFileNames() const { return catalog_.logicalFileNames(); }
2221
std::vector<std::string> fileNames(unsigned iCatalog) const { return catalog_.fileNames(iCatalog); }
2322
InputFileCatalog& catalog() { return catalog_; }
2423

FWCore/Sources/interface/ProducerSourceFromFiles.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ namespace edm {
2121

2222
using FromFiles::catalog;
2323
using FromFiles::fileNames;
24-
using FromFiles::logicalFileNames;
2524

2625
static void fillDescription(ParameterSetDescription& desc);
2726

FWCore/Sources/interface/RawInputSourceFromFiles.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ namespace edm {
2020
~RawInputSourceFromFiles() override;
2121

2222
using FromFiles::catalog;
23-
using FromFiles::logicalFileNames;
2423

2524
static void fillDescription(ParameterSetDescription& desc);
2625

0 commit comments

Comments
 (0)