CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_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 procee, defaults to Merge
00026     - newDQMIO     : specifies if the new DQM format should be used to merge the files
00027     - output_file  : sets the output file name
00028     - output_lfn   : sets the output LFN
00029 
00030     """
00031     #  //
00032     # // process supported options
00033     #//
00034     processName = options.get("process_name", "Merge")
00035     outputFilename = options.get("output_file", "Merged.root")
00036     outputLFN = options.get("output_lfn", None)
00037     dropDQM = options.get("drop_dqm", False)
00038     newDQMIO = options.get("newDQMIO", False)
00039     
00040     #  //
00041     # // build process
00042     #//
00043     process = Process(processName)
00044 
00045     #  //
00046     # // input source
00047     #//
00048     if newDQMIO:
00049         process.source = Source("DQMRootSource")
00050         process.Merged = OutputModule("DQMRootOutputModule")
00051         process.add_(Service("DQMStore"))
00052     else:
00053         process.source = Source("PoolSource")
00054         process.Merged = OutputModule("PoolOutputModule")
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     process.Merged.fileName = CfgTypes.untracked(CfgTypes.string(
00065         outputFilename))
00066 
00067     if outputLFN != None:
00068         process.Merged.logicalFileName = CfgTypes.untracked(CfgTypes.string(
00069             outputLFN))
00070 
00071 
00072     process.outputPath = EndPath(process.Merged)
00073     return process