@@ -304,20 +304,22 @@ void CTFReaderSpec::openCTFFile(const std::string& flname)
304304 throw std::runtime_error (fmt::format (" CTF tree in {} has 0 entries, skipping" , flname));
305305 }
306306 if (mInput .shuffle ) {
307+ if (mInput .ctfIDs .empty ()) {
308+ int entries = mCTFTree ->GetEntries ();
309+ if (mInput .maxTFs > 0 ) {
310+ entries = std::min (entries, mInput .maxTFs );
311+ }
312+ if (mInput .maxTFsPerFile > 0 ) {
313+ entries = std::min (entries, mInput .maxTFsPerFile );
314+ }
315+ mInput .ctfIDs .clear ();
316+ mInput .ctfIDs .resize (entries);
317+ std::iota (mInput .ctfIDs .begin (), mInput .ctfIDs .end (), 0 );
318+ }
307319 std::random_device dev;
308320 std::mt19937 gen{dev ()};
309- int entries = mCTFTree ->GetEntries ();
310- if (mInput .maxTFs > 0 ) {
311- entries = std::min (entries, mInput .maxTFs );
312- }
313- if (mInput .maxTFsPerFile > 0 ) {
314- entries = std::min (entries, mInput .maxTFsPerFile );
315- }
316- mInput .ctfIDs .clear ();
317- mInput .ctfIDs .resize (entries);
318- std::iota (mInput .ctfIDs .begin (), mInput .ctfIDs .end (), 0 );
319321 std::shuffle (mInput .ctfIDs .begin (), mInput .ctfIDs .end (), gen);
320- LOGP (info, " will shuffle CTF entries in this order:" );
322+ LOGP (info, " will shuffle reading of CTF entries in this order:" );
321323 for (int i{0 }; i < (int )mInput .ctfIDs .size (); ++i) {
322324 LOGP (info, " \t TF {:02} -> {:02}" , i, mInput .ctfIDs [i]);
323325 }
0 commit comments