-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38280 from forthommel/pps-direct_simu_stdseq-12_5_X
[PPS] Direct simulation as sequence
- Loading branch information
Showing
47 changed files
with
722 additions
and
760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...on/Eras/python/Modifier_ctpps_2021_cff.py → ...on/Eras/python/Modifier_ctpps_2022_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
ctpps_2021 = cms.Modifier() | ||
ctpps_2022 = cms.Modifier() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
def setupPPSDirectSim(process): | ||
process.load('SimPPS.Configuration.directSimPPS_cff') | ||
process.load('RecoPPS.Configuration.recoCTPPS_cff') | ||
if not hasattr(process, 'RandomNumberGeneratorService'): | ||
process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService") | ||
if not hasattr(process.RandomNumberGeneratorService, 'beamDivergenceVtxGenerator'): | ||
process.RandomNumberGeneratorService.beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849)) | ||
if not hasattr(process.RandomNumberGeneratorService, 'ppsDirectProtonSimulation'): | ||
process.RandomNumberGeneratorService.ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) | ||
process.ppsDirectSim = cms.Path(process.directSimPPS * process.recoDirectSimPPS) | ||
process.schedule.append(process.ppsDirectSim) | ||
|
||
from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputs | ||
matchDirectSimOutputs(process) | ||
return process | ||
|
||
def setupPPSDirectSimAOD(process): | ||
setupPPSDirectSim(process) | ||
from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputsAOD | ||
matchDirectSimOutputsAOD(process) | ||
return process | ||
|
||
def setupPPSDirectSimMiniAOD(process): | ||
setupPPSDirectSim(process) | ||
from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputsMiniAOD | ||
matchDirectSimOutputsMiniAOD(process) | ||
return process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from Configuration.StandardSequences.Eras import eras | ||
from SimPPS.DirectSimProducer.ppsDirectProtonSimulation_cff import * | ||
|
||
directSimPPSTask = cms.Task( | ||
beamDivergenceVtxGenerator, | ||
ppsDirectProtonSimulation | ||
) | ||
|
||
directSimPPS = cms.Sequence(directSimPPSTask) | ||
|
||
def unshiftVertex(process, smearingParams): | ||
"""Undo vertex smearing using the parameters used for the sample production""" | ||
if not hasattr(process, 'ctppsBeamParametersFromLHCInfoESSource'): | ||
return | ||
from importlib import import_module | ||
_params = import_module('IOMC.EventVertexGenerators.VtxSmearedParameters_cfi') | ||
if not hasattr(_params, smearingParams): | ||
raise ImportError('Failed to import {} from vertex smearing parameters!'.format(smearingParams)) | ||
_params = getattr(_params, smearingParams) | ||
process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetX45 = cms.double(-_params.X0.value()) | ||
process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetY45 = cms.double(-_params.Y0.value()) | ||
process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetZ45 = cms.double(-_params.Z0.value()) | ||
|
||
# modify according to era | ||
|
||
def _modify2016(process): | ||
print('Process customised for 2016 PPS era') | ||
process.load('SimPPS.DirectSimProducer.simPPS2016_cfi') | ||
unshiftVertex(process, 'Realistic25ns13TeV2016CollisionVtxSmearingParameters') | ||
|
||
def _modify2017(process): | ||
print('Process customised for 2017 PPS era') | ||
process.load('SimPPS.DirectSimProducer.simPPS2017_cfi') | ||
unshiftVertex(process, 'Realistic25ns13TeVEarly2017CollisionVtxSmearingParameters') | ||
|
||
def _modify2018(process): | ||
print('Process customised for 2018 PPS era') | ||
process.load('SimPPS.DirectSimProducer.simPPS2018_cfi') | ||
unshiftVertex(process, 'Realistic25ns13TeVEarly2018CollisionVtxSmearingParameters') | ||
|
||
def _modify2022(process): | ||
print('Process customised for 2022 PPS era') | ||
process.load('SimPPS.DirectSimProducer.simPPS2022_cfi') | ||
if hasattr(process, 'generator'): | ||
process.generator.energy = process.profile_2022_default.ctppsLHCInfo.beamEnergy | ||
if hasattr(process, 'ctppsGeometryESModule'): | ||
# replaced by the composite ESSource | ||
delattr(process, 'ctppsGeometryESModule') | ||
|
||
modifyConfigurationStandardSequencesFor2016_ = eras.ctpps_2016.makeProcessModifier(_modify2016) | ||
modifyConfigurationStandardSequencesFor2017_ = eras.ctpps_2017.makeProcessModifier(_modify2017) | ||
modifyConfigurationStandardSequencesFor2018_ = eras.ctpps_2018.makeProcessModifier(_modify2018) | ||
modifyConfigurationStandardSequencesFor2022_ = eras.ctpps_2022.makeProcessModifier(_modify2022) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<use name="CondFormats/DataRecord"/> | ||
<use name="CondFormats/RunInfo"/> | ||
<use name="Geometry/VeryForwardGeometryBuilder"/> | ||
<use name="Geometry/VeryForwardRPTopology"/> | ||
<use name="SimDataFormats/GeneratorProducts"/> | ||
<use name="rootcore"/> | ||
<library name="SimPPSDirectSimProducerPlugins" file="*.cc"> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
def matchDirectSimOutputs(process, AOD=False, miniAOD=False): | ||
# match sources of rechits with direct simulation outputs | ||
process.totemRPUVPatternFinder.tagRecHit = cms.InputTag('ppsDirectProtonSimulation') | ||
process.ctppsPixelLocalTracks.tag = cms.InputTag('ppsDirectProtonSimulation') | ||
process.ctppsDiamondLocalTracks.recHitsTag = cms.InputTag('ppsDirectProtonSimulation') | ||
# handle clashes between simulation and GT conditions | ||
process.es_prefer_composrc = cms.ESPrefer('CTPPSCompositeESSource', 'ctppsCompositeESSource') | ||
process.es_prefer_pixtopo = cms.ESPrefer('PPSPixelTopologyESSource', 'ppsPixelTopologyESSource') | ||
process.es_prefer_lhcinfo = cms.ESPrefer('CTPPSBeamParametersFromLHCInfoESSource', 'ctppsBeamParametersFromLHCInfoESSource') | ||
process.es_prefer_assocuts = cms.ESPrefer('PPSAssociationCutsESSource', 'ppsAssociationCutsESSource') | ||
return process | ||
|
||
def matchDirectSimOutputsAOD(process): | ||
matchDirectSimOutputs(process) | ||
process.beamDivergenceVtxGenerator.src = cms.InputTag('') | ||
process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( | ||
cms.InputTag('genPUProtons', 'genPUProtons'), | ||
cms.InputTag('genParticles') | ||
) | ||
return process | ||
|
||
def matchDirectSimOutputsMiniAOD(process): | ||
matchDirectSimOutputs(process) | ||
process.beamDivergenceVtxGenerator.src = cms.InputTag('') | ||
process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( | ||
cms.InputTag('genPUProtons', 'genPUProtons'), | ||
cms.InputTag('prunedGenParticles') | ||
) | ||
return process |
Oops, something went wrong.