Skip to content

Commit

Permalink
ctpdev: removing dependencies on RunManager (#2367)
Browse files Browse the repository at this point in the history
* fix: removing RunManager dependence

* clang

* fix: comment added
  • Loading branch information
lietava authored Jul 10, 2024
1 parent 635ab26 commit befd114
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 14 deletions.
10 changes: 7 additions & 3 deletions Modules/CTP/include/CTP/CountersQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@

#include "QualityControl/TaskInterface.h"
#include "DataFormatsCTP/Configuration.h"
#include "DataFormatsCTP/RunManager.h"
#include "TH1.h"

class TH1F;
class TH1D;
class TCanvas;

using namespace o2::quality_control::core;

//
// Fake class to compile. If the task CTPCounterTask will beused it will be fixed or the whole task shall be removed.
//
class CTPRunManager
{
};
namespace o2::quality_control_modules::ctp
{

Expand Down Expand Up @@ -97,7 +101,7 @@ class CTPCountersTask final : public TaskInterface
std::array<TCanvas*, 16> mTCanvasClassRates = { nullptr };
};

class CTPQcRunManager : public o2::ctp::CTPRunManager
class CTPQcRunManager : public CTPRunManager
{
public:
/// \brief Constructor
Expand Down
26 changes: 20 additions & 6 deletions Modules/CTP/src/CTPTrendingTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <QualityControl/ActivityHelpers.h>
#include <CCDB/BasicCCDBManager.h>
#include <DataFormatsCTP/Configuration.h>
#include "DataFormatsCTP/RunManager.h"
// #include "DataFormatsCTP/RunManager.h"

#include <TCanvas.h>
#include <TH1.h>
Expand Down Expand Up @@ -51,10 +51,22 @@ void CTPTrendingTask::initCTP(Trigger& t)
}

/// the reading of the ccdb from trending was already discussed and is related with the fact that CTPconfing may not be ready at the QC starts
o2::ctp::CTPRunManager::setCCDBHost(CCDBHost);
// o2::ctp::CTPRunManager::setCCDBHost(CCDBHost);
bool ok;
o2::ctp::CTPConfiguration CTPconfig = o2::ctp::CTPRunManager::getConfigFromCCDB(t.timestamp, run, ok);

// o2::ctp::CTPConfiguration CTPconfig = o2::ctp::CTPRunManager::getConfigFromCCDB(t.timestamp, run, ok);
auto& mgr = o2::ccdb::BasicCCDBManager::instance();
mgr.setURL(CCDBHost);
map<string, string> metadata; // can be empty
metadata["runNumber"] = run;
auto ctpconfigdb = mgr.getSpecific<o2::ctp::CTPConfiguration>(o2::ctp::CCDBPathCTPConfig, t.timestamp, metadata);
if (ctpconfigdb == nullptr) {
LOG(info) << "CTP config not in database, timestamp:" << t.timestamp;
ok = 0;
} else {
// ctpconfigdb->printStream(std::cout);
LOG(info) << "CTP config found. Run:" << run;
ok = 1;
}
if (!ok) {
ILOG(Warning, Support) << "CTP Config not found for run:" << run << " timesamp " << t.timestamp << ENDM;
return;
Expand Down Expand Up @@ -123,8 +135,10 @@ void CTPTrendingTask::initCTP(Trigger& t)
}

// get the indices of the classes we want to trend
std::vector<ctp::CTPClass> ctpcls = CTPconfig.getCTPClasses();
std::vector<int> clslist = CTPconfig.getTriggerClassList();
// std::vector<ctp::CTPClass> ctpcls = CTPconfig.getCTPClasses();
// std::vector<int> clslist = CTPconfig.getTriggerClassList();
std::vector<ctp::CTPClass> ctpcls = ctpconfigdb->getCTPClasses();
std::vector<int> clslist = ctpconfigdb->getTriggerClassList();
for (size_t i = 0; i < clslist.size(); i++) {
for (size_t j = 0; j < mNumberOfClasses; j++) {
if (ctpcls[i].name.find(mClassNames[j]) != std::string::npos) {
Expand Down
22 changes: 18 additions & 4 deletions Modules/CTP/src/RawDataQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "Headers/RAWDataHeader.h"
#include "DataFormatsCTP/Digits.h"
#include "DataFormatsCTP/Configuration.h"
#include "DataFormatsCTP/RunManager.h"
// #include "DataFormatsCTP/RunManager.h"
#include <Framework/InputRecord.h>
#include "Framework/TimingInfo.h"

Expand Down Expand Up @@ -80,13 +80,27 @@ void CTPRawDataReaderTask::startOfActivity(const Activity& activity)
ccdbName = "https://alice-ccdb.cern.ch";
}
/// the ccdb reading to be futher discussed
o2::ctp::CTPRunManager::setCCDBHost(ccdbName);
// o2::ctp::CTPRunManager::setCCDBHost(ccdbName);
bool ok;
o2::ctp::CTPConfiguration CTPconfig = o2::ctp::CTPRunManager::getConfigFromCCDB(mTimestamp, run, ok);
// o2::ctp::CTPConfiguration CTPconfig = o2::ctp::CTPRunManager::getConfigFromCCDB(mTimestamp, run, ok);
auto& mgr = o2::ccdb::BasicCCDBManager::instance();
mgr.setURL(ccdbName);
map<string, string> metadata; // can be empty
metadata["runNumber"] = run;
auto ctpconfigdb = mgr.getSpecific<o2::ctp::CTPConfiguration>(o2::ctp::CCDBPathCTPConfig, mTimestamp, metadata);
if (ctpconfigdb == nullptr) {
LOG(info) << "CTP config not in database, timestamp:" << mTimestamp;
ok = 0;
} else {
// ctpconfigdb->printStream(std::cout);
LOG(info) << "CTP config found. Run:" << run;
ok = 1;
}
if (ok) {
// get the index of the MB reference class
ILOG(Info, Support) << "CTP config found, run:" << run << ENDM;
std::vector<o2::ctp::CTPClass> ctpcls = CTPconfig.getCTPClasses();
// std::vector<o2::ctp::CTPClass> ctpcls = CTPconfig.getCTPClasses();
std::vector<o2::ctp::CTPClass> ctpcls = ctpconfigdb->getCTPClasses();
for (size_t i = 0; i < ctpcls.size(); i++) {
if (ctpcls[i].name.find(MBclassName) != std::string::npos) {
mIndexMBclass = ctpcls[i].getIndex() + 1;
Expand Down
2 changes: 1 addition & 1 deletion Modules/CTP/src/RawDataReaderCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "QualityControl/MonitorObject.h"
#include "QualityControl/Quality.h"
#include "QualityControl/QcInfoLogger.h"
#include "DataFormatsCTP/RunManager.h"
// #include "DataFormatsCTP/RunManager.h"
#include <DataFormatsCTP/Configuration.h>
// ROOT
#include <TH1.h>
Expand Down

0 comments on commit befd114

Please sign in to comment.