@@ -164607,7 +164607,11 @@ function objectHierarchy(top, obj, args = undefined) {
164607164607 }
164608164608 }
164609164609 }
164610- } else if ((typeof fld === 'number') || (typeof fld === 'boolean') || (typeof fld === 'bigint')) {
164610+ } else if (typeof fld === 'bigint') {
164611+ simple = true;
164612+ item._value = fld.toString() + 'n';
164613+ item._vclass = cssValueNum;
164614+ } else if ((typeof fld === 'number') || (typeof fld === 'boolean')) {
164611164615 simple = true;
164612164616 if (key === 'fBits')
164613164617 item._value = '0x' + fld.toString(16);
@@ -177778,7 +177782,6 @@ class RNTupleDescriptorBuilder {
177778177782 throw new Error('RNTuple corrupted: header checksum does not match footer checksum.');
177779177783
177780177784 const schemaExtensionSize = reader.readS64();
177781-
177782177785 if (schemaExtensionSize < 0)
177783177786 throw new Error('Schema extension frame is not a record frame, which is unexpected.');
177784177787
@@ -177835,14 +177838,12 @@ class RNTupleDescriptorBuilder {
177835177838 fieldListSize = reader.readS64(), // signed 64-bit
177836177839 fieldListIsList = fieldListSize < 0;
177837177840
177838-
177839177841 if (!fieldListIsList)
177840177842 throw new Error('Field list frame is not a list frame, which is required.');
177841177843
177842177844 const fieldListCount = reader.readU32(), // number of field entries
177843- // List frame: list of field record frames
177845+ fieldDescriptors = []; // List frame: list of field record frames
177844177846
177845- fieldDescriptors = [];
177846177847 for (let i = 0; i < fieldListCount; ++i) {
177847177848 const recordStart = BigInt(reader.offset),
177848177849 fieldRecordSize = reader.readS64(),
@@ -178344,18 +178345,18 @@ class ReaderItem {
178344178345 this.buf = new DataView(new ArrayBuffer(4), 0);
178345178346 break;
178346178347 case kReal32Trunc:
178348+ this.buf = new DataView(new ArrayBuffer(4), 0);
178349+ // eslint-disable-next-line no-fallthrough
178347178350 case kReal32Quant:
178348178351 this.nbits = this.column.bitsOnStorage;
178349- if (this.coltype === kReal32Trunc)
178350- this.buf = new DataView(new ArrayBuffer(4), 0);
178351- else {
178352+ if (!this.buf) {
178352178353 this.factor = (this.column.maxValue - this.column.minValue) / ((1 << this.nbits) - 1);
178353178354 this.min = this.column.minValue;
178354178355 }
178355178356
178356178357 this.func = function(obj) {
178357178358 let res = 0, len = this.nbits;
178358- // extract nbits from the
178359+ // extract nbits from the stream
178359178360 while (len > 0) {
178360178361 if (this.o2 === 0) {
178361178362 this.byte = this.view.getUint8(this.o);
@@ -178610,6 +178611,42 @@ class ArrayReaderItem extends ReaderItem {
178610178611}
178611178612
178612178613
178614+ /** @class reading of std::bitset<N>
178615+ * @desc large numbers with more than 48 bits converted to BigInt
178616+ * @private */
178617+
178618+ class BitsetReaderItem extends ReaderItem {
178619+
178620+ constructor(items, tgtname, size) {
178621+ super(items, tgtname);
178622+ this.size = size;
178623+ items[0].set_not_simple();
178624+ this.bigint = size > 48;
178625+ }
178626+
178627+ func(tgtobj) {
178628+ const tmp = {};
178629+ let len = 0, res = this.bigint ? 0n : 0;
178630+ while (len < this.size) {
178631+ this.items[0].func(tmp);
178632+ if (tmp.bit) {
178633+ if (this.bigint)
178634+ res |= (1n << BigInt(len));
178635+ else
178636+ res |= 1 << len;
178637+ }
178638+ len++;
178639+ }
178640+ tgtobj[this.name] = res;
178641+ }
178642+
178643+ shift(entries) {
178644+ this.items[0].shift(entries * this.size);
178645+ }
178646+
178647+ }
178648+
178649+
178613178650/** @class reading std::vector and other kinds of collections
178614178651 * @private */
178615178652
@@ -178657,7 +178694,6 @@ class VariantReaderItem extends ReaderItem {
178657178694
178658178695 constructor(items, tgtname) {
178659178696 super(items, tgtname);
178660- this.items = items;
178661178697 this.set_not_simple();
178662178698 }
178663178699
@@ -178691,6 +178727,29 @@ class TupleReaderItem extends ReaderItem {
178691178727
178692178728}
178693178729
178730+ /** @class reading custom class field
178731+ * @private */
178732+
178733+ class CustomClassReaderItem extends ReaderItem {
178734+
178735+ constructor(items, tgtname, classname) {
178736+ super(items, tgtname);
178737+ this.classname = classname;
178738+ this.set_not_simple();
178739+ }
178740+
178741+ func(tgtobj) {
178742+ const obj = { _typename: this.classname };
178743+ this.items.forEach(item => item.func(obj));
178744+ tgtobj[this.name] = obj;
178745+ }
178746+
178747+ shift(entries) {
178748+ this.items.forEach(item => item.shift(entries));
178749+ }
178750+
178751+ }
178752+
178694178753
178695178754/** @class reading std::pair field
178696178755 * @private */
@@ -178726,7 +178785,7 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178726178785 lastentry: 0 // last entry in the rntuple
178727178786 };
178728178787
178729- function readNextPortion(inc_cluster) {
178788+ function readNextPortion(builder, inc_cluster) {
178730178789 let do_again = true, numClusterEntries, locations;
178731178790
178732178791 while (do_again) {
@@ -178735,13 +178794,13 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178735178794 handle.current_cluster_first_entry = handle.current_cluster_last_entry;
178736178795 }
178737178796
178738- locations = rntuple. builder.pageLocations[handle.current_cluster];
178797+ locations = builder.pageLocations[handle.current_cluster];
178739178798 if (!locations) {
178740178799 selector.Terminate(true);
178741178800 return selector;
178742178801 }
178743178802
178744- numClusterEntries = rntuple. builder.clusterSummaries[handle.current_cluster].numEntries;
178803+ numClusterEntries = builder.clusterSummaries[handle.current_cluster].numEntries;
178745178804
178746178805 handle.current_cluster_last_entry = handle.current_cluster_first_entry + numClusterEntries;
178747178806
@@ -178804,7 +178863,7 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178804178863 }
178805178864 }
178806178865
178807- return readNextPortion(true);
178866+ return readNextPortion(builder, true);
178808178867 });
178809178868 }
178810178869
@@ -178815,28 +178874,39 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178815178874 return item;
178816178875 }
178817178876
178818- function addFieldReading(field, tgtname) {
178819- const columns = rntuple. builder.findColumns(field),
178820- childs = rntuple. builder.findChildFields(field);
178877+ function addFieldReading(builder, field, tgtname) {
178878+ const columns = builder.findColumns(field),
178879+ childs = builder.findChildFields(field);
178821178880 if (!columns?.length) {
178822178881 if ((childs.length === 2) && (field.typeName.indexOf('std::pair') === 0)) {
178823- const item1 = addFieldReading(childs[0], 'first'),
178824- item2 = addFieldReading(childs[1], 'second');
178882+ const item1 = addFieldReading(builder, childs[0], 'first'),
178883+ item2 = addFieldReading(builder, childs[1], 'second');
178825178884 return new PairReaderItem([item1, item2], tgtname);
178826178885 }
178827178886
178828178887 if ((childs.length === 1) && (field.typeName.indexOf('std::array') === 0)) {
178829- const item1 = addFieldReading(childs[0], 'value');
178888+ const item1 = addFieldReading(builder, childs[0], 'value');
178830178889 return new ArrayReaderItem([item1], tgtname, Number(field.arraySize));
178831178890 }
178832178891
178892+ if ((childs.length === 1) && (field.typeName.indexOf('std::atomic') === 0))
178893+ return addFieldReading(builder, childs[0], tgtname);
178894+
178895+
178833178896 if ((childs.length > 0) && (field.typeName.indexOf('std::tuple') === 0)) {
178834178897 const items = [];
178835178898 for (let i = 0; i < childs.length; ++i)
178836- items.push(addFieldReading(childs[i], `_${i}`));
178899+ items.push(addFieldReading(builder, childs[i], `_${i}`));
178837178900 return new TupleReaderItem(items, tgtname);
178838178901 }
178839178902
178903+ if ((childs.length > 0) && field.checksum && field.typeName) {
178904+ const items = [];
178905+ for (let i = 0; i < childs.length; ++i)
178906+ items.push(addFieldReading(builder, childs[i], childs[i].fieldName));
178907+ return new CustomClassReaderItem(items, tgtname, field.typeName);
178908+ }
178909+
178840178910 throw new Error(`No columns found for field '${field.fieldName}' in RNTuple`);
178841178911 }
178842178912
@@ -178846,6 +178916,12 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178846178916 return new StringReaderItem([itemlen, itemstr], tgtname);
178847178917 }
178848178918
178919+ if ((columns.length === 1) && (field.typeName.indexOf('std::bitset') === 0)) {
178920+ const itembit = addColumnReadout(columns[0], 'bit');
178921+ return new BitsetReaderItem([itembit], tgtname, Number(field.arraySize));
178922+ }
178923+
178924+
178849178925 let is_stl = false;
178850178926 ['vector', 'map', 'unordered_map', 'multimap', 'unordered_multimap', 'set', 'unordered_set', 'multiset', 'unordered_multiset'].forEach(name => {
178851178927 if (field.typeName.indexOf('std::' + name) === 0)
@@ -178854,22 +178930,22 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178854178930
178855178931 if ((childs.length === 1) && is_stl) {
178856178932 const itemlen = addColumnReadout(columns[0], 'len'),
178857- itemval = addFieldReading(childs[0], 'val');
178933+ itemval = addFieldReading(builder, childs[0], 'val');
178858178934 return new CollectionReaderItem([itemlen, itemval], tgtname);
178859178935 }
178860178936
178861178937 if ((childs.length > 0) && (field.typeName.indexOf('std::variant') === 0)) {
178862178938 const items = [addColumnReadout(columns[0], 'switch')];
178863178939 for (let i = 0; i < childs.length; ++i)
178864- items.push(addFieldReading(childs[i], tgtname));
178940+ items.push(addFieldReading(builder, childs[i], tgtname));
178865178941 return new VariantReaderItem(items, tgtname);
178866178942 }
178867178943
178868178944 return addColumnReadout(columns[0], tgtname);
178869178945 }
178870178946
178871- return readHeaderFooter(rntuple).then(res => {
178872- if (!res )
178947+ return readHeaderFooter(rntuple).then(builder => {
178948+ if (!builder )
178873178949 throw new Error('Not able to read header for the RNtuple');
178874178950
178875178951 for (let i = 0; i < selector.numBranches(); ++i) {
@@ -178879,16 +178955,16 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178879178955 if (!name)
178880178956 throw new Error(`Not able to extract name for field ${i}`);
178881178957
178882- const field = rntuple. builder.findField(name);
178958+ const field = builder.findField(name);
178883178959 if (!field)
178884178960 throw new Error(`Field ${name} not found`);
178885178961
178886- const item = addFieldReading(field, tgtname);
178962+ const item = addFieldReading(builder, field, tgtname);
178887178963 handle.arr.push(item);
178888178964 }
178889178965
178890178966 // calculate number of entries
178891- rntuple. builder.clusterSummaries.forEach(summary => { handle.lastentry += summary.numEntries; });
178967+ builder.clusterSummaries.forEach(summary => { handle.lastentry += summary.numEntries; });
178892178968
178893178969 if (handle.firstentry >= handle.lastentry)
178894178970 throw new Error('Not able to find entries in the RNtuple');
@@ -178912,8 +178988,8 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178912178988 handle.process_max = Math.min(handle.process_max, handle.process_min + args.numentries);
178913178989
178914178990 // first check from which cluster one should start
178915- for (let indx = 0, emin = 0; indx < rntuple. builder.clusterSummaries.length; ++indx) {
178916- const summary = rntuple. builder.clusterSummaries[indx],
178991+ for (let indx = 0, emin = 0; indx < builder.clusterSummaries.length; ++indx) {
178992+ const summary = builder.clusterSummaries[indx],
178917178993 emax = emin + summary.numEntries;
178918178994 if ((handle.process_min >= emin) && (handle.process_min < emax)) {
178919178995 handle.current_cluster = indx;
@@ -178930,7 +179006,7 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178930179006
178931179007 selector.Begin(rntuple);
178932179008
178933- return readNextPortion();
179009+ return readNextPortion(builder );
178934179010 }).then(() => selector);
178935179011}
178936179012
@@ -178977,8 +179053,8 @@ async function rntupleDraw(rntuple, args) {
178977179053 args.SelectorClass = TDrawSelectorTuple;
178978179054 args.processFunction = rntupleProcess;
178979179055
178980- return readHeaderFooter(rntuple).then(res_header_footer => {
178981- return res_header_footer ? treeDraw(rntuple, args) : null;
179056+ return readHeaderFooter(rntuple).then(builder => {
179057+ return builder ? treeDraw(rntuple, args) : null;
178982179058 });
178983179059}
178984179060
@@ -178989,12 +179065,8 @@ async function rntupleDraw(rntuple, args) {
178989179065async function tupleHierarchy(tuple_node, tuple) {
178990179066 tuple_node._childs = [];
178991179067 // tuple_node._tuple = tuple; // set reference, will be used later by RNTuple::Draw
178992-
178993- return readHeaderFooter(tuple).then(res => {
178994- if (!res)
178995- return res;
178996-
178997- tuple.builder?.fieldDescriptors.forEach((field, indx) => {
179068+ return readHeaderFooter(tuple).then(builder => {
179069+ builder?.fieldDescriptors.forEach((field, indx) => {
178998179070 if (field.parentFieldId !== indx)
178999179071 return;
179000179072 const item = {
@@ -179005,13 +179077,10 @@ async function tupleHierarchy(tuple_node, tuple) {
179005179077 $tuple: tuple, // reference on tuple, need for drawing
179006179078 $field: field
179007179079 };
179008-
179009179080 item._obj = item;
179010-
179011179081 tuple_node._childs.push(item);
179012179082 });
179013-
179014- return true;
179083+ return Boolean(builder);
179015179084 });
179016179085}
179017179086
0 commit comments