@@ -201,10 +201,11 @@ def xrootd_index_private_nano(
201
201
print (f"\t \t \t \t { subsample_name } " )
202
202
203
203
# Navigate through the directory structure (4 levels for new structure)
204
- tfiles = []
205
204
try :
206
205
for f1 in _dirlist (fs , spath ): # dataset directory
207
206
f1path = spath / f1
207
+ tfiles = [] # Reset for each dataset directory
208
+
208
209
for f2 in _dirlist (fs , f1path ): # timestamp directory
209
210
f2path = f1path / f2
210
211
for f3 in _dirlist (fs , f2path ): # chunk directory (0000, 0001, etc.)
@@ -214,15 +215,17 @@ def xrootd_index_private_nano(
214
215
if root_files :
215
216
tfiles += [f"{ redirector } { f3path !s} /{ f } " for f in root_files ]
216
217
218
+ # Process files for this specific dataset directory
217
219
if is_data :
218
- subsample_key = f" { sample } _ { f1 } " .replace ("_DAZSLE_PFNano" , "" )
219
- # For data, concatenate files from related subsamples
220
- # e.g. EGamma0 and EGamma1 should be combined
220
+ run_info = f1 .replace ("_DAZSLE_PFNano" , "" )
221
+ subsample_key = f" { sample } _ { run_info } "
222
+
221
223
if subsample_key not in files [year ][sample ]:
222
224
files [year ][sample ][subsample_key ] = []
223
225
files [year ][sample ][subsample_key ].extend (tfiles )
224
226
print (f"\t \t \t \t \t { len (tfiles )} files added" )
225
227
228
+ # Handle MC case outside the f1 loop since it processes all files together
226
229
if not is_data :
227
230
files [year ][sample ][subsample_name ] = tfiles
228
231
print (f"\t \t \t \t \t { len (tfiles )} files" )
0 commit comments