Esempio n. 1
0
def generateFlowActionsForPids(Pid_table):
    """
        Generate BinProcess objects for all particles given in the Pid_table
        list. The list should contain elements of type (particle_name,
        pid_value). The "particle_name" will be fed into the %s for
        differential_flow_saveTo and integrated_flow_saveTo strings.
    """
    binProcess = []
    for particle_name, pid in Pid_table:
        # differential flow
        tmpProcess = binUtilities.BinProcess(
            binUtilities.SingleVarBinCheckingField(
                FLL(strStream2BlockStream(open(pTBin_table_filename))),
                pT_has_name, pid, pid_has_name), flowAction)
        tmpProcess.saveTo = differential_flow_saveTo % particle_name
        tmpProcess.saveFormatTo = differential_flow_format_saveTo
        tmpProcess.useCplx = True
        binProcess.append(tmpProcess)
        # integrated flow
        tmpProcess = binUtilities.BinProcess(
            binUtilities.SingleVarBinCheckingField(
                FLL(strStream2BlockStream(open(pTAll_table_filename))),
                pT_has_name, pid, pid_has_name), flowAction)
        tmpProcess.saveTo = integrated_flow_saveTo % particle_name
        tmpProcess.saveFormatTo = integrated_flow_format_saveTo
        tmpProcess.useCplx = True
        binProcess.append(tmpProcess)
    return binProcess
Esempio n. 2
0
def generateFlowActionsForPids(Pid_table):
    """
        Generate BinProcess objects for all particles given in the Pid_table
        list. The list should contain elements of type (particle_name,
        pid_value). The "particle_name" will be fed into the %s for
        differential_flow_saveTo and integrated_flow_saveTo strings.
    """
    binProcess = []
    for particle_name, pid in Pid_table:
        # differential flow
        tmpProcess = binUtilities.BinProcess(
            binUtilities.SingleVarBinCheckingField(FLL(strStream2BlockStream(open(pTBin_table_filename))), pT_has_name, pid, pid_has_name),
            flowAction
        )
        tmpProcess.saveTo = differential_flow_saveTo % particle_name
        tmpProcess.saveFormatTo = differential_flow_format_saveTo
        tmpProcess.useCplx = True
        binProcess.append(tmpProcess)
        # integrated flow
        tmpProcess = binUtilities.BinProcess(
            binUtilities.SingleVarBinCheckingField(FLL(strStream2BlockStream(open(pTAll_table_filename))), pT_has_name, pid, pid_has_name),
            flowAction
        )
        tmpProcess.saveTo = integrated_flow_saveTo % particle_name
        tmpProcess.saveFormatTo = integrated_flow_format_saveTo
        tmpProcess.useCplx = True
        binProcess.append(tmpProcess)
    return binProcess
Esempio n. 3
0
differential_flow_saveTo = "results/differential_flow_%s.dat"
differential_flow_format_saveTo = "results/differential_flow_format.dat"

integrated_flow_saveTo = "results/integrated_flow_%s.dat"
integrated_flow_format_saveTo = "results/integrated_flow_format.dat"

count_particle_number_in_pT_range = "results/event_number_of_particles_in_pT_range.dat"

if not path.exists("results"): makedirs("results")
copy(pTBin_table_filename, "results")
copy(pTAll_table_filename, "results")

#-----------------------------------------------------------------------------------
# define reusable bins
pTBin = binUtilities.SingleVarBin(
    FLL(strStream2BlockStream(open(pTBin_table_filename))),
    pT_has_name)  # for differential
pTAll = binUtilities.SingleVarBin(
    FLL(strStream2BlockStream(open(pTAll_table_filename))),
    pT_has_name)  # for integrated

# define reuable actions
returnPT = binUtilities.SingleVarValue(pT_has_name)  # generate mean pT

particle_count_pT_range = readNumericalData(particle_count_pT_range_filename)
countNumberInPTRangeAction = binUtilities.CountInRange(
    pT_has_name, particle_count_pT_range[0][0], particle_count_pT_range[1][0])


class CalculateFlow(binUtilities.ActionObject):
    """ This class calculate the flow.
Esempio n. 4
0
integrated_flow_saveTo = "results/integrated_flow.dat"
integrated_flow_format_saveTo = "results/integrated_flow_format.dat"

count_particle_number_in_pT_range = "results/event_number_of_particles_in_pT_range.dat"

use_bin_processes = {
    "calculate differential flow" : True, # differential flow, differential mean pT, spectra (1st column)
    "calculate integrated flow": True, # integrated flow, total mean pT
    "count particles in pT range": True, # count how many particles lie in given pT range
}


#-----------------------------------------------------------------------------------
# define reusable bins
pTBin = binUtilities.SingleVarBin(FLL(strStream2BlockStream(open(pTBin_table_filename))),  pT_has_name) # for differential
pTAll = binUtilities.SingleVarBin(FLL(strStream2BlockStream(open(pTAll_table_filename))),  pT_has_name) # for integrated

# define reuable actions
returnPT = binUtilities.SingleVarValue(pT_has_name) # generate mean pT

particle_count_pT_range = readNumericalData(particle_count_pT_range_filename)
countNumberInPTRangeAction = binUtilities.CountInRange(pT_has_name, particle_count_pT_range[0][0], particle_count_pT_range[1][0])

class CalculateFlow(binUtilities.ActionObject):
    """ This class calculate the flow.
    """
    def __init__(self, fromOrder=1, toOrder=9, phi_name="phi", pT_name="pT"):
        self.phi_name = phi_name # useful only when phi is renamed
        self.pT_name = pT_name
        self.orderList = numpy.array(range(fromOrder, toOrder+1))