SND@LHC Software
Loading...
Searching...
No Matches
AddDiMuonDecayChannelsToG4.py
Go to the documentation of this file.
1from __future__ import division
2import ROOT
3ROOT.gROOT.ProcessLine('#include "Geant4/G4ParticleTable.hh"')
4ROOT.gROOT.ProcessLine('#include "Geant4/G4DecayTable.hh"')
5ROOT.gROOT.ProcessLine('#include "Geant4/G4PhaseSpaceDecayChannel.hh"')
6
7def Initialize(p8):
8# take decay and branching ratios from Pythia8
9 pt = ROOT.G4ParticleTable.GetParticleTable()
10 for vreso in [223,333,113]:
11 particleG4 = pt.FindParticle(vreso)
12 particleP8 = p8.particleData.particleDataEntryPtr(vreso)
13 decayTable = ROOT.G4DecayTable()
14 for i in range(particleP8.sizeChannels()):
15 achannel = particleP8.channel(i)
16 bR = achannel.bRatio()
17 mul = achannel.multiplicity()
18 dl = []
19 for daughter in range(4):
20 if daughter<mul:
21 pid = achannel.product(daughter)
22 dl.append(pt.FindParticle(pid).GetParticleName())
23 else: dl.append(ROOT.G4String(""))
24 mode = ROOT.G4PhaseSpaceDecayChannel(particleG4.GetParticleName(),bR,mul,dl[0],dl[1],dl[2],dl[3])
25 decayTable.Insert(mode)
26 particleG4.SetDecayTable(decayTable)
27 particleG4.DumpTable()