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