CMS 3D CMS Logo

inputsource_cfi.py
Go to the documentation of this file.
1 from __future__ import print_function
2 from __future__ import absolute_import
3 import FWCore.ParameterSet.Config as cms
4 import FWCore.ParameterSet.VarParsing as VarParsing
5 
6 import sys
7 from .dqmPythonTypes import *
8 
9 options = VarParsing.VarParsing('analysis')
10 
11 # options.inputFiles are inherited from 'analysis'
12 options.register('runNumber',
13  111,
14  VarParsing.VarParsing.multiplicity.singleton,
15  VarParsing.VarParsing.varType.int,
16  "Run number.")
17 
18 options.register('runInputDir',
19  '/tmp',
20  VarParsing.VarParsing.multiplicity.singleton,
21  VarParsing.VarParsing.varType.string,
22  "Directory where the DQM files will appear.")
23 
24 options.register('scanOnce',
25  False, # default value
26  VarParsing.VarParsing.multiplicity.singleton,
27  VarParsing.VarParsing.varType.bool,
28  "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'.")
29 
30 options.register('skipFirstLumis',
31  False, # default value
32  VarParsing.VarParsing.multiplicity.singleton,
33  VarParsing.VarParsing.varType.bool,
34  "Skip (and ignore the minEventsPerLumi parameter) for the files which have been available at the begining of the processing. ")
35 
36 options.register('transDelay',
37  0, #default value, int limit -3
38  VarParsing.VarParsing.multiplicity.singleton,
39  VarParsing.VarParsing.varType.int,
40  "delay in seconds for the commit of the db transaction")
41 
42 options.register('noDB',
43  True, # default value
44  VarParsing.VarParsing.multiplicity.singleton,
45  VarParsing.VarParsing.varType.bool,
46  "Don't upload the BeamSpot conditions to the DB")
47 
48 options.register('BeamSplashRun',
49  False, # default value
50  VarParsing.VarParsing.multiplicity.singleton,
51  VarParsing.VarParsing.varType.bool,
52  "Set client source settings for beam SPLASH run")
53 
54 # Parameters for runType
55 
56 options.register ('runkey',
57  'pp_run',
58  VarParsing.VarParsing.multiplicity.singleton,
59  VarParsing.VarParsing.varType.string,
60  "Run Keys of CMS")
61 
62 # Parameter for frontierKey
63 
64 options.register ('runUniqueKey',
65  'InValid',
66  VarParsing.VarParsing.multiplicity.singleton,
67  VarParsing.VarParsing.varType.string,
68  "Unique run key from RCMS for Frontier")
69 
70 options.parseArguments()
71 
72 # Fix to allow scram to compile
73 #if len(sys.argv) > 1:
74 # options.parseArguments()
75 
76 runType = RunType()
77 if not options.runkey.strip():
78  options.runkey = 'pp_run'
79 
80 runType.setRunType(options.runkey.strip())
81 
82 if not options.inputFiles:
83  # Input source
84  nextLumiTimeoutMillis = 240000
85  endOfRunKills = True
86 
87  if options.scanOnce:
88  endOfRunKills = False
89  nextLumiTimeoutMillis = 0
90 
91  source = cms.Source("DQMStreamerReader",
92  runNumber = cms.untracked.uint32(options.runNumber),
93  runInputDir = cms.untracked.string(options.runInputDir),
94  SelectEvents = cms.untracked.vstring('*'),
95  streamLabel = cms.untracked.string('streamDQM'),
96  scanOnce = cms.untracked.bool(options.scanOnce),
97  minEventsPerLumi = cms.untracked.int32(1),
98  delayMillis = cms.untracked.uint32(500),
99  nextLumiTimeoutMillis = cms.untracked.int32(nextLumiTimeoutMillis),
100  skipFirstLumis = cms.untracked.bool(options.skipFirstLumis),
101  deleteDatFiles = cms.untracked.bool(False),
102  endOfRunKills = cms.untracked.bool(endOfRunKills),
103  inputFileTransitionsEachEvent = cms.untracked.bool(False)
104  )
105 else:
106  print("The list of input files is provided. Disabling discovery and running on everything.")
107  files = ["file://" + x for x in options.inputFiles]
108  source = cms.Source("PoolSource",
109  fileNames = cms.untracked.vstring(files),
110  secondaryFileNames = cms.untracked.vstring()
111  )
112 
113 #source = cms.Source("PoolSource",
114 # fileNames = cms.untracked.vstring(
115 # '/store/user/tosi/STEAM/DQM/online/outputDQM_3.root'
116 # ),
117 # secondaryFileNames = cms.untracked.vstring()
118 #)
119 
120 # https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017
122  source.minEventsPerLumi = 1000000
123  source.nextLumiTimeoutMillis = 15000
124 
125 if options.BeamSplashRun : set_BeamSplashRun_settings( source )
126 
127 print("Initial Source settings:", source)
128 
129 
130 
131 
132 
133 
inputsource_cfi.set_BeamSplashRun_settings
def set_BeamSplashRun_settings(source)
Definition: inputsource_cfi.py:121
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
dqmPythonTypes.RunType
Definition: dqmPythonTypes.py:4
VarParsing.VarParsing
Definition: VarParsing.py:9