I know this is a really old topic, but I have not found a solution (using TF1) in any search, so I am posting here what worked for me.
You can use TMath::Sign function to make the TF1 as the following:
TF1 *myHeavi = new TF1(“myHeavi”,“(1+TMath::Sign(1,x))/2”,-20,20)
And if you want the half-maximum as parameter, you can simply do:
TF1 *myHeavi = new TF1(“myHeavi”,“(1+TMath::Sign(1,x - [0]))/2”,-20,20)
Here is the link for a good explanation of the Sign function:
I hope it helps, if there is a simpler solution please let me know.
Cheers