Beispiel #1
0
def Link(*args, **kwargs):
    # Redefinition of `Link` for keyword arguments and converting python dict to std::map.
    # The keywords must correspond to the CmdArg of the `Link` function.
    # The instances in the dict must correspond to the template argument in std::map of the `Link` function.
    from cppyy.gbl import RooFit

    if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], dict):
        args = list(args)
        args[0] = _dict_to_std_map(args[0], {"std::string": "RooAbsData*"})
        return RooFit._Import(args[0])

    return RooFit._Link(*args, **kwargs)
Beispiel #2
0
def Slice(*args, **kwargs):
    r"""The Slice function is pythonized for converting python dict to std::map.
    The keywords must correspond to the CmdArg of the function.
    The instances in the dict must correspond to the template argument in std::map of the function.
    """
    # Redefinition of `Slice` for keyword arguments and converting python dict to std::map.
    from cppyy.gbl import RooFit

    if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], dict):
        args = list(args)
        args[0] = _dict_to_std_map(args[0], {"RooCategory*": "std::string"})
        return RooFit._Slice(args[0])

    return RooFit._Slice(*args, **kwargs)
Beispiel #3
0
def Import(*args, **kwargs):
    """The Import function is pythonized for converting python dict to std::map.
    The keywords must correspond to the CmdArg of the function.
    The instances in the dict must correspond to the template argument in std::map of the function.
    """
    # Redefinition of `Import` for keyword arguments and converting python dict to std::map.
    from cppyy.gbl import RooFit

    if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], dict):
        args = list(args)
        args[0] = _dict_to_std_map(args[0], {"std::string": ["TH1*", "RooDataHist*", "RooDataSet*"]})
        return RooFit._Import(args[0])

    return RooFit._Import(*args, **kwargs)
Beispiel #4
0
def MultiArg(*args, **kwargs):
    # Redefinition of `MultiArg` for keyword arguments.
    # The keywords must correspond to the CmdArg of the `MultiArg` function.
    from cppyy.gbl import RooFit

    args, kwargs = _kwargs_to_roocmdargs(*args, **kwargs)
    return RooFit._MultiArg(*args, **kwargs)
Beispiel #5
0
def Frame(*args, **kwargs):
    r"""The Frame() function is pythonized with the command argument pythonization.
    The keywords must correspond to the CmdArg of the function.
    """
    # Redefinition of `Frame` for keyword arguments.
    from cppyy.gbl import RooFit

    args, kwargs = _kwargs_to_roocmdargs(*args, **kwargs)
    return RooFit._Frame(*args, **kwargs)
Beispiel #6
0
def YVar(*args, **kwargs):
    # Redefinition of `YVar` for keyword arguments.
    # The keywords must correspond to the CmdArg of the `YVar` function.
    from cppyy.gbl import RooFit

    if "var" in kwargs:
        args = (kwargs["var"], ) + args
        del kwargs["var"]
    args, kwargs = _kwargs_to_roocmdargs(*args, **kwargs)
    return RooFit._YVar(*args, **kwargs)
Beispiel #7
0
def Format(*args, **kwargs):
    # Redefinition of `Format` for keyword arguments.
    # The keywords must correspond to the CmdArg of the `Format` function.
    from cppyy.gbl import RooFit

    if "what" in kwargs:
        args = (kwargs["what"], ) + args
        del kwargs["what"]
    args, kwargs = _kwargs_to_roocmdargs(*args, **kwargs)
    return RooFit._Format(*args, **kwargs)
Beispiel #8
0
def Format(*args, **kwargs):
    r"""The Format() function is pythonized with the command argument pythonization.
    The keywords must correspond to the CmdArg of the function.
    """
    # Redefinition of `Format` for keyword arguments.
    from cppyy.gbl import RooFit

    if "what" in kwargs:
        args = (kwargs["what"], ) + args
        del kwargs["what"]
    args, kwargs = _kwargs_to_roocmdargs(*args, **kwargs)
    return RooFit._Format(*args, **kwargs)
Beispiel #9
0
def ZVar(*args, **kwargs):
    """The ZVar() function is pythonized with the command argument pythonization.
    The keywords must correspond to the CmdArg of the function.
    """
    # Redefinition of `ZVar` for keyword arguments.
    from cppyy.gbl import RooFit

    if "var" in kwargs:
        args = (kwargs["var"],) + args
        del kwargs["var"]
    args, kwargs = _kwargs_to_roocmdargs(*args, **kwargs)
    return RooFit._ZVar(*args, **kwargs)
Beispiel #10
0
def LineColor(color):
    r"""The `color` argument doesn't necessarily have to be a ROOT color enum value, like `ROOT.kRed`.
    Here is what you can also do in PyROOT:

      1. Pass a string with the enum value name instead, e.g.:
    ~~~ {.py}
    pdf.plotOn(frame, LineColor="kRed")
    ~~~
      2. Pass a string with the corresponding single-character color code following the matplotlib convention:
    ~~~ {.py}
    pdf.plotOn(frame, LineColor="r")
    ~~~
      3. Pass a string with the enum value name instead followed by some manipulation of the enum value:
    ~~~ {.py}
    pdf.plotOn(frame, LineColor="kRed+1")
    ~~~
    """
    from cppyy.gbl import RooFit

    return RooFit._LineColor(_string_to_root_attribute(color, _color_map))
Beispiel #11
0
def DataError(etype):
    r"""Instead of passing an enum value to this function, you can pass a
    string with the name of that enum value, for example:

    ~~~ {.py}
        data.plotOn(frame, DataError="SumW2")
        # instead of DataError=ROOT.RooAbsData.SumW2
    ~~~

    If you want to use the `"None"` enum value to disable error plotting, you
    can also pass `None` directly instead of passing a string:

    ~~~ {.py}
        data.plotOn(frame, DataError=None)
        # instead of DataError="None"
    ~~~
    """
    # Redefinition of `DataError` to also accept `str` or `NoneType` to get the
    # corresponding enum values from RooAbsData.DataError.
    from cppyy.gbl import RooFit

    # One of the possible enum values is "None", and we want the user to be
    # able to pass None also as a NoneType for convenience.
    if etype is None:
        etype = "None"

    if isinstance(etype, str):
        try:
            import ROOT
            etype = getattr(ROOT.RooAbsData.ErrorType, etype)
        except AttributeError as error:
            raise ValueError(
                'Unsupported error type type passed to DataError().' +
                ' Supported decay types are : "Poisson", "SumW2", "Auto", "Expected", and None.'
            )
        except Exception as exception:
            raise exception

    return RooFit._DataError(etype)
Beispiel #12
0
def MarkerStyle(style):
    # Redefinition of `MarkerStyle` for matplotlib conventions and string arguments.
    from cppyy.gbl import RooFit

    return RooFit._MarkerStyle(_string_to_root_attribute(style, {}))
Beispiel #13
0
def LineStyle(style):
    # Redefinition of `LineStyle` for matplotlib conventions and string arguments.
    from cppyy.gbl import RooFit

    return RooFit._LineStyle(_string_to_root_attribute(style, _style_map))
Beispiel #14
0
def MarkerColor(color):
    # Redefinition of `MarkerColor` for matplotlib conventions and string arguments.
    from cppyy.gbl import RooFit

    return RooFit._MarkerColor(_string_to_root_attribute(color, _color_map))