Skip to content
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
11 changes: 5 additions & 6 deletions Common/Core/macros/testMetadataHelper.C
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@
#include <TString.h>
#include <TSystem.h>

#include <cstddef>
#include <fstream>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include <string.h>

// Taken from O2/Framework/AnalysisSupport/src/Plugin.cxx
auto readMetadata(std::unique_ptr<TFile>& currentFile) -> std::vector<o2::framework::ConfigParamSpec>
{
Expand All @@ -62,7 +61,7 @@ auto readMetadata(std::unique_ptr<TFile>& currentFile) -> std::vector<o2::framew
auto objString = dynamic_cast<TObjString*>(m->GetValue(obj));
std::string key = "aod-metadata-" + std::string(obj->GetName());
LOGP(info, "- {}: {} goes into key {}", obj->GetName(), objString->String().Data(), key);
char const* value = strdup(objString->String());
const auto value = objString->String().Data();
results.push_back(o2::framework::ConfigParamSpec{key, o2::framework::VariantType::String, value, {"Metadata in AOD"}});
}
return results;
Expand Down Expand Up @@ -104,7 +103,7 @@ std::map<std::string, bool> buildMapForCommitHash(const std::string& hash)
std::string lineOfO2VersionsWithHash;
while (std::getline(infileO2Versions, lineOfO2Version)) {
// Extract the tag
int stripSize = 4;
std::size_t stripSize = 4;
std::string tag = lineOfO2Version.substr(lineOfO2Version.find("O2::") + stripSize);
// Strip a trailing "-1" (some alienv entries append this)
stripSize = 2;
Expand Down Expand Up @@ -147,7 +146,7 @@ void populateCCDBWithCommitAvailability(const std::map<std::string, bool>& hasHa
metadata["O2Version"] = entry.first;
const std::string ccdbPath = "O2Version/CommitHash/" + commitHash;
auto headers = api.retrieveHeaders(ccdbPath, metadata, -1);
if (headers.size() != 0) {
if (!headers.empty()) {
LOG(info) << "Entry in CCDB already present for commit hash " << commitHash << ", skipping creation";
continue;
}
Expand Down Expand Up @@ -189,7 +188,7 @@ void testMetadataHelper(const std::string& aod = "/tmp/AO2D.root")

// Check if the hash is in the software tag
const std::string v = metadataInfo.getO2Version();
if (hasHashMap.find(v) == hasHashMap.end()) {
if (!hasHashMap.contains(v)) {
LOG(fatal) << "Software tag " << v << " not found in available O2 versions";
}
if (hasHashMap.at(v)) {
Expand Down
3 changes: 2 additions & 1 deletion Common/Tools/Multiplicity/macros/runGlauberFit.C
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
#include <RtypesCore.h>

#include <iostream>
#include <vector>

//________________________________________________________________
Double_t FastIntegrate(TF1* f1, Double_t a, Double_t b, Int_t n = 5)
{
// Do fast integration with N sampling points
const Int_t nc = n;
Double_t x[nc], y[nc];
std::vector<Double_t> x(nc), y(nc);
Double_t lWidth = (b - a) / (static_cast<double>(n - 1));
for (Int_t ii = 0; ii < n; ii++) {
x[ii] = a + (static_cast<double>(ii)) * lWidth;
Expand Down
14 changes: 7 additions & 7 deletions Common/Tools/PID/handleParamBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ std::string timeStampToHReadble(time_t rawtime)
if (rawtime < 0) {
return std::string(" latest");
}
struct tm* dt = new tm();
tm dt{};
char buffer[30];
rawtime /= 1000;
localtime_r(&rawtime, dt);
strftime(buffer, sizeof(buffer), "%H:%M %d-%m %Y", dt);
localtime_r(&rawtime, &dt);
strftime(buffer, sizeof(buffer), "%H:%M %d-%m %Y", &dt);
return std::string(buffer);
}

Expand Down Expand Up @@ -154,19 +154,19 @@ void setupTimestamps(int64_t& timestamp,

headers = api.retrieveHeaders(run_path, metadata, -1);

if (headers.count("STF") == 0) {
if (!headers.contains("STF")) {
LOGF(warning, "Cannot find STF for run %d in path '%s'. Using SOR as fallback", runnumber, run_path.data());
if (headers.count("SOR") == 0) {
if (!headers.contains("SOR")) {
LOGF(fatal, "Cannot find SOR in path '%s'.", run_path.data());
}
sor = atol(headers["SOR"].c_str());
} else {
sor = atol(headers["STF"].c_str());
}

if (headers.count("ETF") == 0) {
if (!headers.contains("ETF")) {
LOGF(warning, "Cannot find ETF for run %d in path '%s'. Using EOR as fallback", runnumber, run_path.data());
if (headers.count("EOR") == 0) {
if (!headers.contains("EOR")) {
LOGF(fatal, "Cannot find EOR in path '%s'.", run_path.data());
}
eor = atol(headers["EOR"].c_str());
Expand Down
Loading