1
1
################################################################################
3
# Copyright (c) 2009 The MadGraph Development team and Contributors
3
# Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors
5
# This file is a part of the MadGraph 5 project, an application which
5
# This file is a part of the MadGraph5_aMC@NLO project, an application which
6
6
# automatically generates Feynman diagrams and matrix elements for arbitrary
7
7
# high-energy processes in the Standard Model and beyond.
9
# It is subject to the MadGraph license which should accompany this
9
# It is subject to the MadGraph5_aMC@NLO license which should accompany this
12
# For more information, please visit: http://madgraph.phys.ucl.ac.be
12
# For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch
14
14
################################################################################
15
15
"""Unit test library for the various base objects of the core library"""
1593
1608
goal = goal + " \'forbidden_particles\': [],\n"
1594
1609
goal = goal + " \'is_decay_chain\': False,\n"
1595
1610
goal = goal + " \'decay_chains\': [],\n"
1596
goal = goal + " \'legs_with_decays\': %s\n}" % repr(self.myleglist)
1611
goal = goal + " \'legs_with_decays\': %s,\n" % repr(self.myleglist)
1612
goal = goal + " \'perturbation_couplings\': [],\n"
1613
goal = goal + " \'has_born\': True,\n"
1614
goal = goal + " \'NLO_mode\': 'tree'\n}"
1616
for a, b in zip(goal.split('\n'), str(self.myprocess).split('\n')):
1617
self.assertEqual(a,b)
1598
1618
self.assertEqual(goal, str(self.myprocess))
1600
1620
def test_nice_string(self):
1601
1621
"""Test Process nice_string representation"""
1603
goal_str = "Process: c c > c c c QCD=5 QED=1 @1"
1623
goal_str = "Process: c c > c c c QED=1 QCD=5 @1"
1605
1625
self.assertEqual(goal_str, self.myprocess.nice_string())
1607
1627
def test_input_string(self):
1608
1628
"""Test Process nice_string representation"""
1610
goal_str = "c c > c c c QCD=5 QED=1, (c > c c c c, c > c c c c)"
1630
goal_str = "c c > c c c QED=1 QCD=5, (c > c c c c, c > c c c c)"
1612
1632
decay = copy.copy(self.myprocess)
1613
1633
decay.set('legs', copy.deepcopy(decay.get('legs')))
1655
1675
self.assertTrue(len(self.myprocess.shell_string()) < 70)
1656
1676
self.assertEqual(goal_str, self.myprocess.shell_string())
1678
def test_get_final_ids_after_decay(self):
1679
"""check that we get the correct ids and in the correct order"""
1681
mymodel = base_objects.Model()
1682
mypartlist = base_objects.ParticleList([
1683
base_objects.Particle({'name':'c',
1686
base_objects.Particle({'name':'l',
1689
base_objects.Particle({'name':'H',
1694
mymodel.set('particles', mypartlist)
1696
# Check for c c~ > h c, h > l l~
1698
myleglist = base_objects.LegList(\
1699
[base_objects.Leg({'id':3,
1702
'from_group':False}),
1703
base_objects.Leg({'id':3,
1706
'from_group':False}),
1707
base_objects.Leg({'id':25,
1710
'from_group':False}),
1711
base_objects.Leg({'id':3,
1714
'from_group':False})])
1716
mylegdecay = base_objects.LegList(\
1717
[base_objects.Leg({'id':25,
1720
'from_group':False}),
1721
base_objects.Leg({'id':11,
1724
'from_group':False}),
1725
base_objects.Leg({'id':-11,
1728
'from_group':False})])
1730
mydecay = {'legs':mylegdecay,
1731
'orders':{'QCD':5, 'QED':1},
1735
'required_s_channels':[],
1736
'forbidden_s_channels':[],
1737
'forbidden_onsh_s_channels':[],
1738
'forbidden_particles':[],
1739
'perturbation_couplings':[],
1740
'is_decay_chain': False,
1741
'decay_chains': base_objects.ProcessList(),
1742
'legs_with_decays': [],
1743
'squared_orders': {},
1745
'overall_orders': {},
1749
mydecay = base_objects.Process(mydecay)
1751
myprocess = copy.copy(mydecay)
1752
myprocess['legs'] = myleglist
1753
myprocess['is_decay_chain'] = True
1754
proclist = base_objects.ProcessList()
1755
proclist.append(mydecay)
1756
myprocess['decay_chains'] = proclist
1759
output = myprocess.get_final_ids_after_decay()
1760
self.assertEqual(output, [11, -11, 3])
1762
## c c~ > c h c~ h c, h > l l, h > l~ l~
1763
myleglist = base_objects.LegList(\
1764
[base_objects.Leg({'id':3,
1767
'from_group':False}),
1768
base_objects.Leg({'id':-3,
1771
'from_group':False}),
1772
base_objects.Leg({'id':3,
1775
'from_group':False}),
1776
base_objects.Leg({'id':25,
1779
'from_group':False}),
1780
base_objects.Leg({'id':-3,
1783
'from_group':False}),
1784
base_objects.Leg({'id':25,
1787
'from_group':False}),
1788
base_objects.Leg({'id':3,
1791
'from_group':False})])
1793
mylegdecay = base_objects.LegList(\
1794
[base_objects.Leg({'id':25,
1797
'from_group':False}),
1798
base_objects.Leg({'id':11,
1801
'from_group':False}),
1802
base_objects.Leg({'id':11,
1805
'from_group':False})])
1806
mydecay['legs'] = mylegdecay
1808
mylegdecay2 = base_objects.LegList(\
1809
[base_objects.Leg({'id':25,
1812
'from_group':False}),
1813
base_objects.Leg({'id':-11,
1816
'from_group':False}),
1817
base_objects.Leg({'id':-11,
1820
'from_group':False})])
1821
mydecay2 = copy.copy(mydecay)
1822
mydecay2['legs'] = mylegdecay2
1825
myprocess['legs'] = myleglist
1826
myprocess['is_decay_chain'] = True
1827
proclist = base_objects.ProcessList()
1828
proclist.append(mydecay)
1829
proclist.append(mydecay2)
1830
myprocess['decay_chains'] = proclist
1832
output = myprocess.get_final_ids_after_decay()
1833
self.assertEqual(output, [3, 11, 11, -3,-11,-11,3])
1658
1835
#===============================================================================
1659
1836
# ProcessDefinitionTest
1660
1837
#===============================================================================