Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DataFormats/Detectors/FIT/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ o2_target_root_dictionary(DataFormatsFIT
include/DataFormatsFIT/LookUpTable.h
include/DataFormatsFIT/Triggers.h
include/DataFormatsFIT/ChannelData.h
include/DataFormatsFIT/Digit.h)
include/DataFormatsFIT/Digit.h
include/DataFormatsFIT/Configuration.h
include/DataFormatsFIT/DeadChannelMap.h)
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// 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.

// \file Configuration.h
/// \brief Utilities to describe FEE configuration
/// \author wiktor.pierozak@cern.ch

#ifndef O2_FIT_FEE_CONFIGURATION
#define O2_FIT_FEE_CONFIGURATION

#include <gsl/span>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <type_traits>
#include <algorithm>
#include <Rtypes.h>

namespace o2::fit
{
namespace config_helpers
{
struct DefaultValueType {
template <typename T>
requires std::is_arithmetic_v<T>
constexpr operator T() const noexcept
{
if constexpr (std::is_same_v<T, bool>) {
return false;
} else {
return std::numeric_limits<T>::max();
}
}
};

inline constexpr DefaultValueType DefaultValue{};

template <typename T, std::size_t N>
constexpr void fillDefaultArray(T (&array)[N])
{
for (auto& element : array) {
element = DefaultValue;
}
}
} // namespace config_helpers

struct TcmConfig {
float phaseDelayA{config_helpers::DefaultValue};
float phaseDelayC{config_helpers::DefaultValue};

bool operator==(const TcmConfig&) const = default;
ClassDefNV(TcmConfig, 1);
};

struct PmConfig {
uint8_t orGate{config_helpers::DefaultValue};
uint16_t trgChargeHighLevel{config_helpers::DefaultValue};
uint16_t trgChargeLowLevel{config_helpers::DefaultValue};
bool fddCoincidenceMode{config_helpers::DefaultValue};
bool operator==(const PmConfig&) const = default;
ClassDefNV(PmConfig, 1);
};

template <int NChannels>
struct ChannelsConfig {
int16_t timeAlignments[NChannels];
uint16_t cfdThresholds[NChannels];
int16_t cfdZeros[NChannels];
int16_t adcZeros[NChannels];
uint16_t adcDelays[NChannels];
uint16_t rangeCorrectionAdc0[NChannels];
uint16_t rangeCorrectionAdc1[NChannels];
uint16_t thresholdCalibration[NChannels];
bool channelMaskData[NChannels];
bool channelMaskTriggers[NChannels];

constexpr ChannelsConfig()
{
config_helpers::fillDefaultArray(timeAlignments);
config_helpers::fillDefaultArray(cfdThresholds);
config_helpers::fillDefaultArray(cfdZeros);
config_helpers::fillDefaultArray(adcZeros);
config_helpers::fillDefaultArray(adcDelays);
config_helpers::fillDefaultArray(rangeCorrectionAdc0);
config_helpers::fillDefaultArray(rangeCorrectionAdc1);
config_helpers::fillDefaultArray(channelMaskData);
config_helpers::fillDefaultArray(channelMaskTriggers);
config_helpers::fillDefaultArray(thresholdCalibration);
}

template <typename T>
[[nodiscard]] static constexpr bool isDefault(const T& value)
{
return value == static_cast<T>(config_helpers::DefaultValue);
}

gsl::span<const int16_t, NChannels> getTimeAlignments() const { return timeAlignments; }
gsl::span<const uint16_t, NChannels> getCfdThresholds() const { return cfdThresholds; }
gsl::span<const int16_t, NChannels> getCfdZeros() const { return cfdZeros; }
gsl::span<const int16_t, NChannels> getAdcZeros() const { return adcZeros; }
gsl::span<const uint16_t, NChannels> getAdcDelays() const { return adcDelays; }
gsl::span<const uint16_t, NChannels> getRangeCorrectionAdc0() const { return rangeCorrectionAdc0; }
gsl::span<const uint16_t, NChannels> getRangeCorrectionAdc1() const { return rangeCorrectionAdc1; }
gsl::span<const uint16_t, NChannels> getThresholdCalibration() const { return thresholdCalibration; }
gsl::span<const bool, NChannels> getChannelMaskTriggers() const { return channelMaskTriggers; }
gsl::span<const bool, NChannels> getChannelMaskData() const { return channelMaskData; }

bool operator==(const ChannelsConfig& other) const
{
return std::equal(std::begin(timeAlignments), std::end(timeAlignments), std::begin(other.timeAlignments)) &&
std::equal(std::begin(cfdThresholds), std::end(cfdThresholds), std::begin(other.cfdThresholds)) &&
std::equal(std::begin(cfdZeros), std::end(cfdZeros), std::begin(other.cfdZeros)) &&
std::equal(std::begin(adcZeros), std::end(adcZeros), std::begin(other.adcZeros)) &&
std::equal(std::begin(adcDelays), std::end(adcDelays), std::begin(other.adcDelays)) &&
std::equal(std::begin(rangeCorrectionAdc0), std::end(rangeCorrectionAdc0), std::begin(other.rangeCorrectionAdc0)) &&
std::equal(std::begin(rangeCorrectionAdc1), std::end(rangeCorrectionAdc1), std::begin(other.rangeCorrectionAdc1)) &&
std::equal(std::begin(thresholdCalibration), std::end(thresholdCalibration), std::begin(other.thresholdCalibration)) &&
std::equal(std::begin(channelMaskData), std::end(channelMaskData), std::begin(other.channelMaskData)) &&
std::equal(std::begin(channelMaskTriggers), std::end(channelMaskTriggers), std::begin(other.channelMaskTriggers));
}

ClassDefNV(ChannelsConfig<NChannels>, 1);
};
} // namespace o2::fit
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

