Skip to content
Merged
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
1 change: 1 addition & 0 deletions Modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ add_subdirectory(PHOS)
add_subdirectory(FT0)
add_subdirectory(TRD)
add_subdirectory(HMPID)
add_subdirectory(CPV)
43 changes: 43 additions & 0 deletions Modules/CPV/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ---- Library ----

add_library(QcCPV)

target_sources(QcCPV PRIVATE src/PedestalCheck.cxx src/PedestalTask.cxx )

target_include_directories(
QcCPV
PUBLIC $<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

target_link_libraries(QcCPV PUBLIC O2QualityControl O2::CPVBase ROOT::Spectrum)

install(TARGETS QcCPV
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

add_root_dictionary(QcCPV
HEADERS
include/CPV/PedestalCheck.h
include/CPV/PedestalTask.h
LINKDEF include/CPV/LinkDef.h
BASENAME QcCPV)

# ---- Test(s) ----

set(TEST_SRCS test/testQcCPV.cxx)

foreach(test ${TEST_SRCS})
get_filename_component(test_name ${test} NAME)
string(REGEX REPLACE ".cxx" "" test_name ${test_name})

add_executable(${test_name} ${test})
target_link_libraries(${test_name}
PRIVATE QcCPV Boost::unit_test_framework)
add_test(NAME ${test_name} COMMAND ${test_name})
set_property(TARGET ${test_name}
PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests)
set_tests_properties(${test_name} PROPERTIES TIMEOUT 20)
endforeach()

10 changes: 10 additions & 0 deletions Modules/CPV/etc/read-raw-from-file/CPVraw.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#[defaults]
#dataOrigin = CPV
#dataDescription = RAWDATA
#readoutCard = RORC

[input-CPV-0]
dataOrigin = CPV
dataDescription = RAWDATA
readoutCard = CRU
filePath = /data/cpv-raw-data/data_p2_21_012.raw
106 changes: 106 additions & 0 deletions Modules/CPV/etc/read-raw-from-file/pedestal-task-no-sampling.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"qc": {
"config": {
"database": {
"implementation": "CCDB",
"host": "ccdb-test.cern.ch:8080",
"username": "not_applicable",
"password": "not_applicable",
"name": "not_applicable"
},
"Activity": {
"number": "42",
"type": "2"
},
"monitoring": {
"url": "infologger:///debug?qc"
},
"consul": {
"url": "http://consul-test.cern.ch:8500"
},
"conditionDB": {
"url": "ccdb-test.cern.ch:8080"
}
},
"tasks": {
"CPVPedestalTask": {
"active": "true",
"className": "o2::quality_control_modules::cpv::PedestalTask",
"moduleName": "QcCPV",
"detectorName": "CPV",
"cycleDurationSeconds": "10",
"maxNumberCycles": "-1",
"": "The other type of dataSource is \"direct\", see basic-no-sampling.json.",
"dataSource": {
"type": "direct",
"query": "digits:CPV/DIGITS/0;dtrigrec:CPV/DIGITTRIGREC/0"
},
"taskParameters": {
"cutOnMinAmplitude": "0"
},
"location": "remote",
"saveObjectsToFile": "MOs.root", "": "For debugging, path to the file where to save. If empty or missing it won't save."
}
},
"checks": {
"CPVPedestalCheck": {
"active": "true",
"className": "o2::quality_control_modules::cpv::PedestalCheck",
"moduleName": "QcCPV",
"policy": "OnAny",
"detectorName": "CPV",
"dataSource": [{
"type": "Task",
"name": "CPVPedestalTask",
"MOs": [
"PedestalValueM2",
"PedestalValueM3",
"PedestalValueM4",
"PedestalSigmaM2",
"PedestalSigmaM3",
"PedestalSigmaM4",
"PedestalEfficiencyM2",
"PedestalEfficiencyM3",
"PedestalEfficiencyM4"
]
}],
"checkParameters": {
"mMinGoodPedestalValueM2": "1",
"mMinGoodPedestalValueM3": "1",
"mMinGoodPedestalValueM4": "1",
"": "",
"mMaxGoodPedestalSigmaM2": "2",
"mMaxGoodPedestalSigmaM3": "5",
"mMaxGoodPedestalSigmaM4": "2",
"": "",
"mMinGoodPedestalEfficiencyM2": "0.75",
"mMinGoodPedestalEfficiencyM3": "0.75",
"mMinGoodPedestalEfficiencyM4": "0.75",
"": "",
"mMaxGoodPedestalEfficiencyM2": "1.0",
"mMaxGoodPedestalEfficiencyM3": "1.0",
"mMaxGoodPedestalEfficiencyM4": "1.0",
"": "",
"mToleratedBadPedestalValueChannelsM2": "100",
"mToleratedBadPedestalValueChannelsM3": "200",
"mToleratedBadPedestalValueChannelsM4": "100",
"": "",
"mToleratedBadPedestalSigmaChannelsM2": "300",
"mToleratedBadPedestalSigmaChannelsM3": "400",
"mToleratedBadPedestalSigmaChannelsM4": "500",
"": "",
"mToleratedBadChannelsM2": "200",
"mToleratedBadChannelsM3": "200",
"mToleratedBadChannelsM4": "200",
"": "",
"mToleratedBadPedestalEfficiencyChannelsM2": "100",
"mToleratedBadPedestalEfficiencyChannelsM3": "100",
"mToleratedBadPedestalEfficiencyChannelsM4": "100"
}
}
}
},
"dataSamplingPolicies": [

]
}
10 changes: 10 additions & 0 deletions Modules/CPV/etc/read-raw-from-file/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
0) alienv enter qcg/latest

