~maddevelopers/mg5amcnlo/2.7.4_array

« back to all changes in this revision

Viewing changes to madgraph/interface/reweight_interface.py

  • Committer: olivier-mattelaer
  • Date: 2020-08-07 11:51:35 UTC
  • Revision ID: olivier-mattelaer-20200807115135-08qjlwdaxwmc25ie
allow to distingush process by pid in standalone python + fix gcc issue for loop process

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
        self.rwgt_dir = None
112
112
        self.exitted = False # Flag to know if do_quit was already called.
113
113
        self.keep_ordering = False
 
114
        self.use_eventid = False
114
115
        if event_path:
115
116
            logger.info("Extracting the banner ...")
116
117
            self.do_import(event_path, allow_madspin=allow_madspin)
356
357
            if self.has_standalone_dir:
357
358
                self.terminate_fortran_executables()
358
359
                self.has_standalone_dir = False
359
 
        elif args[0] == "keep_ordering":
360
 
            self.keep_ordering = banner.ConfigFile.format_variable(args[1], bool, "keep_ordering")
 
360
        elif args[0] in ["keep_ordering", "use_eventid"]:
 
361
            setattr(self, args[0], banner.ConfigFile.format_variable(args[1], bool, args[0]))
361
362
        elif args[0] == "allow_missing_finalstate":
362
363
            self.options["allow_missing_finalstate"] = banner.ConfigFile.format_variable(args[1], bool, "allow_missing_finalstate")
363
364
        elif args[0] == "process":
1207
1208
        #    base = "rw_mevirt"
1208
1209
        #else:
1209
1210
        #    base = "rw_me"
1210
 
        
 
1211
 
1211
1212
        if (not self.second_model and not self.second_process and not self.dedicated_path) or hypp_id==0:
1212
1213
            orig_order, Pdir, hel_dict = self.id_to_path[tag]
1213
1214
        else:
1270
1271
        pold = list(p)
1271
1272
        p = self.invert_momenta(p)
1272
1273
        pdg = list(orig_order[0])+list(orig_order[1])
1273
 
 
 
1274
        try:
 
1275
            pid = event.ievent
 
1276
        except AttributeError:
 
1277
            pid = -1
 
1278
        if not self.use_eventid:
 
1279
            pid = -1
 
1280
        
1274
1281
        with misc.chdir(Pdir):
1275
1282
            with misc.stdchannel_redirected(sys.stdout, os.devnull):
1276
 
                me_value = module.smatrixhel(pdg,p, event.aqcd, scale2, nhel)
 
1283
                me_value = module.smatrixhel(pdg, pid, p, event.aqcd, scale2, nhel)
1277
1284
                                
1278
1285
        # for loop we have also the stability status code
1279
1286
        if isinstance(me_value, tuple):
1388
1395
                    nlo_order = nlo_order.replace('noborn', 'virt')
1389
1396
                commandline += "add process %s [%s] %s;" % (base,nlo_order,post)
1390
1397
            commandline = commandline.replace('add process', 'generate',1)
1391
 
            logger.info("RETRY with %s", commandline)
1392
 
            mgcmd.exec_cmd(commandline, precmd=True)
1393
 
            has_nlo = False
 
1398
            if commandline:
 
1399
                logger.info("RETRY with %s", commandline)
 
1400
                mgcmd.exec_cmd(commandline, precmd=True)
 
1401
                has_nlo = False
1394
1402
        except Exception, error:
 
1403
            misc.sprint(type(error))
1395
1404
            raise
1396
1405
        
1397
1406
        commandline = 'output standalone_rw %s --prefix=int' % pjoin(path_me,data['paths'][0])
1803
1812
                data = self.id_to_path_second
1804
1813
 
1805
1814
            # get all the information
1806
 
            all_pdgs = mymod.get_pdg_order()
1807
 
            all_pdgs = [[pdg for pdg in pdgs if pdg!=0] for pdgs in  mymod.get_pdg_order()]
 
1815
            allids, all_pids = mymod.get_pdg_order()
 
1816
            all_pdgs = [[pdg for pdg in pdgs if pdg!=0] for pdgs in  allids]
 
1817
            #all_pids = [pid for (pdgs, pid) in  allids]
1808
1818
            all_prefix = [''.join(j).strip().lower() for j in mymod.get_prefix()]
1809
1819
            prefix_set = set(all_prefix)
1810
1820
 
1827
1837
                    misc.sprint(os.path.exists(pjoin(path_me,onedir,'SubProcesses','MadLoop5_resources', '%sHelConfigs.dat' % prefix.upper())))
1828
1838
                    continue
1829
1839
 
1830
 
            for i,pdg in enumerate(all_pdgs):
 
1840
            for i,(pdg,pid) in enumerate(zip(all_pdgs,all_pids)):
1831
1841
                if self.is_decay:
1832
1842
                    incoming = [pdg[0]]
1833
1843
                    outgoing = pdg[1:]