Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
4 changes: 4 additions & 0 deletions 4 Detectors/MUON/MID/Calibration/macros/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ This can be done with a json file in the form:
{
"startRun": 557251,
"endRun": 557926,
"startTT": 1726300235000,
"endTT": 1726324000000,
"rejectList": [
{
"deId": 4,
Expand Down Expand Up @@ -99,6 +101,8 @@ This can be done with a json file in the form:
}
```

Where `startTT` and `endTT` are the timestamps in which the manual reject list will be built. To use the timestamps of start/end of the specified runs set `startTT` and `endTT` to 0 (or do not include them in the json).

The path to the file is then given to the macro with:

```shell
Expand Down
45 changes: 36 additions & 9 deletions 45 Detectors/MUON/MID/Calibration/macros/build_rejectlist.C
Original file line number Diff line number Diff line change
Expand Up @@ -316,25 +316,52 @@ RejectListStruct load_from_json(const o2::ccdb::CcdbApi& ccdbApi, const char* fi
{
// Open the JSON file
std::cout << "Reading reject list from file " << filename << std::endl;
RejectListStruct rl;
std::ifstream inFile(filename);
if (!inFile.is_open()) {
std::cerr << "Could not open the file!" << std::endl;
return rl;
return {};
}

// Create an IStreamWrapper for file input stream
rapidjson::IStreamWrapper isw(inFile);

rapidjson::Document doc;
if (doc.ParseStream(isw).HasParseError()) {
std::cerr << "Problem parsing " << filename << std::endl;
return rl;
return {};
}
auto startRange = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, doc["startRun"].GetInt());
auto endRange = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, doc["endRun"].GetInt());
rl.start = startRange.first;
rl.end = endRange.second;

// manual-validity interval in ms:
int64_t startTSms = 0;
int64_t endTSms = 0;

// run numbers from the json
int startRun = doc["startRun"].GetInt();
int endRun = doc["endRun"].GetInt();

// check if there are non-zero timestamps in the json
bool hasStartTT = doc.HasMember("startTT") && doc["startTT"].IsInt64() && doc["startTT"].GetInt64() != 0;
bool hasEndTT = doc.HasMember("endTT") && doc["endTT"].IsInt64() && doc["endTT"].GetInt64() != 0;
if (hasStartTT && hasEndTT) {
startTSms = doc["startTT"].GetInt64();
endTSms = doc["endTT"].GetInt64();

// sanity check against the run boundaries
auto runStart = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, startRun).first;
auto runEnd = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, endRun).second;
if (startTSms < runStart || endTSms > runEnd) {
std::cout
<< "\n\nWarning: manual timestamps [" << startTSms << " - " << endTSms
<< "] lie outside run interval [" << runStart << " - " << runEnd << "]\n\n\n";
}
} else {
// use run start/end if there are no timestamps in the json
startTSms = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, startRun).first;
endTSms = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, endRun).second;
}

RejectListStruct rl;
rl.start = startTSms;
rl.end = endTSms;
std::cout << "Manual RL validity: " << timeRangeToString(rl.start, rl.end) << std::endl;
auto rlArray = doc["rejectList"].GetArray();
for (auto& ar : rlArray) {
Expand Down Expand Up @@ -453,4 +480,4 @@ void build_rejectlist(long start, long end, const char* qcdbUrl = "http://ali-qc
outCCDBApi.storeAsTFileAny(&rl.rejectList, "MID/Calib/RejectList", metadata, rl.start, rl.end);
}
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.