コード例 #1
0
ファイル: tmd.py プロジェクト: QCDHUB/jam3dlib
    def eval_stfunc(self, stfunc, x, z, Q2, pT, tar, had, irep, icol=False):

        self.parman.set_new_params(self.par[irep], initial=True)

        if stfunc == 'FUU':
            return upol.get_FUU(x, z, Q2, pT, tar, had)
        elif stfunc == 'FUTSiv':
            return sivers.get_FUT(x, z, Q2, pT, tar, had)
        elif stfunc == 'FUTCol':
            return collins.get_FUT(x, z, Q2, pT, tar, had)
        elif stfunc == 'FUTsinphiS':
            return sinphiS.get_FX(x, z, Q2, None, tar, had)
        else:
            print(stfunc, 'is not available')
            sys.exit()
コード例 #2
0
    def _get_theory(self, entry):
        k, i = entry
        x = self.tabs[k]['x'][i]
        y = self.tabs[k]['y'][i]
        z = self.tabs[k]['z'][i]
        Q2 = self.tabs[k]['Q2'][i]
        pT = self.tabs[k]['pT'][i]
        exp = self.tabs[k]['value'][i]
        tar = self.tabs[k]['target'][i]
        had = self.tabs[k]['hadron'][i]
        obs = self.tabs[k]['obs'][i].strip()
        col = self.tabs[k]['col'][i].strip().upper()

        if tar == 'proton': tar = 'p'
        elif tar == 'neutron': tar = 'n'
        elif tar == 'deuteron': tar = 'd'

        if obs == 'FUU':

            thy = upol.get_FUU(x, z, Q2, pT, tar, had)

        elif obs == 'M':

            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            F2 = self.dis_stfuncs.get_F2(x, Q2, tar)
            thy = FUU / F2
            if col == 'HERMES': thy *= 2 * np.pi * pT

        elif obs == 'AUTcollins':

            # convention factor
            coeff = 1.
            if col == 'HERMES': coeff = 1  # hermes is sin(phi_s+phi_h)
            elif col == 'COMPASS': coeff = -1  # compass is sin(phi_s+phi_h+pi)

            # add depolarization factor
            if col == 'HERMES': coeff *= 2 * (1 - y) / (1 + (1 - y)**2)

            FUT = collins.get_FUT(x, z, Q2, pT, tar, had)
            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            thy = coeff * FUT / FUU

        elif obs == 'AUTsivers':

            # convention factor
            coeff = 1.

            FUT = sivers.get_FUT(x, z, Q2, pT, tar, had)
            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            thy = coeff * FUT / FUU

        elif obs == 'AUUcos2':

            epsilon = (1 - y) / (1 - y + 0.5 * y**2)
            coeff = 1.
            if col == 'HERMES':
                coeff = epsilon  # add depolarization factor for HERMES
            if col == 'COMPASS':
                coeff = 1.
            if col == 'JLAB':
                coeff = epsilon  # add depolarization factor for CLAS

            FUUcos2 = boermulders.get_FUU(x, z, Q2, pT, tar, had)
            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            thy = coeff * FUUcos2 / FUU

        elif obs == 'AUTsinphiS':  # This is for collinear!

            if tar == 'p':
                pT = None
                FUTsinphiS = AUTsinphiS.get_FX(x, z, Q2, pT, 'p', had)
                FUU = upol.get_FUU(x, z, Q2, pT, 'p', had)

            coeff = 1.
            if col == 'HERMES':
                # add depolarization factor for HERMES
                coeff = np.sqrt(1.0 - y) * (2 - y) / (1 - y + 0.5 * y**2)
            if col == 'COMPASS':
                coeff = 1.

            thy = coeff * FUTsinphiS / FUU

        else:
            print 'ERR: exp=%d obs=%s and target=%s not implemented' % (k, obs,
                                                                        tar)
            sys.exit()

        return thy
