Skip to content

Commit 87c82bd

Browse files
pillotalcaliva
authored andcommitted
add option to change digit labels data description (#13626)
1 parent 253d920 commit 87c82bd

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Detectors/MUON/MCH/IO/include/MCHIO/DigitWriterSpec.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ o2::framework::DataProcessorSpec getDigitWriterSpec(
2525
std::string_view specName = "mch-digit-writer",
2626
std::string_view outfile = "mchdigits.root",
2727
std::string_view inputDigitDataDescription = "DIGITS",
28-
std::string_view inputDigitRofDataDescription = "DIGITROFS");
28+
std::string_view inputDigitRofDataDescription = "DIGITROFS",
29+
std::string_view inputDigitLabelDataDescription = "DIGITLABELS");
2930

3031
} // end namespace mch
3132
} // end namespace o2

Detectors/MUON/MCH/IO/src/DigitWriterSpec.cxx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,33 +38,32 @@ o2::framework::DataProcessorSpec getMCHDigitWriterSpec(bool mctruth)
3838
1, // default number of events
3939
BranchDefinition<std::vector<o2::mch::Digit>>{InputSpec{"mchdigits", "MCH", "DIGITS"}, "MCHDigit"},
4040
BranchDefinition<std::vector<o2::mch::ROFRecord>>{InputSpec{"mchrofrecords", "MCH", "DIGITROFS"}, "MCHROFRecords"},
41-
BranchDefinition<o2::dataformats::MCTruthContainer<o2::MCCompLabel>>{InputSpec{"mchdigitlabels", "MCH", "DIGITSLABELS"}, "MCHMCLabels", mctruth ? 1 : 0}
42-
// add more branch definitions (for example Monte Carlo labels here)
43-
)();
41+
BranchDefinition<o2::dataformats::MCTruthContainer<o2::MCCompLabel>>{InputSpec{"mchdigitlabels", "MCH", "DIGITSLABELS"}, "MCHMCLabels", mctruth ? 1 : 0})();
4442
}
4543

4644
o2::framework::DataProcessorSpec getDigitWriterSpec(
4745
bool useMC,
4846
std::string_view specName,
4947
std::string_view outfile,
5048
std::string_view inputDigitDataDescription,
51-
std::string_view inputDigitRofDataDescription)
49+
std::string_view inputDigitRofDataDescription,
50+
std::string_view inputDigitLabelDataDescription)
5251
{
5352
std::string input =
54-
fmt::format("digits:MCH/{};rofs:MCH/{}",
55-
inputDigitDataDescription, inputDigitRofDataDescription);
53+
fmt::format("digits:MCH/{};rofs:MCH/{};labels:MCH/{}",
54+
inputDigitDataDescription, inputDigitRofDataDescription, inputDigitLabelDataDescription);
5655

5756
framework::Inputs inputs{framework::select(input.c_str())};
5857
auto rofs = std::find_if(inputs.begin(), inputs.end(), [](const framework::InputSpec& is) { return is.binding == "rofs"; });
5958
auto digits = std::find_if(inputs.begin(), inputs.end(), [](const framework::InputSpec& is) { return is.binding == "digits"; });
59+
auto labels = std::find_if(inputs.begin(), inputs.end(), [](const framework::InputSpec& is) { return is.binding == "labels"; });
6060
return framework::MakeRootTreeWriterSpec(
6161
std::string(specName).c_str(),
6262
std::string(outfile).c_str(),
6363
framework::MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree MCH Digits"},
6464
BranchDefinition<std::vector<ROFRecord>>{framework::InputSpec{*rofs}, "MCHROFRecords"},
6565
BranchDefinition<std::vector<Digit>>{framework::InputSpec{*digits}, "MCHDigit"},
66-
BranchDefinition<o2::dataformats::MCTruthContainer<o2::MCCompLabel>>{
67-
framework::InputSpec{"mchdigitlabels", "MCH", "DIGITSLABELS"}, "MCHMCLabels", useMC ? 1 : 0})();
66+
BranchDefinition<o2::dataformats::MCTruthContainer<o2::MCCompLabel>>{framework::InputSpec{*labels}, "MCHMCLabels", useMC ? 1 : 0})();
6867
}
6968

7069
} // end namespace mch

Detectors/MUON/MCH/IO/src/digits-writer-workflow.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
4747
{
4848
workflowOptions.emplace_back(ConfigParamSpec{"input-digits-data-description", VariantType::String, "DIGITS", {"description string for the input digits data"}});
4949
workflowOptions.emplace_back(ConfigParamSpec{"input-digitrofs-data-description", VariantType::String, "DIGITROFS", {"description string for the input digit rofs data"}});
50+
workflowOptions.emplace_back(ConfigParamSpec{"input-digitlabels-data-description", VariantType::String, "DIGITLABELS", {"description string for the input digit labels data"}});
5051
workflowOptions.emplace_back(ConfigParamSpec{"enable-mc", VariantType::Bool, false, {" output MC labels if available "}});
5152
workflowOptions.emplace_back(ConfigParamSpec{"mch-digit-outfile", VariantType::String, "mchdigits.root", {"name of digit root file"}});
5253
}
@@ -65,5 +66,6 @@ WorkflowSpec defineDataProcessing(const ConfigContext& cc)
6566
name,
6667
cc.options().get<std::string>("mch-digit-outfile"),
6768
cc.options().get<std::string>("input-digits-data-description"),
68-
cc.options().get<std::string>("input-digitrofs-data-description"))};
69+
cc.options().get<std::string>("input-digitrofs-data-description"),
70+
cc.options().get<std::string>("input-digitlabels-data-description"))};
6971
}

0 commit comments

Comments
 (0)