I had tried to use read not recreate for f1 and f2, but that gave me an error about tfile::init could not read type, or something along those lines So that would’ve been the right thing to use though?
Not in tutorials, although what I was basing the code on was this:
I have two files, ROC.root and SherpaRoc.root. They each contain Multiple TGraphs which show up in a TBrowser as Graph;1, Graph;2 … Graph;10. So I need to get Graph;10 from each file and plot them on the same graph (with different coloured lines). I’m not sure how to get Graph;10 rather than Graph;1, say, but then I can’t get it working at all yet.
I changed it back to “read” for the two existing files and get some weird output like this:
Processing combineROCCurves.C...
gdb.printing.register_pretty_printer(gdb.current_objfile(),
gdb.printing.register_pretty_printer(gdb.current_objfile(),
#0 0x00007f4b7708e41c in waitpid () from /lib64/libc.so.6
#1 0x00007f4b7700bf12 in do_system () from /lib64/libc.so.6
#2 0x00007f4b77bfe644 in TUnixSystem::StackTrace() () from /usr/lib64/root/libCore.so.6.18
#3 0x00007f4b71fb8d95 in cling::MultiplexInterpreterCallbacks::PrintStackTrace() () from /usr/lib64/root/libCling.so
#4 0x00007f4b71fb823b in cling_runtime_internal_throwIfInvalidPointer () from /usr/lib64/root/libCling.so
#5 0x00007f4b7835819e in ?? ()
#6 0x00007fffb560b5d0 in ?? ()
#7 0x00007fffb560b5cf in ?? ()
#8 0x00007fffb560b5e0 in ?? ()
#9 0x0000000c00000000 in ?? ()
#10 0x0000000001bae8e0 in ?? ()
#11 0x0000000001b8f640 in ?? ()
#12 0x00000000019819a8 in ?? ()
#13 0x0000000001980ff8 in ?? ()
#14 0x0000000001a67cc0 in ?? ()
#15 0x0000000001981008 in ?? ()
#16 0x0000000001bae850 in ?? ()
#17 0x00007fffb560b830 in ?? ()
#18 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:
**/home/atlas/krybacki/Pythia/Test/combineROCCurves.C:43:1:** **warning:** **null passed to a callee that requires a non-null argument [-Wnonnull]**
graph->Draw();
which I’m guessing is it complaining that ‘graph’ doesn’t exist or something?
In principle not, the semicolon and number are called cycles. They are “backup” copies of the object. When you write several times an object with the same name into a file, root appends a cycle number. These numbers are different “revision” of the object.
Well, at some point you have to write the objects in the file (as @Wile_E_Coyote just showed) … And I think you should definitively look at the tutorials