ATLAS Offline Software
ttj_MiNNLO.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaCommon import Logging
4 from ..powheg_V2 import PowhegV2
5 from ..external import ExternalMadSpin
6 import os
7 
8 
9 logger = Logging.logging.getLogger("PowhegControl")
10 
11 
12 # Dictionary to convert the PowhegControl decay mode names to the appropriate
13 # decay mode numbers understood by Powheg
14 #
15 # The PowhegControl decay modes with MadSpin in their name use MadSpin to
16 # generate the top decays, the others use Powheg
17 _decay_mode_lookup = {
18  "t t~ > all [MadSpin]" : "00000", # switch off decays in Powheg and let MadSpin handle them!
19  "t t~ > all": "22222",
20  "t t~ > b j j b~ j j": "00022",
21  "t t~ > b l+ vl b~ l- vl~": "22200",
22  "t t~ > b emu+ vemu b~ emu- vemu~": "22000",
23  "t t~ > semileptonic": "11111",
24  "t t~ > undecayed" : "00000",
25 }
26 
27 
29  """! Default Powheg configuration for top pair production plus one jet with MiNNLO.
30 
31  Create a configurable object with all applicable Powheg options.
32 
33  @author Timothee Theveneaux-Pelzer <tpelzer@cern.ch>
34  """
35 
36  def __init__(self, base_directory, **kwargs):
37  """! Constructor: all process options are set here.
38 
39  @param base_directory: path to PowhegBox code.
40  @param kwargs dictionary of arguments from Generate_tf.
41  """
42 
43  # this is very hacky - needed to handle problems with error handling in some fortran codes
44  errors = super(ttj_MiNNLO, self).openloops_error()
45  warnings = super(ttj_MiNNLO, self).hoppet_warning()
46  infos = super(ttj_MiNNLO, self).hoppet_info()
47 
48  super(ttj_MiNNLO, self).__init__(base_directory, "ttJ_MiNNLO", powheg_executable="pwhg_main-gnu", warning_output=warnings, info_output=infos, error_output=errors, **kwargs)
49 
50  # defining ttjMiNNLOPATH environment variable to bypass file path problems in fortran code
51  # this is definitly a hack, see discussion in AGENE-2055
52  os.environ['ttjMiNNLOPATH'] = os.path.dirname(self.executable)
53  logger.info("ttjMiNNLOPATH defined as = {0}".format(os.getenv('ttjMiNNLOPATH')))
54 
55  # hack in place to help powheg executable find all dynamic libraries
56  logger.warning("Applying manual, hard-coded fixes for Virtuals library paths")
57  OLPath = os.path.dirname(self.executable) + "/OpenLoops2"
58  os.environ['OpenLoopsPath'] = OLPath
59  logger.info("OpenLoopsPath defined as = {0}".format(os.getenv('OpenLoopsPath')))
60 
61  logger.debug("LD_LIBRARY_PATH (before) = {0}".format(os.getenv('LD_LIBRARY_PATH')))
62  VirtualsPath = os.path.dirname(self.executable) + "/Virtuals/obj-gnu"
63  ChaplinPath = os.path.dirname(self.executable) + "/../../External/chaplin-1.2/lib"
64  ChaplinPath2 = os.path.dirname(self.executable) + "/../../External/INSTALL/chaplin-1.2/lib"
65  logger.info("VirtualsPath="+VirtualsPath)
66  logger.info("ChaplinPath="+ChaplinPath)
67  ldpath = os.getenv('LD_LIBRARY_PATH')
68  ldpath_new = VirtualsPath + ":" + ChaplinPath + ":" + ChaplinPath2 + ":" + ldpath
69  os.environ['LD_LIBRARY_PATH'] = ldpath_new
70  logger.debug("LD_LIBRARY_PATH (after) = {0}".format(os.getenv('LD_LIBRARY_PATH')))
71 
72  # Add algorithms to the sequence
73  self.add_algorithm(ExternalMadSpin(process="generate p p > t t~ j [QCD]"))
74 
75  # Add parameter validation functions
76  self.validation_functions.append("validate_decays")
77 
78 
80  self.allowed_decay_modes = sorted(_decay_mode_lookup.keys())
81 
82  # Add all keywords for this process, overriding defaults if required
83  self.add_keyword("alphaem")
84  self.add_keyword("alphas_from_pdf", 1) # if 1, uses alphas from PDF evolution tool (e.g. lhapdf or hoppet)
85  self.add_keyword("bcut")
86  self.add_keyword("bornktmin", 0.6) # 0.6 from powheg.input example for this process (default is 0.)
87  self.add_keyword("bornonly")
88  self.add_keyword("bornsuppfact", -1)
89  self.add_keyword("bornzerodamp")
90  self.add_keyword("bottommass")
91  self.add_keyword("bottomthr")
92  self.add_keyword("bottomthrpdf")
93  self.add_keyword("charmthr")
94  self.add_keyword("charmthrpdf")
95  self.add_keyword("check_bad_st1")
96  self.add_keyword("check_bad_st2")
97  self.add_keyword("CKM_Vcb")
98  self.add_keyword("CKM_Vcd")
99  self.add_keyword("CKM_Vcs")
100  self.add_keyword("CKM_Vtb")
101  self.add_keyword("CKM_Vtd")
102  self.add_keyword("CKM_Vts")
103  self.add_keyword("CKM_Vub")
104  self.add_keyword("CKM_Vud")
105  self.add_keyword("CKM_Vus")
106  self.add_keyword("clobberlhe")
107  self.add_keyword('collremnsamp"')
108  self.add_keyword("colltest")
109  self.add_keyword("compute_rwgt")
110  self.add_keyword("doublefsr")
111  self.add_keyword("elbranching")
112  self.add_keyword("facscfact", self.default_scales[0])
113  self.add_keyword("fastbtlbound")
114  self.add_keyword("fixedscale", 0) # keep to zero to use dynamical scale for overall two powers of alphas
115  self.add_keyword("ffltest")
116  self.add_keyword("flg_debug")
117  self.add_keyword("foldcsi", 2)
118  self.add_keyword("foldphi", 2)
119  self.add_keyword("foldy", 2)
120  self.add_keyword("fullrwgt")
121  self.add_keyword("fullrwgtmode")
122  self.add_keyword("ggproc")
123  self.add_keyword("gqbproc")
124  self.add_keyword("hdamp")
125  self.add_keyword("hfact")
126  self.add_keyword("icsimax", 3)
127  self.add_keyword("ih1")
128  self.add_keyword("ih2")
129  self.add_keyword("itmx1")
130  self.add_keyword("itmx2", 4)
131  self.add_keyword("iupperfsr")
132  self.add_keyword("iupperisr")
133  self.add_keyword("iymax", 3)
134  self.add_keyword("jacsing")
135  self.add_keyword("kappaQ", 0.5) # should be set =< 0.5d0 for ttbar)
136  self.add_keyword("largecorrfact")
137  self.add_keyword("largeptscales", 0) # [ 0 - m_tt (invariant mass of top-quark pair) 1 - pT_tt (transverse momentum of top-quark pair) 2 - H_T^tt (sum of transverse masses of the top quarks)]
138  self.add_keyword("lhans1", self.default_PDFs)
139  self.add_keyword("lhans2", self.default_PDFs)
140  self.add_keyword("lhfm/bmass")
141  self.add_keyword("lhfm/cmass")
142  self.add_keyword("lhfm/emass")
143  self.add_keyword("lhfm/mumass")
144  self.add_keyword("lhfm/taumass")
145  self.add_keyword("manyseeds")
146  self.add_keyword("masswindow_high")
147  self.add_keyword("masswindow_low")
148  self.add_keyword("minlo", 1)
149  self.add_keyword("minnlo", 1)
150  self.add_keyword("modlog_p", -1)
151  self.add_keyword("ncall1", 10000000)
152  self.add_keyword("ncall1rm")
153  self.add_keyword("ncall2", 20000000)
154  self.add_keyword("ncall2rm")
155  self.add_keyword("nubound", 5000000)
156  self.add_keyword("par_2gsupp")
157  self.add_keyword("par_diexp")
158  self.add_keyword("par_dijexp")
159  self.add_keyword("par_fsrtinycsi")
160  self.add_keyword("par_fsrtinyy")
161  self.add_keyword("par_isrtinycsi")
162  self.add_keyword("par_isrtinyy")
163  self.add_keyword("parallelstage")
164  self.add_keyword("pdfreweight")
165  self.add_keyword("psgen")
166  self.add_keyword("ptmin_jet", 20.0)
167  self.add_keyword("ptsqmin")
168  self.add_keyword("ptsupp")
169  self.add_keyword("qgproc")
170  self.add_keyword("qqbproc")
171  self.add_keyword("qqpproc")
172  self.add_keyword("qqproc")
173  self.add_keyword("Q0", 2.0)
174  self.add_keyword("R_jet")
175  self.add_keyword("radregion")
176  self.add_keyword("rand1")
177  self.add_keyword("rand2")
178  self.add_keyword("renscfact", self.default_scales[1])
179  self.add_keyword("runningscale")
180  self.add_keyword("rwl_add")
181  self.add_keyword("rwl_file")
182  self.add_keyword("rwl_format_rwgt")
183  self.add_keyword("rwl_group_events")
184  self.add_keyword("semileptonic", hidden=True)
185  self.add_keyword("smartsig")
186  self.add_keyword("softtest")
187  self.add_keyword("sthw2")
188  self.add_keyword("storeinfo_rwgt")
189  self.add_keyword("testplots")
190  self.add_keyword("testsuda")
191  self.add_keyword("topdecaymode", self.allowed_decay_modes[1], name="decay_mode") # default decay is inclusive, by Powheg
192  self.add_keyword("topmass")
193  self.add_keyword("topwidth")
194  self.add_keyword("ubsigmadetails")
195  self.add_keyword("use-old-grid")
196  self.add_keyword("use-old-ubound")
197  self.add_keyword("use_OLP_Interface",1)
198  self.add_keyword("whichscale", 4) # set scale of overall two powers of alphas if fixedscale=0
199  self.add_keyword("withdamp",0)
200  self.add_keyword("withnegweights")
201  self.add_keyword("withsubtr")
202  self.add_keyword("Wmass")
203  self.add_keyword("Wwidth")
204  self.add_keyword("xupbound", 6)
205  self.add_keyword("zerowidth")
206  self.add_keyword("Zmass")
207  self.add_keyword("Zwidth")
208 
209  def validate_decays(self):
210  """! Validate semileptonic and topdecaymode keywords."""
211  self.expose() # convenience call to simplify syntax
212  if self.decay_mode not in self.allowed_decay_modes:
213  error_message = "Decay mode '{given}' not recognised, valid choices are: '{choices}'!".format(given=self.decay_mode, choices="', '".join(self.allowed_decay_modes))
214  logger.warning(error_message)
215  raise ValueError(error_message)
216 
217  # Check if MadSpin decays are requested.
218  # Accordingly, MadSpin will run or not run.
219  if "MadSpin" in self.decay_mode:
220  self.externals["MadSpin"].parameters_by_keyword("powheg_top_decays_enabled")[0].value = False
221  self.externals["MadSpin"].parameters_by_keyword("MadSpin_model")[0].value = "loop_sm-no_b_mass"
222  self.externals["MadSpin"].parameters_by_keyword("MadSpin_nFlavours")[0].value = 5
223 
224  # Calculate appropriate decay mode numbers
225  self.parameters_by_keyword("topdecaymode")[0].value = _decay_mode_lookup[self.decay_mode]
226  if self.decay_mode == "semileptonic":
227  # Parameter semileptonic must be set to 1 to actually get semileptonic decays, because the topdecaymode=11111 also allows fully hadronic decays (with one up and one charm quark)
228  self.parameters_by_keyword("semileptonic")[0].value = 1
python.processes.configurable.Configurable.expose
def expose(self)
Add all names to the interface of this object.
Definition: configurable.py:46
python.processes.powheg_base.PowhegBase.hoppet_info
def hoppet_info(self)
Definition: powheg_base.py:23
python.processes.powheg_base.PowhegBase.add_algorithm
def add_algorithm(self, alg_or_process)
Add an algorithm or external process to the sequence.
Definition: powheg_base.py:208
python.processes.powheg_base.PowhegBase.hoppet_warning
def hoppet_warning(self)
Definition: powheg_base.py:44
python.processes.powheg.ttj_MiNNLO.ttj_MiNNLO.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ttj_MiNNLO.py:36
vtune_athena.format
format
Definition: vtune_athena.py:14
python.processes.powheg.ttj_MiNNLO.ttj_MiNNLO.allowed_decay_modes
allowed_decay_modes
List of allowed decay modes (The sorting of the list is just to increase readability when it's printe...
Definition: ttj_MiNNLO.py:80
python.processes.powheg_base.PowhegBase.default_scales
def default_scales(self)
Default scale variations for this process.
Definition: powheg_base.py:246
python.processes.configurable.Configurable.add_keyword
def add_keyword(self, keyword, value=None, name=None, frozen=None, hidden=None, description=None, **kwargs)
Register configurable parameter that is exposed to the user.
Definition: configurable.py:21
python.processes.external.external_madspin.ExternalMadSpin
Class for running external MadSpin process.
Definition: external_madspin.py:11
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
python.processes.powheg_base.PowhegBase.openloops_error
def openloops_error(self)
Definition: powheg_base.py:51
python.processes.configurable.Configurable.parameters_by_keyword
def parameters_by_keyword(self, keyword)
Retrieve all parameters that use a given keyword.
Definition: configurable.py:57
python.processes.powheg_base.PowhegBase.validation_functions
validation_functions
List of validation functions to run before preparing runcard.
Definition: powheg_base.py:179
python.processes.powheg.ttj_MiNNLO.ttj_MiNNLO.validate_decays
def validate_decays(self)
Validate semileptonic and topdecaymode keywords.
Definition: ttj_MiNNLO.py:209
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.processes.powheg.ttj_MiNNLO.ttj_MiNNLO.decay_mode
decay_mode
Definition: ttj_MiNNLO.py:226
python.processes.powheg_base.PowhegBase.externals
externals
List of external processes to schedule.
Definition: powheg_base.py:176
python.processes.powheg_base.PowhegBase.default_PDFs
def default_PDFs(self)
Default PDFs for this process.
Definition: powheg_base.py:241
python.processes.powheg_V2.PowhegV2
Base class for PowhegBox V2 processes.
Definition: powheg_V2.py:6
python.processes.powheg_base.PowhegBase.executable
executable
Powheg executable that will be used.
Definition: powheg_base.py:154
python.processes.powheg.ttj_MiNNLO.ttj_MiNNLO
Default Powheg configuration for top pair production plus one jet with MiNNLO.
Definition: ttj_MiNNLO.py:28