Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-10 02:50:45

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 
0005 process = cms.Process("Demo")
0006 
0007 #prepare options
0008 
0009 options = VarParsing.VarParsing("analysis")
0010 
0011 options.register ('globalTag',
0012                   "auto:run2_data",
0013                   VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0014                   VarParsing.VarParsing.varType.string,          # string, int, or float
0015                   "GlobalTag")
0016 
0017 options.register ('runNumber',
0018                   303014,
0019                   VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0020                   VarParsing.VarParsing.varType.int,           # string, int, or float
0021                   "run number")
0022 
0023 options.parseArguments()
0024 
0025 
0026 ##
0027 ## MessageLogger
0028 ##
0029 process.load('FWCore.MessageService.MessageLogger_cfi')   
0030 process.MessageLogger.cerr.enable = False
0031 process.MessageLogger.SiStripChannelGainFromDBMiscalibrator=dict()  
0032 process.MessageLogger.cout = cms.untracked.PSet(
0033     enable    = cms.untracked.bool(True),
0034     enableStatistics = cms.untracked.bool(True),
0035     threshold = cms.untracked.string("WARNING"),
0036     default   = cms.untracked.PSet(limit = cms.untracked.int32(0)),                       
0037     FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0038                                    reportEvery = cms.untracked.int32(1000)
0039                                    ),                                                      
0040     SiStripChannelGainFromDBMiscalibrator  = cms.untracked.PSet( limit = cms.untracked.int32(-1))
0041     )
0042 
0043 process.load("Configuration.Geometry.GeometryRecoDB_cff") # Ideal geometry and interface 
0044 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0045 from Configuration.AlCa.GlobalTag import GlobalTag
0046 process.GlobalTag = GlobalTag(process.GlobalTag,options.globalTag, '')
0047 
0048 print("Using Global Tag:", process.GlobalTag.globaltag._value)
0049 
0050 ##
0051 ## Empty Source
0052 ##
0053 process.source = cms.Source("EmptySource",
0054                             firstRun = cms.untracked.uint32(options.runNumber),
0055                             numberEventsInRun = cms.untracked.uint32(1),
0056                             )
0057 
0058 
0059 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )
0060 
0061 ##
0062 ## Example smearing configurations
0063 ##
0064 
0065 ##
0066 ## separately partition by partition
0067 ##
0068 byPartition = cms.VPSet(
0069     cms.PSet(partition = cms.string("TIB"),
0070              doScale   = cms.bool(True),
0071              doSmear   = cms.bool(True),
0072              scaleFactor = cms.double(1.1),
0073              smearFactor = cms.double(0.2)
0074              ),
0075     cms.PSet(partition = cms.string("TOB"),
0076              doScale   = cms.bool(True),
0077              doSmear   = cms.bool(True),
0078              scaleFactor = cms.double(1.2),
0079              smearFactor = cms.double(0.15)
0080              ),
0081     cms.PSet(partition = cms.string("TID"),
0082              doScale   = cms.bool(True),
0083              doSmear   = cms.bool(True),
0084              scaleFactor = cms.double(1.3),
0085              smearFactor = cms.double(0.10)
0086              ),
0087     cms.PSet(partition = cms.string("TEC"),
0088              doScale   = cms.bool(True),
0089              doSmear   = cms.bool(True),
0090              scaleFactor = cms.double(1.4),
0091              smearFactor = cms.double(0.05)
0092              )
0093     )
0094 
0095 ##
0096 ## whole Strip tracker
0097 ##
0098 
0099 wholeTracker = cms.VPSet(
0100     cms.PSet(partition = cms.string("Tracker"),
0101              doScale   = cms.bool(True),
0102              doSmear   = cms.bool(True),
0103              scaleFactor = cms.double(1.15),
0104              smearFactor = cms.double(0.05)
0105              )
0106     )
0107 
0108 
0109 ##
0110 ## down the hierarchy (Tracker,Subdetector,Side,Layer(Wheel)
0111 ##
0112 
0113 subsets =  cms.VPSet(
0114     cms.PSet(partition = cms.string("Tracker"),
0115              doScale   = cms.bool(True),
0116              doSmear   = cms.bool(True),
0117              scaleFactor = cms.double(0.65),
0118              smearFactor = cms.double(0.05)
0119              ),
0120     cms.PSet(partition = cms.string("TEC"),
0121              doScale   = cms.bool(True),
0122              doSmear   = cms.bool(True),
0123              scaleFactor = cms.double(1.15),
0124              smearFactor = cms.double(0.02)
0125              ),
0126     cms.PSet(partition = cms.string("TECP"),
0127              doScale   = cms.bool(True),
0128              doSmear   = cms.bool(True),
0129              scaleFactor = cms.double(1.35),
0130              smearFactor = cms.double(0.02)
0131              ),
0132     cms.PSet(partition = cms.string("TECP_9"),
0133              doScale   = cms.bool(True),
0134              doSmear   = cms.bool(True),
0135              scaleFactor = cms.double(1.55),
0136              smearFactor = cms.double(0.02)
0137              )
0138     )
0139 
0140 
0141 # process.demo = cms.EDAnalyzer('SiStripChannelGainFromDBMiscalibrator',
0142 #                               record = cms.untracked.string("SiStripApvGainRcd"),
0143 #                               gainType = cms.untracked.uint32(1), #0 for G1, 1 for G2
0144 #                               params = subsets, # as a cms.VPset
0145 #                               saveMaps = cms.bool(True)      
0146 #                               )
0147 
0148 process.load("CondTools.SiStrip.scaleAndSmearSiStripGains_cfi")
0149 process.scaleAndSmearSiStripGains.gainType = 1        # 0 for G1, 1 for G2
0150 process.scaleAndSmearSiStripGains.params   = subsets  # as a cms.VPset
0151 
0152 ##
0153 ## Output database (in this case local sqlite file)
0154 ##
0155 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0156     BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'),
0157     DBParameters = cms.PSet(
0158         messageLevel = cms.untracked.int32(3),
0159         authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb')
0160     ),
0161     timetype = cms.untracked.string('runnumber'),
0162     connect = cms.string('sqlite_file:modifiedSiStripGains_%s_IOV_%s.db' % ( process.GlobalTag.globaltag._value, str(options.runNumber))),
0163     toPut = cms.VPSet(cms.PSet(
0164         record = cms.string('SiStripApvGainRcd'),
0165         tag = cms.string('modifiedGains')
0166     ))
0167 )
0168 
0169 process.p = cms.Path(process.scaleAndSmearSiStripGains)