Hi all,
I am trying to read a histogram out of a TFolder in a root file, and I repeat this process 5 times. I have provided a skeleton of what I do below.
What I am finding is that each time I add a new TFolder the memory usage goes up by about 400 Meg, so repeating this 6 times slows down the computer considerably, moreover repeating the routine, will cause a crash.
Is there a way to remove the tfolder’s memory allocation? Thanks for any and all help.
Ben
int play(){
for(int j = 0; j<2; j++){
switch(j){
case 0:
TFile f2 = new TFile("/home/bauerbac/yale/yframework/output/new/10Tev/zee2j_pdg11/all.root", “READ”);
if (!f2) cout << “there is no file” << endl;
f2->cd();
TFolder fFolder1 = (TFolder*)f2 ->Get(“UC;1”); // get folder
fMetvsMass = (TH2F*) f2->Get(“UC/lljets/lljets_z_metvsmass”);
if(fMetvsMass) fMetvsMass->Draw();
f2->Close("R");
break;
case 1:
TFile *f3 = new TFile("/home/bauerbac/yale/yframework/output/new/10Tev/zee3j_pdg11/all.root", "READ");
if (!f3) cout << "there is no file" << endl;
f3->cd();
TFolder* fFolder1 = (TFolder*)f3 ->Get("UC;1"); // get folder
fMetvsMass = (TH2F*) fFolder1->FindObjectAny("lljets_z_metvsmass");
f3->Close("R");
break;
}
}
delete fFolder1;
return -1;
}