Skip to content

Commit

Permalink
hltGetConfiguration: add an option to specify the parent input files …
Browse files Browse the repository at this point in the history
…or dataset
  • Loading branch information
fwyzard committed Dec 3, 2014
1 parent 870e323 commit b896c99
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
26 changes: 17 additions & 9 deletions HLTrigger/Configuration/python/Tools/confdb.py
Expand Up @@ -1245,18 +1245,22 @@ def append_filenames(self, name, filenames):
self.data += " %s,\n" % (token_close)


def expand_filenames(self, input):
# check if the input is a dataset or a list of files
if input[0:8] == 'dataset:':
from dasFileQuery import dasFileQuery
# extract the dataset name, and use DAS to fine the list of LFNs
dataset = input[8:]
files = dasFileQuery(dataset)
else:
# assume a comma-separated list of input files
files = self.config.input.split(',')
return files

def build_source(self):
if self.config.input:
# if a dataset or a list of input files was given, use it
if self.config.input[0:8] == 'dataset:':
from dasFileQuery import dasFileQuery
# extract the dataset name, and use DAS to fine the list of LFNs
dataset = self.config.input[8:]
files = dasFileQuery(dataset)
self.source = files
else:
# assume a list of input files
self.source = self.config.input.split(',')
self.source = self.expand_filenames(self.config.input)
elif self.config.online:
# online we always run on data
self.source = [ "file:/tmp/InputCollection.root" ]
Expand All @@ -1267,6 +1271,10 @@ def build_source(self):
# ...or on mc
self.source = [ "file:RelVal_Raw_%s_MC.root" % self.config.type ]

if self.config.parent:
# if a dataset or a list of input files was given for the parent data, use it
self.parent = self.expand_filenames(self.config.parent)

self.data += """
%(process)ssource = cms.Source( "PoolSource",
"""
Expand Down
3 changes: 2 additions & 1 deletion HLTrigger/Configuration/python/Tools/options.py
Expand Up @@ -85,7 +85,8 @@ def __init__(self):
self.profiling = False # if set, instrument the menu for profiling measurements
self.timing = False # if set, instrument the menu for timing measurements (implies profiling)
self.paths = None # if set, include in the dump only the given paths (wildcards are supported)
self.input = None # (*) if set, run on a specific input file
self.input = None # (*) if set, specify the input file(s) or dataset
self.parent = None # (*) if set, specify the parent input file(s) or dataset
self.events = 100 # (*) run on these many events
self.output = 'all' # (*) output 'all', 'minimal' or 'none' output modules
self.fragment = False # prepare a configuration fragment (true) or a whole process (false)
Expand Down
9 changes: 8 additions & 1 deletion HLTrigger/Configuration/scripts/hltGetConfiguration
Expand Up @@ -131,7 +131,14 @@ parser.add_argument('--input',
type = str,
default = defaults.input,
metavar = 'SOURCE',
help = 'If specified, run over the specified SOURCE file. Otherwise a default is chosen up depending on the other options' )
help = 'If set, specify the SOURCE input file(s) or dataset, otherwise a default is chosen up depending on the other options.\nSOURCE can be a single file nane, a comma-separated list of file names, or have the format "dataset:DATASET" to query a DATASET definition from DAS' )
parser.add_argument('--parent',
dest = 'parent',
action = 'store',
type = str,
default = defaults.parent,
metavar = 'PARENT',
help = 'If set, specify the PARENT input file(s) or dataset, using the same syntax as SOURCE, above' )
parser.add_argument('--max-events',
dest = 'events',
action = 'store',
Expand Down

0 comments on commit b896c99

Please sign in to comment.