Tackling slow pythia event types: Applying (part of) the cut tool in modified EvtGenDecay
Based on a discussion with @mmulder, this provides a modified EvtGenDecay
tool that does exactly the same thing with the only exception being the logic in the generateSignalDecay
part. An additional IGenCutTool
can be provided and the signal decay is repeated by deleting the produced decay and calling EvtGenDecay::generateSignalDecay
over and over until a decay passes the cut.
The use case being, for example, cases such as LHCBGAUSS-1316, where pythia can take a very long time and the used cut tool implements cuts on the decay which have nothing to do with the output of pythia, e.g. a cut on some invariant mass.
Obviously, the cuts applied in the the modified EvtGenDecay
must be independent of anything pythia did to not bias the result (i.e. definitely Lorentz invariant). This will minimise the number of expensive calls to pythia. With the example in LHCBGAUSS-1316 and a modified decay options file, given below, a large increase in speed is seen (in a quick test, this modified setup generated 100 events while the nominal configuration hadn't yet completed the 4th event).
I have selected this to be merged into Sim09 but if accepted should probably go to the other relevant branches as well.
Options file:
from Configurables import Generation
Generation().EventType = 15574121
Generation().SampleGenerationTool = "SignalPlain"
from Configurables import SignalPlain
Generation().addTool(SignalPlain)
Generation().SignalPlain.ProductionTool = "PythiaProduction"
from Configurables import ToolSvc
Generation().SignalPlain.CutTool = "LoKi::GenCutTool/HighVisMass"
Generation().SignalPlain.SignalPIDList = [5122, -5122]
Generation().SignalPlain.DecayTool = "EvtGenDecayWithCutTool"
from Configurables import EvtGenDecayWithCutTool
from Configurables import LoKi__GenCutTool
from Gauss.Configuration import *
ToolSvc().addTool(EvtGenDecayWithCutTool)
evtgendecay = ToolSvc().EvtGenDecayWithCutTool
evtgendecay.UserDecayFile = "$DECFILESROOT/dkfiles/Lb_Lcenu,L0munu=VisibleInAcceptance,HighVisMass.dec"
# THIS LINE IS FROM THE MAIN GAUSS CONFIGURABLE
evtgendecay.DecayFile = "$DECFILESROOT/dkfiles/DECAY.DEC"
evtgendecay.CutTool = "LoKi::GenCutTool/HighVisMassGen"
evtgendecay.addTool(LoKi__GenCutTool, 'HighVisMassGen')
evtgendecay.HighVisMassGen.Decay = '[^(Lambda_b0 => ^(Lambda_c+ => ^(Lambda0 => ^p+ ^pi-) ^mu+ ^nu_mu) ^e- ^nu_e~)]CC'
evtgendecay.HighVisMassGen.Cuts = {'[Lambda_b0]cc': "visMass"}
evtgendecay.HighVisMassGen.Preambulo += [
"visMass = ( ( GMASS ( 'mu+' == GABSID , 'e-' == GABSID, 'p+' == GABSID, 'pi+' == GABSID ) ) > 4500 * MeV ) "]
gen = Generation()
gen.SignalPlain.addTool(LoKi__GenCutTool, 'HighVisMass')
tightCut = gen.SignalPlain.HighVisMass
tightCut.Decay = '[^(Lambda_b0 => ^(Lambda_c+ => ^(Lambda0 => ^p+ ^pi-) ^mu+ ^nu_mu) ^e- ^nu_e~)]CC'
tightCut.Cuts = {
'[p+]cc': "inAcc",
'[pi-]cc': "inAcc",
'[mu+]cc': "inAcc",
'[e-]cc': "inAcc"}
tightCut.Preambulo += ["inAcc = in_range ( 0.005 , GTHETA , 0.400 ) " ]