Skip to content

Commit

Permalink
fix the passing of the input mass to tree2ws
Browse files Browse the repository at this point in the history
  • Loading branch information
emanueledimarco committed Feb 10, 2023
1 parent 13a13f4 commit 6a93cac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Trees2WS/tools/submissionTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def writeSubFiles(_opts):
for tfidx,tf in enumerate(tfiles):
# Extract production mode (and decay extension if required)
p, d = signalFromFileName(tf)
_cmd = "python %s/trees2ws.py --inputConfig %s --inputTreeFile %s --productionMode %s --year %s"%(twd__,_opts['inputConfig'],tf,p,_opts['year'])
m = massFromFileName(tf)
_cmd = "python %s/trees2ws.py --inputConfig %s --inputTreeFile %s --productionMode %s --year %s --inputMass %d"%(twd__,_opts['inputConfig'],tf,p,_opts['year'],m)
if d is not None: _cmd += " --decayExt %s"%d
if _opts['modeOpts'] != '': _cmd += " %s"%_opts['modeOpts']
_f.write("if [ $1 -eq %g ]; then\n"%tfidx)
Expand Down Expand Up @@ -139,7 +140,8 @@ def writeSubFiles(_opts):
writePreamble(_f)
# Extract production mode (and decay extension if required)
p, d = signalFromFileName(tf)
_cmd = "python %s/trees2ws.py --inputConfig %s --inputTreeFile %s --productionMode %s --year %s"%(twd__,_opts['inputConfig'],tf,p,_opts['year'])
m = massFromFileName(tf)
_cmd = "python %s/trees2ws.py --inputConfig %s --inputTreeFile %s --productionMode %s --year %s --inputMass %d"%(twd__,_opts['inputConfig'],tf,p,_opts['year'],m)
if d is not None: _cmd += " --decayExt %s"%d
if _opts['modeOpts'] != '': _cmd += " %s"%_opts['modeOpts']
_f.write("%s\n"%_cmd)
Expand Down
15 changes: 13 additions & 2 deletions tools/commonTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ def signalFromFileName(_fileName):
p += "f05"
return p,d

# Function to return mass from input file name
def massFromFileName(_fileName):
m = None
# to be done with regexp
if "_M120_" in _fileName: m = 120
elif "_M125_" in _fileName: m = 125
elif "_M130_" in _fileName: m = 130
else:
print " ---> [ERROR]: cannot extract mass from input file name. Please update tools.commonTools.massFromFileName"
return m

# Function for converting STXS process to production mode in dataset name
procToDataMap = od()
procToDataMap['GG2H'] = 'ggh'
Expand All @@ -117,8 +128,8 @@ def signalFromFileName(_fileName):
procToDataMap['VBF_ALT0L1Zg'] = 'vbfh_ALT_L1Zg'
procToDataMap['VBF_ALT0L1Zgf05ph0'] = 'vbfh_ALT_L1Zgf05'
procToDataMap['VH'] = 'wzh'
procToDataMap['WH_WM'] = 'wh'
procToDataMap['WH_WP'] = 'wh'
procToDataMap['WMINUSH2HQQ'] = 'wh'
procToDataMap['WPLUSH2HQQ'] = 'wh'
procToDataMap['WH_ALT0L1f05ph0'] = 'wh_ALT_L1f05'
procToDataMap['WH_ALT0PHf05ph0'] = 'wh_ALT_0PHf05'
procToDataMap['WH_ALT0PH'] = 'wh_ALT_0PH'
Expand Down

0 comments on commit 6a93cac

Please sign in to comment.