A couple of questions about RooRealVars (RooFit)

From: James Patrick Burke <phjpb_at_slac.stanford.edu>
Date: Mon, 4 Oct 2010 18:18:01 -0700

ROOT version: 5.26/00
Machine: MacBook (intel), Mac OS X (10.5.8)

Dear fellow ROOT and RooFit users,

  1. Could anybody explain why the RooRealVar methods setRange and setVal cause a crash when my RooRealVar object is instantiated with the default constructor, but not when it's instantiated with other constructors?

E.g.:

root [0] RooRealVar a("a","a",0.5,0.0,1.0);

root [1] a.setRange(0.1,0.9);
root [2] a.setVal(0.6);
root [3] RooRealVar b;
root [4] b.SetNameTitle("b","b");
root [5] b.setRange(0.1,0.9);

Is there a way around this?

2. Does an instance of a derived RooAbsPdf class (e.g. RooGaussian), have to have in scope the RooRealVars with which it was created (the floated parameters, not the variable to which we're fitting) when performing a fit. I get a crash when they're not in scope, but not when they are (see test.C below (also attached)):

root [0] .x test.C

RooFit v3.12 -- Developed by Wouter Verkerke and David Kirkby

                 Copyright (C) 2000-2009 NIKHEF, University of California & 
Stanford University
                 All rights reserved, please read 
http://roofit.sourceforge.net/license.txt

[#1] INFO:Eval -- RooAbsReal::attachToTree(numDegDaysBranch) TTree Float_t branch numDegDaysBranch will be converted to double precision [#0] ERROR:LinkStateMgmt -- RooAbsArg::recursiveCheckObservables(pdf): ERROR: one or more servers of node pdf no longer exists! --- RooAbsArg ---

   Value State: DIRTY
   Shape State: DIRTY
   Attributes: [ServerDied,ServerDied:a(1885600),ServerDied:b(1885a00)]

   Address: 0x1888200
   Clients:
   Servers:
     (0x1873c00,V-) RooRealVar::numDegDaysBranch "numDegDaysBranch"
   Proxies:
     x -> numDegDaysBranch

  *** Break *** segmentation violation
     mean ->


===========================================================
There was a crash (#4 0x0092e8e8 in SigHandler ()). This is the entire stack trace of all threads:

Thread 1 (process 6056 thread 0x10b):
#0 0x94dc8189 in wait4 ()
#1 0x94dc5cd4 in system$UNIX2003 ()
#2 0x00930872 in TUnixSystem::StackTrace ()
#3 0x0092e775 in TUnixSystem::DispatchSignals ()
#4 0x0092e8e8 in SigHandler ()
#5 <signal handler called>
#6 0x02fafbff in RooAbsArg::printMultiline ()
#7 0x02fe4682 in RooAbsReal::printMultiline ()
#8 0x02fda6c2 in RooAbsPdf::printMultiline ()
#9 0x030d3cb4 in RooPrintable::printStream ()
#10 0x02fab890 in RooAbsArg::Print ()
#11 0x02fb0fdf in RooAbsArg::recursiveCheckObservables ()
#12 0x02fd387d in RooAbsOptTestStatistic::RooAbsOptTestStatistic ()
#13 0x030c0a0b in RooNLLVar::RooNLLVar ()
#14 0x02fda3fa in RooAbsPdf::createNLL ()
#15 0x02fde612 in RooAbsPdf::fitTo ()
#16 0x02fd84bc in RooAbsPdf::fitTo ()
#17 0x031b8c2f in G__G__RooFitCore1_241_0_26 ()
#18 0x010bd6d2 in Cint::G__ExceptionWrapper ()
#19 0x01192271 in G__execute_call ()
#20 0x0119273d in G__call_cppfunc ()
#21 0x0116641b in G__interpret_func ()
#22 0x01154062 in G__getfunction ()
#23 0x0126b3db in G__getstructmem ()
#24 0x0126176c in G__getvariable ()
#25 0x0111df81 in G__getitem ()
#26 0x01120464 in G__getexpr ()
#27 0x011cad57 in G__exec_statement ()
#28 0x011685fc in G__interpret_func ()
#29 0x01153e9e in G__getfunction ()
#30 0x0111e0c4 in G__getitem ()
#31 0x01120464 in G__getexpr ()
#32 0x01132939 in G__calc_internal ()
#33 0x011dbf3e in G__process_cmd ()
#34 0x00917044 in TCint::ProcessLine ()
#35 0x00915d9f in TCint::ProcessLineSynch ()
#36 0x0085c135 in TApplication::ExecuteFile ()
#37 0x0085ad2d in TApplication::ProcessLine ()
#38 0x000307a1 in TRint::HandleTermInput ()
#39 0x0002fd40 in TTermInputHandler::Notify ()
#40 0x00032124 in TTermInputHandler::ReadNotify ()
#41 0x0092ea80 in TUnixSystem::CheckDescriptors ()
#42 0x0092f1ab in TUnixSystem::DispatchOneEvent ()
#43 0x008adf60 in TSystem::InnerLoop ()
#44 0x008b030b in TSystem::Run ()
#45 0x00858613 in TApplication::Run ()
#46 0x000310ee in TRint::Run ()
#47 0x00001bae 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 http://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.



#6 0x02fafbff in RooAbsArg::printMultiline ()
#7 0x02fe4682 in RooAbsReal::printMultiline ()
#8 0x02fda6c2 in RooAbsPdf::printMultiline ()
#9 0x030d3cb4 in RooPrintable::printStream ()
#10 0x02fab890 in RooAbsArg::Print ()
#11 0x02fb0fdf in RooAbsArg::recursiveCheckObservables ()
#12 0x02fd387d in RooAbsOptTestStatistic::RooAbsOptTestStatistic ()
#13 0x030c0a0b in RooNLLVar::RooNLLVar ()
#14 0x02fda3fa in RooAbsPdf::createNLL ()
#15 0x02fde612 in RooAbsPdf::fitTo ()
#16 0x02fd84bc in RooAbsPdf::fitTo ()

Root > Function test() busy flag cleared

    ---//---

Here's test.C:

RooDataSet* GetData(RooRealVar &x)
{

   TFile *rootFile = new TFile("test.root","READ");    TTree *tree = (TTree*)rootFile->Get("tree");    RooDataSet *data = new RooDataSet("data","data",tree,RooArgSet(x));    delete rootFile;
   rootFile = 0;
   return data;
}

void DeleteData(RooDataSet *data)
{

   delete data;
   data = 0;
}

RooAbsPdf* GetPdf(RooRealVar &x)
{

   RooRealVar a("a","a",450.,250.,650.);    RooRealVar b("b","b",125.,50.,200.);
   RooAbsPdf *pdf = new RooGaussian("pdf","pdf",x,a,b);    return pdf;
}

void DeletePdf(RooAbsPdf *pdf)
{

   delete pdf;
   pdf = 0;
}

void test()
{

   RooRealVar x("numDegDaysBranch","numDegDaysBranch",190.,785.);    RooAbsPdf *pdf = GetPdf(x);

   ////////// If I move the following block of code into GetPdf(), above, it works //////////    RooDataSet *data = GetData(x);

   pdf->fitTo(*data);                                 // Crashes at this line, when in test()
   RooPlot *xframe = x.frame();
   data->plotOn(xframe);
   pdf->plotOn(xframe);
   xframe->Draw();
   //////////////////////////////////////////////////////////////////////////////////////////

   DeletePdf(pdf);
   DeleteData(data);
}

Many thanks,

Jim Burke.

Received on Tue Oct 05 2010 - 03:18:11 CEST

This archive was generated by hypermail 2.2.0 : Tue Oct 05 2010 - 17:50:01 CEST