I have a TH2D object where for each (x,y) there is an associated variable z. This variable z is in the range [0,1]. I want to project this onto a TH1D histogram in 2 different ways:
-
For each bin x, the content is the average value of the bins on the y axis. For example, let’s suppose that I only have the points (1,1,0.3), (1,2,0.4), (1,3,0.5). By calling
ProjectionX()
, I would get that the content of the TH1D is (1,1.2). I would like it to be (1,0.4). -
The same thing but instead of the arithmetic mean of the values along the y axis, do a weighted average with a gaussian function centered at y=0, and with some Std Dev.
What’s the best way to do this?