def test_set_color_links(self):
     """tests that the set_color_links of a FKSHelasProcess
     returns the correct list of color_links."""
     #ug> ug
     fks1 = fks_base.FKSProcess(self.myproc1)
     #ug>gu
     fks1_qed = fks_base.FKSProcess(self.myproc1_qed)
     me_list = []
     me_list_qed = []
     me_id_list = []
     me_id_list_qed = []
     pdg_list1 = []
     pdg_list1_qed = []
     real_amp_list1 = diagram_generation.AmplitudeList()
     real_amp_list1_qed = diagram_generation.AmplitudeList()
     fks1.generate_reals(pdg_list1, real_amp_list1)
     fks1_qed.generate_reals(pdg_list1_qed, real_amp_list1_qed)
     helas_born_proc = fks_helas.FKSHelasProcess(fks1, me_list, me_id_list)
     helas_born_proc_qed = fks_helas.FKSHelasProcess(\
                                 fks1_qed,me_list_qed,me_id_list_qed)
     helas_born_proc.set_color_links()
     helas_born_proc_qed.set_color_links()
     legpair = [link['link'] for link in helas_born_proc.color_links]
     legpair_qed = [
         link['link'] for link in helas_born_proc_qed.color_links
     ]
     tar_legpair = [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
     tar_legpair_qed = [[1, 4]]
     self.assertEqual(legpair, tar_legpair)
     self.assertEqual(legpair_qed, tar_legpair_qed)
Exemple #2
0
    def test_fks_helas_process_init(self):
        """tests the correct initialization of a FKSHelasProcess object.
        in particular checks:
        -- born ME
        -- list of FKSHelasRealProcesses
        -- color links
        -- fks_infos
        """
        #ug> ug
        fks1 = fks_base.FKSProcess(self.myproc1)
        #uu~> dd~
        fks3 = fks_base.FKSProcess(self.myproc3)

        pdg_list1 = []
        real_amp_list1 = diagram_generation.AmplitudeList()
        pdg_list3 = []
        real_amp_list3 = diagram_generation.AmplitudeList()
        fks1.generate_reals(pdg_list1, real_amp_list1)
        fks3.generate_reals(pdg_list3, real_amp_list3)

        me_list = []
        me_id_list = []
        me_list3 = []
        me_id_list3 = []
        res_me_list = []
        res_me_id_list = []

        helas_born_proc = fks_helas.FKSHelasProcess(fks1, me_list, me_id_list)
        helas_born_proc3 = fks_helas.FKSHelasProcess(fks3, me_list3,
                                                     me_id_list3)

        self.assertEqual(helas_born_proc.born_matrix_element,
                         helas_objects.HelasMatrixElement(fks1.born_amp))
        res_reals = []
        for real in fks1.real_amps:
            res_reals.append(
                fks_helas.FKSHelasRealProcess(real, res_me_list,
                                              res_me_id_list))
            # the process u g > u g g corresponds to 4 fks configs
            if real.pdgs == array.array('i', [2, 21, 2, 21, 21]):
                self.assertEqual(len(real.fks_infos), 4)
            else:
                # any other process has only 1 fks config
                self.assertEqual(len(real.fks_infos), 1)

        self.assertEqual(me_list, res_me_list)
        self.assertEqual(me_id_list, res_me_id_list)
        self.assertEqual(8, len(helas_born_proc.real_processes))
        self.assertNotEqual(helas_born_proc.born_matrix_element,
                            helas_born_proc3.born_matrix_element)
        for a, b in zip(helas_born_proc3.real_processes,
                        helas_born_proc.real_processes):
            self.assertNotEqual(a, b)
    def test_get_fks_info_list(self):
        """tests that the get_fks_info_list of a FKSHelasProcess 
        returns the correct list of configurations/fks_configs"""

        #ug> ug
        fks1 = fks_base.FKSProcess(self.myproc1)
        me_list = []
        me_id_list = []
        pdg_list1 = []
        real_amp_list1 = diagram_generation.AmplitudeList()
        fks1.generate_reals(pdg_list1, real_amp_list1)
        helas_born_proc = fks_helas.FKSHelasProcess(fks1, me_list, me_id_list)
        goal = \
            [
             {'n_me' : 1, 'pdgs':[2,21,2,21,21], \
                 'fks_info': {'i':5, 'j':1, 'ij':1, 'ij_glu':0, 'need_color_links':True,
                              'rb_links': [{'born_conf': 0, 'real_conf': 11},
                                           {'born_conf': 1, 'real_conf': 10},
                                           {'born_conf': 2, 'real_conf': 9}]}},
             {'n_me' : 1, 'pdgs':[2,21,2,21,21], \
                 'fks_info': {'i':5, 'j':2, 'ij':2, 'ij_glu':2, 'need_color_links':True,
                              'rb_links': [{'born_conf': 0, 'real_conf': 14},
                                           {'born_conf': 1, 'real_conf': 4},
                                           {'born_conf': 2, 'real_conf': 7}]}},
             {'n_me' : 1, 'pdgs':[2,21,2,21,21], \
                 'fks_info': {'i':5, 'j':3, 'ij':3, 'ij_glu':0, 'need_color_links':True,
                              'rb_links': [{'born_conf': 0, 'real_conf': 1},
                                           {'born_conf': 1, 'real_conf': 13},
                                           {'born_conf': 2, 'real_conf': 8}]}},
             {'n_me' : 1, 'pdgs':[2,21,2,21,21], \
                 'fks_info': {'i':5, 'j':4, 'ij':4, 'ij_glu':4, 'need_color_links':True,
                              'rb_links': [{'born_conf': 0, 'real_conf': 2},
                                           {'born_conf': 1, 'real_conf': 5},
                                           {'born_conf': 2, 'real_conf': 12}]}},
             {'n_me' : 2, 'pdgs':[21,21,2,-2,21], \
                 'fks_info': {'i':4, 'j':1, 'ij':1, 'ij_glu':0, 'need_color_links':False,
                              'rb_links': [{'born_conf': 0, 'real_conf': 8},
                                           {'born_conf': 1, 'real_conf': 7},
                                           {'born_conf': 2, 'real_conf': 6}]}},
             {'n_me' : 3, 'pdgs':[2,-1,2,-1,21], \
                 'fks_info': {'i':4, 'j':2, 'ij':2, 'ij_glu':2, 'need_color_links':False,
                              'rb_links': [{'born_conf': 0, 'real_conf': 4},
                                           {'born_conf': 1, 'real_conf': 0},
                                           {'born_conf': 2, 'real_conf': 3}]}},
             {'n_me' : 4, 'pdgs':[2,1,2,1,21], \
                 'fks_info': {'i':4, 'j':2, 'ij':2, 'ij_glu':2, 'need_color_links':False,
                              'rb_links': [{'born_conf': 0, 'real_conf': 4},
                                           {'born_conf': 1, 'real_conf': 0},
                                           {'born_conf': 2, 'real_conf': 3}]}},
             {'n_me' : 5, 'pdgs':[2,-2,2,-2,21], \
                 'fks_info': {'i':4, 'j':2, 'ij':2, 'ij_glu':2, 'need_color_links':False,
                              'rb_links': [{'born_conf': 0, 'real_conf': 8},
                                           {'born_conf': 1, 'real_conf': 3},
                                           {'born_conf': 2, 'real_conf': 6}]}},
             {'n_me' : 6, 'pdgs':[2,2,2,2,21], \
                 'fks_info': {'i':4, 'j':2, 'ij':2, 'ij_glu':2, 'need_color_links':False,
                              'rb_links': [{'born_conf': 0, 'real_conf': 9},
                                           {'born_conf': 1, 'real_conf': 0},
                                           {'born_conf': 2, 'real_conf': 7}]}},
             {'n_me' : 7, 'pdgs':[2,21,2,1,-1], \
                 'fks_info': {'i':5, 'j':4, 'ij':4, 'ij_glu':4, 'need_color_links':False,
                              'rb_links': [{'born_conf': 0, 'real_conf': 0},
                                           {'born_conf': 1, 'real_conf': 3},
                                           {'born_conf': 2, 'real_conf': 4}]}},
             {'n_me' : 8, 'pdgs':[2,21,2,2,-2], \
                 'fks_info': {'i':5, 'j':4, 'ij':4, 'ij_glu':4, 'need_color_links':False,
                              'rb_links': [{'born_conf': 0, 'real_conf': 1},
                                           {'born_conf': 1, 'real_conf': 4},
                                           {'born_conf': 2, 'real_conf': 8}]}},
             ]
        for a, b in zip(goal, helas_born_proc.get_fks_info_list()):
            self.assertEqual(a, b)

        self.assertEqual(goal, helas_born_proc.get_fks_info_list())