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 # Parameters for runType
49 
50 options.register ('runkey',
51  'pp_run',
52  VarParsing.VarParsing.multiplicity.singleton,
53  VarParsing.VarParsing.varType.string,
54  "Run Keys of CMS")
55 
56 options.parseArguments()
57 
58 # Fix to allow scram to compile
59 #if len(sys.argv) > 1:
60 # options.parseArguments()
61 
62 runType = RunType()
63 if not options.runkey.strip():
64  options.runkey = 'pp_run'
65 
66 runType.setRunType(options.runkey.strip())
67 
68 if not options.inputFiles:
69  # Input source
70  nextLumiTimeoutMillis = 240000
71  endOfRunKills = True
72 
73  if options.scanOnce:
74  endOfRunKills = False
75  nextLumiTimeoutMillis = 0
76 
77  source = cms.Source("DQMStreamerReader",
78  runNumber = cms.untracked.uint32(options.runNumber),
79  runInputDir = cms.untracked.string(options.runInputDir),
80  SelectEvents = cms.untracked.vstring('*'),
81  streamLabel = cms.untracked.string('streamDQM'),
82  scanOnce = cms.untracked.bool(options.scanOnce),
83  minEventsPerLumi = cms.untracked.int32(1),
84  delayMillis = cms.untracked.uint32(500),
85  nextLumiTimeoutMillis = cms.untracked.int32(nextLumiTimeoutMillis),
86  skipFirstLumis = cms.untracked.bool(options.skipFirstLumis),
87  deleteDatFiles = cms.untracked.bool(False),
88  endOfRunKills = cms.untracked.bool(endOfRunKills),
89  )
90 else:
91  print("The list of input files is provided. Disabling discovery and running on everything.")
92  files = ["file://" + x for x in options.inputFiles]
93  source = cms.Source("PoolSource",
94  fileNames = cms.untracked.vstring(files),
95  secondaryFileNames = cms.untracked.vstring()
96  )
97 
98 #source = cms.Source("PoolSource",
99 # fileNames = cms.untracked.vstring(
100 # '/store/user/tosi/STEAM/DQM/online/outputDQM_3.root'
101 # ),
102 # secondaryFileNames = cms.untracked.vstring()
103 #)
104 
105 print("Source:", source)
dqmPythonTypes.RunType
Definition: dqmPythonTypes.py:4
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
VarParsing.VarParsing
Definition: VarParsing.py:10