Project
Loading...
Searching...
No Matches
DataReader.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
23#include "Framework/Logger.h"
30
31// add workflow options, note that customization needs to be declared before
32// including Framework/runDataProcessing
33void customize(std::vector<ConfigParamSpec>& workflowOptions)
34{
35
36 std::vector<o2::framework::ConfigParamSpec> options{
37 {"verbose", VariantType::Bool, false, {"Enable verbose epn data reading."}},
38 {"verboseerrors", VariantType::Bool, false, {"Enable verbose error text, instead of simply updating the spectra."}},
39 {"ignore-dist-stf", VariantType::Bool, false, {"do not subscribe to FLP/DISTSUBTIMEFRAME/0 message (no lost TF recovery)"}},
40 {"halfchamberwords", VariantType::Int, 0, {"Fix half chamber for when it is version is 0.0 integer value of additional header words, ignored if version is not 0.0"}},
41 {"halfchambermajor", VariantType::Int, 0, {"Fix half chamber for when it is version is 0.0 integer value of major version, ignored if version is not 0.0"}},
42 {"fixforoldtrigger", VariantType::Bool, false, {"Fix for the old data not having a 2 stage trigger stored in the cru header."}},
43 {"onlycalibrationtrigger", VariantType::Bool, false, {"Only permit calibration triggers, used for debugging traclets and their digits, maybe other uses."}},
44 {"sortDigits", VariantType::Bool, false, {"Sort the digits in det/row/col (tracklets are always sorted)"}},
45 {"detailed-link-stats", VariantType::Bool, false, {"Collect link statistics per trigger"}},
46 {"tracklethcheader", VariantType::Int, 2, {"Status of TrackletHalfChamberHeader 0 off always, 1 iff tracklet data, 2 on always"}},
47 {"disable-stats", VariantType::Bool, false, {"Do not generate stat messages for qc"}},
48 {"disable-root-output", VariantType::Bool, false, {"Do not write the digits and tracklets to file"}},
49 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}};
50 std::swap(workflowOptions, options);
51}
52
53#include "Framework/runDataProcessing.h" // the main driver
54
55using namespace o2::framework;
58{
59
60 o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
61
62 auto askSTFDist = !cfgc.options().get<bool>("ignore-dist-stf");
63 auto tracklethcheader = cfgc.options().get<int>("tracklethcheader");
64 auto halfchamberwords = cfgc.options().get<int>("halfchamberwords");
65 auto halfchambermajor = cfgc.options().get<int>("halfchambermajor");
66
67 std::vector<OutputSpec> outputs;
68 outputs.emplace_back("TRD", "TRACKLETS", 0, Lifetime::Timeframe);
69 outputs.emplace_back("TRD", "DIGITS", 0, Lifetime::Timeframe);
70 outputs.emplace_back("TRD", "TRKTRGRD", 0, Lifetime::Timeframe);
71
72 std::bitset<16> binaryoptions;
73 binaryoptions[o2::trd::TRDVerboseBit] = cfgc.options().get<bool>("verbose");
74 binaryoptions[o2::trd::TRDVerboseErrorsBit] = cfgc.options().get<bool>("verboseerrors");
75 binaryoptions[o2::trd::TRDIgnore2StageTrigger] = cfgc.options().get<bool>("fixforoldtrigger");
76 binaryoptions[o2::trd::TRDGenerateStats] = !cfgc.options().get<bool>("disable-stats");
77 binaryoptions[o2::trd::TRDOnlyCalibrationTriggerBit] = cfgc.options().get<bool>("onlycalibrationtrigger");
78 binaryoptions[o2::trd::TRDSortDigits] = cfgc.options().get<bool>("sortDigits");
79 binaryoptions[o2::trd::TRDLinkStats] = cfgc.options().get<bool>("detailed-link-stats");
80 AlgorithmSpec algoSpec;
81 algoSpec = AlgorithmSpec{adaptFromTask<o2::trd::DataReaderTask>(tracklethcheader, halfchamberwords, halfchambermajor, binaryoptions)};
82 if (binaryoptions[o2::trd::TRDGenerateStats]) {
83 outputs.emplace_back("TRD", "RAWSTATS", 0, Lifetime::Timeframe);
84 }
85 if (binaryoptions[o2::trd::TRDLinkStats]) {
86 outputs.emplace_back("TRD", "LINKSTATS", 0, Lifetime::Timeframe);
87 }
88
89 WorkflowSpec workflow;
90
91 auto inputs = o2::framework::select(std::string("x:TRD/RAWDATA").c_str());
92 if (askSTFDist) {
93 inputs.emplace_back("stdDist", "FLP", "DISTSUBTIMEFRAME", 0, Lifetime::Timeframe);
94 }
95 inputs.emplace_back("trigoffset", "CTP", "Trig_Offset", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec("CTP/Config/TriggerOffsets"));
96 inputs.emplace_back("linkToHcid", "TRD", "LinkToHcid", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec("TRD/Config/LinkToHCIDMapping"));
97 workflow.emplace_back(DataProcessorSpec{
98 std::string("trd-datareader"), // left as a string cast incase we append stuff to the string
99 inputs,
100 outputs,
101 algoSpec,
102 Options{{"log-max-errors", VariantType::Int, 20, {"maximum number of errors to log"}},
103 {"log-max-warnings", VariantType::Int, 20, {"maximum number of warnings to log"}},
104 {"number-of-TBs", VariantType::Int, -1, {"set to >=0 in order to overwrite number of time bins"}},
105 {"every-nth-tf", VariantType::Int, 1, {"process only every n-th TF"}}}});
106
107 if (!cfgc.options().get<bool>("disable-root-output")) {
108 workflow.emplace_back(o2::trd::getTRDDigitWriterSpec(false, false));
109 workflow.emplace_back(o2::trd::getTRDTrackletWriterSpec(false));
110 if (binaryoptions[o2::trd::TRDGenerateStats]) {
111 workflow.emplace_back(o2::trd::getTRDRawStatWriterSpec(binaryoptions[o2::trd::TRDLinkStats]));
112 }
113 }
114
115 return workflow;
116}
TRD epn task to read incoming data.
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
This function hooks up the the workflow specifications into the DPL driver.
void customize(std::vector< ConfigParamSpec > &workflowOptions)
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< DataProcessorSpec > WorkflowSpec
std::vector< InputSpec > select(char const *matcher="")
o2::framework::DataProcessorSpec getTRDDigitWriterSpec(bool mctruth=true, bool inpFromDigitizer=true)
o2::framework::DataProcessorSpec getTRDTrackletWriterSpec(bool useMC)
@ TRDVerboseErrorsBit
@ TRDGenerateStats
@ TRDOnlyCalibrationTriggerBit
@ TRDIgnore2StageTrigger
framework::DataProcessorSpec getTRDRawStatWriterSpec(bool linkStats)
writer for TRD raw data statistics