CMS 3D CMS Logo

LHCInfoPerLSPopConAnalyzer_cfg.py
Go to the documentation of this file.
1 import socket
2 import FWCore.ParameterSet.Config as cms
3 import FWCore.ParameterSet.VarParsing as VarParsing
4 process = cms.Process("LHCInfoPerLSPopulator")
5 from CondCore.CondDB.CondDB_cfi import *
6 
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'
10 
12 options.register( 'mode'
13  , None # Required parameter
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"
17  )
18 options.register( 'destinationConnection'
19  , 'sqlite_file:lhcinfo_pop_test.db' #default value
20  , VarParsing.VarParsing.multiplicity.singleton
21  , VarParsing.VarParsing.varType.string
22  , "Connection string to the DB where payloads will be possibly written."
23  )
24 options.register( 'targetConnection'
25  , '' #default value
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."""
31  )
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."
37  )
38 options.register( 'messageLevel'
39  , 0 #default value
40  , VarParsing.VarParsing.multiplicity.singleton
41  , VarParsing.VarParsing.varType.int
42  , "Message level; default to 0"
43  )
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"""
50  )
51 options.register( 'endTime'
52  , ''
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"""
58  )
59 
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"""
66  )
67 options.register( 'oms'
68  , "http://vocms0184.cern.ch/agg/api/v1"
69  , VarParsing.VarParsing.multiplicity.singleton
70  , VarParsing.VarParsing.varType.string
71  , """OMS base URL"""
72  )
73 
74 #duringFill mode specific:
75 options.register( 'lastLumiFile'
76  , ''
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)"""
81  )
82 options.register( 'frontierKey'
83  , ''
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)"""
88  )
89 options.register('offsetLS'
90  , 2
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"""
95  )
96 options.register( 'debugLogic'
97  , False
98  , VarParsing.VarParsing.multiplicity.singleton
99  , VarParsing.VarParsing.varType.bool
100  , """duringFill only: Enables debug logic, meant to be used only for tests"""
101  )
102 options.register( 'defaultXangleX'
103  , 160.0 # urad
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. """
109  )
110 options.register( 'defaultXangleY'
111  , 0.0 # urad
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. """
117  )
118 options.register( 'defaultBetaX'
119  , 0.3 # meters
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. """
125  )
126 options.register( 'defaultBetaY'
127  , 0.3 # meters
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. """
133  )
134 
135 
136 # it's unlikely to ever use values different from the defaults, added as a parameter just in case
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""")
153 
154 # as the previous options, so far there was no need to use option, added just in case
155 options.register( 'authenticationPath'
156  , ""
157  , VarParsing.VarParsing.multiplicity.singleton
158  , VarParsing.VarParsing.varType.string
159  , """for now this option was always left empty"""
160  )
161 
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")
167 
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)
171 
172 process.MessageLogger = cms.Service("MessageLogger",
173  cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')),
174  destinations = cms.untracked.vstring('cout')
175  )
176 
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)
182  )
183 
184 # Write different time-types tags depending on the O2O mode
185 if options.mode == 'endFill':
186  timetype = 'timestamp'
187 else:
188  timetype = 'lumiid'
189 
190 if options.mode == "endFill":
191  process.PoolDBOutputService = cms.Service("PoolDBOutputService",
192  CondDBConnection,
193  timetype = cms.untracked.string(timetype),
194  toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerLSRcd'),
195  tag = cms.string( options.tag )
196  )
197  )
198  )
199 else:
200  process.OnlineDBOutputService = cms.Service("OnlineDBOutputService",
201  CondDBConnection,
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 "" ),
208  # runNumber = cms.untracked.uint64(384468), #not used in production, the last LS processed is set as the 1st LS of this
209  #run if the omsServiceUrl is empty and file specified in lastLumiFile is empty
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)
216  )),
217  frontierKey = cms.untracked.string(options.frontierKey)
218 )
219 
220 
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'),
226  Source = cms.PSet(
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), # Additional logs
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),
244  ),
245  loggingOn = cms.untracked.bool(True),
246  IsDestDbCheckedInQueryLog = cms.untracked.bool(False)
247  )
248 
249 process.p = cms.Path(process.Test1)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19