Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:06

0001 import socket
0002 import time
0003 import FWCore.ParameterSet.Config as cms
0004 import FWCore.ParameterSet.VarParsing as VarParsing
0005 from CondCore.CondDB.CondDB_cfi import *
0006 from Configuration.AlCa.autoCond import autoCond
0007 
0008 options = VarParsing.VarParsing()
0009 options.register('connectionString',
0010                  'frontier://FrontierProd/CMS_CONDITIONS', #default value
0011                  VarParsing.VarParsing.multiplicity.singleton,
0012                  VarParsing.VarParsing.varType.string,
0013                  "GlobalTag Connection string")
0014 options.register('globalTag',
0015                  autoCond['run2_data'], #default value
0016                  VarParsing.VarParsing.multiplicity.singleton,
0017                  VarParsing.VarParsing.varType.string,
0018                  "GlobalTag")
0019 options.register( 'runNumber'
0020                 , 1 #default value
0021                 , VarParsing.VarParsing.multiplicity.singleton
0022                 , VarParsing.VarParsing.varType.int
0023                 , "Run number to be uploaded."
0024                   )
0025 options.register( 'destinationConnection'
0026                 , 'sqlite_file:EcalADCToGeVConstant_EDAnalyzer_test.db' #default value
0027                 , VarParsing.VarParsing.multiplicity.singleton
0028                 , VarParsing.VarParsing.varType.string
0029                 , "Connection string to the DB where payloads will be possibly written."
0030                   )
0031 options.register( 'tag'
0032                 , 'EcalADCToGeVConstant_EDAnalyzer_test'
0033                 , VarParsing.VarParsing.multiplicity.singleton
0034                 , VarParsing.VarParsing.varType.string
0035                 , "Tag written in destinationConnection and finally appended onto the tag in connectionString."
0036                   )
0037 options.register( 'currentThreshold'
0038                 , 18000.
0039                 , VarParsing.VarParsing.multiplicity.singleton
0040                 , VarParsing.VarParsing.varType.float
0041                 , "The threshold on the magnet current for considering a switch of the magnetic field."
0042                   )
0043 options.register( 'messageLevel'
0044                 , 0 #default value
0045                 , VarParsing.VarParsing.multiplicity.singleton
0046                 , VarParsing.VarParsing.varType.int
0047                 , "Message level; default to 0."
0048                   )
0049 options.parseArguments()
0050 
0051 CondDBConnection = CondDB.clone( connect = cms.string( options.connectionString ) )
0052 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
0053 DestConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
0054 DestConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
0055 
0056 process = cms.Process( "EcalADCToGeVConstantWriter" )
0057 
0058 process.MessageLogger = cms.Service( "MessageLogger"
0059                                    , destinations = cms.untracked.vstring( 'cout' )
0060                                    , cout = cms.untracked.PSet( threshold = cms.untracked.string( 'INFO' ) )
0061                                      )
0062 
0063 if options.messageLevel == 3:
0064     #enable LogDebug output: remember the USER_CXXFLAGS="-DEDM_ML_DEBUG" compilation flag!
0065     process.MessageLogger.cout = cms.untracked.PSet( threshold = cms.untracked.string( 'DEBUG' ) )
0066     process.MessageLogger.debugModules = cms.untracked.vstring( '*' )
0067 
0068 process.source = cms.Source( "EmptySource",
0069                              firstRun = cms.untracked.uint32( options.runNumber ),
0070                              firstTime = cms.untracked.uint64( ( long( time.time() ) - 24 * 3600 ) << 32 ), #24 hours ago in nanoseconds
0071                              numberEventsInRun = cms.untracked.uint32( 1 ),
0072                              numberEventsInLuminosityBlock = cms.untracked.uint32( 1 )
0073                              )
0074 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32( 1 ) )
0075 
0076 process.GlobalTag = cms.ESSource( "PoolDBESSource",
0077                                   CondDBConnection,
0078                                   globaltag = cms.string( options.globalTag ),
0079                                   toGet = cms.VPSet()
0080                                   )
0081 process.GlobalTag.toGet.append( cms.PSet( record = cms.string( "EcalADCToGeVConstantRcd" ),
0082                                           label = cms.untracked.string( "0T" ),
0083                                           tag = cms.string( "EcalADCToGeVConstant_0T_test0" ),
0084                                           connect = cms.string( "frontier://FrontierPrep/CMS_CONDITIONS" ),
0085                                           )
0086                                 )
0087 process.GlobalTag.toGet.append( cms.PSet( record = cms.string( "EcalADCToGeVConstantRcd" ),
0088                                           label = cms.untracked.string( "38T" ),
0089                                           tag = cms.string( "EcalADCToGeVConstant_3.8T_test0" ),
0090                                           connect = cms.string( "frontier://FrontierPrep/CMS_CONDITIONS" ),
0091                                           )
0092                                 )
0093 
0094 process.PoolDBOutputService = cms.Service( "PoolDBOutputService"
0095                                          , DestConnection
0096                                          , timetype = cms.untracked.string( 'runnumber' )
0097                                          , toPut = cms.VPSet( cms.PSet( record = cms.string( 'EcalADCToGeVConstantRcd' )
0098                                                                       , tag = cms.string( options.tag )
0099                                                                         )
0100                                                               )
0101                                           )
0102 
0103 process.ecalADCToGeVConstantBTransition = cms.EDAnalyzer( "EcalADCToGeVConstantBTransitionAnalyzer"
0104                                                         , currentThreshold = cms.untracked.double( options.currentThreshold )
0105                                                           )
0106 
0107 process.p = cms.Path( process.ecalADCToGeVConstantBTransition )