コード例 #3
0
            def yield_thy(accelerator, should_integrate):

                # depending on input parameters, either selects the coefficient
                # method or the integration method of producing a residual value.
                # root_s and w2_min also fluctuate based on accelerator.

                # set known values based on the source of AUUcos2 data
                if accelerator == 'COMPASS':
                    ROOT_S = 17.3
                    W2_MIN = 25
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.9

                #TODO: define accelerator constants for JLab and HERMES data
                elif accelerator == 'JLAB':
                    ROOT_S = 7.25
                    W2_MIN = 4
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.85

                elif accelerator == 'HERMES':
                    ROOT_S = 3.42
                    W2_MIN = 10
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.85

                if should_integrate:

                    def fast_integrate(f, low, hi):
                        f = np.vectorize(f)
                        return integrate.fixed_quad(f, low, hi, n=10)

                    M2 = conf['aux'].M**2
                    Q2_MIN = 1
                    Q2_MAX = 1000

                    yA = max(  # lower bound of integration
                        RANGE_MIN, Q2_MAX / (x * ((ROOT_S**2) - M2)),
                        (W2_MIN - M2) / ((1 - x) * ((ROOT_S**2) - M2)))
                    yB = min(  # upper bound of integration
                        Q2_MAX / (x * ((ROOT_S**2) - M2)), RANGE_MAX)

                    # any value dependent on y must be a function so that its value
                    # may be recalculated during the integration process
                    Q_compass = lambda y: np.sqrt(((ROOT_S**2) - M2) * x * y)
                    FUU = lambda y: upol.get_FUU(x, z,
                                                 Q_compass(y)**2, pT, tar, had)
                    FUUcos2 = lambda y: (boermulders.get_FUU(
                        x, z,
                        Q_compass(y)**2, pT, tar, had) + cahn.get_cahn(
                            x, z,
                            Q_compass(y)**2, pT, tar, had))

                    # integrate over y for the numerator and denominator of AUUcos2
                    FUUcos2_integral = fast_integrate(
                        lambda y: (1 / (Q_compass(y)**4)) * FUUcos2(y), yA,
                        yB)[0]
                    FUU_integral = fast_integrate(
                        lambda y: (1 / (Q_compass(y)**4)) * FUU(y), yA, yB)[0]

                    theory = FUUcos2_integral / FUU_integral

                else:  # use coefficient method

                    coeff = (1 - y) / (1 - y + 0.5 * y**2)
                    FUUcos2 = (boermulders.get_FUU(x, z, Q2, pT, tar, had) +
                               cahn.get_cahn(x, z, Q2, pT, tar, had))
                    FUU = upol.get_FUU(x, z, Q2, pT, tar, had)

                    theory = coeff * FUUcos2 / FUU_integral

                return theory
