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('datafnPosition',
19  3, # default value
20  VarParsing.VarParsing.multiplicity.singleton,
21  VarParsing.VarParsing.varType.int,
22  "Data filename position in the positional arguments array 'data' in json file.")
23 
24 options.register('runInputDir',
25  '/tmp',
26  VarParsing.VarParsing.multiplicity.singleton,
27  VarParsing.VarParsing.varType.string,
28  "Directory where the DQM files will appear.")
29 
30 options.register('scanOnce',
31  False, # default value
32  VarParsing.VarParsing.multiplicity.singleton,
33  VarParsing.VarParsing.varType.bool,
34  "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'.")
35 
36 options.register('skipFirstLumis',
37  False, # default value
38  VarParsing.VarParsing.multiplicity.singleton,
39  VarParsing.VarParsing.varType.bool,
40  "Skip (and ignore the minEventsPerLumi parameter) for the files which have been available at the beginning of the processing.")
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 # Parameter for output directory of the event display clients
71 # visualization-live and visualization-live-secondInstance
72 # this additional input argument was added in the hltd framework
73 # only for the visualization clients
74 # Note, the other clients do not use this input parameter
75 
76 options.register('outputBaseDir',
77  '/fff/BU0/output',
78  VarParsing.VarParsing.multiplicity.singleton,
79  VarParsing.VarParsing.varType.string,
80  "Directory where the visualization output files will appear.")
81 
82 
83 
84 options.parseArguments()
85 
86 # Fix to allow scram to compile
87 #if len(sys.argv) > 1:
88 # options.parseArguments()
89 
90 runType = RunType()
91 if not options.runkey.strip():
92  options.runkey = 'pp_run'
93 
94 runType.setRunType(options.runkey.strip())
95 
96 if not options.inputFiles:
97  # Input source
98  nextLumiTimeoutMillis = 240000
99  endOfRunKills = True
100 
101  if options.scanOnce:
102  endOfRunKills = False
103  nextLumiTimeoutMillis = 0
104 
105  source = cms.Source("DQMStreamerReader",
106  runNumber = cms.untracked.uint32(options.runNumber),
107  runInputDir = cms.untracked.string(options.runInputDir),
108  SelectEvents = cms.untracked.vstring('*'),
109  streamLabel = cms.untracked.string('streamDQM'),
110  scanOnce = cms.untracked.bool(options.scanOnce),
111  datafnPosition = cms.untracked.uint32(options.datafnPosition),
112  minEventsPerLumi = cms.untracked.int32(1),
113  delayMillis = cms.untracked.uint32(500),
114  nextLumiTimeoutMillis = cms.untracked.int32(nextLumiTimeoutMillis),
115  skipFirstLumis = cms.untracked.bool(options.skipFirstLumis),
116  deleteDatFiles = cms.untracked.bool(False),
117  endOfRunKills = cms.untracked.bool(endOfRunKills),
118  inputFileTransitionsEachEvent = cms.untracked.bool(False)
119  )
120 else:
121  print("The list of input files is provided. Disabling discovery and running on everything.")
122  files = ["file://" + x for x in options.inputFiles]
123  source = cms.Source("PoolSource",
124  fileNames = cms.untracked.vstring(files),
125  secondaryFileNames = cms.untracked.vstring()
126  )
127 
128 #source = cms.Source("PoolSource",
129 # fileNames = cms.untracked.vstring(
130 # '/store/user/tosi/STEAM/DQM/online/outputDQM_3.root'
131 # ),
132 # secondaryFileNames = cms.untracked.vstring()
133 #)
134 
135 # https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017
137  source.minEventsPerLumi = 1000000
138  source.nextLumiTimeoutMillis = 15000
139 
140 if options.BeamSplashRun : set_BeamSplashRun_settings( source )
141 
142 print("Initial Source settings:", source)
def set_BeamSplashRun_settings(source)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47