1) start raw file reader with command
o2-raw-file-reader-workflow --input-conf CPVraw.cfg

2) raw data stream is produced by previous command. Try to connect to it with raw to digit converter:
o2-raw-file-reader-workflow --input-conf CPVraw.cfg | o2-cpv-reco-workflow --input-type raw --output-type digits --disable-mc --pedestal=on --disable-root-output

3) connect qc:
o2-raw-file-reader-workflow --input-conf CPVraw.cfg | o2-cpv-reco-workflow --input-type raw --output-type digits --disable-mc --pedestal=on --disable-root-output | o2-qc --config json://pedestal-task-no-sampling.json
8 changes: 8 additions & 0 deletions Modules/CPV/include/CPV/LinkDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifdef __CLING__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class o2::quality_control_modules::cpv::PedestalTask+;
#pragma link C++ class o2::quality_control_modules::cpv::PedestalCheck+;
#endif
58 changes: 58 additions & 0 deletions Modules/CPV/include/CPV/PedestalCheck.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 PedestalCheck.h
/// \author Sergey Evdokimov
///

#ifndef QC_MODULE_CPV_CPVPEDESTALCHECK_H
#define QC_MODULE_CPV_CPVPEDESTALCHECK_H

#include "QualityControl/CheckInterface.h"

namespace o2::quality_control_modules::cpv
{

/// \brief CPV PedestalCheck
/// \author Sergey Evdokimov
///
class PedestalCheck : public o2::quality_control::checker::CheckInterface
{
public:
/// Default constructor
PedestalCheck() = default;
/// Destructor
~PedestalCheck() override = default;

// Override interface
void configure(std::string name) override;
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
std::string getAcceptedType() override;

private:
//configurable parameters and their default values
//see config example in Modules/CPV/etc/pedestal-task-no-sampling.json
int mMinGoodPedestalValueM[3] = { 1, 1, 1 };
float mMaxGoodPedestalSigmaM[3] = { 2., 2., 2. };
float mMinGoodPedestalEfficiencyM[3] = { 0.7, 0.7, 0.7 };
float mMaxGoodPedestalEfficiencyM[3] = { 1., 1., 1. };
int mToleratedBadPedestalValueChannelsM[3] = { 10, 10, 10 }; //pedestal value < mMinGoodPedestalValue or > 512
int mToleratedBadChannelsM[3] = { 20, 20, 20 }; //double peaks or empty or channels
int mToleratedBadPedestalSigmaChannelsM[3] = { 20, 20, 20 }; //pedestal value < mMinGoodPedestalValue or > 512
int mToleratedBadPedestalEfficiencyChannelsM[3] = { 20, 20, 20 }; //efficiency < min or > max

ClassDefOverride(PedestalCheck, 1);
};

} // namespace o2::quality_control_modules::cpv

