Skip to content

Commit 488044c

Browse files
authored
Merge pull request #49537 from mkirsano/fixresidualdecay
Fix residualDecay code and 3 test configurations in /test
2 parents c51d1ad + 076bfbf commit 488044c

File tree

4 files changed

+118
-4
lines changed

4 files changed

+118
-4
lines changed

GeneratorInterface/Pythia8Interface/plugins/Pythia8HepMC3Hadronizer.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,12 +1041,11 @@ bool Pythia8HepMC3Hadronizer::residualDecay() {
10411041
p->production_vertex()->position().t()));
10421042
prod_vtx0->add_particle_in(p);
10431043
(event3().get())->add_vertex(prod_vtx0);
1044-
HepMC3::GenParticle *pnew;
10451044
Pythia8::Event pyev = fDecayer->event;
10461045
double momFac = 1.;
10471046
for (int i = 2; i < pyev.size(); ++i) {
10481047
// Fill the particle.
1049-
pnew = new HepMC3::GenParticle(
1048+
HepMC3::GenParticlePtr pnew = make_shared<HepMC3::GenParticle>(
10501049
HepMC3::FourVector(
10511050
momFac * pyev[i].px(), momFac * pyev[i].py(), momFac * pyev[i].pz(), momFac * pyev[i].e()),
10521051
pyev[i].id(),

GeneratorInterface/Pythia8Interface/test/pythia8_photos_ZToTauTau_13TeV_cfg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
'23:onIfAny = 15',
4949
'TimeShower:mMaxGamma = 4.0',
5050
'TauDecays:externalMode = 0',
51-
'ParticleDecays:allowPhotonRadiation = on', # allow photons from hadron decays
51+
#'ParticleDecays:allowPhotonRadiation = on', # allow photons from hadron decays (OBSOLETE in pythia8316)
52+
'HadronLevel:QED = on', # allow photons from hadron decays
5253
'TimeShower:QEDshowerByL = off', # no photons from leptons
5354
'TimeShower:QEDshowerByOther = off', # no photons from W bosons
5455
),
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
from FWCore.ParameterSet.VarParsing import VarParsing
4+
options = VarParsing ('python')
5+
options.register('outFilename', 'particleLevel.root', VarParsing.multiplicity.singleton, VarParsing.varType.string, "Output file name")
6+
options.register('photos', 'off', VarParsing.multiplicity.singleton, VarParsing.varType.string, "ME corrections")
7+
options.register('lepton', 13, VarParsing.multiplicity.singleton, VarParsing.varType.int, "Lepton ID for Z decays")
8+
options.register('cutoff', 0.00011, VarParsing.multiplicity.singleton, VarParsing.varType.float, "IR cutoff")
9+
options.register('taufilter', 'off', VarParsing.multiplicity.singleton, VarParsing.varType.string, "Filter tau -> leptons")
10+
options.setDefault('maxEvents', 100)
11+
options.parseArguments()
12+
print(options)
13+
14+
process = cms.Process("PROD")
15+
16+
# import of standard configurations
17+
process.load('Configuration.StandardSequences.Services_cff')
18+
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
19+
process.load("FWCore.MessageLogger.MessageLogger_cfi")
20+
process.MessageLogger.cerr.FwkReport.reportEvery = int(options.maxEvents/100)
21+
22+
from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
23+
randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
24+
randSvc.populate()
25+
26+
# set input to process
27+
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) )
28+
29+
process.source = cms.Source("EmptySource")
30+
31+
from Configuration.Generator.Pythia8CommonSettings_cfi import *
32+
from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import *
33+
34+
process.generator = cms.EDFilter("Pythia8HepMC3GeneratorFilter",
35+
maxEventsToPrint = cms.untracked.int32(1),
36+
pythiaPylistVerbosity = cms.untracked.int32(1),
37+
filterEfficiency = cms.untracked.double(1.0),
38+
pythiaHepMCVerbosity = cms.untracked.bool(False),
39+
comEnergy = cms.double(13000.),
40+
PythiaParameters = cms.PSet(
41+
pythia8CommonSettingsBlock,
42+
pythia8CUEP8M1SettingsBlock,
43+
processParameters = cms.vstring(
44+
'WeakSingleBoson:ffbar2gmZ = on',
45+
'PhaseSpace:mHatMin = 50.',
46+
'23:onMode = off',
47+
'23:onIfAny = 15',
48+
'HadronLevel:QED = on',
49+
'TimeShower:QEDshowerByL = off',
50+
),
51+
parameterSets = cms.vstring('pythia8CommonSettings',
52+
'pythia8CUEP8M1Settings',
53+
'processParameters')
54+
),
55+
ExternalDecays = cms.PSet(
56+
Photospp = cms.untracked.PSet(
57+
parameterSets = cms.vstring("setExponentiation", "setInfraredCutOff", "setMeCorrectionWtForW", "setMeCorrectionWtForZ", "setMomentumConservationThreshold", "setPairEmission", "setPhotonEmission", "setStopAtCriticalError", "suppressAll", "forceBremForDecay"),
58+
setExponentiation = cms.bool(True),
59+
setMeCorrectionWtForW = cms.bool(True),
60+
setMeCorrectionWtForZ = cms.bool(True),
61+
setInfraredCutOff = cms.double(0.00011),
62+
setMomentumConservationThreshold = cms.double(0.1),
63+
setPairEmission = cms.bool(False),
64+
setPhotonEmission = cms.bool(True),
65+
setStopAtCriticalError = cms.bool(False),
66+
# Use Photos only for W/Z decays
67+
suppressAll = cms.bool(True),
68+
forceBremForDecay = cms.PSet(
69+
parameterSets = cms.vstring("Z", "Wp", "Wm"),
70+
Z = cms.vint32(0, 23),
71+
Wp = cms.vint32(0, 24),
72+
Wm = cms.vint32(0, -24),
73+
),
74+
),
75+
parameterSets = cms.vstring("Photospp")
76+
)
77+
)
78+
79+
if options.taufilter != 'off':
80+
process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:filter = on')
81+
if options.taufilter == 'el':
82+
process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:eDecays = on')
83+
process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:muDecays = off')
84+
if options.taufilter == 'mu':
85+
process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:eDecays = off')
86+
process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:muDecays = on')
87+
88+
89+
## configure process options
90+
process.options = cms.untracked.PSet(
91+
allowUnscheduled = cms.untracked.bool(True),
92+
wantSummary = cms.untracked.bool(True)
93+
)
94+
95+
process.genParticles = cms.EDProducer("GenParticleProducer",
96+
saveBarCodes = cms.untracked.bool(True),
97+
src = cms.InputTag("generator:unsmeared"),
98+
abortOnUnknownPDGCode = cms.untracked.bool(False)
99+
)
100+
process.printTree1 = cms.EDAnalyzer("ParticleListDrawer",
101+
src = cms.InputTag("genParticles"),
102+
maxEventsToPrint = cms.untracked.int32(10)
103+
)
104+
105+
process.load("GeneratorInterface.RivetInterface.rivetAnalyzer_cfi")
106+
process.rivetAnalyzer.AnalysisNames = cms.vstring('PDG_TAUS', 'MC_ELECTRONS', 'MC_MUONS', 'MC_TAUS')
107+
process.rivetAnalyzer.useLHEweights = False
108+
# process.rivetAnalyzer.OutputFile = 'out.yoda'
109+
process.rivetAnalyzer.OutputFile = 'z-taufilter-%s.yoda' % options.taufilter
110+
111+
# process.path = cms.Path(process.externalLHEProducer*process.generator*process.rivetAnalyzer)
112+
process.path = cms.Path(process.generator*process.rivetAnalyzer)
113+

GeneratorInterface/Pythia8Interface/test/pythia8hmc3_photos_ZToTauTau_13TeV_cfg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
'PhaseSpace:mHatMin = 50.',
4747
'23:onMode = off',
4848
'23:onIfAny = 15',
49-
'ParticleDecays:allowPhotonRadiation = on',
49+
#'ParticleDecays:allowPhotonRadiation = on', # allow photons from hadron decays (OBSOLETE in pythia8316)
50+
'HadronLevel:QED = on', # allow photons from hadron decays
5051
'TimeShower:QEDshowerByL = off',
5152
),
5253
parameterSets = cms.vstring('pythia8CommonSettings',

0 commit comments

Comments
 (0)