Hello, I would like to plot graphs only for no-empty cases…then I did
double entries[10];
t->SetBranchAddress("xhit", &entries[0]);
if (xhit[0]!=NULL){
c01->Print(outputname);
}
but I get this error
: warning: comparison between NULL and non-pointer ('double' and NULL) [-Wnull-arithmetic]
if (entries[0]!=NULL){
~~~~~~~~~~^ ~~~~
/data_collamaf/DataFausto/Muon_Collider/III_anno/TestBeam21/2021/12-11-05/LEMMA-TB2021/xhitb21.cpp:82:29: warning: implicit conversion of NULL constant to 'double' [-Wnull-conversion]
if (entries[0]!=NULL){
~~^~~~
0.0
TFile** setup/build/LemmaMC.root
TFile* setup/build/LemmaMC.root
KEY: TTree LEMMA;1 LemmaMCNtuple
KEY: TTree Beam;1 SimulatedBeamInfo
KEY: TTree DetEnter;1 WhatEntersCalos
KEY: TTree DetExit;1 WhatExitsCalos
KEY: TH1D CaloMap;1 CaloMap
#0 0x00007ff9724c7471 in __GI___waitpid (pid=20227, stat_loc=stat_loc
entry=0x7ffd68f966d8, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1 0x00007ff972443cc7 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2 0x00007ff972e91620 in TUnixSystem::StackTrace() () from /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/root/6.24/lib/libCore.so.6.24
#3 0x00007ff96e0ea8f8 in ?? () from /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/root/6.24/lib/libCling.so
#4 0x00007ff96e0e09de in cling_runtime_internal_throwIfInvalidPointer () from /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/root/6.24/lib/libCling.so
#5 0x00007ff9725ba3f9 in ?? ()
#6 0x00007ff96f0a34f0 in ?? () from /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/root/6.24/lib/libCling.so
#7 0x00007ff96f0a51e0 in ?? () from /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/root/6.24/lib/libCling.so
#8 0x000055cdb443ba98 in ?? ()
#9 0x00007ffd68f98c60 in ?? ()
#10 0x000055cdb43a5450 in ?? ()
#11 0x0000000000000035 in ?? ()
#12 0x0000000000000026 in ?? ()
#13 0x000055cdb3f6dd00 in ?? ()
#14 0x000055cdb43a0408 in ?? ()
#15 0x000000000000000b in ?? ()
#16 0x000055cdb4570410 in ?? ()
#17 0x0000000300000010 in ?? ()
#18 0x0000001800000000 in ?? ()
#19 0x00007ff9725bd000 in ?? ()
#20 0x000055cdb30641e8 in ?? ()
#21 0xd30207b000000000 in ?? ()
#22 0x000055cdb41a23e0 in ?? ()
#23 0x000055cdb4271ef0 in ?? ()
#24 0x000055cdb44e5210 in ?? ()
#25 0x0000000000000003 in ?? ()
#26 0x000055cdb43db990 in ?? ()
#27 0x0000000300000010 in ?? ()
#28 0x0000001800000000 in ?? ()
#29 0x0000000168f98b98 in ?? ()
#30 0x00007ffd68f98b98 in ?? ()
#31 0xd30207b0d1f06e00 in ?? ()
#32 0x000055cdb42e6bd0 in ?? ()
#33 0x00007ff970b1ce94 in ?? () from /cvmfs/sft.cern.ch/lcg/contrib/gentoo/linux/x86_64/usr/lib64/root/6.24/lib/libCling.so
#34 0x0000000000000001 in ?? ()
#35 0x00007ffd68f98d30 in ?? ()
#36 0x00007ff97306413d in do_lookup_x (undef_name=<error reading variable: Cannot access memory at address 0x556>, new_hash=<error reading variable: Cannot access memory at address 0x54e>, old_hash=<error reading variable: Cannot access memory at address 0x526>, ref=<error reading variable: Cannot access memory at address 0x546>, result=<error reading variable: Cannot access memory at address 0x52e>, scope=<optimized out>, i=<optimized out>, version=<error reading variable: Cannot access memory at address 0x5ce>, flags=<error reading variable: Cannot access memory at address 0x5d6>, skip=<error reading variable: Cannot access memory at address 0x5de>, type_class=<error reading variable: Cannot access memory at address 0x5e6>, undef_map=<error reading variable: Cannot access memory at address 0x5ee>) at dl-lookup.c:423
Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
/data_collamaf/DataFausto/Muon_Collider/III_anno/TestBeam21/2021/12-11-05/LEMMA-TB2021/xhitb21.cpp:41:4: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
t->SetBranchAddress("xhit", &entries[0]);
^
root [1]
xhitb21.cpp (3.1 KB)