diff --git a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/FEEConfig.h b/DataFormats/Detectors/ZDC/include/DataFormatsZDC/FEEConfig.h deleted file mode 100644 index b084507b84519..0000000000000 --- a/DataFormats/Detectors/ZDC/include/DataFormatsZDC/FEEConfig.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -// DataFormats/Detectors/ZDC/include/DataFormatsZDC/RawEventData.h - -#include "ZDCBase/Constants.h" - -#ifndef ALICEO2_ZDC_FEECONFIG_H -#define ALICEO2_ZDC_FEECONFIG_H - -/// \file FEEConfig.h -/// \brief ZDC FEE configuration -/// \author pietro.cortese@cern.ch - -namespace o2 -{ -namespace zdc -{ - -struct FEEFillingMap { - uint64_t filling[56]; -}; - -struct FEEConfigMap { - uint32_t address[5 * NChPerModule + 3] = {0, 1, 2, 3, - 4, 5, 6, 7, - 8, 9, 10, 11, - 12, 13, 14, 15, - 16, 17, 18, 19, - 76, 77, 78}; - uint64_t delay_sample[NChPerModule] = {6, 6, 6, 6}; // 4 bits - uint64_t delay_coarse[NChPerModule] = {200, 200, 200, 200}; // 8 bits - uint64_t threshold_level[NChPerModule] = {10, 10, 10, 10}; // 12 bits - uint64_t difference_delta[NChPerModule] = {4, 4, 4, 4}; // 3 bits - uint64_t masking_difference[NChPerModule] = {0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00}; // 24 bits - uint64_t masking_alicet = 0x00000010; // 32 bits - uint64_t masking_autot = 0xf; // 4 bits - uint64_t masking_readout = 0xf; // 4 bits -}; - -} // namespace zdc -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/calib/testWorkflow/DataGeneratorSpec.h b/Detectors/ZDC/calib/testWorkflow/DataGeneratorSpec.h deleted file mode 100644 index 22761869f6ff2..0000000000000 --- a/Detectors/ZDC/calib/testWorkflow/DataGeneratorSpec.h +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef O2_CALIBRATION_DATAGENERATOR_H -#define O2_CALIBRATION_DATAGENERATOR_H - -/// @file DataGeneratorSpec.h -/// @brief Dummy data generator - -#include -#include -#include "Framework/DeviceSpec.h" -#include "Framework/ConfigParamRegistry.h" -#include "Framework/ControlService.h" -#include "Framework/WorkflowSpec.h" -#include "Framework/Task.h" -#include "Framework/Logger.h" -#include "DataFormatsZDC/CalibInfoZDC.h" -#include "ZDCBase/Constants.h" -#include "CommonConstants/MathConstants.h" - -namespace o2 -{ -namespace calibration -{ - -class TFDispatcher : public o2::framework::Task -{ - public: - TFDispatcher(int slot, int ngen, int nlanes, int latency) : mSlot(slot), mNGen(ngen), mNLanes(nlanes), mLatency(latency) {} - - void init(o2::framework::InitContext& ic) final - { - mMaxTF = ic.options().get("max-timeframes"); - } - - void run(o2::framework::ProcessingContext& pc) final - { - for (auto& input : pc.inputs()) { - auto tfid = header::get(input.header)->startTime; - if (tfid >= mMaxTF - 1) { - LOG(info) << "Data generator reached TF " << tfid << ", stopping"; - pc.services().get().endOfStream(); - pc.services().get().readyToQuit(o2::framework::QuitRequest::Me); - if (!acceptTF(tfid)) { - return; - } - break; - } - if (!acceptTF(tfid)) { - return; - } - } - int size = 100 + gRandom->Integer(100); // push dummy output - usleep(mLatency); - pc.outputs().snapshot(o2::framework::OutputRef{"output", 0}, size); - } - - bool acceptTF(int tfid) - { - - // check if the current TF should be processed by this instance of the generator - - int targetSlot = (tfid / mNLanes) % mNGen; - if (targetSlot != mSlot) { - LOG(info) << "tfid = " << tfid << ", mNLanes = " << mNLanes << ", mNGen = " << mNGen << ", mSlot = " << mSlot << " target slot = " << targetSlot << ": discarded"; - return false; - } - LOG(info) << "tfid = " << tfid << ", mNLanes = " << mNLanes << ", mNGen = " << mNGen << ", mSlot = " << mSlot << " target slot = " << targetSlot << ": accepted"; - return true; - } - - private: - uint64_t mMaxTF = 1; - int mSlot = 1; - int mNGen = 1; - int mNLanes = 1; - int mLatency = 0; -}; - -class TFProcessor : public o2::framework::Task -{ - public: - TFProcessor(int latency, int latencyRMS) : mMeanLatency(latency), mLatencyRMS(latencyRMS){}; - - void init(o2::framework::InitContext& ic) final - { - mDevCopy = ic.services().get().inputTimesliceId; - gRandom->SetSeed(mDevCopy); - mZDCChannelCalib = ic.options().get("do-ZDC-channel-calib"); - mZDCChannelCalibInTestMode = ic.options().get("do-ZDC-channel-calib-in-test-mode"); - LOG(info) << "TFProcessorCopy: " << mDevCopy << " MeanLatency: " << mMeanLatency << " LatencyRMS: " << mLatencyRMS << " DoZDCChannelCalib: " << mZDCChannelCalib - << " DoZDCChannelCalibInTestMode: " << mZDCChannelCalibInTestMode; - } - - void run(o2::framework::ProcessingContext& pc) final - { - auto tfcounter = o2::header::get(pc.inputs().get("input").header)->startTime; - // introduceDelay - uint32_t delay = std::abs(gRandom->Gaus(mMeanLatency, mLatencyRMS)); - LOG(info) << "TFProcessorCopy: " << mDevCopy << " Simulate latency of " << delay << " mcs for TF " << tfcounter; - usleep(delay); - - // push dummy output - auto size = pc.inputs().get("input"); - auto& output = pc.outputs().make>(o2::framework::OutputRef{"output", 0}); - output.reserve(size); - - for (int i = size; i--;) { - if (!mZDCChannelCalib) { - output.emplace_back(gRandom->Integer(32), 0, gRandom->Gaus(clockShift, 100.), 0, 0); - } else { - int channel = mZDCChannelCalibInTestMode ? gRandom->Integer(100) : gRandom->Integer(32); - double tot = gRandom->Gaus(12, 2); // in ns - output.emplace_back(channel, 0, value, tot, 0); - } - } - } - - private: - int mDevCopy = 0; - uint32_t mMeanLatency = 0; - uint32_t mLatencyRMS = 1; - bool mZDCChannelCalib = false; - bool mZDCChannelCalibInTestMode = false; -}; - -} // namespace calibration - -namespace framework -{ - -DataProcessorSpec getTFDispatcherSpec(int slot, int ngen, int nlanes, int latency) -{ - return DataProcessorSpec{ - "calib-tf-dispatcher", - Inputs{}, - Outputs{{{"output"}, "ZDC", "DATASIZE"}}, - AlgorithmSpec{adaptFromTask(slot, ngen, nlanes, latency)}, - Options{{"max-timeframes", VariantType::Int64, 99999999999ll, {"max TimeFrames to generate"}}}}; -} - -DataProcessorSpec getTFProcessorSpec(int latency, int latencyRMS) -{ - return DataProcessorSpec{ - "calib-tf-data-processor", - Inputs{{"input", "ZDC", "DATASIZE"}}, - Outputs{{{"output"}, "ZDC", "CALIBDATA"}}, - AlgorithmSpec{adaptFromTask(latency, latencyRMS)}, - Options{ - {"do-ZDC-channel-calib", VariantType::Bool, false, {"flag to do ZDC ChannelCalib"}}, - {"do-ZDC-channel-calib-in-test-mode", VariantType::Bool, false, {"flag to do ZDC ChannelCalib in testMode"}}}}; -} - -} // namespace framework -} // namespace o2 - -#endif diff --git a/Detectors/ZDC/calib/testWorkflow/data-generator-workflow.cxx b/Detectors/ZDC/calib/testWorkflow/data-generator-workflow.cxx deleted file mode 100644 index ccafbb704ed9f..0000000000000 --- a/Detectors/ZDC/calib/testWorkflow/data-generator-workflow.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "Framework/DataProcessorSpec.h" -#include "DataGeneratorSpec.h" - -using namespace o2::framework; - -// we need to add workflow options before including Framework/runDataProcessing -void customize(std::vector& workflowOptions) -{ - // option allowing to set parameters - workflowOptions.push_back(ConfigParamSpec{"lanes", o2::framework::VariantType::Int, 2, {"number of data generator lanes"}}); - workflowOptions.push_back(ConfigParamSpec{"gen-norm", o2::framework::VariantType::Int, 1, {"nominal number of expected generators"}}); - workflowOptions.push_back(ConfigParamSpec{"gen-slot", o2::framework::VariantType::Int, 0, {"generate TFs of slot in [0 : gen-norm) range"}}); - workflowOptions.push_back(ConfigParamSpec{"pressure", o2::framework::VariantType::Float, 1.f, {"generation / processing rate factor"}}); - workflowOptions.push_back(ConfigParamSpec{"mean-latency", o2::framework::VariantType::Int, 1000, {"mean latency of the processor in microseconds"}}); - workflowOptions.push_back(ConfigParamSpec{"latency-spread", o2::framework::VariantType::Int, 100, {"latency gaussian RMS of the processor in microseconds"}}); -} - -// ------------------------------------------------------------------ - -#include "Framework/runDataProcessing.h" - -WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) -{ - WorkflowSpec specs; - auto nlanes = std::max(1, configcontext.options().get("lanes")); - auto ngen = std::max(1, configcontext.options().get("gen-norm")); - auto slot = std::max(0, configcontext.options().get("gen-slot")); - auto latency = std::max(1, configcontext.options().get("mean-latency")); - auto latencyRMS = std::max(1, configcontext.options().get("latency-spread")); - auto pressure = std::max(0.001f, configcontext.options().get("pressure")); - if (slot >= ngen) { - slot = 0; - ngen = 1; - } - specs.emplace_back(getTFDispatcherSpec(slot, ngen, nlanes, std::max(1, int(float(latency) / nlanes / pressure)))); - specs.emplace_back(timePipeline(getTFProcessorSpec(latency, latencyRMS), nlanes)); - return specs; -} diff --git a/Detectors/ZDC/calib/testWorkflow/zdc-calib-workflow.cxx b/Detectors/ZDC/calib/testWorkflow/zdc-calib-workflow.cxx deleted file mode 100644 index 73fe5a09eb663..0000000000000 --- a/Detectors/ZDC/calib/testWorkflow/zdc-calib-workflow.cxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "Framework/DataProcessorSpec.h" - -using namespace o2::framework; - -// we need to add workflow options before including Framework/runDataProcessing -void customize(std::vector& workflowOptions) -{ - // option allowing to set parameters - workflowOptions.push_back(ConfigParamSpec{"use-ccdb", o2::framework::VariantType::Bool, false, {"enable access to ccdb ZDC calibration objects"}}); - workflowOptions.push_back(ConfigParamSpec{"do-lhc-phase", o2::framework::VariantType::Bool, true, {"do LHC clock phase calibration"}}); -} - -// ------------------------------------------------------------------ - -#include "Framework/runDataProcessing.h" - -WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) -{ - WorkflowSpec specs; - auto useCCDB = configcontext.options().get("use-ccdb"); - auto doLHCcalib = configcontext.options().get("do-lhc-phase"); - - LOG(info) << "ZDC Calibration workflow: options"; - LOG(info) << "useCCDB = " << useCCDB; - return specs; -}