I’m working with a TH2F histogram that describes energies in KeV, and I want to new one with this information but in Grays. Already have the term that converts it, but I can not implement it.
When I run the macro a error occurs: invalid operands to binary expression (‘void’ and ‘double’)
Hg2-> SetBinContent (i, j) * 5.54267E-9;
This is the macro I created:
[code]{
gROOT -> Reset();
TFile f(“brachytherapy.root”);
TCanvas* c1 = new TCanvas(“c1”, " ");
TH2F* h20;
int nbinsx = h20 ->GetXaxis()->GetNbins();
int nbinsy = h20 ->GetYaxis()->GetNbins();
cout << “olha”<< nbinsx <<endl;
TH2F* hg2 = new TH2F(“hg2”,“Radiation Dose - Bone”,nbinsx,-100.125,100.125,nbinsy,-100.125,100.125);
for (int i=0;i <nbinsx;i++){
for (int j=0; j<=nbinsy;i++){
h20-> GetBinContent(i,j);
hg2-> SetBinContent(i,j)*5.54267E-9;
}
}
if you do not have access to the entries, you can resort to this method root.cern.ch/doc/master/classTH … 56f5038e37
The idea would be to start from an empty histogram and add to it the one in KeV weighted so to have the z axis expressed in grays.