Project
Loading...
Searching...
No Matches
raw-checker-workflow.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#include <string>
18#include <vector>
19#include "Framework/Variant.h"
21#include "MIDRaw/CrateMasks.h"
23#include "MIDRaw/FEEIdConfig.h"
27
28using namespace o2::framework;
29
30// add workflow options, note that customization needs to be declared before
31// including Framework/runDataProcessing
32void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
33{
34 std::vector<ConfigParamSpec>
35 options{
36 {"feeId-config-file", VariantType::String, "", {"Filename with crate FEE ID correspondence"}},
37 {"crate-masks-file", VariantType::String, "", {"Filename with crate masks"}},
38 {"electronics-delay-file", VariantType::String, "", {"Filename with electronics delay"}},
39 {"per-gbt", VariantType::Bool, false, {"One process per GBT link"}},
40 {"per-feeId", VariantType::Bool, false, {"One process per FeeId"}}};
41 workflowOptions.insert(workflowOptions.end(), options.begin(), options.end());
42}
43
44// ------------------------------------------------------------------
45
47
49{
50 auto feeIdConfigFilename = cfgc.options().get<std::string>("feeId-config-file");
51 o2::mid::FEEIdConfig feeIdConfig;
52 if (!feeIdConfigFilename.empty()) {
53 feeIdConfig = o2::mid::FEEIdConfig(feeIdConfigFilename.c_str());
54 }
55 auto crateMasksFilename = cfgc.options().get<std::string>("crate-masks-file");
56 o2::mid::CrateMasks crateMasks;
57 if (!crateMasksFilename.empty()) {
58 crateMasks = o2::mid::CrateMasks(crateMasksFilename.c_str());
59 }
60 auto electronicsDelayFilename = cfgc.options().get<std::string>("electronics-delay-file");
61 o2::mid::ElectronicsDelay electronicsDelay;
62 if (!electronicsDelayFilename.empty()) {
63 electronicsDelay = o2::mid::readElectronicsDelay(electronicsDelayFilename.c_str());
64 }
65
66 bool perGBT = cfgc.options().get<bool>("per-gbt");
67
68 bool perFeeId = cfgc.options().get<bool>("per-feeId");
69
70 std::vector<uint32_t> gbtIds = feeIdConfig.getConfiguredLinkUniqueIDs();
71 std::vector<uint16_t> feeIds;
72 for (auto& gbtId : gbtIds) {
73 feeIds.emplace_back(feeIdConfig.getGBTUniqueId(gbtId));
74 }
75
77 if (perGBT || perFeeId) {
78 o2::framework::WorkflowSpec templateSpecs;
79 templateSpecs.emplace_back(o2::mid::getRawGBTDecoderSpec(true, feeIds, crateMasks, electronicsDelay));
80 templateSpecs.emplace_back(o2::mid::getRawCheckerSpec(feeIds, crateMasks, electronicsDelay, true));
81
82 auto parallelSpecs = o2::framework::parallelPipeline(
83 templateSpecs, gbtIds.size(),
84 [&gbtIds]() { return gbtIds.size(); },
85 [&gbtIds, &feeIdConfig, perFeeId](size_t index) { return perFeeId ? feeIdConfig.getGBTUniqueId(gbtIds[index]) : gbtIds[index]; });
86 specs.insert(specs.end(), parallelSpecs.begin(), parallelSpecs.end());
87 } else {
88 specs.emplace_back(o2::mid::getRawDecoderSpec(true, feeIdConfig, crateMasks, electronicsDelay, false));
89 specs.emplace_back(o2::mid::getRawCheckerSpec(feeIds, crateMasks, electronicsDelay, false));
90 }
91 return specs;
92}
MID crate masks.
Delay parameters for MID electronics.
Hardware Id to FeeId mapper.
Data processor spec for MID raw decoder device.
Data processor spec for MID raw checker device.
Data processor spec for MID GBT raw decoder device.
ConfigParamRegistry & options() const
GLuint index
Definition glcorearb.h:781
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
WorkflowSpec parallelPipeline(const WorkflowSpec &specs, size_t nPipelines, std::function< size_t()> getNumberOfSubspecs, std::function< size_t(size_t)> getSubSpec)
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getRawCheckerSpec(const std::vector< uint16_t > &feeIds, const CrateMasks &crateMasks, const ElectronicsDelay &electronicsDelay, bool perGBT=false)
framework::DataProcessorSpec getRawDecoderSpec(bool isDebugMode=false)
ElectronicsDelay readElectronicsDelay(const char *filename)
o2::framework::DataProcessorSpec getRawGBTDecoderSpec(bool isDebugMode, const std::vector< uint16_t > &feeIds, const CrateMasks &crateMasks, const ElectronicsDelay &electronicsDelay)
void customize(std::vector< o2::framework::ConfigParamSpec > &workflowOptions)
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)