CMS 3D CMS Logo

RunInfoPopConAnalyzer.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 from CondCore.CondDB.CondDB_cfi import *
5 
6 sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R'
7 if socket.getfqdn().find('.cms') != -1:
8  sourceConnection = 'oracle://cms_omds_lb/CMS_RUNINFO_R'
9 
10 options = VarParsing.VarParsing()
11 options.register( 'runNumber'
12  , 1 #default value
13  , VarParsing.VarParsing.multiplicity.singleton
14  , VarParsing.VarParsing.varType.int
15  , "Run number to be uploaded."
16  )
17 options.register( 'destinationConnection'
18  , 'sqlite_file:RunInfo_PopCon_test.db' #default value
19  , VarParsing.VarParsing.multiplicity.singleton
20  , VarParsing.VarParsing.varType.string
21  , "Connection string to the DB where payloads will be possibly written."
22  )
23 options.register( 'targetConnection'
24  , '' #default value
25  , VarParsing.VarParsing.multiplicity.singleton
26  , VarParsing.VarParsing.varType.string
27  , """Connection string to the target DB:
28  if not empty (default), this provides the latest IOV and payloads to compare;
29  it is the DB where payloads should be finally uploaded."""
30  )
31 options.register( 'tag'
32  , 'RunInfo_PopCon_test'
33  , VarParsing.VarParsing.multiplicity.singleton
34  , VarParsing.VarParsing.varType.string
35  , "Tag written in destinationConnection and finally appended in targetConnection."
36  )
37 options.register( 'messageLevel'
38  , 0 #default value
39  , VarParsing.VarParsing.multiplicity.singleton
40  , VarParsing.VarParsing.varType.int
41  , "Message level; default to 0"
42  )
43 options.parseArguments()
44 
45 CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
46 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
47 
48 OMDSDBConnection = CondDB.clone( connect = cms.string( sourceConnection ) )
49 OMDSDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
50 
51 process = cms.Process( "RunInfoPopulator" )
52 
53 process.MessageLogger = cms.Service( "MessageLogger"
54  , destinations = cms.untracked.vstring( 'cout' )
55  , cout = cms.untracked.PSet( threshold = cms.untracked.string( 'INFO' ) )
56  )
57 
58 if options.messageLevel == 3:
59  #enable LogDebug output: remember the USER_CXXFLAGS="-DEDM_ML_DEBUG" compilation flag!
60  process.MessageLogger.cout = cms.untracked.PSet( threshold = cms.untracked.string( 'DEBUG' ) )
61  process.MessageLogger.debugModules = cms.untracked.vstring( '*' )
62 
63 process.source = cms.Source( "EmptyIOVSource"
64  , lastValue = cms.uint64( options.runNumber )
65  , timetype = cms.string( 'runnumber' )
66  , firstValue = cms.uint64( options.runNumber )
67  , interval = cms.uint64( 1 )
68  )
69 
70 process.PoolDBOutputService = cms.Service( "PoolDBOutputService"
71  , CondDBConnection
72  , timetype = cms.untracked.string( 'runnumber' )
73  , toPut = cms.VPSet( cms.PSet( record = cms.string( 'RunInfoRcd' )
74  , tag = cms.string( options.tag )
75  )
76  )
77  )
78 
79 process.popConRunInfo = cms.EDAnalyzer( "RunInfoPopConAnalyzer"
80  , SinceAppendMode = cms.bool( True )
81  , record = cms.string( 'RunInfoRcd' )
82  , Source = cms.PSet( OMDSDBConnection
83  , runNumber = cms.uint64( options.runNumber )
84  )
85  , loggingOn = cms.untracked.bool( True )
86  , targetDBConnectionString = cms.untracked.string( options.targetConnection )
87  )
88 
89 process.p = cms.Path( process.popConRunInfo )
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20