CMS 3D CMS Logo

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