CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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('noDB',
37  True, # default value
38  VarParsing.VarParsing.multiplicity.singleton,
39  VarParsing.VarParsing.varType.bool,
40  "Don't upload the BeamSpot conditions to the DB")
41 
42 options.register('BeamSplashRun',
43  False, # default value
44  VarParsing.VarParsing.multiplicity.singleton,
45  VarParsing.VarParsing.varType.bool,
46  "Set client source settings for beam SPLASH run")
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 # Parameter for frontierKey
57 
58 options.register ('runUniqueKey',
59  'InValid',
60  VarParsing.VarParsing.multiplicity.singleton,
61  VarParsing.VarParsing.varType.string,
62  "Unique run key from RCMS for Frontier")
63 
64 options.parseArguments()
65 
66 # Fix to allow scram to compile
67 #if len(sys.argv) > 1:
68 # options.parseArguments()
69 
70 runType = RunType()
71 if not options.runkey.strip():
72  options.runkey = 'pp_run'
73 
74 runType.setRunType(options.runkey.strip())
75 
76 if not options.inputFiles:
77  # Input source
78  nextLumiTimeoutMillis = 240000
79  endOfRunKills = True
80 
81  if options.scanOnce:
82  endOfRunKills = False
83  nextLumiTimeoutMillis = 0
84 
85  source = cms.Source("DQMStreamerReader",
86  runNumber = cms.untracked.uint32(options.runNumber),
87  runInputDir = cms.untracked.string(options.runInputDir),
88  SelectEvents = cms.untracked.vstring('*'),
89  streamLabel = cms.untracked.string('streamDQM'),
90  scanOnce = cms.untracked.bool(options.scanOnce),
91  minEventsPerLumi = cms.untracked.int32(1),
92  delayMillis = cms.untracked.uint32(500),
93  nextLumiTimeoutMillis = cms.untracked.int32(nextLumiTimeoutMillis),
94  skipFirstLumis = cms.untracked.bool(options.skipFirstLumis),
95  deleteDatFiles = cms.untracked.bool(False),
96  endOfRunKills = cms.untracked.bool(endOfRunKills),
97  inputFileTransitionsEachEvent = cms.untracked.bool(False)
98  )
99 else:
100  print("The list of input files is provided. Disabling discovery and running on everything.")
101  files = ["file://" + x for x in options.inputFiles]
102  source = cms.Source("PoolSource",
103  fileNames = cms.untracked.vstring(files),
104  secondaryFileNames = cms.untracked.vstring()
105  )
106 
107 #source = cms.Source("PoolSource",
108 # fileNames = cms.untracked.vstring(
109 # '/store/user/tosi/STEAM/DQM/online/outputDQM_3.root'
110 # ),
111 # secondaryFileNames = cms.untracked.vstring()
112 #)
113 
114 # https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMSBeamSplash2017
116  source.minEventsPerLumi = 1000000
117  source.nextLumiTimeoutMillis = 15000
118 
119 if options.BeamSplashRun : set_BeamSplashRun_settings( source )
120 
121 print("Initial Source settings:", source)
122 
123 
124 
125 
126 
127 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47