andy@andy$ root itog_allGuass.C
root [0]
Processing itog_allGuass.C...
#0 0x00007fbff3f8d337 in __GI___waitpid (pid=29249, stat_loc=stat_loc
entry=0x7fff6a545ba8, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1 0x00007fbff3ef8047 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:149
#2 0x00007fbff4ba6bff in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x56467eec8740) at /opt/root/root-6.09.02-source/core/unix/src/TUnixSystem.cxx:2119
#3 TUnixSystem::StackTrace (this=0x56467eec8740) at /opt/root/root-6.09.02-source/core/unix/src/TUnixSystem.cxx:2413
#4 0x00007fbfefd37ff5 in cling::MultiplexInterpreterCallbacks::PrintStackTrace() () from /opt/root/root-6.09.02-build/lib/libCling.so
#5 0x00007fbfefd37a88 in cling_runtime_internal_throwIfInvalidPointer () from /opt/root/root-6.09.02-build/lib/libCling.so
#6 0x00007fbff52f2316 in ?? ()
#7 0x00007fbf00000000 in ?? ()
#8 0x9d59dc20b9863700 in ?? ()
#9 0x0000000000000002 in ?? ()
#10 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_8:1:
/opt/geant4/ĐиПа/gc/reasult/4/itog_allGuass.C:11:9: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
h->Draw()
---------------------------------------------------------
Why my histogram is null?
I can open my root-file and see my histogram(PMT2) using TBrowser!
Help me!
OK, so there is no TH2I in your file, so TH2I *h = (TH2I*)file1->Get("PMT2"); cannot work. You must create and fill an histogram from the Hits TTree. Probably something like:
#include <TCanvas.h>
#include <ROOT/RDataFrame.hxx>
void itog_allGuass()
{
TCanvas *c1 = new TCanvas("c1", "c1");
ROOT::RDataFrame df{"Hits", "351mm_12.root"};
auto hist1 = df.Histo1D("PMT1");
hist1->DrawClone();
/// draw another histogram in the same canvas
auto hist2 = df.Histo1D("PMT2");
hist2->DrawClone("SAME");
}