コード例 #4
0
    def _get_theory(self, entry):
        k, i = entry
        x = self.tabs[k]['x'][i]
        y = self.tabs[k]['y'][i]
        z = self.tabs[k]['z'][i]
        Q2 = self.tabs[k]['Q2'][i]
        pT = self.tabs[k]['pT'][i]
        exp = self.tabs[k]['value'][i]
        tar = self.tabs[k]['target'][i]
        had = self.tabs[k]['hadron'][i]
        obs = self.tabs[k]['obs'][i].strip()
        col = self.tabs[k]['col'][i].strip().upper()

        if tar == 'proton': tar = 'p'
        elif tar == 'neutron': tar = 'n'
        elif tar == 'deuteron': tar = 'd'

        if obs == 'FUU':

            thy = upol.get_FUU(x, z, Q2, pT, tar, had)

        elif obs == 'M':

            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            F2 = self.dis_stfuncs.get_F2(x, Q2, tar)
            thy = FUU / F2
            if col == 'HERMES': thy *= 2 * np.pi * pT

        elif obs == 'AUTcollins':

            # convention factor
            coeff = 1.
            if col == 'HERMES': coeff = 1  # hermes is sin(phi_s+phi_h)
            elif col == 'COMPASS': coeff = -1  # compass is sin(phi_s+phi_h+pi)

            # add depolarization factor
            if col == 'HERMES': coeff *= 2 * (1 - y) / (1 + (1 - y)**2)

            FUT = collins.get_FUT(x, z, Q2, pT, tar, had)
            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            thy = coeff * FUT / FUU

        elif obs == 'AUTsivers':

            # convention factor
            coeff = 1.

            FUT = sivers.get_FUT(x, z, Q2, pT, tar, had)
            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            thy = coeff * FUT / FUU

        elif obs == 'AUUcos2':
            ''' The data from JLab and HERMES do not require any integrations,
                but require a y-based coefficient. The COMPASS data requires an
                integration over y, and does not require the coefficient.    '''
            def yield_thy(accelerator, should_integrate):

                # depending on input parameters, either selects the coefficient
                # method or the integration method of producing a residual value.
                # root_s and w2_min also fluctuate based on accelerator.

                # set known values based on the source of AUUcos2 data
                if accelerator == 'COMPASS':
                    ROOT_S = 17.3
                    W2_MIN = 25
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.9

                #TODO: define accelerator constants for JLab and HERMES data
                elif accelerator == 'JLAB':
                    ROOT_S = 7.25
                    W2_MIN = 4
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.85

                elif accelerator == 'HERMES':
                    ROOT_S = 3.42
                    W2_MIN = 10
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.85

                if should_integrate:

                    def fast_integrate(f, low, hi):
                        f = np.vectorize(f)
                        return integrate.fixed_quad(f, low, hi, n=10)

                    M2 = conf['aux'].M**2
                    Q2_MIN = 1
                    Q2_MAX = 1000

                    yA = max(  # lower bound of integration
                        RANGE_MIN, Q2_MAX / (x * ((ROOT_S**2) - M2)),
                        (W2_MIN - M2) / ((1 - x) * ((ROOT_S**2) - M2)))
                    yB = min(  # upper bound of integration
                        Q2_MAX / (x * ((ROOT_S**2) - M2)), RANGE_MAX)

                    # any value dependent on y must be a function so that its value
                    # may be recalculated during the integration process
                    Q_compass = lambda y: np.sqrt(((ROOT_S**2) - M2) * x * y)
                    FUU = lambda y: upol.get_FUU(x, z,
                                                 Q_compass(y)**2, pT, tar, had)
                    FUUcos2 = lambda y: (boermulders.get_FUU(
                        x, z,
                        Q_compass(y)**2, pT, tar, had) + cahn.get_cahn(
                            x, z,
                            Q_compass(y)**2, pT, tar, had))

                    # integrate over y for the numerator and denominator of AUUcos2
                    FUUcos2_integral = fast_integrate(
                        lambda y: (1 / (Q_compass(y)**4)) * FUUcos2(y), yA,
                        yB)[0]
                    FUU_integral = fast_integrate(
                        lambda y: (1 / (Q_compass(y)**4)) * FUU(y), yA, yB)[0]

                    theory = FUUcos2_integral / FUU_integral

                else:  # use coefficient method

                    coeff = (1 - y) / (1 - y + 0.5 * y**2)
                    FUUcos2 = (boermulders.get_FUU(x, z, Q2, pT, tar, had) +
                               cahn.get_cahn(x, z, Q2, pT, tar, had))
                    FUU = upol.get_FUU(x, z, Q2, pT, tar, had)

                    theory = coeff * FUUcos2 / FUU_integral

                return theory

            thy = yield_thy(col, should_integrate=True)

        elif obs == 'AUTsinphiS':  # This is for collinear!

            if tar == 'p':
                pT = None
                FUTsinphiS = AUTsinphiS.get_FX(x, z, Q2, pT, 'p', had)
                FUU = upol.get_FUU(x, z, Q2, pT, 'p', had)

            coeff = 1.
            if col == 'HERMES':
                # add depolarization factor for HERMES
                coeff = np.sqrt(1.0 - y) * (2 - y) / (1 - y + 0.5 * y**2)
            if col == 'COMPASS':
                coeff = 1.

            thy = coeff * FUTsinphiS / FUU

        else:
            print 'ERR: exp=%d obs=%s and target=%s not implemented' % (k, obs,
                                                                        tar)
            sys.exit()

        return thy
