Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 
0004 ###################################################################
0005 # Set default phase-2 settings
0006 ###################################################################
0007 import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
0008 _PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
0009 
0010 process = cms.Process("TopologyAnalysis")
0011 options = VarParsing.VarParsing("analysis")
0012 
0013 options.register ('globalTag',
0014                   "auto:run2_data",
0015                   VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0016                   VarParsing.VarParsing.varType.string,          # string, int, or float
0017                  "GlobalTag")
0018 
0019 options.register ('runNumber',
0020                   1,
0021                   VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0022                   VarParsing.VarParsing.varType.int,          # string, int, or float
0023                   "run number")
0024 
0025 options.parseArguments()
0026 
0027 if 'phase2' in options.globalTag:
0028     if options.globalTag != _PH2_GLOBAL_TAG:
0029         raise KeyError(
0030             f"Global tag key given in input ('{options.globalTag}') mismatches the default ('{_PH2_GLOBAL_TAG}')."
0031         )
0032 
0033 ###################################################################
0034 # Message logger service
0035 ###################################################################
0036 process.load("FWCore.MessageService.MessageLogger_cfi")
0037 process.MessageLogger.cerr.FwkReport.reportEvery = 1
0038 
0039 ###################################################################
0040 # Geometry producer and standard includes
0041 ###################################################################
0042 process.load("Configuration.StandardSequences.Services_cff")
0043 
0044 if 'phase2' in options.globalTag:
0045     process.load("Configuration.Geometry.GeometryExtendedRun4Default_cff")
0046     process.load("Configuration.Geometry.GeometryExtendedRun4DefaultReco_cff")
0047 else:
0048     process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
0049 
0050 ####################################################################
0051 # Get the GlogalTag
0052 ####################################################################
0053 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0054 from Configuration.AlCa.GlobalTag import GlobalTag
0055 process.GlobalTag = GlobalTag(process.GlobalTag, options.globalTag, '')
0056 
0057 ###################################################################
0058 # Empty Source
0059 ###################################################################
0060 process.source = cms.Source("EmptySource",
0061                             firstRun = cms.untracked.uint32(options.runNumber),
0062                             numberEventsInRun = cms.untracked.uint32(1),
0063                             )
0064 
0065 process.maxEvents = cms.untracked.PSet(
0066     input = cms.untracked.int32(1)
0067 )
0068 
0069 ###################################################################
0070 # The analysis module
0071 ###################################################################
0072 process.myanalysis = cms.EDAnalyzer("PixelTopologyMapTest")
0073 
0074 ###################################################################
0075 # Path
0076 ###################################################################
0077 process.p1 = cms.Path(process.myanalysis)
0078