Skip to content

Commit

Permalink
DPL: cleanup DataInputDirector (#12163)
Browse files Browse the repository at this point in the history
* DPL Analysis: drop unused API
Since we use bulk reading, TTreeReader usage is not really needed anymore.
* DPL: follow coding conventions
* DPL: forward declare Monitoring
  • Loading branch information
ktf authored Oct 28, 2023
1 parent 5e8bfe8 commit 477eb7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 27 deletions.
23 changes: 2 additions & 21 deletions Framework/AnalysisSupport/src/DataInputDirector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "Headers/DataHeader.h"
#include "Framework/TableTreeHelpers.h"
#include "Monitoring/Tags.h"
#include "Monitoring/Metric.h"
#include "Monitoring/Monitoring.h"

#include "rapidjson/document.h"
#include "rapidjson/prettywriter.h"
Expand Down Expand Up @@ -710,27 +712,6 @@ DataInputDescriptor* DataInputDirector::getDataInputDescriptor(header::DataHeade
return result;
}

std::unique_ptr<TTreeReader> DataInputDirector::getTreeReader(header::DataHeader dh, int counter, int numTF, std::string treename)
{
std::unique_ptr<TTreeReader> reader = nullptr;
auto didesc = getDataInputDescriptor(dh);
// if NOT match then use defaultDataInputDescriptor
if (!didesc) {
didesc = mdefaultDataInputDescriptor;
}

auto fileAndFolder = didesc->getFileFolder(counter, numTF);
if (fileAndFolder.file) {
treename = fileAndFolder.folderName + "/" + treename;
reader = std::make_unique<TTreeReader>(treename.c_str(), fileAndFolder.file);
if (!reader) {
throw std::runtime_error(fmt::format(R"(Couldn't create TTreeReader for tree "{}" in file "{}")", treename, fileAndFolder.file->GetName()));
}
}

return reader;
}

FileAndFolder DataInputDirector::getFileFolder(header::DataHeader dh, int counter, int numTF)
{
auto didesc = getDataInputDescriptor(dh);
Expand Down
14 changes: 8 additions & 6 deletions Framework/AnalysisSupport/src/DataInputDirector.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef o2_framework_DataInputDirector_H_INCLUDED
#define o2_framework_DataInputDirector_H_INCLUDED
#ifndef O2_FRAMEWORK_DATAINPUTDIRECTOR_H_
#define O2_FRAMEWORK_DATAINPUTDIRECTOR_H_

#include "TFile.h"
#include "TTreeReader.h"

#include "Framework/DataDescriptorMatcher.h"
#include "Framework/DataAllocator.h"
#include "Monitoring/Monitoring.h"

#include <regex>
#include "rapidjson/fwd.h"

namespace o2::monitoring
{
class Monitoring;
}

namespace o2::framework
{

Expand Down Expand Up @@ -138,7 +141,6 @@ class DataInputDirector
DataInputDescriptor* getDataInputDescriptor(header::DataHeader dh);
int getNumberInputDescriptors() { return mdataInputDescriptors.size(); }

std::unique_ptr<TTreeReader> getTreeReader(header::DataHeader dh, int counter, int numTF, std::string treeName);
bool readTree(DataAllocator& outputs, header::DataHeader dh, int counter, int numTF, size_t& totalSizeCompressed, size_t& totalSizeUncompressed);
uint64_t getTimeFrameNumber(header::DataHeader dh, int counter, int numTF);
FileAndFolder getFileFolder(header::DataHeader dh, int counter, int numTF);
Expand Down Expand Up @@ -169,4 +171,4 @@ class DataInputDirector

} // namespace o2::framework

#endif // o2_framework_DataInputDirector_H_INCLUDED
#endif // O2_FRAMEWORK_DATAINPUTDIRECTOR_H_

0 comments on commit 477eb7d

Please sign in to comment.