37 mSkipClusRefs = ic.
options().
get<
bool>(
"skip-clusref");
38 connectTree(mInputFileName);
43 auto ent = mTree->GetReadEntry() + 1;
45 assert(ent < mTree->GetEntries());
51 if ((trackTune.sourceLevelTPC && trackTune.applyWhenReading) &&
52 (trackTune.useTPCInnerCorr || trackTune.useTPCOuterCorr ||
54 for (
auto& trc : mTracksOut) {
55 if (trc.getNClusters() == 0) {
58 if (trackTune.useTPCInnerCorr) {
59 trc.updateParams(trackTune.tpcParInner);
64 if (trackTune.useTPCOuterCorr) {
65 trc.getParamOut().updateParams(trackTune.tpcParOuter);
78 if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
84void TrackReader::accumulate(
int from,
int n)
86 assert(from + n <= mTree->GetEntries());
88 mTree->GetEntry(from);
89 mTracksOut.swap(*mTracksInp);
90 mCluRefVecOut.swap(*mCluRefVecInp);
92 std::copy(mMCTruthInp->begin(), mMCTruthInp->end(), std::back_inserter(mMCTruthOut));
95 for (
int iev = 0; iev <
n; iev++) {
96 mTree->GetEntry(from + iev);
98 uint32_t shift = mCluRefVecOut.size();
100 auto cl0 = mCluRefVecInp->begin();
101 auto cl1 = mCluRefVecInp->end();
102 std::copy(cl0, cl1, std::back_inserter(mCluRefVecOut));
104 auto tr0 = mTracksInp->begin();
105 auto tr1 = mTracksInp->end();
108 for (
auto tr = tr0; tr != tr1; tr++) {
109 tr->shiftFirstClusterRef(shift);
112 std::copy(tr0, tr1, std::back_inserter(mTracksOut));
115 std::copy(mMCTruthInp->begin(), mMCTruthInp->end(), std::back_inserter(mMCTruthOut));
119 LOG(info) <<
"TPCTrackReader pushes " << mTracksOut.size() <<
" tracks from entries " << from <<
" : " << from +
n - 1;
122void TrackReader::connectTree(
const std::string&
filename)
124 mTree.reset(
nullptr);
125 mFile.reset(TFile::Open(
filename.c_str()));
126 if (!(mFile && !mFile->IsZombie())) {
127 throw std::runtime_error(
"Error opening tree file");
129 mTree.reset((TTree*)mFile->Get(mTrackTreeName.c_str()));
131 throw std::runtime_error(
"Error opening tree");
134 mTree->SetBranchAddress(mTrackBranchName.c_str(), &mTracksInp);
135 if (!mSkipClusRefs) {
136 mTree->SetBranchAddress(mClusRefBranchName.c_str(), &mCluRefVecInp);
138 mCluRefVecInp =
new std::vector<o2::tpc::TPCClRefElem>;
141 if (mTree->GetBranch(mTrackMCTruthBranchName.c_str())) {
142 mTree->SetBranchAddress(mTrackMCTruthBranchName.c_str(), &mMCTruthInp);
143 LOG(info) <<
"Will use MC-truth from " << mTrackMCTruthBranchName;
145 LOG(info) <<
"MC-truth is missing";
149 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " << mTree->GetEntries() <<
" entries";
154 std::vector<OutputSpec> outputSpec;
155 outputSpec.emplace_back(
"TPC",
"TRACKS", 0, Lifetime::Timeframe);
156 outputSpec.emplace_back(
"TPC",
"CLUSREFS", 0, Lifetime::Timeframe);
158 outputSpec.emplace_back(
"TPC",
"TRACKSMCLBL", 0, Lifetime::Timeframe);
167 {
"infile", VariantType::String,
"tpctracks.root", {
"Name of the input track file"}},
168 {
"input-dir", VariantType::String,
"none", {
"Input directory"}},
169 {
"skip-clusref", VariantType::Bool,
false, {
"Skip reading cluster references"}}}};
Definition of the Names Generator class.
Configurable params for tracks ad hoc tuning.
static const TrackTuneParams & Instance()
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.
void init(InitContext &ic) final
void run(ProcessingContext &pc) final
TrackReader(bool useMC=true)
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
framework::DataProcessorSpec getTPCTrackReaderSpec(bool useMC=true)
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"