CMS 3D CMS Logo

LHCInfoPerFillPopConAnalyzer_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("LHCInfoPerFillPopulator")
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  , 'LHCInfoPerFill_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  )
66 options.register( 'ecalConnection'
67  , "oracle://cms_orcon_adg/CMS_DCS_ENV_PVSS_COND"
68  , VarParsing.VarParsing.multiplicity.singleton
69  , VarParsing.VarParsing.varType.string
70  , """ecal data source connection string"""
71  )
72 options.register( 'oms'
73  , "http://vocms0184.cern.ch/agg/api/v1"
74  , VarParsing.VarParsing.multiplicity.singleton
75  , VarParsing.VarParsing.varType.string
76  , """OMS base URL"""
77  )
78 
79 #duringFill mode specific:
80 options.register( 'lastLumiFile'
81  , ''
82  , VarParsing.VarParsing.multiplicity.singleton
83  , VarParsing.VarParsing.varType.string
84  , """duringFill only: path to file with lumiid to override the last lumisection processed by HLT.
85  Used for testing. Leave empty for production behaviour (getting this info from OMS)"""
86  )
87 options.register( 'frontierKey'
88  , ''
89  , VarParsing.VarParsing.multiplicity.singleton
90  , VarParsing.VarParsing.varType.string
91  , """duringFill only: run-unique key for writing with OnlinePopCon
92  (used for confirming proper upload)"""
93  )
94 
95 
96 # so far there was no need to use option, added just in case
97 options.register( 'authenticationPath'
98  , ""
99  , VarParsing.VarParsing.multiplicity.singleton
100  , VarParsing.VarParsing.varType.string
101  , """for now this option was always left empty"""
102  )
103 
104 options.parseArguments()
105 if options.mode is None:
106  raise ValueError("mode argument not provided. Supported modes are: duringFill endFill")
107 if options.mode not in ("duringFill", "endFill"):
108  raise ValueError("Wrong mode argument. Supported modes are: duringFill endFill")
109 
110 CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
111 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
112 CondDBConnection.DBParameters.authenticationPath = cms.untracked.string(options.authenticationPath)
113 
114 process.MessageLogger = cms.Service("MessageLogger",
115  cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')),
116  destinations = cms.untracked.vstring('cout')
117  )
118 
119 process.source = cms.Source("EmptyIOVSource",
120  lastValue = cms.uint64(1),
121  timetype = cms.string('runnumber'),
122  firstValue = cms.uint64(1),
123  interval = cms.uint64(1)
124  )
125 
126 # Write different time-types tags depending on the O2O mode
127 if options.mode == 'endFill':
128  timetype = 'timestamp'
129 else:
130  timetype = 'lumiid'
131 
132 if options.mode == "endFill":
133  process.PoolDBOutputService = cms.Service("PoolDBOutputService",
134  CondDBConnection,
135  timetype = cms.untracked.string(timetype),
136  toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerFillRcd'),
137  tag = cms.string( options.tag )
138  )
139  )
140  )
141 else:
142  process.OnlineDBOutputService = cms.Service("OnlineDBOutputService",
143  CondDBConnection,
144  preLoadConnectionString = cms.untracked.string('frontier://FrontierProd/CMS_CONDITIONS'
145  if not options.destinationConnection.startswith('sqlite')
146  else options.destinationConnection ),
147  lastLumiFile = cms.untracked.string(options.lastLumiFile),
148  omsServiceUrl = cms.untracked.string('http://cmsoms-eventing.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection'
149  if not options.lastLumiFile else "" ),
150  # runNumber = cms.untracked.uint64(384468), #not used in production, the last LS processed is set as the 1st LS of this
151  #run if the omsServiceUrl is empty and file specified in lastLumiFile is empty
152  latency = cms.untracked.uint32(2),
153  timetype = cms.untracked.string(timetype),
154  toPut = cms.VPSet(cms.PSet(
155  record = cms.string('LHCInfoPerFillRcd'),
156  tag = cms.string( options.tag ),
157  onlyAppendUpdatePolicy = cms.untracked.bool(True)
158  )),
159  frontierKey = cms.untracked.string(options.frontierKey)
160 )
161 
162 
163 process.Test1 = cms.EDAnalyzer("LHCInfoPerFillPopConAnalyzer" if options.mode == "endFill" else "LHCInfoPerFillOnlinePopConAnalyzer",
164  SinceAppendMode = cms.bool(True),
165  record = cms.string('LHCInfoPerFillRcd'),
166  name = cms.untracked.string('LHCInfo'),
167  Source = cms.PSet(
168  startTime = cms.untracked.string(options.startTime),
169  endTime = cms.untracked.string(options.endTime),
170  endFill = cms.untracked.bool(options.mode == "endFill"),
171  name = cms.untracked.string("LHCInfoPerFillPopConSourceHandler"),
172  connectionString = cms.untracked.string(options.sourceConnection),
173  ecalConnectionString = cms.untracked.string(options.ecalConnection),
174  omsBaseUrl = cms.untracked.string(options.oms),
175  authenticationPath = cms.untracked.string(options.authenticationPath),
176  debug=cms.untracked.bool(False)
177  ),
178  loggingOn = cms.untracked.bool(True),
179  IsDestDbCheckedInQueryLog = cms.untracked.bool(False)
180  )
181 
182 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