Re: [ROOTDEV] problem with TF1 (fwd)

From: Alessio Mangiarotti <alessio_at_lipc.fis.uc.pt>
Date: Tue, 24 Nov 2009 13:01:27 +0000


Dear Rene,

  Now it works! Thank you very much for your time. Indeed I was doing something wrong. It was my fault.

Alessio.

On Tue, 24 Nov 2009, Rene Brun wrote:

> When you use the interpreter and call TF1::EvalPar you must specify the
> address of the parameters array.
> The doc says:
> // WARNING. In case of an interpreted function (fType=2), it is the
> // user's responsability to initialize the parameters via InitArgs
> // before calling this function.
> // InitArgs should be called at least once to specify the addresses
> // of the arguments x and params.
> // InitArgs should be called everytime these addresses change.
>
> I have modified your code such that it works with or without the interpreter.
> (see atatchment)
>
> Rene Brun
>
> Alessio Mangiarotti wrote:
>> Dear Rene,
>>
>> thank you very much for your patience, but this, unfortunately, did not
>> help me. I changed the code as you suggested and I still get a segmentation
>> violation. I tried this also on root 5.22/00d on SL 4.8 with gcc 4.1.2.
>>
>> This is the output of the crush:
>> *** Break *** segmentation violation
>> Using host libthread_db library "/lib64/tls/libthread_db.so.1".
>> Attaching to program: /proc/13977/exe, process 13977
>> [Thread debugging using libthread_db enabled]
>> [New Thread 182923994176 (LWP 13977)]
>> 0x000000396d590104 in waitpid () from /lib64/tls/libc.so.6
>> #1 0x000000396d539aff in do_system () from /lib64/tls/libc.so.6
>> #2 0x0000002a957e0390 in TUnixSystem::StackTrace () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #3 0x0000002a957de0e3 in TUnixSystem::DispatchSignals () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #4 <signal handler called>
>> #5 0x0000002a960968ae in G__LD_P10_double () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #6 0x0000002a95f99cd0 in G__exec_asm () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #7 0x0000002a95fa01fa in G__exec_bytecode () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #8 0x0000002a9601f836 in G__interpret_func () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #9 0x0000002a95fbd3aa in Cint::G__CallFunc::ExecInterpretedFunc ()
>> from /usr/local/root/root/lib/libCint.so.5.22
>> #10 0x0000002a95fbd596 in Cint::G__CallFunc::Execute () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #11 0x0000002a957c4951 in TCint::CallFunc_ExecDouble () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #12 0x0000002a957b2294 in TMethodCall::Execute () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #13 0x0000002a983ec3c1 in TF1::EvalPar () from
>> /usr/local/root/root/lib/libHist.so
>> #14 0x0000002a985f51fa in G__G__Hist_199_0_36 () from
>> /usr/local/root/root/lib/libHist.so
>> #15 0x0000002a95f8658f in Cint::G__ExceptionWrapper () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #16 0x0000002a9604c650 in G__execute_call () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #17 0x0000002a9604d669 in G__call_cppfunc () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #18 0x0000002a960203ab in G__interpret_func () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #19 0x0000002a9600f1a6 in G__getfunction () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #20 0x0000002a9611eb69 in G__getstructmem () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #21 0x0000002a9611493b in G__getvariable () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #22 0x0000002a95fde31a in G__getitem () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #23 0x0000002a95fe90d2 in G__getexpr () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #24 0x0000002a95feb241 in G__getexpr () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #25 0x0000002a9607a45c in G__exec_statement () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #26 0x0000002a960220b4 in G__interpret_func () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #27 0x0000002a9600d3b0 in G__getfunction () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #28 0x0000002a95fde47d in G__getitem () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #29 0x0000002a95fe90d2 in G__getexpr () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #30 0x0000002a96082319 in G__exec_statement () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #31 0x0000002a95fc7514 in G__exec_tempfile_core () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #32 0x0000002a95fc77ee in G__exec_tempfile_fp () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #33 0x0000002a9608d505 in G__process_cmd () from
>> /usr/local/root/root/lib/libCint.so.5.22
>> #34 0x0000002a957c8261 in TCint::ProcessLine () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #35 0x0000002a956e4305 in TApplication::ProcessLine () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #36 0x0000002a96f9cb78 in TRint::HandleTermInput () from
>> /usr/local/root/root/lib/libRint.so.5.22
>> #37 0x0000002a96f9ac77 in TTermInputHandler::Notify () from
>> /usr/local/root/root/lib/libRint.so.5.22
>> #38 0x0000002a96f9d4fd in TTermInputHandler::ReadNotify () from
>> /usr/local/root/root/lib/libRint.so.5.22
>> #39 0x0000002a957ddd05 in TUnixSystem::CheckDescriptors () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #40 0x0000002a957de25b in TUnixSystem::DispatchOneEvent () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #41 0x0000002a9574ab55 in TSystem::InnerLoop () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #42 0x0000002a9574dcb1 in TSystem::Run () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #43 0x0000002a956e28df in TApplication::Run () from
>> /usr/local/root/root/lib/libCore.so.5.22
>> #44 0x0000002a96f9d0b4 in TRint::Run () from
>> /usr/local/root/root/lib/libRint.so.5.22
>> #45 0x000000000040109d in main ()
>>
>>
>> Maybe I am doing something trivially stupid, but I can not see it.
>>
>> My problem of sending messages to the roottalk list has been solved
>> (thanks to Fons Rademakers), so I think it is more appropriate to switch
>> these emails to the general roottalk mailing list.
>>
>> Alessio.
>>
>>
>> On Mon, 23 Nov 2009, Rene Brun wrote:
>>
>>> You have an error in your C++ code. Replace your function by:
>>>
>>> Double_t myfunction(Double_t *x, Double_t *par)
>>> {
>>> Float_t xx =x[0];
>>> Double_t f;
>>> if (xx!=0.) {
>>> f = TMath::Abs(par[0]*TMath::Sin(par[1]*xx)/xx);
>>> } else {
>>> f =0.;
>>> }
>>> return f;
>>> }
>>>
>>>
>>> Rene
>>>
>>> Alessio Mangiarotti wrote:
>>>> Dear root developers,
>>>>
>>>> I am sorry to generate spam on this other address, but my messages can
>>>> not get to the roottalk list (I am a subscribed user). Am I doing
>>>> something wrong or it is just a miss-configuration of some filter?
>>>>
>>>> Regards,
>>>> Alessio Mangiarotti.
>>>>
>>>>
>>>>
>>>> ---------- Forwarded message ----------
>>>> Date: Fri, 20 Nov 2009 03:11:40 +0000 (WET)
>>>> From: Alessio Mangiarotti <alessio_at_lipc.fis.uc.pt>
>>>> To: roottalk_at_root.cern.ch
>>>> Cc: Alessio Mangiarotti <alessio_at_lipc.fis.uc.pt>
>>>> Subject: problem with TF1 (fwd)
>>>>
>>>>
>>>> It seems it did not get trough, for some reasons. I attach here the gdb
>>>> output as requested on the site.
>>>>
>>>> I hope it gets trough now,
>>>> Regards,
>>>> Alessio Mangiarotti.
>>>>
>>>>
>>>> ---------- Forwarded message ----------
>>>> Date: Thu, 19 Nov 2009 01:33:55 +0000 (WET)
>>>> From: Alessio Mangiarotti <alessio_at_lipc.fis.uc.pt>
>>>> To: roottalk_at_root.cern.ch
>>>> Cc: Alessio Mangiarotti <alessio_at_lipc.fis.uc.pt>
>>>> Subject: problem with TF1
>>>>
>>>> Dear rooters,
>>>>
>>>> I am experiencing a strange problem with TF1. In essence, I would like
>>>> to calculate a function for given values of the argument and the
>>>> parameters. I would also like to plot the function. However when I use
>>>> ->EvalPar() on a c function I defined, root crashes. I reproduced the
>>>> problem in a much simpler macro I attach here. If the function is defined
>>>> with an in line expression in TF1 root does not crashes. I am using root
>>>> version 5.24/00b on ubuntu 6.10 (gcc 4.4.1-4). Maybe I am doing something
>>>> stupid, but I can not see it!
>>>>
>>>> To reproduce the problem just type:
>>>> .L tf1_problem.C
>>>> tf1_problem();
>>>>
>>>>
>>>> I would appreciate any help.
>>>> Best Regards,
>>>> Alessio Mangiarotti.
>>>
>>>
>>
>
>
Received on Tue Nov 24 2009 - 14:01:38 CET

This archive was generated by hypermail 2.2.0 : Tue Nov 24 2009 - 17:50:04 CET