def generate_virtuals(self): """For each process among the born_processes, creates the corresponding virtual amplitude""" # If not using MadLoop, then the LH order file generation and processing # will be entirely done during the output, so nothing must be done at # this stage yet. if self['OLP']!='MadLoop': logger.info("The loop matrix elements will be generated by "+\ '%s at the output stage only.'%self['OLP']) return # determine the orders to be used to generate the loop loop_orders = {} for born in self['born_processes']: for coup, val in fks_common.find_orders(born.born_amp).items(): try: loop_orders[coup] = max([loop_orders[coup], val]) except KeyError: loop_orders[coup] = val for i, born in enumerate(self['born_processes']): logger.info('Generating virtual matrix elements using MadLoop:') myproc = copy.copy(born.born_proc) # take the orders that are actually used bu the matrix element myproc['orders'] = loop_orders myproc['legs'] = fks_common.to_legs(copy.copy(myproc['legs'])) logger.info('Generating virtual matrix element with MadLoop for process%s (%d / %d)' \ % (myproc.nice_string(print_weighted = False).replace(\ 'Process', ''), i + 1, len(self['born_processes']))) myamp = loop_diagram_generation.LoopAmplitude(myproc) if myamp.get('diagrams'): born.virt_amp = myamp
def async_generate_born(args): i = args[0] born = args[1] born_pdg_list = args[2] loop_orders = args[3] pdg_list = args[4] loop_optimized = args[5] OLP = args[6] realmapout = args[7] logger.info('Generating born %s' % \ born.born_proc.nice_string(print_weighted=False).replace('Process', 'process')) #load informations on reals from temp files helasreal_list = [] for amp in born.real_amps: idx = pdg_list.index(amp.pdgs) infilename = realmapout[idx] infile = open(infilename, 'rb') realdata = cPickle.load(infile) infile.close() amp.amplitude = realdata[0] helasreal_list.append(realdata[1]) born.link_born_reals() for amp in born.real_amps: amp.find_fks_j_from_i(born_pdg_list) # generate the virtuals if needed has_loops = False if born.born_proc.get('NLO_mode') == 'all' and OLP == 'MadLoop': myproc = copy.copy(born.born_proc) # take the orders that are actually used by the matrix element myproc['orders'] = loop_orders myproc['legs'] = fks_common.to_legs(copy.copy(myproc['legs'])) myamp = loop_diagram_generation.LoopAmplitude(myproc) if myamp.get('diagrams'): has_loops = True born.virt_amp = myamp helasfull = FKSHelasProcess(born, helasreal_list, loop_optimized=loop_optimized, decay_ids=[], gen_color=False) processes = helasfull.born_matrix_element.get('processes') metag = helas_objects.IdentifyMETag.create_tag( helasfull.born_matrix_element.get('base_amplitude')) outdata = helasfull output = tempfile.NamedTemporaryFile(delete=False) cPickle.dump(outdata, output, protocol=2) output.close() return [output.name, metag, has_loops, processes]
def async_generate_born(args): i = args[0] born = args[1] born_pdg_list = args[2] loop_orders = args[3] pdg_list = args[4] loop_optimized = args[5] OLP = args[6] realmapout = args[7] logger.info('Generating born %s' % \ born.born_proc.nice_string(print_weighted=False).replace('Process', 'process')) #load informations on reals from temp files helasreal_list = [] for amp in born.real_amps: idx = pdg_list.index(amp.pdgs) infilename = realmapout[idx] infile = open(infilename,'rb') realdata = cPickle.load(infile) infile.close() amp.amplitude = realdata[0] helasreal_list.append(realdata[1]) born.link_born_reals() for amp in born.real_amps: amp.find_fks_j_from_i(born_pdg_list) # generate the virtuals if needed has_loops = False if born.born_proc.get('NLO_mode') == 'all' and OLP == 'MadLoop': myproc = copy.copy(born.born_proc) # take the orders that are actually used by the matrix element myproc['orders'] = loop_orders myproc['legs'] = fks_common.to_legs(copy.copy(myproc['legs'])) myamp = loop_diagram_generation.LoopAmplitude(myproc) if myamp.get('diagrams'): has_loops = True born.virt_amp = myamp helasfull = FKSHelasProcess(born, helasreal_list, loop_optimized = loop_optimized, decay_ids=[], gen_color=False) processes = helasfull.born_matrix_element.get('processes') metag = helas_objects.IdentifyMETag.create_tag(helasfull.born_matrix_element.get('base_amplitude')) outdata = helasfull output = tempfile.NamedTemporaryFile(delete = False) cPickle.dump(outdata,output,protocol=2) output.close() return [output.name,metag,has_loops,processes]