Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-10 01:50:19

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 # Define here the BeamSpotOnline record name,
0005 # it will be used both in FakeBeamMonitor setup and in payload creation/upload
0006 BSOnlineRecordName = 'BeamSpotOnlineHLTObjectsRcd'
0007 BSOnlineTag = 'BeamSpotOnlineFakeHLT'
0008 BSOnlineJobName = 'BeamSpotOnlineFakeHLT'
0009 BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection'
0010 useLockRecords = True
0011 
0012 import sys
0013 from Configuration.Eras.Era_Run3_cff import Run3
0014 process = cms.Process("FakeBeamMonitor", Run3)
0015 
0016 # switch
0017 live = True # FIXME
0018 unitTest = False
0019 
0020 if 'unitTest=True' in sys.argv:
0021   live=False
0022   unitTest=True
0023   useLockRecords = False
0024 
0025 # Common part for PP and H.I Running
0026 #-----------------------------
0027 if unitTest:
0028   process.load("DQM.Integration.config.unittestinputsource_cfi")
0029   from DQM.Integration.config.unittestinputsource_cfi import options
0030 elif live:
0031   process.load("DQM.Integration.config.inputsource_cfi")
0032   from DQM.Integration.config.inputsource_cfi import options
0033 else:
0034   process.load("DQM.Integration.config.fileinputsource_cfi")
0035   from DQM.Integration.config.fileinputsource_cfi import options
0036 
0037 # new stream label
0038 #process.source.streamLabel = cms.untracked.string('streamDQMOnlineBeamspot')
0039 
0040 # for testing in lxplus
0041 #process.load("DQM.Integration.config.fileinputsource_cfi")
0042 #from DQM.Integration.config.fileinputsource_cfi import options
0043 
0044 #--------------------------
0045 # HLT Filter
0046 # 0=random, 1=physics, 2=calibration, 3=technical
0047 #--------------------------
0048 process.hltTriggerTypeFilter = cms.EDFilter("HLTTriggerTypeFilter",
0049     SelectedTriggerType = cms.int32(1)
0050 )
0051 
0052 #-----------------------------
0053 # DQM Live Environment
0054 #-----------------------------
0055 process.load("DQM.Integration.config.environment_cfi")
0056 process.dqmEnv.subSystemFolder = 'FakeBeamMonitorHLT'
0057 process.dqmSaver.tag           = 'FakeBeamMonitorHLT'
0058 process.dqmSaver.runNumber     = options.runNumber
0059 process.dqmSaverPB.tag         = 'FakeBeamMonitorHLT'
0060 process.dqmSaverPB.runNumber   = options.runNumber
0061 
0062 # Configure tag and jobName if running Playback system
0063 if process.isDqmPlayback.value :
0064   BSOnlineTag = BSOnlineTag + 'Playback'
0065   BSOnlineJobName = BSOnlineJobName + 'Playback'
0066   BSOnlineOmsServiceUrl = ''
0067   useLockRecords = False
0068 
0069 #---------------
0070 """
0071 # Conditions
0072 if (live):
0073   process.load("DQM.Integration.config.FrontierCondition_GT_cfi")
0074 else:
0075   process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0076   from Configuration.AlCa.GlobalTag import GlobalTag as gtCustomise
0077   process.GlobalTag = gtCustomise(process.GlobalTag, 'auto:run2_data', '')
0078   # you may need to set manually the GT in the line below
0079   #process.GlobalTag.globaltag = '100X_upgrade2018_realistic_v10'
0080 """
0081 #-----------------------------
0082 # BeamMonitor
0083 #-----------------------------
0084 process.load("DQM.BeamMonitor.FakeBeamMonitor_cff")
0085 process.dqmBeamMonitor = process.dqmFakeBeamMonitor.clone(
0086   monitorName = 'FakeBeamMonitor',
0087   OnlineMode = True,
0088   recordName = BSOnlineRecordName,
0089   useLockRecords = useLockRecords,
0090   resetEveryNLumi   = 5,
0091   resetPVEveryNLumi = 5
0092 )  
0093 
0094 #---------------
0095 # Calibration
0096 #---------------
0097 # Condition for P5 cluster
0098 #process.load("DQM.Integration.config.FrontierCondition_GT_cfi")
0099 process.dqmcommon = cms.Sequence(process.dqmEnv
0100                                * process.dqmSaver * process.dqmSaverPB)
0101 
0102 process.monitor = cms.Sequence(process.dqmBeamMonitor)
0103 
0104 #-----------------------------------------------------------
0105 # process customizations included here
0106 from DQM.Integration.config.online_customizations_cfi import *
0107 process = customise(process)
0108 
0109 # Set rawDataRepacker (HI and live) or rawDataCollector (for all the rest)
0110 if (process.runType.getRunType() == process.runType.hi_run and live):
0111   rawDataInputTag = "rawDataRepacker"
0112 else:
0113   rawDataInputTag = "rawDataCollector"
0114 
0115 #---------
0116 # Upload BeamSpotOnlineObject (HLTRcd) to CondDB
0117 if unitTest == False:
0118   process.OnlineDBOutputService = cms.Service("OnlineDBOutputService",
0119 
0120       DBParameters = cms.PSet(
0121                               messageLevel = cms.untracked.int32(0),
0122                               authenticationPath = cms.untracked.string('.')
0123                               ),
0124 
0125       # Upload to CondDB
0126       connect = cms.string('oracle://cms_orcon_prod/CMS_CONDITIONS'),
0127       preLoadConnectionString = cms.untracked.string('frontier://FrontierProd/CMS_CONDITIONS'),
0128       runNumber = cms.untracked.uint64(options.runNumber),
0129       omsServiceUrl = cms.untracked.string(BSOnlineOmsServiceUrl),
0130       latency = cms.untracked.uint32(2),
0131       autoCommit = cms.untracked.bool(True),
0132       saveLogsOnDB = cms.untracked.bool(True),
0133       jobName = cms.untracked.string(BSOnlineJobName), # name of the DB log record
0134       toPut = cms.VPSet(cms.PSet(
0135           record = cms.string(BSOnlineRecordName),
0136           tag = cms.string(BSOnlineTag),
0137           timetype = cms.untracked.string('Lumi'),
0138           onlyAppendUpdatePolicy = cms.untracked.bool(True)
0139       )),
0140       frontierKey = cms.untracked.string(options.runUniqueKey)
0141   )
0142 
0143 else:
0144   process.OnlineDBOutputService = cms.Service("OnlineDBOutputService",
0145     DBParameters = cms.PSet(
0146                             messageLevel = cms.untracked.int32(0),
0147                             authenticationPath = cms.untracked.string('.')
0148                             ),
0149 
0150     # Upload to CondDB
0151     connect = cms.string('sqlite_file:BeamSpotOnlineFakeHLT.db'),
0152     preLoadConnectionString = cms.untracked.string('sqlite_file:BeamSpotOnlineFakeHLT.db'),
0153 
0154     runNumber = cms.untracked.uint64(options.runNumber),
0155     lastLumiFile = cms.untracked.string('last_lumi.txt'),
0156     latency = cms.untracked.uint32(2),
0157     autoCommit = cms.untracked.bool(True),
0158     toPut = cms.VPSet(cms.PSet(
0159         record = cms.string(BSOnlineRecordName),
0160         tag = cms.string(BSOnlineTag),
0161         timetype = cms.untracked.string('Lumi'),
0162         onlyAppendUpdatePolicy = cms.untracked.bool(True)
0163     )),
0164     frontierKey = cms.untracked.string(options.runUniqueKey)
0165 )
0166 print("Configured frontierKey", options.runUniqueKey)
0167 
0168 #---------
0169 # Final path
0170 print("Final Source settings:", process.source)
0171 
0172 process.p = cms.Path(process.dqmcommon
0173                     * process.monitor )
0174