Skip to content

Commit 83ba2d0

Browse files
authored
Merge pull request #7472 from lietava/ctpdev
Ctpdev:digi2raw and ctp-raw-recoder fixes
1 parent 814b989 commit 83ba2d0

8 files changed

Lines changed: 18 additions & 98 deletions

File tree

Detectors/CTP/simulation/src/Digits2Raw.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ void Digits2Raw::init()
3939
// Interaction Record
4040
int ilink = 0;
4141
uint64_t feeID = getFEEIDIR();
42-
std::string outFileLink0 = mOutputPerLink ? fmt::format("{}{}_feeid{}.raw", outd, mCTPRawDataFileName, feeID) : fmt::format("{}{}.raw", outd, mCTPRawDataFileName, feeID);
42+
std::string outFileLink0 = mOutputPerLink ? fmt::format("{}{}_feeid{}.raw", outd, mCTPRawDataFileName, feeID) : fmt::format("{}{}.raw", outd, mCTPRawDataFileName);
4343
mWriter.registerLink(feeID, mCruID, ilink, mEndPointID, outFileLink0);
4444
// Trigger Class record
4545
ilink = 1;
4646
feeID = getFEEIDTC();
47-
std::string outFileLink1 = mOutputPerLink ? fmt::format("{}{}_feeid{}.raw", outd, mCTPRawDataFileName, feeID) : fmt::format("{}{}.raw", outd, mCTPRawDataFileName, feeID);
47+
std::string outFileLink1 = mOutputPerLink ? fmt::format("{}{}_feeid{}.raw", outd, mCTPRawDataFileName, feeID) : fmt::format("{}{}.raw", outd, mCTPRawDataFileName);
4848
mWriter.registerLink(feeID, mCruID, ilink, mEndPointID, outFileLink1);
4949
// ilink = 2: HBMap, Counters - tbd
5050
mWriter.setEmptyPageCallBack(this);

Detectors/CTP/simulation/src/digi2raw.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "DataFormatsParameters/GRPObject.h"
2727
namespace bpo = boost::program_options;
2828

29-
void digi2raw(const std::string& inpName, const std::string& outDir, int verbosity, bool filePerLink, uint32_t rdhV = 4, bool noEmptyHBF = false,
29+
void digi2raw(const std::string& inpName, const std::string& outDir, int verbosity, const std::string& fileForLink, uint32_t rdhV = 4, bool noEmptyHBF = false,
3030
int superPageSizeInB = 1024 * 1024);
3131

3232
int main(int argc, char** argv)
@@ -44,7 +44,7 @@ int main(int argc, char** argv)
4444
add_option("verbosity,v", bpo::value<int>()->default_value(0), "verbosity level");
4545
// add_option("input-file,i", bpo::value<std::string>()->default_value(o2::base::NameConf::getDigitsFileName(o2::detectors::DetID::CTP)),"input CTP digits file"); // why not used?
4646
add_option("input-file,i", bpo::value<std::string>()->default_value("ctpdigits.root"), "input CTP digits file");
47-
add_option("file-per-link,l", bpo::value<bool>()->default_value(false)->implicit_value(true), "create output file per CRU (default: per layer)");
47+
add_option("file-for,f", bpo::value<std::string>()->default_value("all"), "single file per: all,link,cru");
4848
add_option("output-dir,o", bpo::value<std::string>()->default_value("./"), "output directory for raw data");
4949
uint32_t defRDH = o2::raw::RDHUtils::getVersion<o2::header::RAWDataHeader>();
5050
add_option("rdh-version,r", bpo::value<uint32_t>()->default_value(defRDH), "RDH version to use");
@@ -79,7 +79,7 @@ int main(int argc, char** argv)
7979
digi2raw(vm["input-file"].as<std::string>(),
8080
vm["output-dir"].as<std::string>(),
8181
vm["verbosity"].as<int>(),
82-
vm["file-per-link"].as<bool>(),
82+
vm["file-for"].as<std::string>(),
8383
vm["rdh-version"].as<uint32_t>(),
8484
vm["no-empty-hbf"].as<bool>());
8585

@@ -88,12 +88,12 @@ int main(int argc, char** argv)
8888
return 0;
8989
}
9090

91-
void digi2raw(const std::string& inpName, const std::string& outDir, int verbosity, bool filePerLink, uint32_t rdhV, bool noEmptyHBF, int superPageSizeInB)
91+
void digi2raw(const std::string& inpName, const std::string& outDir, int verbosity, const std::string& fileForLink, uint32_t rdhV, bool noEmptyHBF, int superPageSizeInB)
9292
{
9393
TStopwatch swTot;
9494
swTot.Start();
9595
o2::ctp::Digits2Raw m2r;
96-
m2r.setFilePerLink(filePerLink);
96+
m2r.setFilePerLink(fileForLink == "link");
9797
m2r.setVerbosity(verbosity);
9898
auto& wr = m2r.getWriter();
9999
std::string inputGRP = o2::base::NameConf::getGRPFileName();

Detectors/CTP/workflow/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ o2_add_library(CTPWorkflow
2323
O2::CTPWorkflowIO)
2424
o2_add_executable(reco-workflow
2525
COMPONENT_NAME ctp
26-
SOURCES src/ctp-reco-workflow.cxx
26+
SOURCES src/ctp-raw-decoder.cxx
2727
PUBLIC_LINK_LIBRARIES O2::Algorithm
2828
O2::CTPWorkflow)
2929

3030
o2_add_executable(entropy-encoder-workflow
3131
COMPONENT_NAME ctp
3232
SOURCES src/entropy-encoder-workflow.cxx
33-
PUBLIC_LINK_LIBRARIES O2::CTPWorkflow)
33+
PUBLIC_LINK_LIBRARIES O2::CTPWorkflow)

