Hi Guys
I have this problem, I am tying to define a function that is based on the values of previous array, one for x, and one for y = f(x). I’m using pyroot. I have defined my function trhough a c++ string
cpp_code = '''
// Template Mixing definition
double StepFunction(double x, double bins[], double Counts[], int arraysize){
int index =0 ;
for(int i = 0; i < arraysize; i++){
if(x >= bins[i]){
index = i;
}
}
return Counts[index];
}
'''
ROOT.gInterpreter.ProcessLine(cpp_code)
This function takes x, the arrays and an int value. I am able to call this function with ROOT.StepFunction.
What I want to do is to define a TF1 function based on this StepFunction, using two arrays that I have. I have tried something like
WallAnnihilation = ROOT.TF1("WallAnnihilation", "[0]*StepFunction(x, arr1, arr2, 30)",0,4)
But at this point I receive an error because arr1 and arr2 are not “seen” by the program.
Thank you for your help
But
ROOT Version: 6.26/10
Platform: Ubuntu
Compiler: Not Provided