Root2numpy#

WORK IN PROGRESS

qunfold.root2numpy.TH1_to_numpy(histo, error=False, overflow=True, dtype=<class 'numpy.float64'>)[source]#

Convert a ROOT.TH1 object into a 1D numpy array.

Parameters:
  • histo (ROOT.TH1) – the input TH1 histogram to convert.

  • error (bool) – if True, it gets the bin error instead of the bin content.

  • overflow (bool) – if True, it considers also the overflow bins.

  • dtype (type) – the data type of the output array.

Returns:

the output 1D numpy array.

Return type:

array (numpy.ndarray)

qunfold.root2numpy.TH2_to_numpy(histo, overflow=True, dtype=<class 'numpy.float64'>)[source]#

Convert a ROOT.TH2 object into a 2D numpy array.

Parameters:
  • histo (ROOT.TH2) – the input TH2 histogram to convert.

  • overflow (bool) – if True, it considers also the overflow bins.

  • dtype (type) – the data type of the output array.

Returns:

the output 2D numpy array.

Return type:

array (numpy.ndarray)

qunfold.root2numpy.TMatrix_to_numpy(matrix, dtype=<class 'numpy.float64'>)[source]#

Convert a ROOT.TMatrix object into a 2D numpy array.

Parameters:
  • matrix (ROOT.TMatrix) – the input TMatrix to convert.

  • dtype (type) – the data type of the output array.

Returns:

the output 2D numpy array.

Return type:

array (numpy.ndarray)

qunfold.root2numpy.TVector_to_numpy(vector, dtype=<class 'numpy.float64'>)[source]#

Convert a ROOT.TVector object into a 1D numpy array.

Parameters:
  • vector (ROOT.TVector) – the input TVector to convert.

  • dtype (type) – the data type of the output array.

Returns:

the output 1D numpy array.

Return type:

array (numpy.ndarray)