HPS-MC
 
Loading...
Searching...
No Matches
_hadd.py
Go to the documentation of this file.
1"""! running hadd from in hps-mc jobs"""
2
3import shutil
4import re
5import os
6import logging
7
8from hpsmc.component import Component
9
10
12 """! Run ROOT's histogram/TTree merger
13
14 Required:
15 - **inputs**: input ROOT files to merge
16 - **outputs**: *single* output file to merge into
17 Optional:
18 - **ncores**: number of cores to supply to hadd (default 1)
19 """
20
21 logger = logging.getLogger('hpsmc.tools.hadd')
22
23 def __init__(self, **kwargs):
25 self.ncores = None
26 super().__init__('hadd', command='hadd', **kwargs)
27
29 return ['ncores']
30
31 def cmd_args(self):
32 a = []
33 if self.ncores is not None:
34 a += ['-j', self.ncores]
35 if len(self.outputsoutputs) != 1:
36 raise ValueError('hadd makes no sense without exactly one output')
37 a += self.outputsoutputs
38 if self.inputsinputs is None or len(self.inputsinputs) == 0:
39 raise ValueError('hadd makes no sense without at least one input')
40 a += self.inputsinputs
41 return a
Run ROOT's histogram/TTree merger.
Definition _hadd.py:11
__init__(self, **kwargs)
Definition _hadd.py:23
optional_parameters(self)
Return a list of optional parameters.
Definition _hadd.py:28
cmd_args(self)
Return the command arguments of this component.
Definition _hadd.py:31
Base class for components in a job.
Definition component.py:15