Hello I have a code which I simplified down below
My issue stems from the second to last line where if I try to use it
It spits out a long error which I show at the bottom. I’m not sure on where I’m going wrong with using the function.
void fplot()
{
TH1D* h1 = new TH1D("h1","",10,0,10);
h1->SetBinContent(1, TMath::Poisson(0.,1));
h1->SetBinContent(2, TMath::Poisson(0.,2));
h1->SetBinContent(3, TMath::Poisson(0.,3));
h1->SetBinContent(4, TMath::Poisson(0.,4));
h1->SetBinContent(5, TMath::Poisson(0.,5));
h1->SetBinContent(6, TMath::Poisson(0.,6));
h1->SetBinContent(7, TMath::Poisson(0.,7));
h1->SetBinContent(8, TMath::Poisson(0.,8));
h1->SetBinContent(9, TMath::Poisson(0.,9));
h1->SetBinContent(10,TMath::Poisson(0.,10));
TF1 *Poisson = new TF1("Poisson", "TMath::Poisson(0.,x)", 0., 10.);
Poisson -> Draw();
h1 -> Draw("same");
TF1 *fit = h1 -> GetFunction("Poisson");
double_t chi = fit -> GetChisquare();
cout << "ChiTest(1)" << chi << endl;
}
==========================================
=============== STACKTRACE ===============
==========================================
================ Thread 0 ================
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\metacling\src\TClingCallbacks.cxx(922): TClingCallbacks::PrintStackTrace()
libCling!cling::MultiplexInterpreterCallbacks::PrintStackTrace()
libCling!cling_runtime_internal_throwIfInvalidPointer()
0xe0edbb6 ??
0xe0ef037 ??
libCling!cling::IncrementalExecutor::executeWrapper()
libCling!cling::Interpreter::RunFunction()
libCling!cling::Interpreter::EvaluateInternal()
libCling!cling::Interpreter::process()
libCling!cling::MetaProcessor::process()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\metacling\src\TCling.cxx(2427): HandleInterpreterException()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\metacling\src\TCling.cxx(2587): TCling::ProcessLine()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\base\src\TApplication.cxx(1472): TApplication::ProcessLine()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\rint\src\TRint.cxx(751): TRint::ProcessLineNr()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\rint\src\TRint.cxx(613): TRint::HandleTermInput()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\winnt\src\TWinNTSystem.cxx(1615): TWinNTSystem::DispatchOneEvent()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\base\src\TSystem.cxx(405): TSystem::InnerLoop()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\base\src\TSystem.cxx(355): TSystem::Run()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\base\src\TApplication.cxx(1624): TApplication::Run()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\rint\src\TRint.cxx(466): TRint::Run()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\main\src\rmain.cxx(32): main()
d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(288): __scrt_common_main_seh()
KERNEL32!BaseThreadInitThunk()
ntdll!RtlGetAppContainerNamedObjectPath()
ntdll!RtlGetAppContainerNamedObjectPath()
================ Thread 1 ================
ntdll!NtDelayExecution()
KERNELBASE!Sleep()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\winnt\src\TWinNTSystem.cxx(4379): TWinNTSystem::TimerThread()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\winnt\inc\TWinNTSystem.h(99): TWinNTSystem::ThreadStub()
KERNEL32!BaseThreadInitThunk()
ntdll!RtlGetAppContainerNamedObjectPath()
ntdll!RtlGetAppContainerNamedObjectPath()
================ Thread 2 ================
win32u!NtUserGetMessage()
C:\build\ws\BUILDTYPE\Debug\LABEL\windows10\V\6-24\root\core\winnt\src\TWinNTSystem.cxx(498): `anonymous namespace'::GUIThreadMessageProcessingLoop()
KERNEL32!BaseThreadInitThunk()
ntdll!RtlGetAppContainerNamedObjectPath()
ntdll!RtlGetAppContainerNamedObjectPath()
================ Thread 3 ================
ntdll!ZwWaitForWorkViaWorkerFactory()
KERNEL32!BaseThreadInitThunk()
ntdll!RtlGetAppContainerNamedObjectPath()
ntdll!RtlGetAppContainerNamedObjectPath()
================ Thread 4 ================
ntdll!ZwWaitForWorkViaWorkerFactory()
KERNEL32!BaseThreadInitThunk()
ntdll!RtlGetAppContainerNamedObjectPath()
ntdll!RtlGetAppContainerNamedObjectPath()
==========================================
============= END STACKTRACE =============
==========================================
Any tips on this would be great
Thanks, Soren
Please read tips for efficient and successful posting and posting code
ROOT Version: 6.24
Platform: Windows 10
Compiler: Not Provided