15#include <arrow/util/key_value_metadata.h>
16#include <arrow/util/config.h>
31 throw o2::framework::runtime_error_f(
"Trying to dereference index with a wrong type in %s_as<T> for base target \"%s\". Note that if you have several compatible index targets in your process() signature, the last one will be the one actually bound.", getter,
target);
51 rows.resize(sel->GetNumSlots());
52 for (
auto i = 0;
i < sel->GetNumSlots(); ++
i) {
53 rows[
i] = sel->GetIndex(
i);
62 auto start_iterator = std::lower_bound(mSelectedRows.begin(), mSelectedRows.end(),
start);
63 auto stop_iterator = std::lower_bound(start_iterator, mSelectedRows.end(),
end);
65 std::ranges::transform(slicedSelection.begin(), slicedSelection.end(), slicedSelection.begin(),
67 return idx - static_cast<int64_t>(start);
69 return slicedSelection;
75 requires(std::same_as<T, std::string>)
76auto makeString(T
const&
str)
81 requires(std::same_as<T, const char*>)
82auto makeString(T
const&
str)
88void canNotJoin(std::vector<std::shared_ptr<arrow::Table>>
const& tables, std::span<T>
labels)
90 for (
auto i = 0U;
i < tables.size() - 1; ++
i) {
91 if (tables[
i]->num_rows() != tables[
i + 1]->num_rows()) {
93 makeString(
labels[
i]), makeString(
labels[
i + 1]), (
long long)tables[
i]->num_rows(), (
long long)tables[
i + 1]->num_rows());
99void IncompatibleRanges(std::vector<ArrowTableRef>
const& tables, std::span<T>
labels)
101 auto loc = std::ranges::adjacent_find(tables, [](
auto const& l,
auto const&
r) {
return l.range !=
r.range; });
102 if (loc != std::ranges::cend(tables)) {
103 auto pos = std::distance(tables.begin(), loc);
105 if (loc->range.size != next->range.size) {
108 (
int)
pos, (
int)
pos + 1, (
long long)loc->range.size, (
long long)next->range.size);
111 makeString(
labels[
pos]), makeString(
labels[
pos + 1]), (
long long)loc->range.size, (
long long)next->range.size);
115 (
int)
pos, (
unsigned long long)loc->range.offset, (
long long)loc->range.size, (
unsigned long long)next->range.offset, (
long long)next->range.size);
118 (
int)
pos, makeString(
labels[
pos]), makeString(
labels[
pos + 1]), (
unsigned long long)loc->range.offset, (
long long)loc->range.size, (
unsigned long long)next->range.offset, (
long long)next->range.size);
122std::shared_ptr<arrow::Table> joinTablesImpl(std::ranges::input_range
auto tables)
124 std::vector<std::shared_ptr<arrow::Field>>
fields;
125 std::vector<std::shared_ptr<arrow::ChunkedArray>> columns;
126 bool notEmpty = (tables.front()->num_rows() != 0);
127 std::ranges::for_each(tables, [&
fields, &columns, notEmpty](
auto const&
t) {
128 std::ranges::copy(
t->fields(), std::back_inserter(
fields));
130 std::ranges::copy(
t->columns(), std::back_inserter(columns));
134 return arrow::Table::Make(
schema, columns);
138ArrowTableRef joinTablesImpl(std::ranges::input_range
auto tables, std::span<T>
labels)
140 if (tables.size() == 1) {
141 return tables.front();
143 IncompatibleRanges(tables,
labels);
144 ArrowRange commonRange{tables.front().range};
145 return {joinTablesImpl(tables), commonRange};
151 std::vector<ArrowTableRef> refs;
152 std::ranges::transform(tables, std::back_inserter(refs), [](
auto const& table) {
return ArrowTableRef{table}; });
153 return joinTablesImpl(refs, std::span<const char* const>());
158 return joinTablesImpl(tables, std::span<const char* const>());
163 return joinTablesImpl(tables,
labels);
168 return joinTablesImpl(tables,
labels);
173 canNotJoin(tables,
labels);
179 canNotJoin(tables,
labels);
185 if (tables.size() == 1) {
186 return tables.front();
188 std::vector<std::shared_ptr<arrow::ChunkedArray>> columns;
189 std::vector<std::shared_ptr<arrow::Field>> resultFields = tables.front()->schema()->fields();
190 auto compareFields = [](std::shared_ptr<arrow::Field>
const& f1, std::shared_ptr<arrow::Field>
const& f2) {
192 return (!f1->Equals(f2)) && (f1->name() < f2->name());
195 for (
auto i = 1;
i < tables.size(); ++
i) {
196 auto const&
fields = tables[
i]->fields();
197 std::vector<std::shared_ptr<arrow::Field>> intersection;
198 std::ranges::set_intersection(resultFields,
fields, std::back_inserter(intersection), compareFields);
199 resultFields.swap(intersection);
202 for (
auto const& field : resultFields) {
203 arrow::ArrayVector
chunks;
204 for (
auto const& table : tables) {
205 auto ci = table->schema()->GetFieldIndex(field->name());
209 auto column = table->column(ci);
210 auto otherChunks = column->chunks();
211 chunks.insert(
chunks.end(), otherChunks.begin(), otherChunks.end());
213 columns.push_back(std::make_shared<arrow::ChunkedArray>(
chunks));
216 return {arrow::Table::Make(std::make_shared<arrow::Schema>(resultFields), columns)};
224 auto field = std::ranges::find_if(table->schema()->fields(), [
label](std::shared_ptr<arrow::Field>
const&
f) {
225 std::string_view name = f->name();
226 return label == name ||
227 std::ranges::equal(label, name, [](char c1, char c2) {
228 return asciiToLower(c1) == asciiToLower(c2);
231 if (field == table->schema()->fields().end()) {
234 return table->column(std::distance(table->schema()->fields().begin(), field)).get();
254 Int_t previousErrorLevel = gErrorIgnoreLevel;
255 gErrorIgnoreLevel = kFatal;
257 TMemFile
file(
"name", (
char*)payload,
size,
"READ");
258 gErrorIgnoreLevel = previousErrorLevel;
259 if (
file.IsZombie()) {
266 auto object =
file.GetObjectChecked(what, cl);
270 std::string objectName(cl->GetName());
271 objectName.erase(std::find_if(objectName.rbegin(), objectName.rend(), [](
unsigned char ch) {
272 return !std::isspace(ch);
275 objectName.erase(objectName.begin(), std::find_if(objectName.begin(), objectName.end(), [](
unsigned char ch) {
276 return !std::isspace(ch);
279 object =
file.GetObjectChecked(objectName.c_str(), cl);
280 LOG(warn) <<
"Did not find object under expected name " << what;
284 LOG(warn) <<
"Found object under deprecated name " << cl->GetName();
289 if (cl->IsTObject()) {
292 auto tree =
dynamic_cast<TTree*
>((
TObject*)
object);
294 tree->LoadBaskets(0x1L << 32);
295 tree->SetDirectory(
nullptr);
298 auto h =
dynamic_cast<TH1*
>((
TObject*)
object);
300 h->SetDirectory(
nullptr);
312 m.origin = newOrigin;
325 if (
pos != std::string::npos) {
333 std::transform(
str.begin(),
str.end(),
str.begin(), [](
unsigned char c) { return std::toupper(c); });
std::shared_ptr< arrow::Schema > schema
std::vector< std::shared_ptr< arrow::Field > > fields
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
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
std::vector< o2::MCCompLabel > labels
Class for time synchronization of RawReader instances.
GLsizei const GLfloat * value
GLuint GLsizei const GLchar * label
std::shared_ptr< gandiva::SelectionVector > Selection
Defining ITS Vertex explicitly as messageable.
RuntimeErrorRef runtime_error(const char *)
void throw_error(RuntimeErrorRef)
std::string strToUpper(std::string &&str)
RuntimeErrorRef runtime_error_f(const char *,...)
std::string cutString(std::string &&str)
void * extractCCDBPayload(char *payload, size_t size, TClass const *cl, const char *what)
SelectionVector selectionToVector(gandiva::Selection const &sel)
void notBoundTable(const char *tableName)
SelectionVector sliceSelection(std::span< int64_t const > const &mSelectedRows, int64_t nrows, uint64_t offset)
std::vector< int64_t > SelectionVector
void missingFilterDeclaration(int hash, int ai)
void accessingInvalidIndexFor(const char *getter)
void dereferenceWithWrongType(const char *getter, const char *target)
void getterNotFound(const char *targetColumnLabel)
void missingOptionalPreslice(const char *label, const char *key)
std::function< framework::ConcreteDataMatcher(framework::ConcreteDataMatcher &&)> originReplacement(header::DataOrigin newOrigin)
arrow::ChunkedArray * getIndexFromLabel(arrow::Table *table, std::string_view label)
void notFoundColumn(const char *label, const char *key)
const std::string binding
Entry const & getBindingKey() const
SliceInfoUnsortedPtr sliceInfo
std::span< const int64_t > getSliceFor(int value) const
void updateSliceInfo(SliceInfoUnsortedPtr &&si)
o2::soa::ArrowTableRef getSliceFor(int value, o2::soa::ArrowTableRef const &input) const
void updateSliceInfo(SliceInfoPtr &&si)
std::pair< int64_t, int64_t > getSliceFor(int value) const
std::span< int64_t const > getSliceFor(int value) const
static o2::soa::ArrowTableRef joinTables(std::vector< std::shared_ptr< arrow::Table > > &&tables)
static o2::soa::ArrowTableRef concatTables(std::vector< o2::soa::ArrowTableRef > &&tables)
ArrowTableRef slice(ArrowRange newRange) const
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< ReadoutWindowData > rows