Commit 1b2f19bf authored by Ewelina Maria Lobodzinska's avatar Ewelina Maria Lobodzinska
Browse files

Merge branch '21.6-event-norm' into '21.6'

MadGraphControl event_norm fix for [AGENE-1725]

See merge request !26817
parents 51b1bd1f 8703748b
......@@ -2437,6 +2437,19 @@ def run_card_consistency_check(isNLO=False,path='.'):
for k,v in mydict.iteritems():
mglog.info( '"%s" = %s'%(k,v) )
if is_version_or_newer([2,5,0]):
# We should always use event_norm = average [AGENE-1725] otherwise Pythia cross sections are wrong
if is_version_or_newer([2,6,1]):
if not checkSetting('event_norm','average',mydict):
modify_run_card(cardpath,cardpath.replace('.dat','_backup.dat'),{'event_norm':'average'})
# Only needed for 2.5.0 to 2.6.0 to battle problem with inconsistent event weights [AGENE-1542]
# Will likely cause Pythia to calculate the wrong cross section [AGENE-1725]
else:
if not isNLO and checkSettingIsTrue('use_syst',mydict):
if not checkSetting('event_norm','sum',mydict):
modify_run_card(cardpath,cardpath.replace('.dat','_backup.dat'),{'event_norm':'sum'})
mglog.warning("Setting 'event_norm' to 'sum' -- this will mean the cross section calculated by Pythia is most likely wrong.")
if not isNLO:
#Check CKKW-L setting
if float(mydict['ktdurham']) > 0 and int(mydict['ickkw']) != 0:
......@@ -2444,14 +2457,6 @@ def run_card_consistency_check(isNLO=False,path='.'):
mglog.error(log)
raise RuntimeError(log)
version = getMadGraphVersion() # avoiding code duplication
# Only needed for 2.5.0 and later
if int(version.split('.')[0])>=2 and int(version.split('.')[1])>=5:
#event_norm must be "sum" for use_syst to work
if mydict['use_syst'].replace('.','').lower() in ['t','true']:
if 'event_norm' not in mydict or mydict['event_norm']!="sum":
modify_run_card(cardpath,cardpath.replace('.dat','_backup.dat'),{'event_norm':'sum'})
# Check if user is trying to use deprecated syscalc arguments with the other systematics script
if is_version_or_newer([2,6,2]) and (not 'systematics_program' in mydict or mydict['systematics_program']=='systematics'):
syscalc_settings=['sys_pdf', 'sys_scalefact', 'sys_alpsfact', 'sys_matchscale']
......
......@@ -40,7 +40,14 @@ def checkSetting(key_,value_,mydict_):
for k in mydict_:
mydict[totallyStripped(k)]=totallyStripped(mydict_[k])
return key in mydict and mydict[key]==value
def checkSettingIsTrue(key_,mydict_):
key=totallyStripped(key_)
mydict={}
for k in mydict_:
mydict[totallyStripped(k)]=totallyStripped(mydict_[k])
return key in mydict and mydict[key] in ['t','true']
def checkSettingExists(key_,mydict_):
key=totallyStripped(key_)
keys=[]
......@@ -64,7 +71,7 @@ def is_version_or_newer(args):
for x in vs:
versionnumber+=x*y
y/=100
return testnumber>=versionnumber
return versionnumber>=testnumber
def isNLO_from_run_card(run_card):
f = open(run_card,'r')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment