def main(): """Main function""" args = parse_args() logger.info('Loading RootCore libraries') load_rc_libs(batch=True) sh = scan_samples(args.scanDir, args.samplePattern) if args.splitEvents is not None: sh = split_samples(sh, args.splitEvents) print_samples(sh) # Write out result sh.save(args.output)
def load_samples(args): """ Build a SampleHandler. Not all these options are compatible with each other. It might thus be better to split this up somehow. """ from ROOT import SH if args.sampleHandler: sh = SH.SampleHandler() sh.load(args.sampleHandler) else: sh = scan_samples(args.scanDir, args.samplePattern) # Split samples by file if requested if args.splitSamples: sh = split_samples(sh, 1) # Choose samples according to task ID if args.task: task, numTasks = map(int, args.task.split(':')) sh = select_by_task(sh, task, numTasks) if args.eventsPerWorker: from ROOT import EL SH.scanNEvents(sh) sh.setMetaDouble(EL.Job.optEventsPerWorker, args.eventsPerWorker) return sh