How to pass argument to the function!

Hi everyone,
I was sent a code to calculate SigmaEff (a variable) but I don’t know how to pass argument to the code after doing .L SigmaEff.C so I transform it by adding two lines (11 and 12) and remove the arguments, it works but I the result is wrong so I am not sure if the way I transform it is the good one.
Can anyone have a look please to see if the way I transform it is good or just show me how to pass argument to this function. I attached the two codes FabSigmaEff.C is the original one and SigmaEff.C is the one I transformed.
Cheers
SigmaEff.C (2.16 KB)
FabSigmaEff.C (1.81 KB)

[code]double sigmaEffective(const char *fname = “data.root”,
const char *hname = “hdatamassCorr1RG”)
{
if (!fname || !(fname[0]) || !hname || !(hname[0]))
return; // just a precaution

TFile *f = TFile::Open(fname);
if (!f || f->IsZombie()) { delete f; return; } // just a precaution

TH1F *hdatamassCorr1RG;
f->GetObject(hname, hdatamassCorr1RG);
if (!hdatamassCorr1RG) { delete f; return; } // just a precaution

// …
}[/code]

Thanks Pepe for replying it’s a kind of advanced code :slight_smile: