Skip to content

Commit

Permalink
option to store dia TOF calib directly from digits
Browse files Browse the repository at this point in the history
  • Loading branch information
noferini committed Feb 6, 2024
1 parent f4af221 commit 33225c5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "DetectorsRaw/HBFUtilsInitializer.h"
#include "Framework/CallbacksPolicy.h"
#include "Framework/CompletionPolicyHelpers.h"
#include "TOFWorkflowIO/TOFCalibWriterSpec.h"

#include <string>
#include <stdexcept>
Expand Down Expand Up @@ -71,6 +72,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{"orbits-per-tf", VariantType::Int, -1, {"default(-1) from GRP/CCDB, a valid value is required to run compressor for epn"}},
{"calib-cluster", VariantType::Bool, false, {"to enable calib info production from clusters"}},
{"for-calib", VariantType::Bool, false, {"to disable check on problematic, otherwise masked for new calibrations"}},
{"calib-dia", VariantType::Bool, false, {"enabling writing calib for diagnostics"}},
{"cosmics", VariantType::Bool, false, {"to enable cosmics utils"}}};
o2::raw::HBFUtilsInitializer::addConfigOption(options);
std::swap(workflowOptions, options);
Expand Down Expand Up @@ -147,6 +149,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
auto orbitPerTF = cfgc.options().get<int>("orbits-per-tf");
auto ccdb_url = o2::base::NameConf::getCCDBServer();
auto isForCalib = cfgc.options().get<bool>("for-calib");
auto writingDia = cfgc.options().get<bool>("calib-dia");

LOG(debug) << "TOF RECO WORKFLOW configuration";
LOG(debug) << "TOF input = " << cfgc.options().get<std::string>("input-type");
Expand Down Expand Up @@ -205,6 +208,10 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
}
}

if (writingDia) {
specs.emplace_back(o2::tof::getTOFCalibWriterSpec("o2calib_tof.root", false, true, true));
}

LOG(debug) << "Number of active devices = " << specs.size();

// configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace tof

/// create a processor spec
/// write TOF calbi info in a root file
o2::framework::DataProcessorSpec getTOFCalibWriterSpec(const char* outdef = "o2calib_tof.root", bool toftpc = false, bool addDia = false);
o2::framework::DataProcessorSpec getTOFCalibWriterSpec(const char* outdef = "o2calib_tof.root", bool toftpc = false, bool addDia = false, bool onlyDia = false);

} // namespace tof
} // namespace o2
Expand Down
7 changes: 5 additions & 2 deletions Detectors/TOF/workflowIO/src/TOFCalibWriterSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ template <typename T>
using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition<T>;
using CalibInfosType = std::vector<o2::dataformats::CalibInfoTOF>;
using CalibDiaType = o2::tof::Diagnostic;
DataProcessorSpec getTOFCalibWriterSpec(const char* outdef, bool toftpc, bool addDia)
DataProcessorSpec getTOFCalibWriterSpec(const char* outdef, bool toftpc, bool addDia, bool onlyDia)
{
if (!addDia) {
onlyDia = false;
}
// A spectator for logging
auto logger = [](CalibInfosType const& indata) {
LOG(debug) << "RECEIVED MATCHED SIZE " << indata.size();
Expand All @@ -55,7 +58,7 @@ DataProcessorSpec getTOFCalibWriterSpec(const char* outdef, bool toftpc, bool ad
BranchDefinition<CalibInfosType>{InputSpec{"input", o2::header::gDataOriginTOF, ddCalib, 0},
"TOFCalibInfo",
"calibinfo-branch-name",
1,
!onlyDia,
logger},
BranchDefinition<CalibDiaType>{InputSpec{"inputDia", o2::header::gDataOriginTOF, ddCalibDia, 0},
"TOFDiaInfo",
Expand Down

0 comments on commit 33225c5

Please sign in to comment.