Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-25 02:29:25

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