CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/Configuration/DataProcessing/python/Merge.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 """
00003 _Merge_
00004 
00005 Module that generates standard merge job configurations for use in any
00006 standard processing
00007 
00008 """
00009 
00010 
00011 from FWCore.ParameterSet.Config import Process, EndPath
00012 from FWCore.ParameterSet.Modules import OutputModule, Source, Service
00013 import FWCore.ParameterSet.Types as CfgTypes
00014 
00015 
00016 def mergeProcess(*inputFiles, **options):
00017     """
00018     _mergeProcess_
00019 
00020     Creates and returns a merge process that will merge the provided
00021     filenames
00022 
00023     supported options:
00024 
00025     - process_name : name of the process, defaults to Merge
00026     - outputmod_label : label of the output module, defaults to Merged
00027     - newDQMIO : specifies if the new DQM format should be used to merge the files
00028     - output_file : sets the output file name
00029     - output_lfn : sets the output LFN
00030 
00031     """
00032     #  //
00033     # // process supported options
00034     #//
00035     processName = options.get("process_name", "Merge")
00036     outputModLabel = options.get("outputmod_label", "Merged")
00037     outputFilename = options.get("output_file", "Merged.root")
00038     outputLFN = options.get("output_lfn", None)
00039     dropDQM = options.get("drop_dqm", False)
00040     newDQMIO = options.get("newDQMIO", False)
00041     
00042     #  //
00043     # // build process
00044     #//
00045     process = Process(processName)
00046 
00047     #  //
00048     # // input source
00049     #//
00050     if newDQMIO:
00051         process.source = Source("DQMRootSource")
00052         process.add_(Service("DQMStore"))
00053     else:
00054         process.source = Source("PoolSource")
00055         if dropDQM:
00056             process.source.inputCommands = CfgTypes.untracked.vstring('keep *','drop *_EDMtoMEConverter_*_*')
00057     process.source.fileNames = CfgTypes.untracked(CfgTypes.vstring())
00058     for entry in inputFiles:
00059         process.source.fileNames.append(str(entry))
00060  
00061     #  //
00062     # // output module
00063     #//
00064     if newDQMIO:
00065         outMod = OutputModule("DQMRootOutputModule")
00066     else:
00067         outMod = OutputModule("PoolOutputModule")
00068     outMod.fileName = CfgTypes.untracked.string(outputFilename)
00069     if outputLFN != None:
00070         outMod.logicalFileName = CfgTypes.untracked.string(outputLFN)
00071     setattr(process, outputModLabel, outMod)
00072 
00073     process.outputPath = EndPath(outMod)
00074 
00075     return process