Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-08-04 22:45:30

0001 import FWCore.ParameterSet.Config as cms
0002 from Configuration.StandardSequences.Eras import eras
0003 from SimPPS.DirectSimProducer.ppsDirectProtonSimulation_cff import *
0004 
0005 directSimPPSTask = cms.Task(
0006     beamDivergenceVtxGenerator,
0007     ppsDirectProtonSimulation
0008 )
0009 
0010 directSimPPS = cms.Sequence(directSimPPSTask)
0011 
0012 def unshiftVertex(process, smearingParams):
0013     """Undo vertex smearing using the parameters used for the sample production"""
0014     if not hasattr(process, 'ctppsBeamParametersFromLHCInfoESSource'):
0015         return
0016     from importlib import import_module
0017     _params = import_module('IOMC.EventVertexGenerators.VtxSmearedParameters_cfi')
0018     if not hasattr(_params, smearingParams):
0019         raise ImportError('Failed to import {} from vertex smearing parameters!'.format(smearingParams))
0020     _params = getattr(_params, smearingParams)
0021     process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetX45 = cms.double(-_params.X0.value())
0022     process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetY45 = cms.double(-_params.Y0.value())
0023     process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetZ45 = cms.double(-_params.Z0.value())
0024 
0025 # modify according to era
0026 
0027 def _modify2016(process):
0028     print('Process customised for 2016 PPS era')
0029     process.load('SimPPS.DirectSimProducer.simPPS2016_cfi')
0030     unshiftVertex(process, 'Realistic25ns13TeV2016CollisionVtxSmearingParameters')
0031 
0032 def _modify2017(process):
0033     print('Process customised for 2017 PPS era')
0034     process.load('SimPPS.DirectSimProducer.simPPS2017_cfi')
0035     unshiftVertex(process, 'Realistic25ns13TeVEarly2017CollisionVtxSmearingParameters')
0036 
0037 def _modify2018(process):
0038     print('Process customised for 2018 PPS era')
0039     process.load('SimPPS.DirectSimProducer.simPPS2018_cfi')
0040     unshiftVertex(process, 'Realistic25ns13TeVEarly2018CollisionVtxSmearingParameters')
0041 
0042 def _modify2022(process):
0043     print('Process customised for 2022 PPS era')
0044     process.load('SimPPS.DirectSimProducer.simPPS2022_cfi')
0045     if hasattr(process, 'generator'):
0046         process.generator.energy = process.profile_2022_default.ctppsLHCInfo.beamEnergy
0047     if hasattr(process, 'ctppsGeometryESModule'):
0048         # replaced by the composite ESSource
0049         delattr(process, 'ctppsGeometryESModule')
0050 
0051 modifyConfigurationStandardSequencesFor2016_ = eras.ctpps_2016.makeProcessModifier(_modify2016)
0052 modifyConfigurationStandardSequencesFor2017_ = eras.ctpps_2017.makeProcessModifier(_modify2017)
0053 modifyConfigurationStandardSequencesFor2018_ = eras.ctpps_2018.makeProcessModifier(_modify2018)
0054 modifyConfigurationStandardSequencesFor2022_ = eras.ctpps_2022.makeProcessModifier(_modify2022)