Skip to content

Commit

Permalink
option to silence most pythia printouts
Browse files Browse the repository at this point in the history
  • Loading branch information
kpedro88 committed Jun 5, 2024
1 parent 8981f6c commit 70e0c15
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ The [runSVJ](./test/runSVJ.py) script is a wrapper that can customize and run an
* `config=[str]`: config file to customize and run (default = step_GEN)
* `useFolders=[bool]`: read input files written with `--use-folders` option (see [Condor submission](#condor-submission))
* `printEvents=[num]`: number of Pythia events to print (default = 1)
* `quiet=[bool]`: suppress all Pythia printouts (default = False)
* `threads=[num]`: number of threads to run (default = 1)
* `streams=[num]`: number of streams to run (default = 0 -> streams = threads)
* `redir=[dir]`: xrootd redirector for input file
Expand Down
1 change: 1 addition & 0 deletions python/optSVJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
options.register("maxEventsIn", -1, VarParsing.multiplicity.singleton, VarParsing.varType.int)
options.register("useFolders", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool)
options.register("printEvents", 1, VarParsing.multiplicity.singleton, VarParsing.varType.int)
options.register("quiet", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool)
options.register("threads", 1, VarParsing.multiplicity.singleton, VarParsing.varType.int)
options.register("streams", 0, VarParsing.multiplicity.singleton, VarParsing.varType.int)
options.register("redir", "", VarParsing.multiplicity.singleton, VarParsing.varType.string)
Expand Down
25 changes: 23 additions & 2 deletions test/runSVJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,29 @@ def fix_inname(inname,options,lhe=False):
)
process.ProductionFilterSequence.insert(0,process.nmedfilter)

if hasattr(process,'generator') and hasattr(process.generator,'maxEventsToPrint'):
process.generator.maxEventsToPrint = options.printEvents
def set_if_has(obj,attr,val):
if hasattr(obj,attr): setattr(obj,attr,val)

if hasattr(process,'generator'):
if options.quiet:
set_if_has(process.generator,'maxEventsToPrint',0)
set_if_has(process.generator,'pythiaHepMCVerbosity',False)
set_if_has(process.generator,'pythiaPylistVerbosity',0)
if hasattr(process.generator,'PythiaParameters'):
pythia_quiet_settings = [
'Print:quiet = on',
'Init:showProcesses = off',
'Init:showMultipartonInteractions = off',
'Init:showChangedSettings = off',
'init:showChangedParticleData = off',
]
set_if_has(
process.generator.PythiaParameters,
'pythia8CommonSettings',
getattr(process.generator.PythiaParameters,'pythia8CommonSettings',[])+pythia_quiet_settings
)
elif hasattr(process.generator,'maxEventsToPrint'):
process.generator.maxEventsToPrint = options.printEvents

# genjet/met settings - treat DM stand-ins as invisible
_particles = ["genParticlesForJetsNoMuNoNu","genParticlesForJetsNoNu","genCandidatesForMET","genParticlesForMETAllVisible"]
Expand Down

0 comments on commit 70e0c15

Please sign in to comment.