365def get_interaction_list(input_file, interaction_file='ProcessList.txt', mass_spectrum=1):
366 """ Function to write all possible interactiosn that we need
367 First input parameter: input file (string or file handle)
368 Second input parameter: output PDG table (string or file handle)
369 Third input parameter: mass spectrum (enumeration value)
370 Gets R-hadron masses based on get_gluino_Rhadron_masses()
371 """
372
373 masses = get_gluino_Rhadron_masses(input_file,mass_spectrum)
374
375
376 if isinstance (interaction_file, str):
377 out_file = open(interaction_file,'a')
378 else:
379 out_file = interaction_file
380
381
382 sm_particles = {
383
384 'pi0' : [ 0 , 0 , 0 ],
385 'pi+' : [ 1 , 0 , 0 ],
386 'pi-' : [ -1 , 0 , 0 ],
387 'neutron' : [ 0 , 1 , 0 ],
388 'proton' : [ 1 , 1 , 0 ],
389 'kaon0' : [ 0 , 0 , 1 ],
390 'anti_kaon0' : [ 0 , 0 , -1 ],
391 'kaon+' : [ 1 , 0 , 1 ],
392 'kaon-' : [ -1 , 0 , -1 ]
393 }
394 targets = [ 'proton' , 'neutron' ]
395
396 incoming_rhadrons = {}
397 outgoing_rhadrons = {}
398 for pid in masses:
399
400 if offset_options[abs(pid)][0]==0: continue
401
402
403
404
405 s_number = 0
406 my_q = get_quarks(pid)
407 if '3' in my_q or '4' in my_q or '5' in my_q:
408 if len(my_q)>2:
409
410 s_number = -(my_q.count('3')-my_q.count('4')+my_q.count('5')) if pid>0 else my_q.count('3')-my_q.count('4')+my_q.count('5')
411 elif len(my_q)>1 and '9' in str(pid):
412
413 if my_q in ['33','44','55','35']: s_number=0
414
415 elif my_q in ['43','53']: s_number = 2 if pid>0 else -2
416
417 elif offset_options[abs(pid)][3]==0 and ('3' in my_q or '5' in my_q): s_number=1 if pid>0 else -1
418 elif offset_options[abs(pid)][3]==0 and '4' in my_q: s_number=1 if pid<0 else -1
419
420 elif '3' in my_q or '5' in my_q: s_number=offset_options[abs(pid)][3]
421 elif '4' in my_q: s_number=-offset_options[abs(pid)][3]
422 elif len(my_q)>1:
423
424 s_number = -(my_q.count('3')-my_q.count('4')+my_q.count('5')) if pid>0 else my_q.count('3')-my_q.count('4')+my_q.count('5')
425 else:
426
427 s_number = my_q.count('3') - my_q.count('4') + my_q.count('5')
428 s_number = s_number if pid>0 else -s_number
429 else: s_number=0
430
431 pid_name = offset_options[pid][2].
strip()
if pid>0
else anti_name(offset_options[abs(pid)][2]).
strip()
432 charge = offset_options[abs(pid)][3] if pid>0 else -offset_options[abs(pid)][3]
433 incoming_rhadrons[pid_name] = [ charge , is_baryon(pid) , s_number ]
434
435
436 if '4' in my_q or '5' in my_q: continue
437 outgoing_rhadrons[pid_name] = [ charge , is_baryon(pid) , s_number ]
438
439
440 for proj in incoming_rhadrons:
441
442 for t in targets:
443
444 for orhad in outgoing_rhadrons:
445
446 for osm1 in sm_particles:
447
448 total_charge = incoming_rhadrons[proj][0]+sm_particles[t][0]-outgoing_rhadrons[orhad][0]-sm_particles[osm1][0]
449
450 total_bnumber = incoming_rhadrons[proj][1]+sm_particles[t][1]-outgoing_rhadrons[orhad][1]-sm_particles[osm1][1]
451
452 total_snumber = incoming_rhadrons[proj][2]+sm_particles[t][2]-outgoing_rhadrons[orhad][2]-sm_particles[osm1][2]
453
454 if total_charge==0 and total_bnumber==0 and total_snumber==0:
455 out_file.write( ' # '.join([str(proj),str(t),str(orhad),str(osm1)])+'\n' )
456
457 for osm2 in sm_particles:
458
459 total_charge = incoming_rhadrons[proj][0]+sm_particles[t][0]-outgoing_rhadrons[orhad][0]-sm_particles[osm1][0]-sm_particles[osm2][0]
460
461 total_bnumber = incoming_rhadrons[proj][1]+sm_particles[t][1]-outgoing_rhadrons[orhad][1]-sm_particles[osm1][1]-sm_particles[osm2][1]
462
463 total_snumber = incoming_rhadrons[proj][2]+sm_particles[t][2]-outgoing_rhadrons[orhad][2]-sm_particles[osm1][2]-sm_particles[osm2][2]
464
465 if total_charge==0 and total_bnumber==0 and total_snumber==0:
466 out_file.write( ' # '.join([str(proj),str(t),str(orhad),str(osm1),str(osm2)])+'\n' )
467
468
469
470
471
472
473
474
475 if isinstance(interaction_file, str):
476 out_file.close()
477
478
479
480