@@ -448,16 +448,20 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
448448 return outputString;
449449 }
450450
451- std::string getFullNameInputPath () {
451+ std::string getFullNameInputPath ()
452+ {
452453 return pathInputFile + std::string (" /" ) + nameInputFile;
453454 }
454455
455456 void getDcaGraphs ()
456457 {
457- std::string fullNameInputFile = pathInputFile; // + std::string("/") + nameInputFile;
458- // std::string fullNameFileQoverPt = pathFileQoverPt + std::string("/") + nameFileQoverPt;
459- std::string fullNameFileQoverPt = " " ;
460- TList* ccdb_object = nullptr ;
458+ std::string fullNameInputFile = pathInputFile + std::string (" /" ) + nameInputFile;
459+ std::string fullNameFileQoverPt = pathFileQoverPt + std::string (" /" ) + nameFileQoverPt;
460+ TList* ccdb_object_dca = nullptr ;
461+ TList* ccdb_object_qoverpt = nullptr ;
462+
463+ std::string grOneOverPtPionNameMC = " sigmaVsPtMc" ;
464+ std::string grOneOverPtPionNameData = " sigmaVsPtData" ;
461465
462466 if (isInputFileFromCCDB) {
463467 // / use input correction file from CCDB
@@ -467,49 +471,41 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
467471 ccdbApi.init (" http://alice-ccdb.cern.ch" );
468472 LOG (info) << " [TrackTuner] CCDB Api OK!" ;
469473
470- // o2::ccdb::BasicCCDBManager::instance().setURL("http://alice-ccdb.cern.ch"); LOG(info) << "[Tracktuner] address to CCDB service ...";
471- // o2::ccdb::BasicCCDBManager::instance().setCaching(true);
472- // o2::ccdb::BasicCCDBManager::instance().setLocalObjectValidityChecking();
473- // o2::ccdb::BasicCCDBManager::instance().setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
474- // o2::ccdb::BasicCCDBManager::instance().setFatalWhenNull(false);
475- // LOG(info) << " [TrackTuner] CCDB service OK!";
476-
477- // get the directory from the DCA correction file present in CCDB
478-
479- ccdb_object = o2::ccdb::BasicCCDBManager::instance ().get <TList>(fullNameInputFile);
480- LOG (info) << " [TrackTuner] ccdb_object " << ccdb_object;
474+ // get the TList from the DCA correction file present in CCDB
475+ ccdb_object_dca = o2::ccdb::BasicCCDBManager::instance ().get <TList>(pathInputFile);
476+ LOG (info) << " [TrackTuner] ccdb_object_dca " << ccdb_object_dca;
481477
478+ // get the TList from the Q/Pt correction file from CCDB
479+ if (updateCurvature || updateCurvatureIU) {
480+ ccdb_object_qoverpt = o2::ccdb::BasicCCDBManager::instance ().get <TList>(pathFileQoverPt);
481+ LOG (info) << " [TrackTuner] ccdb_object_qoverpt " << ccdb_object_qoverpt;
482482 }
483- // point to the file in the tmp local folder
484- // fullNameInputFile = tmpDir + std::string("/") + nameInputFile;
485- fullNameFileQoverPt = tmpDir + std::string (" /" ) + nameFileQoverPt;
486483 } else {
487484 // / use input correction file from local filesystem
488- fullNameFileQoverPt = pathFileQoverPt + std::string (" /" ) + nameFileQoverPt;
489-
490- // / open the input correction file
485+
486+ // / open the input correction file - dca correction
491487 TFile* inputFile = TFile::Open (fullNameInputFile.c_str (), " READ" );
492488 if (!inputFile) {
493489 LOG (fatal) << " [TrackTuner] Something wrong with the local input file" << fullNameInputFile << " for dca correction. Fix it!" ;
494490 }
491+ ccdb_object_dca = dynamic_cast <TList*>(inputFile->Get (" ccdb_object" ));
495492
496-
497- ccdb_object = dynamic_cast <TList*>(inputFile->Get (" ccdb_object" ));
498-
499- }
500-
501- std::unique_ptr<TFile> inputFileQoverPt (TFile::Open(fullNameFileQoverPt.c_str(), "READ"));
502- if (!inputFileQoverPt.get() && (updateCurvature || updateCurvatureIU)) {
503- LOG (fatal) << " Something wrong with the Q/Pt input file" << fullNameFileQoverPt << " for Q/Pt correction. Fix it!" ;
493+ // / open the input correction file - q/pt correction
494+ TFile* inputFileQoverPt = TFile::Open (fullNameFileQoverPt.c_str (), " READ" );
495+ if (!inputFileQoverPt && (updateCurvature || updateCurvatureIU)) {
496+ LOG (fatal) << " Something wrong with the Q/Pt input file" << fullNameFileQoverPt << " for Q/Pt correction. Fix it!" ;
497+ }
498+ ccdb_object_qoverpt = dynamic_cast <TList*>(inputFileQoverPt->Get (" ccdb_object" ));
504499 }
505500
506501 // choose wheter to use corrections w/ PV refit or w/o it, and retrieve the proper TList
507502 std::string dir = " woPvRefit" ;
508-
509- TList* td = dynamic_cast <TList*>(ccdb_object->FindObject (dir.c_str()));
503+ if (usePvRefitCorrections) {
504+ dir = " withPvRefit" ;
505+ }
506+ TList* td = dynamic_cast <TList*>(ccdb_object_dca->FindObject (dir.c_str ()));
510507 if (!td) {
511- LOG (fatal) << " [TrackTuner] TList " << td << " not found in ccdb_object. Fix it!" ;
512-
508+ LOG (fatal) << " [TrackTuner] TList " << td << " not found in ccdb_object_dca. Fix it!" ;
513509 }
514510
515511 int inputNphiBins = nPhiBins;
@@ -580,12 +576,9 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
580576 }
581577 }
582578
583- std::string grOneOverPtPionNameMC = " sigmaVsPtMc" ;
584- std::string grOneOverPtPionNameData = " sigmaVsPtData" ;
585-
586579 if (updateCurvature || updateCurvatureIU) {
587- grOneOverPtPionMC.reset (dynamic_cast <TGraphErrors*>(inputFileQoverPt-> Get (grOneOverPtPionNameMC.c_str ())));
588- grOneOverPtPionData.reset (dynamic_cast <TGraphErrors*>(inputFileQoverPt-> Get (grOneOverPtPionNameData.c_str ())));
580+ grOneOverPtPionMC.reset (dynamic_cast <TGraphErrors*>(ccdb_object_qoverpt-> FindObject (grOneOverPtPionNameMC.c_str ())));
581+ grOneOverPtPionData.reset (dynamic_cast <TGraphErrors*>(ccdb_object_qoverpt-> FindObject (grOneOverPtPionNameData.c_str ())));
589582 }
590583 } // getDcaGraphs() ends here
591584
0 commit comments