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, Service
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 process, defaults to Merge
26  - outputmod_label : label of the output module, defaults to Merged
27  - newDQMIO : specifies if the new DQM format should be used to merge the files
28  - output_file : sets the output file name
29  - output_lfn : sets the output LFN
30  - bypassVersionCheck : to bypass version check in case merging happened in lower version of CMSSW (i.e. UL HLT case). This will be TRUE by default.
31 
32  """
33  # //
34  # // process supported options
35  #//
36  processName = options.get("process_name", "Merge")
37  outputModLabel = options.get("outputmod_label", "Merged")
38  outputFilename = options.get("output_file", "Merged.root")
39  outputLFN = options.get("output_lfn", None)
40  dropDQM = options.get("drop_dqm", False)
41  newDQMIO = options.get("newDQMIO", False)
42  bypassVersionCheck = options.get("bypassVersionCheck", True)
43 
44  # //
45  # // build process
46  #//
47  process = Process(processName)
48 
49  # //
50  # // input source
51  #//
52  if newDQMIO:
53  process.source = Source("DQMRootSource")
54  process.add_(Service("DQMStore"))
55  else:
56  process.source = Source("PoolSource")
57  process.source.bypassVersionCheck = CfgTypes.untracked.bool(bypassVersionCheck)
58  if dropDQM:
59  process.source.inputCommands = CfgTypes.untracked.vstring('keep *','drop *_EDMtoMEConverter_*_*')
60  process.source.fileNames = CfgTypes.untracked(CfgTypes.vstring())
61  for entry in inputFiles:
62  process.source.fileNames.append(str(entry))
63 
64  # //
65  # // output module
66  #//
67  if newDQMIO:
68  outMod = OutputModule("DQMRootOutputModule")
69  else:
70  outMod = OutputModule("PoolOutputModule")
71 
72  outMod.fileName = CfgTypes.untracked.string(outputFilename)
73  if outputLFN != None:
74  outMod.logicalFileName = CfgTypes.untracked.string(outputLFN)
75  setattr(process, outputModLabel, outMod)
76 
77  process.outputPath = EndPath(outMod)
78 
79  return process
def mergeProcess
Definition: Merge.py:16