diff --git a/Detectors/GlobalTrackingWorkflow/tofworkflow/src/tof-reco-workflow.cxx b/Detectors/GlobalTrackingWorkflow/tofworkflow/src/tof-reco-workflow.cxx index e16145b33113e..7c8e41a92f931 100644 --- a/Detectors/GlobalTrackingWorkflow/tofworkflow/src/tof-reco-workflow.cxx +++ b/Detectors/GlobalTrackingWorkflow/tofworkflow/src/tof-reco-workflow.cxx @@ -32,6 +32,7 @@ #include "DetectorsRaw/HBFUtilsInitializer.h" #include "Framework/CallbacksPolicy.h" #include "Framework/CompletionPolicyHelpers.h" +#include "TOFWorkflowIO/TOFCalibWriterSpec.h" #include #include @@ -71,6 +72,7 @@ void customize(std::vector& 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); @@ -147,6 +149,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) auto orbitPerTF = cfgc.options().get("orbits-per-tf"); auto ccdb_url = o2::base::NameConf::getCCDBServer(); auto isForCalib = cfgc.options().get("for-calib"); + auto writingDia = cfgc.options().get("calib-dia"); LOG(debug) << "TOF RECO WORKFLOW configuration"; LOG(debug) << "TOF input = " << cfgc.options().get("input-type"); @@ -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 diff --git a/Detectors/TOF/workflowIO/include/TOFWorkflowIO/TOFCalibWriterSpec.h b/Detectors/TOF/workflowIO/include/TOFWorkflowIO/TOFCalibWriterSpec.h index 658b457fe4c4f..6712532a3582b 100644 --- a/Detectors/TOF/workflowIO/include/TOFWorkflowIO/TOFCalibWriterSpec.h +++ b/Detectors/TOF/workflowIO/include/TOFWorkflowIO/TOFCalibWriterSpec.h @@ -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 diff --git a/Detectors/TOF/workflowIO/src/DigitReaderSpec.cxx b/Detectors/TOF/workflowIO/src/DigitReaderSpec.cxx index 30ddea9d5b9e7..6986d88f06912 100644 --- a/Detectors/TOF/workflowIO/src/DigitReaderSpec.cxx +++ b/Detectors/TOF/workflowIO/src/DigitReaderSpec.cxx @@ -21,6 +21,7 @@ #include "TOFWorkflowIO/DigitReaderSpec.h" #include "DataFormatsParameters/GRPObject.h" #include "CommonUtils/NameConf.h" +#include "DetectorsBase/TFIDInfoHelper.h" using namespace o2::framework; using namespace o2::tof; @@ -79,6 +80,12 @@ void DigitReader::run(ProcessingContext& pc) mFiller.setReadoutWindowData(mRow, mPatterns); mFiller.fillDiagnosticFrequency(); mDiagnostic = mFiller.getDiagnosticFrequency(); + auto creationTime = pc.services().get().creation; + mDiagnostic.setTimeStamp(creationTime / 1000); + // add TFIDInfo + o2::dataformats::TFIDInfo tfinfo; + o2::base::TFIDInfoHelper::fillTFIDInfo(pc, tfinfo); + mDiagnostic.setTFIDInfo(tfinfo); // add digits loaded in the output snapshot pc.outputs().snapshot(Output{o2::header::gDataOriginTOF, "DIGITS", 0}, mDigits); diff --git a/Detectors/TOF/workflowIO/src/TOFCalibWriterSpec.cxx b/Detectors/TOF/workflowIO/src/TOFCalibWriterSpec.cxx index ff1df0cf8193d..75fa3218e2e85 100644 --- a/Detectors/TOF/workflowIO/src/TOFCalibWriterSpec.cxx +++ b/Detectors/TOF/workflowIO/src/TOFCalibWriterSpec.cxx @@ -37,8 +37,11 @@ template using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition; using CalibInfosType = std::vector; 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(); @@ -55,7 +58,7 @@ DataProcessorSpec getTOFCalibWriterSpec(const char* outdef, bool toftpc, bool ad BranchDefinition{InputSpec{"input", o2::header::gDataOriginTOF, ddCalib, 0}, "TOFCalibInfo", "calibinfo-branch-name", - 1, + !onlyDia, logger}, BranchDefinition{InputSpec{"inputDia", o2::header::gDataOriginTOF, ddCalibDia, 0}, "TOFDiaInfo",