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 binISSDataFile(data_filename,
                   format_filename,
                   data_block_size_filename=None):
    """
        This function is a shell that perform all the defined binning process to a
        data file generated by iSS program. Here data_filename gives the main data
        file, format_filename gives the format of the data file (see formatter), and
        data_block_size_filename is the control file that is used to devide data
        into blocks.
    """
    # generate block-related non-reusable bin processes
    if data_block_size_filename:
        # define blockBin objects (they are not re-usable: each binProcess should use a different blockBin object)
        #        blockSizes = [float(aLine) for aLine in file(data_block_size_filename)]
        blockSizes = numpy.loadtxt(data_block_size_filename)
        generateBlocks = binUtilities.BlockBin(blockSizes)
        # define particle counting bin process (within certain pT range specified in particle_count_pT_range_filename)
        countParticleNumberInPTRange = binUtilities.BinProcess(
            generateBlocks, countNumberInPTRangeAction)
        countParticleNumberInPTRange.saveTo = count_particle_number_in_pT_range

    # get data format
    raw_format = assignmentFormat.assignmentExprStream2IndexDict(
        open(format_filename))

    # call binDataStream function to finish the binning
    binUtilities.binDataStream(open(data_filename), raw_format,
                               useBinProcesses)
Esempio n. 3
0
        """
            Return a list of strings describing flows.
        """
        strings = ["pT"]
        strings.extend("v_%d" % order for order in self.orderList)
        return strings


flowAction = CalculateFlow(calculate_flow_from_order,
                           calculate_flow_to_order,
                           phi_name=phi_has_name,
                           pT_name=pT_has_name)

#------------------------------------------------------------------------------------
# combine bin and action to processes
differentialFlowCharged = binUtilities.BinProcess(pTBin, flowAction)
differentialFlowCharged.saveTo = differential_flow_saveTo % "total"
differentialFlowCharged.saveFormatTo = differential_flow_format_saveTo
differentialFlowCharged.useCplx = True

integratedFlowCharged = binUtilities.BinProcess(pTAll, flowAction)
integratedFlowCharged.saveTo = integrated_flow_saveTo % "total"
integratedFlowCharged.saveFormatTo = integrated_flow_format_saveTo
integratedFlowCharged.useCplx = True


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