TChain vs. TCastorFile and TTree

Hi,
I’m trying to plot the same variable into a new histo, Draw(“variable>>histo”), opening the same file using TChain or TCastorFile:

void comp() {

TH1D *data, *mc;
TChain ss3(“Tree”);
TCastorFile *pipi0;
TTree *pipi0_tree;

TH1D *data = new TH1D(“data”, “data”, 50, .13, .14);
TH1D *mc = new TH1D(“mc”, “mc”, 50, .13, .14);

TCanvas *c1 = new TCanvas(“c1”, “c1”, 700, 700);
c1->Divide(2,2);

ss3.Add("/castor/cern.ch/user/b/bifani/pipi0/scmp/SS3-40/0.root");
c1_1->cd();
ss3.Draw(“mgg>>data”);

pipi0 = new TCastorFile("/castor/cern.ch/user/b/bifani/pipi0/scmp/SS3-40/0.root");
pipi0_tree = (TTree*) pipi0->Get(“Tree”);
c1_2->cd();
pipi0_tree->Draw(“mgg>>mc”);

c1_3->cd();
data->Draw();
c1_4->cd();
mc->Draw();

}

DATA histo filled with TChain opened file is ok.
MC histo filled with TCastorFile opened file is empty.

What is wrong in that macro?

s.

Could you change your macro as shown below

[code]void comp() {

TH1D *data, *mc;
TChain ss3(“Tree”);
TCastorFile *pipi0;
TTree *pipi0_tree;

TCanvas *c1 = new TCanvas(“c1”, “c1”, 700, 700);
c1->Divide(2,2);

ss3.Add("/castor/cern.ch/user/b/bifani/pipi0/scmp/SS3-40/0.root");
c1_1->cd();
TH1D *data = new TH1D(“data”, “data”, 50, .13, .14);
ss3.Draw(“mgg>>data”);

pipi0 = new TCastorFile("/castor/cern.ch/user/b/bifani/pipi0/scmp/SS3-40/0.root");
pipi0_tree = (TTree*) pipi0->Get(“Tree”);
c1_2->cd();
TH1D *mc = new TH1D(“mc”, “mc”, 50, .13, .14);
//TTree::Draw will take the “mc” histo in the current dir
pipi0_tree->Draw(“mgg>>mc”);

c1_3->cd();
data->Draw();
c1_4->cd();
mc->Draw();

}
[/code]
Rene