ebe_scripts/average_event_spvn_h5_minimumbias.py
def calculate_rn_eta(eta_array, dN_array, vn_array, outputFileName):
    """
        This function computes the longitudinal factorization breaking ratios
        for all n passed from vn_array
            eta, rn(eta)
    """
    nev, neta = dN_array.shape
    dN_array  = dN_array.reshape((nev, 1, neta))
    Qn_array  = vn_array
    Qnshape   = Qn_array.shape
    nQn       = Qnshape[1]

    # calculate the reference flow vector for every event
    eta_b_min    = 2.5
    eta_b_max    = 4.0
    eta_ref1_tmp = linspace(eta_b_min, eta_b_max, 16)
    eta_ref2_tmp = linspace(-eta_b_max, -eta_b_min, 16)
    Qn_ref1      = [] 
    Qn_ref2      = [] 
    for iev in range(nev):
        dN1_interp = interp(eta_ref1_tmp, eta_array, dN_array[iev, 0, :])
        dN2_interp = interp(eta_ref2_tmp, eta_array, dN_array[iev, 0, :])
        Qn_ref1_vec = []
        Qn_ref2_vec = []
        for iorder in range(nQn):
            Qn1_interp = interp(eta_ref1_tmp, eta_array,
                                Qn_array[iev, iorder, :])
            Qn2_interp = interp(eta_ref2_tmp, eta_array,
                                Qn_array[iev, iorder, :])
            Qn_ref1_vec.append(sum(dN1_interp*Qn1_interp)
                               /(sum(dN1_interp) + 1e-15))
            Qn_ref2_vec.append(sum(dN2_interp*Qn2_interp)
                               /(sum(dN2_interp) + 1e-15))
        Qn_ref1.append(Qn_ref1_vec)
        Qn_ref2.append(Qn_ref2_vec)
    Qn_ref1 = array(Qn_ref1).reshape((nev, nQn, 1))
    Qn_ref2 = array(Qn_ref2).reshape((nev, nQn, 1))

    rn_num    = real(Qn_array[:, :, ::-1]*conj(Qn_ref1))
    rn_den    = real(Qn_array*conj(Qn_ref1))
    rnn_num   = real((Qn_ref2*conj(Qn_array))
                     *(Qn_array[:, :, ::-1]*conj(Qn_ref1)))
    rnn_den   = real((Qn_ref2*conj(Qn_array[:, :, ::-1]))
                     *(Qn_array*conj(Qn_ref1)))

    # compute the error using jack-knife
    rn_array  = zeros([nev, nQn, neta])
    rnn_array = zeros([nev, nQn, neta])
    for iev in range(nev):
        array_idx      = [True]*nev
        array_idx[iev] = False
        array_idx      = array(array_idx)
        rn_ev          = (mean(rn_num[array_idx], axis=0)
                          /(mean(rn_den[array_idx], axis=0) + 1e-15))
        rnn_ev         = (mean(rnn_num[array_idx], axis=0)
                          /(mean(rnn_den[array_idx], axis=0) + 1e-15))
        rn_array[iev, :, :]  = rn_ev
        rnn_array[iev, :, :] = rnn_ev
    rn_mean  = mean(rn_array, axis=0)
    rn_err   = sqrt((nev - 1.)/nev*sum((rn_array - rn_mean)**2., axis=0))
    rnn_mean = mean(rnn_array, axis=0)
    rnn_err  = sqrt((nev - 1.)/nev*sum((rnn_array - rnn_mean)**2., axis=0))

    f = open(outputFileName, 'w')
    f.write("#eta  rn(eta)  rn_err(eta)  rnn(eta)  rnn_err(eta)\n")
    for ieta in range(len(eta_array)-1):
        f.write("%.10e  " % eta_array[ieta])
        for iorder in range(0, n_order-1):
            f.write("%.10e  %.10e  %.10e  %.10e  "
                    % (rn_mean[iorder, ieta], rn_err[iorder, ieta],
                       rnn_mean[iorder, ieta], rnn_err[iorder, ieta]))
        f.write("\n")
    f.close()
    return

        This function computes the longitudinal factorization breaking ratios
        for all n passed from vn_array
            eta, rn(eta)
    
