Beispiel #1
0
    def __init__(self, start_proc = None, remove_reals = True):
        """initialization: starts either from an amplitude or a process,
        then init the needed variables.
        remove_borns tells if the borns not needed for integration will be removed
        from the born list (mainly used for testing)"""
                
        self.splittings = {}
        self.reals = []
        self.fks_dirs = []
        self.leglist = []
        self.myorders = {}
        self.pdg_codes = []
        self.colors = []
        self.nlegs = 0
        self.fks_ipos = []
        self.fks_j_from_i = {}
        self.real_amps = []
        self.remove_reals = remove_reals
        self.nincoming = 0
        self.virt_amp = None

        if not remove_reals in [True, False]:
            raise fks_common.FKSProcessError(\
                    'Not valid type for remove_reals in FKSProcess')
        
        if start_proc:
            if isinstance(start_proc, MG.Process):
                self.born_proc = fks_common.sort_proc(start_proc) 
                self.born_amp = diagram_generation.Amplitude(self.born_proc)
            elif isinstance(start_proc, diagram_generation.Amplitude):
                self.born_proc = fks_common.sort_proc(start_proc.get('process'))
                self.born_amp = diagram_generation.Amplitude(self.born_proc)
            else:
                raise fks_common.FKSProcessError(\
                    'Not valid start_proc in FKSProcess')

            self.born_proc.set('legs_with_decays', MG.LegList())

            self.leglist = fks_common.to_fks_legs(
                                    self.born_proc['legs'], self.born_proc['model'])
            self.nlegs = len(self.leglist)
            self.pdg_codes = [leg.get('id') for leg in self.leglist]
            self.colors = [leg.get('color') for leg in self.leglist]
            self.isr = set([leg.get('color') for leg in self.leglist if not leg.get('state')]) != set([1])
            self.fsr = set([leg.get('color') for leg in self.leglist if leg.get('state')]) != set([1])
            for leg in self.leglist:
                if not leg['state']:
                    self.nincoming += 1
            self.orders = self.born_amp['process']['orders']
            # this is for cases in which the user specifies e.g. QED=0
            if sum(self.orders.values()) == 0:
                self.orders = fks_common.find_orders(self.born_amp)
                
            self.ndirs = 0
            for order in self.born_proc.get('perturbation_couplings'):
                self.find_reals(order)
Beispiel #2
0
    def __init__(self, start_proc = None, remove_reals = True, ncores_for_proc_gen=0):
        """initialization: starts either from an amplitude or a process,
        then init the needed variables.
        remove_borns tells if the borns not needed for integration will be removed
        from the born list (mainly used for testing)
        ncores_for_proc_gen has the following meaning
           0 : do things the old way
           > 0 use ncores_for_proc_gen
           -1 : use all cores
        """
                
        self.splittings = {}
        self.reals = []
        self.fks_dirs = []
        self.leglist = []
        self.myorders = {}
        self.pdg_codes = []
        self.colors = [] # color
        self.charges = [] # charge
        self.nlegs = 0
        self.fks_ipos = []
        self.fks_j_from_i = {}
        self.real_amps = []
        self.remove_reals = remove_reals
        self.nincoming = 0
        self.virt_amp = None
        self.perturbation = 'QCD'
        self.ncores_for_proc_gen = ncores_for_proc_gen

        if not remove_reals in [True, False]:
            raise fks_common.FKSProcessError(\
                    'Not valid type for remove_reals in FKSProcess')

        if start_proc:
            if isinstance(start_proc, MG.Process):
                pertur = start_proc['perturbation_couplings']
                if pertur:
                    self.perturbation = sorted(pertur)[0]
                self.born_proc = fks_common.sort_proc(start_proc,pert = self.perturbation)
                # filter in Amplitude will legs sorted in bornproc
                bornproc = copy.copy(self.born_proc) # deepcopy might let T -> array
                assert bornproc==self.born_proc
                self.born_amp = diagram_generation.Amplitude(bornproc)
            elif isinstance(start_proc, diagram_generation.Amplitude):
                pertur = start_proc.get('process')['perturbation_couplings']
                if pertur:
                    self.perturbation = sorted(pertur)[0]
                self.born_proc = fks_common.sort_proc(start_proc.get('process'),\
                                                      pert = self.perturbation)
                # filter in Amplitude will legs sorted in bornproc
                bornproc = copy.copy(self.born_proc)
                assert bornproc == self.born_proc
                self.born_amp = diagram_generation.Amplitude(bornproc)
            else:
                raise fks_common.FKSProcessError(\
                    'Not valid start_proc in FKSProcess')
            self.born_proc.set('legs_with_decays', MG.LegList())

            self.leglist = fks_common.to_fks_legs(
                                    self.born_proc['legs'], self.born_proc['model'])
            self.nlegs = len(self.leglist)
            self.pdg_codes = [leg.get('id') for leg in self.leglist]
            if self.perturbation == 'QCD':
                self.colors = [leg.get('color') for leg in self.leglist]
                # in QCD, charge is irrelevant but impact the combine process !
                self.charges = [0. for leg in self.leglist]
                color = 'color'
                zero = 1
            elif self.perturbation == 'QED':
                self.colors = [leg.get('color') for leg in self.leglist]
                self.charges = [leg.get('charge') for leg in self.leglist]
                color = 'charge'
                zero = 0.
            # special treatment of photon is needed !
            self.isr = set([leg.get(color) for leg in self.leglist if not leg.get('state')]) != set([zero])
            self.fsr = set([leg.get(color) for leg in self.leglist if leg.get('state')]) != set([zero])
            for leg in self.leglist:
                if not leg['state']:
                    self.nincoming += 1
            self.orders = self.born_amp['process']['orders']
            # this is for cases in which the user specifies e.g. QED=0
            if sum(self.orders.values()) == 0:
                self.orders = fks_common.find_orders(self.born_amp)
                
            self.ndirs = 0
            # generate reals, when the mode is not LOonly
            # when is LOonly it is supposed to be a 'fake' NLO process
            # e.g. to be used in merged sampels at high multiplicities
            if self.born_proc['NLO_mode'] != 'LOonly':
                for order in self.born_proc.get('perturbation_couplings'):
                    self.find_reals(order)
