How to draw a correlation plot and calculate correlation coefficient?

Dear Expert,

I am not being able to draw the correlation between two variables by using TH2D and also correlation factor is not getting calculated. Canvas is coming but nothing is getting filled.

Could you please check the code once and update it so that both can be solved.

Thanks in Advance.

Regards
Souvik

mdvsdelm.C (542 Bytes)

We do not have your data files we cannot run your example.

Sorry I forgot to attach. Here is one such file.
evtgen_exp_55_d0prel-25.root (292.3 KB)

Thanks for your reply.

Regards
Souvik

ch->Draw("deltam : d0mass >> hist", m_p);

Thanks.
No mercy for those silly mistake :pray:

To calculate the covariance the line I have added is not working.
h_kl.GetCovariance(Double_t axis=1 , Double_t axis=2);

I am getting following error.

error: unexpected type name ‘Double_t’: expected expression
hist.GetCovariance(Double_t axis=1 , Double_t axis=2);

Could you please also look into this.

Probably you want something like:

  auto cov = hist->GetCovariance(1,2);
  std::cout << "covariance: " << cov << std::endl;

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.