Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-17 02:46:35

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 
0005 import sys
0006 
0007 from DQM.Integration.config.dqmPythonTypes import RunType 
0008 from DQM.DTMonitorModule.test.dtDqmPythonTypes import DTDQMConfig 
0009 
0010 options = VarParsing.VarParsing('analysis')
0011 
0012 # options.inputFiles are inherited from 'analysis'
0013 options.register('runNumber',
0014                  111,
0015                  VarParsing.VarParsing.multiplicity.singleton,
0016                  VarParsing.VarParsing.varType.int,
0017                  "Run number.")
0018 
0019 options.register('runInputDir',
0020                  '/tmp',
0021                  VarParsing.VarParsing.multiplicity.singleton,
0022                  VarParsing.VarParsing.varType.string,
0023                  "Directory where the DQM files will appear.")
0024 
0025 options.register('scanOnce',
0026                  False, # default value
0027                  VarParsing.VarParsing.multiplicity.singleton,
0028                  VarParsing.VarParsing.varType.bool,
0029                  "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'.")
0030 
0031 options.register('minEventsPerLumi',
0032                  1, # default value
0033                  VarParsing.VarParsing.multiplicity.singleton,
0034                  VarParsing.VarParsing.varType.int,
0035                  "If scanOnce is tue, sets the minimal # of events per LS to be processed before switching to the next LS (and file).")
0036 
0037 options.register('skipFirstLumis',
0038                  False, # default value
0039                  VarParsing.VarParsing.multiplicity.singleton,
0040                  VarParsing.VarParsing.varType.bool,
0041                  "Skip (and ignore the minEventsPerLumi parameter) for the files which have been available at the begining of the processing. ")
0042 
0043 # Parameters for runType
0044 
0045 options.register ('runkey',
0046           'pp_run',
0047           VarParsing.VarParsing.multiplicity.singleton,
0048           VarParsing.VarParsing.varType.string,
0049           "Run Keys of CMS")
0050 
0051 # parameters for DT configuration
0052 
0053 options.register('processAB7Digis',
0054                  False, # default value
0055                  VarParsing.VarParsing.multiplicity.singleton,
0056                  VarParsing.VarParsing.varType.bool,
0057                  "Enable processing of AB7 DT digi data (duplicate occupancy plot and other customisations to DT digi monitoring)")
0058 
0059 options.register('processAB7TPs',
0060                  False, # default value
0061                  VarParsing.VarParsing.multiplicity.singleton,
0062                  VarParsing.VarParsing.varType.bool,
0063                  "Enable processing of AB7 DT local trigger data (DOES NOTHING FOR NOW)")
0064 
0065 options.register('runWithLargeTimeBox',
0066                  False, # default value
0067                  VarParsing.VarParsing.multiplicity.singleton,
0068                  VarParsing.VarParsing.varType.bool,
0069                  "Runs DTDigiTask with a timebox plot window of 6400 TDC Counts")
0070 
0071 options.register('timeBoxTDCPedestal',
0072                  -200, # default value
0073                  VarParsing.VarParsing.multiplicity.singleton,
0074                  VarParsing.VarParsing.varType.int,
0075                  "Pedestal of the lower edge of AB7 time boxes")
0076 
0077 
0078 options.parseArguments()
0079 
0080 runType = RunType()
0081 if not options.runkey.strip():
0082   options.runkey = 'pp_run'
0083 
0084 dtDqmConfig = DTDQMConfig()
0085 dtDqmConfig.setProcessAB7Digis(options.processAB7Digis)
0086 dtDqmConfig.setProcessAB7TPs(options.processAB7TPs)
0087 
0088 dtDqmConfig.setRunWithLargeTB(options.runWithLargeTimeBox)
0089 dtDqmConfig.setTBTDCPedestal(options.timeBoxTDCPedestal)
0090 
0091 runType.setRunType(options.runkey.strip())
0092 
0093 if not options.inputFiles:
0094     # Input source
0095     minEventsPerLumi = 1
0096     nextLumiTimeoutMillis = 240000
0097     endOfRunKills = True
0098     
0099     if options.scanOnce:
0100         endOfRunKills = False
0101         nextLumiTimeoutMillis = 0
0102         minEventsPerLumi = options.minEventsPerLumi
0103     
0104     source = cms.Source("DQMStreamerReader",
0105         runNumber = cms.untracked.uint32(options.runNumber),
0106         runInputDir = cms.untracked.string(options.runInputDir),
0107         SelectEvents = cms.untracked.vstring('*'),
0108         streamLabel = cms.untracked.string('streamDQM'),
0109         scanOnce = cms.untracked.bool(options.scanOnce),
0110         minEventsPerLumi = cms.untracked.int32(minEventsPerLumi),
0111         delayMillis = cms.untracked.uint32(500),
0112         nextLumiTimeoutMillis = cms.untracked.int32(nextLumiTimeoutMillis),
0113         skipFirstLumis = cms.untracked.bool(options.skipFirstLumis),
0114         deleteDatFiles = cms.untracked.bool(False),
0115         endOfRunKills  = cms.untracked.bool(endOfRunKills),
0116     )
0117 else:
0118     print("The list of input files is provided. Disabling discovery and running on everything.")
0119     files = map(lambda x: "file://" + x, options.inputFiles)
0120     source = cms.Source("PoolSource",
0121         fileNames = cms.untracked.vstring(files),
0122         secondaryFileNames = cms.untracked.vstring()
0123     )
0124 
0125 print("Source:", source)
0126 
0127 print("RunType:", runType)
0128 
0129 print("DTDQMConfig:", dtDqmConfig)
0130