26#include "TTreeReader.h"
27#include "TTreeReaderValue.h"
57 mLabels = std::make_unique<TTreeReaderValue<dataformats::MCTruthContainer<MCLabel>>>(mTreeReader,
"MIDDigitMCLabels");
64 ic.
options().
get<std::string>(
"mid-digit-infile"));
83 TTreeReader mTreeReader{};
84 TTreeReaderValue<std::vector<ROFRecord>> mRofs = {mTreeReader,
"MIDROFRecords"};
85 TTreeReaderValue<std::vector<ColumnData>> mDigits = {mTreeReader,
"MIDDigit"};
86 std::unique_ptr<TTreeReaderValue<dataformats::MCTruthContainer<MCLabel>>> mLabels{};
88 bool mUseIRFrames =
false;
90 void connectTree(std::string
filename)
94 throw std::invalid_argument(fmt::format(
"Opening file {} failed",
filename));
97 auto tree =
file->Get<TTree>(
"o2sim");
99 throw std::invalid_argument(fmt::format(
"Tree o2sim not found in {}",
filename));
101 mTreeReader.SetTree(
tree);
102 mTreeReader.Restart();
109 if (mTreeReader.GetEntries() == 0) {
110 LOG(info) <<
"digit tree has no entry, sending empty output";
122 if (!mTreeReader.Next()) {
123 throw std::invalid_argument(mTreeReader.fgEntryStatusText[mTreeReader.GetEntryStatus()]);
134 if (mTreeReader.GetCurrentEntry() + 1 >= mTreeReader.GetEntries()) {
142 std::vector<ROFRecord> rofs{};
143 std::vector<ColumnData>
digits{};
147 auto irFrames = pc.
inputs().
get<gsl::span<dataformats::IRFrame>>(
"driverInfo");
149 if (mTreeReader.GetEntries() == 0) {
152 LOG(info) <<
"digit tree has no entry, sending empty output";
153 }
else if (!irFrames.empty()) {
156 const auto irMin = irfSel.getIRFrames().front().getMin();
157 const auto irMax = irfSel.getIRFrames().back().getMax();
160 bool loadNextTF = mTreeReader.GetCurrentEntry() < 0;
164 if (loadNextTF && !mTreeReader.Next()) {
165 throw std::invalid_argument(mTreeReader.fgEntryStatusText[mTreeReader.GetEntryStatus()]);
169 if (!mRofs->empty() && mRofs->front().interactionRecord <= irMax &&
170 mRofs->back().interactionRecord >= irMin) {
171 for (
const auto& rof : *mRofs) {
172 if (irfSel.check(rof.interactionRecord) != -1) {
173 rofs.emplace_back(rof);
174 rofs.back().firstEntry =
digits.size();
175 rofs.back().nEntries = rof.nEntries;
176 digits.insert(
digits.end(), mDigits->begin() + rof.firstEntry, mDigits->begin() + rof.getEndIndex());
178 for (
auto idig = 0; idig < rof.nEntries; ++idig) {
179 labels.addElements(
labels.getIndexedSize(), (*mLabels)->getLabels(rof.firstEntry + idig));
187 if ((mRofs->empty() || mRofs->back().interactionRecord < irMax) &&
188 mTreeReader.GetCurrentEntry() + 1 < mTreeReader.GetEntries()) {
205 if (irFrames.empty() || irFrames.back().isLast()) {
214 std::vector<OutputSpec> outputs;
215 std::stringstream ss;
231 Options{{
"mid-digit-infile", VariantType::String,
"middigits.root", {
"Name of the input file"}},
232 {
"input-dir", VariantType::String,
"none", {
"Input directory"}}}};
std::vector< framework::ConcreteDataMatcher > matchers
Strip pattern (aka digits)
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font Renderer for event Frontend to use for event ROOT macros used as track filter Console script file
Class to check if give InteractionRecord or IRFrame is selected by the external IRFrame vector.
Class to delimit start and end IR of certain time period.
std::vector< o2::MCCompLabel > labels
Definition of a container to keep Monte Carlo truth external to simulation objects.
Data processor specs for MID digits reader device.
bool hasOption(const char *key) const
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.
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
void init(InitContext &ic)
void run(ProcessingContext &pc)
DigitsReaderDeviceDPL(bool useMC)
void setSelectedIRFrames(const SPAN &sp, size_t bwd=0, size_t fwd=0, long shift=0, bool removeOverlaps=true)
constexpr o2::header::DataOrigin gDataOriginMID
Defining ITS Vertex explicitly as messageable.
std::vector< InputSpec > select(char const *matcher="")
std::vector< InputSpec > Inputs
framework::DataProcessorSpec getDigitReaderSpec(bool useMC, const char *baseDescription="DATAMC")
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static OutputSpec asOutputSpec(InputSpec const &spec)
static std::string rectifyDirectory(const std::string_view p)
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))
std::vector< Digit > digits