20
20
#include < ROOT/RDF/SnapshotHelpers.hxx>
21
21
22
22
#include < ROOT/REntry.hxx>
23
+ #include < ROOT/RFieldToken.hxx>
23
24
#include < ROOT/RNTuple.hxx>
24
25
#include < ROOT/RNTupleDS.hxx>
25
26
#include < ROOT/RNTupleWriter.hxx>
@@ -831,6 +832,7 @@ void ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::Initialize()
831
832
{
832
833
auto model = ROOT::RNTupleModel::CreateBare ();
833
834
auto nFields = fOutputFieldNames .size ();
835
+ fFieldTokens .resize (nFields);
834
836
for (decltype (nFields) i = 0 ; i < nFields; i++) {
835
837
// Need to retrieve the type of every field to create as a string
836
838
// If the input type for a field does not have RTTI, internally we store it as the tag UseNativeDataType. When
@@ -840,6 +842,7 @@ void ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::Initialize()
840
842
fInputFieldNames [i], fOptions .fVector2RVec )
841
843
: ROOT::Internal::RDF::TypeID2TypeName (*fInputColumnTypeIDs [i]);
842
844
model->AddField (ROOT::RFieldBase::Create (fOutputFieldNames [i], typeName).Unwrap ());
845
+ fFieldTokens [i] = model->GetToken (fOutputFieldNames [i]);
843
846
}
844
847
model->Freeze ();
845
848
fOutputEntry = model->CreateBareEntry ();
@@ -866,9 +869,9 @@ void ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::Initialize()
866
869
867
870
void ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::Exec (unsigned int /* slot */ , const std::vector<void *> &values)
868
871
{
869
- assert (values.size () == fOutputFieldNames .size ());
872
+ assert (values.size () == fFieldTokens .size ());
870
873
for (decltype (values.size ()) i = 0 ; i < values.size (); i++) {
871
- fOutputEntry ->BindRawPtr (fOutputFieldNames [i], values[i]);
874
+ fOutputEntry ->BindRawPtr (fFieldTokens [i], values[i]);
872
875
}
873
876
fWriter ->Fill (*fOutputEntry );
874
877
}
0 commit comments