2 import FWCore.ParameterSet.Config
as cms
3 import FWCore.ParameterSet.VarParsing
as VarParsing
4 process = cms.Process(
"LHCInfoPerLSPopulator")
7 sourceConnection =
'oracle://cms_omds_adg/CMS_RUNINFO_R' 8 if socket.getfqdn().
find(
'.cms') != -1:
9 sourceConnection =
'oracle://cms_omds_lb/CMS_RUNINFO_R' 12 options.register(
'mode' 14 , VarParsing.VarParsing.multiplicity.singleton
15 , VarParsing.VarParsing.varType.string
16 ,
"The mode the fills are going to be process and the data gathered. Accepted values: duringFill endFill" 18 options.register(
'destinationConnection' 19 ,
'sqlite_file:lhcinfo_pop_test.db' 20 , VarParsing.VarParsing.multiplicity.singleton
21 , VarParsing.VarParsing.varType.string
22 ,
"Connection string to the DB where payloads will be possibly written." 24 options.register(
'targetConnection' 26 , VarParsing.VarParsing.multiplicity.singleton
27 , VarParsing.VarParsing.varType.string
28 ,
"""Connection string to the target DB: 29 if not empty (default), this provides the latest IOV and payloads to compare; 30 it is the DB where payloads should be finally uploaded.""" 32 options.register(
'tag' 33 ,
'LHCInfoPerLS_PopCon_test' 34 , VarParsing.VarParsing.multiplicity.singleton
35 , VarParsing.VarParsing.varType.string
36 ,
"Tag written in destinationConnection and finally appended in targetConnection." 38 options.register(
'messageLevel' 40 , VarParsing.VarParsing.multiplicity.singleton
41 , VarParsing.VarParsing.varType.int
42 ,
"Message level; default to 0" 44 options.register(
'startTime' 45 ,
'2021-09-10 03:10:18.000' 46 , VarParsing.VarParsing.multiplicity.singleton
47 , VarParsing.VarParsing.varType.string
48 ,
"""Date and time of the start of processing: 49 processes only fills starting at startTime or later""" 51 options.register(
'endTime' 53 , VarParsing.VarParsing.multiplicity.singleton
54 , VarParsing.VarParsing.varType.string
55 ,
"""Date and time of the start of processing: 56 processes only fills starting before endTime; 57 default to empty string which sets no restriction""" 60 options.register(
'sourceConnection' 61 ,
"oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER" 62 , VarParsing.VarParsing.multiplicity.singleton
63 , VarParsing.VarParsing.varType.string
64 ,
"""beam data source connection string (aka PPS db) 65 It's the source of crossing angle and beta * data""" 67 options.register(
'oms' 68 ,
"http://vocms0184.cern.ch/agg/api/v1" 69 , VarParsing.VarParsing.multiplicity.singleton
70 , VarParsing.VarParsing.varType.string
75 options.register(
'lastLumiFile' 77 , VarParsing.VarParsing.multiplicity.singleton
78 , VarParsing.VarParsing.varType.string
79 ,
"""duringFill only: path to file with lumiid to override the last lumisection processed by HLT. 80 Used for testing. Leave empty for production behaviour (getting this info from OMS)""" 82 options.register(
'frontierKey' 84 , VarParsing.VarParsing.multiplicity.singleton
85 , VarParsing.VarParsing.varType.string
86 ,
"""duringFill only: run-unique key for writing with OnlinePopCon 87 (used for confirming proper upload)""" 89 options.register(
'offsetLS' 91 , VarParsing.VarParsing.multiplicity.singleton
92 , VarParsing.VarParsing.varType.int
93 ,
"""duringFill only: offset between lastLumi (last LS processed by HLT or overriden by lastLumiFile) 94 and the IOV of the payload to be uploaded""" 96 options.register(
'debugLogic' 98 , VarParsing.VarParsing.multiplicity.singleton
99 , VarParsing.VarParsing.varType.bool
100 ,
"""duringFill only: Enables debug logic, meant to be used only for tests""" 102 options.register(
'defaultXangleX' 104 , VarParsing.VarParsing.multiplicity.singleton
105 , VarParsing.VarParsing.varType.float
106 ,
"""duringFill only: crossingAngleX value (in urad) for the default payload. 107 The default payload is inserted after the last processed fill has ended 108 and there's no ongoing stable beam yet. """ 110 options.register(
'defaultXangleY' 112 , VarParsing.VarParsing.multiplicity.singleton
113 , VarParsing.VarParsing.varType.float
114 ,
"""duringFill only: crossingAngleY value (in urad) for the default payload. 115 The default payload is inserted after the last processed fill has ended 116 and there's no ongoing stable beam yet. """ 118 options.register(
'defaultBetaX' 120 , VarParsing.VarParsing.multiplicity.singleton
121 , VarParsing.VarParsing.varType.float
122 ,
"""duringFill only: betaStarX value (in meters) for the default payload. 123 The default payload is inserted after the last processed fill has ended 124 and there's no ongoing stable beam yet. """ 126 options.register(
'defaultBetaY' 128 , VarParsing.VarParsing.multiplicity.singleton
129 , VarParsing.VarParsing.varType.float
130 ,
"""duringFill only: betaStarY value (in meters) for the default payload. 131 The default payload is inserted after the last processed fill has ended 132 and there's no ongoing stable beam yet. """ 137 options.register(
'minBetaStar', 0.1
138 , VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.float
139 ,
"""duringFill only: [meters] min value of the range of valid values. 140 If the value is outside of this range the payload is not uploaded""")
141 options.register(
'maxBetaStar', 100.
142 , VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.float
143 ,
"""duringFill only: [meters] min value of the range of valid values. 144 If the value is outside of this range the payload is not uploaded""")
145 options.register(
'minCrossingAngle', 10.
146 , VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.float
147 ,
"""duringFill only: [urad] min value of the range of valid values. 148 If the value is outside of this range the payload is not uploaded""")
149 options.register(
'maxCrossingAngle', 500.
150 , VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.float
151 ,
"""duringFill only: [urad] min value of the range of valid values. 152 If the value is outside of this range the payload is not uploaded""")
155 options.register(
'authenticationPath' 157 , VarParsing.VarParsing.multiplicity.singleton
158 , VarParsing.VarParsing.varType.string
159 ,
"""for now this option was always left empty""" 162 options.parseArguments()
163 if options.mode
is None:
164 raise ValueError(
"mode argument not provided. Supported modes are: duringFill endFill")
165 if options.mode
not in (
"duringFill",
"endFill"):
166 raise ValueError(
"Wrong mode argument. Supported modes are: duringFill endFill")
168 CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
169 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
170 CondDBConnection.DBParameters.authenticationPath = cms.untracked.string(options.authenticationPath)
172 process.MessageLogger = cms.Service(
"MessageLogger",
173 cout = cms.untracked.PSet(threshold = cms.untracked.string(
'INFO')),
174 destinations = cms.untracked.vstring(
'cout')
177 process.source = cms.Source(
"EmptyIOVSource",
178 lastValue = cms.uint64(1),
179 timetype = cms.string(
'runnumber'),
180 firstValue = cms.uint64(1),
181 interval = cms.uint64(1)
185 if options.mode ==
'endFill':
186 timetype =
'timestamp' 190 if options.mode ==
"endFill":
191 process.PoolDBOutputService = cms.Service(
"PoolDBOutputService",
193 timetype = cms.untracked.string(timetype),
194 toPut = cms.VPSet(cms.PSet(record = cms.string(
'LHCInfoPerLSRcd'),
195 tag = cms.string( options.tag )
200 process.OnlineDBOutputService = cms.Service(
"OnlineDBOutputService",
202 preLoadConnectionString = cms.untracked.string(
'frontier://FrontierProd/CMS_CONDITIONS' 203 if not options.destinationConnection.startswith(
'sqlite')
204 else options.destinationConnection ),
205 lastLumiFile = cms.untracked.string(options.lastLumiFile),
206 omsServiceUrl = cms.untracked.string(
'http://cmsoms-eventing.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' 207 if not options.lastLumiFile
else "" ),
210 latency = cms.untracked.uint32(options.offsetLS),
211 timetype = cms.untracked.string(timetype),
212 toPut = cms.VPSet(cms.PSet(
213 record = cms.string(
'LHCInfoPerLSRcd'),
214 tag = cms.string( options.tag ),
215 onlyAppendUpdatePolicy = cms.untracked.bool(
True)
217 frontierKey = cms.untracked.string(options.frontierKey)
221 process.Test1 = cms.EDAnalyzer((
"LHCInfoPerLSPopConAnalyzer" if options.mode ==
"endFill" 222 else "LHCInfoPerLSOnlinePopConAnalyzer"),
223 SinceAppendMode = cms.bool(
True),
224 record = cms.string(
'LHCInfoPerLSRcd'),
225 name = cms.untracked.string(
'LHCInfo'),
227 startTime = cms.untracked.string(options.startTime),
228 endTime = cms.untracked.string(options.endTime),
229 endFill = cms.untracked.bool(options.mode ==
"endFill"),
230 name = cms.untracked.string(
"LHCInfoPerLSPopConSourceHandler"),
231 connectionString = cms.untracked.string(options.sourceConnection),
232 omsBaseUrl = cms.untracked.string(options.oms),
233 authenticationPath = cms.untracked.string(options.authenticationPath),
234 debug=cms.untracked.bool(
False),
235 debugLogic=cms.untracked.bool(options.debugLogic),
236 defaultCrossingAngleX = cms.untracked.double(options.defaultXangleX),
237 defaultCrossingAngleY = cms.untracked.double(options.defaultXangleY),
238 defaultBetaStarX = cms.untracked.double(options.defaultBetaX),
239 defaultBetaStarY = cms.untracked.double(options.defaultBetaY),
240 minBetaStar = cms.untracked.double(options.minBetaStar),
241 maxBetaStar = cms.untracked.double(options.maxBetaStar),
242 minCrossingAngle = cms.untracked.double(options.minCrossingAngle),
243 maxCrossingAngle = cms.untracked.double(options.maxCrossingAngle),
245 loggingOn = cms.untracked.bool(
True),
246 IsDestDbCheckedInQueryLog = cms.untracked.bool(
False)
249 process.p = cms.Path(process.Test1)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)