Filling a histogram with weight from other histogram

From: Benjamin Bannier <bbannier_at_gmail.com>
Date: Wed, 13 Jun 2012 07:01:40 -0400


Hi,

I would like to fill a histogram from a TNtuple and get the fill weight from another histogram, depending on a variable from the ntuple.

I tried

    nt->Draw("pt", "eff->GetBinContent(eff->FindBin(pt))")

where `nt` is a `TNtuple` and `eff` a `TH1` in the variable pt.

However at the cint prompt already getting the weight fails:

   root [18] eff
   (class TH1F*)0x9533f60)]
   root [19] eff->GetBinContent(eff->FindBin(0.2))    Error: Symbol eff is not defined in current scope (tmpfile):1:    Error: Failed to evaluate eff->FindBin(0.2)

What is the correct way to do this?

Cheers,

Benjamin

-- 
"Good judgment comes from experience. Experience comes from bad judgment."

Received on Wed Jun 13 2012 - 13:01:51 CEST

This archive was generated by hypermail 2.2.0 : Wed Jun 13 2012 - 17:50:01 CEST