18#include "fairlogger/Logger.h"
31 LOG(info) <<
"Init TPC unbinned residual reader!";
33 ic.
options().
get<std::string>(
"input-filename"));
34 mInTreeName = ic.
options().
get<std::string>(
"treename");
38void TPCUnbinnedResidualReader::connectTree()
40 mTreeIn.reset(
nullptr);
41 mFileIn.reset(TFile::Open(mInFileName.c_str()));
42 assert(mFileIn && !mFileIn->IsZombie());
43 mTreeIn.reset((TTree*)mFileIn->Get(mInTreeName.c_str()));
45 mTreeIn->SetBranchAddress(
"residuals", &mUnbinnedResidPtr);
46 mTreeIn->SetBranchAddress(
"trackRefs", &mTrackDataCompactPtr);
48 mTreeIn->SetBranchAddress(
"tracks", &mTrackDataPtr);
50 LOG(info) <<
"Loaded tree from " << mInFileName <<
" with " << mTreeIn->GetEntries() <<
" entries";
55 auto currEntry = mTreeIn->GetReadEntry() + 1;
56 assert(currEntry < mTreeIn->GetEntries());
57 mTreeIn->GetEntry(currEntry);
58 LOG(info) <<
"Pushing " << mUnbinnedResid.size() <<
" unbinned residuals at entry " << currEntry;
62 LOG(info) <<
"Pushing " << mTrackData.size() <<
" reference tracks for these residuals";
66 if (mTreeIn->GetReadEntry() + 1 >= mTreeIn->GetEntries()) {
74 std::vector<OutputSpec> outputs;
75 outputs.emplace_back(
"GLO",
"UNBINNEDRES", 0, Lifetime::Timeframe);
76 outputs.emplace_back(
"GLO",
"TRKREFS", 0, Lifetime::Timeframe);
78 outputs.emplace_back(
"GLO",
"TRKDATA", 0, Lifetime::Timeframe);
82 "TPCUnbinnedResidualReader",
85 AlgorithmSpec{adaptFromTask<TPCUnbinnedResidualReader>(trkInput)},
87 {
"input-filename", VariantType::String,
"o2residuals_tpc.root", {
"Name of the input file"}},
88 {
"input-dir", VariantType::String,
"none", {
"Input directory"}},
89 {
"treename", VariantType::String,
"residualsTPC", {
"Name of top-level TTree"}},
Definition of the Names Generator class.
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
ServiceRegistryRef services()
The services registry associated with this processing context.
virtual void endOfStream(EndOfStreamContext &context)
This is invoked whenever we have an EndOfStream event.
void init(o2::framework::InitContext &ic) final
void run(o2::framework::ProcessingContext &pc) final
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
framework::DataProcessorSpec getUnbinnedTPCResidualsReaderSpec(bool trkInput)
read unbinned TPC residuals and reference tracks from a root file
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static std::string rectifyDirectory(const std::string_view p)
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"