Skip to content

Commit 6018214

Browse files
lhusovaLucia Anna Tarasovicova
andauthored
CTP: changes requested by review (#2362)
* change the TH1F to TH1D * changes required by the CTP code review --------- Co-authored-by: Lucia Anna Tarasovicova <lucia.anna.husova@cern.ch>
1 parent 8ad723f commit 6018214

7 files changed

Lines changed: 183 additions & 219 deletions

File tree

Modules/CTP/CMakeLists.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ add_library(O2QcCTP
44
src/TrendingConfigCTP.cxx
55
src/TH1ctpReductor.cxx )
66

7-
target_sources(O2QcCTP PRIVATE src/RawDataReaderCheck.cxx src/CountersQcTask.cxx src/RawDataQcTask.cxx src/TH1ctpReductor.cxx src/CTPTrendingTask.cxx)
7+
target_sources(O2QcCTP PRIVATE
8+
src/RawDataReaderCheck.cxx
9+
src/CountersQcTask.cxx
10+
src/RawDataQcTask.cxx
11+
src/TH1ctpReductor.cxx
12+
src/CTPTrendingTask.cxx )
813

914
target_include_directories(
1015
O2QcCTP
@@ -49,14 +54,3 @@ foreach(test ${TEST_SRCS})
4954
endforeach()
5055

5156
# ---- Extra scripts ----
52-
53-
install(FILES
54-
src/ctpTrending.json
55-
DESTINATION etc)
56-
57-
get_property(dirs
58-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
59-
PROPERTY INCLUDE_DIRECTORIES)
60-
foreach(dir ${dirs})
61-
message(STATUS "dir='${dir}'")
62-
endforeach()

Modules/CTP/include/CTP/CTPTrendingTask.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "CTP/TH1ctpReductor.h"
2424

2525
#include <string>
26-
#include <vector>
2726
#include <TTree.h>
2827

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

62-
o2::ctp::CTPConfiguration* mCTPconfig{ nullptr };
6361
TrendingConfigCTP mConfig;
6462
MetaData mMetaData;
65-
UInt_t mTime;
66-
67-
std::string mInputNamesDefault[5] = { "TVX", "VBA", "DMC", "EMC", "PH0" };
68-
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" };
69-
std::string mClassNamesDefault[5] = { "CMTVX-B-NOPF", "CMVBA-B-NOPF", "CTVXDMC-B-NOPF-EMC", "CTVXEMC-B-NOPF-EMC", "CTVXPH0-B-NOPF-PHSCPV" };
70-
std::string mClassNames[5] = { "", "", "", "", "" };
71-
std::string mInputNames[5] = { "", "", "", "", "" };
72-
const int mNumOfClasses = 5;
73-
const int mNumOfInputs = 5;
74-
int mClassIndex[5] = { 65, 65, 65, 65, 65 };
75-
int mInputIndex[5] = { 49, 49, 49, 49, 49 };
63+
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
64+
65+
std::string mInputNamesDefault[5] = { "TVX", "VBA", "DMC", "EMC", "PH0" }; // ctp inputs to be trended by default, unless modified in config.json
66+
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
67+
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
68+
std::string mClassNames[5] = { "", "", "", "", "" }; // the trended ctp classes will be filled in this array, either default or from config
69+
std::string mInputNames[5] = { "", "", "", "", "" }; // the trended ctp inputs will be filled in this array, either default or from config
70+
const int mNumberOfClasses = 5; // number of thrended ctp classes
71+
const int mNumberOfInputs = 5; // number of thrended ctp inputs
72+
int mClassIndex[5] = { 65, 65, 65, 65, 65 }; // indices of trended ctp classes, found in CTPconfig
73+
int mInputIndex[5] = { 49, 49, 49, 49, 49 }; // indices of trended ctp inputs, found in CTPconfig
74+
bool mCTPconfigFound = false; // bool telling whether the CTPconfing was already found
7675

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

Modules/CTP/include/CTP/RawDataQcTask.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
#include "Common/TH1Ratio.h"
2424
#include <memory>
2525

26-
class TH1F;
26+
class TH1D;
2727

2828
using namespace o2::quality_control::core;
2929
using namespace o2::quality_control_modules::common;
3030
namespace o2::quality_control_modules::ctp
3131
{
3232

33-
/// \brief Task for reading the CTP inputs
33+
/// \brief Task for reading the CTP inputs and CTP classes
3434
class CTPRawDataReaderTask final : public TaskInterface
3535
{
3636
public:
@@ -49,16 +49,15 @@ class CTPRawDataReaderTask final : public TaskInterface
4949
void reset() override;
5050

5151
private:
52-
o2::ctp::RawDataDecoder mDecoder;
53-
std::unique_ptr<TH1FRatio> mHistoInputs = nullptr;
54-
std::unique_ptr<TH1FRatio> mHistoClasses = nullptr;
55-
std::unique_ptr<TH1FRatio> mHistoInputRatios = nullptr;
56-
std::unique_ptr<TH1FRatio> mHistoClassRatios = nullptr;
57-
std::unique_ptr<TH1F> mHistoMTVXBC = nullptr;
52+
o2::ctp::RawDataDecoder mDecoder; // ctp raw data decoder
53+
std::unique_ptr<TH1DRatio> mHistoInputs = nullptr; // histogram with ctp inputs
54+
std::unique_ptr<TH1DRatio> mHistoClasses = nullptr; // histogram with ctp classes
55+
std::unique_ptr<TH1DRatio> mHistoInputRatios = nullptr; // histogram with ctp input ratios to MB
56+
std::unique_ptr<TH1DRatio> mHistoClassRatios = nullptr; // histogram with ctp class ratios to MB
57+
std::unique_ptr<TH1D> mHistoMTVXBC = nullptr; // histogram of BC positions to check LHC filling scheme
5858
int mRunNumber;
5959
long int mTimestamp;
60-
int mIndexMBclass = -1;
61-
// 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" };
60+
int mIndexMBclass = -1; // index for the MB ctp class, which is used as scaling for the ratios
6261
};
6362

6463
} // namespace o2::quality_control_modules::ctp

Modules/CTP/include/CTP/RawDataReaderCheck.h

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
#include "CommonConstants/LHCConstants.h"
2222
#include "DetectorsBase/GRPGeomHelper.h"
2323
#include <bitset>
24-
class TH1F;
24+
class TH1D;
2525

2626
namespace o2::quality_control_modules::ctp
2727
{
2828

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

4949
private:
5050
int getRunNumberFromMO(std::shared_ptr<MonitorObject> mo);
51-
int getNumberFilledBins(TH1F* hist);
52-
int checkChange(TH1F* fHist, TH1F* fHistPrev, std::vector<int>& vIndexBad, std::vector<int>& vIndexMedium);
53-
Quality SetQualityResult(std::vector<int>& vBad, std::vector<int>& vMedium);
54-
void ClearIndexVectors();
51+
int checkChange(TH1D* mHist, TH1D* mHistPrev);
52+
Quality setQualityResult(std::vector<int>& vBad, std::vector<int>& vMedium);
53+
void clearIndexVectors();
5554
long int mTimestamp;
56-
float mThreshold = -1;
57-
float mThresholdRateBad;
58-
float mThresholdRateMedium;
59-
float mThresholdRateRatioBad;
60-
float mThresholdRateRatioMedium;
61-
float mFraction;
62-
int mCycleDuration;
63-
bool flagRatio = false;
64-
bool flagInput = false;
65-
TH1F* fHistInputPrevious = nullptr;
66-
TH1F* fHistClassesPrevious = nullptr;
67-
TH1F* fHistInputRatioPrevious = nullptr;
68-
TH1F* fHistClassRatioPrevious = nullptr;
69-
std::vector<int> vGoodBC;
70-
std::vector<int> vMediumBC;
71-
std::vector<int> vBadBC;
72-
std::vector<int> vIndexBad;
73-
std::vector<int> vIndexMedium;
74-
std::bitset<o2::constants::lhc::LHCMaxBunches> mLHCBCs;
75-
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" };
55+
float mThreshold = -1; // threshold for BCs
56+
float mThresholdRateBad; // threshold for the relative change in ctp input and class rates
57+
float mThresholdRateMedium; // threshold for the relative change in ctp input and class rates
58+
float mThresholdRateRatioBad; // threshold for the relative change in ctp input and class ratios
59+
float mThresholdRateRatioMedium; // threshold for the relative change in ctp input and class ratios
60+
bool mFlagRatio = false; // flag that a ratio plot is checked
61+
bool mFlagInput = false; // flag that an input plot is checked
62+
TH1D* mHistInputPrevious = nullptr; // histogram storing ctp input rates from previous cycle
63+
TH1D* mHistClassesPrevious = nullptr; // histogram storing ctp class rates from previous cycle
64+
TH1D* mHistInputRatioPrevious = nullptr; // histogram storing ctp input ratios to MB from previous cycle
65+
TH1D* mHistClassRatioPrevious = nullptr; // histogram storing ctp class ratios to MB from previous cycle
66+
std::vector<int> mVecGoodBC; // vector of good BC positions
67+
std::vector<int> mVecMediumBC; // vector of medium BC positions, we expect a BC at this position, but inputs are below mThreshold
68+
std::vector<int> mVecBadBC; // vector of bad BC positions, we don't expect a BC at this position, but inputs are abow mThreshold
69+
std::vector<int> mVecIndexBad; // vector of ctp input and class indices, which had a big relative change
70+
std::vector<int> mVecIndexMedium; // vector of ctp input and class indices, which had a relative change
71+
std::bitset<o2::constants::lhc::LHCMaxBunches> mLHCBCs; // LHC filling scheme
72+
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
73+
74+
ClassDefOverride(RawDataReaderCheck, 6);
7675
};
7776

7877
} // namespace o2::quality_control_modules::ctp

0 commit comments

Comments
 (0)