2 Tree Questions

Olivier Meplan (meplan@isn.in2p3.fr)
Mon, 17 May 1999 16:03:39 +0200


Hi rooters!

I have 2 questions about trees (certainly very stupid...)

1) I have a tree with a single branch; the number of entries is of the
order of 50 000 000. I want to make a sub tree of that tree with some
conditions; for that I use the following code

b=original_tree->GetBranch("EventBranch"); //b is a TBranch
evt= new Event(); //my event class
b->SetAddress(&evt);
if(sub_tree!=0) delete sub_tree;
sub_tree=original_tree->CloneTree(0);
Int_t kTime,kAmplitude,kPileUp,kChannel; //flags for selection
Int_t i;
for(i=0;i < o_nentries ; i++) //o_entries=
//original_tree->GetEvent()
{
b->GetEvent(i);
kChannel=0; //evt_sel contains my selections
for (Int_t k=0;k<evt_sel->GetNChannel();k++)
{
if(evt->GetChannel()==evt_sel->GetChannel(k)) kChannel=1;
if(evt_sel->Tmax>evt_sel->Tmin)
kTime=(evt->GetTime()>=evt_sel->Tmin &&
evt->GetTime()<=evt_sel->Tmax);
else kTime=1;
if(evt_sel->Amax>evt_sel->Amin)
kAmplitude=(evt->GetAmplitude()>=
evt_sel->Amin &&
evt->GetAmplitude()<=evt_sel->Amax);
else kAmplitude=1;
if(evt_sel->PileUpBit!=2)
kPileUp=(evt->GetPileUpBit()==
evt_sel->PileUpBit);
else kPileUp=1;
if(kTime && kAmplitude && kPileUp && kChannel)
sub_tree->Fill();
}
}
sub_tree->SetName("Sub_E");

With that code it took a very long time to make the sub tree!
(Up o 5 min); What can I do to increased the speed?

2) question 2.

In my interface I have 3 tree pointers: one for the original_tree, one
for the sub_tree and one named cuurent_tree wich take the value of
original_tree or of the sub_tree depending of the user choice.
There is no pb when I try to draw a given selection of the original_tree
but when I do the same thing for the sub_tree I have the following error
message:

Warning in <TBranch::GetBasket>: Estimated keylen too small=14465
Fatal in <operator new>: storage exhausted

which of course I don't understand...
Thanks for your help
Olivier Meplan