def test_find_symmetry_uu_tt_with_subprocess_group(self): """Test the find_symmetry function for subprocess groups""" procs = [[2,2,6,6]] amplitudes = diagram_generation.AmplitudeList() for proc in procs: # Define the multiprocess my_leglist = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in proc]) my_leglist[0].set('state', False) my_leglist[1].set('state', False) my_process = base_objects.Process({'legs':my_leglist, 'model':self.base_model_4ferm}) my_amplitude = diagram_generation.Amplitude(my_process) amplitudes.append(my_amplitude) subproc_group = \ group_subprocs.SubProcessGroup.group_amplitudes(amplitudes, "madevent")[0] symmetry, perms, ident_perms = diagram_symmetry.find_symmetry(\ subproc_group) self.assertEqual(len([s for s in symmetry if s > 0]), 1) self.assertEqual(symmetry, [1]) return
def test_find_symmetry_qq_qqg_with_subprocess_group(self): """Test the find_symmetry function for subprocess groups""" procs = [[2,-2,2,-2,21], [2,2,2,2,21]] amplitudes = diagram_generation.AmplitudeList() for proc in procs: # Define the multiprocess my_leglist = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in proc]) my_leglist[0].set('state', False) my_leglist[1].set('state', False) my_process = base_objects.Process({'legs':my_leglist, 'model':self.base_model}) my_amplitude = diagram_generation.Amplitude(my_process) amplitudes.append(my_amplitude) subproc_group = \ group_subprocs.SubProcessGroup.group_amplitudes(amplitudes)[0] symmetry, perms, ident_perms = diagram_symmetry.find_symmetry(\ subproc_group) self.assertEqual(len([s for s in symmetry if s > 0]), 23) self.assertEqual(symmetry, [1, 1, 1, 1, -2, -3, -4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -21, -22, -23]) return # The test below doesn't apply with the new way of determining # config symmetry for subprocess groups, since we don't demand # that symmetric diagrams have identical particles. # Check that the momentum assignments work matrix_element = \ subproc_group.get('matrix_elements')[1] process = matrix_element.get('processes')[0] evaluator = process_checks.MatrixElementEvaluator(self.base_model, auth_skipping = True, reuse = True) p, w_rambo = evaluator.get_momenta(process) me_value, amp2_org = evaluator.evaluate_matrix_element(\ matrix_element, p) for isym, (sym, perm) in enumerate(zip(symmetry, perms)): new_p = [p[i] for i in perm] if sym >= 0: continue iamp = subproc_group.get('diagram_maps')[1].index(isym+1) isymamp = subproc_group.get('diagram_maps')[1].index(-sym) me_value, amp2 = evaluator.evaluate_matrix_element(\ matrix_element, new_p) self.assertAlmostEqual(amp2[iamp], amp2_org[isymamp])
def test_find_symmetry_qq_qqg_with_subprocess_group(self): """Test the find_symmetry function for subprocess groups""" procs = [[2,-2,2,-2,21], [2,2,2,2,21]] amplitudes = diagram_generation.AmplitudeList() for proc in procs: # Define the multiprocess my_leglist = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in proc]) my_leglist[0].set('state', False) my_leglist[1].set('state', False) my_process = base_objects.Process({'legs':my_leglist, 'model':self.base_model}) my_amplitude = diagram_generation.Amplitude(my_process) amplitudes.append(my_amplitude) subproc_group = \ group_subprocs.SubProcessGroup.group_amplitudes(amplitudes,"madevent")[0] symmetry, perms, ident_perms = diagram_symmetry.find_symmetry(\ subproc_group) self.assertEqual(len([s for s in symmetry if s > 0]), 19) self.assertEqual(symmetry,[1, 1, 1, 1, -2, -3, -4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -8, -9, -10, -11, -12, -13, -14, -18, -19]) return # The test below doesn't apply with the new way of determining # config symmetry for subprocess groups, since we don't demand # that symmetric diagrams have identical particles. # Check that the momentum assignments work matrix_element = \ subproc_group.get('matrix_elements')[1] process = matrix_element.get('processes')[0] evaluator = process_checks.MatrixElementEvaluator(self.base_model, auth_skipping = True, reuse = True) p, w_rambo = evaluator.get_momenta(process) me_value, amp2_org = evaluator.evaluate_matrix_element(\ matrix_element, p) for isym, (sym, perm) in enumerate(zip(symmetry, perms)): new_p = [p[i] for i in perm] if sym >= 0: continue iamp = subproc_group.get('diagram_maps')[1].index(isym+1) isymamp = subproc_group.get('diagram_maps')[1].index(-sym) me_value, amp2 = evaluator.evaluate_matrix_element(\ matrix_element, new_p) self.assertAlmostEqual(amp2[iamp], amp2_org[isymamp])
def test_find_symmetry_decay_chain_with_subprocess_group(self): """Test the find_symmetry function for subprocess groups""" procs = [[2, -1, 24, 21, 21], [-3, 4, 24, 21, 21]] decays = [[24, -11, 12], [24, -13, 14]] amplitudes = diagram_generation.AmplitudeList() decay_amps = diagram_generation.DecayChainAmplitudeList() for proc, decay in zip(procs, decays): # Define the multiprocess my_leglist = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in proc]) my_leglist[0].set('state', False) my_leglist[1].set('state', False) my_decaylegs = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in decay]) my_decaylegs[0].set('state', False) my_process = base_objects.Process({ 'legs': my_leglist, 'model': self.base_model }) my_decay_proc = base_objects.Process({ 'legs': my_decaylegs, 'model': self.base_model, 'is_decay_chain': True }) my_amplitude = diagram_generation.Amplitude(my_process) my_decay = diagram_generation.DecayChainAmplitude(my_decay_proc) amplitudes.append(my_amplitude) decay_amps.append(my_decay) amplitudes = diagram_generation.DecayChainAmplitudeList([\ diagram_generation.DecayChainAmplitude({\ 'amplitudes': amplitudes, 'decay_chains': decay_amps})]) subproc_groups = \ group_subprocs.DecayChainSubProcessGroup.group_amplitudes(\ amplitudes,"madevent").generate_helas_decay_chain_subproc_groups() self.assertEqual(len(subproc_groups), 1) subproc_group = subproc_groups[0] self.assertEqual(len(subproc_group.get('matrix_elements')), 2) symmetry, perms, ident_perms = diagram_symmetry.find_symmetry(\ subproc_group) self.assertEqual(len([s for s in symmetry if s > 0]), 5) self.assertEqual(symmetry, [1, -1, 1, 1, 1, -4, -5, 1])
def test_find_symmetry_decay_chain_with_subprocess_group(self): """Test the find_symmetry function for subprocess groups""" procs = [[2,-1,24,21,21], [-3,4,24,21,21]] decays = [[24,-11,12],[24,-13,14]] amplitudes = diagram_generation.AmplitudeList() decay_amps = diagram_generation.DecayChainAmplitudeList() for proc, decay in zip(procs, decays): # Define the multiprocess my_leglist = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in proc]) my_leglist[0].set('state', False) my_leglist[1].set('state', False) my_decaylegs = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in decay]) my_decaylegs[0].set('state', False) my_process = base_objects.Process({'legs':my_leglist, 'model':self.base_model}) my_decay_proc = base_objects.Process({'legs':my_decaylegs, 'model':self.base_model, 'is_decay_chain': True}) my_amplitude = diagram_generation.Amplitude(my_process) my_decay = diagram_generation.DecayChainAmplitude(my_decay_proc) amplitudes.append(my_amplitude) decay_amps.append(my_decay) amplitudes = diagram_generation.DecayChainAmplitudeList([\ diagram_generation.DecayChainAmplitude({\ 'amplitudes': amplitudes, 'decay_chains': decay_amps})]) subproc_groups = \ group_subprocs.DecayChainSubProcessGroup.group_amplitudes(\ amplitudes).generate_helas_decay_chain_subproc_groups() self.assertEqual(len(subproc_groups), 1) subproc_group = subproc_groups[0] self.assertEqual(len(subproc_group.get('matrix_elements')), 2) symmetry, perms, ident_perms = diagram_symmetry.find_symmetry(\ subproc_group) self.assertEqual(len([s for s in symmetry if s > 0]), 5) self.assertEqual(symmetry, [1, -1, 1, 1, 1, -4, -5, 1])
def test_find_symmetry_epem_aaa(self): """Test the find_symmetry function""" myleglist = base_objects.LegList() myleglist.append(base_objects.Leg({'id':-11, 'state':False})) myleglist.append(base_objects.Leg({'id':11, 'state':False})) myleglist.append(base_objects.Leg({'id':22, 'state':True})) myleglist.append(base_objects.Leg({'id':22, 'state':True})) myleglist.append(base_objects.Leg({'id':22, 'state':True})) myproc = base_objects.Process({'legs':myleglist, 'model':self.base_model}) myamplitude = diagram_generation.Amplitude(myproc) matrix_element = helas_objects.HelasMatrixElement(myamplitude) symmetry, perms, ident_perms = diagram_symmetry.find_symmetry(matrix_element) self.assertEqual(symmetry, [6,-1,-1,-1,-1,-1]) # Check that the momentum assignments work process = matrix_element.get('processes')[0] evaluator = process_checks.MatrixElementEvaluator(self.base_model, auth_skipping = True, reuse = True) p, w_rambo = evaluator.get_momenta(process) me_value, amp2_org = evaluator.evaluate_matrix_element(\ matrix_element, p) for isym, (sym, perm) in enumerate(zip(symmetry, perms)): new_p = [p[i] for i in perm] if sym >= 0: continue me_value, amp2 = evaluator.evaluate_matrix_element(matrix_element, new_p) self.assertAlmostEqual(amp2[isym], amp2_org[-sym-1])
def test_find_symmetry_gg_tt_fullylept(self): """Test the find_symmetry function for subprocess groups""" procs = [[21,21, 6, -6]] decayt = [[6,5,-11,12],[6, 5,-13, 14]] decaytx = [[-6,-5,11,-12],[-6, -5, 13,-14]] amplitudes = diagram_generation.AmplitudeList() decay_amps = diagram_generation.DecayChainAmplitudeList() proc = procs[0] my_leglist = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in proc]) my_leglist[0].set('state', False) my_leglist[1].set('state', False) my_process = base_objects.Process({'legs':my_leglist, 'model':self.base_model}) my_amplitude = diagram_generation.Amplitude(my_process) amplitudes.append(my_amplitude) for dect in decayt: my_top_decaylegs = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in dect]) my_top_decaylegs[0].set('state', False) my_decayt_proc = base_objects.Process({'legs':my_top_decaylegs, 'model':self.base_model, 'is_decay_chain': True}) my_decayt = diagram_generation.DecayChainAmplitude(my_decayt_proc) decay_amps.append(my_decayt) for dectx in decaytx: # Define the multiprocess my_topx_decaylegs = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in dectx]) my_topx_decaylegs[0].set('state', False) my_decaytx_proc = base_objects.Process({'legs':my_topx_decaylegs, 'model':self.base_model, 'is_decay_chain': True}) my_decaytx = diagram_generation.DecayChainAmplitude(my_decaytx_proc) decay_amps.append(my_decaytx) amplitudes = diagram_generation.DecayChainAmplitudeList([\ diagram_generation.DecayChainAmplitude({\ 'amplitudes': amplitudes, 'decay_chains': decay_amps})]) subproc_groups = \ group_subprocs.DecayChainSubProcessGroup.group_amplitudes(\ amplitudes).generate_helas_decay_chain_subproc_groups() self.assertEqual(len(subproc_groups), 1) subproc_group = subproc_groups[0] self.assertEqual(len(subproc_group.get('matrix_elements')), 1) symmetry, perms, ident_perms = diagram_symmetry.find_symmetry(\ subproc_group) sol_perms = [list(range(8)), list(range(8)), [0,1,5,6,7,2,3,4]] self.assertEqual(len([s for s in symmetry if s > 0]), 2) self.assertEqual(symmetry, [1, 1, -2]) self.assertEqual(perms, sol_perms)
def test_find_symmetry_gg_tt_fullylept(self): """Test the find_symmetry function for subprocess groups""" procs = [[21,21, 6, -6]] decayt = [[6,5,-11,12],[6, 5,-13, 14]] decaytx = [[-6,-5,11,-12],[-6, -5, 13,-14]] amplitudes = diagram_generation.AmplitudeList() decay_amps = diagram_generation.DecayChainAmplitudeList() proc = procs[0] my_leglist = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in proc]) my_leglist[0].set('state', False) my_leglist[1].set('state', False) my_process = base_objects.Process({'legs':my_leglist, 'model':self.base_model}) my_amplitude = diagram_generation.Amplitude(my_process) amplitudes.append(my_amplitude) for dect in decayt: my_top_decaylegs = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in dect]) my_top_decaylegs[0].set('state', False) my_decayt_proc = base_objects.Process({'legs':my_top_decaylegs, 'model':self.base_model, 'is_decay_chain': True}) my_decayt = diagram_generation.DecayChainAmplitude(my_decayt_proc) decay_amps.append(my_decayt) for dectx in decaytx: # Define the multiprocess my_topx_decaylegs = base_objects.LegList([\ base_objects.Leg({'id': id, 'state': True}) for id in dectx]) my_topx_decaylegs[0].set('state', False) my_decaytx_proc = base_objects.Process({'legs':my_topx_decaylegs, 'model':self.base_model, 'is_decay_chain': True}) my_decaytx = diagram_generation.DecayChainAmplitude(my_decaytx_proc) decay_amps.append(my_decaytx) amplitudes = diagram_generation.DecayChainAmplitudeList([\ diagram_generation.DecayChainAmplitude({\ 'amplitudes': amplitudes, 'decay_chains': decay_amps})]) subproc_groups = \ group_subprocs.DecayChainSubProcessGroup.group_amplitudes(\ amplitudes).generate_helas_decay_chain_subproc_groups() self.assertEqual(len(subproc_groups), 1) subproc_group = subproc_groups[0] self.assertEqual(len(subproc_group.get('matrix_elements')), 1) symmetry, perms, ident_perms = diagram_symmetry.find_symmetry(\ subproc_group) sol_perms = [range(8), range(8), [0,1,5,6,7,2,3,4]] self.assertEqual(len([s for s in symmetry if s > 0]), 2) self.assertEqual(symmetry, [1, 1, -2]) self.assertEqual(perms, sol_perms)