def _analysis(name, verbose, **kwargs): a = root.Analysis(name) for k,v in kwargs.iteritems(): if not hasattr(a, k): PError('PandaAnalysis.Flat.analysis','Could not set property %s'%k) return None setattr(a, k, bool(v)) setattr(a, 'dump', lambda : _dump(a)) if verbose: a.dump() return a
def run(self, f_out): PInfo('fitting_forest.Process.run', 'Running ' + self.name) branches = sorted(self.all_branches.values()) try: xarr = root_interface.read_tree(tree=self.tree, branches=branches, cut=self.cut) fields = self.variables.keys() + ['nominal'] self.__write_out(f_out, xarr, fields, '') for shift, weight in self.weights.iteritems(): fields = self.variables.keys() + [shift] self.__write_out(f_out, xarr, fields, '_' + shift) except ValueError as e: PError('fitting_forest.Process.run', str(e)) return
from PandaCore.Tools.Misc import PInfo, PError, PWarning ### Global definitions ### # environment: logdir = getenv('SUBMIT_LOGDIR') workdir = getenv('SUBMIT_WORKDIR') lockdir = getenv('SUBMIT_LOCKDIR') outdir = getenv('SUBMIT_OUTDIR') submit_name = getenv('SUBMIT_NAME') cmssw_base = getenv('CMSSW_BASE') incfg = workdir + '/local_all.cfg' outcfg = workdir + '/local.cfg' if any([x is None for x in [lockdir, workdir, logdir, cmssw_base]]): PError('task.py', 'Your environment is incomplete!') # argument parsing: parser = argparse.ArgumentParser(description='task') parser.add_argument('--kill', action='store_true') parser.add_argument('--check', action='store_true') parser.add_argument('--submit', action='store_true') parser.add_argument('--build_only', action='store_true') parser.add_argument('--submit_only', action='store_true') parser.add_argument('--clean_output', action='store_true') parser.add_argument('--clean', action='store_true') parser.add_argument('--lockdir', type=str, default=lockdir) parser.add_argument('--force', action='store_true') parser.add_argument('--nfiles', type=int, default=-1) parser.add_argument('--silent', action='store_true') parser.add_argument('--monitor', type=int, default=None)