From 65313a3b928267b3bc55cc441572072f9ea63744 Mon Sep 17 00:00:00 2001 From: Laura Serksnyte Date: Mon, 11 Dec 2023 15:56:33 +0100 Subject: [PATCH] Shared clusters, found clusters and crossed rows TASK for TPC QC --- Modules/TPC/CMakeLists.txt | 5 +- Modules/TPC/include/TPC/LinkDef.h | 1 + Modules/TPC/include/TPC/TrackClusters.h | 60 ++++++++++++++ Modules/TPC/run/tpcQCTrackClusters.json | 46 ++++++++++ Modules/TPC/src/TrackClusters.cxx | 106 ++++++++++++++++++++++++ 5 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 Modules/TPC/include/TPC/TrackClusters.h create mode 100644 Modules/TPC/run/tpcQCTrackClusters.json create mode 100644 Modules/TPC/src/TrackClusters.cxx diff --git a/Modules/TPC/CMakeLists.txt b/Modules/TPC/CMakeLists.txt index aacb42b205..c6adb4e8b3 100644 --- a/Modules/TPC/CMakeLists.txt +++ b/Modules/TPC/CMakeLists.txt @@ -34,7 +34,8 @@ target_sources(O2QcTPC PRIVATE src/PID.cxx src/IDCScaleReductor.cxx src/SACs.cxx src/TPCAggregator.cxx - src/SACZeroScaleReductor.cxx) + src/SACZeroScaleReductor.cxx + src/TrackClusters.cxx) target_include_directories( O2QcTPC @@ -89,6 +90,7 @@ add_root_dictionary(O2QcTPC include/TPC/SACs.h include/TPC/TPCAggregator.h include/TPC/SACZeroScaleReductor.h + include/TPC/TrackClusters.h LINKDEF include/TPC/LinkDef.h) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/TPC @@ -168,4 +170,5 @@ install(FILES run/tpcQCPID_sampled.json run/tpcQCROCTrending.json run/tpcQCSACs.json run/tpcQCSACScaleTrend.json + run/tpcQCTrackClusters.json DESTINATION etc) diff --git a/Modules/TPC/include/TPC/LinkDef.h b/Modules/TPC/include/TPC/LinkDef.h index a6e91b7729..f8013abb2f 100644 --- a/Modules/TPC/include/TPC/LinkDef.h +++ b/Modules/TPC/include/TPC/LinkDef.h @@ -39,6 +39,7 @@ #pragma link C++ class o2::quality_control_modules::tpc::SACs + ; #pragma link C++ class o2::quality_control_modules::tpc::TPCAggregator + ; #pragma link C++ class o2::quality_control_modules::tpc::SACZeroScaleReductor + ; +#pragma link C++ class o2::quality_control_modules::tpc::TrackClusters + ; #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/TrackClusters.h b/Modules/TPC/include/TPC/TrackClusters.h new file mode 100644 index 0000000000..8ef039407f --- /dev/null +++ b/Modules/TPC/include/TPC/TrackClusters.h @@ -0,0 +1,60 @@ +// 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 TrackClusters.h +/// \author Laura Serksnyte +/// + +#ifndef QC_MODULE_TPC_TRACKCLUSTERS_H +#define QC_MODULE_TPC_TRACKCLUSTERS_H + +// O2 includes +#include "TPCQC/TrackClusters.h" + +// QC includes +#include "QualityControl/TaskInterface.h" + +// ROOT includes +#include + +using namespace o2::quality_control::core; + +namespace o2::quality_control_modules::tpc +{ + +/// \brief Quality Control task for the shared clusters and crossed rows distribution +class TrackClusters : public TaskInterface +{ + public: + /// \brief Constructor + TrackClusters(); + /// \brief Destructor + ~TrackClusters() = default; + + // Definition of the methods for the template method pattern + void initialize(o2::framework::InitContext& ctx) override; + void startOfActivity(const Activity& activity) override; + void startOfCycle() override; + void monitorData(o2::framework::ProcessingContext& ctx) override; + void endOfCycle() override; + void endOfActivity(const Activity& activity) override; + void reset() override; + + private: + o2::tpc::qc::TrackClusters mQCTrackClusters{}; ///< TPC QC class from o2 + TRandom3* mRandomGenerator; + float mSamplingFraction; +}; + +} // namespace o2::quality_control_modules::tpc + +#endif // QC_MODULE_TPC_TRACKCLUSTERS_H diff --git a/Modules/TPC/run/tpcQCTrackClusters.json b/Modules/TPC/run/tpcQCTrackClusters.json new file mode 100644 index 0000000000..cbd97785ba --- /dev/null +++ b/Modules/TPC/run/tpcQCTrackClusters.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": { + }, + "monitoring": { + "url": "infologger:///debug?qc" + }, + "consul": { + "url": "" + }, + "conditionDB": { + "url": "ccdb-test.cern.ch:8080" + } + }, + "tasks": { + "TrackClusters": { + "active": "true", + "className": "o2::quality_control_modules::tpc::TrackClusters", + "moduleName": "QcTPC", + "detectorName": "TPC", + "cycleDurationSeconds": "200", + "maxNumberCycles": "-1", + "dataSource": { + "type": "direct", + "query": "inputTracks:TPC/TRACKS/0;inputClusters:TPC/CLUSTERNATIVE/0;inputClusRefs:TPC/CLUSREFS/0" + }, + "taskParameters": { + "cutAbsEta": "1.", "cutMinNCluster": "60", "cutMindEdxTot": "20.", + "seed": "0", "samplingFraction": "1" + }, + "location": "remote" + } + } + }, + "dataSamplingPolicies": [ + + ] +} diff --git a/Modules/TPC/src/TrackClusters.cxx b/Modules/TPC/src/TrackClusters.cxx new file mode 100644 index 0000000000..b3cbbbdbe6 --- /dev/null +++ b/Modules/TPC/src/TrackClusters.cxx @@ -0,0 +1,106 @@ +// 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 TrackClusters.cxx +/// \author Laura Serksnyte +/// + +// O2 includes +#include "Framework/ProcessingContext.h" +#include +#include "DataFormatsTPC/TrackTPC.h" +#include "TPCQC/Helpers.h" +#include "DataFormatsTPC/ClusterNative.h" +#include "DataFormatsTPC/WorkflowHelper.h" + +// QC includes +#include "QualityControl/QcInfoLogger.h" +#include "TPC/TrackClusters.h" +#include "Common/Utils.h" + +using namespace o2::framework; +using namespace o2::tpc; + +namespace o2::quality_control_modules::tpc +{ + +TrackClusters::TrackClusters() : TaskInterface() +{ +} + +void TrackClusters::initialize(InitContext& /*ctx*/) +{ + ILOG(Debug, Devel) << "initialize TPC TrackClusters QC task" << ENDM; + + // do random generator + const int seed = o2::quality_control_modules::common::getFromConfig(mCustomParameters, "seed"); + mRandomGenerator = new TRandom3(seed); + mSamplingFraction = o2::quality_control_modules::common::getFromConfig(mCustomParameters, "samplingFraction"); + + const int cutMinNCluster = o2::quality_control_modules::common::getFromConfig(mCustomParameters, "cutMinNCluster"); + const float cutMindEdxTot = o2::quality_control_modules::common::getFromConfig(mCustomParameters, "cutMindEdxTot"); + const float cutAbsEta = o2::quality_control_modules::common::getFromConfig(mCustomParameters, "cutAbsEta"); + + mQCTrackClusters.setTrackClustersCuts(cutMinNCluster, cutMindEdxTot, cutAbsEta); + mQCTrackClusters.initializeHistograms(); + + o2::tpc::qc::helpers::setStyleHistogramsInMap(mQCTrackClusters.getMapOfHisto()); + for (auto const& pair : mQCTrackClusters.getMapOfHisto()) { + for (auto& hist : pair.second) { + getObjectsManager()->startPublishing(hist.get()); + } + } +} + +void TrackClusters::startOfActivity(const Activity& /*activity*/) +{ + ILOG(Debug, Devel) << "startOfActivity" << ENDM; + // serksnyte: anything neeeded for start of activity (in track tasks there is a reset of histograms)? +} + +void TrackClusters::startOfCycle() +{ + ILOG(Debug, Devel) << "startOfCycle" << ENDM; +} + +void TrackClusters::monitorData(ProcessingContext& ctx) +{ + if (mRandomGenerator->Uniform(0., 1.) < mSamplingFraction) { + + using TrackType = std::vector; + using ClusterRefType = std::vector; + + auto tracks = ctx.inputs().get("inputTracks"); + const auto& inputsTPCclusters = o2::tpc::getWorkflowTPCInput(ctx, 0, false); + auto clusRefs = ctx.inputs().get("inputClusRefs"); + + mQCTrackClusters.processTrackAndClusters(&tracks, &inputsTPCclusters->clusterIndex, &clusRefs); + } +} + +void TrackClusters::endOfCycle() +{ + ILOG(Debug, Devel) << "endOfCycle" << ENDM; +} + +void TrackClusters::endOfActivity(const Activity& /*activity*/) +{ + ILOG(Debug, Devel) << "endOfActivity" << ENDM; +} + +void TrackClusters::reset() +{ + ILOG(Debug, Devel) << "Resetting the data" << ENDM; + mQCTrackClusters.resetHistograms(); +} + +} // namespace o2::quality_control_modules::tpc