'RooRealVar' is ambiguous

I’m trying to run a macro and I’m getting this error

root [0]
Processing runSplot.C…

RooFit v3.60 – Developed by Wouter Verkerke and David Kirkby
Copyright © 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt

In file included from input_line_8:1:
/home/jleite/Dropbox/ntuples/runSplot.C:69:13: error: call to constructor of
’RooRealVar’ is ambiguous
RooRealVar taubkg(“taubkg” , “”, -1.93784e-003,-1,0);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jleite/root/include/RooRealVar.h:43:3: note: candidate constructor
RooRealVar(const char *name, const char *title, Double_t minValue,
^
/home/jleite/root/include/RooRealVar.h:45:3: note: candidate constructor
RooRealVar(const char *name, const char *title, Double_t value,
^
root [1]

I’m using root_v6.06 CentOS binary

Dear Juan,

this looks like a problem with sloppy use of the C++ language. If I read yout error message correctly, your constructor is called in this line:

RooRealVar taubkg("taubkg" , "", -1.93784e-003,-1,0);

The compiler tries to match this to the known constructors of RooRealVars, and did not find an excact match, and type converting constructor arguments leads to more than one possible constructor, thus the compiler cannot figure out which one you meant. The alternatives it’s talking about are:

RooRealVar(const char *name, const char *title, Double_t minValue, Double_t maxValue, const char *unit= "");
RooRealVar(const char *name, const char *title, Double_t value, Double_t minValue, Double_t maxValue, const char *unit= "") ;

As you can see, the ambiguity arises because there are two integers, -1 and 0, in your constructor call that need converting to match any of the constructors, and when you allow conversions, it’s not clear how the second integer is to be converted (to double, or interpret it as null pointer to char?).

The solution is obvious: If you mean a double constant in your code, write a double constant in your code, and not an integer one as you did above, i.e. your code should be:

RooRealVar taubkg("taubkg" , "", -1.93784e-003, -1., 0.);

(Note the decimal points after the constants, which is what makes then double literals!)

I hope these explanations help!

Cheers,

Manuel

Thank you mschille , it works !!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.