Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-14 00:30:15

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