コード例 #5
0
ファイル: residuals.py プロジェクト: pitonyak25/jam3d
    def _get_theory(self, entry):
        k, i = entry
        x = self.tabs[k]['x'][i]
        try:
            y = self.tabs[k]['y'][i]
        except (ValueError, KeyError):
            y = None
        z = self.tabs[k]['z'][i]
        try:
            Q2 = self.tabs[k]['Q2'][i]
        except ValueError:
            Q2 = None
        pT = self.tabs[k]['pT'][i]
        exp = self.tabs[k]['value'][i]
        tar = self.tabs[k]['target'][i]
        had = self.tabs[k]['hadron'][i]
        obs = self.tabs[k]['obs'][i].strip()
        col = self.tabs[k]['col'][i].strip().upper()
        try:
            F2 = self.tabs[k]['F2'][i]
        except KeyError:
            F2 = None

        M = conf['aux'].M
        M2 = conf['aux'].M**2
        Mpi2 = conf['aux'].Mpi**2

        if tar == 'proton': tar = 'p'
        elif tar == 'neutron': tar = 'n'
        elif tar == 'deuteron': tar = 'd'

        if obs == 'FUU':

            thy = upol.get_FUU(x, z, Q2, pT, tar, had)

        elif obs == 'M':

            if had == 'h+': had = 'pi+'
            if had == 'h-': had = 'pi-'

            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            if F2 == None: F2 = self.dis_stfuncs.get_F2(x, Q2, tar)
            thy = FUU / F2
            if col == 'HERMES' or col == 'hermes': thy = 2 * np.pi * pT * thy
            if col == 'COMPASS' or col == 'compass': thy = np.pi * thy

        elif obs == 'AUTcollins':

            # convention factor
            coeff = 1.
            if col == 'HERMES': coeff = 1  # hermes is sin(phi_s+phi_h)
            elif col == 'COMPASS': coeff = -1  # compass is sin(phi_s+phi_h+pi)

            # add depolarization factor
            if col == 'HERMES': coeff *= 2 * (1 - y) / (1 + (1 - y)**2)

            FUT = collins.get_FUT(x, z, Q2, pT, tar, had)
            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            thy = coeff * FUT / FUU

        elif obs == 'AUTsivers':

            # convention factor
            coeff = 1.

            FUT = sivers.get_FUT(x, z, Q2, pT, tar, had)
            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            thy = coeff * FUT / FUU

        elif obs == 'AUUcos2':

            if had == 'h+': had = 'pi+'
            if had == 'h-': had = 'pi-'
            ''' The data from JLab and HERMES do not require any integrations,
                but require a y-based coefficient. The COMPASS data requires an
                integration over y, and does not require the coefficient.    '''
            def yield_thy(accelerator, should_integrate, ny=10):

                # depending on input parameters, either selects the coefficient
                # method or the integration method of producing a residual value.
                # root_s and W2_min also fluctuate based on accelerator.

                # set known values based on the source of AUUcos2 data
                if accelerator == 'COMPASS':
                    ROOT_S = 17.3
                    W2_MIN = 25.0
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.9

                elif accelerator == 'CLAS':  #JLab col in the data files
                    ROOT_S = 3.42
                    W2_MIN = 4.0
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.85

                elif accelerator == 'HERMES':
                    ROOT_S = 7.25
                    W2_MIN = 10
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.85

                if should_integrate:

                    def fast_integrate(f, low, hi, ny):
                        f = np.vectorize(f)
                        return integrate.fixed_quad(f, low, hi, n=ny)

                    Q2_MIN = 1
                    Q2_MAX = 1000

                    yA = max(  # lower bound of integration
                        RANGE_MIN, Q2_MIN / (x * ((ROOT_S**2) - M2)),
                        (W2_MIN - M2) / ((1 - x) * ((ROOT_S**2) - M2)))
                    yB = min(  # upper bound of integration
                        Q2_MAX / (x * ((ROOT_S**2) - M2)), RANGE_MAX)

                    # any value dependent on y must be a function so that its value
                    # may be recalculated during the integration process
                    Q = lambda y: np.sqrt(((ROOT_S**2) - M2) * x * y)

                    if accelerator == 'HERMES':
                        FUU = lambda y: (1. - y + 0.5 * y**2) * upol.get_FUU(
                            x, z,
                            Q(y)**2, pT, tar, had)
                        FUUcos2 = lambda y: (1. - y) * (boermulders.get_FUU(
                            x, z,
                            Q(y)**2, pT, tar, had) + cahn.get_cahn(
                                x, z,
                                Q(y)**2, pT, tar, had))

                    elif accelerator == 'COMPASS':
                        FUU = lambda y: upol.get_FUU(x, z,
                                                     Q(y)**2, pT, tar, had)
                        FUUcos2 = lambda y: (boermulders.get_FUU(
                            x, z,
                            Q(y)**2, pT, tar, had) + cahn.get_cahn(
                                x, z,
                                Q(y)**2, pT, tar, had))

                    elif accelerator == 'CLAS':
                        # CLAS accelerators measure H4 / (H2 + H1), which can be related
                        # to the AUUcos2 asymmetry.
                        gamma = lambda y: (2 * M * x) / Q(y)
                        kappa = lambda y: 1 / (1 + gamma(x, y)**2)
                        zeta = lambda y: 1 - y - (0.25 * (gamma(x, y)**2) *
                                                  (y**2))
                        epsilon = lambda y: 1 / (1 + (
                            (y**2) / (2 * kappa(x, y) * zeta(x, y))))
                        ppa_over_Eh = lambda y: np.sqrt(1 - (pT**2 + Mpi**2) *
                                                        (2. * M * x /
                                                         (z * Q(y)**2))**2)

                        FUU = lambda y: ppa_over_Eh * (kappa / epsilon) * (
                            1 + gamma**2 /
                            (2. * x)) * upol.get_FUU(x, z,
                                                     Q(y)**2, pT, tar, had)
                        FUUcos2 = lambda y: (ppa_over_Eh / 2.) * (
                            1 + gamma**2 / (2. * x)) * (boermulders.get_FUU(
                                x, z,
                                Q(y)**2, pT, tar, had) + cahn.get_cahn(
                                    x, z,
                                    Q(y)**2, pT, tar, had))

                    # integrate over y for the numerator and denominator of AUUcos2
                    FUUcos2_integral = fast_integrate(
                        lambda y: (1. / (Q(y)**4)) * FUUcos2(y), yA, yB, ny)[0]
                    FUU_integral = fast_integrate(
                        lambda y: (1. / (Q(y)**4)) * FUU(y), yA, yB, ny)[0]

                    theory = FUUcos2_integral / FUU_integral

                else:  # no integration

                    if accelerator == 'HERMES':
                        coeff = (1 - y) / (1 - y + 0.5 * y**2)
                    elif accelerator == 'COMPASS':
                        coeff = 1.
                    elif accelerator == 'CLAS':
                        gamma = (2. * M * x) / np.sqrt(Q2)
                        kappa = 1. / (1. + gamma**2.)
                        zeta = 1. - y - (0.25 * (gamma**2.) * (y**2.))
                        epsilon = 1. / (1. + ((y**2.) / (2. * kappa * zeta)))

                        coeff = epsilon / (2. * kappa)

                    FUUcos2 = (boermulders.get_FUU(x, z, Q2, pT, tar, had) +
                               cahn.get_cahn(x, z, Q2, pT, tar, had))
                    FUU = upol.get_FUU(x, z, Q2, pT, tar, had)

                    theory = coeff * FUUcos2 / FUU

                return theory

            if col == 'COMPASS':
                thy = yield_thy(col, should_integrate=True, ny=10)
            elif col == 'HERMES':
                thy = yield_thy(col, should_integrate=False, ny=10)
            elif col == 'CLAS':
                thy = yield_thy(col, should_integrate=False, ny=10)

        elif obs == 'AUTsinphiS':  # This is for collinear!

            if tar == 'p':
                pT = None
                FUTsinphiS = AUTsinphiS.get_FX(x, z, Q2, pT, 'p', had)
                FUU = upol.get_FUU(x, z, Q2, pT, 'p', had)

            coeff = 1.
            if col == 'HERMES':
                # add depolarization factor for HERMES
                coeff = np.sqrt(1.0 - y) * (2 - y) / (1 - y + 0.5 * y**2)
            if col == 'COMPASS':
                coeff = 1.

            thy = coeff * FUTsinphiS / FUU

        else:
            print('ERR: exp=%d obs=%s and target=%s not implemented' %
                  (k, obs, tar))
            sys.exit()

        return thy
