-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathMergerBuilder.h
More file actions
92 lines (77 loc) · 2.99 KB
/
MergerBuilder.h
File metadata and controls
92 lines (77 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef ALICEO2_MERGERBUILDER_H
#define ALICEO2_MERGERBUILDER_H
/// \file MergeBuilder.h
/// \brief Definition of O2 Mergers builder, v0.1
///
/// \author Piotr Konopka, piotr.jan.konopka@cern.ch
#include "Mergers/MergerConfig.h"
#include "Framework/DataProcessorSpec.h"
#include <string>
namespace o2
{
namespace framework
{
class CompletionPolicy;
}
namespace mergers
{
/// \brief A builder class to generate a DataProcessorSpec of one Merger
///
/// A builder class to generate a DataProcessorSpec of one Merger. One builder can be reused by using setters to change
/// the configuration and generating more Mergers. If OutputSpec is not set or it is has either header::gDataOriginInvalid
/// or header::gDataDescriptionInvalid, OutputSpec is generated using.
class MergerBuilder
{
public:
/// \brief Default constructor.
MergerBuilder();
/// \brief Default destructor.
~MergerBuilder() = default;
void setName(std::string);
void setInputSpecs(const framework::Inputs&);
void setOutputSpec(const framework::OutputSpec& outputSpec);
void setOutputSpecMovingWindow(const framework::OutputSpec& outputSpec);
void setTopologyPosition(size_t layer, size_t id);
void setTimePipeline(size_t timepipeline);
void setConfig(MergerConfig);
framework::DataProcessorSpec buildSpec();
/// \brief Configures mergers to consume any data immediately.
static void customizeInfrastructure(std::vector<framework::CompletionPolicy>&);
static inline framework::DataProcessorLabel mergerLabel() { return {"merger"}; }
static inline std::string mergerIntegralOutputBinding() { return "out"; };
static inline std::string mergerMovingWindowOutputBinding() { return "mw_out"; };
static inline std::string mergerIdString() { return "MERGER"; };
static inline header::DataOrigin mergerDataOrigin() { return {"MRGR"}; };
static inline header::DataDescription mergerDataDescription(std::string name)
{
header::DataDescription description;
description.runtimeInit(name.substr(0, 16).c_str());
return description;
};
static inline header::DataHeader::SubSpecificationType mergerSubSpec(size_t layer, size_t id)
{
return (layer << 16) + id;
};
private:
std::string mName;
size_t mId{0};
size_t mLayer{1};
size_t mTimePipeline{1};
framework::Inputs mInputSpecs;
framework::OutputSpec mOutputSpecIntegral;
framework::OutputSpec mOutputSpecMovingWindow;
MergerConfig mConfig;
};
} // namespace mergers
} // namespace o2
#endif //ALICEO2_MERGERBUILDER_H