#endif // QC_MODULE_CPV_CPVPEDESTALCHECK_H
112 changes: 112 additions & 0 deletions Modules/CPV/include/CPV/PedestalTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 PedestalTask.h
/// \author Sergey Evdokimov
///

#ifndef QC_MODULE_CPV_CPVPEDESTALTASK_H
#define QC_MODULE_CPV_CPVPEDESTALTASK_H

#include "QualityControl/TaskInterface.h"
#include <memory>
#include <array>
#include "DataFormatsCPV/Digit.h"
#include "DataFormatsCPV/TriggerRecord.h"
#include <gsl/span>
#include "CPVBase/Geometry.h"

class TH1F;
class TH2F;

using namespace o2::quality_control::core;

namespace o2::quality_control_modules::cpv
{

/// \brief CPV Pedestal Task which processes uncalibrated digits from pedestal runs and produces pedestal monitor objects
/// \author Sergey Evdokimov
class PedestalTask final : public TaskInterface
{
public:
/// \brief Constructor
PedestalTask() = default;
/// Destructor
~PedestalTask() override;

// Definition of the methods for the template method pattern
void initialize(o2::framework::InitContext& ctx) override;
void startOfActivity(Activity& activity) override;
void startOfCycle() override;
void monitorData(o2::framework::ProcessingContext& ctx) override;
void endOfCycle() override;
void endOfActivity(Activity& activity) override;
void reset() override;

private:
void initHistograms();
// void fillHistograms(const gsl::span<const o2::cpv::Digit>& digits, const gsl::span<const o2::cpv::TriggerRecord>& triggerRecords);
void fillHistograms();
void resetHistograms();

static constexpr short kNHist1D = 14;
enum Histos1D { H1DInputPayloadSize,
H1DNInputs,
H1DNValidInputs,
H1DNDigitsPerInput,
H1DDigitIds,
H1DPedestalValueM2,
H1DPedestalValueM3,
H1DPedestalValueM4,
H1DPedestalSigmaM2,
H1DPedestalSigmaM3,
H1DPedestalSigmaM4,
H1DPedestalEfficiencyM2,
H1DPedestalEfficiencyM3,
H1DPedestalEfficiencyM4
};

static constexpr short kNHist2D = 16;
enum Histos2D { H2DErrorType,
H2DDigitMapM2,
H2DDigitMapM3,
H2DDigitMapM4,
H2DPedestalValueMapM2,
H2DPedestalValueMapM3,
H2DPedestalValueMapM4,
H2DPedestalSigmaMapM2,
H2DPedestalSigmaMapM3,
H2DPedestalSigmaMapM4,
H2DPedestalEfficiencyMapM2,
H2DPedestalEfficiencyMapM3,
H2DPedestalEfficiencyMapM4,
H2DPedestalNPeaksMapM2,
H2DPedestalNPeaksMapM3,
H2DPedestalNPeaksMapM4
};

static constexpr short kNModules = 3;
static constexpr short kNChannels = 23040;
o2::cpv::Geometry mCPVGeometry;

int mNEventsTotal;
int mNEventsFromLastFillHistogramsCall;

std::array<TH1F*, kNHist1D> mHist1D = { nullptr }; ///< Array of 1D histograms
std::array<TH2F*, kNHist2D> mHist2D = { nullptr }; ///< Array of 2D histograms

std::array<TH1F*, kNChannels> mHistAmplitudes = { nullptr }; ///< Array of amplitude spectra
std::array<bool, kNChannels> mIsUpdatedAmplitude = { false }; ///< Array of isUpdatedAmplitude bools
};

} // namespace o2::quality_control_modules::cpv

#endif // QC_MODULE_CPV_CPVPEDESTALTASK_H
Loading