Possible bug for creating root file

Dear ROOT experts

Hello while I was plotting TH2F graph, the terminal was showing this error message:

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f7b3bbcedbc in waitpid () from /lib64/libc.so.6
#1  0x00007f7b3bb51cc2 in do_system () from /lib64/libc.so.6
#2  0x00007f7b3cbd56af in TUnixSystem::StackTrace (this=0x8268e0) at /afs/cern.ch/user/d/daslee/Downloads/root-6.09.02/core/unix/src/TUnixSystem.cxx:2413
#3  0x00007f7b3cbd7dfc in TUnixSystem::DispatchSignals (this=0x8268e0, sig=kSigSegmentationViolation) at /afs/cern.ch/user/d/daslee/Downloads/root-6.09.02/core/unix/src/TUnixSystem.cxx:3633
#4  <signal handler called>
#5  0x0000000000000000 in ?? ()
#6  0x0000000000000000 in ?? ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum.
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x0000000000000000 in ?? ()
#6  0x0000000000000000 in ?? ()
===========================================================

is this bug or I did something wrong?

Can you post a (simple) macro reproducing this crash ?

here is the code following:

{
  TCanvas* c = new TCanvas();
   int points_1 = 20000;

ifstream file1("beamdis_raw.txt");
TFile *f = new TFile("basic.root","RECREATE");
 TH2F *h1 = new TH2F("proton distribution","The proton distribution" ,50,-5,5,50,-5,5);
 //TNtuple *ntuple1 = new TNtuple("ntuple1","detectorn_0.9.txt","x:y");

 Float_t x1, y2, z1;
  for(Int_t i=0; i<points_1; i++){
    file1>>x1>>y2>>z1;
    //y2=y2/(2.0E04);
    h1->Fill(x1,y2);
    // ntuple1->Fill(x,y);
    if(!file1) break;}
  
 h1->Draw("COLZ");

Looking quickly at it I do not see any obvious error. Can you post something we can run reproducing the error ?

Could you try to replace:

by:

   if (file1.eof()) break;}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.