|
41 | 41 | #include <TGraphErrors.h> |
42 | 42 |
|
43 | 43 | #include <fmt/core.h> |
| 44 | +#include <sys/stat.h> |
44 | 45 |
|
45 | 46 | #include <algorithm> |
46 | 47 | #include <map> |
@@ -458,18 +459,31 @@ struct TrackTuner : o2::framework::ConfigurableGroup { |
458 | 459 | // properly init the ccdb |
459 | 460 | ccdbApi.init("http://alice-ccdb.cern.ch"); |
460 | 461 |
|
461 | | - // get the DCA correction file from CCDB |
462 | | - if (!ccdbApi.retrieveBlob(pathInputFile.data(), tmpDir, metadata, 0, false, nameInputFile.data())) { |
463 | | - LOG(fatal) << "[TrackTuner] input file for DCA corrections not found on CCDB, please check the pathInputFile and nameInputFile!"; |
| 462 | + // name of the file in the tmp local folder |
| 463 | + fullNameInputFile = tmpDir + std::string("/") + nameInputFile; |
| 464 | + fullNameFileQoverPt = tmpDir + std::string("/") + nameFileQoverPt; |
| 465 | + |
| 466 | + // get the DCA correction file from CCDB if not yet downloaded before |
| 467 | + struct stat sbDca; // search utility |
| 468 | + if (stat(fullNameInputFile.c_str(), &sbDca) == 0) { |
| 469 | + LOG(info) << " [TrackTuner] File " << fullNameInputFile << " already downloaded. Not downloading it anymore"; |
| 470 | + } else { |
| 471 | + LOG(info) << "[TrackTuner] downloading input file " << nameInputFile << " from CCDB..."; |
| 472 | + if (!ccdbApi.retrieveBlob(pathInputFile.data(), tmpDir, metadata, 0, false, nameInputFile.data())) { |
| 473 | + LOG(fatal) << "[TrackTuner] input file for DCA corrections not found on CCDB, please check the pathInputFile and nameInputFile!"; |
| 474 | + } |
464 | 475 | } |
465 | 476 |
|
466 | | - // get the Q/Pt correction file from CCDB |
467 | | - if (!ccdbApi.retrieveBlob(pathFileQoverPt.data(), tmpDir, metadata, 0, false, nameFileQoverPt.data())) { |
468 | | - LOG(fatal) << "[TrackTuner] input file for Q/Pt corrections not found on CCDB, please check the pathFileQoverPt and nameFileQoverPt!"; |
| 477 | + // get the Q/Pt correction file from CCDB if not yet downloaded before |
| 478 | + struct stat sbQoverPt; // search utility |
| 479 | + if (stat(fullNameFileQoverPt.c_str(), &sbQoverPt) == 0) { |
| 480 | + LOG(info) << " [TrackTuner] File " << fullNameFileQoverPt << " already downloaded. Not downloading it anymore"; |
| 481 | + } else { |
| 482 | + LOG(info) << "[TrackTuner] downloading input file " << nameFileQoverPt << " from CCDB..."; |
| 483 | + if (!ccdbApi.retrieveBlob(pathFileQoverPt.data(), tmpDir, metadata, 0, false, nameFileQoverPt.data())) { |
| 484 | + LOG(fatal) << "[TrackTuner] input file for Q/Pt corrections not found on CCDB, please check the pathFileQoverPt and nameFileQoverPt!"; |
| 485 | + } |
469 | 486 | } |
470 | | - // point to the file in the tmp local folder |
471 | | - fullNameInputFile = tmpDir + std::string("/") + nameInputFile; |
472 | | - fullNameFileQoverPt = tmpDir + std::string("/") + nameFileQoverPt; |
473 | 487 | } else { |
474 | 488 | /// use input correction file from local filesystem |
475 | 489 | fullNameInputFile = pathInputFile + std::string("/") + nameInputFile; |
|
0 commit comments