~maddevelopers/mg5amcnlo/2.9.4

« back to all changes in this revision

Viewing changes to madgraph/interface/amcatnlo_run_interface.py

  • Committer: olivier-mattelaer
  • Date: 2020-09-28 10:48:24 UTC
  • mfrom: (289.1.11 python3)
  • Revision ID: olivier-mattelaer-20200928104824-8x5rkmftax4ewsq9
pass to 2.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
4124
4124
            misc.call(['tar','-czpf','RunMaterial.tar.gz','RunMaterial'], 
4125
4125
                                                           cwd=run_dir_path)
4126
4126
            shutil.rmtree(pjoin(run_dir_path,'RunMaterial'))
 
4127
        
 
4128
        if self.run_card['ickkw'] >0 :
 
4129
            if self.run_card['ickkw'] != 3 or shower != 'PYTHIA8':
 
4130
                logger.warning("Merged cross-section not retrieved by MadGraph. Please check the parton-shower log to get the correct cross-section after merging")
 
4131
            else:
 
4132
                pythia_log = misc.BackRead(pjoin(rundir, "mcatnlo_run.log") )
 
4133
                
 
4134
                pythiare = re.compile("\s*Les Houches User Process\(es\)\s+9999\s*\|\s*(?P<generated>\d+)\s+(?P<tried>\d+)\s+(?P<accepted>\d+)\s*\|\s*(?P<xsec>[\d\.DeE\-+]+)\s+(?P<xerr>[\d\.DeE\-+]+)\s*\|")    
 
4135
                # | Les Houches User Process(es)                  9999 |       10000      10000       7115 |   1.120e-04  0.000e+00 |     
 
4136
                                                         
 
4137
                for line in pythia_log:
 
4138
                    info = pythiare.search(line)
 
4139
                    if not info:
 
4140
                        continue
 
4141
                    try:
 
4142
                        # Pythia cross section in mb, we want pb
 
4143
                        sigma_m = float(info.group('xsec').replace('D','E')) *1e9
 
4144
                        sigma_err = float(info.group('xerr').replace('D','E')) *1e9
 
4145
                        Nacc = int(info.group('accepted'))
 
4146
                        #Ntry = int(info.group('accepted'))
 
4147
                    except:
 
4148
                        logger.warning("Merged cross-section not retrieved by MadGraph. Please check the parton-shower log to get the correct cross-section after merging")
 
4149
                        break
 
4150
                    
 
4151
                    self.results.add_detail('cross_pythia', sigma_m)
 
4152
                    self.results.add_detail('nb_event_pythia', Nacc)
 
4153
                    self.results.add_detail('error_pythia', sigma_err)
 
4154
                    self.results.add_detail('shower_dir', os.path.basename(rundir))
 
4155
                    logger.info("\nFxFx  Cross-Section:\n"+\
 
4156
                                "======================\n"+\
 
4157
                                "    %f pb.\n"
 
4158
                                "    Number of events after merging: %s\n", sigma_m, Nacc, '$MG:BOLD')
 
4159
                    break
 
4160
                else:
 
4161
                    logger.warning("Merged cross-section not retrieved by MadGraph. Please check the parton-shower log to get the correct cross-section after merging")
 
4162
                                    
 
4163
                
 
4164
            
 
4165
            
 
4166
            
 
4167
            
4127
4168
        # end of the run, gzip files and print out the message/warning
4128
4169
        for f in to_gzip:
4129
4170
            misc.gzip(f)
5408
5449
            self.set_run_name(self.run_name, self.run_tag, 'parton')
5409
5450
            if self.run_card['ickkw'] == 3 and mode in ['LO', 'aMC@LO', 'noshowerLO']:
5410
5451
                raise self.InvalidCmd("""FxFx merging (ickkw=3) not allowed at LO""")
5411
 
            elif self.run_card['ickkw'] == 3 and mode in ['aMC@NLO', 'noshower']:
 
5452
            elif self.run_card['ickkw'] == 3 and mode in ['aMC@NLO', 'noshower'] and self.run_card['parton_shower'].upper() != 'PYTHIA8':
5412
5453
                logger.warning("""You are running with FxFx merging enabled.  To be able to merge
5413
5454
    samples of various multiplicities without double counting, you
5414
5455
    have to remove some events after showering 'by hand'.  Please
5557
5598
    # Launch the interface without any check if one code is already running.
5558
5599
    # This can ONLY run a single command !!
5559
5600
    import sys
5560
 
    if not sys.version_info[0] == 2 or sys.version_info[1] < 6:
5561
 
        sys.exit('MadGraph/MadEvent 5 works only with python 2.6 or later (but not python 3.X).\n'+\
5562
 
               'Please upgrate your version of python.')
 
5601
    if sys.version_info[1] < 7:
 
5602
        sys.exit('MadGraph/MadEvent 5 works only with python 2.7 or python3.7 and later.\n'+\
 
5603
               'Please upgrade your version of python or specify a compatible version')
5563
5604
 
5564
5605
    import os
5565
5606
    import optparse