Example #1
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

    # fillin the to-use binProcess list
    useBinProcesses = []
    if use_bin_processes["calculate differential flow"]: useBinProcesses.extend([differentialFlow])
    if use_bin_processes["calculate integrated flow"]: useBinProcesses.extend([integratedFlow])
    if use_bin_processes["count particles in pT range"]: useBinProcesses.extend([countParticleNumberInPTRange])
    # 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)
Example #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)
Example #3
0
def binISSDataFileSimple(data_filename, format_filename, useBinProcesses):
    """
        Simpler version of binISSDataFile
    """
    # 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)
Example #4
0
def binISSDataFileSimple(data_filename, format_filename, useBinProcesses):
    """
        Simpler version of binISSDataFile
    """
    # 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)