Fill TProfile2D from TChain

Hello, I am filling a TProfile2D from a TChain, and at the moment I am doing

for i in xrange(tc.GetEntries()):
    tc.GetEntry(i)
    hprof.Fill(tc.v1,tc.v2.tc.v3)

which is very slow. I am wondering if there is any problem with using tc.Draw(‘v1:v2:v3 >> hprofname’) like I would normally do for a histogram. In the TTree::Draw documentation it only talks about histograms, not about filling directly TProfile or TProfile2D graphs.

Trying it myself yielded no syntax errors, but the TProfile2D ends up empty. I’m guessing this is possible, but there is some subtlety that I am missing.

Jean-François

When using TTree::Draw use option "prof"
tc.Draw(“x:y:z”,“selection/weight”,“prof”)

REne

Thanks Rene. In the TTree::Draw documentation they mention both the “prof” and “profs” option, but the difference is not described. Is “profs” intended to make a TProfile with the “s” ErrorOption while “prof” uses the default? What about the other options “i” and “g”?

Reference link to TProfile2D options:
http://root.cern.ch/root/html/TProfile2D.html#TProfile2D:SetErrorOption

Jean-François

[quote]Is “profs” intended to make a TProfile with the “s” ErrorOption while “prof” uses the default?
[/quote]yes

[quote]What about the other options “i” and “g”?
[/quote]“profi” and “profg” are recognized too

and you are right, this should be correctly documented in TTree::Draw

Rene