Hello
I generated two trees and tried to save only one tree in a root file.
When I opened the file, I found the tree was saved as I intended.
But the problem is the size of the file. The size of the root file is
much bigger than I expected (the tree I saved has only 100 entries having
just one branch) and it seems like the other tree affected the size
of the root file, too. Please help me understand this file size issue.
I am attaching my test code.
Thanks,
SC
{
TFile *af = new TFile("ttree_test.root","recreate");
TTree *tr = new TTree("tr","tr");
TTree *trb = new TTree("trb","trb");
double x1,y1,z1;
double x1b;
int ient;
int ii,jj;
tr->Branch("x1",&x1,"x1/D");
tr->Branch("y1",&y1,"y1/D");
tr->Branch("z1",&z1,"z1/D");
trb->Branch("x1b",&x1b,"x1b/D");
TRandom3 r;
for(jj=0;jj<100;jj++)
{
for(ii=0;ii<10000;ii++)
{
//if(ii%100==0)cout<<ii<<endl;
x1= r.Gaus(10,3);
y1= r.Gaus(-2,1);
z1= r.Gaus(4,0.5);
ient = ii;
tr->Fill();
}
TH1F *h1 = new TH1F("h1","h1",100,0,24);
tr->Project("h1","x1+y1","z1>4");
x1b = h1->GetMean();
cout<<x1b<<endl;
trb->Fill();
tr->Reset();
h1->Reset();
}
trb->Write();
af->Close();
}