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

ctpdev: removing dependencies on RunManager #2367

Merged
merged 3 commits into from
Jul 10, 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
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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic with the ok seems circumvoluted...

LOG(info) << "CTP config not in database, timestamp:" << mTimestamp;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in QC we favour using ILOG i.e. the infologger

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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, remove lines instead of commenting. The history is any ways kept in git.

#include <DataFormatsCTP/Configuration.h>
// ROOT
#include <TH1.h>
Expand Down
Loading