From 543175b9afeb4627571d03e64a7bced442415555 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Wed, 20 Aug 2025 11:41:46 +0200 Subject: [PATCH 1/7] Customize tmpDir for TrackTuner download accoding to track-propagation devices. --- Common/TableProducer/trackPropagation.cxx | 16 +++++++++++++++- Common/Tools/TrackTuner.h | 3 +-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Common/TableProducer/trackPropagation.cxx b/Common/TableProducer/trackPropagation.cxx index e1b6528ce53..c4759fb148e 100644 --- a/Common/TableProducer/trackPropagation.cxx +++ b/Common/TableProducer/trackPropagation.cxx @@ -14,6 +14,7 @@ // #include "TableHelper.h" + #include "Common/Tools/TrackTuner.h" // The Run 3 AO2D stores the tracks at the point of innermost update. For a track with ITS this is the innermost (or second innermost) @@ -133,7 +134,20 @@ struct TrackPropagation { break; } - trackTunerObj.getDcaGraphs(); + /// see if other track-propagation devices are present + int counter = 0; + LOG(info) << " ---> looking for track-propagation devices"; + const auto& workflows = initContext.services().get(); + for (const DeviceSpec& device : workflows.devices) { + if (device.name.compare("track-propagation") == 0) { + // init HF event selection helper + LOG(info) << " FOUND!"; + counter++; + } + } + + std::string tmpDirName = std::string("./") + std::to_string(counter); + trackTunerObj.getDcaGraphs(tmpDirName); trackTunedTracks->SetTitle(outputStringParams.c_str()); trackTunedTracks->GetXaxis()->SetBinLabel(1, "all tracks"); } diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index 60cf377a410..709352c0365 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -447,7 +447,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { return outputString; } - void getDcaGraphs() + void getDcaGraphs(std::string tmpDir = ".") { std::string fullNameInputFile = ""; std::string fullNameFileQoverPt = ""; @@ -456,7 +456,6 @@ struct TrackTuner : o2::framework::ConfigurableGroup { /// use input correction file from CCDB // properly init the ccdb - std::string tmpDir = "."; ccdbApi.init("http://alice-ccdb.cern.ch"); // get the DCA correction file from CCDB From ebfb5def7d4f64ef312bf56dc5bc7bb6001e9e7d Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Wed, 20 Aug 2025 11:43:00 +0200 Subject: [PATCH 2/7] Remove useless newline. --- Common/TableProducer/trackPropagation.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Common/TableProducer/trackPropagation.cxx b/Common/TableProducer/trackPropagation.cxx index c4759fb148e..3b859070b56 100644 --- a/Common/TableProducer/trackPropagation.cxx +++ b/Common/TableProducer/trackPropagation.cxx @@ -14,7 +14,6 @@ // #include "TableHelper.h" - #include "Common/Tools/TrackTuner.h" // The Run 3 AO2D stores the tracks at the point of innermost update. For a track with ITS this is the innermost (or second innermost) From e2f1c4c8e6f7e40f95b51f636051bc9e6e4da960 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Wed, 20 Aug 2025 14:27:55 +0200 Subject: [PATCH 3/7] Adjust LOG(info). --- Common/TableProducer/trackPropagation.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/TableProducer/trackPropagation.cxx b/Common/TableProducer/trackPropagation.cxx index 3b859070b56..08ea5896b88 100644 --- a/Common/TableProducer/trackPropagation.cxx +++ b/Common/TableProducer/trackPropagation.cxx @@ -14,6 +14,7 @@ // #include "TableHelper.h" + #include "Common/Tools/TrackTuner.h" // The Run 3 AO2D stores the tracks at the point of innermost update. For a track with ITS this is the innermost (or second innermost) @@ -139,11 +140,10 @@ struct TrackPropagation { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { if (device.name.compare("track-propagation") == 0) { - // init HF event selection helper - LOG(info) << " FOUND!"; counter++; } } + LOGF(info, "Number of track propagation tasks detected: %i", counter); std::string tmpDirName = std::string("./") + std::to_string(counter); trackTunerObj.getDcaGraphs(tmpDirName); From f951cc62713f327e6de83e7abf466bd189984133 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Wed, 20 Aug 2025 19:10:27 +0200 Subject: [PATCH 4/7] Download file from CCDB only if not present in local folder. --- Common/TableProducer/trackPropagation.cxx | 14 +--------- Common/Tools/TrackTuner.h | 32 ++++++++++++++++------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Common/TableProducer/trackPropagation.cxx b/Common/TableProducer/trackPropagation.cxx index 08ea5896b88..dbe1c93a56c 100644 --- a/Common/TableProducer/trackPropagation.cxx +++ b/Common/TableProducer/trackPropagation.cxx @@ -134,19 +134,7 @@ struct TrackPropagation { break; } - /// see if other track-propagation devices are present - int counter = 0; - LOG(info) << " ---> looking for track-propagation devices"; - const auto& workflows = initContext.services().get(); - for (const DeviceSpec& device : workflows.devices) { - if (device.name.compare("track-propagation") == 0) { - counter++; - } - } - LOGF(info, "Number of track propagation tasks detected: %i", counter); - - std::string tmpDirName = std::string("./") + std::to_string(counter); - trackTunerObj.getDcaGraphs(tmpDirName); + trackTunerObj.getDcaGraphs(); trackTunedTracks->SetTitle(outputStringParams.c_str()); trackTunedTracks->GetXaxis()->SetBinLabel(1, "all tracks"); } diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index 709352c0365..aa69b1e4031 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -458,18 +459,31 @@ struct TrackTuner : o2::framework::ConfigurableGroup { // properly init the ccdb 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 + if (stat(fullNameInputFile.c_str(), &sbDca) == 0) { + 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 + if (stat(fullNameFileQoverPt.c_str(), &sbQoverPt) == 0) { + 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; From 7a59741161c907117e2bb593967217f3495ce936 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Wed, 20 Aug 2025 19:11:14 +0200 Subject: [PATCH 5/7] Remove useless newline. --- Common/TableProducer/trackPropagation.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Common/TableProducer/trackPropagation.cxx b/Common/TableProducer/trackPropagation.cxx index dbe1c93a56c..e1b6528ce53 100644 --- a/Common/TableProducer/trackPropagation.cxx +++ b/Common/TableProducer/trackPropagation.cxx @@ -14,7 +14,6 @@ // #include "TableHelper.h" - #include "Common/Tools/TrackTuner.h" // The Run 3 AO2D stores the tracks at the point of innermost update. For a track with ITS this is the innermost (or second innermost) From d0be0f712e4862bd999309aff02e79e41411e035 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Wed, 20 Aug 2025 19:13:03 +0200 Subject: [PATCH 6/7] Restore detail. --- Common/Tools/TrackTuner.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index aa69b1e4031..2ae5d7cec6f 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -448,7 +448,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { return outputString; } - void getDcaGraphs(std::string tmpDir = ".") + void getDcaGraphs() { std::string fullNameInputFile = ""; std::string fullNameFileQoverPt = ""; @@ -457,6 +457,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { /// use input correction file from CCDB // properly init the ccdb + std::string tmpDir = "."; ccdbApi.init("http://alice-ccdb.cern.ch"); // name of the file in the tmp local folder From 091df1046d7ba8564c49ee17408682b7ad9e5297 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Wed, 20 Aug 2025 19:14:03 +0200 Subject: [PATCH 7/7] Add comment. --- Common/Tools/TrackTuner.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Common/Tools/TrackTuner.h b/Common/Tools/TrackTuner.h index 2ae5d7cec6f..7f04e27a212 100644 --- a/Common/Tools/TrackTuner.h +++ b/Common/Tools/TrackTuner.h @@ -467,6 +467,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { // get the DCA correction file from CCDB if not yet downloaded before struct stat sbDca; // search utility 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..."; @@ -478,6 +479,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup { // get the Q/Pt correction file from CCDB if not yet downloaded before struct stat sbQoverPt; // search utility 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...";