Yes.
I’ve got it but it was empty and I’ve found that the empty rootlogon.C causes that error message.
I’ve deleted rootlogon.C and the message has disappeared.

I have tried with the master (on Mac). An empty rootlogon.C. gives me:

$ ls rootlogon.C
ls: rootlogon.C: No such file or directory
$ touch rootlogon.C
$ root
----------------------------------------------------------------
| Welcome to ROOT 6.07/07 http://root.cern.ch |
| (c) 1995-2016, The ROOT Team |
| Built for macosx64 |
| From heads/master@v6-07-06-819-gb25ae13, Jul 07 2016, 14:58:03 |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
----------------------------------------------------------------
warning: cannot find function 'rootlogon()'; falling back to .L
root [0]

Hello , I am new here. I was trying to plot momentum § vs beta (B), it says Error in TF1::TF1: can not find any function at the address 0x11fc7d8. This function requested for lin. I cannot fix it , can any one help me please.
here is my code.

#include "TF1.h"
#include "TCanvas.h"
#include "TMath.h"
void momentumplot()
{
double m=1.008, B, p;
TCanvas* myplot = new TCanvas("myplot","", 600,600);
double B = p/(TMath::Sqrt(p*p+m*m));
TF1* mom = new TF1("mom", "B",0,1,100);
//B = p/(Sqtr(p*P+m*M));
mom->Draw();
mom->Print();
mom->Fill();
mom->SetTitle("Plot of Beta(B) vs P");
}
…
thanks in Advance.

[quote=“Pepe Le Pew”]{
// https://root.cern.ch/doc/master/classTF1.html
TF1 *mom = new TF1("mom", "x/TMath::Sqrt(x*x+[0]*[0])", 0, 1);
mom->SetParName(0, "m");
mom->SetParameter(0, 1.008);
mom->Draw();
}[/quote]
Thanks Pepe,
this gives the output. I was wondering why it doesn’t work when I place ‘m’ and give its value at the begining.
here you define m as [0] and set at last right.
Also when i tried b = x/TMath::Sqrt(xx+[0][0]), inside it doesn’t give any plot and just draw the canvas. I was wondering is this 2-D plot. Actually I want to plot b with x. how can I do that
?
Thank you again.

Hello I wanted to plot I = sin^2(theta)/(1-betacos(theta)), where cos(theta) = (sqrt(1+24beta^2)-1)/(4beta), and beta is given as 0, 0.2, 0.9. here is the code I have written. This code doesn’t work. can anyone help me please.
Thanks in advance.
void filename()
{
TCanvas plot = new TCanvas(“plot”, “”, 600,600);
Double_t B = 0.2;
Double_t phi = (TMath::Sqrt(1+24BB)-1)/(4B);
theta = TMath::ACos(phi);
//TF1 f1 = new TF1(“f1”,“TMath::Sin(theta)TMath::Sin(theta)/(1-BTMath::Cos(theta))”);
Double_t x = TMath::Sin(theta)TMath::Sin(theta)/(1-BTMath::Cos(theta));
Draw(“x”);
}

Thanks Pepe,
I am still confused, I went through all those TF1 files. I need to calculate x first and then use it on the equation and need to plot it.I have different values of B. Here is the code I used , it gives output but is different than it should be.
my question is can we use x in the function defined this way?
Thanks again.
{
TCanvas* plot = new TCanvas(“plot”, “”, 600,600);
Double_t B = 0.2;
Double_t phi = (TMath::Sqrt(1+24BB)-1)/(4B);
Double_t x = TMath::ACos(phi);
//TF1 f1 = new TF1(“f1”,“TMath::Sin(theta)TMath::Sin(theta)/(1-BTMath::Cos(theta))”);
//Double_t x = TMath::Sin(th)TMath::Sin(th)/(1-BTMath::Cos(th));
TF1* f1 = new TF1(“f1”,“TMath::Sin(x)*TMath::Sin(x)/(1-[0]*TMath::Cos(x))”,0,10);
f1->SetParameter(0,0.2);
f1->Draw();
}

Thanks Pepe,
I still did not get any output and I was wondering why did you return … return (1.-phiphi)/(1.-Bphi); This time I did not get the error message but it doesn’t show any output. Again here is my code. #include “TMath.h” #include "TF1.h"
void momentumplotcorrect()
{
Double_t myFucntion(Double_t *x, Double_t y)
{
Double_t B = x[0]; //I did not understand this line also, would you mind to explain.
Double_t phi = ((TMath::Sqrt(1.+24.BB)-1.)/(4.B):0.0);
return (1.-phiphi)/(1.-Bphi);
}
void momentumplotcorrect(void)
{
Double_t y = TMath::ACos(phi);

TF1*f1 = new TF1(“f1”, “TMath::Sin(y)*TMath::Sin(y)/(1-[0]*TMath::Cos(y))”, 0.0,1.0,0);
f1->Draw();
f1->Print();
}
}
//here y act as theta in the original equation.
I am really sorry for these simple question, I am new in root. I really appreciate your help.
Thanks again.

Copy the whole example source code from my previous post in this thread (without any modifications) into a new file called “filename.cxx”, then start ROOT and then execute:
root [0] .x filename.cxx

BTW. // the conditional ?: (ternary) operator used like this
phi = (B ? (TMath::Sqrt(1.+24.*B*B)-1.)/(4.*B) : 0.0);
// is equivalent to
if (B != 0.0) {phi = (TMath::Sqrt(1.+24.*B*B)-1.)/(4.*B);} else {phi = 0.0;}

Hello all,
I am having trouble to plot date on my data file in root. Is there any best way to do this? I have attached my data shell below. I want to plot first column vs second , second vs four and so on. If I can get idea to plot any two column then I can do rest.
Thanks in advance. maindata.txt (1.46 KB)