Project
Loading...
Searching...
No Matches
FilteredTFReaderSpec.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14#include <cassert>
19
20using namespace o2::framework;
21using namespace o2::dataformats;
22
24{
25
27{
28 mUseMC = useMC;
29}
30
32{
34 ic.options().get<std::string>("filtered-tf-infile"));
36}
37
39{
40 // FIXME: fill all output headers by TF specific info (extend findMessageHeaderStack)
41
42 auto ent = mTree->GetReadEntry() + 1;
43 assert(ent < mTree->GetEntries()); // this should not happen
44 mTree->GetEntry(ent);
45
46 LOG(info) << "Pushing filtered TF: " << mFiltTF.header.asString();
47 // ITS
48 pc.outputs().snapshot(Output{"ITS", "ITSTrackROF", 0}, mFiltTF.ITSTrackROFs);
49 pc.outputs().snapshot(Output{"ITS", "TRACKS", 0}, mFiltTF.ITSTracks);
50 pc.outputs().snapshot(Output{"ITS", "TRACKCLSID", 0}, mFiltTF.ITSClusterIndices);
51 if (mUseMC) {
52 pc.outputs().snapshot(Output{"ITS", "TRACKSMCTR", 0}, mFiltTF.ITSTrackMCTruth);
53 }
54 pc.outputs().snapshot(Output{"ITS", "CLUSTERSROF", 0}, mFiltTF.ITSClusterROFs);
55 pc.outputs().snapshot(Output{"ITS", "COMPCLUSTERS", 0}, mFiltTF.ITSClusters);
56 pc.outputs().snapshot(Output{"ITS", "PATTERNS", 0}, mFiltTF.ITSClusterPatterns);
57
58 if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
60 pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);
61 }
62}
63
65{
66 mTree.reset(nullptr); // in case it was already loaded
67 mFile.reset(TFile::Open(filename.c_str()));
68 assert(mFile && !mFile->IsZombie());
69 mTree.reset((TTree*)mFile->Get(mInputTreeName.c_str()));
70 assert(mTree);
71 assert(mTree->GetBranch(mFTFBranchName.c_str()));
72 mTree->SetBranchAddress(mFTFBranchName.c_str(), &mFiltTFPtr);
73 LOG(info) << "Loaded tree from " << filename << " with " << mTree->GetEntries() << " entries";
74}
75
77{
78
79 std::vector<OutputSpec> outputSpec;
80 // same as ITSWorkflow/TrackReaderSpec
81 outputSpec.emplace_back("ITS", "ITSTrackROF", 0, Lifetime::Timeframe);
82 outputSpec.emplace_back("ITS", "TRACKS", 0, Lifetime::Timeframe);
83 outputSpec.emplace_back("ITS", "TRACKCLSID", 0, Lifetime::Timeframe);
84 if (useMC) {
85 outputSpec.emplace_back("ITS", "TRACKSMCTR", 0, Lifetime::Timeframe);
86 }
87 // same as ITSMFTWorkflow/ClusterReaderSpec
88 outputSpec.emplace_back("ITS", "CLUSTERSROF", 0, Lifetime::Timeframe);
89 outputSpec.emplace_back("ITS", "COMPCLUSTERS", 0, Lifetime::Timeframe);
90 outputSpec.emplace_back("ITS", "PATTERNS", 0, Lifetime::Timeframe);
91
92 return DataProcessorSpec{
93 "filtered-reco-tf-reader",
94 Inputs{},
95 outputSpec,
96 AlgorithmSpec{adaptFromTask<FilteredTFReader>(useMC)},
97 Options{
98 {"filtered-tf-infile", VariantType::String, "o2_filtered_tf.root", {"Name of the input file"}},
99 {"input-dir", VariantType::String, "none", {"Input directory"}}}};
100}
101
102} // namespace o2::filtering
Reader for the reconstructed and filtered TF.
Definition of the Names Generator class.
void run(o2::framework::ProcessingContext &pc) final
void init(o2::framework::InitContext &ic) final
o2::dataformats::FilteredRecoTF mFiltTF
o2::dataformats::FilteredRecoTF * mFiltTFPtr
void connectTree(const std::string &filename)
void snapshot(const Output &spec, T const &object)
ConfigParamRegistry const & options()
Definition InitContext.h:33
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.
Definition Task.h:43
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
DataProcessorSpec getFilteredTFReaderSpec(bool useMC)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
std::string filename()
std::vector< o2::itsmft::ROFRecord > ITSClusterROFs
std::vector< o2::its::TrackITS > ITSTracks
std::vector< o2::MCCompLabel > ITSTrackMCTruth
std::vector< o2::itsmft::ROFRecord > ITSTrackROFs
std::vector< int > ITSClusterIndices
std::vector< unsigned char > ITSClusterPatterns
std::vector< o2::itsmft::CompClusterExt > ITSClusters
static std::string rectifyDirectory(const std::string_view p)
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"