test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
visualization-live-secondInstance_cfg.py
Go to the documentation of this file.
1 import re,os
2 import FWCore.ParameterSet.Config as cms
3 from Configuration.DataProcessing.GetScenario import getScenario
4 
5 """
6 Example configuration for online reconstruction meant for visualization clients.
7 """
8 from DQM.Integration.config.inputsource_cfi import options,runType,source
9 
10 # this is needed to map the names of the run-types chosen by DQM to the scenarios, ideally we could converge to the same names
11 #scenarios = {'pp_run': 'ppRun2','cosmic_run':'cosmicsRun2','hi_run':'HeavyIons'}
12 #scenarios = {'pp_run': 'ppRun2','pp_run_stage1': 'ppRun2','cosmic_run':'cosmicsRun2','cosmic_run_stage1':'cosmicsRun2','hi_run':'HeavyIonsRun2'}
13 scenarios = {'pp_run': 'ppEra_Run2_2016','cosmic_run':'cosmicsRun2','hi_run':'HeavyIonsRun2'}
14 
15 if not runType.getRunTypeName() in scenarios.keys():
16  msg = "Error getting the scenario out of the 'runkey', no mapping for: %s\n"%runType.getRunTypeName()
17  raise RuntimeError(msg)
18 
19 scenarioName = scenarios[runType.getRunTypeName()]
20 
21 print "Using scenario:",scenarioName
22 
23 
24 try:
25  scenario = getScenario(scenarioName)
26 except Exception as ex:
27  msg = "Error getting Scenario implementation for %s\n" % (
28  scenarioName,)
29  msg += str(ex)
30  raise RuntimeError(msg)
31 
32 
33 kwds = {}
34 # example of how to add a filer IN FRONT of all the paths, eg for HLT selection
35 #kwds['preFilter'] = 'DQM/Integration/python/config/visualizationPreFilter.hltfilter'
36 
37 process = scenario.visualizationProcessing(globalTag='DUMMY', writeTiers=['FEVT'], **kwds)
38 
39 process.source = source
40 process.source.inputFileTransitionsEachEvent = cms.untracked.bool(True)
41 process.source.skipFirstLumis = cms.untracked.bool(True)
42 process.source.minEventsPerLumi = cms.untracked.int32(0)
43 process.source.nextLumiTimeoutMillis = cms.untracked.int32(10000)
44 process.source.streamLabel = cms.untracked.string('streamDQMEventDisplay')
45 
46 m = re.search(r"\((\w+)\)", str(source.runNumber))
47 runno = str(m.group(1))
48 outDir= '/fff/BU0/output/EvD/run'+runno+'/streamEvDOutput2'
49 
50 #create output directory
51 try:
52  os.makedirs(outDir)
53 except:
54  pass
55 
56 process.load("DQM.Integration.config.FrontierCondition_GT_autoExpress_cfi")
57 
58 process.options = cms.untracked.PSet(
59  Rethrow = cms.untracked.vstring('ProductNotFound'),
60  wantSummary = cms.untracked.bool(True),
61  numberOfThreads = cms.untracked.uint32(8),
62  numberOfStreams = cms.untracked.uint32(8)
63  )
64 
65 process.maxEvents = cms.untracked.PSet(
66  input = cms.untracked.int32(-1)
67  )
68 oldo = process._Process__outputmodules["FEVToutput"]
69 del process._Process__outputmodules["FEVToutput"]
70 
71 process.FEVToutput = cms.OutputModule("JsonWritingTimeoutPoolOutputModule",
72  splitLevel = oldo.splitLevel,
73  eventAutoFlushCompressedSize = oldo.eventAutoFlushCompressedSize,
74  outputCommands = oldo.outputCommands,
75  fileName = oldo.fileName,
76  dataset = oldo.dataset,
77  runNumber = cms.untracked.uint32(int(runno)),
78  streamLabel = cms.untracked.string("streamEvDOutput2_dqmcluster"),
79  # output path must exist!
80  outputPath = cms.untracked.string(outDir),
81 )
82 
83 process.DQMMonitoringService = cms.Service("DQMMonitoringService")
84 
85 dump = False
86 if dump:
87  psetFile = open("RunVisualizationProcessingCfg.py", "w")
88  psetFile.write(process.dumpPython())
89  psetFile.close()
90  cmsRun = "cmsRun -e RunVisualizationProcessingCfg.py"
91  print "Now do:\n%s" % cmsRun
def getScenario
Definition: GetScenario.py:12