CMS 3D CMS Logo

BeamSpotOnlineAnalyzerStartRun.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("BeamSpotOnlineStartRun")
5 from CondCore.CondDB.CondDB_cfi import *
6 
8 options.register( 'destinationConnection'
9  , 'sqlite_file:beamspot_test.db' #default value
10  , VarParsing.VarParsing.multiplicity.singleton
11  , VarParsing.VarParsing.varType.string
12  , "Connection string to the DB where payloads will be possibly written."
13  )
14 options.register( 'targetConnection'
15  , '' #default value
16  , VarParsing.VarParsing.multiplicity.singleton
17  , VarParsing.VarParsing.varType.string
18  , """Connection string to the target DB:
19  if not empty (default), this provides the latest IOV and payloads to compare;
20  it is the DB where payloads should be finally uploaded."""
21  )
22 options.register( 'tag'
23  , 'beamspot_test'
24  , VarParsing.VarParsing.multiplicity.singleton
25  , VarParsing.VarParsing.varType.string
26  , "Tag written in destinationConnection and finally appended in targetConnection."
27  )
28 options.register( 'sourceTag'
29  , ''
30  , VarParsing.VarParsing.multiplicity.singleton
31  , VarParsing.VarParsing.varType.string
32  , "Tag used to retrieve the source payload from the targetConnection."
33  )
34 options.register( 'runNumber'
35  , 1 #default value
36  , VarParsing.VarParsing.multiplicity.singleton
37  , VarParsing.VarParsing.varType.int
38  , "Run number for the target since."
39  )
40 options.register( 'messageLevel'
41  , 0 #default value
42  , VarParsing.VarParsing.multiplicity.singleton
43  , VarParsing.VarParsing.varType.int
44  , "Message level; default to 0"
45  )
46 options.parseArguments()
47 
48 CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
49 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
50 
51 process.MessageLogger = cms.Service("MessageLogger",
52  cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')),
53  destinations = cms.untracked.vstring('cout')
54  )
55 
56 process.source = cms.Source("EmptyIOVSource",
57  lastValue = cms.uint64(1),
58  timetype = cms.string('runnumber'),
59  firstValue = cms.uint64(1),
60  interval = cms.uint64(1)
61  )
62 
63 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
64  CondDBConnection,
65  timetype = cms.untracked.string('lumiid'),
66  toPut = cms.VPSet(cms.PSet(record = cms.string('BeamSpotRcd'),
67  tag = cms.string( options.tag )
68  )
69  )
70  )
71 
72 process.PopCon = cms.EDAnalyzer("BeamSpotOnlinePopConAnalyzer",
73  SinceAppendMode = cms.bool(True),
74  record = cms.string('BeamSpotRcd'),
75  name = cms.untracked.string('BeamSpotOnline'),
76  Source = cms.PSet(
77  runNumber = cms.untracked.uint32( options.runNumber ),
78  sourcePayloadTag = cms.untracked.string( options.sourceTag ),
79  # maxAge = one day in seconds
80  maxAge = cms.untracked.uint32( 86400 ),
81  debug=cms.untracked.bool(False)
82  ),
83  loggingOn = cms.untracked.bool(True),
84  IsDestDbCheckedInQueryLog = cms.untracked.bool(False)
85  )
86 
87 process.p = cms.Path(process.PopCon)