Applies the `process` function to each and every event from the specified
input files, in sequence.
The `inputFiles` list may be a single file, or a list (or any iterable object)
of files, or a `std::vector<std::string>` object.
The `process` callable is executed with two arguments: the number of argument
in the loop, and the event itself. No information on which file the event is
taken from is provided. If a call returns exactly `False`, it is considered
to have failed and an error counter is incremented. Exceptions raised in
`process` are not handled.
The error counter is returned at the end of the execution.
Options:
- 'nEvents': number of events to be processed (does not include skipped ones)
- 'nSkip': number of events from the beginning of the sample to be skipped
Definition at line 233 of file icarusalg/icarusalg/gallery/helpers/python/galleryUtils.py.
236 Applies the `process` function to each and every event from the specified
237 input files, in sequence.
239 The `inputFiles` list may be a single file, or a list (or any iterable object)
240 of files, or a `std::vector<std::string>` object.
242 The `process` callable is executed with two arguments: the number of argument
243 in the loop, and the event itself. No information on which file the event is
244 taken from is provided. If a call returns exactly `False`, it is considered
245 to have failed and an error counter is incremented. Exceptions raised in
246 `process` are not handled.
248 The error counter is returned at the end of the execution.
251 - 'nEvents': number of events to be processed (does not include skipped ones)
252 - 'nSkip': number of events from the beginning of the sample to be skipped
256 nSkip = options.get(
'nSkip', 0)
257 nEvents = options.get(
'nEvents',
None)
260 if not isinstance(inputFiles, ROOT.vector(ROOT.string)):
261 if isinstance(inputFiles, str): inputFiles = [ inputFiles, ]
265 event = ROOT.gallery.Event(inputFiles)
276 if iFile != event.fileEntry():
277 iFile = event.fileEntry()
278 print(
"Opening: '%s'" % inputFiles[iFile])
282 if iEvent < nSkip:
continue
283 if (nEvents
is not None)
and (nProcessedEvents >= nEvents):
break
284 nProcessedEvents += 1
289 res = process(event, iEvent)
290 if isinstance(res, bool)
and not res: nErrors += 1
298 print(
"Encountered %d/%d errors." % (nErrors, nProcessedEvents),file=sys.stderr)
do one_file $F done echo for F in find $TOP name CMakeLists txt print
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.