@@ -447,40 +447,59 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
447447 return outputString;
448448 }
449449
450+ std::string getFullNameInputPath () {
451+ return pathInputFile + std::string (" /" ) + nameInputFile;
452+ }
453+
450454 void getDcaGraphs ()
451455 {
452- std::string fullNameInputFile = " " ;
456+ std::string fullNameInputFile = pathInputFile + std::string (" /" ) + nameInputFile;
457+ // std::string fullNameFileQoverPt = pathFileQoverPt + std::string("/") + nameFileQoverPt;
453458 std::string fullNameFileQoverPt = " " ;
459+ TDirectoryFile* ccdb_object = nullptr ;
454460
455461 if (isInputFileFromCCDB) {
456462 // / use input correction file from CCDB
457463
458464 // properly init the ccdb
459465 std::string tmpDir = " ." ;
460466 ccdbApi.init (" http://alice-ccdb.cern.ch" );
467+ LOG (info) << " [TrackTuner] CCDB Api OK!" ;
461468
462- // get the DCA correction file from CCDB
463- if (!ccdbApi.retrieveBlob (pathInputFile.data (), tmpDir, metadata, 0 , false , nameInputFile.data ())) {
464- LOG (fatal) << " [TrackTuner] input file for DCA corrections not found on CCDB, please check the pathInputFile and nameInputFile!" ;
465- }
469+ // o2::ccdb::BasicCCDBManager::instance().setURL("http://alice-ccdb.cern.ch"); LOG(info) << "[Tracktuner] address to CCDB service ...";
470+ // o2::ccdb::BasicCCDBManager::instance().setCaching(true);
471+ // o2::ccdb::BasicCCDBManager::instance().setLocalObjectValidityChecking();
472+ // o2::ccdb::BasicCCDBManager::instance().setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
473+ // o2::ccdb::BasicCCDBManager::instance().setFatalWhenNull(false);
474+ // LOG(info) << " [TrackTuner] CCDB service OK!";
475+
476+ // get the directory from the DCA correction file present in CCDB
477+
478+ ccdb_object = o2::ccdb::BasicCCDBManager::instance ().get <TDirectoryFile>(fullNameInputFile);
479+ LOG (info) << " [TrackTuner] ccdb_object " << ccdb_object;
466480
467481 // get the Q/Pt correction file from CCDB
468482 if (!ccdbApi.retrieveBlob (pathFileQoverPt.data (), tmpDir, metadata, 0 , false , nameFileQoverPt.data ())) {
469483 LOG (fatal) << " [TrackTuner] input file for Q/Pt corrections not found on CCDB, please check the pathFileQoverPt and nameFileQoverPt!" ;
470484 }
485+
471486 // point to the file in the tmp local folder
472- fullNameInputFile = tmpDir + std::string (" /" ) + nameInputFile;
487+ // fullNameInputFile = tmpDir + std::string("/") + nameInputFile;
473488 fullNameFileQoverPt = tmpDir + std::string (" /" ) + nameFileQoverPt;
474489 } else {
475490 // / use input correction file from local filesystem
476- fullNameInputFile = pathInputFile + std::string (" /" ) + nameInputFile;
477491 fullNameFileQoverPt = pathFileQoverPt + std::string (" /" ) + nameFileQoverPt;
492+
493+ // / open the input correction file
494+ TFile* inputFile = TFile::Open (fullNameInputFile.c_str (), " READ" );
495+ if (!inputFile) {
496+ LOG (fatal) << " [TrackTuner] Something wrong with the local input file" << fullNameInputFile << " for dca correction. Fix it!" ;
497+ }
498+
499+ ccdb_object = dynamic_cast <TDirectoryFile*>(inputFile->Get (" ccdb_object" ));
500+
478501 }
479- // / open the input correction file
480- std::unique_ptr<TFile> inputFile (TFile::Open (fullNameInputFile.c_str (), " READ" ));
481- if (!inputFile.get ()) {
482- LOG (fatal) << " Something wrong with the input file" << fullNameInputFile << " for dca correction. Fix it!" ;
483- }
502+
484503 std::unique_ptr<TFile> inputFileQoverPt (TFile::Open (fullNameFileQoverPt.c_str (), " READ" ));
485504 if (!inputFileQoverPt.get () && (updateCurvature || updateCurvatureIU)) {
486505 LOG (fatal) << " Something wrong with the Q/Pt input file" << fullNameFileQoverPt << " for Q/Pt correction. Fix it!" ;
@@ -491,9 +510,9 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
491510 if (usePvRefitCorrections) {
492511 dir = " withPvRefit" ;
493512 }
494- TDirectory* td = dynamic_cast <TDirectory*>(inputFile ->Get (dir.c_str ()));
513+ TDirectory* td = dynamic_cast <TDirectory*>(ccdb_object ->Get (dir.c_str ()));
495514 if (!td) {
496- LOG (fatal) << " TDirectory " << td << " not found in input file " << inputFile-> GetName () << " . Fix it!" ;
515+ LOG (fatal) << " [TrackTuner] TDirectory " << td << " not found in ccdb_object . Fix it!" ;
497516 }
498517
499518 int inputNphiBins = nPhiBins;
0 commit comments