Dear ROOTers,
I’m reading event objects from a chain and trying to speed up my analysis by disabling unnecessary branches. But instead of running faster it is much slower now.
My event objects consists mainly of an event header, some kinematic variables and clones arrays containing tracks, vertices etc.
The event trees are created by this piece of code:
// Create event tree
fTree = new TTree(TreeName, TreeTitle);
fTree->SetAutoSave(1000000000); // autosave each 1GB
fTree->SetBranchStyle(1); // use new branch style (bronch)
// Create pointer to event objects
fEvent = new ZEvent;
// Create superbranche
TBranch *b_evt = fTree->Branch(“Event”, “ZEvent”, &fEvent);
b_evt->SetAutoDelete(kFALSE); // don’t re-create event in event loop
So this means buffe size = 32000 and split level = 99.
For reading the chain I use:
// Set branch address
fEvent = new ZEvent;
fInputChain->SetBranchAddress(“Event”, &fEvent);
// Set input branches to read
fInputChain->SetBranchStatus("", kFALSE); // disable all
fInputChain->SetBranchStatus("fEvtHeader", 1);
fInputChain->SetBranchStatus(“fNTracks”, kTRUE);
fInputChain->SetBranchStatus(“fTracks*”, kTRUE);
// Event loop
for ( Int_t ievt = 0; ievt < nevt; ievt++ ) {
fInputChain->GetEntry(ievt);
…
}
As I told you, this runs very slowly compared with the case in which all branches are enabled. Do you have any ideas why this can happen?
I’ve also tried the alternative method by using TBranch::GetEntry() instead, but here I got a seg fault immedialty in the first event. I don’t know why exactly, because I don’t have a debug version of RooT here.
However, if I set TChain::SetMakeClass(1), then the analysis is very fast (like in TChain::Draw()). Unfortunately in this case the branch addresses aren’t set correctly, so that the event objects are empty. One could think of setting them individually, but I’d rather keep and work with the event objects, even if they are filled only partially.
Many thanks in advance,
Oliver
P.S: I’m working with Root 3.05_03 on a Intel Pentium III (1266MHz), linux, gcc version 2.95.3