Re: TH2I -> TH2F

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Mon, 25 Oct 2010 18:03:43 +0200


Assuming TH2I *h2i, create a TH2F *h2f with the same binning as h2i, then do

    h2f->Add(h2i,normfactor)

Rene Brun

On 25/10/2010 17:46, Alexander Mann wrote:
>
> Hi,
>
> is there an easy way to cast a TH2I to a TH2F? I would like to Scale()
> a TH2I, but due to the integer nature of the bin contents this does
> not work directly.
>
> The TH2F constructor only takes TH2F as input. DrawCopy gives a TH1*,
> but still uses integers internally.
>
> I could create a TH2I of equal binning, and also copy the bin labels
> etc. by hand, then do a Add() to fill the histogram. Is there a better
> solution?
>
> Suggestion: It would be nice if one could cast TH2I to TH2F (I prefer
> the first type, because I am counting.)
>
> cu,
> Alexander
>
Received on Mon Oct 25 2010 - 18:03:50 CEST

This archive was generated by hypermail 2.2.0 : Mon Oct 25 2010 - 23:50:02 CEST