CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Merge.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 """
3 _Merge_
4 
5 Module that generates standard merge job configurations for use in any
6 standard processing
7 
8 """
9 
10 
11 from FWCore.ParameterSet.Config import Process, EndPath
12 from FWCore.ParameterSet.Modules import OutputModule, Source
13 import FWCore.ParameterSet.Types as CfgTypes
14 
15 
16 def mergeProcess(*inputFiles, **options):
17  """
18  _mergeProcess_
19 
20  Creates and returns a merge process that will merge the provided
21  filenames
22 
23  supported options:
24 
25  - process_name : name of the procee, defaults to Merge
26  - output_file : sets the output file name
27  - output_lfn : sets the output LFN
28 
29  """
30  # //
31  # // process supported options
32  #//
33  processName = options.get("process_name", "Merge")
34  outputFilename = options.get("output_file", "Merged.root")
35  outputLFN = options.get("output_lfn", None)
36 
37  # //
38  # // build process
39  #//
40  process = Process(processName)
41 
42  # //
43  # // input source
44  #//
45  process.source = Source("PoolSource")
46  process.source.fileNames = CfgTypes.untracked(CfgTypes.vstring())
47  for entry in inputFiles:
48  process.source.fileNames.append(str(entry))
49 
50  # //
51  # // output module
52  #//
53  process.Merged = OutputModule("PoolOutputModule")
54  process.Merged.fileName = CfgTypes.untracked(CfgTypes.string(
55  outputFilename))
56 
57  if outputLFN != None:
58  process.Merged.logicalFileName = CfgTypes.untracked(CfgTypes.string(
59  outputLFN))
60 
61 
62  process.outputPath = EndPath(process.Merged)
63  return process
def mergeProcess
Definition: Merge.py:16