Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTP: changes requested by review #2362

Merged
merged 2 commits into from
Jul 4, 2024
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
18 changes: 6 additions & 12 deletions Modules/CTP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ add_library(O2QcCTP
src/TrendingConfigCTP.cxx
src/TH1ctpReductor.cxx )

target_sources(O2QcCTP PRIVATE src/RawDataReaderCheck.cxx src/CountersQcTask.cxx src/RawDataQcTask.cxx src/TH1ctpReductor.cxx src/CTPTrendingTask.cxx)
target_sources(O2QcCTP PRIVATE
src/RawDataReaderCheck.cxx
src/CountersQcTask.cxx
src/RawDataQcTask.cxx
src/TH1ctpReductor.cxx
src/CTPTrendingTask.cxx )

target_include_directories(
O2QcCTP
Expand Down Expand Up @@ -49,14 +54,3 @@ foreach(test ${TEST_SRCS})
endforeach()

# ---- Extra scripts ----

install(FILES
src/ctpTrending.json
DESTINATION etc)

get_property(dirs
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
message(STATUS "dir='${dir}'")
endforeach()
25 changes: 12 additions & 13 deletions Modules/CTP/include/CTP/CTPTrendingTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "CTP/TH1ctpReductor.h"

#include <string>
#include <vector>
#include <TTree.h>

namespace o2::quality_control::repository
Expand Down Expand Up @@ -59,20 +58,20 @@ class CTPTrendingTask : public PostProcessingInterface
void trendValues(const Trigger& t, quality_control::repository::DatabaseInterface& qcdb);
void generatePlots();

o2::ctp::CTPConfiguration* mCTPconfig{ nullptr };
TrendingConfigCTP mConfig;
MetaData mMetaData;
UInt_t mTime;

std::string mInputNamesDefault[5] = { "TVX", "VBA", "DMC", "EMC", "PH0" };
std::string ctpinputs[49] = { " T0A", " T0C", " TVX", " TSC", " TCE", " VBA", " VOR", " VIR", " VNC", " VCH", "11", "12", " UCE", "DMC", " USC", " UVX", " U0C", " U0A", "COS", "LAS", "EMC", " PH0", "23", "24", "ZED", "ZNC", "PHL", "PHH", "PHM", "30", "31", "32", "33", "34", "35", "36", "EJ1", "EJ2", "EG1", "EG2", "DJ1", "DG1", "DJ2", "DG2", "45", "46", "47", "48", "49" };
std::string mClassNamesDefault[5] = { "CMTVX-B-NOPF", "CMVBA-B-NOPF", "CTVXDMC-B-NOPF-EMC", "CTVXEMC-B-NOPF-EMC", "CTVXPH0-B-NOPF-PHSCPV" };
std::string mClassNames[5] = { "", "", "", "", "" };
std::string mInputNames[5] = { "", "", "", "", "" };
const int mNumOfClasses = 5;
const int mNumOfInputs = 5;
int mClassIndex[5] = { 65, 65, 65, 65, 65 };
int mInputIndex[5] = { 49, 49, 49, 49, 49 };
UInt_t mTime; // this is not a specific time, used for x axis in trending plots, this name is used in all other modules, please suggest a new name if not appropriate

std::string mInputNamesDefault[5] = { "TVX", "VBA", "DMC", "EMC", "PH0" }; // ctp inputs to be trended by default, unless modified in config.json
std::string ctpinputs[49] = { " T0A", " T0C", " TVX", " TSC", " TCE", " VBA", " VOR", " VIR", " VNC", " VCH", "11", "12", " UCE", "DMC", " USC", " UVX", " U0C", " U0A", "COS", "LAS", "EMC", " PH0", "23", "24", "ZED", "ZNC", "PHL", "PHH", "PHM", "30", "31", "32", "33", "34", "35", "36", "EJ1", "EJ2", "EG1", "EG2", "DJ1", "DG1", "DJ2", "DG2", "45", "46", "47", "48", "49" }; // all ctp input names
std::string mClassNamesDefault[5] = { "CMTVX-B-NOPF", "CMVBA-B-NOPF", "CTVXDMC-B-NOPF-EMC", "CTVXEMC-B-NOPF-EMC", "CTVXPH0-B-NOPF-PHSCPV" }; // ctp classes to be trended by default, unless modified in config.json
std::string mClassNames[5] = { "", "", "", "", "" }; // the trended ctp classes will be filled in this array, either default or from config
std::string mInputNames[5] = { "", "", "", "", "" }; // the trended ctp inputs will be filled in this array, either default or from config
const int mNumberOfClasses = 5; // number of thrended ctp classes
const int mNumberOfInputs = 5; // number of thrended ctp inputs
int mClassIndex[5] = { 65, 65, 65, 65, 65 }; // indices of trended ctp classes, found in CTPconfig
int mInputIndex[5] = { 49, 49, 49, 49, 49 }; // indices of trended ctp inputs, found in CTPconfig
bool mCTPconfigFound = false; // bool telling whether the CTPconfing was already found

std::map<std::string, TObject*> mPlots;

Expand Down
19 changes: 9 additions & 10 deletions Modules/CTP/include/CTP/RawDataQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
#include "Common/TH1Ratio.h"
#include <memory>

class TH1F;
class TH1D;

using namespace o2::quality_control::core;
using namespace o2::quality_control_modules::common;
namespace o2::quality_control_modules::ctp
{

/// \brief Task for reading the CTP inputs
/// \brief Task for reading the CTP inputs and CTP classes
class CTPRawDataReaderTask final : public TaskInterface
{
public:
Expand All @@ -49,16 +49,15 @@ class CTPRawDataReaderTask final : public TaskInterface
void reset() override;

private:
o2::ctp::RawDataDecoder mDecoder;
std::unique_ptr<TH1FRatio> mHistoInputs = nullptr;
std::unique_ptr<TH1FRatio> mHistoClasses = nullptr;
std::unique_ptr<TH1FRatio> mHistoInputRatios = nullptr;
std::unique_ptr<TH1FRatio> mHistoClassRatios = nullptr;
std::unique_ptr<TH1F> mHistoMTVXBC = nullptr;
o2::ctp::RawDataDecoder mDecoder; // ctp raw data decoder
std::unique_ptr<TH1DRatio> mHistoInputs = nullptr; // histogram with ctp inputs
std::unique_ptr<TH1DRatio> mHistoClasses = nullptr; // histogram with ctp classes
std::unique_ptr<TH1DRatio> mHistoInputRatios = nullptr; // histogram with ctp input ratios to MB
std::unique_ptr<TH1DRatio> mHistoClassRatios = nullptr; // histogram with ctp class ratios to MB
std::unique_ptr<TH1D> mHistoMTVXBC = nullptr; // histogram of BC positions to check LHC filling scheme
int mRunNumber;
long int mTimestamp;
int mIndexMBclass = -1;
// const char* ctpinputs[o2::ctp::CTP_NINPUTS + 1] = { " T0A", " T0C", " TVX", " TSC", " TCE", " VBA", " VOR", " VIR", " VNC", " VCH", "11", "12", " UCE", "DMC", " USC", " UVX", " U0C", " U0A", "COS", "LAS", "EMC", " PH0", "23", "24", "ZED", "ZNC", "PHL", "PHH", "PHM", "30", "31", "32", "33", "34", "35", "36", "EJ1", "EJ2", "EG1", "EG2", "DJ1", "DG1", "DJ2", "DG2", "45", "46", "47", "48", "49" };
int mIndexMBclass = -1; // index for the MB ctp class, which is used as scaling for the ratios
};

} // namespace o2::quality_control_modules::ctp
Expand Down
51 changes: 25 additions & 26 deletions Modules/CTP/include/CTP/RawDataReaderCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
#include "CommonConstants/LHCConstants.h"
#include "DetectorsBase/GRPGeomHelper.h"
#include <bitset>
class TH1F;
class TH1D;

namespace o2::quality_control_modules::ctp
{

/// \brief This class is checking the expected BC filling scheme
/// \brief This class is checking the relative change of ctp input and ctp class rates and ratios to MB
/// \author Lucia Anna Tarasovicova
class RawDataReaderCheck : public o2::quality_control::checker::CheckInterface
{
Expand All @@ -44,35 +45,33 @@ class RawDataReaderCheck : public o2::quality_control::checker::CheckInterface
void startOfActivity(const Activity& activity) override;
const double_t nofOrbitsPerTF = o2::base::GRPGeomHelper::instance().getNHBFPerTF();
const double_t TimeTF = nofOrbitsPerTF * o2::constants::lhc::LHCOrbitMUS / 1e6; // in seconds
ClassDefOverride(RawDataReaderCheck, 5);

private:
int getRunNumberFromMO(std::shared_ptr<MonitorObject> mo);
int getNumberFilledBins(TH1F* hist);
int checkChange(TH1F* fHist, TH1F* fHistPrev, std::vector<int>& vIndexBad, std::vector<int>& vIndexMedium);
Quality SetQualityResult(std::vector<int>& vBad, std::vector<int>& vMedium);
void ClearIndexVectors();
int checkChange(TH1D* mHist, TH1D* mHistPrev);
Quality setQualityResult(std::vector<int>& vBad, std::vector<int>& vMedium);
void clearIndexVectors();
long int mTimestamp;
float mThreshold = -1;
float mThresholdRateBad;
float mThresholdRateMedium;
float mThresholdRateRatioBad;
float mThresholdRateRatioMedium;
float mFraction;
int mCycleDuration;
bool flagRatio = false;
bool flagInput = false;
TH1F* fHistInputPrevious = nullptr;
TH1F* fHistClassesPrevious = nullptr;
TH1F* fHistInputRatioPrevious = nullptr;
TH1F* fHistClassRatioPrevious = nullptr;
std::vector<int> vGoodBC;
std::vector<int> vMediumBC;
std::vector<int> vBadBC;
std::vector<int> vIndexBad;
std::vector<int> vIndexMedium;
std::bitset<o2::constants::lhc::LHCMaxBunches> mLHCBCs;
const char* ctpinputs[49] = { " T0A", " T0C", " TVX", " TSC", " TCE", " VBA", " VOR", " VIR", " VNC", " VCH", "11", "12", " UCE", "DMC", " USC", " UVX", " U0C", " U0A", "COS", "LAS", "EMC", " PH0", "23", "24", "ZED", "ZNC", "PHL", "PHH", "PHM", "30", "31", "32", "33", "34", "35", "36", "EJ1", "EJ2", "EG1", "EG2", "DJ1", "DG1", "DJ2", "DG2", "45", "46", "47", "48", "49" };
float mThreshold = -1; // threshold for BCs
float mThresholdRateBad; // threshold for the relative change in ctp input and class rates
float mThresholdRateMedium; // threshold for the relative change in ctp input and class rates
float mThresholdRateRatioBad; // threshold for the relative change in ctp input and class ratios
float mThresholdRateRatioMedium; // threshold for the relative change in ctp input and class ratios
bool mFlagRatio = false; // flag that a ratio plot is checked
bool mFlagInput = false; // flag that an input plot is checked
TH1D* mHistInputPrevious = nullptr; // histogram storing ctp input rates from previous cycle
TH1D* mHistClassesPrevious = nullptr; // histogram storing ctp class rates from previous cycle
TH1D* mHistInputRatioPrevious = nullptr; // histogram storing ctp input ratios to MB from previous cycle
TH1D* mHistClassRatioPrevious = nullptr; // histogram storing ctp class ratios to MB from previous cycle
std::vector<int> mVecGoodBC; // vector of good BC positions
std::vector<int> mVecMediumBC; // vector of medium BC positions, we expect a BC at this position, but inputs are below mThreshold
std::vector<int> mVecBadBC; // vector of bad BC positions, we don't expect a BC at this position, but inputs are abow mThreshold
std::vector<int> mVecIndexBad; // vector of ctp input and class indices, which had a big relative change
std::vector<int> mVecIndexMedium; // vector of ctp input and class indices, which had a relative change
std::bitset<o2::constants::lhc::LHCMaxBunches> mLHCBCs; // LHC filling scheme
const char* ctpinputs[49] = { " T0A", " T0C", " TVX", " TSC", " TCE", " VBA", " VOR", " VIR", " VNC", " VCH", "11", "12", " UCE", "DMC", " USC", " UVX", " U0C", " U0A", "COS", "LAS", "EMC", " PH0", "23", "24", "ZED", "ZNC", "PHL", "PHH", "PHM", "30", "31", "32", "33", "34", "35", "36", "EJ1", "EJ2", "EG1", "EG2", "DJ1", "DG1", "DJ2", "DG2", "45", "46", "47", "48", "49" }; // ctp input names

ClassDefOverride(RawDataReaderCheck, 6);
};

} // namespace o2::quality_control_modules::ctp
Expand Down
Loading
Loading