Detectors/CTP/workflow/include/CTPWorkflow/RecoWorkflow.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,9 @@ namespace ctp
2525
namespace reco_workflow
2626
{
2727

28-
/// define input and output types of the workflow
29-
enum struct InputType { Digits, // read digits from file
30-
Raw // read data in raw page format from file
31-
};
32-
enum struct OutputType { Digits,
33-
Raw
34-
};
35-
3628
/// create the workflow for CTP reconstruction
37-
framework::WorkflowSpec getWorkflow(bool disableRootInp,
38-
bool disableRootOut,
39-
bool propagateMC = true,
40-
bool noLostTF = false,
41-
std::string const& cfgInput = "raw", //
42-
std::string const& cfgOutput = "digits" //
43-
);
29+
framework::WorkflowSpec getWorkflow(bool noLostTF);
30+
4431
} // namespace reco_workflow
4532

4633
} // namespace ctp

Detectors/CTP/workflow/src/RecoWorkflow.cxx

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,10 @@
1515

1616
#include "FairLogger.h"
1717

18-
#include "Framework/RootSerializationSupport.h"
19-
#include "Algorithm/RangeTokenizer.h"
20-
#include "DPLUtils/MakeRootTreeWriterSpec.h"
2118
#include "DataFormatsCTP/Digits.h"
22-
#include "SimulationDataFormat/MCCompLabel.h"
2319
#include "CTPWorkflow/RecoWorkflow.h"
24-
#include "CTPWorkflowIO/DigitReaderSpec.h"
25-
#include "CTPWorkflowIO/DigitWriterSpec.h"
2620
#include "CTPWorkflow/RawToDigitConverterSpec.h"
2721
#include "Framework/DataSpecUtils.h"
28-
#include "SimulationDataFormat/MCTruthContainer.h"
29-
30-
using namespace o2::dataformats;
3122

