CentralityClasses

class CentralityClasses.CentralityClasses(events_multiplicity: List[float] | ndarray, centrality_bins: List[float] | ndarray)[source]

Class for defining centrality classes based on event multiplicity.

Parameters:
events_multiplicitylist or numpy.ndarray

List or array containing the multiplicity values for each event.

centrality_binslist or numpy.ndarray

List or array defining the boundaries of centrality classes as percentages.

Raises:
TypeError

If events_multiplicity or centrality_bins is not a list or numpy.ndarray.

Examples

1>>> centrality_obj = CentralityClasses(events_multiplicity=[10, 15, 20, 25],
2...                                   centrality_bins=[0, 25, 50, 75, 100])
3>>> centrality_obj.get_centrality_class(18)
41
5>>> centrality_obj.output_centrality_classes('centrality_output.txt')
Attributes:
events_multiplicity_list or numpy.ndarray

Stores the input multiplicity values for each event.

centrality_bins_list or numpy.ndarray

Stores the input boundaries of centrality classes.

dNchdetaMin_list

Minimum values of multiplicity for each centrality class.

dNchdetaMax_list

Maximum values of multiplicity for each centrality class.

dNchdetaAvg_list

Average values of multiplicity for each centrality class.

dNchdetaAvgErr_list

Average errors of multiplicity for each centrality class.

Methods

get_centrality_class:

Return the index of the centrality bin for a given multiplicity value.

output_centrality_classes:

Write centrality class information to a file.

CentralityClasses.get_centrality_class(dNchdEta: float) int[source]

This function determines the index of the centrality bin for a given multiplicity value based on the predefined centrality classes.

Parameters:
dNchdEtafloat

Multiplicity value.

Returns:
int

Index of the centrality bin.

Examples

1>>> centrality_obj = CentralityClasses(events_multiplicity=[10, 15, 20, 25],
2...                                   centrality_bins=[0, 25, 50, 75, 100])
3>>> centrality_obj.get_centrality_class(18)
41
CentralityClasses.output_centrality_classes(fname: str) None[source]

Write centrality class information to a file.

Parameters:
fnamestr

Name of the output file.

Raises:
TypeError

If fname is not a string.

Notes

This function writes the centrality class information, including minimum, maximum, average multiplicities, and average errors, to the specified file.

Examples

1>>> centrality_obj = CentralityClasses(events_multiplicity=[10, 15, 20, 25],
2...                                   centrality_bins=[0, 25, 50, 75, 100])
3>>> centrality_obj.output_centrality_classes('centrality_output.txt')