Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-06 06:06:23

0001 #! /usr/bin/env cmsRun
0002 # Author: Marco Musich (Feb 2022)
0003 import FWCore.ParameterSet.Config as cms
0004 import FWCore.ParameterSet.VarParsing as VarParsing
0005 
0006 ###################################################################
0007 # Set default phase-2 settings
0008 ###################################################################
0009 import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
0010 _PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
0011 
0012 process = cms.Process("TEST", _PH2_ERA)
0013 options = VarParsing.VarParsing('analysis')
0014 options.register('fromESSource',
0015                  False, # default value
0016                  VarParsing.VarParsing.multiplicity.singleton,
0017                  VarParsing.VarParsing.varType.bool,
0018                  "Populate SiPhase2OuterTrackerBadStripRcd from the ESSource")
0019 options.parseArguments()
0020 
0021 ###################################################################
0022 # Messages
0023 ###################################################################
0024 process.load('FWCore.MessageService.MessageLogger_cfi')   
0025 process.MessageLogger.cerr.enable = False
0026 process.MessageLogger.SiPhase2BadStripChannelReader=dict()  
0027 process.MessageLogger.SiStripBadStrip=dict()
0028 process.MessageLogger.SiPhase2BadStripConfigurableFakeESSource=dict()
0029 process.MessageLogger.cout = cms.untracked.PSet(
0030     enable    = cms.untracked.bool(True),
0031     enableStatistics = cms.untracked.bool(True),
0032     threshold = cms.untracked.string("INFO"),
0033     default   = cms.untracked.PSet(limit = cms.untracked.int32(0)),                       
0034     FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0035                                    reportEvery = cms.untracked.int32(1000)
0036                                    ),                                                      
0037     SiPhase2BadStripChannelReader = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0038     SiStripBadStrip = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0039     SiPhase2BadStripConfigurableFakeESSource = cms.untracked.PSet( limit = cms.untracked.int32(-1))
0040 )
0041 
0042 ###################################################################
0043 # A data source must always be defined.
0044 # We don't need it, so here's a dummy one.
0045 ###################################################################
0046 process.source = cms.Source("EmptyIOVSource",
0047     timetype = cms.string('runnumber'),
0048     firstValue = cms.uint64(1),
0049     lastValue = cms.uint64(1),
0050     interval = cms.uint64(1)
0051 )
0052 
0053 ###################################################################
0054 # Input data
0055 ###################################################################
0056 if(options.fromESSource): 
0057     process.load("Configuration.Geometry.GeometryExtendedRun4Default_cff")
0058     process.load('Configuration.Geometry.GeometryExtendedRun4DefaultReco_cff')
0059     process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0060     from Configuration.AlCa.GlobalTag import GlobalTag
0061     process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '')
0062     #process.load("SLHCUpgradeSimulations.Geometry.fakePhase2OuterTrackerConditions_cff") # already included
0063     #process.SiPhase2OTFakeBadStripsESSource.printDebug = cms.untracked.bool(True)    # this makes it verbose 
0064     process.SiPhase2OTFakeBadStripsESSource.badComponentsFraction = cms.double(0.05)   # bad components fraction is 5%
0065 else:
0066     tag = 'SiStripBadStripPhase2_T33'
0067     suffix = 'v0'
0068     inFile = tag+'_'+suffix+'.db'
0069     inDB = 'sqlite_file:'+inFile
0070     
0071     process.load("CondCore.CondDB.CondDB_cfi")
0072     # input database (in this case the local sqlite file)
0073     process.CondDB.connect = inDB
0074     
0075     process.PoolDBESSource = cms.ESSource("PoolDBESSource",
0076                                           process.CondDB,
0077                                           DumpStat=cms.untracked.bool(True),
0078                                           toGet = cms.VPSet(cms.PSet(#record = cms.string("SiStripBadStripRcd"),
0079                                                                      record = cms.string("SiPhase2OuterTrackerBadStripRcd"),
0080                                                                      tag = cms.string(tag))))
0081     
0082 ###################################################################
0083 # check the ES data getter
0084 ###################################################################
0085 process.get = cms.EDAnalyzer("EventSetupRecordDataGetter",
0086     toGet = cms.VPSet(cms.PSet(
0087         #record = cms.string('SiStripBadStripRcd'),
0088         record = cms.string('SiPhase2OuterTrackerBadStripRcd'),
0089         data = cms.vstring('SiStripBadStrip')
0090     )),
0091     verbose = cms.untracked.bool(True)
0092 )
0093 
0094 ###################################################################
0095 # Payload reader
0096 ###################################################################
0097 import CondTools.SiPhase2Tracker.siPhase2BadStripChannelReader_cfi as _mod
0098 process.BadStripPayloadReader = _mod.siPhase2BadStripChannelReader.clone(printDebug = 1,
0099                                                                          printVerbose = False,
0100                                                                          label = "")
0101 
0102 ###################################################################
0103 # Path
0104 ###################################################################
0105 process.p = cms.Path(process.get+process.BadStripPayloadReader)