Rene Brun
//____________________macro William.C____________________
{
gROOT->Reset();
TFile *f = new TFile("wil.root","RECREATE");
TNtuple *ntuple = new TNtuple("ntuple","data from Unidaq file",
"p_time:nwires:time:chamber:mpx_peak:x:y:isVert");
Float_t p_time,x,y;
Float_t nwires,time,chamber,peak,isVert;
for (Int_t i=0;i<10000;i++) {
p_time = gRandom->Rndm();
nwires = 100*gRandom->Rndm();
time = 100*gRandom->Rndm();
chamber = 10*gRandom->Rndm();
peak = 1000*gRandom->Rndm();
x = 100*gRandom->Gaus(0,2);
y = 100*gRandom->Gaus(5,1);
isVert = 100*gRandom->Rndm();
ntuple->Fill(p_time,
nwires,
time,
chamber,
peak,
x,
y,
isVert);
}
f->Write();
}
//_________________end of macro
William J. Deninger wrote:
>
> Hello,
>
> I have a TObject class called BOOK which creates an TNuple and TFile and
> Fills data into the ntuple, but seems to generate a run-time error when
> the ntuple fill routine is called too often (exactly 7982 times with
> this ntuple regardless of data), it crashes my WinNT root!
> .
> // code segment
> void BOOK::Run()
> {
> TFile *f = new TFile("d:\\data\\basic.root","RECREATE");
> TNtuple *ntuple = new TNtuple("ntuple","data from Unidaq file",
> "p_time:nwires:time:chamber:mpx_peak:x:y:isVert");
> unsigned int calls = 0;
> // big loop over unidaq data
> while(unidaq.get_record())
> {
> cout << "record " << unidaq.record() << endl;
> ....
> ....
> // booking ntuple
> for (unsigned int i=0; i<mpx.hit.size_wires; i++)
> {
> calls ++; // bombs Root on 7982 nd call regardless of data.
> ntuple->Fill(mpx.hit.p_time, mpx.hit.size_wires,
> (mpx.hit.wires[i].time_1 + mpx.hit.wires[i].time_2)/2.0,
> mpx.hit.wires[i].wi.Chamber(),
> mpx.hit.wires[i].mpx_peak,
> mpx.hit.wires[i].wi.Wire_x(),
> mpx.hit.wires[i].wi.Wire_y(),
> mpx.hit.wires[i].wi.Iswirevert() );
> }
> }
> f->Write();
> }
>
> //
> //
> root[0] BOOK b;
> root[1] b.Run();
> record 1
> ..
> ..
> record 779
> record 780
> record 781
> record 782
> Fatal in <operator delete>: storage area overwritten
> aborting
> Warning in <TClass::TClass>: no dictionary for class TWinNTSystem
> available
> Warning in <TWinNTSystem::StackTrace>: this method must be overridden!
>
> Any suggestions??
>
> William J. Deninger