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);
47 if (mTreeIn->GetBranch(
"detInfo")) {
48 mTreeIn->SetBranchAddress(
"detInfo", &mDetInfoUnbResPtr);
50 LOGP(warn,
"No detInfo branch found in the unbinned residuals tree, empty vector will be sent");
53 mTreeIn->SetBranchAddress(
"tracks", &mTrackDataPtr);
55 LOG(info) <<
"Loaded tree from " << mInFileName <<
" with " << mTreeIn->GetEntries() <<
" entries";
60 auto currEntry = mTreeIn->GetReadEntry() + 1;
61 assert(currEntry < mTreeIn->GetEntries());
62 mTreeIn->GetEntry(currEntry);
63 LOG(info) <<
"Pushing " << mUnbinnedResid.size() <<
" unbinned residuals at entry " << currEntry;
68 LOG(info) <<
"Pushing " << mTrackData.size() <<
" reference tracks for these residuals";
72 if (mTreeIn->GetReadEntry() + 1 >= mTreeIn->GetEntries()) {
80 std::vector<OutputSpec> outputs;
81 outputs.emplace_back(
"GLO",
"UNBINNEDRES", 0, Lifetime::Timeframe);
82 outputs.emplace_back(
"GLO",
"DETINFORES", 0, Lifetime::Timeframe);
83 outputs.emplace_back(
"GLO",
"TRKREFS", 0, Lifetime::Timeframe);
85 outputs.emplace_back(
"GLO",
"TRKDATA", 0, Lifetime::Timeframe);
89 "TPCUnbinnedResidualReader",
92 AlgorithmSpec{adaptFromTask<TPCUnbinnedResidualReader>(trkInput)},
94 {
"input-filename", VariantType::String,
"o2residuals_tpc.root", {
"Name of the input file"}},
95 {
"input-dir", VariantType::String,
"none", {
"Input directory"}},
96 {
"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"