RooRealVar and arrays

Why doesn’t this work?

RooRealVar means[5]; means[0] = RooRealVar("name","title",50,"MeV");This does:

RooGaussian gaus[5]; gaus[0] = RooGaussian("name","title",*x,mean,sigma);
The first results in a segmentation violation:

#5 0x00007f6eff092f22 in RooAbsRealLValue::inRange(double, char const*, double*) const () from /usr/lib64/root/libRooFitCore.so
#6 0x00007f6eff093004 in RooAbsRealLValue::operator=(double) () from /usr/lib64/root/libRooFitCore.so
#7 0x00007f6eff24bfe9 in ?? () from /usr/lib64/root/libRooFitCore.so

Hi,

It is because the copy-tor crashes when copying empty RooRealVar objects. Just uses arrays of pointers.
I will fix this bug, thank you for reporting this problem

Best Regards

Lorenzo

Hi,

This problem is now fixes in the ROOT master

I use root on a server I ssh to, so I’m not sure if your patch is part of the build I’m using, but now I get the following error:

root [0] using namespace RooFit; root [1] RooRealVar means[5];

RooFit v3.60 – Developed by Wouter Verkerke and David Kirkby
Copyright © 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read roofit.sourceforge.net/license.txt

*** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x00007f03ff19f65e in waitpid () from /lib64/libc.so.6
#1 0x00007f03ff131609 in do_system () from /lib64/libc.so.6
#2 0x00007f0400321e3f in TUnixSystem::StackTrace() () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCore.so
#3 0x00007f04003239bc in TUnixSystem::DispatchSignals(ESignals) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCore.so
#4
#5 0x00007f03f3e32901 in RooRealVar::RooRealVar(RooRealVar const&, char const*) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libRooFitCore.so
#6 0x00007f0400a6025f in void cling::runtime::internal::copyArray(RooRealVar*, void*, int) ()
#7 0x00007f0400a601c1 in __cling_Un1Qu32(void*) ()
#8 0x00007f03fc354ec3 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCling.so
#9 0x00007f03fc359dca in cling::Interpreter::EvaluateInternal(std::basic_string<char, std::char_traits, std::allocator > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCling.so
#10 0x00007f03fc359f23 in cling::Interpreter::process(std::basic_string<char, std::char_traits, std::allocator > const&, cling::Value*, cling::Transaction**) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCling.so
#11 0x00007f03fc3ee4f3 in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCling.so
#12 0x00007f03fc30bfa6 in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCling.so
#13 0x00007f0400234df5 in TApplication::ProcessLine(char const*, bool, int*) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCore.so
#14 0x00007f03ffe569ef in TRint::ProcessLineNr(char const*, char const*, int*) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libRint.so
#15 0x00007f03ffe56ce1 in TRint::HandleTermInput() () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libRint.so
#16 0x00007f0400323155 in TUnixSystem::CheckDescriptors() () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCore.so
#17 0x00007f04003240ea in TUnixSystem::DispatchOneEvent(bool) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCore.so
#18 0x00007f040026ddb6 in TSystem::InnerLoop() () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCore.so
#19 0x00007f040026e960 in TSystem::Run() () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCore.so
#20 0x00007f040023326f in TApplication::Run(bool) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCore.so
#21 0x00007f03ffe58197 in TRint::Run(bool) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libRint.so
#22 0x000000000040133c in main ()

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x00007f03f3e32901 in RooRealVar::RooRealVar(RooRealVar const&, char const*) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libRooFitCore.so
#6 0x00007f0400a6025f in void cling::runtime::internal::copyArray(RooRealVar*, void*, int) ()
#7 0x00007f0400a601c1 in __cling_Un1Qu32(void*) ()
#8 0x00007f03fc354ec3 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCling.so
#9 0x00007f03fc359dca in cling::Interpreter::EvaluateInternal(std::basic_string<char, std::char_traits, std::allocator > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCling.so
#10 0x00007f03fc359f23 in cling::Interpreter::process(std::basic_string<char, std::char_traits, std::allocator > const&, cling::Value*, cling::Transaction**) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCling.so
#11 0x00007f03fc3ee4f3 in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /afs/cern.ch/sw/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc48-opt/lib/libCling.so

Hi,

You are using v6.04/02 (according to the directory name in the stack trace). This definitively does not contain Lorenzo’s fix which is currently only the master (v6.07) and will likely be added to v6.06/02.

Cheers,
Philippe.