26#include <fairlogger/Logger.h>
33namespace globaltracking
45 void connectTree(
const std::string&
filename);
47 std::unique_ptr<TFile> mFile;
48 std::unique_ptr<TTree> mTree;
49 std::string mFileName =
"";
50 std::vector<o2::dataformats::GlobalFwdTrack> mTracks, *mTracksPtr = &mTracks;
51 std::vector<o2::MCCompLabel> mLabels, *mLabelsPtr = &mLabels;
57 ic.
options().
get<std::string>(
"globalfwd-track-infile"));
58 connectTree(mFileName);
63 auto ent = mTree->GetReadEntry() + 1;
64 assert(ent < mTree->GetEntries());
66 LOG(info) <<
"Pushing " << mTracks.size() <<
" Global Forward tracks at entry " << ent;
73 if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
79void GlobalFwdTrackReader::connectTree(
const std::string&
filename)
82 mFile.reset(TFile::Open(
filename.c_str()));
83 assert(mFile && !mFile->IsZombie());
84 mTree.reset((TTree*)mFile->Get(
"GlobalFwdTracks"));
86 mTree->SetBranchAddress(
"fwdtracks", &mTracksPtr);
88 mTree->SetBranchAddress(
"MCTruth", &mLabelsPtr);
90 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " << mTree->GetEntries() <<
" entries";
95 std::vector<OutputSpec> outputs;
96 outputs.emplace_back(
"GLO",
"GLFWD", 0, Lifetime::Timeframe);
98 outputs.emplace_back(
"GLO",
"GLFWD_MC", 0, Lifetime::Timeframe);
101 "globalfwd-track-reader",
106 {
"globalfwd-track-infile", VariantType::String,
"globalfwdtracks.root", {
"Name of the input file"}},
107 {
"input-dir", VariantType::String,
"none", {
"Input directory"}}}};
Header of the General Run Parameters object.
Global Forward Muon tracks.
Definition of the Names Generator class.
Type wrappers for enfording a specific serialization method.
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(InitContext &ic) final
void run(ProcessingContext &pc) final
GlobalFwdTrackReader(bool useMC)
~GlobalFwdTrackReader() override=default
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
framework::DataProcessorSpec getGlobalFwdTrackReaderSpec(bool useMC)
create a processor spec
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"