コード例 #6
0
ファイル: residuals.py プロジェクト: pitonyak25/jam3d
            def yield_thy(accelerator, should_integrate, ny=10):

                # depending on input parameters, either selects the coefficient
                # method or the integration method of producing a residual value.
                # root_s and W2_min also fluctuate based on accelerator.

                # set known values based on the source of AUUcos2 data
                if accelerator == 'COMPASS':
                    ROOT_S = 17.3
                    W2_MIN = 25.0
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.9

                elif accelerator == 'CLAS':  #JLab col in the data files
                    ROOT_S = 3.42
                    W2_MIN = 4.0
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.85

                elif accelerator == 'HERMES':
                    ROOT_S = 7.25
                    W2_MIN = 10
                    RANGE_MIN = 0.2
                    RANGE_MAX = 0.85

                if should_integrate:

                    def fast_integrate(f, low, hi, ny):
                        f = np.vectorize(f)
                        return integrate.fixed_quad(f, low, hi, n=ny)

                    Q2_MIN = 1
                    Q2_MAX = 1000

                    yA = max(  # lower bound of integration
                        RANGE_MIN, Q2_MIN / (x * ((ROOT_S**2) - M2)),
                        (W2_MIN - M2) / ((1 - x) * ((ROOT_S**2) - M2)))
                    yB = min(  # upper bound of integration
                        Q2_MAX / (x * ((ROOT_S**2) - M2)), RANGE_MAX)

                    # any value dependent on y must be a function so that its value
                    # may be recalculated during the integration process
                    Q = lambda y: np.sqrt(((ROOT_S**2) - M2) * x * y)

                    if accelerator == 'HERMES':
                        FUU = lambda y: (1. - y + 0.5 * y**2) * upol.get_FUU(
                            x, z,
                            Q(y)**2, pT, tar, had)
                        FUUcos2 = lambda y: (1. - y) * (boermulders.get_FUU(
                            x, z,
                            Q(y)**2, pT, tar, had) + cahn.get_cahn(
                                x, z,
                                Q(y)**2, pT, tar, had))

                    elif accelerator == 'COMPASS':
                        FUU = lambda y: upol.get_FUU(x, z,
                                                     Q(y)**2, pT, tar, had)
                        FUUcos2 = lambda y: (boermulders.get_FUU(
                            x, z,
                            Q(y)**2, pT, tar, had) + cahn.get_cahn(
                                x, z,
                                Q(y)**2, pT, tar, had))

                    elif accelerator == 'CLAS':
                        # CLAS accelerators measure H4 / (H2 + H1), which can be related
                        # to the AUUcos2 asymmetry.
                        gamma = lambda y: (2 * M * x) / Q(y)
                        kappa = lambda y: 1 / (1 + gamma(x, y)**2)
                        zeta = lambda y: 1 - y - (0.25 * (gamma(x, y)**2) *
                                                  (y**2))
                        epsilon = lambda y: 1 / (1 + (
                            (y**2) / (2 * kappa(x, y) * zeta(x, y))))
                        ppa_over_Eh = lambda y: np.sqrt(1 - (pT**2 + Mpi**2) *
                                                        (2. * M * x /
                                                         (z * Q(y)**2))**2)

                        FUU = lambda y: ppa_over_Eh * (kappa / epsilon) * (
                            1 + gamma**2 /
                            (2. * x)) * upol.get_FUU(x, z,
                                                     Q(y)**2, pT, tar, had)
                        FUUcos2 = lambda y: (ppa_over_Eh / 2.) * (
                            1 + gamma**2 / (2. * x)) * (boermulders.get_FUU(
                                x, z,
                                Q(y)**2, pT, tar, had) + cahn.get_cahn(
                                    x, z,
                                    Q(y)**2, pT, tar, had))

                    # integrate over y for the numerator and denominator of AUUcos2
                    FUUcos2_integral = fast_integrate(
                        lambda y: (1. / (Q(y)**4)) * FUUcos2(y), yA, yB, ny)[0]
                    FUU_integral = fast_integrate(
                        lambda y: (1. / (Q(y)**4)) * FUU(y), yA, yB, ny)[0]

                    theory = FUUcos2_integral / FUU_integral

                else:  # no integration

                    if accelerator == 'HERMES':
                        coeff = (1 - y) / (1 - y + 0.5 * y**2)
                    elif accelerator == 'COMPASS':
                        coeff = 1.
                    elif accelerator == 'CLAS':
                        gamma = (2. * M * x) / np.sqrt(Q2)
                        kappa = 1. / (1. + gamma**2.)
                        zeta = 1. - y - (0.25 * (gamma**2.) * (y**2.))
                        epsilon = 1. / (1. + ((y**2.) / (2. * kappa * zeta)))

                        coeff = epsilon / (2. * kappa)

                    FUUcos2 = (boermulders.get_FUU(x, z, Q2, pT, tar, had) +
                               cahn.get_cahn(x, z, Q2, pT, tar, had))
                    FUU = upol.get_FUU(x, z, Q2, pT, tar, had)

                    theory = coeff * FUUcos2 / FUU

                return theory
