Home | News | Documentation | Download

Getting an error while running my code

Hope you are doing great.
I am getting the following error while running my code.
Please guide me.
Have a nice day.

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

following are the files that I am having problem.

The error is:

root -l eff_1.C
root [0] 
Processing eff_1.C...
#0  0x00007ff3e96ce457 in __GI___waitpid (pid=6744, stat_loc=stat_loc
entry=0x7ffdaa4d9fd8, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1  0x00007ff3e9639177 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:149
#2  0x00007ff3ea2e2b23 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x55e3eee347c0) at /home/robert/Downloads/root6/core/unix/src/TUnixSystem.cxx:2119
#3  TUnixSystem::StackTrace (this=0x55e3eee347c0) at /home/robert/Downloads/root6/core/unix/src/TUnixSystem.cxx:2413
#4  0x00007ff3e4ada005 in cling::MultiplexInterpreterCallbacks::PrintStackTrace() () from /home/robert/Downloads/MyRoot/lib/libCling.so
#5  0x00007ff3e4ad9a0b in cling_runtime_internal_throwIfInvalidPointer () from /home/robert/Downloads/MyRoot/lib/libCling.so
#6  0x00007ff3eaa8418b in ?? ()
#7  0x0000000000000000 in ?? ()
Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
In file included from input_line_10:1:
/home/robert/Downloads/MyRoot/macros/CK/eff_1.C:18:22: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
   TH1F *h2 = (TH1F*)f->Get("h")->Clone();

Looks like no histogram named “h” exists in your “f” file. Try: f->ls();

Where should I have to write it in the code or in the terminal? ( f->ls();)

You can also try the standalone tool: rootls -l your_file.root


I tried but following error is coming up
rootls -l 16O+100Mo@102MeV-2f-1.001.root
Traceback (most recent call last):
File “/home/Downloads/MyRoot/bin/rootls”, line 10, in
import cmdLineUtils
ImportError: No module named cmdLineUtils

It seems you do not have “pyroot”.

root your_file.root -q -e 'gFile->ls();'


What Can I do to view the spectrums in these files?
I know that I can view the spectrums in TBrowser but for doing calibration my file [eff_1.C|attachment](https://root-forum.cern.ch/uploads/short-url/trhdcRigiNPJhFu3dbVBLzP11te.C) (is giving me the error that I have posted above)

You need to use a proper histogram’s name (there is no histogram named “h”, as you can see).

I got the program running when I changed the histogram name from h to that which is in the root file.