Skip to content

Commit 6e5cde1

Browse files
author
Mattia Faggin
committed
Fix path and use TList structure.
1 parent 3b2155f commit 6e5cde1

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

Common/Tools/TrackTuner.h

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <ReconstructionDataFormats/Track.h>
4040

4141
#include <TGraphErrors.h>
42+
#include <TList.h>
4243

4344
#include <fmt/core.h>
4445

@@ -453,10 +454,10 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
453454

454455
void getDcaGraphs()
455456
{
456-
std::string fullNameInputFile = pathInputFile + std::string("/") + nameInputFile;
457+
std::string fullNameInputFile = pathInputFile; // + std::string("/") + nameInputFile;
457458
//std::string fullNameFileQoverPt = pathFileQoverPt + std::string("/") + nameFileQoverPt;
458459
std::string fullNameFileQoverPt = "";
459-
TDirectoryFile* ccdb_object = nullptr;
460+
TList* ccdb_object = nullptr;
460461

461462
if (isInputFileFromCCDB) {
462463
/// use input correction file from CCDB
@@ -475,14 +476,10 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
475476

476477
// get the directory from the DCA correction file present in CCDB
477478

478-
ccdb_object = o2::ccdb::BasicCCDBManager::instance().get<TDirectoryFile>(fullNameInputFile);
479+
ccdb_object = o2::ccdb::BasicCCDBManager::instance().get<TList>(fullNameInputFile);
479480
LOG(info) << " [TrackTuner] ccdb_object " << ccdb_object;
480481

481-
// get the Q/Pt correction file from CCDB
482-
if (!ccdbApi.retrieveBlob(pathFileQoverPt.data(), tmpDir, metadata, 0, false, nameFileQoverPt.data())) {
483-
LOG(fatal) << "[TrackTuner] input file for Q/Pt corrections not found on CCDB, please check the pathFileQoverPt and nameFileQoverPt!";
484482
}
485-
486483
// point to the file in the tmp local folder
487484
//fullNameInputFile = tmpDir + std::string("/") + nameInputFile;
488485
fullNameFileQoverPt = tmpDir + std::string("/") + nameFileQoverPt;
@@ -496,7 +493,8 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
496493
LOG(fatal) << "[TrackTuner] Something wrong with the local input file" << fullNameInputFile << " for dca correction. Fix it!";
497494
}
498495

499-
ccdb_object = dynamic_cast<TDirectoryFile*>(inputFile->Get("ccdb_object"));
496+
497+
ccdb_object = dynamic_cast<TList*>(inputFile->Get("ccdb_object"));
500498

501499
}
502500

@@ -505,14 +503,13 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
505503
LOG(fatal) << "Something wrong with the Q/Pt input file" << fullNameFileQoverPt << " for Q/Pt correction. Fix it!";
506504
}
507505

508-
// choose wheter to use corrections w/ PV refit or w/o it, and retrieve the proper TDirectory
506+
// choose wheter to use corrections w/ PV refit or w/o it, and retrieve the proper TList
509507
std::string dir = "woPvRefit";
510-
if (usePvRefitCorrections) {
511-
dir = "withPvRefit";
512-
}
513-
TDirectory* td = dynamic_cast<TDirectory*>(ccdb_object->Get(dir.c_str()));
508+
509+
TList* td = dynamic_cast<TList*>(ccdb_object->FindObject(dir.c_str()));
514510
if (!td) {
515-
LOG(fatal) << "[TrackTuner] TDirectory " << td << " not found in ccdb_object. Fix it!";
511+
LOG(fatal) << "[TrackTuner] TList " << td << " not found in ccdb_object. Fix it!";
512+
516513
}
517514

518515
int inputNphiBins = nPhiBins;
@@ -541,7 +538,7 @@ struct TrackTuner : o2::framework::ConfigurableGroup {
541538
/// Lambda expression to get the TGraphErrors from file
542539
auto loadGraph = [&](int phiBin, const std::string& strBaseName) -> TGraphErrors* {
543540
std::string strGraphName = inputNphiBins != 0 ? fmt::format("{}_{}", strBaseName, phiBin) : strBaseName;
544-
TObject* obj = td->Get(strGraphName.c_str());
541+
TObject* obj = td->FindObject(strGraphName.c_str());
545542
if (!obj) {
546543
LOG(fatal) << "[TrackTuner] TGraphErrors not found in the Input Root file: " << strGraphName;
547544
td->ls();

0 commit comments

Comments
 (0)