# SetFcn

**URL:** <https://root-forum.cern.ch/t/setfcn/12998>\
**Category:** ROOT\
**Created:** [August 29, 2011, 9:10am UTC](https://root-forum.cern.ch/t/setfcn/12998 "2011-08-29T09:10:18Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![LeWhoo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/e8c25b/32.png) [@LeWhoo](https://root-forum.cern.ch/u/LeWhoo)\
**Post date:** [August 29, 2011, 9:10am UTC](https://root-forum.cern.ch/t/setfcn/12998/1 "2011-08-29T09:10:18Z")

</div>

Is it possible to call SetFCN in PyROOT with python function as a parameter? In my code I have

```auto
TVirtualFitter.Fitter(g).SetFCN(twoPartParabFCN)
```

where g is a TGraph and twoPartParabFCN starts as:

```auto
def twoPartParabFCN(nPar, grad, fval, par, iflag):
```

but I receive the following error:

> [@](#):
>
> Traceback (most recent call last):  
> File “./frame\_offset”, line 73, in   
> TVirtualFitter.Fitter(g).SetFCN(twoPartParabFCN)  
> TypeError: none of the 2 overloaded methods succeeded. Full details:  
> void TFitter::SetFCN(void\* fcn) =\>  
> could not convert argument 1  
> void TFitter::SetFCN(void (_)(Int\_t&, Double\_t_, Double\_t&f, Double\_t\*, Int\_t) fcn) =\>  
> could not convert argument 1 (void/unknown arguments can’t be set)

Any help appreciated 🙂

---

_[View the full topic](https://root-forum.cern.ch/t/setfcn/12998)._
