Re: [ROOT] DrawClone("same")

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sun Feb 25 2001 - 09:10:14 MET


Hi Severino,
The DrawClone method does not work for TF1 interpreted
or compiled functions. DrawClone uses internally the Clone function.
Clone copies only the persistent data members of the class.
The interpreted (or compiled code) cannot be persistent.
I will investigate how to bypass this problem when the I/O
is within the same session in memory.
Meanwhile, you can use the function DrawCopy instead.
I have modified your example below to draw your function
with two different sets of parameters.

Rene Brun

Double_t lennarj(Double_t *x,Double_t *par)
{
    Double_t potenziale=0;
    Double_t xval=x[0];
    Double_t energ=par[1];
    Double_t rz=par[2];
    potenziale=energ*((pow(rz/xval,12))-(pow(rz/xval,6)));
    return potenziale;
}

void surface(){

TCanvas *surf=new TCanvas("surf",0);
TH2F *bg=new TH2F("bg","Potenziale di
fisiassorbimento",100,0.3,7,100,-10,20);
TF1 *fis=new TF1("lennarj",lennarj,0.3,7,3);

fis->SetParameter(1,8.6);
fis->SetParameter(2,4);
bg->Draw();
fis->DrawCopy("same");
//fis->DrawClone("same");
fis->SetParameter(2,3);
fis->Draw("same");
}


On Sun, 25 Feb 2001, Severino Tessarin wrote:

> Dear Rooters,
> 
> The method DrawClone("same") work for a TF1?
> If Yes why this macro draw correcty the function but the clone is only a line 
> meaningless.
> 
> 
> Double_t lennarj(Double_t *x,Double_t *par)
> {
>     Double_t potenziale=0;
>     Double_t xval=x[0];
>     Double_t energ=par[1];
>     Double_t rz=par[2];
>     potenziale=energ*((pow(rz/xval,12))-(pow(rz/xval,6)));
>     return potenziale;
> }
> 
> void surface(){
> 
> TCanvas *surf=new TCanvas("surf",0);
> TH2F *bg=new TH2F("bg","Potenziale di fisiassorbimento",100,0.3,7,100,-10,20);
> TF1 *fis=new TF1("lennarj",lennarj,0.3,7,3);
> 
> fis->SetParameter(1,8.6);
> fis->SetParameter(2,4);
> bg->Draw();
> fis->Draw("same");
> fis->DrawClone("same");
> 
>  return;
> 
> }
> 
> O.S Linux Suse 7.0
> V.R. root 3.00/05 own compiled(*).
> Seve
> 
> (*)Let me  say thanks to Fons. & other for the suggestions  about compiling
> root on Suse 7.0
> 



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