Skip to content

Commit 1e2c79e

Browse files
pillotaphecetche
authored andcommitted
fix broken workflows
1 parent 782b83a commit 1e2c79e

5 files changed

Lines changed: 40 additions & 38 deletions

File tree

Detectors/MUON/MCH/Workflow/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Take as input the list of all preclusters ([PreCluster](../Base/include/MCHBase/
7979

8080
## Local to global cluster transformation
8181

82-
The `o2-mch-clusters-transformer-workflow` takes as as input the list of all clusters ([ClusterStruct](../Base/include/MCHBase/ClusterBlock.h)), in local reference frame, in the current time frame, with the data description "CLUSTERS".
82+
The `o2-mch-clusters-transformer-workflow` takes as input the list of all clusters ([ClusterStruct](../Base/include/MCHBase/ClusterBlock.h)), in local reference frame, in the current time frame, with the data description "CLUSTERS".
8383

8484
It sends the list of the same clusters, but converted in global reference frame, with the data description "GLOBALCLUSTERS".
8585

@@ -175,7 +175,7 @@ Option `--nEventsPerTF xxx` allows to set the number of events (i.e. ROF records
175175
### Cluster sampler
176176

177177
```shell
178-
o2-mch-clusters-sampler-workflow --infile "clusters.in"
178+
o2-mch-clusters-sampler-workflow --infile "clusters.in" [--global]
179179
```
180180

181181
where `clusters.in` is a binary file containing for each event:
@@ -185,7 +185,7 @@ where `clusters.in` is a binary file containing for each event:
185185
* list of clusters ([ClusterStruct](../Base/include/MCHBase/ClusterBlock.h))
186186
* list of associated digits ([Digit](../Base/include/MCHBase/Digit.h))
187187

188-
Send the list of all clusters ([ClusterStruct](../Base/include/MCHBase/ClusterBlock.h)) in the current time frame, with the data description "CLUSTERS", and the list of ROF records ([ROFRecord](../../../../DataFormats/Detectors/MUON/MCH/include/DataFormatsMCH/ROFRecord.h)) pointing to the clusters associated to each interaction, with the data description "CLUSTERROFS".
188+
Send the list of all clusters ([ClusterStruct](../Base/include/MCHBase/ClusterBlock.h)) in the current time frame, with the data description "CLUSTERS" (or "GLOBALCLUSTERS" if `--global` option is used), and the list of ROF records ([ROFRecord](../../../../DataFormats/Detectors/MUON/MCH/include/DataFormatsMCH/ROFRecord.h)) pointing to the clusters associated to each interaction, with the data description "CLUSTERROFS".
189189

190190
Option `--nEventsPerTF xxx` allows to set the number of events (i.e. ROF records) to send per time frame (default = 1).
191191

@@ -248,7 +248,7 @@ o2-mch-clusters-sink-workflow --outfile "clusters.out" [--txt] [--no-digits] [--
248248
Take as input the list of all clusters ([ClusterStruct](../Base/include/MCHBase/ClusterBlock.h)) in the current time frame, and, optionnally, the list of all associated digits ([Digit](../Base/include/MCHBase/Digit.h)) and the list of ROF records ([ROFRecord](../../../../DataFormats/Detectors/MUON/MCH/include/DataFormatsMCH/ROFRecord.h)) pointing to the clusters associated to each interaction, with the data description "CLUSTERS" (or "GLOBALCLUSTERS" if `--global` option is used), "CLUSTERDIGITS" (unless `--no-digits` option is used) and "CLUSTERROFS", respectively, and write them event-by-event in the binary file `clusters.out` with the following format for each event:
249249

250250
* number of clusters (int)
251-
* number of associated digits (int) (unless option `--no-digits` is used)
251+
* number of associated digits (int) (= 0 if `--no-digits` is used)
252252
* list of clusters ([ClusterStruct](../Base/include/MCHBase/ClusterBlock.h))
253253
* list of associated digits ([Digit](../Base/include/MCHBase/Digit.h))(unless option `--no-digits` is used)
254254

Detectors/MUON/MCH/Workflow/src/TrackFinderOriginalSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ o2::framework::DataProcessorSpec getTrackFinderOriginalSpec()
149149
return DataProcessorSpec{
150150
"TrackFinderOriginal",
151151
Inputs{InputSpec{"clusterrofs", "MCH", "CLUSTERROFS", 0, Lifetime::Timeframe},
152-
InputSpec{"clusters", "MCH", "CLUSTERS", 0, Lifetime::Timeframe}},
152+
InputSpec{"clusters", "MCH", "GLOBALCLUSTERS", 0, Lifetime::Timeframe}},
153153
Outputs{OutputSpec{{"trackrofs"}, "MCH", "TRACKROFS", 0, Lifetime::Timeframe},
154154
OutputSpec{{"tracks"}, "MCH", "TRACKS", 0, Lifetime::Timeframe},
155155
OutputSpec{{"trackclusters"}, "MCH", "TRACKCLUSTERS", 0, Lifetime::Timeframe}},

Detectors/MUON/MCH/Workflow/src/TrackFinderSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ o2::framework::DataProcessorSpec getTrackFinderSpec()
147147
return DataProcessorSpec{
148148
"TrackFinder",
149149
Inputs{InputSpec{"clusterrofs", "MCH", "CLUSTERROFS", 0, Lifetime::Timeframe},
150-
InputSpec{"clusters", "MCH", "CLUSTERS", 0, Lifetime::Timeframe}},
150+
InputSpec{"clusters", "MCH", "GLOBALCLUSTERS", 0, Lifetime::Timeframe}},
151151
Outputs{OutputSpec{{"trackrofs"}, "MCH", "TRACKROFS", 0, Lifetime::Timeframe},
152152
OutputSpec{{"tracks"}, "MCH", "TRACKS", 0, Lifetime::Timeframe},
153153
OutputSpec{{"trackclusters"}, "MCH", "TRACKCLUSTERS", 0, Lifetime::Timeframe}},

Detectors/MUON/MCH/Workflow/src/clusters-sampler-workflow.cxx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@
2828
#include "Framework/Task.h"
2929
#include "Framework/Logger.h"
3030
#include "Framework/WorkflowSpec.h"
31+
#include "Framework/ConfigParamSpec.h"
3132

3233
#include "DataFormatsMCH/ROFRecord.h"
3334
#include "MCHBase/ClusterBlock.h"
3435
#include "MCHBase/Digit.h"
3536

36-
// add workflow options, note that customization needs to be declared before
37-
// including Framework/runDataProcessing
38-
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
37+
using namespace o2::framework;
38+
39+
//_________________________________________________________________________________________________
40+
void customize(std::vector<ConfigParamSpec>& workflowOptions)
3941
{
40-
std::vector<o2::framework::ConfigParamSpec> options{
41-
{"global", o2::framework::VariantType::Bool, false, {"assume the read clusters are in global reference frame"}},
42-
};
43-
std::swap(workflowOptions, options);
42+
/// add workflow options. Note that customization needs to be declared before including Framework/runDataProcessing
43+
workflowOptions.emplace_back("global", VariantType::Bool, false,
44+
ConfigParamSpec::HelpString{"assume the read clusters are in global reference frame"});
4445
}
4546

4647
#include "Framework/runDataProcessing.h"
4748

48-
using namespace o2::framework;
4949
using namespace o2::mch;
5050

5151
class ClusterSamplerTask
@@ -159,7 +159,7 @@ class ClusterSamplerTask
159159
o2::framework::DataProcessorSpec getClusterSamplerSpec(bool globalReferenceSystem)
160160
{
161161

162-
std::string spec = fmt::format("clusters:MCH/{}CLUSTERS", globalReferenceSystem ? "GLOBAL" : "");
162+
std::string spec = fmt::format("clusters:MCH/{}CLUSTERS/0", globalReferenceSystem ? "GLOBAL" : "");
163163
InputSpec itmp = o2::framework::select(spec.c_str())[0];
164164

165165
return DataProcessorSpec{
@@ -168,11 +168,11 @@ o2::framework::DataProcessorSpec getClusterSamplerSpec(bool globalReferenceSyste
168168
Outputs{OutputSpec{{"rofs"}, "MCH", "CLUSTERROFS", 0, Lifetime::Timeframe},
169169
DataSpecUtils::asOutputSpec(itmp)},
170170
AlgorithmSpec{adaptFromTask<ClusterSamplerTask>()},
171-
Options{
172-
{"infile", VariantType::String, "", {"input filename"}},
173-
{"nEventsPerTF", VariantType::Int, 1, {"number of events per time frame"}}}}; // namespace mch
171+
Options{{"infile", VariantType::String, "", {"input filename"}},
172+
{"nEventsPerTF", VariantType::Int, 1, {"number of events per time frame"}}}};
174173
}
175174

175+
//_________________________________________________________________________________________________
176176
WorkflowSpec defineDataProcessing(const ConfigContext& cc)
177177
{
178178
return WorkflowSpec{getClusterSamplerSpec(cc.options().get<bool>("global"))};

Detectors/MUON/MCH/Workflow/src/clusters-sink-workflow.cxx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <stdexcept>
2020
#include <vector>
2121

22+
#include <fmt/format.h>
23+
2224
#include <gsl/span>
2325

2426
#include "Framework/CallbackService.h"
@@ -29,14 +31,12 @@
2931
#include "Framework/Task.h"
3032
#include "Framework/Logger.h"
3133
#include "Framework/WorkflowSpec.h"
32-
#include "Framework/WorkflowSpec.h"
3334
#include "Framework/ConfigParamSpec.h"
3435

3536
#include "DataFormatsMCH/ROFRecord.h"
3637
#include "MCHBase/Digit.h"
3738
#include "MCHBase/ClusterBlock.h"
3839
#include "MCHMappingInterface/Segmentation.h"
39-
#include <fmt/format.h>
4040

4141
using namespace std;
4242
using namespace o2::framework;
@@ -104,16 +104,16 @@ class ClusterSinkTask
104104
int nClusters = eventClusters.size();
105105
mOutputFile.write(reinterpret_cast<char*>(&nClusters), sizeof(int));
106106

107-
if (mDoDigits) {
108-
// write the total number of digits in these clusters
109-
int nDigits = eventDigits.size();
110-
mOutputFile.write(reinterpret_cast<char*>(&nDigits), sizeof(int));
107+
// write the total number of digits in these clusters
108+
int nDigits = eventDigits.size();
109+
mOutputFile.write(reinterpret_cast<char*>(&nDigits), sizeof(int));
111110

112-
// write the clusters
113-
mOutputFile.write(reinterpret_cast<const char*>(eventClusters.data()),
114-
eventClusters.size() * sizeof(ClusterStruct));
111+
// write the clusters
112+
mOutputFile.write(reinterpret_cast<const char*>(eventClusters.data()),
113+
eventClusters.size() * sizeof(ClusterStruct));
115114

116-
// write the digits (after converting the pad ID into a digit UID if requested)
115+
// write the digits (after converting the pad ID into a digit UID if requested)
116+
if (nDigits > 0) {
117117
if (mUseRun2DigitUID) {
118118
std::vector<Digit> digitsCopy(eventDigits.begin(), eventDigits.end());
119119
convertPadID2DigitUID(digitsCopy);
@@ -150,6 +150,7 @@ class ClusterSinkTask
150150
clusters.begin() + rof.getLastIdx() + 1);
151151

152152
if (mDoDigits) {
153+
153154
auto digitOffset = eventClusters.front().firstDigit;
154155
for (auto& cluster : eventClusters) {
155156
cluster.firstDigit -= digitOffset;
@@ -162,6 +163,7 @@ class ClusterSinkTask
162163

163164
return digits.subspan(digitOffset, nDigits);
164165
}
166+
165167
return {};
166168
}
167169

@@ -206,28 +208,28 @@ class ClusterSinkTask
206208
bool mDoDigits = true; ///< whether or not we deal with digits
207209
};
208210

209-
// add workflow options, note that customization needs to be declared before
210-
// including Framework/runDataProcessing
211-
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
211+
//_________________________________________________________________________________________________
212+
void customize(std::vector<ConfigParamSpec>& workflowOptions)
212213
{
213-
std::vector<o2::framework::ConfigParamSpec> options{
214-
{"global", o2::framework::VariantType::Bool, false, {"read clusters with positions expressed in global reference frame"}},
215-
{"no-digits", o2::framework::VariantType::Bool, false, {"do not look for digits"}},
216-
};
217-
std::swap(workflowOptions, options);
214+
/// add workflow options. Note that customization needs to be declared before including Framework/runDataProcessing
215+
workflowOptions.emplace_back("global", VariantType::Bool, false,
216+
ConfigParamSpec::HelpString{"read clusters with positions expressed in global reference frame"});
217+
workflowOptions.emplace_back("no-digits", VariantType::Bool, false,
218+
ConfigParamSpec::HelpString{"do not look for digits"});
218219
}
219220

221+
//_________________________________________________________________________________________________
220222
#include "Framework/runDataProcessing.h"
221223

222224
WorkflowSpec defineDataProcessing(const ConfigContext& cc)
223225
{
224-
std::string inputConfig = fmt::format("rofs:MCH/CLUSTERROFS;clusters:MCH/{}CLUSTERS",
226+
std::string inputConfig = fmt::format("rofs:MCH/CLUSTERROFS/0;clusters:MCH/{}CLUSTERS/0",
225227
cc.options().get<bool>("global") ? "GLOBAL" : "");
226228

227229
bool doDigits = not cc.options().get<bool>("no-digits");
228230

229231
if (doDigits) {
230-
inputConfig += ";digits:MCH/CLUSTERDIGITS";
232+
inputConfig += ";digits:MCH/CLUSTERDIGITS/0";
231233
}
232234
std::cout << "inputConfig=" << inputConfig << "\n";
233235

0 commit comments

Comments
 (0)