This function computes the longitudinal factorization breaking ratios
for all n passed from vn_array
eta, rn(eta)
This function computes the longitudinal factorization breaking ratios for all n passed from vn_array eta rn ( eta )
def calculate_rn_eta(eta_array, dN_array, vn_array, outputFileName):
    nev, neta = dN_array.shape
    dN_array  = dN_array.reshape((nev, 1, neta))
    Qn_array  = vn_array
    Qnshape   = Qn_array.shape
    nQn       = Qnshape[1]
    eta_b_min    = 2.5
    eta_b_max    = 4.0
    eta_ref1_tmp = linspace(eta_b_min, eta_b_max, 16)
    eta_ref2_tmp = linspace(-eta_b_max, -eta_b_min, 16)
    Qn_ref1      = [] 
    Qn_ref2      = [] 
    for iev in range(nev):
        dN1_interp = interp(eta_ref1_tmp, eta_array, dN_array[iev, 0, :])
        dN2_interp = interp(eta_ref2_tmp, eta_array, dN_array[iev, 0, :])
        Qn_ref1_vec = []
        Qn_ref2_vec = []
        for iorder in range(nQn):
            Qn1_interp = interp(eta_ref1_tmp, eta_array,
                                Qn_array[iev, iorder, :])
            Qn2_interp = interp(eta_ref2_tmp, eta_array,
                                Qn_array[iev, iorder, :])
            Qn_ref1_vec.append(sum(dN1_interp*Qn1_interp)
                               /(sum(dN1_interp) + 1e-15))
            Qn_ref2_vec.append(sum(dN2_interp*Qn2_interp)
                               /(sum(dN2_interp) + 1e-15))
        Qn_ref1.append(Qn_ref1_vec)
        Qn_ref2.append(Qn_ref2_vec)
    Qn_ref1 = array(Qn_ref1).reshape((nev, nQn, 1))
    Qn_ref2 = array(Qn_ref2).reshape((nev, nQn, 1))
    rn_num    = real(Qn_array[:, :, ::-1]*conj(Qn_ref1))
    rn_den    = real(Qn_array*conj(Qn_ref1))
    rnn_num   = real((Qn_ref2*conj(Qn_array))
                     *(Qn_array[:, :, ::-1]*conj(Qn_ref1)))
    rnn_den   = real((Qn_ref2*conj(Qn_array[:, :, ::-1]))
                     *(Qn_array*conj(Qn_ref1)))
    rn_array  = zeros([nev, nQn, neta])
    rnn_array = zeros([nev, nQn, neta])
    for iev in range(nev):
        array_idx      = [True]*nev
        array_idx[iev] = False
        array_idx      = array(array_idx)
        rn_ev          = (mean(rn_num[array_idx], axis=0)
                          /(mean(rn_den[array_idx], axis=0) + 1e-15))
        rnn_ev         = (mean(rnn_num[array_idx], axis=0)
                          /(mean(rnn_den[array_idx], axis=0) + 1e-15))
        rn_array[iev, :, :]  = rn_ev
        rnn_array[iev, :, :] = rnn_ev
    rn_mean  = mean(rn_array, axis=0)
    rn_err   = sqrt((nev - 1.)/nev*sum((rn_array - rn_mean)**2., axis=0))
    rnn_mean = mean(rnn_array, axis=0)
    rnn_err  = sqrt((nev - 1.)/nev*sum((rnn_array - rnn_mean)**2., axis=0))
    f = open(outputFileName, 'w')
    f.write("#eta  rn(eta)  rn_err(eta)  rnn(eta)  rnn_err(eta)\n")
    for ieta in range(len(eta_array)-1):
        f.write("%.10e  " % eta_array[ieta])
        for iorder in range(0, n_order-1):
            f.write("%.10e  %.10e  %.10e  %.10e  "
                    % (rn_mean[iorder, ieta], rn_err[iorder, ieta],
                       rnn_mean[iorder, ieta], rnn_err[iorder, ieta]))
        f.write("\n")
    f.close()
    return
