TTree and Project("")

Dear ROOT people,
I am trying to work with trees (possible script is on the bottom): to summerize points from different histogramms in different trees. Is the “Project” a good way ? Can you recommend me something ?
regards,

[code]{
gROOT->Reset();
TCanvas *c1 = new TCanvas (“c1”,“trees1”, 480, 320);
TH1F *h10 = new TH1F(“h10”, “h10 histos”, 100, 0, 2000);

TFile f1(“fe_data_29559.root”);
TTree myTree1 = (TTree)f1.Get(“h1”);
Long64_t Project(“h10”, “px”);
TFile f2(“fe_data_29558.root”);
TTree myTree2 = (TTree)f2.Get(“h1”);
Long64_t Project(“h10”, “px”);
c1->SaveAs(Form(“fe_data.jpg”, 1));
}[/code]

More correctely:
to summarize points of 1D histogramms with the same
names from different Ttrees

We show plenty of examples in the Users Guide.
see also section " Saving the result of Draw to an histogram"
at: root.cern.ch/root/htmldoc//TTree … DrawSelect

Use TTree::Draw instead of Project.
Note that in your example above, you should not do:

Long64_t Project("h10", "px"); but

Rene

OK, it works very nice :smiley:

The simplest way is of course throw
TH1F htemp = (TH1F)gPad->GetPrimitive(“htemp”);

h1->Draw(“px>>htemp(100)”);

TH1F htemp = (TH1F)gDirectory->Get(“htemp”);
h10->Add(htemp1, htemp2);
h10->Draw();

with best regards :smiley: