Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:30

0001 '''
0002 This file is an example configuration of the SiStripPayloadCopyAndExclude module.
0003 This module is meant to copy the content of a SiStrip APV Gain payload (either G1 or G2) 
0004 from a local sqlite file (that should be feeded to the Event Setup via the SiStripApvGain3Rcd  
0005 and put in another local sqlite file, excepted for the modules specified in the excludedModules 
0006 parameter. If the doReverse parameter is true, the opposite action is performed. 
0007 '''
0008 
0009 import FWCore.ParameterSet.Config as cms
0010 import FWCore.ParameterSet.VarParsing as VarParsing
0011 
0012 process = cms.Process("SiStripPayloadCopyAndExclude")
0013 
0014 options = VarParsing.VarParsing("analysis")
0015 
0016 options.register ('globalTag',
0017                   "101X_dataRun2_Express_v7",
0018                   VarParsing.VarParsing.multiplicity.singleton,  # singleton or list
0019                   VarParsing.VarParsing.varType.string,          # string, int, or float
0020                   "GlobalTag")
0021 
0022 options.register ('runNumber',
0023                   317478,
0024                   VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0025                   VarParsing.VarParsing.varType.int,            # string, int, or float
0026                   "run number")
0027 
0028 options.register ('doReverse',
0029                   False,
0030                   VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0031                   VarParsing.VarParsing.varType.bool,           # string, int, or float
0032                   "reverse the selection")
0033 
0034 options.parseArguments()
0035 
0036 
0037 if(options.doReverse): 
0038     print("====================================================================================================================================")
0039     print("%MSG-i DoReverse: : Going to revert the selection. All modules will be taken from GT, unless they are specified in the modules list!")
0040     print("====================================================================================================================================")
0041 
0042 ##
0043 ## Messages
0044 ##
0045 process.load("FWCore.MessageService.MessageLogger_cfi")
0046 
0047 ##
0048 ## Event Source
0049 ##
0050 process.source = cms.Source("EmptyIOVSource",
0051                             firstValue = cms.uint64(options.runNumber),
0052                             lastValue  = cms.uint64(options.runNumber),
0053                             timetype  = cms.string('runnumber'),
0054                             interval = cms.uint64(1)
0055                             )
0056 
0057 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )
0058 
0059 ##
0060 ## Conditions inputs
0061 ##
0062 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0063 from Configuration.AlCa.GlobalTag import GlobalTag
0064 process.GlobalTag = GlobalTag(process.GlobalTag,options.globalTag, '')
0065 process.GlobalTag.toGet = cms.VPSet(
0066     cms.PSet(record = cms.string("SiStripApvGain3Rcd"),
0067              tag = cms.string("SiStripApvGainAAG_pcl"),
0068              #connect = cms.string("sqlite_file:/eos/cms/store/group/alca_global/multiruns/results/prod//slc6_amd64_gcc630/CMSSW_10_1_5/86791_1p_0f/promptCalibConditions86791.db")             
0069              connect = cms.string("sqlite_file:promptCalibConditions86791.db") # locally copied file for unit test
0070              )
0071     )
0072 
0073 ##
0074 ## Worker module
0075 ##
0076 process.SiStripGainPayloadCopyAndExclude = cms.EDAnalyzer('SiStripGainPayloadCopyAndExclude',
0077                                                           ### FED 387
0078                                                           excludedModules = cms.untracked.vuint32(436281608,436281604,436281592,436281624,436281620,436281644,436281640,436281648,436281668,436281680,436281684,436281688,436281720,436281700,436281708,436281556,436281552,436281704,436281764,436281768,436281572,436281576,436281748,436281744,436281740,436281780,436281784,436281612,436281616,436281588,436281580,436281584,436281636,436281656,436281652,436281676,436281672,436281732,436281736,436281716,436281712,436281776,436281772,436281548,436281544,436281540,436281752,436281560),
0079                                                           reverseSelection = cms.untracked.bool(options.doReverse),  # if True it will take everything from GT, but the execludedModules from the Gain3 tag 
0080                                                           record   = cms.untracked.string("SiStripApvGainRcd"),
0081                                                           gainType = cms.untracked.uint32(1) # 0 for G1, 1 for G2
0082 )
0083 
0084 ##
0085 ## Output database (in this case local sqlite file)
0086 ##
0087 process.load("CondCore.CondDB.CondDB_cfi")
0088 process.CondDB.connect = "sqlite_file:modifiedGains_"+process.GlobalTag.globaltag._value+'_IOV_'+str(options.runNumber)+("_reverse.db" if options.doReverse else ".db")
0089 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0090                                           process.CondDB,
0091                                           timetype = cms.untracked.string('runnumber'),
0092                                           toPut = cms.VPSet(cms.PSet(record = cms.string('SiStripApvGainRcd'),
0093                                                                      tag = cms.string('modifiedGains')
0094                                                                      )
0095                                                             )
0096 )
0097 
0098 process.p = cms.Path(process.SiStripGainPayloadCopyAndExclude)