コード例 #7
0
    def _get_theory(self, entry):
        k, i = entry
        x = self.tabs[k]['x'][i]
        y = self.tabs[k]['y'][i]
        z = self.tabs[k]['z'][i]
        Q2 = self.tabs[k]['Q2'][i]
        pT = self.tabs[k]['pT'][i]
        exp = self.tabs[k]['value'][i]
        tar = self.tabs[k]['target'][i]
        had = self.tabs[k]['hadron'][i]
        obs = self.tabs[k]['obs'][i].strip()
        col = self.tabs[k]['col'][i].strip().upper()
        M = conf['aux'].M
        S = 299.29
        W2_min = 25
        Q2_min = 1
        Q2_max = 1000

        if tar == 'proton': tar = 'p'
        elif tar == 'neutron': tar = 'n'
        elif tar == 'deuteron': tar = 'd'

        if obs == 'FUU':

            thy = upol.get_FUU(x, z, Q2, pT, tar, had)

        elif obs == 'M':

            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            F2 = self.dis_stfuncs.get_F2(x, Q2, tar)
            thy = FUU / F2
            if col == 'HERMES': thy *= 2 * np.pi * pT

        elif obs == 'AUTcollins':

            # convention factor
            coeff = 1.
            if col == 'HERMES': coeff = 1  # hermes is sin(phi_s+phi_h)
            elif col == 'COMPASS': coeff = -1  # compass is sin(phi_s+phi_h+pi)

            # add depolarization factor
            if col == 'HERMES': coeff *= 2 * (1 - y) / (1 + (1 - y)**2)

            FUT = collins.get_FUT(x, z, Q2, pT, tar, had)
            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            thy = coeff * FUT / FUU

        elif obs == 'AUTsivers':

            # convention factor
            coeff = 1.

            FUT = sivers.get_FUT(x, z, Q2, pT, tar, had)
            FUU = upol.get_FUU(x, z, Q2, pT, tar, had)
            thy = coeff * FUT / FUU

        elif obs == 'AUUcos2':

            # data from Hermes and Jlab do not need integration
            if col == ['COMPASS', 'JLAB']:

                coeff = (1 - y) / (1 - y + 0.5 * y**2)
                FUUcos2 = boermulders.get_FUU(x, z, Q2, pT, tar,
                                              had) + cahn.get_cahn(
                                                  x, z, Q2, pT, tar, had)
                FUU = upol.get_FUU(x, z, Q2, pT, tar, had)

                thy = coeff * FUUcos2 / FUU