Beispiel #3
0
    def __init__(self, start_proc = None, remove_reals = True, ncores_for_proc_gen=0):
        """initialization: starts either from an amplitude or a process,
        then init the needed variables.
        remove_borns tells if the borns not needed for integration will be removed
        from the born list (mainly used for testing)
        ncores_for_proc_gen has the following meaning
           0 : do things the old way
           > 0 use ncores_for_proc_gen
           -1 : use all cores
        """
                
        self.splittings = {}
        self.reals = []
        self.fks_dirs = []
        self.leglist = []
        self.myorders = {}
        self.pdg_codes = []
        self.colors = [] # color
        self.charges = [] # charge
        self.nlegs = 0
        self.fks_ipos = []
        self.fks_j_from_i = {}
        self.real_amps = []
        self.remove_reals = remove_reals
        self.nincoming = 0
        self.virt_amp = None
        self.perturbation = 'QCD'
        self.ncores_for_proc_gen = ncores_for_proc_gen

        if not remove_reals in [True, False]:
            raise fks_common.FKSProcessError(\
                    'Not valid type for remove_reals in FKSProcess')

        if start_proc:
            if isinstance(start_proc, MG.Process):
                pertur = start_proc['perturbation_couplings']
                if pertur:
                    self.perturbation = sorted(pertur)[0]
                self.born_proc = fks_common.sort_proc(start_proc,pert = self.perturbation)
                # filter in Amplitude will legs sorted in bornproc
                bornproc = copy.copy(self.born_proc) # deepcopy might let T -> array
                assert bornproc==self.born_proc
                self.born_amp = diagram_generation.Amplitude(bornproc)
            elif isinstance(start_proc, diagram_generation.Amplitude):
                pertur = start_proc.get('process')['perturbation_couplings']
                if pertur:
                    self.perturbation = sorted(pertur)[0]
                self.born_proc = fks_common.sort_proc(start_proc.get('process'),\
                                                      pert = self.perturbation)
                # filter in Amplitude will legs sorted in bornproc
                bornproc = copy.copy(self.born_proc)
                assert bornproc == self.born_proc
                self.born_amp = diagram_generation.Amplitude(bornproc)
            else:
                raise fks_common.FKSProcessError(\
                    'Not valid start_proc in FKSProcess')
            self.born_proc.set('legs_with_decays', MG.LegList())

            self.leglist = fks_common.to_fks_legs(
                                    self.born_proc['legs'], self.born_proc['model'])
            self.nlegs = len(self.leglist)
            self.pdg_codes = [leg.get('id') for leg in self.leglist]
            if self.perturbation == 'QCD':
                self.colors = [leg.get('color') for leg in self.leglist]
                # in QCD, charge is irrelevant but impact the combine process !
                self.charges = [0. for leg in self.leglist]
                color = 'color'
                zero = 1
            elif self.perturbation == 'QED':
                self.colors = [leg.get('color') for leg in self.leglist]
                self.charges = [leg.get('charge') for leg in self.leglist]
                color = 'charge'
                zero = 0.
            # special treatment of photon is needed !
            self.isr = set([leg.get(color) for leg in self.leglist if not leg.get('state')]) != set([zero])
            self.fsr = set([leg.get(color) for leg in self.leglist if leg.get('state')]) != set([zero])
            for leg in self.leglist:
                if not leg['state']:
                    self.nincoming += 1
            self.orders = self.born_amp['process']['orders']
            # this is for cases in which the user specifies e.g. QED=0
            if sum(self.orders.values()) == 0:
                self.orders = fks_common.find_orders(self.born_amp)
                
            self.ndirs = 0
            # generate reals, when the mode is not LOonly
            # when is LOonly it is supposed to be a 'fake' NLO process
            # e.g. to be used in merged sampels at high multiplicities
            if self.born_proc['NLO_mode'] != 'LOonly':
                for order in self.born_proc.get('perturbation_couplings'):
                    self.find_reals(order)