Re: [ROOT] untegrating funtions CINT problem

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Aug 30 2001 - 23:24:11 MEST


Hi Matthieu,

I can reproduce your problem. This is a CINT optimisation problem.
I am forwarding the problem to Masa.

You have two ways to circumvent the problem:
 1- run with CINT optimisation 0
   root > .O0
   root > .L jitter.C
   root > PlotMissingTriggers(7, 2, 5)

 2- run with ACLIC
   Add "include "TF1.h" at the beginning of your file, then do:
   root > .L jitter.C+
   root > PlotMissingTriggers(7, 2, 5)

Note that you had a typing mistake in your original function. The line
 Double_t dResult = c_dNormalize * TMath::Exp(-dX * dX / (2. * dSigma *
should be (I think)
 Double_t dResult = dNormalize * TMath::Exp(-dX * dX / (2. * dSigma *


Rene Brun


On Thu, 30 Aug 2001, Matthieu Guillo wrote:

> Hello Rooters,
> 
> I wrote a small script to draw a function (the function is a integral of
> an other function) based on the example found in
> $ROOTSYS/tutorials/FitDemo.C. Here is the script:
> 
> 
> Double_t jitter(Double_t* x, Double_t* par)
> {
>   Double_t dSigma = par[0];
>   Double_t dX = x[0];
> 
>   Double_t dNormalize = 1. / TMath::Sqrt(2. * TMath::Pi()) / dSigma;
> 
>   Double_t dResult = c_dNormalize * TMath::Exp(-dX * dX / (2. * dSigma *
> dSigma)); 
>   
>   return (dResult);
> }
> 
> Double_t missTrigg(Double_t* x, Double_t* par)
> {
> 
>   Double_t dSigma = x[0];
>   Double_t dTaggerGate = par[0];
>   Double_t dSTGate = par[1];
> 
>   Double_t dLimInf = (dSTGate + dTaggerGate) / 2.;
>   Double_t dLimSup = 50.;
> 
>   TF1 *f2 = new TF1("f2", jitter, dLimInf, dLimSup, 1);
>   
>   Double_t dResult = f2->Integral(dLimInf, dLimSup, &dSigma);
>   
>   return (dResult);
> }
> 
> void PlotMissingTriggers(Double_t dTaggerGate, Double_t dSTGate, Double_t
> dSigma)
> {
>   
>   Float_t fMin = 0., fMax = 3. * (dTaggerGate + dSTGate) / 2.;
>   TF1 *f1 = new TF1("f1", missTrigg, fMin, fMax, 2);
>   f1->SetParameters(dTaggerGate, dSTGate);
>   
>   f1->SetLineWidth(2);
>   f1->SetLineColor(4);
>   f1->Draw();
> } 
> 
> 
> This script is in a file called jitter.C. After stating ROOT I type:
> .L jitter.C
> PlotMissingTriggers(7, 2, 5);
> 
> And I receive a bunch of identical mesages (one for each loop in the
> Integral method I guess): 
> 
> Function:f2 cannot be compiled
> 
> What am I doing wrong? I would appreciate any help.
> 
> 
> 
> Matthieu Guillo
> University of South Carolina
> Thomas Jefferson National Laboratory
> Office 71 trailer 16
> Phone: 757-269-5551
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:59 MET