Hello all,
First, forgive my ignorance I’m going through a self-taught crash course in UNIX, C++, and ROOT all at once. I know this is a simple question, but I’ve searched the documentation and can’t seem to come across a simple answer.
I’m writing a simple “program”, just to basically introduce myself to ROOT. I would like it to define two functions. Then add those functions together, then plot those functions. This is what I have:
[code]{
gROOT->Reset();
gROOT->SetStyle(“Plain”);
TF1 f1(“func1”,“sin(x)”,0,10);
TF1 f2(“func2”,“cos(x)^2”,0,10);
//f1.Draw();
//f2.Draw(“Same”);
TF1 f3(“func3”,“f1+f2”,0,10);
f3.Draw();
}[/code]
I can’t figure out how to ask ROOT to combine functions f1 and f2 into a single function f3. Do I need to call the TF1 Class before defining f3? I basically took the “how to define” f1 and f2 straight out of the documentation, but I can’t seem to get ROOT to compile f1 and f2 into a single function. It works fine if instead of f1+f2 I put “sin(x)+cos(x)^2”… but I would like to know how to work with the defined functions within the TF class.
Thanks for your time and sorry for the low level issues.
Zach