Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-01-08 23:50:23

0001 from __future__ import print_function
0002 from __future__ import absolute_import
0003 import FWCore.ParameterSet.Config as cms
0004 import FWCore.ParameterSet.VarParsing as VarParsing
0005 
0006 import sys
0007 from .dqmPythonTypes import *
0008 
0009 options = VarParsing.VarParsing('analysis')
0010 
0011 options.register('runNumber',
0012                  111,
0013                  VarParsing.VarParsing.multiplicity.singleton,
0014                  VarParsing.VarParsing.varType.int,
0015                  "Run number.")
0016 
0017 options.register('datafnPosition',
0018                  3, # default value
0019                  VarParsing.VarParsing.multiplicity.singleton,
0020                  VarParsing.VarParsing.varType.int,
0021                  "Data filename position in the positional arguments array 'data' in json file.")
0022 
0023 options.register('runInputDir',
0024                  '/tmp',
0025                  VarParsing.VarParsing.multiplicity.singleton,
0026                  VarParsing.VarParsing.varType.string,
0027                  "Directory where the DQM files will appear.")
0028 
0029 options.register('scanOnce',
0030                  False, # default value
0031                  VarParsing.VarParsing.multiplicity.singleton,
0032                  VarParsing.VarParsing.varType.bool,
0033                  "Don't repeat file scans: use what was found during the initial scan. EOR file is ignored and the state is set to 'past end of run'.")
0034 
0035 options.register('skipFirstLumis',
0036                  False, # default value
0037                  VarParsing.VarParsing.multiplicity.singleton,
0038                  VarParsing.VarParsing.varType.bool,
0039                  "Skip (and ignore the minEventsPerLumi parameter) for the files which have been available at the beginning of the processing.")
0040 
0041 options.register('BeamSplashRun',
0042                  False, # default value
0043                  VarParsing.VarParsing.multiplicity.singleton,
0044                  VarParsing.VarParsing.varType.bool,
0045                  "Set client source settings for beam SPLASH run")
0046 
0047 # Parameters for runType
0048 
0049 options.register('runkey',
0050                  'pp_run',
0051                  VarParsing.VarParsing.multiplicity.singleton,
0052                  VarParsing.VarParsing.varType.string,
0053                  "Run Keys of CMS")
0054 
0055 # Parameter for frontierKey
0056 
0057 options.register('runUniqueKey',
0058                  'InValid',
0059                  VarParsing.VarParsing.multiplicity.singleton,
0060                  VarParsing.VarParsing.varType.string,
0061                  "Unique run key from RCMS for Frontier")
0062 
0063 options.parseArguments()
0064 
0065 # Fix to allow scram to compile
0066 #if len(sys.argv) > 1:
0067 #  options.parseArguments()
0068 
0069 runType = RunType()
0070 if not options.runkey.strip():
0071   options.runkey = 'pp_run'
0072 
0073 runType.setRunType(options.runkey.strip())
0074 
0075 # Input source
0076 nextLumiTimeoutMillis = 120000
0077 endOfRunKills = True
0078 
0079 if options.scanOnce:
0080     endOfRunKills = False
0081     nextLumiTimeoutMillis = 0
0082 
0083 source = cms.Source("DQMProtobufReader",
0084     runNumber = cms.untracked.uint32(options.runNumber),
0085     runInputDir = cms.untracked.string(options.runInputDir),
0086     streamLabel = cms.untracked.string('streamDQMHistograms'),
0087     scanOnce = cms.untracked.bool(options.scanOnce),
0088     datafnPosition = cms.untracked.uint32(options.datafnPosition),
0089     delayMillis = cms.untracked.uint32(500),
0090     nextLumiTimeoutMillis = cms.untracked.int32(nextLumiTimeoutMillis),
0091     skipFirstLumis = cms.untracked.bool(options.skipFirstLumis),
0092     deleteDatFiles = cms.untracked.bool(False),
0093     loadFiles = cms.untracked.bool(True),
0094     endOfRunKills  = cms.untracked.bool(endOfRunKills),
0095 )
0096 
0097 # https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017
0098 def set_BeamSplashRun_settings( source ):
0099   # source.minEventsPerLumi      = 1000000
0100   source.nextLumiTimeoutMillis = 15000
0101 
0102 if options.BeamSplashRun : set_BeamSplashRun_settings( source )
0103 
0104 print("Initial Source settings:", source)