~maddevelopers/mg5amcnlo/ttbar_MadSpin_FO

« back to all changes in this revision

Viewing changes to tests/unit_tests/interface/test_cmd.py

  • Committer: olivier-mattelaer
  • Date: 2020-05-25 18:16:07 UTC
  • mfrom: (956.1.32 3.0.2)
  • Revision ID: olivier-mattelaer-20200525181607-eevbr5wynsn782ll
pass to 3.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
        """check if generate format are correctly supported"""
205
205
    
206
206
        cmd = self.cmd
 
207
        cmd.do_import('sm')
207
208
        
208
209
        # valid syntax
209
210
        cmd.check_process_format('e+ e- > e+ e-')
211
212
        cmd.check_process_format('e+ e- > mu+ ta- / x $y @1')
212
213
        cmd.check_process_format('e+ e- > mu+ ta- $ x /y @1')
213
214
        cmd.check_process_format('e+ e- > mu+ ta- $ x /y, (e+ > e-, e-> ta) @1')
 
215
        cmd.check_process_format('e+ e- > Z{L}, Z > mu+ mu- @1')
 
216
        cmd.check_process_format('e+ e- > Z{0}, Z > mu+ mu- @1')
 
217
        cmd.check_process_format('e+{L} e- > mu+{L} mu-{R} @1')
 
218
        cmd.check_process_format('e+ e- > t{L} t~ Z{L}, t > mu+ mu- @1')
 
219
        cmd.check_process_format('g g > Z Z [ noborn=QCD] @1')
 
220
        cmd.check_process_format('u u~ > 2w+ 2j')
 
221
        cmd.check_process_format('u u~ > 2w+{0} 2j')
214
222
        
215
223
        # unvalid syntax
216
224
        self.wrong(cmd.check_process_format, ' e+ e-')
223
231
        self.wrong(cmd.check_process_format, ' e+ > e+, (e+ > e- / z, e- > top')   
224
232
        self.wrong(cmd.check_process_format, 'e+ > ')
225
233
        self.wrong(cmd.check_process_format, 'e+ >')
 
234
        self.wrong(cmd.check_process_format, 'e+ e- > Z{L} > mu+ mu-')
 
235
        self.wrong(cmd.check_process_format, 'e+ e- > Z > mu+ mu- / W+{L}')
 
236
        self.wrong(cmd.check_process_format, 'e+ e- > Z > mu+ mu- $ W+{L}')
 
237
        self.wrong(cmd.check_process_format, 'u u~ > t{L} t~ [QCD]')
 
238
        self.wrong(cmd.check_process_format, 'u u~ > W+{L} vl [ QED QCD]')
 
239
        self.wrong(cmd.check_process_format,'u u~ > w+{L} [QCD]')
 
240
        self.wrong(cmd.check_process_format,'u u~ > e+{L} vl [QCD]')
226
241
        
227
242
    @test_aloha.set_global()
228
243
    def test_output_default(self):
236
251
        cmd.check_output([])
237
252
        
238
253
        self.assertNotEqual('tmp', cmd._export_dir)
 
254
        
 
255
    @test_aloha.set_global()
 
256
    def test_simple_generate(self):
 
257
        """check that simple syntax goes trough and return expected process"""
 
258
           
 
259
        cmd = self.cmd
 
260
        self.do('import model sm')
 
261
        self.do('generate 2p > 2j')
 
262
        self.assertTrue(cmd._curr_amps)
 
263
        proc = cmd._curr_amps[0].get('process').get('legs')
 
264
        self.assertEqual(len(proc), 4)
 
265
        
239
266
 
240
267
 
241
268
class TestExtendedCmd(unittest.TestCase):
310
337
        self.assertEqual(output, set([-11, 11, -13, 13, 1, 2, 3, 4, 21, -1, -2,-3,-4]))
311
338
        
312
339
        output = self.cmd.get_final_part(' p p > t t~ [ all = QCD ] , (t > b z, z > l+ l-) ')
313
 
        self.assertEqual(output, set([-11, 11, -13, 13, -6, 5]))        
314
 
        
315
 
        
 
340
        self.assertEqual(output, set([-11, 11, -13, 13, -6, 5])) 
 
341
        
 
342
        output = self.cmd.get_final_part('p p > 2Z')
 
343
        self.assertEqual(output, set([23]))        
 
344
        
 
345
        output = self.cmd.get_final_part('p p > Z{L} j')
 
346
        self.assertEqual(output, set([1, 2, 3, 4, -1, 21, -4, -3, -2, 23]))         
 
347
 
 
348
        output = self.cmd.get_final_part('p p > Z{L} j, Z > e+ e-')
 
349
        self.assertEqual(output, set([1, 2, 3, 4, -1, 21, -4, -3, -2, 11, -11])) 
 
350
        
 
351
        output = self.cmd.get_final_part('p p > 2Z{L} ')
 
352
        self.assertEqual(output, set([23]))         
 
353
 
 
354
        output = self.cmd.get_final_part('p p > 2Z{L} j, Z > e+ e-')
 
355
        self.assertEqual(output, set([1, 2, 3, 4, -1, 21, -4, -3, -2, 11, -11]))