test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
visualization-live_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':'HeavyIons'}
13 
14 if not runType.getRunTypeName() in scenarios.keys():
15  msg = "Error getting the scenario out of the 'runkey', no mapping for: %s\n"%runType.getRunTypeName()
16  raise RuntimeError, msg
17 
18 scenarioName = scenarios[runType.getRunTypeName()]
19 
20 print "Using scenario:",scenarioName
21 
22 
23 try:
24  scenario = getScenario(scenarioName)
25 except Exception, ex:
26  msg = "Error getting Scenario implementation for %s\n" % (
27  scenarioName,)
28  msg += str(ex)
29  raise RuntimeError, msg
30 
31 
32 kwds = {}
33 # example of how to add a filer IN FRONT of all the paths, eg for HLT selection
34 #kwds['preFilter'] = 'DQM/Integration/python/config/visualizationPreFilter.hltfilter'
35 
36 process = scenario.visualizationProcessing(globalTag='DUMMY', writeTiers=['FEVT'], **kwds)
37 
38 process.source = source
39 process.source.inputFileTransitionsEachEvent = cms.untracked.bool(True)
40 process.source.skipFirstLumis = cms.untracked.bool(True)
41 process.source.minEventsPerLumi = cms.untracked.int32(0)
42 process.source.nextLumiTimeoutMillis = cms.untracked.int32(10000)
43 process.source.streamLabel = cms.untracked.string('streamDQM')
44 
45 m = re.search(r"\((\w+)\)", str(source.runNumber))
46 runno = str(m.group(1))
47 outDir= '/fff/BU0/output/EvD/run'+runno+'/streamEvDOutput'
48 
49 #create output directory
50 try:
51  os.makedirs(outDir)
52 except:
53  pass
54 
55 process.load("DQM.Integration.config.FrontierCondition_GT_autoExpress_cfi")
56 
57 process.options = cms.untracked.PSet(
58  Rethrow = cms.untracked.vstring('ProductNotFound'),
59  wantSummary = cms.untracked.bool(True)
60  )
61 
62 process.maxEvents = cms.untracked.PSet(
63  input = cms.untracked.int32(-1)
64  )
65 oldo = process._Process__outputmodules["FEVToutput"]
66 del process._Process__outputmodules["FEVToutput"]
67 
68 process.FEVToutput = cms.OutputModule("JsonWritingTimeoutPoolOutputModule",
69  splitLevel = oldo.splitLevel,
70  eventAutoFlushCompressedSize = oldo.eventAutoFlushCompressedSize,
71  outputCommands = oldo.outputCommands,
72  fileName = oldo.fileName,
73  dataset = oldo.dataset,
74  runNumber = cms.untracked.uint32(int(runno)),
75  streamLabel = cms.untracked.string("streamEvDOutput_dqmcluster"),
76  # output path must exist!
77  outputPath = cms.untracked.string(outDir),
78 )
79 
80 process.DQMMonitoringService = cms.Service("DQMMonitoringService")
81 
82 dump = False
83 if dump:
84  psetFile = open("RunVisualizationProcessingCfg.py", "w")
85  psetFile.write(process.dumpPython())
86  psetFile.close()
87  cmsRun = "cmsRun -e RunVisualizationProcessingCfg.py"
88  print "Now do:\n%s" % cmsRun
def getScenario
Definition: GetScenario.py:12