Re: Compilation problem: ROOT 5.34.00

From: Arthur E. Snyder <snyder_at_slac.stanford.edu>
Date: Tue, 12 Jun 2012 13:41:52 -0700


Hi Rooters,

I find the following weird behavior with cloned |TF1|s:

fp=makePowerLaw(); <---creates a simple power law TF1

make function: lo=1 up=10 power=2 name=powerLaw
(class TF1*)0xa0f6ad0

root [29] fp->Print()

              powerLaw :  Ndim= 1, Npar= 4, Noper= 0
  Par  0                    p0 = 1
  Par  1                    p1 = 2
  Par  2                    p2 = 1
  Par  3                    p3 = 10

root [30]

root [30] fpa=(TF1*)fp->Clone()
(class TF1*)0xa0f6968

root [32] fpa->Print()

              powerLaw :  Ndim= 1, Npar= 4, Noper= 0
  Par  0                    p0 = 1
  Par  1                    p1 = 2
  Par  2                    p2 = 1
  Par  3                    p3 = 10


root [31] fpa->Draw()
root [32]

--at this point cloned copy makes same plot as original |fp|

root [6] fpa->SetParameter(1,4)
root [7] fpa->Print()

              powerLaw :  Ndim= 1, Npar= 4, Noper= 0
  Par  0                    p0 = 1
  Par  1                    p1 = 4
  Par  2                    p2 = 1
  Par  3                    p3 = 10

--changing parameter of clone seems to work, but ..

root [8] fpa->Draw() <--- attached looks the same as fp->Draw() with p1=2!

but the plot still shows the same as above .. i.e., p1=2, not 4

If I look with debugger this:

(gdb) b 'powerLaw(double*, double*)'

Breakpoint 1 at 0x4b8feb2: file
/afs/slac.stanford.edu/u/ek/snyder/glast/root/./powerLaw.C, line 10.
(gdb) c

I find |fpa->Draw()| does not stop in the underlying c++ function |PowerLaw|.

|fp| does stop in |PowerLaw|

This is pretty strange. A clone is not a clone. It's behavior is not the same as the function i was cloned from. It seems to have somekind of copy of the curve, but no control over it.

If I try to fit with clone, it fails.

Is this a bug or a feature?

-Arthur

powerLaw:

double powerLaw(double* x,double *par) {

   double N=par[0];
   double power=par[1];
   double xp=x[0];

   double emin=par[2];
   double emax=par[3];

   if(xp<=0) return 0.0;

   double temp=1.0/TMath::Power(xp,power);

     double fIntegral=

(TMath::Power((emin),(-power+1))-TMath::Power((emax),(-power+1)))/(power-1);

   temp/=fIntegral;
   temp*=N;

   return temp;
}

A.E. Snyder, The Former Group C (TFC)        \!c*p?/
SLAC Mail Stop #95                          ((.   .))
Box 4349                                        |
Stanford, Ca, USA, 94309                      '\|/`
e-mail:snyder_at_slac.stanford.edu                 o
phone:650-926-2701                              _
http://www.slac.stanford.edu/~snyder          BaBar
FAX:707-313-0250                          Collaboration
                                                 &
                                            Fermi/GLAST



On Tue, 12 Jun 2012, Chris Jones wrote:

   [NON-Text Body part not included]

c1-log-12.684-Glast.gif
Received on Tue Jun 12 2012 - 22:42:03 CEST

This archive was generated by hypermail 2.2.0 : Tue Jun 12 2012 - 23:50:01 CEST