How to sum many TF1 functions

I have two or more TF1 functions, and I want to create a new TF1 function that is the sum of the previous functions. How can I do that without defining every time, manually, the TF1-sum function?
I ask for that because in my code there is a cycle in which the number of functions I have to sum changes every time.

Thanks.
Carlo

Hi,
see the attached example in C++ (you need to compile it directly or with ACLIC)

Lorenzo
SumTF1.C (608 Bytes)

1 Like

After compiling with ACLIC, executing the script the interpreter shows me the following error:

Error: Symbol null is not defined in current scope  :0:

Thanks
Carlo

to run this, you have to do:

.L SumTF1.C+
main()

or rename the main() function to SumTF1()