#pragma link C++ std::vector < std::pair < uint64_t, int>> + ;
#pragma link C++ struct o2::fit::DCSDPValues + ;

#pragma link C++ struct o2::fit::TcmConfig + ;
#pragma link C++ struct o2::fit::PmConfig + ;
#pragma link C++ struct o2::fit::DeadChannelMap + ;
/*
#include "DetectorsCommonDataFormats/DetID.h"
#pragma link C++ struct o2::fit::ChannelData<o2::detectors::DetID::FDD> + ;
Expand Down
7 changes: 4 additions & 3 deletions Detectors/FIT/FDD/dcsmonitoring/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# or submit itself to any jurisdiction.

o2_add_library(FDDDCSMonitoring
SOURCES src/FDDDCSDataProcessor.cxx
PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring)
SOURCES src/FDDDCSDataProcessor.cxx src/FDDDCSConfigProcessor.cxx
PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring O2::DataFormatsFDD)

o2_add_executable(dcs-sim-workflow
COMPONENT_NAME fdd
Expand All @@ -30,4 +30,5 @@ o2_add_executable(dcs-config-workflow
SOURCES workflow/fdd-dcs-config-workflow.cxx
PUBLIC_LINK_LIBRARIES O2::DetectorsCalibration
O2::FITDCSMonitoring
O2::Framework)
O2::Framework
O2::FDDDCSMonitoring)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 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.

/// \author Wiktor Pierożak <wiktor.pierozak@cern.ch>, AGH University of Krakow, Poland

#ifndef O2_FDD_DCS_CONFIG_PROCESSOR_H
#define O2_FDD_DCS_CONFIG_PROCESSOR_H

#include "FITDCSMonitoring/FITDCSConfigProcessor.h"

namespace o2::fdd
{
class FDDDCSConfigProcessor : public o2::fit::FITDCSConfigProcessor
{
public:
FDDDCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM, const o2::header::DataDescription& dataDescriptionFeeConfig)
: o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM, dataDescriptionFeeConfig) {}

void init(o2::framework::InitContext& ic) final;
void run(o2::framework::ProcessingContext& pc) final;
void endOfStream(o2::framework::EndOfStreamContext& ec) final;
};
} // namespace o2::fdd
#endif
44 changes: 44 additions & 0 deletions Detectors/FIT/FDD/dcsmonitoring/src/FDDDCSConfigProcessor.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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 "FDDDCSMonitoring/FDDDCSConfigProcessor.h"

namespace o2::fdd
{
void FDDDCSConfigProcessor::init(o2::framework::InitContext& ic)
{
initDeadChannelMapReader();
setupDeadChannelMapReader(ic);
}

void FDDDCSConfigProcessor::run(o2::framework::ProcessingContext& pc)
{
try {
long dataTime = getValidityTime(pc);

gsl::span<const char> dataBuffer = pc.inputs().get<gsl::span<char>>("inputConfig");
std::string configFileName = pc.inputs().get<std::string>("inputConfigFileName");
LOG(info) << "Got input file " << configFileName << " of size " << dataBuffer.size();

if (!configFileName.compare(mDeadChannelMapReader->getFileNameDChM())) {
handleDeadChannelMapUpdate(pc, dataTime, dataBuffer);
} else {
LOG(error) << "Unknown input file: " << configFileName;
}
} catch (std::exception& e) {
LOG(error) << "Exception: " << e.what();
}
}

void FDDDCSConfigProcessor::endOfStream(o2::framework::EndOfStreamContext& ec)
{
}
} // namespace o2::fdd
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
///
/// \author Andreas Molander <andreas.molander@cern.ch>, University of Jyvaskyla, Finland

#ifndef O2_FDD_DCSCONFIGPROCESSOR_H
#define O2_FDD_DCSCONFIGPROCESSOR_H
#ifndef O2_FDD_DCSCONFIGPROCESSORSPEC_H
#define O2_FDD_DCSCONFIGPROCESSORSPEC_H

#include "FITDCSMonitoring/FITDCSConfigProcessorSpec.h"
#include "FDDDCSMonitoring/FDDDCSConfigProcessor.h"
#include "DetectorsCalibration/Utils.h"
#include "Framework/WorkflowSpec.h"
#include "Headers/DataHeader.h"
Expand All @@ -43,7 +43,7 @@ DataProcessorSpec getFDDDCSConfigProcessorSpec()
Inputs{{"inputConfig", o2::header::gDataOriginFDD, "DCS_CONFIG_FILE", Lifetime::Sporadic},
{"inputConfigFileName", o2::header::gDataOriginFDD, "DCS_CONFIG_NAME", Lifetime::Sporadic}},
outputs,
AlgorithmSpec{adaptFromTask<o2::fit::FITDCSConfigProcessor>("FDD", ddDChM)},
AlgorithmSpec{adaptFromTask<o2::fdd::FDDDCSConfigProcessor>("FDD", ddDChM, o2::header::DataDescription{})},
Options{{"use-verbose-mode", VariantType::Bool, false, {"Use verbose mode"}},
{"filename-dchm", VariantType::String, "FDD-deadchannels.txt", {"Dead channel map file name"}},
{"valid-days-dchm", VariantType::UInt32, 180u, {"Dead channel map validity in days"}},
Expand All @@ -53,4 +53,4 @@ DataProcessorSpec getFDDDCSConfigProcessorSpec()
} // namespace framework
} // namespace o2

#endif // O2_FDD_DCSCONFIGPROCESSOR_H
#endif // O2_FDD_DCSCONFIGPROCESSORSPEC_H
7 changes: 2 additions & 5 deletions Detectors/FIT/FT0/dcsmonitoring/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
# or submit itself to any jurisdiction.

o2_add_library(FT0DCSMonitoring
SOURCES src/FT0DCSDataProcessor.cxx
PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring)

o2_target_root_dictionary(FT0DCSMonitoring
HEADERS include/FT0DCSMonitoring/FT0DCSConfigReader.h)
SOURCES src/FT0DCSDataProcessor.cxx src/FT0DCSConfigProcessor.cxx
PUBLIC_LINK_LIBRARIES O2::FITDCSMonitoring O2::DataFormatsFT0)

o2_add_executable(dcs-sim-workflow
COMPONENT_NAME ft0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 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_FT0_DCSCONFIGPROCESSOR_H
#define O2_FT0_DCSCONFIGPROCESSOR_H

#include "FITDCSMonitoring/FITDCSConfigProcessor.h"
#include "DetectorsCalibration/Utils.h"
#include "Framework/WorkflowSpec.h"
#include "Headers/DataHeader.h"

#include <string>
#include <vector>

namespace o2::ft0
{
class FT0DCSConfigProcessor : public o2::fit::FITDCSConfigProcessor
{
public:
FT0DCSConfigProcessor(const std::string& detectorName, const o2::header::DataDescription& dataDescriptionDChM, const o2::header::DataDescription& dataDescriptionFeeConfig)
: o2::fit::FITDCSConfigProcessor(detectorName, dataDescriptionDChM, dataDescriptionFeeConfig) {}

void init(o2::framework::InitContext& ic) final;
void run(o2::framework::ProcessingContext& pc) final;
void endOfStream(o2::framework::EndOfStreamContext& ec) final;
};
} // namespace o2::ft0
#endif // O2_FT0_DCSCONFIGPROCESSOR_H

This file was deleted.

Loading
Loading