RE: [Brahms-dev-l] root error

From: Johnson, Erik B <ebj@ku.edu>
Date: Fri Apr 30 2004 - 05:49:00 EDT
Bjorn,
  Thanks for the info.  Here is what I'm doing with the ntulpe.  I fill it in a module.  


void BrCreateFlowNT::Begin()
{
  fFlowNT = new  TNtuple("FlowNT","Flow Ntuple",
			 "Psi1_r2:Psi1_r3:Psi2_r2:Psi2_r3:"
			 "cent:eta_r2:eta_r3:vz:"
			 "v1_r2:v1_r3:v2_r2:v2_r3");
  
}


void BrCreateFlowNT::Event(BrEventNode* inNode, BrEventNode* outNode)
{

...code....

// __________________________________________________________
  // Fill Ntulpe
  Float_t ntarray[12];
  ntarray[0]  = Psi1_r2;
  ntarray[1]  = Psi1_r3;
  ntarray[2]  = Psi2_r2;
  ntarray[3]  = Psi2_r3;
  ntarray[4]  = cent;
  ntarray[5]  = eta_r2;
  ntarray[6]  = eta_r3;
  ntarray[7]  = vz;
  ntarray[8]  = v1_r2;
  ntarray[9]  = v1_r3;
  ntarray[10] = v2_r2;
  ntarray[11] = v2_r3;
  fFlowNT->Fill(ntarray);

}


//__________________________________________________________________
void BrCreateFlowNT::Finish() 
{
  SetState(kFinish);
  TFile *sf = new TFile("FlowNT.root","RECREATE");
  fFlowNT->Write();
  sf->Close();

}


The other thing that I've noticed is that when I run over 100,000 events I get the error.  When I run over only 10,000 events I get nice plots.  I have a feeling the error has something to do with how the memory is handled.  
Erik




-----Original Message-----
From:	brahms-dev-l-bounces@lists.bnl.gov on behalf of Bjorn H Samset
Sent:	Fri 4/30/2004 3:14 AM
To:	BRAHMS Software list
Cc:	
Subject:	Re: [Brahms-dev-l] root error
On Fri, 30 Apr 2004, Johnson, Erik B wrote:

> Brahms,
>   I have a general root error that I don't understand.  I fill a ntuple
> with the variable eta_r2.  I save the ntuple in a root file using TFile
> *sf = new TFile("filename","RECREATE"); ntulpe->Write(); sf->Close();
>
> When I try to draw eta_r2, I get this error message Error in
> <TFile::ReadBuffer>: error reading all requested bytes from file
> FlowNT.root, got 0 of 28964 Error in <TBranch::GetBasket>: File:
> FlowNT.root at byte:0, branch:eta_r2, entry:-1 Error in
> <TFile::ReadBuffer>: error reading all requested bytes from file
> FlowNT.root, got 0 of 28964
>
>   Does anyone know what could be wrong here?


Hi Erik. It's a bit hard to tell without the rest of the code, but it
looks to me like the ntuple was created OK but not written properly. A
simple thing to try is to make sure you write it in the proper place:

TFile *sf = new TFile("filename","RECREATE");
sf->cd(); // make sure you're in the right dir just before writing
ntulpe->Write();
sf->Close();

If that's not it, could you send us some more of the code?

Ping :-)

--
Bjorn H. Samset                           Phone: 22856465/92051998
PhD student, heavy ion physics            Adr:   Schouterrassen 6
Inst. of Physics, University of Oslo             0573 Oslo
                              \|/
----------------------------> -*- <-----------------------------
                              /|\

_______________________________________________
Brahms-dev-l mailing list
Brahms-dev-l@lists.bnl.gov
http://lists.bnl.gov/mailman/listinfo/brahms-dev-l




_______________________________________________
Brahms-dev-l mailing list
Brahms-dev-l@lists.bnl.gov
http://lists.bnl.gov/mailman/listinfo/brahms-dev-l
Received on Fri Apr 30 05:49:29 2004

This archive was generated by hypermail 2.1.8 : Fri Apr 30 2004 - 05:49:44 EDT