@@ -48,26 +48,27 @@ bool RNTupleReader::initCategory(const std::string& category) {
4848 // Assume that the metadata is the same in all files
4949 auto filename = m_filenames[0 ];
5050
51+ auto & collInfo = m_collectionInfo[category];
52+
5153 auto id = m_metadata_readers[filename]->GetView <std::vector<unsigned int >>(root_utils::idTableName (category));
52- m_collectionInfo[category] .id = id (0 );
54+ collInfo .id = id (0 );
5355
5456 auto collectionName =
5557 m_metadata_readers[filename]->GetView <std::vector<std::string>>(root_utils::collectionName (category));
56- m_collectionInfo[category] .name = collectionName (0 );
58+ collInfo .name = collectionName (0 );
5759
5860 auto collectionType =
5961 m_metadata_readers[filename]->GetView <std::vector<std::string>>(root_utils::collInfoName (category));
60- m_collectionInfo[category] .type = collectionType (0 );
62+ collInfo .type = collectionType (0 );
6163
6264 auto subsetCollection =
6365 m_metadata_readers[filename]->GetView <std::vector<short >>(root_utils::subsetCollection (category));
64- m_collectionInfo[category] .isSubsetCollection = subsetCollection (0 );
66+ collInfo .isSubsetCollection = subsetCollection (0 );
6567
6668 auto schemaVersion = m_metadata_readers[filename]->GetView <std::vector<SchemaVersionT>>(" schemaVersion_" + category);
67- m_collectionInfo[category] .schemaVersion = schemaVersion (0 );
69+ collInfo .schemaVersion = schemaVersion (0 );
6870
69- m_idTables[category] =
70- std::make_shared<CollectionIDTable>(m_collectionInfo[category].id , m_collectionInfo[category].name );
71+ m_idTables[category] = std::make_shared<CollectionIDTable>(collInfo.id , collInfo.name );
7172
7273 return true ;
7374}
@@ -175,22 +176,23 @@ std::unique_ptr<ROOTFrameData> RNTupleReader::readEntry(const std::string& categ
175176 auto dentry = m_readers[category][readerIndex]->GetModel ()->GetDefaultEntry ();
176177#endif
177178
178- for (size_t i = 0 ; i < m_collectionInfo[category].id .size (); ++i) {
179- const auto & collType = m_collectionInfo[category].type [i];
179+ const auto & collInfo = m_collectionInfo[category];
180+
181+ for (size_t i = 0 ; i < collInfo.id .size (); ++i) {
182+ const auto & collType = collInfo.type [i];
180183 const auto & bufferFactory = podio::CollectionBufferFactory::instance ();
181- auto maybeBuffers = bufferFactory. createBuffers (collType, m_collectionInfo[category]. schemaVersion [i],
182- m_collectionInfo[category] .isSubsetCollection [i]);
184+ auto maybeBuffers =
185+ bufferFactory. createBuffers (collType, collInfo. schemaVersion [i], collInfo .isSubsetCollection [i]);
183186 auto collBuffers = maybeBuffers.value_or (podio::CollectionReadBuffers{});
184187
185188 if (!maybeBuffers) {
186- std::cout << " WARNING: Buffers couldn't be created for collection " << m_collectionInfo[category].name [i]
187- << " of type " << m_collectionInfo[category].type [i] << " and schema version "
188- << m_collectionInfo[category].schemaVersion [i] << std::endl;
189+ std::cout << " WARNING: Buffers couldn't be created for collection " << collInfo.name [i] << " of type "
190+ << collInfo.type [i] << " and schema version " << collInfo.schemaVersion [i] << std::endl;
189191 return nullptr ;
190192 }
191193
192- if (m_collectionInfo[category] .isSubsetCollection [i]) {
193- auto brName = root_utils::subsetBranch (m_collectionInfo[category] .name [i]);
194+ if (collInfo .isSubsetCollection [i]) {
195+ auto brName = root_utils::subsetBranch (collInfo .name [i]);
194196 auto vec = new std::vector<podio::ObjectID>;
195197#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 31, 0)
196198 dentry->BindRawPtr (brName, vec);
@@ -200,16 +202,16 @@ std::unique_ptr<ROOTFrameData> RNTupleReader::readEntry(const std::string& categ
200202 collBuffers.references ->at (0 ) = std::unique_ptr<std::vector<podio::ObjectID>>(vec);
201203 } else {
202204#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 31, 0)
203- dentry->BindRawPtr (m_collectionInfo[category] .name [i], collBuffers.data );
205+ dentry->BindRawPtr (collInfo .name [i], collBuffers.data );
204206#else
205- dentry->CaptureValueUnsafe (m_collectionInfo[category] .name [i], collBuffers.data );
207+ dentry->CaptureValueUnsafe (collInfo .name [i], collBuffers.data );
206208#endif
207209
208210 const auto relVecNames = podio::DatamodelRegistry::instance ().getRelationNames (collType);
209211 for (size_t j = 0 ; j < relVecNames.relations .size (); ++j) {
210212 const auto relName = relVecNames.relations [j];
211213 auto vec = new std::vector<podio::ObjectID>;
212- const auto brName = root_utils::refBranch (m_collectionInfo[category] .name [i], relName);
214+ const auto brName = root_utils::refBranch (collInfo .name [i], relName);
213215#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 31, 0)
214216 dentry->BindRawPtr (brName, vec);
215217#else
@@ -220,7 +222,7 @@ std::unique_ptr<ROOTFrameData> RNTupleReader::readEntry(const std::string& categ
220222
221223 for (size_t j = 0 ; j < relVecNames.vectorMembers .size (); ++j) {
222224 const auto vecName = relVecNames.vectorMembers [j];
223- const auto brName = root_utils::vecBranch (m_collectionInfo[category] .name [i], vecName);
225+ const auto brName = root_utils::vecBranch (collInfo .name [i], vecName);
224226#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 31, 0)
225227 dentry->BindRawPtr (brName, collBuffers.vectorMembers ->at (j).second );
226228#else
@@ -229,7 +231,7 @@ std::unique_ptr<ROOTFrameData> RNTupleReader::readEntry(const std::string& categ
229231 }
230232 }
231233
232- buffers.emplace (m_collectionInfo[category] .name [i], std::move (collBuffers));
234+ buffers.emplace (collInfo .name [i], std::move (collBuffers));
233235 }
234236
235237 m_readers[category][readerIndex]->LoadEntry (localEntry, *dentry);
0 commit comments