Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-01 03:53:37

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.inputFiles are inherited from 'analysis'
0012 options.register('runNumber',
0013                  111,
0014                  VarParsing.VarParsing.multiplicity.singleton,
0015                  VarParsing.VarParsing.varType.int,
0016                  "Run number.")
0017 
0018 options.register('runInputDir',
0019                  '/tmp',
0020                  VarParsing.VarParsing.multiplicity.singleton,
0021                  VarParsing.VarParsing.varType.string,
0022                  "Directory where the DQM files will appear.")
0023 
0024 options.register('scanOnce',
0025                  False, # default value
0026                  VarParsing.VarParsing.multiplicity.singleton,
0027                  VarParsing.VarParsing.varType.bool,
0028                  "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'.")
0029 
0030 options.register('skipFirstLumis',
0031                  False, # default value
0032                  VarParsing.VarParsing.multiplicity.singleton,
0033                  VarParsing.VarParsing.varType.bool,
0034                  "Skip (and ignore the minEventsPerLumi parameter) for the files which have been available at the begining of the processing. ")
0035 
0036 options.register('noDB',
0037                  True, # default value
0038                  VarParsing.VarParsing.multiplicity.singleton,
0039                  VarParsing.VarParsing.varType.bool,
0040                  "Don't upload the BeamSpot conditions to the DB")
0041 
0042 options.register('BeamSplashRun',
0043                  False, # default value
0044                  VarParsing.VarParsing.multiplicity.singleton,
0045                  VarParsing.VarParsing.varType.bool,
0046                  "Set client source settings for beam SPLASH run")
0047 
0048 # Parameters for runType
0049 
0050 options.register ('runkey',
0051           'pp_run',
0052           VarParsing.VarParsing.multiplicity.singleton,
0053           VarParsing.VarParsing.varType.string,
0054           "Run Keys of CMS")
0055 
0056 # Parameter for frontierKey
0057 
0058 options.register ('runUniqueKey',
0059           'InValid',
0060           VarParsing.VarParsing.multiplicity.singleton,
0061           VarParsing.VarParsing.varType.string,
0062           "Unique run key from RCMS for Frontier")
0063 
0064 options.parseArguments()
0065 
0066 # Fix to allow scram to compile
0067 #if len(sys.argv) > 1:
0068 #  options.parseArguments()
0069 
0070 runType = RunType()
0071 if not options.runkey.strip():
0072   options.runkey = 'pp_run'
0073 
0074 runType.setRunType(options.runkey.strip())
0075 
0076 if not options.inputFiles:
0077     # Input source
0078     nextLumiTimeoutMillis = 240000
0079     endOfRunKills = True
0080     
0081     if options.scanOnce:
0082         endOfRunKills = False
0083         nextLumiTimeoutMillis = 0
0084     
0085     source = cms.Source("DQMStreamerReader",
0086         runNumber = cms.untracked.uint32(options.runNumber),
0087         runInputDir = cms.untracked.string(options.runInputDir),
0088         SelectEvents = cms.untracked.vstring('*'),
0089         streamLabel = cms.untracked.string('streamDQM'),
0090         scanOnce = cms.untracked.bool(options.scanOnce),
0091         minEventsPerLumi = cms.untracked.int32(1),
0092         delayMillis = cms.untracked.uint32(500),
0093         nextLumiTimeoutMillis = cms.untracked.int32(nextLumiTimeoutMillis),
0094         skipFirstLumis = cms.untracked.bool(options.skipFirstLumis),
0095         deleteDatFiles = cms.untracked.bool(False),
0096         endOfRunKills  = cms.untracked.bool(endOfRunKills),
0097         inputFileTransitionsEachEvent = cms.untracked.bool(False)
0098     )
0099 else:
0100     print("The list of input files is provided. Disabling discovery and running on everything.")
0101     files = ["file://" + x for x in options.inputFiles]
0102     source = cms.Source("PoolSource",
0103         fileNames = cms.untracked.vstring(files),
0104         secondaryFileNames = cms.untracked.vstring()
0105     )
0106     
0107 #source = cms.Source("PoolSource",
0108 #    fileNames = cms.untracked.vstring(
0109 #       '/store/user/tosi/STEAM/DQM/online/outputDQM_3.root'
0110 #    ),
0111 #    secondaryFileNames = cms.untracked.vstring()
0112 #)
0113 
0114 # https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017
0115 def set_BeamSplashRun_settings( source ):
0116   source.minEventsPerLumi      = 1000000
0117   source.nextLumiTimeoutMillis = 15000
0118 
0119 if options.BeamSplashRun : set_BeamSplashRun_settings( source )
0120 
0121 print("Initial Source settings:", source)
0122 
0123 
0124 
0125 
0126 
0127