diff --git a/Modules/TPC/CMakeLists.txt b/Modules/TPC/CMakeLists.txt index 3c490e0658..4fcfbf7843 100644 --- a/Modules/TPC/CMakeLists.txt +++ b/Modules/TPC/CMakeLists.txt @@ -10,7 +10,8 @@ target_sources(O2QcTPC PRIVATE src/PID.cxx src/ROCReductor.cxx src/Clusters.cxx src/CalDetPublisher.cxx - src/Utility.cxx) + src/Utility.cxx + src/RawDigits.cxx) target_include_directories( O2QcTPC @@ -21,7 +22,8 @@ target_include_directories( target_link_libraries(O2QcTPC PUBLIC O2QualityControl - O2::TPCQC) + O2::TPCQC + O2::TPCWorkflow) @@ -35,6 +37,7 @@ add_root_dictionary(O2QcTPC include/TPC/Clusters.h include/TPC/CalDetPublisher.h include/TPC/Utility.h + include/TPC/RawDigits.h LINKDEF include/TPC/LinkDef.h BASENAME O2QcTPC) @@ -91,4 +94,5 @@ install(FILES run/tpcQCPID_sampled.json run/tpcQCClusters_direct.json run/tpcQCTrackingFromExternal_direct.json run/tpcQCCalDetPublisher.json + run/tpcQCRawDigits_direct.json DESTINATION etc) diff --git a/Modules/TPC/include/TPC/LinkDef.h b/Modules/TPC/include/TPC/LinkDef.h index a2400f82ae..723f6990a9 100644 --- a/Modules/TPC/include/TPC/LinkDef.h +++ b/Modules/TPC/include/TPC/LinkDef.h @@ -11,6 +11,7 @@ #pragma link C++ class o2::quality_control_modules::tpc::ROCReductor+; #pragma link C++ class o2::quality_control_modules::tpc::Clusters+; #pragma link C++ class o2::quality_control_modules::tpc::CalDetPublisher+; +#pragma link C++ class o2::quality_control_modules::tpc::RawDigits+; #pragma link C++ function o2::quality_control_modules::tpc::addAndPublish+; #pragma link C++ function o2::quality_control_modules::tpc::toVector+; diff --git a/Modules/TPC/include/TPC/RawDigits.h b/Modules/TPC/include/TPC/RawDigits.h new file mode 100644 index 0000000000..b1ce3dda62 --- /dev/null +++ b/Modules/TPC/include/TPC/RawDigits.h @@ -0,0 +1,71 @@ +// 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 RawDigits.h +/// \author Jens Wiechula +/// \author Thomas Klemenz +/// + +#ifndef QC_MODULE_TPC_RAWDIGITS_H +#define QC_MODULE_TPC_RAWDIGITS_H + +// O2 includes +#include "TPCQC/Clusters.h" +#include "TPCQC/CalPadWrapper.h" +#include "TPCReconstruction/RawReaderCRU.h" +#include "TPCWorkflow/CalibProcessingHelper.h" + +// QC includes +#include "QualityControl/TaskInterface.h" + +class TCanvas; + +using namespace o2::quality_control::core; + +namespace o2::quality_control_modules::tpc +{ + +/// \brief Example Quality Control DPL Task +/// It is final because there is no reason to derive from it. Just remove it if needed. +/// \author Barthelemy von Haller +/// \author Piotr Konopka +class RawDigits /*final*/ : public TaskInterface // todo add back the "final" when doxygen is fixed +{ + public: + /// \brief Constructor + RawDigits(); + /// \brief Destructor + ~RawDigits() = default; + + // 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: + o2::tpc::qc::Clusters mRawDigitQC; ///< O2 Cluster task to perform actions on cluster objects + std::vector mWrapperVector{}; ///< vector holding CalPad objects wrapped as TObjects; published on QCG; will be non-wrapped CalPad objects in the future + std::vector> mNRawDigitsCanvasVec{}; ///< summary canvases of the NRawDigits object + std::vector> mQMaxCanvasVec{}; ///< summary canvases of the QMax object + std::vector> mQTotCanvasVec{}; ///< summary canvases of the QTot object + std::vector> mSigmaTimeCanvasVec{}; ///< summary canvases of the SigmaTime object + std::vector> mSigmaPadCanvasVec{}; ///< summary canvases of the SigmaPad object + std::vector> mTimeBinCanvasVec{}; ///< summary canvases of the TimeBin object + o2::tpc::rawreader::RawReaderCRUManager mRawReader; +}; + +} // namespace o2::quality_control_modules::tpc + +#endif // QC_MODULE_TPC_RawDigits_H diff --git a/Modules/TPC/run/tpcQCClusters_direct.json b/Modules/TPC/run/tpcQCClusters_direct.json index 8e7202f84e..4aac66fcd0 100644 --- a/Modules/TPC/run/tpcQCClusters_direct.json +++ b/Modules/TPC/run/tpcQCClusters_direct.json @@ -28,7 +28,7 @@ "className": "o2::quality_control_modules::tpc::Clusters", "moduleName": "QcTPC", "detectorName": "TPC", - "cycleDurationSeconds": "10", + "cycleDurationSeconds": "60", "maxNumberCycles": "-1", "dataSource": { "type": "direct", diff --git a/Modules/TPC/run/tpcQCPID_direct.json b/Modules/TPC/run/tpcQCPID_direct.json index 2469f28a3e..848c310885 100644 --- a/Modules/TPC/run/tpcQCPID_direct.json +++ b/Modules/TPC/run/tpcQCPID_direct.json @@ -28,7 +28,7 @@ "className": "o2::quality_control_modules::tpc::PID", "moduleName": "QcTPC", "detectorName": "TPC", - "cycleDurationSeconds": "10", + "cycleDurationSeconds": "60", "maxNumberCycles": "-1", "dataSource": { "type": "direct", diff --git a/Modules/TPC/run/tpcQCRawDigits_direct.json b/Modules/TPC/run/tpcQCRawDigits_direct.json new file mode 100644 index 0000000000..7c0e16059c --- /dev/null +++ b/Modules/TPC/run/tpcQCRawDigits_direct.json @@ -0,0 +1,46 @@ +{ + "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": { + "RawDigits": { + "active": "true", + "className": "o2::quality_control_modules::tpc::RawDigits", + "moduleName": "QcTPC", + "detectorName": "TPC", + "cycleDurationSeconds": "60", + "maxNumberCycles": "-1", + "dataSource": { + "type": "direct", + "query" : "input:TPC/RAWDATA" + }, + "taskParameters": { + "myOwnKey": "myOwnValue" + }, + "location": "remote" + } + } + }, + "dataSamplingPolicies": [ + ] +} diff --git a/Modules/TPC/run/tpcQCTracks_direct.json b/Modules/TPC/run/tpcQCTracks_direct.json index 5e329d8fed..bff6a56da1 100644 --- a/Modules/TPC/run/tpcQCTracks_direct.json +++ b/Modules/TPC/run/tpcQCTracks_direct.json @@ -28,7 +28,7 @@ "className": "o2::quality_control_modules::tpc::Tracks", "moduleName": "QcTPC", "detectorName": "TPC", - "cycleDurationSeconds": "10", + "cycleDurationSeconds": "60", "maxNumberCycles": "-1", "dataSource": { "type": "direct", diff --git a/Modules/TPC/src/RawDigits.cxx b/Modules/TPC/src/RawDigits.cxx new file mode 100644 index 0000000000..7c4d2f1e3c --- /dev/null +++ b/Modules/TPC/src/RawDigits.cxx @@ -0,0 +1,101 @@ +// 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 RawDigits.cxx +/// \author Thomas Klemenz +/// + +// O2 includes +#include "Framework/ProcessingContext.h" +#include "DataFormatsTPC/ClusterNative.h" +#include "TPCBase/Painter.h" + +// QC includes +#include "QualityControl/QcInfoLogger.h" +#include "TPC/RawDigits.h" +#include "TPC/Utility.h" + +namespace o2::quality_control_modules::tpc +{ + +RawDigits::RawDigits() : TaskInterface() +{ + mWrapperVector.emplace_back(&mRawDigitQC.getNClusters()); + mWrapperVector.emplace_back(&mRawDigitQC.getQMax()); + mWrapperVector.emplace_back(&mRawDigitQC.getTimeBin()); +} + +void RawDigits::initialize(o2::framework::InitContext& /*ctx*/) +{ + QcInfoLogger::GetInstance() << "initialize TPC RawDigits QC task" << AliceO2::InfoLogger::InfoLogger::endm; + + mRawReader.createReader(""); + + addAndPublish(getObjectsManager(), mNRawDigitsCanvasVec, { "c_Sides_N_RawDigits", "c_ROCs_N_RawDigits_1D", "c_ROCs_N_RawDigits_2D" }); + addAndPublish(getObjectsManager(), mQMaxCanvasVec, { "c_Sides_Q_Max", "c_ROCs_Q_Max_1D", "c_ROCs_Q_Max_2D" }); + addAndPublish(getObjectsManager(), mTimeBinCanvasVec, { "c_Sides_Time_Bin", "c_ROCs_Time_Bin_1D", "c_ROCs_Time_Bin_2D" }); + + for (auto& wrapper : mWrapperVector) { + getObjectsManager()->startPublishing(&wrapper); + getObjectsManager()->addMetadata(wrapper.getObj()->getName().data(), "custom", "87"); + } + + mRawReader.setLinkZSCallback([this](int cru, int rowInSector, int padInRow, int timeBin, float adcValue) -> bool { + mRawDigitQC.fillADCValue(cru, rowInSector, padInRow, timeBin, adcValue); + return true; + }); +} + +void RawDigits::startOfActivity(Activity& /*activity*/) +{ + QcInfoLogger::GetInstance() << "startOfActivity" << AliceO2::InfoLogger::InfoLogger::endm; +} + +void RawDigits::startOfCycle() +{ + QcInfoLogger::GetInstance() << "startOfCycle" << AliceO2::InfoLogger::InfoLogger::endm; +} + +void RawDigits::monitorData(o2::framework::ProcessingContext& ctx) +{ + auto& reader = mRawReader.getReaders()[0]; + o2::tpc::calib_processing_helper::processRawData(ctx.inputs(), reader, false); + + mRawDigitQC.analyse(); + + auto vecPtrNRawDigits = toVector(mNRawDigitsCanvasVec); + o2::tpc::painter::makeSummaryCanvases(mRawDigitQC.getNClusters(), 300, 0, 0, true, &vecPtrNRawDigits); + + auto vecPtrQMax = toVector(mQMaxCanvasVec); + o2::tpc::painter::makeSummaryCanvases(mRawDigitQC.getQMax(), 300, 0, 0, true, &vecPtrQMax); + + auto vecPtrTimeBin = toVector(mTimeBinCanvasVec); + o2::tpc::painter::makeSummaryCanvases(mRawDigitQC.getTimeBin(), 300, 0, 0, true, &vecPtrTimeBin); +} + +void RawDigits::endOfCycle() +{ + QcInfoLogger::GetInstance() << "endOfCycle" << AliceO2::InfoLogger::InfoLogger::endm; +} + +void RawDigits::endOfActivity(Activity& /*activity*/) +{ + QcInfoLogger::GetInstance() << "endOfActivity" << AliceO2::InfoLogger::InfoLogger::endm; +} + +void RawDigits::reset() +{ + // clean all the monitor objects here + + QcInfoLogger::GetInstance() << "Resetting the histogram" << AliceO2::InfoLogger::InfoLogger::endm; +} + +} // namespace o2::quality_control_modules::tpc