def calculate_rn_eta ( eta_array , dN_array , vn_array , outputFileName ) : nev , neta = dN_array . shape dN_array = dN_array . reshape ( ( nev , 1 , neta ) ) Qn_array = vn_array Qnshape = Qn_array . shape nQn = Qnshape [ 1 ] eta_b_min = 2.5 eta_b_max = 4.0 eta_ref1_tmp = linspace ( eta_b_min , eta_b_max , 16 ) eta_ref2_tmp = linspace ( - eta_b_max , - eta_b_min , 16 ) Qn_ref1 = [ ] Qn_ref2 = [ ] for iev in range ( nev ) : dN1_interp = interp ( eta_ref1_tmp , eta_array , dN_array [ iev , 0 , : ] ) dN2_interp = interp ( eta_ref2_tmp , eta_array , dN_array [ iev , 0 , : ] ) Qn_ref1_vec = [ ] Qn_ref2_vec = [ ] for iorder in range ( nQn ) : Qn1_interp = interp ( eta_ref1_tmp , eta_array , Qn_array [ iev , iorder , : ] ) Qn2_interp = interp ( eta_ref2_tmp , eta_array , Qn_array [ iev , iorder , : ] ) Qn_ref1_vec . append ( sum ( dN1_interp * Qn1_interp ) / ( sum ( dN1_interp ) + 1e-15 ) ) Qn_ref2_vec . append ( sum ( dN2_interp * Qn2_interp ) / ( sum ( dN2_interp ) + 1e-15 ) ) Qn_ref1 . append ( Qn_ref1_vec ) Qn_ref2 . append ( Qn_ref2_vec ) Qn_ref1 = array ( Qn_ref1 ) . reshape ( ( nev , nQn , 1 ) ) Qn_ref2 = array ( Qn_ref2 ) . reshape ( ( nev , nQn , 1 ) ) rn_num = real ( Qn_array [ : , : , : : - 1 ] * conj ( Qn_ref1 ) ) rn_den = real ( Qn_array * conj ( Qn_ref1 ) ) rnn_num = real ( ( Qn_ref2 * conj ( Qn_array ) ) * ( Qn_array [ : , : , : : - 1 ] * conj ( Qn_ref1 ) ) ) rnn_den = real ( ( Qn_ref2 * conj ( Qn_array [ : , : , : : - 1 ] ) ) * ( Qn_array * conj ( Qn_ref1 ) ) ) rn_array = zeros ( [ nev , nQn , neta ] ) rnn_array = zeros ( [ nev , nQn , neta ] ) for iev in range ( nev ) : array_idx = [ True ] * nev array_idx [ iev ] = False array_idx = array ( array_idx ) rn_ev = ( mean ( rn_num [ array_idx ] , axis = 0 ) / ( mean ( rn_den [ array_idx ] , axis = 0 ) + 1e-15 ) ) rnn_ev = ( mean ( rnn_num [ array_idx ] , axis = 0 ) / ( mean ( rnn_den [ array_idx ] , axis = 0 ) + 1e-15 ) ) rn_array [ iev , : , : ] = rn_ev rnn_array [ iev , : , : ] = rnn_ev rn_mean = mean ( rn_array , axis = 0 ) rn_err = sqrt ( ( nev - 1. ) / nev * sum ( ( rn_array - rn_mean ) ** 2. , axis = 0 ) ) rnn_mean = mean ( rnn_array , axis = 0 ) rnn_err = sqrt ( ( nev - 1. ) / nev * sum ( ( rnn_array - rnn_mean ) ** 2. , axis = 0 ) ) f = open ( outputFileName , 'w' ) f . write ( "#eta  rn(eta)  rn_err(eta)  rnn(eta)  rnn_err(eta)\n" ) for ieta in range ( len ( eta_array ) - 1 ) : f . write ( "%.10e  " % eta_array [ ieta ] ) for iorder in range ( 0 , n_order - 1 ) : f . write ( "%.10e  %.10e  %.10e  %.10e  " % ( rn_mean [ iorder , ieta ] , rn_err [ iorder , ieta ] , rnn_mean [ iorder , ieta ] , rnn_err [ iorder , ieta ] ) ) f . write ( "\n" ) f . close ( ) return
This function computes the longitudinal factorization breaking ratios
for all n passed from vn_array
eta, rn(eta)
This function computes the longitudinal factorization breaking ratios for all n passed from vn_array eta rn ( eta )
"""
        This function computes the longitudinal factorization breaking ratios
        for all n passed from vn_array
            eta, rn(eta)
    """ # calculate the reference flow vector for every event # compute the error using jack-knife
eta_array
dN_array
vn_array
outputFileName