[ROOT] tree->Draw("var>>histo",cut) in a macro

From: Matthieu Lechowski (lechowsk@lal.in2p3.fr)
Date: Mon Jun 30 2003 - 17:09:36 MEST


Hello,

I have always this problem:
in a macro, when I try to draw a tree's variable and put the result in a
histogram, the plot disappears as soon it's drawn.
example:
 void start()
 {
   TFile F("~/scratch1/ntuplesLH/mytrees/MyTree_W1000.root");
   TTree* T=(TTree*)gDirectory->Get("T");
   T->Draw("mmax2_YY>>h","abs(eta_Y[i1max2_YY])<2.5 &&
      abs(eta_Y[i2max2_YY])<2.5 && pt_Y[i1max2_YY]>25 &&
      pt_Y[i2max2_YY]>25 && mmax2_YY>110");
   TH1F* H=(TH1F*)gDirectory->Get("h");
   H->Draw();
 }

Is there a thing to do to avoid this ? (maybe it's a basic thing to
know, but...)
I know the solution of transferring data of the tree in tables, then
filling a histogram with them, but it's heavy.

I think that an other problem I have is related to this one.
When I try to do (as described in the user guide)
 TPaveStats *st=(TPaveStats*) canvas->GetPrimitive("stats");
 st->SetFillColor(10);
 H->Draw("SAMES");
it doesn't work ("st" not known at the second line).
I think "stats" is not known anymore.

Thank you.

Matthieu.


( I'm using /afs/cern.ch/sw/root/v3.05.05/rh73_gcc2952/root )



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET