Draft: Extend RHadrons/python/GeneratePythiaCommands_RHadrons.py to cover simulation of gluino R-Hadrons
This initial commit is just an attempt to get things working for a specific DSID: 449464
The previous job options from MC15JobOptions were:
MC15.449464.MGPy8EG_A14NNPDF23LO_GG_direct_RH_1800_1770_1ns_sp5_gl10.py
include ( 'MC15JobOptions/MadGraphControl_SimplifiedModel_GG_direct_LongLived_RHadron.py' )
Updates in RHadrons/python/GeneratePythiaCommands_RHadrons.py
based upon this syntax from the evgen stage:
from MadGraphControl.MadGraphUtils import *
from MadGraphControl.MadGraphUtilsHelpers import get_physics_short
include ( 'MadGraphControl/SUSY_SimplifiedModel_PreInclude.py' )
#JOname = 'mc.MGPy8EG_A14NNPDF23LO_GG_direct_RH_500_100_3ns_sp5_gl10.py'
JOname = get_physics_short()
infoStrings = JOname.split("_")
masses['1000021'] = float(infoStrings[5])
masses['1000022'] = float(infoStrings[6].split('.py')[0])
if "stab" in infoStrings[7] :
lifetime = -1
else :
lifetime = float(infoStrings[7].replace("ns","").split('.py')[0].replace('p','.') ) #in ns
spectrum = int(infoStrings[8].split('.py')[0].replace('sp',''))
if '_gl' in runArgs.jobConfig[0]:
gluinoballProb = float(infoStrings[-1].split('.')[0].replace("gl",""))*0.01
else:
gluinoballProb = -1
if masses['1000022']<0.5: masses['1000022']=0.5
gentype = str(infoStrings[2])
decaytype = str(infoStrings[3])
process = '''
generate p p > go go $ susysq susysq~ @1
add process p p > go go j $ susysq susysq~ @2
add process p p > go go j j $ susysq susysq~ @3
'''
njets = 2
evt_multiplier = 6
evgenLog.info('Registered generation of gluino grid '+str(runArgs.jobConfig))
evgenConfig.contact = [ "lawrence.lee.jr@cern.ch" ]
evgenConfig.keywords += ['simplifiedModel','gluino','longLived']
evgenConfig.description = 'Gluino-gluino production, glu->qq+LSP in simplified model, m_glu = %d GeV, m_N1 = %d GeV. Gluino lifetime of %f, including RHadron setup. gluino-ball probability: %f, '%(masses['1000021'],masses['1000022'],lifetime,gluinoballProb)
include ( 'MadGraphControl/SUSY_SimplifiedModel_PostInclude.py' )
if njets>0:
genSeq.Pythia8.Commands += ["Merging:Process = pp>{go,1000021}{go,1000021}"]
genSeq.Pythia8.Commands += ["Init:showChangedSettings = on"]
genSeq.Pythia8.Commands += ["Rhadrons:allow = on"]
genSeq.Pythia8.Commands += ["RHadrons:allowDecay = off"]
# Check if we are explicitly setting the gluinoball fraction; if not use the default value
if gluinoballProb!=-1:
genSeq.Pythia8.Commands += ["RHadrons:probGluinoball = %f"%gluinoballProb]
else:
genSeq.Pythia8.Commands += ["RHadrons:probGluinoball = 0.1"]
genSeq.Pythia8.Commands += ["Next:showScaleAndVertex = on"]
genSeq.Pythia8.Commands += ["Check:nErrList = 2"]
# Make sure that the RHadrons are allowed by TestHepMC
if 'testSeq' in dir():
extra_pdgids_f = open('extra_pdgids.txt','w')
from RHadrons.RHadronMasses import offset_options
# Just allow all of them to have an anti-particle. It's more future-proof.
for a in offset_options:
extra_pdgids_f.write(str(a)+'\n')
extra_pdgids_f.write('-'+str(a)+'\n')
extra_pdgids_f.close()
Extras = [1009002]
with open('extra_pdgids.txt','a') as f:
for a in Extras:
f.write(str(a)+'\n')
f.write('-'+str(a)+'\n')
testSeq.TestHepMC.G4ExtraWhiteFile='extra_pdgids.txt'
testSeq.TestHepMC.UnknownPDGIDFile = 'extra_pdgids.txt'
evgenConfig.specialConfig = "LIFETIME={lifetime};preInclude=SimulationJobOptions/preInclude.RHadronsPythia8.py".format(lifetime=lifetime)
# Set up R-hadron masses in Pythia8
import os
if os.access('param_card.dat',os.R_OK):
from RHadrons.RHadronMasses import get_Pythia8_commands
genSeq.Pythia8.Commands += get_Pythia8_commands('param_card.dat',spectrum)
# Otherwise this is going to be done a different way by the simulation pre-include
This is untested, but I'm making a draft MR to allow discussion with @yuematsu, @ewelina and @zmarshal. From my side, what I would need to test further is a working Gen_tf.py command and/or an EVNT sample to use as input to simulation.