# data from compass will be integrated over y
            elif col == 'HERMES':

                def integrand(f, low, hi):
                    f = np.vectorize(f)
                    return fixed_quad(f, low, hi, n=10)

                yLOW = max(0.2, Q2_max / (x * (S - M**2)),
                           (W2_min - M**2) / ((1 - x) * (S - M**2)))
                yUP = min(Q2_max / (x * (S - M**2)), 0.9)
                Q_XY = lambda y: np.sqrt((S - M**2) * x * y)

                FUUcos2 = lambda y: boermulders.get_FUU(
                    x, z,
                    Q_XY(y)**2, pT, tar, had) + cahn.get_cahn(
                        x, z,
                        Q_XY(y)**2, pT, tar, had)
                FUU = lambda y: upol.get_FUU(x, z, Q_XY(y)**2, pT, tar, had)

                #inegrate over y for top and bottom of AUUcos2 compass
                FUUcos2_int = integrand(
                    lambda y: (1 / (Q_XY(y)**4)) * FUUcos2(y), yLOW, yUP)[0]
                FUU_int = integrand(lambda y: (1 / (Q_XY(y)**4)) * FUU(y),
                                    yLOW, yUP)[0]
                thy = FUUcos2_int / FUU_int

        elif obs == 'AUTsinphiS':  # This is for collinear!

            if tar == 'p':
                pT = None
                FUTsinphiS = AUTsinphiS.get_FX(x, z, Q2, pT, 'p', had)
                FUU = upol.get_FUU(x, z, Q2, pT, 'p', had)

            coeff = 1.
            if col == 'HERMES':
                # add depolarization factor for HERMES
                coeff = np.sqrt(1.0 - y) * (2 - y) / (1 - y + 0.5 * y**2)
            if col == 'COMPASS':
                coeff = 1.

            thy = coeff * FUTsinphiS / FUU

        else:
            print 'ERR: exp=%d obs=%s and target=%s not implemented' % (k, obs,
                                                                        tar)
            sys.exit()

        return thy