Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:50

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 parser = VarParsing.VarParsing('python')
0005 one = VarParsing.VarParsing.multiplicity.singleton
0006 bool = VarParsing.VarParsing.varType.bool
0007 string = VarParsing.VarParsing.varType.string
0008 parser.register('nolegacy',             False, one, bool, "Don't run legacy harvesters")
0009 parser.register('nomodules',            False, one, bool, "Don't run any harvesters")
0010 parser.register('legacyoutput',         False, one, bool, "Use DQMFileSaver for output instead of DQMIO.")
0011 parser.register('protobufinput',        False, one, bool, "Use DQMProtobufReader for input instead of DQMIO.")
0012 parser.register('metoedminput',         False, one, bool, "Use PoolInputSource and EDMtoMEConverter for input.")
0013 parser.register('outfile',              "dqm.root", one, string, "Output file name.")
0014 parser.register('reScope',              "",         one, string, "Type of reScoping to use.")
0015 parser.parseArguments()
0016 args = parser
0017 
0018 process = cms.Process("HARVESTING")
0019 process.add_(cms.Service("DQMStore"))
0020 process.load("DQMServices.Demo.testharvester_cfi")
0021 process.load("DQMServices.Demo.testlegacyharvester_cfi")
0022 
0023 print(args.inputFiles)
0024 
0025 if args.protobufinput:
0026   infile = args.inputFiles[0]
0027   runnr = int(infile[-6:])
0028   indir = "/".join(infile.split("/")[:-1])
0029   process.source = cms.Source("DQMProtobufReader",
0030     runNumber = cms.untracked.uint32(runnr),
0031     runInputDir = cms.untracked.string(indir),
0032     streamLabel = cms.untracked.string("streamDQMHistograms"),
0033     scanOnce = cms.untracked.bool(True),
0034     datafnPosition = cms.untracked.uint32(4),
0035     delayMillis = cms.untracked.uint32(500),
0036     nextLumiTimeoutMillis = cms.untracked.int32(-1),
0037     skipFirstLumis = cms.untracked.bool(False),
0038     deleteDatFiles = cms.untracked.bool(False),
0039     endOfRunKills  = cms.untracked.bool(False),
0040   )
0041 
0042 elif args.metoedminput:
0043   process.EDMtoMEConverter = cms.EDProducer("EDMtoMEConverter",
0044     Name = cms.untracked.string('EDMtoMEConverter'),
0045     Verbosity = cms.untracked.int32(0), 
0046     Frequency = cms.untracked.int32(50),
0047     convertOnEndLumi = cms.untracked.bool(True),
0048     convertOnEndRun = cms.untracked.bool(True),
0049     runInputTag = cms.InputTag('MEtoEDMConverter', 'MEtoEDMConverterRun'),
0050     lumiInputTag = cms.InputTag('MEtoEDMConverter', 'MEtoEDMConverterLumi')
0051   )
0052   process.convert = cms.Path(process.EDMtoMEConverter)
0053   process.source = cms.Source("PoolSource",
0054                               fileNames = cms.untracked.vstring(*["file://" + f for f in args.inputFiles]))
0055 
0056 else:
0057   process.source = cms.Source("DQMRootSource",
0058                               fileNames = cms.untracked.vstring(*["file://" + f for f in args.inputFiles]),
0059                               reScope = cms.untracked.string(args.reScope))
0060 
0061 
0062 process.harvest = cms.Sequence(process.testharvester)
0063 process.harvestlegacy = cms.Sequence(process.testlegacyharvester)
0064 
0065 if args.nomodules:
0066   pass
0067 elif args.nolegacy:
0068   process.p = cms.Path(process.harvest)
0069 else:
0070   process.p = cms.Path(process.harvest + process.harvestlegacy)
0071 
0072 # legacy output
0073 process.dqmSaver = cms.EDAnalyzer("DQMFileSaver",
0074   convention = cms.untracked.string('Offline'),
0075   fileFormat = cms.untracked.string('ROOT'),
0076   producer = cms.untracked.string('DQM'),
0077   workflow = cms.untracked.string('/Harvesting/DQMTests/DQMIO'),
0078   dirName = cms.untracked.string('.'),
0079   saveByRun = cms.untracked.int32(-1),
0080   saveAtJobEnd = cms.untracked.bool(True),
0081 )
0082 
0083 # dqmio ouptut
0084 process.out = cms.OutputModule("DQMRootOutputModule",
0085                                fileName = cms.untracked.string(args.outfile))
0086 if args.legacyoutput:
0087   process.e = cms.EndPath(process.dqmSaver)
0088 else:
0089   process.e = cms.EndPath(process.out)
0090 
0091 # useful for debugging
0092 #process.DQMStore.trackME = cms.untracked.string("testlegacyfillrun")
0093 #process.Tracer = cms.Service("Tracer")