CMS 3D CMS Logo

inputsource_cfi.py
Go to the documentation of this file.
1 from __future__ import print_function
2 import FWCore.ParameterSet.Config as cms
3 import FWCore.ParameterSet.VarParsing as VarParsing
4 
5 import sys
6 from dqmPythonTypes import *
7 
8 options = VarParsing.VarParsing('analysis')
9 
10 # options.inputFiles are inherited from 'analysis'
11 options.register('runNumber',
12  111,
13  VarParsing.VarParsing.multiplicity.singleton,
14  VarParsing.VarParsing.varType.int,
15  "Run number.")
16 
17 options.register('runInputDir',
18  '/tmp',
19  VarParsing.VarParsing.multiplicity.singleton,
20  VarParsing.VarParsing.varType.string,
21  "Directory where the DQM files will appear.")
22 
23 options.register('scanOnce',
24  False, # default value
25  VarParsing.VarParsing.multiplicity.singleton,
26  VarParsing.VarParsing.varType.bool,
27  "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'.")
28 
29 options.register('skipFirstLumis',
30  False, # default value
31  VarParsing.VarParsing.multiplicity.singleton,
32  VarParsing.VarParsing.varType.bool,
33  "Skip (and ignore the minEventsPerLumi parameter) for the files which have been available at the begining of the processing. ")
34 
35 # Parameters for runType
36 
37 options.register ('runkey',
38  'pp_run',
39  VarParsing.VarParsing.multiplicity.singleton,
40  VarParsing.VarParsing.varType.string,
41  "Run Keys of CMS")
42 
43 options.parseArguments()
44 
45 # Fix to allow scram to compile
46 #if len(sys.argv) > 1:
47 # options.parseArguments()
48 
49 runType = RunType()
50 if not options.runkey.strip():
51  options.runkey = 'pp_run'
52 
53 runType.setRunType(options.runkey.strip())
54 
55 if not options.inputFiles:
56  # Input source
57  nextLumiTimeoutMillis = 240000
58  endOfRunKills = True
59 
60  if options.scanOnce:
61  endOfRunKills = False
62  nextLumiTimeoutMillis = 0
63 
64  source = cms.Source("DQMStreamerReader",
65  runNumber = cms.untracked.uint32(options.runNumber),
66  runInputDir = cms.untracked.string(options.runInputDir),
67  SelectEvents = cms.untracked.vstring('*'),
68  streamLabel = cms.untracked.string('streamDQM'),
69  scanOnce = cms.untracked.bool(options.scanOnce),
70  minEventsPerLumi = cms.untracked.int32(1),
71  delayMillis = cms.untracked.uint32(500),
72  nextLumiTimeoutMillis = cms.untracked.int32(nextLumiTimeoutMillis),
73  skipFirstLumis = cms.untracked.bool(options.skipFirstLumis),
74  deleteDatFiles = cms.untracked.bool(False),
75  endOfRunKills = cms.untracked.bool(endOfRunKills),
76  )
77 else:
78  print("The list of input files is provided. Disabling discovery and running on everything.")
79  files = map(lambda x: "file://" + x, options.inputFiles)
80  source = cms.Source("PoolSource",
81  fileNames = cms.untracked.vstring(files),
82  secondaryFileNames = cms.untracked.vstring()
83  )
84 
85 #source = cms.Source("PoolSource",
86 # fileNames = cms.untracked.vstring(
87 # '/store/user/tosi/STEAM/DQM/online/outputDQM_3.root'
88 # ),
89 # secondaryFileNames = cms.untracked.vstring()
90 #)
91 
92 print("Source:", source)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65