Executor for skimming RAW events according to a list of run and event numbers.
More...
Executor for skimming RAW events according to a list of run and event numbers.
Definition at line 19 of file recoTransforms.py.
◆ preExecute()
def python.recoTransforms.skimRawExecutor.preExecute |
( |
|
self, |
|
|
|
input = set() , |
|
|
|
output = set() |
|
) |
| |
Definition at line 21 of file recoTransforms.py.
21 def preExecute(self, input = set(), output =
set()):
26 listEvtCommand = [
'AtlListBSEvents',
'-l']
27 listEvtCommand.extend(self.conf.argdict[
'inputBSFile'].value)
31 longlist = subprocess.check_output(listEvtCommand).
decode(
'utf-8')
33 for line
in longlist.split(
"\n"):
34 if line.startswith(
"Index="):
36 splitStrings = line.split(
" ")
37 runprefix, runstr = splitStrings[1].
split(
"=")
38 evtprefix, evtstr = splitStrings[2].
split(
"=")
40 if runprefix !=
"Run" or evtprefix !=
"Event":
41 msg.warning(
"Failed to understand this line from AtlListBSEvents (1): %s", line)
43 runnumber =
int(runstr)
44 evtnumber =
int(evtstr)
47 rawEventList[runstr +
"-" + evtstr] =
True
48 msg.debug(
"Identified run %s, event %s in input RAW files", runstr, evtstr)
50 msg.warning(
"Failed to understand this line from AtlListBSEvents (2): %s", line)
51 except subprocess.CalledProcessError
as e:
52 errMsg =
"Call to AtlListBSEvents failed: {0}".
format(e)
54 raise trfExceptions.TransformExecutionException(trfExit.nameToCode(
"TRF_EXEC_SETUP_FAIL"), errMsg)
55 msg.info(
"Found %d events as skim candidates in RAW inputs", len(rawEventList))
58 slimmedFilterFile =
"slimmedFilterFile.{0}".
format(os.getpid())
59 with open(slimmedFilterFile,
"w")
as slimFF,
open(self.conf.argdict[
'filterFile'].value)
as masterFF:
64 if runstr +
"-" + evtstr
in rawEventList:
65 msg.debug(
"Found run %s, event %s in master filter list", runstr, evtstr)
66 os.write(slimFF.fileno(), line.encode(
'utf-8'))
68 except ValueError
as e:
69 msg.warning(
"Failed to understand this line from master filter file: %s %s", line, e)
73 msg.info(
"No events matched in this input file - empty RAW file output will be made")
74 os.write(slimFF.fileno(), b
"0 0\n")
75 msg.info(
"Matched %d lines from the master filter file against input events; wrote these to %s", count, slimmedFilterFile)
80 for line
in open(slimmedFilterFile):
81 events +=
'%s,' % line.split()[-1]
84 self._cmd = [
'AtlCopyBSEvent']
86 self._cmd.
extend((
'-e', events))
87 self._cmd.
extend((
'-o', self.conf.argdict[
'outputBS_SKIMFile'].value[0]))
88 self._cmd.
extend(self.conf.argdict[
'inputBSFile'].value)
90 super(skimRawExecutor, self).preExecute()
◆ _cmd
python.recoTransforms.skimRawExecutor._cmd |
|
private |
The documentation for this class was generated from the following file:
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.