42 LOG(
debug) <<
"Init TOF matching info reader!";
44 ic.
options().
get<std::string>(
"tof-matched-infile"));
45 mInTreeName = ic.
options().
get<std::string>(
"treename");
46 connectTree(mInFileName);
49void TOFMatchedReader::connectTree(
const std::string&
filename)
52 mFile.reset(TFile::Open(
filename.c_str()));
53 assert(mFile && !mFile->IsZombie());
54 mTree.reset((TTree*)mFile->Get(mInTreeName.c_str()));
56 mTree->SetBranchAddress(
"TOFMatchInfo", &mMatchesPtr);
58 if (!mTree->GetBranch(
"TPCTOFTracks")) {
59 throw std::runtime_error(
"TPC-TOF tracks are requested but not found in the tree");
61 mTree->SetBranchAddress(
"TPCTOFTracks", &mTracksPtr);
64 mTree->SetBranchAddress(
"MatchTOFMCTruth", &mLabelTOFPtr);
66 LOG(
debug) <<
"Loaded tree from " <<
filename <<
" with " << mTree->GetEntries() <<
" entries";
71 auto currEntry = mTree->GetReadEntry() + 1;
72 assert(currEntry < mTree->GetEntries());
73 mTree->GetEntry(currEntry);
74 LOG(
debug) <<
"Pushing " << mMatches.size() <<
" TOF matchings at entry " << currEntry;
78 if (mReadTracks && (!mMode)) {
85 if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
93 const char* match_name[4] = {
"TOFMatchedReader_TPC",
"TOFMatchedReader_ITSTPC",
"TOFMatchedReader_TPCTRD",
"TOFMatchedReader_ITSTPCTRD"};
94 const char* match_name_strict[4] = {
"TOFMatchedReader_TPC_str",
"TOFMatchedReader_ITSTPC_str",
"TOFMatchedReader_TPCTRD_str",
"TOFMatchedReader_ITSTPCTRD_str"};
95 const char* file_name[4] = {
"o2match_tof_tpc.root",
"o2match_tof_itstpc.root",
"o2match_tof_tpctrd.root",
"o2match_tof_itstpctrd.root"};
96 const char* taskName = match_name[
mode];
97 const char* fileName = file_name[
mode];
99 taskName = match_name_strict[
mode];
102 std::vector<OutputSpec> outputs;
105 if (!
mode && readTracks) {
116 AlgorithmSpec{adaptFromTask<TOFMatchedReader>(useMC,
mode, readTracks, subSpecStrict)},
118 {
"tof-matched-infile", VariantType::String, fileName, {
"Name of the input file"}},
119 {
"input-dir", VariantType::String,
"none", {
"Input directory"}},
120 {
"treename", VariantType::String,
"matchTOF", {
"Name of top-level TTree"}},
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Definition of a container to keep Monte Carlo truth external to simulation objects.
Class to store the output of the matching to TOF.
Defintions for the inter-detector matching type.
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 run(o2::framework::ProcessingContext &pc) final
void init(o2::framework::InitContext &ic) final
constexpr o2::header::DataOrigin gDataOriginTOF
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
framework::DataProcessorSpec getTOFMatchedReaderSpec(bool useMC, int mode=1, bool readTracks=false, bool subSpecStrict=false)
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"