Skip to content
Closed
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
34 changes: 25 additions & 9 deletions Common/Tools/TrackTuner.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <TGraphErrors.h>

#include <fmt/core.h>
#include <sys/stat.h>

#include <algorithm>
#include <map>
Expand All @@ -57,8 +58,8 @@
DECLARE_SOA_COLUMN(TunedQOverPt, tunedQOverPt, float);

/// configuration source
enum configSource : int { InputString = 1,

Check failure on line 61 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/enum]

Use UpperCamelCase for names of enumerators and their values.
Configurables };

Check failure on line 62 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
} // namespace track_tuner

DECLARE_SOA_TABLE(TrackTunerTable, "AOD", "TRACKTUNERTABLE", //!
Expand All @@ -68,10 +69,10 @@
struct TrackTuner : o2::framework::ConfigurableGroup {

std::string prefix = "trackTuner"; // JSON group name
o2::framework::Configurable<bool> cfgDebugInfo{"debugInfo", false, "Flag to switch on the debug printout"};

Check failure on line 72 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
o2::framework::Configurable<bool> cfgUpdateTrackDCAs{"updateTrackDCAs", false, "Flag to enable the DCA smearing"};

Check failure on line 73 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
o2::framework::Configurable<bool> cfgUpdateTrackCovMat{"updateTrackCovMat", false, "Flag to enable the DCA covariance-matrix smearing"};

Check failure on line 74 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
o2::framework::Configurable<bool> cfgUpdateCurvature{"updateCurvature", false, "Flag to enable the Q/Pt smearing after the propagation to the production point"};

Check failure on line 75 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
o2::framework::Configurable<bool> cfgUpdateCurvatureIU{"updateCurvatureIU", false, "Flag to enable the Q/Pt smearing before the propagation to the production point"};
o2::framework::Configurable<bool> cfgUpdatePulls{"updatePulls", false, "Flag to enable the pulls smearing"};
o2::framework::Configurable<bool> cfgIsInputFileFromCCDB{"isInputFileFromCCDB", false, "True: files from CCDB; False: fils from local path (debug)"};
Expand Down Expand Up @@ -249,7 +250,7 @@

LOG(info) << "[TrackTuner]";
LOG(info) << "[TrackTuner] >>> String slices:";
for (const std::string& s : slices)

Check failure on line 253 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
LOG(info) << "[TrackTuner] " << s;

/// check if the number of input parameters is correct
Expand Down Expand Up @@ -459,18 +460,33 @@
std::string tmpDir = ".";
ccdbApi.init("http://alice-ccdb.cern.ch");

// get the DCA correction file from CCDB
if (!ccdbApi.retrieveBlob(pathInputFile.data(), tmpDir, metadata, 0, false, nameInputFile.data())) {
LOG(fatal) << "[TrackTuner] input file for DCA corrections not found on CCDB, please check the pathInputFile and nameInputFile!";
// name of the file in the tmp local folder
fullNameInputFile = tmpDir + std::string("/") + nameInputFile;
fullNameFileQoverPt = tmpDir + std::string("/") + nameFileQoverPt;

// get the DCA correction file from CCDB if not yet downloaded before
struct stat sbDca; // search utility

Check failure on line 468 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/struct]

Use UpperCamelCase for names of structs.
if (stat(fullNameInputFile.c_str(), &sbDca) == 0) {
// file found
LOG(info) << " [TrackTuner] File " << fullNameInputFile << " already downloaded. Not downloading it anymore";
} else {
LOG(info) << "[TrackTuner] downloading input file " << nameInputFile << " from CCDB...";
if (!ccdbApi.retrieveBlob(pathInputFile.data(), tmpDir, metadata, 0, false, nameInputFile.data())) {
LOG(fatal) << "[TrackTuner] input file for DCA corrections not found on CCDB, please check the pathInputFile and nameInputFile!";
}
}

// get the Q/Pt correction file from CCDB
if (!ccdbApi.retrieveBlob(pathFileQoverPt.data(), tmpDir, metadata, 0, false, nameFileQoverPt.data())) {
LOG(fatal) << "[TrackTuner] input file for Q/Pt corrections not found on CCDB, please check the pathFileQoverPt and nameFileQoverPt!";
// get the Q/Pt correction file from CCDB if not yet downloaded before
struct stat sbQoverPt; // search utility

Check failure on line 480 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/struct]

Use UpperCamelCase for names of structs.
if (stat(fullNameFileQoverPt.c_str(), &sbQoverPt) == 0) {
// file found
LOG(info) << " [TrackTuner] File " << fullNameFileQoverPt << " already downloaded. Not downloading it anymore";
} else {
LOG(info) << "[TrackTuner] downloading input file " << nameFileQoverPt << " from CCDB...";
if (!ccdbApi.retrieveBlob(pathFileQoverPt.data(), tmpDir, metadata, 0, false, nameFileQoverPt.data())) {
LOG(fatal) << "[TrackTuner] input file for Q/Pt corrections not found on CCDB, please check the pathFileQoverPt and nameFileQoverPt!";
}
}
// point to the file in the tmp local folder
fullNameInputFile = tmpDir + std::string("/") + nameInputFile;
fullNameFileQoverPt = tmpDir + std::string("/") + nameFileQoverPt;
} else {
/// use input correction file from local filesystem
fullNameInputFile = pathInputFile + std::string("/") + nameInputFile;
Expand Down Expand Up @@ -595,7 +611,7 @@
// get phibin
double phiMC = mcparticle.phi();
if (phiMC < 0.)
phiMC += o2::constants::math::TwoPI; // 2 * std::numbers::pi;//

Check failure on line 614 in Common/Tools/TrackTuner.h

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Use RecoDecay::constrainAngle to restrict angle to a given range.
int phiBin = phiMC / (o2::constants::math::TwoPI + 0.0000001) * nPhiBins; // 0.0000001 just a numerical protection

dcaXYResMC = evalGraph(ptMC, grDcaXYResVsPtPionMC[phiBin].get());
Expand Down
Loading