3223
namespace o2
3324
{
@@ -38,57 +29,10 @@ namespace ctp
3829
namespace reco_workflow
3930
{
4031

41-
const std::unordered_map<std::string, InputType> InputMap{
42-
{"raw", InputType::Raw},
43-
{"digits", InputType::Digits}};
44-
45-
const std::unordered_map<std::string, OutputType> OutputMap{
46-
{"digits", OutputType::Digits}};
47-
48-
o2::framework::WorkflowSpec getWorkflow(bool disableRootInp,
49-
bool disableRootOut,
50-
bool propagateMC,
51-
bool noLostTF,
52-
std::string const& cfgInput,
53-
std::string const& cfgOutput)
32+
o2::framework::WorkflowSpec getWorkflow(bool noLostTF)
5433
{
55-
InputType inputType;
56-
57-
try {
58-
inputType = InputMap.at(cfgInput);
59-
} catch (std::out_of_range&) {
60-
throw std::invalid_argument(std::string("invalid input type: ") + cfgInput);
61-
}
62-
std::vector<OutputType> outputTypes;
63-
try {
64-
outputTypes = RangeTokenizer::tokenize<OutputType>(cfgOutput, [](std::string const& token) { return OutputMap.at(token); });
65-
} catch (std::out_of_range&) {
66-
throw std::invalid_argument(std::string("invalid output type: ") + cfgOutput);
67-
}
68-
auto isEnabled = [&outputTypes](OutputType type) {
69-
return std::find(outputTypes.begin(), outputTypes.end(), type) != outputTypes.end();
70-
};
71-
7234
o2::framework::WorkflowSpec specs;
73-
74-
// //Raw to ....
75-
if (inputType == InputType::Raw) {
76-
//no explicit raw reader
77-
78-
if (isEnabled(OutputType::Digits)) {
79-
specs.emplace_back(o2::ctp::reco_workflow::getRawToDigitConverterSpec(noLostTF));
80-
if (!disableRootOut) {
81-
specs.emplace_back(o2::ctp::getDigitWriterSpec(true));
82-
}
83-
}
84-
}
85-
86-
// Digits to ....
87-
if (inputType == InputType::Digits) {
88-
if (!disableRootInp) {
89-
specs.emplace_back(o2::ctp::getDigitsReaderSpec(propagateMC));
90-
}
91-
}
35+
specs.emplace_back(o2::ctp::reco_workflow::getRawToDigitConverterSpec(noLostTF));
9236
return std::move(specs);
9337
}
9438

Detectors/CTP/workflow/src/ctp-reco-workflow.cxx renamed to Detectors/CTP/workflow/src/ctp-raw-decoder.cxx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,8 @@
2828
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
2929
{
3030
std::vector<o2::framework::ConfigParamSpec> options{
31-
{"input-type", o2::framework::VariantType::String, "raw", {"digits, raw"}},
32-
{"output-type", o2::framework::VariantType::String, "digits", {"digits, raw"}},
33-
{"disable-mc", o2::framework::VariantType::Bool, false, {"disable sending of MC information"}},
34-
{"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
35-
{"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
36-
{"configKeyValues", o2::framework::VariantType::String, "", {"Semicolon separated key=value strings ..."}},
37-
{"ignore-dist-stf", o2::framework::VariantType::Bool, false, {"do not subscribe to FLP/DISTSUBTIMEFRAME/0 message (no lost TF recovery)"}}};
31+
{"ignore-dist-stf", o2::framework::VariantType::Bool, false, {"do not subscribe to FLP/DISTSUBTIMEFRAME/0 message (no lost TF recovery)"}},
32+
{"configKeyValues", o2::framework::VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
3833
o2::raw::HBFUtilsInitializer::addConfigOption(options);
3934
std::swap(workflowOptions, options);
4035
}
@@ -58,13 +53,7 @@ o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext co
5853
// Update the (declared) parameters if changed from the command line
5954
o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
6055

61-
auto wf = o2::ctp::reco_workflow::getWorkflow(cfgc.options().get<bool>("disable-root-input"),
62-
cfgc.options().get<bool>("disable-root-output"),
63-
!cfgc.options().get<bool>("disable-mc"),
64-
!cfgc.options().get<bool>("ignore-dist-stf"), //
65-
cfgc.options().get<std::string>("input-type"), //
66-
cfgc.options().get<std::string>("output-type") //
67-
);
56+
auto wf = o2::ctp::reco_workflow::getWorkflow(!cfgc.options().get<bool>("ignore-dist-stf"));
6857
// configure dpl timer to inject correct firstTFOrbit: start from the 1st orbit of TF containing 1st sampled orbit
6958
o2::raw::HBFUtilsInitializer hbfIni(cfgc, wf);
7059
return std::move(wf);

prodtests/full-system-test/dpl-workflow.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ if [ $CTFINPUT == 0 ]; then
366366
has_detector TRD && add_W o2-trd-datareader "$TRD_DECODER_OPTIONS --pipeline $(get_N trd-datareader TRD RAW TRDRAWDEC)" "" 0
367367
has_detector ZDC && add_W o2-zdc-raw2digits "$DISABLE_ROOT_OUTPUT --pipeline $(get_N zdc-datareader-dpl ZDC RAW)"
368368
has_detector HMP && add_W o2-hmpid-raw-to-digits-stream-workflow "--pipeline $(get_N HMP-RawStreamDecoder HMP RAW)"
369-
has_detector CTP && add_W o2-ctp-reco-workflow "$DISABLE_ROOT_OUTPUT --pipeline $(get_N CTP-RawStreamDecoder CTP RAW)"
369+
has_detector CTP && add_W o2-ctp-reco-workflow "--pipeline $(get_N CTP-RawStreamDecoder CTP RAW)"
370370
has_detector PHS && ! has_detector_flp_processing PHS && add_W o2-phos-reco-workflow "--input-type raw --output-type cells --disable-root-input $DISABLE_ROOT_OUTPUT --pipeline $(get_N PHOSRawToCellConverterSpec PHS REST) $DISABLE_MC"
371371
has_detector CPV && add_W o2-cpv-reco-workflow "--input-type $CPV_INPUT --output-type clusters --disable-root-input $DISABLE_ROOT_OUTPUT --pipeline $(get_N CPVRawToDigitConverterSpec CPV REST),$(get_N CPVClusterizerSpec CPV REST) $DISABLE_MC"
372372
has_detector EMC && ! has_detector_flp_processing EMC && add_W o2-emcal-reco-workflow "--input-type raw --output-type cells $EMCRAW2C_CONFIG $DISABLE_ROOT_OUTPUT $DISABLE_MC --pipeline $(get_N EMCALRawToCellConverterSpec EMC REST EMCREC)"

prodtests/full_system_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ taskwrapper cpvraw.log o2-cpv-digi2raw --file-for cru -o raw/CPV
130130
taskwrapper zdcraw.log o2-zdc-digi2raw --file-for cru -o raw/ZDC
131131
taskwrapper hmpraw.log o2-hmpid-digits-to-raw-workflow --file-for cru --outdir raw/HMP
132132
taskwrapper trdraw.log o2-trd-trap2raw -o raw/TRD --fileper halfcru
133-
taskwrapper ctpraw.log o2-ctp-digi2raw -o raw/CTP --file-per-link
133+
taskwrapper ctpraw.log o2-ctp-digi2raw -o raw/CTP --file-for cru
134134

135135
cat raw/*/*.cfg > rawAll.cfg
136136

0 commit comments

Comments
 (0)