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 import time 
0004 
0005 # Define here the BeamSpotOnline record name,
0006 # it will be used both in FakeBeamMonitor setup and in payload creation/upload
0007 BSOnlineRecordName = 'BeamSpotOnlineLegacyObjectsRcd'
0008 BSOnlineTag = 'BeamSpotOnlineFakeLegacy'
0009 BSOnlineJobName = 'BeamSpotOnlineFakeLegacy'
0010 BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection'
0011 useLockRecords = True
0012 import sys
0013 from Configuration.Eras.Era_Run3_cff import Run3
0014 process = cms.Process("FakeBeamMonitor", Run3)
0015 
0016 process.MessageLogger = cms.Service("MessageLogger",
0017     debugModules = cms.untracked.vstring('*'),
0018     cerr = cms.untracked.PSet(
0019         threshold = cms.untracked.string('WARNING')
0020     ),
0021     destinations = cms.untracked.vstring('cerr')
0022 )
0023 
0024 # switch
0025 live = True # FIXME
0026 unitTest = False
0027 
0028 if 'unitTest=True' in sys.argv:
0029     live=False
0030     unitTest=True
0031     useLockRecords = False
0032 else:
0033     time.sleep(48.)
0034 
0035 
0036 #---------------
0037 # Input sources
0038 if unitTest:
0039     process.load("DQM.Integration.config.unittestinputsource_cfi")
0040     from DQM.Integration.config.unittestinputsource_cfi import options
0041 elif live:
0042     process.load("DQM.Integration.config.inputsource_cfi")
0043     from DQM.Integration.config.inputsource_cfi import options
0044 else:
0045     process.load("DQM.Integration.config.fileinputsource_cfi")
0046     from DQM.Integration.config.fileinputsource_cfi import options
0047 
0048 #--------------------------
0049 # HLT Filter
0050 process.hltTriggerTypeFilter = cms.EDFilter("HLTTriggerTypeFilter",
0051     SelectedTriggerType = cms.int32(1) # physics
0052 )
0053 
0054 #----------------------------
0055 # DQM Live Environment
0056 process.load("DQM.Integration.config.environment_cfi")
0057 process.dqmEnv.subSystemFolder = 'FakeBeamMonitorLegacy'
0058 process.dqmSaver.tag           = 'FakeBeamMonitorLegacy'
0059 process.dqmSaver.runNumber     = options.runNumber
0060 process.dqmSaverPB.tag         = 'FakeBeamMonitorLegacy'
0061 process.dqmSaverPB.runNumber   = options.runNumber
0062 
0063 # Configure tag and jobName if running Playback system
0064 if process.isDqmPlayback.value :
0065     BSOnlineTag = BSOnlineTag + 'Playback'
0066     BSOnlineJobName = BSOnlineJobName + 'Playback'
0067     BSOnlineOmsServiceUrl = ''
0068     useLockRecords = False
0069 
0070 #---------------
0071 """
0072 # Conditions
0073 if (live):
0074     process.load("DQM.Integration.config.FrontierCondition_GT_cfi")
0075 else:
0076     process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0077     from Configuration.AlCa.GlobalTag import GlobalTag as gtCustomise
0078     process.GlobalTag = gtCustomise(process.GlobalTag, 'auto:run2_data', '')
0079     # you may need to set manually the GT in the line below
0080     #process.GlobalTag.globaltag = '100X_upgrade2018_realistic_v10'
0081 """
0082 #----------------------------
0083 # BeamMonitor
0084 process.load("DQM.BeamMonitor.FakeBeamMonitor_cff")
0085 
0086 
0087 
0088 #----------------
0089 # Setup tracking
0090 #process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
0091 #process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff')
0092 #process.load("Configuration.StandardSequences.RawToDigi_Data_cff")
0093 #process.load("RecoLocalTracker.Configuration.RecoLocalTracker_cff")
0094 #process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi")
0095 
0096 #-----------------
0097 
0098 process.dqmcommon = cms.Sequence(process.dqmEnv
0099                                * process.dqmSaver * process.dqmSaverPB)
0100 
0101 #
0102 process.monitor = cms.Sequence(process.dqmFakeBeamMonitor
0103                              )
0104 
0105 #------------------------
0106 # Process customizations
0107 from DQM.Integration.config.online_customizations_cfi import *
0108 process = customise(process)
0109 
0110 #------------------------
0111 # Set rawDataRepacker (HI and live) or rawDataCollector (for all the rest)
0112 if (process.runType.getRunType() == process.runType.hi_run and live):
0113     rawDataInputTag = "rawDataRepacker"
0114 else:
0115     rawDataInputTag = "rawDataCollector"
0116 
0117 """ process.castorDigis.InputLabel           = rawDataInputTag
0118 process.csctfDigis.producer              = rawDataInputTag 
0119 process.dttfDigis.DTTF_FED_Source        = rawDataInputTag
0120 process.ecalDigis.cpu.InputLabel         = rawDataInputTag
0121 process.ecalPreshowerDigis.sourceTag     = rawDataInputTag
0122 process.gctDigis.inputLabel              = rawDataInputTag
0123 process.gtDigis.DaqGtInputTag            = rawDataInputTag
0124 process.hcalDigis.InputLabel             = rawDataInputTag
0125 process.muonCSCDigis.InputObjects        = rawDataInputTag
0126 process.muonDTDigis.inputLabel           = rawDataInputTag
0127 process.muonRPCDigis.InputLabel          = rawDataInputTag
0128 process.scalersRawToDigi.scalersInputTag = rawDataInputTag
0129 process.siPixelDigis.InputLabel          = rawDataInputTag
0130 process.siStripDigis.ProductLabel        = rawDataInputTag
0131  """
0132 process.dqmFakeBeamMonitor.OnlineMode = True
0133 process.dqmFakeBeamMonitor.recordName = BSOnlineRecordName
0134 
0135 process.dqmFakeBeamMonitor.resetEveryNLumi   = 5 # was 10 for HI
0136 process.dqmFakeBeamMonitor.resetPVEveryNLumi = 5 # was 10 for HI
0137 process.dqmFakeBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords)
0138 
0139 
0140 #---------
0141 # Upload BeamSpotOnlineObject (LegacyRcd) to CondDB
0142 if unitTest == False:
0143     process.OnlineDBOutputService = cms.Service("OnlineDBOutputService",
0144 
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('oracle://cms_orcon_prod/CMS_CONDITIONS'),
0152         preLoadConnectionString = cms.untracked.string('frontier://FrontierProd/CMS_CONDITIONS'),
0153 
0154         runNumber = cms.untracked.uint64(options.runNumber),
0155         omsServiceUrl = cms.untracked.string(BSOnlineOmsServiceUrl),
0156         latency = cms.untracked.uint32(2),
0157         autoCommit = cms.untracked.bool(True),
0158         saveLogsOnDB = cms.untracked.bool(True),
0159         jobName = cms.untracked.string(BSOnlineJobName), # name of the DB log record
0160         toPut = cms.VPSet(cms.PSet(
0161             record = cms.string(BSOnlineRecordName),
0162             tag = cms.string(BSOnlineTag),
0163             timetype = cms.untracked.string('Lumi'),
0164             onlyAppendUpdatePolicy = cms.untracked.bool(True)
0165         )),
0166         frontierKey = cms.untracked.string(options.runUniqueKey)
0167     )
0168 
0169 else:
0170     process.OnlineDBOutputService = cms.Service("OnlineDBOutputService",
0171 
0172         DBParameters = cms.PSet(
0173                                 messageLevel = cms.untracked.int32(0),
0174                                 authenticationPath = cms.untracked.string('.')
0175                             ),
0176 
0177         # Upload to CondDB
0178         connect = cms.string('sqlite_file:BeamSpotOnlineFakeLegacy.db'),
0179         preLoadConnectionString = cms.untracked.string('sqlite_file:BeamSpotOnlineFakeLegacy.db'),
0180         runNumber = cms.untracked.uint64(options.runNumber),
0181         lastLumiFile = cms.untracked.string('last_lumi.txt'),
0182         latency = cms.untracked.uint32(2),
0183         autoCommit = cms.untracked.bool(True),
0184         toPut = cms.VPSet(cms.PSet(
0185             record = cms.string(BSOnlineRecordName),
0186             tag = cms.string(BSOnlineTag),
0187             timetype = cms.untracked.string('Lumi'),
0188             onlyAppendUpdatePolicy = cms.untracked.bool(True)
0189         )),
0190         frontierKey = cms.untracked.string(options.runUniqueKey)
0191     )
0192 
0193 print("Configured frontierKey", options.runUniqueKey)
0194 
0195 #---------
0196 # Final path
0197 print("Final Source settings:", process.source)
0198 
0199 process.p = cms.Path(process.dqmcommon
0200                      * process.monitor
0201                     )
0202 
0203 
0204