St9bad_alloc

Hello All,

 I am having an interesting problem.  I am using cafe and running some MC files through a processor I wrote.  When I run over 1000, or 2000 events there seems to be no problem.  When I run over 10000 events, I get this error message:

######################################################################

root [2] TCanvas::MakeDefCanvas: created default TCanvas with name c1
Error in TFile::ReadBuffer: error reading all requested bytes from file testjob.root, got 0 of 3934
Warning in TBasket::ReadBasketBuffers: basket: has fNevBuf=0, but fEntryOffset=0, trying to repair
Error in TBranchElement::GetBasket: File: testjob.root at byte:0, branch:(null), entry:153661564
Error in TFile::ReadBuffer: error reading all requested bytes from file testjob.root, got 0 of 3934
Warning in TBasket::ReadBasketBuffers: basket: has fNevBuf=0, but fEntryOffset=0, trying to repair
Error in TBranchElement::GetBasket: File: testjob.root at byte:0, branch:(null), entry:153661564
terminate called after throwing an instance of ‘std::bad_alloc’
what(): St9bad_alloc

#######################################################################

I will attach my processor code (it isn’t too long) and the root file. I believe the problem is in the part of the code that fills the muonbranch (as I have called it). As I said, it seems to be fine when run over 2000 events.

If any of you would help me with this problem, I would so greatly appreciate it. I am defending a masters in a week using results from this code, and I could really use a friend right now. Thanks so much in advance for your time.

Sincerely,
Evan
testjob.root (113 KB)
MyPartonSelector.cpp (15.2 KB)

Your file testjob.root contains the tree header only and not its baskets.
It looks like you saved your baskets buffers to another file and the Tree header to a different file. Here is the result of TFile::Map()

root [0] TFile f("testjob.root"); root [1] f.Map() 20081031/163056 At:100 N=120 TFile 20081031/184735 At:220 N=105430 TTree CX = 2.99 20081031/184735 At:105650 N=311 TH1D CX = 2.22 20081031/184735 At:105961 N=644 TH2F CX = 65.60 20081031/184735 At:106605 N=492 TH1D CX = 34.12 20081031/184735 At:107097 N=539 TH1D CX = 31.23 20081031/184735 At:107636 N=526 KeysList 20081031/184735 At:108162 N=7003 StreamerInfo CX = 3.65 20081031/184735 At:115165 N=56 FreeSegments 20081031/184735 At:115221 N=1 END

Rene

Dear Rene,

 Thanks so much for your reply, can you tell me how to implement your advice or point me to a source that can tell me?   Once again, thanks  :slight_smile: 

Evan

well! my answer was not an advice, just a simple look to your file.
You should look at your program that created this file and check where your baskets were created. I cannot tell you more without looking at your code, but this should be something simple to find yourself.

Rene