Converting TMatrix to TH2F/TH2D

Hi, I am using the following code for converting TMatrix to TH2F/TH2D:

  TH2D *h = new TH2D(matrix1);
  h->SetNameTitle("h", "matrix;x axis;y axis;z axis");
  h->Draw("COLZ");

But I am getting this errror:

 no known conversion from 'TMatrixD *' (aka
      'TMatrixT<double> *') to 'const TMatrixDBase' (aka 'const
      TMatrixTBase<double>') for 1st argument; dereference the argument with *
   TH2D(const TMatrixDBase &m);

Any idea what I am doing wrong?

Try:

TH2D *h = new TH2D(*matrix1);
1 Like

Thank you. It is solved. :slight_smile:

1 Like