Crash error while file run

Hello Rooters:
I m trying to run .cc file by doing " root -l .cc file" . I m getting this crash error given below. I dont have any idea that why i m getting this error. Can you please help me fix this error.
Thank in advance.

There was a crash.
This is the entire stack trace of all threads:
===========================================================

Thread 11 (Thread 0x7f1203715700 (LWP 9460)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 10 (Thread 0x7f1202d14700 (LWP 9461)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 9 (Thread 0x7f1202313700 (LWP 9462)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 8 (Thread 0x7f1201912700 (LWP 9463)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 7 (Thread 0x7f1200f11700 (LWP 9464)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 6 (Thread 0x7f1200510700 (LWP 9465)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7f11ffb0f700 (LWP 9466)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f11ff10e700 (LWP 9467)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f11fe70d700 (LWP 9468)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f11fdd0c700 (LWP 9469)):
#0  0x00007f120fe5c68c in pthread_cond_wait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f12059669c3 in ?? () from /usr/lib64/dri/swrast_dri.so
#2  0x00007f1205966537 in ?? () from /usr/lib64/dri/swrast_dri.so
#3  0x00007f120fe58aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f12115c2bcd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f1212b3d0e0 (LWP 7145)):
#0  0x00007f121158686d in waitpid () from /lib64/libc.so.6
#1  0x00007f1211518479 in do_system () from /lib64/libc.so.6
#2  0x00007f12115187b0 in system () from /lib64/libc.so.6
#3  0x00007f1212229b04 in TUnixSystem::StackTrace() () from /usr/lib64/root/libCore.so.5.34
#4  0x00007f1212228f23 in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib64/root/libCore.so.5.34
#5  <signal handler called>
#6  0x00007f121228cc28 in ?? () from /usr/lib64/root/libCore.so.5.34
#7  0x00007f1210ba7ba9 in Cint::G__ExceptionWrapper(int (*)(G__value*, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /usr/lib64/root/libCint.so.5.34
#8  0x00007f1210c4fed1 in G__execute_call () from /usr/lib64/root/libCint.so.5.34
#9  0x00007f1210c50d22 in G__call_cppfunc () from /usr/lib64/root/libCint.so.5.34
#10 0x00007f1210c2fa05 in G__interpret_func () from /usr/lib64/root/libCint.so.5.34
#11 0x00007f1210c1e8b9 in G__getfunction () from /usr/lib64/root/libCint.so.5.34
#12 0x00007f1210d03071 in G__getstructmem(int, G__FastAllocString&, char*, int, char*, int*, G__var_array*, int) () from /usr/lib64/root/libCint.so.5.34
#13 0x00007f1210cfb80a in G__getvariable () from /usr/lib64/root/libCint.so.5.34
#14 0x00007f1210d03031 in G__getstructmem(int, G__FastAllocString&, char*, int, char*, int*, G__var_array*, int) () from /usr/lib64/root/libCint.so.5.34
#15 0x00007f1210cfb80a in G__getvariable () from /usr/lib64/root/libCint.so.5.34
#16 0x00007f1210bfc9ad in G__getitem () from /usr/lib64/root/libCint.so.5.34
#17 0x00007f1210c01cb8 in G__getexpr () from /usr/lib64/root/libCint.so.5.34
#18 0x00007f1210c7cbe7 in G__exec_statement () from /usr/lib64/root/libCint.so.5.34
#19 0x00007f1210c30dd9 in G__interpret_func () from /usr/lib64/root/libCint.so.5.34
#20 0x00007f1210c1e918 in G__getfunction () from /usr/lib64/root/libCint.so.5.34
#21 0x00007f1210bfd12e in G__getitem () from /usr/lib64/root/libCint.so.5.34
#22 0x00007f1210c01cb8 in G__getexpr () from /usr/lib64/root/libCint.so.5.34
#23 0x00007f1210c0b1c8 in G__calc_internal () from /usr/lib64/root/libCint.so.5.34
#24 0x00007f1210c8a275 in G__process_cmd () from /usr/lib64/root/libCint.so.5.34
#25 0x00007f12121e9c46 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /usr/lib64/root/libCore.so.5.34
#26 0x00007f12121e73b3 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /usr/lib64/root/libCore.so.5.34
#27 0x00007f121214e126 in TApplication::ExecuteFile(char const*, int*, bool) () from /usr/lib64/root/libCore.so.5.34
#28 0x00007f121214d5d3 in TApplication::ProcessLine(char const*, bool, int*) () from /usr/lib64/root/libCore.so.5.34
#29 0x00007f1211d9d811 in TRint::Run(bool) () from /usr/lib64/root/libRint.so.5.34
#30 0x000000000040103c in main ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug 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.
===========================================================
#6  0x00007f121228cc28 in ?? () from /usr/lib64/root/libCore.so.5.34
===========================================================


Root > Function comparison1() busy flag cleared

Best Regards

You will need to provide the shortest working example of your script which causes the crash.

comparison1.cc (3.0 KB)
Dear ksmith:
Thanks for your reply. Here is the file that is causing the crash.

Best Regards

First step, remove all the unneeded headers that are cluttering your file (some class you included multiple times):

#include <TFile.h>
#include <TCanvas.h>
#include <TGaxis.h>
#include <TPad.h>
#include <TH1F.h>

//...

Secondly, this does not run as the input files are missing:

Error in <TFile::TFile>: file /afs/cern.ch/work/r/rkanwal/root_files/data_eta.root does not exist
Error in <TFile::TFile>: file /afs/cern.ch/work/r/rkanwal/root_files/mc_eta.root does not exist

If I instead create some fake data:

TH1F *h1 = new TH1F("h1", "H", 100, -2, 2);
TH1F *h2 = (TH1F*) h1->Clone("h2");
h1->FillRandom("gaus", 1E4);
h2->FillRandom("gaus", 1E4);

I get this result:

Also, the tabbing needed a little work.

Oh i m really sorry, i forgot to upload that input root files.
Here are the input files. mc_eta.root (10.2 KB)
data_eta.root (10.3 KB)

Your data files do not contain TH1F objects, but instead have TGraphAsymmErrors. You are forcing an incorrect cast and then have to suffer the consequences. Using a dynamic_cast will check if the type will work.

   TH1F *h1 = dynamic_cast<TH1F*>(f->Get("hxy_fit_eff;3"));
   TH1F *h2 = dynamic_cast<TH1F*>(f1->Get("hxy_fit_eff;3"));
   if (!h1 || !h2) {
      std::cerr << "ERROR: Unable to retrieve TH1F objects!\n";
      return;
   }

As @ksmith says or directly get from file an object with the correct type:

   TH1F *h1, *h2;
   f->GetObject("hxy_fit_eff;3", h1);
   f1->GetObject("hxy_fit_eff;3", h2);
   if (!h1 || !h2) {
      std::cerr << "ERROR: Unable to retrieve TH1F objects!\n";
      return;
   }
1 Like

okay thank u so much dpiparo.

Best Regards

thanks to @ksmith!

Cheers,
Danilo

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