Skip to content
Snippets Groups Projects
Commit fd976143 authored by Sergei Zharko's avatar Sergei Zharko
Browse files

[BugFix]: replace of TFile::FindObjectAny with TFile::Get in the QA-Checker framework

parent cd645e08
No related branches found
No related tags found
1 merge request!1636[BugFix]: replace of TFile::FindObjectAny with TFile::Get in the QA-Checker framework
Pipeline #27014 passed
...@@ -101,7 +101,7 @@ void FileHandler::Process(Option_t* opt) ...@@ -101,7 +101,7 @@ void FileHandler::Process(Option_t* opt)
bool skipObj = false; bool skipObj = false;
for (int iVer = 0; iVer < nVersions; ++iVer) { for (int iVer = 0; iVer < nVersions; ++iVer) {
auto* pInputFile = static_cast<TFile*>(fpInputFiles->At(iVer)); auto* pInputFile = static_cast<TFile*>(fpInputFiles->At(iVer));
vpObjects[iVer] = ReadObjectFromFile(pInputFile, fpObjDB->GetObject(fFileID, iObj)); vpObjects[iVer] = pInputFile->Get<TNamed>(fpObjDB->GetObject(fFileID, iObj).c_str());
if (!vpObjects[iVer]) { if (!vpObjects[iVer]) {
LOG(warn) << "FileHandler: object " << fpObjDB->GetObject(fFileID, iObj) << " is undefined for version " LOG(warn) << "FileHandler: object " << fpObjDB->GetObject(fFileID, iObj) << " is undefined for version "
<< fpObjDB->GetVersionLabel(iVer) << ". This object will be skipped"; << fpObjDB->GetVersionLabel(iVer) << ". This object will be skipped";
...@@ -180,16 +180,3 @@ void FileHandler::Process(Option_t* opt) ...@@ -180,16 +180,3 @@ void FileHandler::Process(Option_t* opt)
} // iObj } // iObj
} }
// ---------------------------------------------------------------------------------------------------------------------
//
TNamed* FileHandler::ReadObjectFromFile(TFile* pFile, const std::string& path) const
{
int iPosSlash = path.find_last_of('/') + 1;
std::string baseName = path.substr(iPosSlash, path.size());
std::string pathName = path.substr(0, iPosSlash);
if (pathName.size() > 0) {
pFile->cd(pathName.c_str());
}
return dynamic_cast<TNamed*>(pFile->FindObjectAny(baseName.c_str()));
}
...@@ -71,13 +71,6 @@ namespace cbm::qa::checker ...@@ -71,13 +71,6 @@ namespace cbm::qa::checker
/// @return Pointer to created TDirectory object /// @return Pointer to created TDirectory object
TDirectory* CreateNestedDirectory(const std::string& path); TDirectory* CreateNestedDirectory(const std::string& path);
/// @brief Iteratively reads object from file by the provided full path to the object
/// @param pFile Pointer to TFile instance
/// @param path Full path to the object inside the file
/// @return A pointer to TNamed object
TNamed* ReadObjectFromFile(TFile* pFile, const std::string& path) const;
int fFileID = -1; ///< Index of file int fFileID = -1; ///< Index of file
int fDatasetID = -1; ///< Index of dataset int fDatasetID = -1; ///< Index of dataset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment