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::TrackMCHMID> mTracks, *mTracksPtr = &mTracks;
51 std::vector<o2::MCCompLabel> mLabels, *mLabelsPtr = &mLabels;
57 ic.
options().
get<std::string>(
"matchmchmid-track-infile"));
58 connectTree(mFileName);
63 auto ent = mTree->GetReadEntry() + 1;
69 const bool noEntry = ent >= mTree->GetEntries();
71 LOG(info) <<
"no entry to read, publishing empty output";
75 LOG(info) <<
"Pushing " << mTracks.size() <<
" MCHMID matches at entry " << ent;
82 if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
88void MatchMCHMIDReader::connectTree(
const std::string&
filename)
91 mFile.reset(TFile::Open(
filename.c_str()));
92 assert(mFile && !mFile->IsZombie());
93 mTree.reset((TTree*)mFile->Get(
"o2sim"));
95 mTree->SetBranchAddress(
"tracks", &mTracksPtr);
97 mTree->SetBranchAddress(
"tracklabels", &mLabelsPtr);
99 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " << mTree->GetEntries() <<
" entries";
104 std::vector<OutputSpec> outputs;
105 outputs.emplace_back(
OutputSpec{{
"muontracks"},
"GLO",
"MTC_MCHMID", 0, Lifetime::Timeframe});
107 outputs.emplace_back(
OutputSpec{{
"muontracklabels"},
"GLO",
"MCMTC_MCHMID", 0, Lifetime::Timeframe});
111 "mchmid-matches-reader",
116 {
"matchmchmid-track-infile", VariantType::String,
"muontracks.root", {
"Name of the input file"}},
117 {
"input-dir", VariantType::String,
"none", {
"Input directory"}}}};
Header of the General Run Parameters object.
Definition of the Names Generator class.
Type wrappers for enfording a specific serialization method.
Definition of the MUON track.
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.
MatchMCHMIDReader(bool useMC)
void run(ProcessingContext &pc) final
~MatchMCHMIDReader() override=default
void init(InitContext &ic) final
Defining ITS Vertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
framework::DataProcessorSpec getMCHMIDMatchedReaderSpec(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"