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
9 changes: 9 additions & 0 deletions ALICE3/Core/DelphesO2TrackSmearer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
mCcdbManager->getCCDBAccessor().retrieveBlob(path, outPath, metadata, 1);
// Add CCDB handling logic here if needed
LOG(info) << " --- Now retrieving LUT file from CCDB to: " << filename;
if (mCleanupDownloadedFile) { // Clean up the downloaded file if needed
bool status = loadTable(pdg, filename, forceReload);
if (std::remove(filename) != 0) {
LOG(warn) << " --- Could not remove temporary LUT file: " << filename;
} else {
LOG(info) << " --- Removed temporary LUT file: " << filename;
}
return status;
}
} else { // File exists, proceed to load
LOG(info) << " --- LUT file already exists: " << filename << ". Skipping download.";
checkFile.close();
Expand Down
2 changes: 2 additions & 0 deletions ALICE3/Core/DelphesO2TrackSmearer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include <cstdio>
#include <fstream>
#include <iostream>

Check failure on line 34 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <map>

///////////////////////////////
Expand All @@ -54,7 +54,7 @@
float width = (max - min) / nbins;
float val = min + (bin + 0.5) * width;
if (log)
return pow(10., val);

Check failure on line 57 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
return val;
}
// function needed to interpolate some dimensions
Expand All @@ -64,8 +64,8 @@
int bin;
float returnVal = 0.5f;
if (log) {
bin = static_cast<int>((log10(val) - min) / width);

Check failure on line 67 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
returnVal = ((log10(val) - min) / width) - bin;

Check failure on line 68 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
} else {
bin = static_cast<int>((val - min) / width);
returnVal = val / width - bin;
Expand All @@ -78,7 +78,7 @@
float width = (max - min) / nbins;
int bin;
if (log)
bin = static_cast<int>((log10(val) - min) / width); // Changed due to MegaLinter error.

Check failure on line 81 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
// bin = (int)((log10(val) - min) / width); // Original line.
else
bin = static_cast<int>((val - min) / width); // Changed due to MegaLinter error.
Expand Down Expand Up @@ -107,9 +107,9 @@
} //;
void print()
{
printf(" version: %d \n", version);

Check failure on line 110 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
printf(" pdg: %d \n", pdg);

Check failure on line 111 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
printf(" field: %f \n", field);

Check failure on line 112 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
printf(" nchmap: ");
nchmap.print();
printf(" radmap: ");
Expand Down Expand Up @@ -199,7 +199,7 @@

int getIndexPDG(const int pdg)
{
switch (abs(pdg)) {

Check failure on line 202 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
case 11:
return 0; // Electron
case 13:
Expand All @@ -225,7 +225,7 @@

const char* getParticleName(int pdg)
{
switch (abs(pdg)) {

Check failure on line 228 in ALICE3/Core/DelphesO2TrackSmearer.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
case 11:
return "electron";
case 13:
Expand All @@ -250,6 +250,7 @@
}
void setdNdEta(float val) { mdNdEta = val; } //;
void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdbManager = mgr; } //;
void setCleanupDownloadedFile(bool val) { mCleanupDownloadedFile = val; } //;

protected:
static constexpr unsigned int nLUTs = 9; // Number of LUT available
Expand All @@ -263,6 +264,7 @@

private:
o2::ccdb::BasicCCDBManager* mCcdbManager = nullptr;
bool mCleanupDownloadedFile = true;
};

} // namespace delphes
Expand Down
Loading