root [0] .x cernstaff.C
Error in TApplication::ExecuteFile: macro cernbuild.C not found in path /snap/root-framework/146/usr/local/tutorials/tree/cernstaff.C
Error in TFile::TFile: file /home/hyungjoe/6.22.06/tutorials/tree/cernstaff.root does not exist
Generating stack trace…
0x00007fa33f77145b in
0x00007fa33f775053 in
0x00007fa33a245028 in cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const + 0x148 from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa33a1ad5f9 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) + 0xc9 from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa33a1af049 in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) + 0x209 from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa33a2bc245 in cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) + 0x445 from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa33a2ca275 in cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) + 0x1b5 from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa33a2cb76e in cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) + 0x9e from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa33a2b51d9 in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) + 0x189 from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa339fc37e5 in from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa339fc4278 in from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa339fc7dde in from /snap/root-framework/146/usr/local/lib/libCling.so
0x00007fa33fa6d6c2 in TApplication::ExecuteFile(char const*, int*, bool) at TApplication.cxx:? from /snap/root-framework/146/usr/local/lib/libCore.so
0x00007fa33fa6ce20 in TApplication::ProcessFile(char const*, int*, bool) + 0x34 from /snap/root-framework/146/usr/local/lib/libCore.so
0x00007fa33fa6cc0b in TApplication::ProcessLine(char const*, bool, int*) + 0xda9 from /snap/root-framework/146/usr/local/lib/libCore.so
0x00007fa33fe2c8fb in TRint::ProcessLineNr(char const*, char const*, int*) + 0x24d from /snap/root-framework/146/usr/local/lib/libRint.so
0x00007fa33fe2c022 in TRint::HandleTermInput() + 0x344 from /snap/root-framework/146/usr/local/lib/libRint.so
0x00007fa33fe298b9 in TTermInputHandler::Notify() + 0x35 from /snap/root-framework/146/usr/local/lib/libRint.so
0x00007fa33fe2e1bf in TTermInputHandler::ReadNotify() + 0x29 from /snap/root-framework/146/usr/local/lib/libRint.so
0x00007fa33fc0def7 in TUnixSystem::CheckDescriptors() + 0x121 from /snap/root-framework/146/usr/local/lib/libCore.so
0x00007fa33fc0d154 in TUnixSystem::DispatchOneEvent(bool) + 0x178 from /snap/root-framework/146/usr/local/lib/libCore.so
0x00007fa33fae701b in TSystem::InnerLoop() + 0x45 from /snap/root-framework/146/usr/local/lib/libCore.so
0x00007fa33fae6d8c in TSystem::Run() + 0xf4 from /snap/root-framework/146/usr/local/lib/libCore.so
0x00007fa33fa6d886 in TApplication::Run(bool) + 0x54 from /snap/root-framework/146/usr/local/lib/libCore.so
0x00007fa33fe2b332 in TRint::Run(bool) + 0x8da from /snap/root-framework/146/usr/local/lib/libRint.so
0x0000564ea8fcd241 in from /snap/root-framework/146/usr/local/bin/root.exe
0x00007fa33f3a80b3 in __libc_start_main + 0xf3 from /lib/x86_64-linux-gnu/libc.so.6
0x0000564ea8fcd10e in _start + 0x2e from /snap/root-framework/146/usr/local/bin/root.exe
Error in : 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/hyungjoe/6.22.06/tutorials/tree/cernstaff.C:24:4: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
T->Draw(“Nation:Division>>hN”,"",“text”);
^
root [1]
root [1] TCanvas *hbars() {
root (cont’ed, cancel with .@) [2] // Try to open first the file cernstaff.root in tutorials/tree directory
root (cont’ed, cancel with .@) [3] TString filedir = gROOT->GetTutorialDir();
root (cont’ed, cancel with .@) [4] filedir += TString("/tree/");
root (cont’ed, cancel with .@) [5] TString filename = “cernstaff.root”;
root (cont’ed, cancel with .@) [6] bool fileNotFound = gSystem->AccessPathName(filename); // note opposite return code
root (cont’ed, cancel with .@) [7]
root (cont’ed, cancel with .@) [7] // If file is not found try to generate it uing the macro tree/cernbuild.C
root (cont’ed, cancel with .@) [8] if (fileNotFound) {
root (cont’ed, cancel with .@) [9] TString macroName = filedir + “cernbuild.C”;
root (cont’ed, cancel with .@) [10] if (!gInterpreter->IsLoaded(macroName)) gInterpreter->LoadMacro(macroName);
root (cont’ed, cancel with .@) [11] gROOT->ProcessLineFast(“cernbuild()”);
root (cont’ed, cancel with .@) [12] }
root (cont’ed, cancel with .@) [13] TFile * f = TFile::Open(filename);
root (cont’ed, cancel with .@) [14] if (!f) {
root (cont’ed, cancel with .@) [15] Error(“hbars”,“file cernstaff.root not found”);
root (cont’ed, cancel with .@) [16] return 0;
root (cont’ed, cancel with .@) [17] }
root (cont’ed, cancel with .@) [18] TTree T = (TTree)f->Get(“T”);
root (cont’ed, cancel with .@) [19] if (!T) {
root (cont’ed, cancel with .@) [20] Error(“hbars”,“Tree T is not present in file %s”,f->GetName() );
root (cont’ed, cancel with .@) [21] return 0;
root (cont’ed, cancel with .@) [22] }
root (cont’ed, cancel with .@) [23] T->SetFillColor(45);
root (cont’ed, cancel with .@) [24] TCanvas *c1 = new TCanvas(“c1”,“histograms with bars”,700,800);
root (cont’ed, cancel with .@) [25] c1->SetFillColor(42);
root (cont’ed, cancel with .@) [26] c1->Divide(1,2);
root (cont’ed, cancel with .@) [27]
root (cont’ed, cancel with .@) [27] // Horizontal bar chart
root (cont’ed, cancel with .@) [28] c1->cd(1); gPad->SetGrid(); gPad->SetLogx(); gPad->SetFrameFillColor(33);
root (cont’ed, cancel with .@) [29] T->Draw(“Nation”,"",“hbar2”);
root (cont’ed, cancel with .@) [30]
root (cont’ed, cancel with .@) [30] // Vertical bar chart
root (cont’ed, cancel with .@) [31] c1->cd(2); gPad->SetGrid(); gPad->SetFrameFillColor(33);
root (cont’ed, cancel with .@) [32] T->Draw(“Division>>hDiv”,"",“goff”);
root (cont’ed, cancel with .@) [33] TH1F hDiv = (TH1F)gDirectory->Get(“hDiv”);
root (cont’ed, cancel with .@) [34] hDiv->SetStats(0);
root (cont’ed, cancel with .@) [35] TH1F hDivFR = (TH1F)hDiv->Clone(“hDivFR”);
root (cont’ed, cancel with .@) [36] T->Draw(“Division>>hDivFR”,“Nation==“FR””,“goff”);
root (cont’ed, cancel with .@) [37] hDiv->SetBarWidth(0.45);
root (cont’ed, cancel with .@) [38] hDiv->SetBarOffset(0.1);
root (cont’ed, cancel with .@) [39] hDiv->SetFillColor(49);
root (cont’ed, cancel with .@) [40] TH1 *h1 = hDiv->DrawCopy(“bar2”);
root (cont’ed, cancel with .@) [41] hDivFR->SetBarWidth(0.4);
root (cont’ed, cancel with .@) [42] hDivFR->SetBarOffset(0.55);
root (cont’ed, cancel with .@) [43] hDivFR->SetFillColor(50);
root (cont’ed, cancel with .@) [44] TH1 *h2 = hDivFR->DrawCopy(“bar2,same”);
root (cont’ed, cancel with .@) [45]
root (cont’ed, cancel with .@) [45] TLegend *legend = new TLegend(0.55,0.65,0.76,0.82);
root (cont’ed, cancel with .@) [46] legend->AddEntry(h1,“All nations”,“f”);
root (cont’ed, cancel with .@) [47] legend->AddEntry(h2,“French only”,“f”);
root (cont’ed, cancel with .@) [48] legend->Draw();
root (cont’ed, cancel with .@) [49]
root (cont’ed, cancel with .@) [49] c1->cd();
root (cont’ed, cancel with .@) [50] delete f;
root (cont’ed, cancel with .@) [51] return c1;
root (cont’ed, cancel with .@) [52]}