Skip to content

Commit 5cf63ac

Browse files
committed
DPL: separate concrete header information in InputSpec
1 parent f94e832 commit 5cf63ac

27 files changed

Lines changed: 793 additions & 483 deletions

Detectors/TPC/workflow/src/CATrackerSpec.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "Headers/DataHeader.h"
1818
#include "Framework/WorkflowSpec.h" // o2::framework::mergeInputs
1919
#include "Framework/DataRefUtils.h"
20+
#include "Framework/DataSpecUtils.h"
2021
#include "DataFormatsTPC/TPCSectorHeader.h"
2122
#include "DataFormatsTPC/ClusterNative.h"
2223
#include "DataFormatsTPC/Helpers.h"
@@ -282,7 +283,7 @@ DataProcessorSpec getCATrackerSpec(bool processMC, size_t fanIn)
282283
// using unique input names for the moment but want to find
283284
// an input-multiplicity-agnostic way of processing
284285
input.binding += std::to_string(index);
285-
input.subSpec = index;
286+
DataSpecUtils::updateMatchingSubspec(input, index);
286287
}));
287288
};
288289

Detectors/TPC/workflow/src/RecoWorkflow.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/// @brief Workflow definition for the TPC reconstruction
1515

1616
#include "Framework/WorkflowSpec.h"
17+
#include "Framework/DataSpecUtils.h"
1718
#include "Utils/MakeRootTreeWriterSpec.h"
1819
#include "TPCWorkflow/RecoWorkflow.h"
1920
#include "PublisherSpec.h"
@@ -198,7 +199,7 @@ framework::WorkflowSpec getWorkflow(std::vector<int> const& tpcSectors, bool pro
198199
nLanes,
199200
[](DataProcessorSpec& spec, size_t id) {
200201
for (auto& input : spec.inputs) {
201-
input.subSpec = id;
202+
DataSpecUtils::updateMatchingSubspec(input, id);
202203
}
203204
for (auto& output : spec.outputs) {
204205
output.subSpec = id;
@@ -253,7 +254,7 @@ framework::WorkflowSpec getWorkflow(std::vector<int> const& tpcSectors, bool pro
253254

254255
auto amendInput = [](InputSpec& input, size_t lane) {
255256
input.binding += std::to_string(lane);
256-
input.subSpec = lane;
257+
DataSpecUtils::updateMatchingSubspec(input, lane);
257258
};
258259
auto amendBranchDef = [nLanes, propagateMC, amendInput, tpcSectors, getIndex, getName](auto&& def) {
259260
def.keys = mergeInputs(def.keys, nLanes, amendInput);

Framework/Core/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ set(SRCS
2929
src/ChannelConfigurationPolicy.cxx
3030
src/ChannelConfigurationPolicyHelpers.cxx
3131
src/DataAllocator.cxx
32+
src/DataDescriptorMatcher.cxx
3233
src/DataProcessingDevice.cxx
3334
src/DataProcessingHeader.cxx
3435
src/DataProcessor.cxx
@@ -41,6 +42,7 @@ set(SRCS
4142
src/DataSamplingReadoutAdapter.cxx
4243
src/DataSamplingPolicy.cxx
4344
src/DataSourceDevice.cxx
45+
src/DataSpecUtils.cxx
4446
src/DeviceMetricsInfo.cxx
4547
src/DeviceSpec.cxx
4648
src/DeviceSpecHelpers.cxx
@@ -54,6 +56,7 @@ set(SRCS
5456
src/FairMQResizableBuffer.cxx
5557
src/GraphvizHelpers.cxx
5658
src/InputRecord.cxx
59+
src/InputSpec.cxx
5760
src/DataDescriptorQueryBuilder.cxx
5861
src/LifetimeHelpers.cxx
5962
src/LocalRootFileService.cxx

Framework/Core/include/Framework/ChannelMatching.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "Framework/DataProcessorSpec.h"
1414
#include "Framework/InputSpec.h"
1515
#include "Framework/OutputSpec.h"
16+
#include "Framework/DataSpecUtils.h"
17+
1618
#include <vector>
1719
#include <string>
1820

@@ -44,7 +46,7 @@ struct DomainId {
4446
struct LogicalChannelDomain {
4547
LogicalChannelDomain(const InputSpec& spec)
4648
{
47-
name.value = std::string("out_") + spec.origin.as<std::string>() + "_" + spec.description.as<std::string>() + "_" + std::to_string(spec.subSpec);
49+
name.value = std::string("out_") + std::string(DataSpecUtils::label(spec));
4850
}
4951
DomainId name;
5052
bool operator<(LogicalChannelDomain const& other) const
@@ -82,14 +84,6 @@ struct PhysicalChannelDomain {
8284
}
8385
};
8486

85-
/// @return true if the doma
86-
/// FIXME: for the moment we require a full match, however matcher could really be
87-
/// a *-expression or even a regular expression.
88-
inline bool intersect(const LogicalChannelDomain& targetDomain, const LogicalChannelRange& sourceRange)
89-
{
90-
return targetDomain.name.value == sourceRange.name;
91-
}
92-
9387
} // namespace framework
9488
} // namespace o2
9589
#endif // FRAMEWORK_CHANNELMATCHING_H
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
#ifndef o2_framework_ConcreteDataMatcher_H_INCLUDED
11+
#define o2_framework_ConcreteDataMatcher_H_INCLUDED
12+
13+
#include "Headers/DataHeader.h"
14+
15+
namespace o2
16+
{
17+
namespace framework
18+
{
19+
20+
struct ConcreteDataMatcher {
21+
header::DataOrigin origin;
22+
header::DataDescription description;
23+
header::DataHeader::SubSpecificationType subSpec;
24+
25+
ConcreteDataMatcher(header::DataOrigin origin_,
26+
header::DataDescription description_,
27+
header::DataHeader::SubSpecificationType subSpec_)
28+
: origin(origin_),
29+
description(description_),
30+
subSpec(subSpec_)
31+
{
32+
}
33+
ConcreteDataMatcher(ConcreteDataMatcher const& other) = default;
34+
ConcreteDataMatcher(ConcreteDataMatcher&& other) noexcept = default;
35+
ConcreteDataMatcher& operator=(ConcreteDataMatcher const& other) = default;
36+
ConcreteDataMatcher& operator=(ConcreteDataMatcher&& other) noexcept = default;
37+
38+
/// Two DataDescription are the same if and only
39+
/// if every component is the same.
40+
bool operator==(ConcreteDataMatcher const& that) const
41+
{
42+
return origin == that.origin && description == that.description && subSpec == that.subSpec;
43+
}
44+
};
45+
46+
} // namespace framework
47+
} // namespace o2
48+
#endif

0 commit comments

Comments
 (0)