ATLAS Offline Software
Generators
PowhegControl
python
algorithms
preprocessors
preprocessors/reweighter.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3
from
...decorators
import
timed
4
from
...utility
import
FileParser
5
import
shutil
6
7
8
@
timed
(
"reweighting setup"
)
9
def
reweighter
(process, *args):
10
"""! Prepare for reweighting by enabling the runcard option.
11
12
@author James Robinson <james.robinson@cern.ch>
13
"""
14
# Alter/remove runcard options depending on which weighting scheme is being used
15
if
process.use_XML_reweighting:
16
FileParser(
"powheg.input"
).text_remove(
"lhrwgt_descr"
)
17
FileParser(
"powheg.input"
).text_remove(
"lhrwgt_group_combine"
)
18
FileParser(
"powheg.input"
).text_remove(
"lhrwgt_group_name"
)
19
FileParser(
"powheg.input"
).text_remove(
"lhrwgt_id"
)
20
FileParser(
"powheg.input"
).text_remove(
"storeinfo_rwgt"
)
21
else
:
22
FileParser(
"powheg.input"
).text_remove(
"rwl_add"
)
23
FileParser(
"powheg.input"
).text_remove(
"rwl_file"
)
24
FileParser(
"powheg.input"
).text_remove(
"rwl_format_rwgt"
)
25
FileParser(
"powheg.input"
).text_remove(
"rwl_group_events"
)
26
# Enable #rwgt information lines - these cause Pythia to crash if present in the final output
27
FileParser(
"powheg.input"
).text_replace(
"storeinfo_rwgt 0"
,
"storeinfo_rwgt 1"
)
28
29
# Make a copy of the nominal input file
30
shutil.copy(
"powheg.input"
,
"powheg_nominal.input"
)
31
python.algorithms.preprocessors.reweighter.reweighter
def reweighter(process, *args)
Prepare for reweighting by enabling the runcard option.
Definition:
preprocessors/reweighter.py:9
python.decorators.timed.timed
def timed(name)
Decorator to output function execution time.
Definition:
timed.py:12
Generated on Mon Dec 23 2024 21:17:16 for ATLAS Offline Software by
1.8.18