Esempio n. 1
0
    def compare_processes(self,
                          my_proc_list=[],
                          orders={},
                          model='sm',
                          energy=500,
                          filename="",
                          pickle_file="",
                          tolerance=1e-06):
        """ """
        mg5_path = self.build_old_mg5()

        if 'v4' in model:
            old_mg5 = me_comparator.MG5OldRunner()
            old_mg5.setup(mg5_path)
            current_mg5 = me_comparator.MG5Runner()
            current_mg5.setup(MG5DIR, MG5DIR)
            current_mg5.store_proc_card = True
        else:
            old_mg5 = me_comparator.MG5_UFO_OldRunner()
            old_mg5.setup(mg5_path)
            current_mg5 = me_comparator.MG5_UFO_Runner()
            current_mg5.setup(MG5DIR, MG5DIR)
            current_mg5.store_proc_card = True

        if os.path.exists(
                pjoin(MG5DIR, 'models', 'paralel_test_model_%s' % model)):
            shutil.rmtree(
                pjoin(MG5DIR, 'models', 'paralel_test_model_%s' % model))
        os.system('cp -rf %s %s' %
                  (pjoin(mg5_path, 'models', model),
                   pjoin(MG5DIR, 'models', 'paralel_test_model_%s' % model)))

        # Create and setup a comparator
        my_comp = me_comparator.MEComparator()
        my_comp.set_me_runners(current_mg5, old_mg5)

        # Run the actual comparison
        my_comp.run_comparison(my_proc_list,
                               ['paralel_test_model_%s' % model, model],
                               orders, energy)

        # Print the output
        if filename:
            my_comp.output_result(filename=filename)

            # Store output to a pickle file in the input_files directory
        if pickle_file:
            me_comparator.PickleRunner.store_comparison(\
                os.path.join(_pickle_path, pickle_file),
                my_comp.get_non_zero_processes(),
                my_comp.me_runners[0].model,
                my_comp.me_runners[0].name,
                my_comp.me_runners[0].orders,
                my_comp.me_runners[0].energy)

        # Assert that all process comparisons passed the tolerance cut
        my_comp.assert_processes(self, tolerance)

        # Do some cleanup
        my_comp.cleanup()
Esempio n. 2
0
    def test_short_heft(self):
        """Test a minimal list of sm 2->2 processes, mainly to test the test"""
        # Create a list of processes to check automatically
        comparisons = me_comparator.PickleRunner.find_comparisons(\
            os.path.join(_pickle_path, "mg5_short_paralleltest_heft.pkl"))
        for stored_runner in comparisons:
            # Create a MERunner object for MG5
            my_mg5 = me_comparator.MG5_UFO_Runner()
            my_mg5.setup(MG5DIR, MG5DIR)

            # Create and setup a comparator
            my_comp = me_comparator.MEComparator()
            my_comp.set_me_runners(stored_runner, my_mg5)

            # Run the actual comparison
            my_comp.run_comparison(stored_runner.proc_list, 'heft',
                                   stored_runner.orders, stored_runner.energy)

            my_comp.assert_processes(self)

            # Do some cleanup
            my_comp.cleanup()
Esempio n. 3
0
    def test_short_sqso(self):
        """Test a short list of processes with squared order constraints"""

        comparisons = me_comparator.PickleRunner.find_comparisons(\
            os.path.join(_pickle_path, "mg5_short_paralleltest_sqso.pkl"))

        for stored_runner in comparisons:
            # Create a MERunner object for MG5
            my_mg5 = me_comparator.MG5_UFO_Runner()
            my_mg5.setup(MG5DIR, MG5DIR)

            # Create and setup a comparator
            my_comp = me_comparator.MEComparator()
            my_comp.set_me_runners(stored_runner, my_mg5)

            # Run the actual comparison
            my_comp.run_comparison(stored_runner.proc_list, 'sm',
                                   stored_runner.orders, stored_runner.energy)

            my_comp.assert_processes(self)

            # Do some cleanup
            my_comp.cleanup()
Esempio n. 4
0
    my_mg4.setup(mg4_path)

    # Create a MERunner object for MG5
    my_mg5 = me_comparator.MG5Runner()
    my_mg5.setup(mg5_path, mg4_path)

    # Create a MERunner object for UFO-ALOHA-MG5
    my_mg5_ufo = me_comparator.MG5_UFO_Runner()
    my_mg5_ufo.setup(mg5_path, mg4_path)

    # Create a MERunner object for C++
    my_mg5_cpp = me_comparator.MG5_CPP_Runner()
    my_mg5_cpp.setup(mg5_path, mg4_path)

    # Create and setup a comparator
    my_comp = me_comparator.MEComparator()
    my_comp.set_me_runners(my_mg5, my_mg5_ufo)

    # Run the actual comparison
    my_comp.run_comparison(my_proc_list,
                           model=model,
                           orders={
                               'QED': 99,
                               'QCD': 99,
                               'HIG': 1,
                               'HIW': 0
                           },
                           energy=2000)

    # Do some cleanup
    #my_comp.cleanup()