Weights for only one axis TH2D

I have a tree with three variables a, b, c and I have to plot TH2D::Fill(a, b, k), where k is weight for a, how can I set a weight which is for only one axis.

Based on the docs : https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuideChapters/Histograms.pdf
hist2->Fill(somenamex,b,weight);

It isn’t clear, what’s the string value I should pass.

If you can use TTree::Draw. if your tree is name tree just do:

tree->Draw("a:b");

you can add drawing option:

tree->Draw("a:b","","col");

and weight:

tree->Draw("a:b","k","col");

I tried to write the output to a TH2D, this way,

tree->Draw("a:b >> h2", "k", ""); // Didn’t work

Is there a way to multiply scale it up and write to a TH2D ?

// Didn’t work

How did it fail?

And by the way, if you want a weight for only one axis then the idea of a two dimensional histogram doesn’t match what you need: the weight is a statement of “how much” you fill at the coordinate (a,b).

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