Package madgraph :: Package fks :: Module fks_common
[hide private]
[frames] | no frames]

Source Code for Module madgraph.fks.fks_common

  1  ################################################################################ 
  2  # 
  3  # Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors 
  4  # 
  5  # This file is a part of the MadGraph5_aMC@NLO project, an application which  
  6  # automatically generates Feynman diagrams and matrix elements for arbitrary 
  7  # high-energy processes in the Standard Model and beyond. 
  8  # 
  9  # It is subject to the MadGraph5_aMC@NLO license which should accompany this  
 10  # distribution. 
 11  # 
 12  # For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch 
 13  # 
 14  ################################################################################ 
 15   
 16  """Definitions of the objects needed both for MadFKS from real  
 17  and MadFKS from born""" 
 18   
 19  import madgraph.core.base_objects as MG 
 20  import madgraph.core.helas_objects as helas_objects 
 21  import madgraph.core.diagram_generation as diagram_generation 
 22  import madgraph.core.color_amp as color_amp 
 23  import madgraph.core.color_algebra as color_algebra 
 24  from operator import itemgetter 
 25  import copy 
 26  import logging 
 27  import array 
 28  import fractions 
29 30 31 32 -class FKSProcessError(Exception):
33 """Exception for MadFKS""" 34 pass
35
36 37 -class FKSDiagramTag(diagram_generation.DiagramTag): #test written
38 """Modified diagram tags to be used to link born and real configurations. 39 """ 40 41 @staticmethod 48 220
221 222 223 -def find_orders(amp): #test_written
224 """Takes an amplitude as input, and returns a dictionary with the 225 orders of the couplings. 226 """ 227 assert isinstance(amp, diagram_generation.Amplitude) 228 orders = {} 229 for diag in amp.get('diagrams'): 230 for order, value in diag.get('orders').items(): 231 if value != 0 or order in amp['process']['orders'].keys(): 232 try: 233 orders[order] = max(orders[order], value) 234 except KeyError: 235 orders[order] = value 236 return orders 237
238 239 -def find_splittings(leg, model, dict, pert='QCD'): #test written
240 """Finds the possible splittings corresponding to leg 241 """ 242 if dict == {}: 243 dict = find_pert_particles_interactions(model, pert) 244 splittings = [] 245 #check that the leg is a qcd leg 246 247 if leg.get('id') in dict['pert_particles']: 248 part = model.get('particle_dict')[leg.get('id')] 249 antipart = model.get('particle_dict')[part.get_anti_pdg_code()] 250 for ii in dict['interactions']: 251 #check which interactions contain leg and at least one soft particles: 252 parts = copy.deepcopy(ii['particles']) 253 nsoft = 0 254 if part in parts: 255 #pops the ANTI-particle of part from the interaction 256 parts.pop(parts.index(antipart)) 257 for p in parts: 258 if p.get_pdg_code() in dict['soft_particles']: 259 nsoft += 1 260 if nsoft >= 1: 261 splittings.extend(split_leg(leg, parts, model)) 262 return splittings 263
264 265 -def split_leg(leg, parts, model): #test written
266 """Splits the leg into parts, and returns the two new legs. 267 """ 268 #for an outgoing leg take the antiparticles 269 split = [] 270 #for a final state particle one can have only a splitting 271 if leg['state'] : 272 split.append([]) 273 for part in parts: 274 split[-1].append(to_fks_leg({'state': True, \ 275 'id': part.get_pdg_code()},model)) 276 ij_final(split[-1]) 277 #while for an initial state particle one can have two splittings 278 # if the two partons are different 279 else: 280 if parts[0] != parts[1]: 281 for part in parts: 282 cparts = copy.deepcopy(parts) 283 split.append([\ 284 to_fks_leg({'state': False, 285 'id': cparts.pop(cparts.index(part)).get_pdg_code(), 286 'fks': 'j'}, model), 287 to_fks_leg({'state': True, 288 'id': cparts[0].get_anti_pdg_code(), 289 'fks': 'i'}, model)\ 290 ]) 291 else: 292 split.append([\ 293 to_fks_leg({'state': False, 294 'id': parts[0].get_pdg_code(), 295 'fks': 'j'}, model), 296 to_fks_leg({'state': True, 297 'id': parts[1].get_anti_pdg_code(), 298 'fks': 'i'}, model)]) 299 return split 300
301 302 -def ij_final(pair):
303 """given a pair of legs in the final state, assigns the i/j fks id 304 NOTE: the j partons is always put before the i one 305 """ 306 #if a massless bosonic particle is in the pair, it is i 307 #else by convention the anti-particle is labeled i 308 #the order of the splitting is [ j, i] 309 if len(pair) == 2: 310 for i in range(len(pair)): 311 set = 0 312 if (pair[i]['massless'] and pair[i]['self_antipart']) or \ 313 (not pair[i]['is_part'] and pair[1-i]['is_part'] and\ 314 (pair[i]['spin']+pair[1-i]['spin'])%2==0) and not set: 315 pair[i]['fks'] = 'i' 316 pair[1-i]['fks'] = 'j' 317 #check that first j then i 318 if i < 1 - i: 319 pair.reverse() 320 set = 1
321
322 -def insert_legs(leglist_orig, leg, split,pert='QCD'):
323 """Returns a new leglist with leg splitted into split. 324 The convention is to remove leg ij, replace it with leg j, and put 325 i at the end of the group of legs with the same color(charge) representation 326 """ 327 if pert =='QCD': 328 color = 'color' 329 elif pert == 'QED': 330 color = 'charge' 331 else: 332 raise FKSProcessError, "Only QCD or QED is allowed not %s" % pert 333 # the deepcopy statement is crucial 334 leglist = FKSLegList(copy.deepcopy(leglist_orig)) 335 #find the position of the first final state leg 336 for i in range(len(leglist)): 337 if leglist[-i - 1].get('state'): 338 firstfinal = len(leglist) - i - 1 339 # replace leg with leg_j (split[0]) 340 leglist[leglist.index(leg)] = split[0] 341 # and find where to insert i (split[1]) 342 col_maxindex = {} 343 mass_col_maxindex = {} 344 for col in set([l[color] for l in leglist[firstfinal:] if l['massless']]): 345 col_maxindex[col] = max([0] + [leglist.index(l) for l in leglist[firstfinal:]\ 346 if l[color] == col and l['massless']]) 347 for col in set([abs(l[color]) for l in leglist[firstfinal:] if not l['massless']]): 348 mass_col_maxindex[col] = max([0] + [leglist.index(l) for l in leglist[firstfinal:]\ 349 if abs(l[color]) == col and not l['massless']]) 350 #no need to keep info on particles with color > i 351 if pert == 'QCD': 352 for col in copy.copy(col_maxindex.keys()): 353 if abs(col) > abs(split[1][color]): 354 del col_maxindex[col] 355 ### for col in copy.copy(mass_col_maxindex.keys()): 356 ### if abs(col) > abs(split[1][color]): 357 ### del mass_col_maxindex[col] 358 #also remove antiquarks if i is a quark or a fermion 359 if split[1]['is_part'] and not split[1]['self_antipart']: 360 # In old MADFKS5, the line below was used instead. It is however equivalent in principle. 361 # We can remove this comment and the line below altogether after validation and complete 362 # merge of the EW branch in aMC@NLO trunk. 363 #if split[1][color] > 0: 364 try: 365 del col_maxindex[-split[1][color]] 366 except KeyError: 367 pass 368 #so now the maximum of the max_col entries should be the position to insert leg i 369 leglist.insert(max(col_maxindex.values() + mass_col_maxindex.values() + [firstfinal - 1] ) + 1, split[1]) 370 ### leglist.insert(max(col_maxindex.values() + [firstfinal - 1] ) + 1, split[1]) 371 # for sleg in split: 372 # leglist.insert(i, sleg) 373 # #keep track of the number for initial state legs 374 # #if not sleg.get('state') and not leg.get('state'): 375 # leglist[i]['number'] = leg['number'] 376 # i += 1 377 # if i < firstfinal: 378 # i = firstfinal 379 # 380 # leglist.sort() 381 for i, leg in enumerate(leglist): 382 leg['number'] = i + 1 383 return leglist
384
385 386 -def combine_ij( i, j, model, dict, pert='QCD'): #test written
387 """checks whether FKSlegs i and j can be combined together in the given model 388 and with given perturbation order and if so combines them into ij. 389 If dict is empty it is initialized with find_pert_particles_interactions 390 """ 391 if dict == {}: 392 dict = find_pert_particles_interactions(model, pert) 393 ij = [] 394 num = copy.copy(min(i.get('number'), j.get('number'))) 395 396 # we do not want j being a massless vector unless also i is or j is initial 397 not_double_counting = (j.get('spin') == 3 and j.get('massless') and 398 i.get('spin') == 3 and i.get('massless')) or \ 399 j.get('spin') != 3 or not j.get('massless') or \ 400 not j.get('state') 401 402 #if i and j are a final state particle and antiparticle pair, 403 # then we want i to be antipart and j to be 404 if j.get('state') and j.get('id') == - i.get('id'): 405 not_double_counting = not_double_counting and j.get('id') >0 406 407 if i.get('id') in dict['soft_particles'] and \ 408 j.get('id') in dict['pert_particles'] and \ 409 i.get('state') and not_double_counting: 410 for int in dict['interactions']: 411 parts= copy.copy(int['particles']) 412 #remove i 413 try: 414 parts.remove(model.get('particle_dict')[i.get('id')]) 415 except ValueError: 416 continue 417 418 #remove j if final state, anti j if initial state 419 if j.get('state'): 420 j_id = j.get('id') 421 else: 422 j_id = model.get('particle_dict')[j.get('id')].get_anti_pdg_code() 423 try: 424 parts.remove(model.get('particle_dict')[j_id]) 425 except ValueError: 426 continue 427 428 #ij is what remains if j is initial, the anti of if j is final 429 if j.get('state'): 430 ij.append(MG.Leg({ 431 'id': parts[0].get_anti_pdg_code(), 432 'state': True, 433 'number': num})) 434 else: 435 ij.append(MG.Leg({ 436 'id': parts[0].get_pdg_code(), 437 'state': False, 438 'number': num})) 439 return to_fks_legs(ij, model) 440
441 442 -def find_pert_particles_interactions(model, pert_order = 'QCD'): #test written
443 """given a model and pert_order, returns a dictionary with as entries: 444 --interactions : the interactions of order pert_order 445 --pert_particles : pdgs of particles taking part to interactions 446 --soft_particles : pdgs of massless particles in pert_particles 447 """ 448 #ghost_list = [82, -82] # make sure ghost_list is non-empty 449 ghost_list = [] 450 ghost_list += [ p.get_pdg_code() for p in model.get('particles') if p.get('ghost')] 451 qcd_inter = MG.InteractionList() 452 pert_parts = [] 453 soft_parts = [] 454 for i, ii in model.get('interaction_dict').items(): 455 # i want interections of pert_order: 1 (from LO to NLO), 456 # without any other orders 457 # and of "base" type 458 if ii.get('type') != 'base': continue 459 460 if ii.get('orders') == {pert_order:1} and len(ii['particles']) == 3 : 461 masslist = [p.get('mass').lower() for p in ii['particles']] 462 463 # require that at least one particle be soft and of even spin for the interaction to be IR singular 464 found_soft_even_spin_particle = False 465 for p in ii['particles']: 466 if p.get('mass').lower()=='zero': 467 if p.get('spin')%2==1: 468 found_soft_even_spin_particle = True 469 break 470 if not found_soft_even_spin_particle: 471 continue 472 473 # check that there is at least a massless particle, and that the 474 # remaining ones have the same mass 475 # (otherwise the real emission final state will not be degenerate 476 # with the born one 477 try: 478 masslist.remove('zero') 479 except ValueError: 480 continue 481 if len(set(masslist)) == 1 and not \ 482 any( [ p.get_pdg_code() in ghost_list for p in ii['particles']]) : 483 qcd_inter.append(ii) 484 for pp in ii['particles']: 485 pert_parts.append(pp.get_pdg_code()) 486 if pp['mass'].lower() == 'zero': 487 soft_parts.append(pp.get_pdg_code()) 488 489 return {'interactions': sorted(qcd_inter), 490 'pert_particles': sorted(set(pert_parts)), 491 'soft_particles': sorted(set(soft_parts))} 492 495 """insert the color links in col_obj: returns a list of dictionaries 496 (one for each link) with the following entries: 497 --link: the numbers of the linked legs 498 --link_basis: the linked color basis 499 --link_matrix: the color matrix created from the original basis and the linked one 500 """ 501 assert isinstance(col_basis, color_amp.ColorBasis) 502 assert isinstance(col_obj, list) 503 result =[] 504 for link in links: 505 this = {} 506 #define the link 507 l =[] 508 for leg in link['legs']: 509 l.append(leg.get('number')) 510 this['link'] = l 511 512 #replace the indices in col_obj of the linked legs according to 513 # link['replacements'] 514 # and extend-> product the color strings 515 516 this_col_obj = [] 517 for old_dict in col_obj: 518 new_dict = dict(old_dict) 519 for k, string in new_dict.items(): 520 new_dict[k] = string.create_copy() 521 for col in new_dict[k]: 522 for ind in col: 523 for pair in link['replacements']: 524 if ind == pair[0]: 525 col[col.index(ind)] = pair[1] 526 new_dict[k].product(link['string']) 527 this_col_obj.append(new_dict) 528 basis_link = color_amp.ColorBasis() 529 for ind, new_dict in enumerate(this_col_obj): 530 basis_link.update_color_basis(new_dict, ind) 531 532 this['link_basis'] = basis_link 533 this['link_matrix'] = color_amp.ColorMatrix(col_basis,basis_link) 534 result.append(this) 535 basis_orig = color_amp.ColorBasis() 536 for ind, new_dict in enumerate(col_obj): 537 basis_orig.update_color_basis(new_dict, ind) 538 539 for link in result: 540 link['orig_basis'] = basis_orig 541 return result 542 546 """Finds all the possible color(charge) links between any 547 two legs of the born. 548 If symm is true, only half of the color links are generated, those 549 for which leg1['number'] <= leg2['number'] 550 """ 551 if pert == 'QCD': 552 color = 'color' 553 zero = 1 554 elif pert == 'QED': 555 color = 'charge' 556 zero = 0. 557 else: 558 raise FKSProcessError,"Only QCD or QED is allowed not %s" % pert 559 color_links = [] 560 for leg1 in leglist: 561 for leg2 in leglist: 562 #legs must be colored(charged) and different, unless massive 563 if (leg1.get(color) != zero and leg2.get(color) != zero) \ 564 and (leg1 != leg2 or not leg1.get('massless')): 565 if not symm or leg1['number'] <= leg2['number']: 566 col_dict = legs_to_color_link_string(leg1,leg2,pert = pert) 567 color_links.append({ 568 'legs': [leg1, leg2], 569 'string': col_dict['string'], 570 'replacements': col_dict['replacements']}) 571 572 return color_links 573 576 """given two FKSlegs, returns a dictionary containing: 577 --string: the color link between the two particles, to be appended to 578 the old color string 579 extra minus or 1/2 factor are included as it was done in MadDipole 580 --replacements: a pair of lists containing the replacements of the color 581 indices in the old string to match the link 582 """ 583 #the second-to-last index of the t is the triplet, 584 # the last is the anti-triplet 585 586 legs = FKSLegList([leg1, leg2]) 587 dict = {} 588 min_index = -3000 589 iglu = min_index*2 590 string = color_algebra.ColorString() 591 replacements = [] 592 if pert == 'QCD': 593 if leg1 != leg2: 594 for leg in legs: 595 min_index -= 1 596 num = leg.get('number') 597 replacements.append([num, min_index]) 598 icol = 1 599 if not leg.get('state'): 600 icol = - 1 601 if leg.get('color') * icol == 3: 602 string.product(color_algebra.ColorString([ 603 color_algebra.T(iglu, num, min_index)])) 604 string.coeff = string.coeff * (-1) 605 elif leg.get('color') * icol == - 3: 606 string.product(color_algebra.ColorString([ 607 color_algebra.T(iglu, min_index, num)])) 608 elif leg.get('color') == 8: 609 string.product(color_algebra.ColorString(init_list = [ 610 color_algebra.f(min_index,iglu,num)], 611 is_imaginary =True)) 612 613 else: 614 icol = 1 615 if not leg1.get('state'): 616 icol = - 1 617 num = leg1.get('number') 618 replacements.append([num, min_index -1]) 619 if leg1.get('color') * icol == 3: 620 string = color_algebra.ColorString( 621 [color_algebra.T(iglu, iglu, num, min_index -1)]) 622 elif leg1.get('color') * icol == - 3: 623 string = color_algebra.ColorString( 624 [color_algebra.T(iglu, iglu, min_index-1, num)]) 625 elif leg1.get('color') == 8: 626 string = color_algebra.ColorString(init_list = [ 627 color_algebra.f(min_index-1,iglu,min_index)], 628 is_imaginary =True) 629 string.product(color_algebra.ColorString(init_list = [ 630 color_algebra.f(min_index,iglu,num)], 631 is_imaginary =True)) 632 string.coeff = string.coeff * fractions.Fraction(1, 2) 633 634 elif pert == 'QED': 635 for leg in legs: 636 # make it a fraction 637 string.coeff = string.coeff * fractions.Fraction(leg['charge']*3.)*\ 638 fractions.Fraction(1,3) 639 else: 640 raise FKSProcessError,"Only QCD or QED is allowed not %s"% pert 641 642 dict['replacements'] = replacements 643 dict['string'] = string 644 return dict 645
646 647 -def sort_proc(process,pert = 'QCD'):
648 """Given a process, this function returns the same process 649 but with sorted FKSLegs. 650 """ 651 leglist = to_fks_legs(process.get('legs'), process.get('model')) 652 leglist.sort(pert = pert) 653 for n, leg in enumerate(leglist): 654 leg['number'] = n + 1 655 process['legs'] = leglist 656 # add this line to pass ./test_managers.py -p A test_check_ppzjj 657 process['legs_with_decays']=MG.LegList() 658 659 return process
660
661 662 -def to_leg(fksleg):
663 """Given a FKSLeg, returns the original Leg. 664 """ 665 leg = MG.Leg( \ 666 {'id': fksleg.get('id'), 667 'number': fksleg.get('number'), 668 'state': fksleg.get('state'), 669 'from_group': fksleg.get('from_group'), 670 'polarization': fksleg.get('polarization') 671 }) 672 return leg
673
674 675 -def to_legs(fkslegs):
676 """Given a FKSLegList, returns the corresponding LegList. 677 """ 678 leglist = MG.LegList() 679 for leg in fkslegs: 680 leglist.append(to_leg(leg)) 681 return leglist
682
683 684 -def to_fks_leg(leg, model): #test written
685 """Given a leg or a dict with Leg entries, 686 adds color, spin and massless entries, according to model""" 687 fksleg = FKSLeg(leg) 688 part = model.get('particle_dict')[leg['id']] 689 fksleg['color'] = part.get_color() 690 fksleg['charge'] = part.get_charge() 691 fksleg['massless'] = part['mass'].lower() == 'zero' 692 fksleg['spin'] = part.get('spin') 693 fksleg['is_part'] = part.get('is_part') 694 fksleg['self_antipart'] = part.get('self_antipart') 695 return fksleg 696
697 698 -def to_fks_legs(leglist, model): #test written
699 """given leglist, sets color and massless entries according to the model 700 variable. 701 return a FKSLeglist""" 702 fkslegs = FKSLegList() 703 for leg in leglist: 704 fkslegs.append(to_fks_leg(leg, model)) 705 return fkslegs 706
707 708 -class FKSLegList(MG.LegList):
709 """list of FKSLegs""" 710
711 - def is_valid_element(self, obj):
712 """Test if object obj is a valid FKSLeg for the list.""" 713 return isinstance(obj, FKSLeg)
714
715 - def sort(self,pert='QCD'):
716 """Sorting routine, sorting chosen to be optimal for madfks""" 717 sorted_leglist = FKSLegList() 718 #find initial state legs 719 initial_legs = FKSLegList([l for l in copy.copy(self) if not l['state']]) 720 #find final state legs 721 final_legs = FKSLegList([l for l in copy.copy(self) if l['state']]) 722 if len(initial_legs) == 1: 723 sorted_leglist.extend(initial_legs) 724 elif len(initial_legs) == 2: 725 if initial_legs[0]['number'] > initial_legs[1]['number']: 726 initial_legs.reverse() 727 sorted_leglist.extend(initial_legs) 728 else: 729 raise FKSProcessError('Too many initial legs') 730 #find color representations 731 if pert == 'QCD': 732 color = 'color' 733 zero = 1 734 elif pert == 'QED': 735 color = 'charge' 736 zero = 0. 737 else: 738 raise FKSProcessError,"Only QCD and QED is allowed not %s"% pert 739 colors = sorted(set([abs(l[color]) for l in final_legs])) 740 # first put massless particles, without any rearrangment 741 if zero in colors: 742 sorted_leglist.extend(sorted(\ 743 [l for l in final_legs if l[color] == zero], key = itemgetter('number'))) 744 colors.remove(zero) 745 746 #now go for colored legs, put first all massive legs, then all massless legs 747 massless_dict = {} 748 massive_dict = {} 749 for col in colors: 750 col_legs = FKSLegList([l for l in final_legs if abs(l[color]) == col]) 751 #find massive and massless legs in this color repr 752 massive_dict[col] = [l for l in col_legs if not l['massless']] 753 massless_dict[col] = [l for l in col_legs if l['massless']] 754 755 for i_m, dict in enumerate([massive_dict, massless_dict]): 756 for col in colors: 757 # sorting may be different for massive and massless particles 758 # for color singlets, do not change order 759 if col == zero: 760 keys = [itemgetter('number'), itemgetter('number')] 761 reversing = False 762 else: 763 keys = [itemgetter('id'), itemgetter('id')] 764 reversing = True 765 766 init_pdg_legs = [] 767 list = dict[col] 768 if len(initial_legs) == 2: 769 #put first legs which have the same abs(pdg) of the initial ones 770 for i in range(len(set([ abs(l['id']) for l in initial_legs]))): 771 pdg = abs(initial_legs[i]['id']) 772 init_pdg_legs = [l for l in list if abs(l['id']) == pdg] 773 if init_pdg_legs: 774 # sort in order to put first quarks then antiparticles, 775 # and to put fks partons as n j i 776 init_pdg_legs.sort(key = keys[i_m], reverse=reversing) 777 sorted_leglist.extend(FKSLegList(init_pdg_legs)) 778 779 init_pdgs = [ abs(l['id']) for l in initial_legs] 780 other_legs = [l for l in list if not abs(l['id']) in init_pdgs] 781 other_legs.sort(key = keys[i_m], reverse=reversing) 782 sorted_leglist.extend(FKSLegList(other_legs)) 783 else: 784 list.sort(key = keys[i_m], reverse=reversing) 785 sorted_leglist.extend(FKSLegList(list)) 786 787 for i, l in enumerate(sorted_leglist): 788 self[i] = l
789
790 791 792 -class FKSLeg(MG.Leg):
793 """a class for FKS legs: it inherits from the ususal leg class, with two 794 extra keys in the dictionary: 795 -'fks', whose value can be 'i', 'j' or 'n' (for "normal" particles) 796 -'color', which gives the color of the leg 797 -'charge', which gives the charge of the leg 798 -'massless', boolean, true if leg is massless 799 -'spin' which gives the spin of leg 800 -'is_part', boolean, true if leg is an particle 801 -'self_antipart', boolean, true if leg is an self-conjugated particle 802 """ 803
804 - def default_setup(self):
805 """Default values for all properties""" 806 super(FKSLeg, self).default_setup() 807 808 self['fks'] = 'n' 809 self['color'] = 0 810 self['charge'] = 0. 811 self['massless'] = True 812 self['spin'] = 0 813 self['is_part'] = True 814 self['self_antipart'] = False
815
816 - def get_sorted_keys(self):
817 """Return particle property names as a nicely sorted list.""" 818 keys = super(FKSLeg, self).get_sorted_keys() 819 keys += ['fks', 'color','charge', 'massless', 'spin','is_part','self_antipart'] 820 return keys
821 822
823 - def filter(self, name, value):
824 """Filter for valid leg property values.""" 825 826 if name == 'fks': 827 if not isinstance(value, str): 828 raise self.PhysicsObjectError, \ 829 "%s is not a valid string for leg fks flag" \ 830 % str(value) 831 if name in ['color', 'spin']: 832 if not isinstance(value, int): 833 raise self.PhysicsObjectError, \ 834 "%s is not a valid leg %s flag" % \ 835 str(value),name 836 837 if name in ['massless','self_antipart','is_part']: 838 if not isinstance(value, bool): 839 raise self.PhysicsObjectError, \ 840 "%s is not a valid boolean for leg flag %s" % \ 841 str(value),name 842 if name is 'charge': 843 if not isinstance(value, float): 844 raise self.PhysicsObjectError, \ 845 "%s is not a valid float for leg flag charge" \ 846 % str(value) 847 return super(FKSLeg,self).filter(name, value)
848