Skip to content

Commit e09958c

Browse files
committed
Event Display: add OnlineMode and safety checks
1 parent b7dcf6a commit e09958c

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

EventVisualisation/Base/src/DirectoryLoader.cxx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
/// \author julian.myrcha@cern.ch
1515

1616
#include "EventVisualisationBase/DirectoryLoader.h"
17+
#include "Framework/DefaultsHelpers.h"
18+
#include "Framework/DataTakingContext.h"
1719
#include <filesystem>
1820
#include <algorithm>
1921
#include <climits>
@@ -65,10 +67,13 @@ bool DirectoryLoader::canCreateNextFile(const std::vector<std::string>& paths, c
6567
}
6668

6769
// comparison with safety if marker not in the filename (-1+1 gives 0)
68-
std::ranges::sort(result.begin(), result.end(),
69-
[marker](const std::string& a, const std::string& b) {
70-
return a.substr(a.find_first_of(marker) + 1) > b.substr(b.find_first_of(marker) + 1);
71-
});
70+
if (result.size() > 1) {
71+
std::ranges::sort(result.begin(), result.end(),
72+
[marker](const std::string& a, const std::string& b) {
73+
return a.substr(a.find_first_of(marker) + 1) > b.substr(b.find_first_of(marker) + 1);
74+
});
75+
}
76+
7277
unsigned long accumulatedSize = 0L;
7378
const std::regex delimiter{"_"};
7479
for (auto const& file : result) {
@@ -113,11 +118,15 @@ deque<string> DirectoryLoader::load(const std::vector<std::string>& paths, const
113118

114119
std::vector<std::string> DirectoryLoader::allFolders(const std::string& location)
115120
{
116-
auto const pos = location.find_last_of('_');
117121
std::vector<std::string> folders;
118-
folders.push_back(location.substr(0, pos) + "_PHYSICS");
119-
folders.push_back(location.substr(0, pos) + "_COSMICS");
120-
folders.push_back(location.substr(0, pos) + "_SYNTHETIC");
122+
if (o2::framework::DefaultsHelpers::deploymentMode() == o2::framework::DeploymentMode::OnlineDDS) {
123+
auto const pos = location.find_last_of('_');
124+
folders.push_back(location.substr(0, pos) + "_PHYSICS");
125+
folders.push_back(location.substr(0, pos) + "_COSMICS");
126+
folders.push_back(location.substr(0, pos) + "_SYNTHETIC");
127+
} else {
128+
folders.push_back(location);
129+
}
121130
return folders;
122131
}
123132

0 commit comments

Comments
 (0)