Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:42

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 # Define once the BeamSpotOnline record name,
0005 # will be used both in BeamMonitor setup and in payload creation/upload
0006 
0007 import sys
0008 
0009 from Configuration.Eras.Era_Run3_cff import Run3
0010 process = cms.Process("OnlineBeamMonitor", Run3)
0011 
0012 # Message logger
0013 #process.load("FWCore.MessageLogger.MessageLogger_cfi")
0014 #process.MessageLogger = cms.Service("MessageLogger",
0015 #    debugModules = cms.untracked.vstring('*'),
0016 #    cerr = cms.untracked.PSet(
0017 #        FwkReport = cms.untracked.PSet(
0018 #            optionalPSet = cms.untracked.bool(True),
0019 #            reportEvery = cms.untracked.int32(1000),
0020 #            limit = cms.untracked.int32(999999)
0021 #        )
0022 #    ),
0023 #    destinations = cms.untracked.vstring('cerr'),
0024 #)
0025 
0026 unitTest = 'unitTest=True' in sys.argv
0027 
0028 #-----------------------------
0029 if unitTest:
0030   import FWCore.ParameterSet.VarParsing as VarParsing
0031   options = VarParsing.VarParsing("analysis")
0032 
0033   options.register(
0034       "runkey",
0035       "pp_run",
0036       VarParsing.VarParsing.multiplicity.singleton,
0037       VarParsing.VarParsing.varType.string,
0038       "Run Keys of CMS"
0039   )
0040 
0041   options.register('runNumber',
0042                   346508,
0043                   VarParsing.VarParsing.multiplicity.singleton,
0044                   VarParsing.VarParsing.varType.int,
0045                   "Run number. This run number has to be present in the dataset configured with the dataset option.")
0046 
0047   options.register('dataset',
0048                   '/ExpressPhysics/Commissioning2021-Express-v1/FEVT',
0049                   VarParsing.VarParsing.multiplicity.singleton,
0050                   VarParsing.VarParsing.varType.string,
0051                   "Dataset name like '/ExpressCosmics/Commissioning2019-Express-v1/FEVT'")
0052 
0053   options.register('maxLumi',
0054                   2,
0055                   VarParsing.VarParsing.multiplicity.singleton,
0056                   VarParsing.VarParsing.varType.int,
0057                   "Only lumisections up to maxLumi are processed.")
0058 
0059   options.register('minLumi',
0060                   1,
0061                   VarParsing.VarParsing.multiplicity.singleton,
0062                   VarParsing.VarParsing.varType.int,
0063                   "Only lumisections starting from minLumi are processed.")
0064 
0065   options.register('lumiPattern',
0066                   '*',
0067                   VarParsing.VarParsing.multiplicity.singleton,
0068                   VarParsing.VarParsing.varType.string,
0069                   "Only lumisections with numbers matching lumiPattern are processed.")
0070 
0071   options.register('eventsPerLumi',
0072                   100,
0073                   VarParsing.VarParsing.multiplicity.singleton,
0074                   VarParsing.VarParsing.varType.int,
0075                   "This number of last events in each lumisection will be processed.")
0076 
0077   # This is used only by the online clients themselves. 
0078   # We need to register it here because otherwise an error occurs saying that there is an unidentified option.
0079   options.register('unitTest',
0080                   True,
0081                   VarParsing.VarParsing.multiplicity.singleton,
0082                   VarParsing.VarParsing.varType.bool,
0083                   "Required to avoid the error.")
0084 
0085   options.register('noDB',
0086                   True, # default value
0087                   VarParsing.VarParsing.multiplicity.singleton,
0088                   VarParsing.VarParsing.varType.bool,
0089                   "Don't upload the BeamSpot conditions to the DB")
0090 
0091   options.parseArguments()
0092   
0093   process.source = cms.Source("EmptySource")
0094   process.source.numberEventsInRun=cms.untracked.uint32(100)
0095   process.source.firstRun = cms.untracked.uint32(options.runNumber)
0096   process.source.firstLuminosityBlock = cms.untracked.uint32(1)
0097   process.source.numberEventsInLuminosityBlock = cms.untracked.uint32(2)
0098   process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(100))
0099 
0100 else:
0101   process.load("DQM.Integration.config.inputsource_cfi")
0102   from DQM.Integration.config.inputsource_cfi import options
0103 
0104 #ESProducer
0105 process.load("CondCore.CondDB.CondDB_cfi")
0106 process.BeamSpotESProducer = cms.ESProducer("OnlineBeamSpotESProducer")
0107 
0108 #-----------------------------
0109 # DQM Live Environment
0110 #-----------------------------
0111 process.load("DQM.Integration.config.environment_cfi")
0112 process.dqmEnv.subSystemFolder = 'OnlineBeamMonitor'
0113 process.dqmSaver.tag           = 'OnlineBeamMonitor'
0114 process.dqmSaver.runNumber     = options.runNumber
0115 process.dqmSaverPB.tag         = 'OnlineBeamMonitor'
0116 process.dqmSaverPB.runNumber   = options.runNumber
0117 
0118 # for running offline enhance the time validity of the online beamspot in DB
0119 if (unitTest or process.isDqmPlayback.value):
0120   process.BeamSpotESProducer.timeThreshold = cms.int32(int(1e6))
0121 
0122 #-----------------------------
0123 # BeamMonitor
0124 #-----------------------------
0125 process.dqmOnlineBeamMonitor = cms.EDProducer("OnlineBeamMonitor",
0126 MonitorName         = cms.untracked.string("OnlineBeamMonitor"),
0127 AppendRunToFileName = cms.untracked.bool(False),
0128 WriteDIPAscii       = cms.untracked.bool(True),
0129 DIPFileName         = cms.untracked.string("/nfshome0/dqmpro/BeamMonitorDQM/BeamFitResultsForDIP.txt")
0130 )
0131 
0132 #---------------
0133 # Calibration
0134 #---------------
0135 # Condition for P5 cluster
0136 process.load("DQM.Integration.config.FrontierCondition_GT_cfi")
0137 # Condition for lxplus: change and possibly customise the GT
0138 #from Configuration.AlCa.GlobalTag import GlobalTag as gtCustomise
0139 #process.GlobalTag = gtCustomise(process.GlobalTag, 'auto:run3_data', '')
0140 
0141 # Please *do not* delete this toGet statement as it is needed to fetch BeamSpotOnline
0142 # information every lumisection (instead of every run as for the other records in the GT)
0143 process.GlobalTag.toGet = cms.VPSet(
0144   cms.PSet(
0145     record = cms.string("BeamSpotOnlineLegacyObjectsRcd"),
0146     refreshTime = cms.uint64(2)
0147   ),
0148   cms.PSet(
0149     record = cms.string("BeamSpotOnlineHLTObjectsRcd"),
0150     refreshTime = cms.uint64(2)
0151   )
0152 )
0153 
0154 process.dqmcommon = cms.Sequence(process.dqmEnv
0155                                * process.dqmSaver * process.dqmSaverPB)
0156 
0157 process.monitor = cms.Sequence(process.dqmOnlineBeamMonitor)
0158 
0159 #-----------------------------------------------------------
0160 # process customizations included here
0161 from DQM.Integration.config.online_customizations_cfi import *
0162 process = customise(process)
0163 
0164 process.p = cms.Path( process.dqmcommon * process.monitor )
0165 
0166 print("Final Source settings:", process.source)