Skip to content

Commit 3ff1952

Browse files
authored
[RNTuple] add test files for extension header (#333)
* [RNTuple] add test files for extension header * more test for bool and fix boolean logic
1 parent f317355 commit 3ff1952

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

src/RNTuple/fieldcolumn_reading.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,15 @@ _field_output_type(::Type{LeafField{T}}) where {T} = Vector{T}
9393
function read_field(io, field::LeafField{T}, page_list) where T
9494
cr = field.columnrecord
9595
pages = page_list[field.content_col_idx]
96-
res = collect(reinterpret(T, read_pagedesc(io, pages, cr)))
9796
fei = cr.first_ele_idx
98-
if !iszero(fei)
99-
z = zero(eltype(res))
100-
prepend!(res, fill(z, fei))
97+
res = if !iszero(fei)
98+
z = zero(T)
99+
fill(z, fei)
100+
else
101+
T[]
101102
end
103+
104+
append!(res, reinterpret(T, read_pagedesc(io, pages, cr)))
102105
return res::_field_output_type(field)
103106
end
104107

@@ -110,7 +113,7 @@ function read_field(io, field::LeafField{Bool}, page_list)
110113

111114
# pad to nearest 8*k bytes because each chunk needs to be UInt64
112115
bytes = read_pagedesc(io, pages, cr)
113-
append!(bytes, zeros(eltype(bytes), 8 - rem(total_num_elements, 8)))
116+
append!(bytes, zeros(eltype(bytes), (64 - rem(total_num_elements, 64))÷8))
114117
chunks = reinterpret(UInt64, bytes)
115118

116119
res = BitVector(undef, total_num_elements)

test/rntuple.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,21 @@ end
227227
@test length(truth_jets_one_event.pt) == 5
228228
end
229229

230+
@testset "Footer extension header links backfill" begin
231+
f1 = UnROOT.samplefile("RNTuple/test_ntuple_extension_columns.root")
232+
df = LazyTree(f1, "EventData")
233+
pbs = collect(df.var"HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf_TLAAux::fastDIPS20211215_pb")
234+
@test length(pbs) == 40
235+
@test findfirst(!isempty, pbs) == 37
236+
jets = collect(df.var"HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf_TLAAux:")
237+
238+
@test length.(pbs) == length.(getproperty.(jets, :pt))
239+
240+
# backfilled booleans
241+
xTrigDecisionAux = collect(df.var"xTrigDecisionAux:")
242+
@test length(xTrigDecisionAux) == length(pbs)
243+
end
244+
230245
@testset "RNTuple Tables.jl and Arrow integration" begin
231246
f1 = UnROOT.samplefile("RNTuple/test_ntuple_stl_containers.root")
232247
rnt = LazyTree(f1, "ntuple")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
1. Checkout an Athena build with ROOT nightly (currently has RNTuple RC2)
2+
2. Get an ATLAS RAW file
3+
3. Run reco:
4+
```bash
5+
Reco_tf.py \
6+
--CA="True" \
7+
--maxEvents=40 \
8+
--multithreaded="True" \
9+
--sharedWriter="True" \
10+
--parallelCompression="False" \
11+
--inputBSFile="raw.root" \
12+
--outputDAOD_TLAFile="daod_tla.root" \
13+
--preExec="flags.Output.StorageTechnology.EventData=\"ROOTRNTUPLE\"";
14+
```
Binary file not shown.

0 commit comments

Comments
 (0)