Пример #1
0
    def __init__(self,
                 name,
                 id,
                 xsecs=None,
                 processes=None,
                 color=None,
                 label=None,
                 label_short=None,
                 is_data=False,
                 tags=None,
                 aux=None,
                 context=None):
        UniqueObject.__init__(self, name, id, context=context)
        CopyMixin.__init__(self)
        AuxDataMixin.__init__(self, aux=aux)
        TagMixin.__init__(self, tags=tags)
        DataSourceMixin.__init__(self, is_data=is_data)
        LabelMixin.__init__(self, label=label, label_short=label_short)
        ColorMixin.__init__(self, color=color)

        # instance members
        self._xsecs = {}

        # set initial values
        if xsecs is not None:
            self.xsecs = xsecs

        # set initial child processes
        if processes is not None:
            self.extend_processes(processes)
Пример #2
0
    def __init__(self,
                 name,
                 id=UniqueObject.AUTO_ID,
                 channel=None,
                 categories=None,
                 label=None,
                 label_short=None,
                 selection=None,
                 selection_mode=None,
                 tags=None,
                 aux=None,
                 context=None):
        UniqueObject.__init__(self, name, id, context=context)
        CopyMixin.__init__(self)
        AuxDataMixin.__init__(self, aux=aux)
        TagMixin.__init__(self, tags=tags)
        SelectionMixin.__init__(self,
                                selection=selection,
                                selection_mode=selection_mode)
        LabelMixin.__init__(self, label=label, label_short=label_short)

        # register empty attributes
        self._channel = None

        # set initial values
        if channel is not None:
            self.channel = channel

        # set initial child categories
        if categories is not None:
            self.extend_categories(categories)
Пример #3
0
    def __init__(self,
                 name,
                 id,
                 campaign=None,
                 info=None,
                 processes=None,
                 label=None,
                 label_short=None,
                 is_data=False,
                 tags=None,
                 aux=None,
                 context=None,
                 **kwargs):
        UniqueObject.__init__(self, name, id, context=context)
        CopyMixin.__init__(self)
        AuxDataMixin.__init__(self, aux=aux)
        TagMixin.__init__(self, tags=tags)
        DataSourceMixin.__init__(self, is_data=is_data)
        LabelMixin.__init__(self, label=label, label_short=label_short)

        # instance members
        self._campaign = None
        self._info = {}

        # set initial values
        if campaign is not None:
            self.campaign = campaign
        if info is not None:
            self.info = info
        if kwargs and Shift.NOMINAL not in self.info:
            self.info = {Shift.NOMINAL: kwargs}

        # set initial processes
        if processes is not None:
            self.processes.extend(processes)
Пример #4
0
    def __init__(self,
                 name,
                 id=UniqueObject.AUTO_ID,
                 expression=None,
                 binning=(1, 0., 1.),
                 x_title="",
                 x_title_short=None,
                 y_title="Entries",
                 y_title_short=None,
                 x_labels=None,
                 log_x=False,
                 log_y=False,
                 unit="1",
                 unit_format="{title} / {unit}",
                 selection=None,
                 selection_mode=None,
                 tags=None,
                 aux=None,
                 context=None):
        UniqueObject.__init__(self, name, id, context=context)
        CopyMixin.__init__(self)
        AuxDataMixin.__init__(self, aux=aux)
        TagMixin.__init__(self, tags=tags)
        SelectionMixin.__init__(self,
                                selection=selection,
                                selection_mode=selection_mode)

        # instance members
        self._expression = None
        self._binning = None
        self._x_title = None
        self._x_title_short = None
        self._y_title = None
        self._y_title_short = None
        self._x_labels = None
        self._log_x = None
        self._log_y = None
        self._unit = None
        self._unit_format = None

        # set initial values
        self.expression = expression
        self.binning = binning
        self.x_title = x_title
        self.x_title_short = x_title_short
        self.y_title = y_title
        self.y_title_short = y_title_short
        self.x_labels = x_labels
        self.log_x = log_x
        self.log_y = log_y
        self.unit = unit
        self.unit_format = unit_format
Пример #5
0
    def __init__(self, keys=None, n_files=-1, n_events=-1, aux=None):
        CopyMixin.__init__(self)
        AuxDataMixin.__init__(self, aux=aux)

        # instance members
        self._keys = []
        self._n_files = -1
        self._n_events = -1

        # set initial values
        if keys is not None:
            self.keys = keys
        if n_files is not None:
            self.n_files = n_files
        if n_events is not None:
            self.n_events = n_events
Пример #6
0
    def __init__(self, name, id, type=None, label=None, label_short=None, tags=None, aux=None,
            context=None):
        UniqueObject.__init__(self, name, id, context=context)
        CopyMixin.__init__(self)
        AuxDataMixin.__init__(self, aux=aux)
        TagMixin.__init__(self, tags=tags)
        LabelMixin.__init__(self, label=label, label_short=label_short)

        # register empty attributes
        self._source = None
        self._direction = None
        self._type = self.RATE_SHAPE

        # set initial values
        self._source, self._direction = self.split_name(self.name)
        if type is not None:
            self.type = type
Пример #7
0
    def __init__(self,
                 name,
                 id,
                 categories=None,
                 label=None,
                 label_short=None,
                 tags=None,
                 aux=None,
                 context=None):
        UniqueObject.__init__(self, name, id, context=context)
        CopyMixin.__init__(self)
        AuxDataMixin.__init__(self, aux=aux)
        TagMixin.__init__(self, tags=tags)
        LabelMixin.__init__(self, label=label, label_short=label_short)

        # set initial categories
        if categories is not None:
            self.extend_categories(categories)
Пример #8
0
    def __init__(self, cls, default_context=None):
        CopyMixin.__init__(self)

        # set the cls using the typed parser
        self._cls = None
        self._cls = self.__class__.cls.fparse(self, cls)

        # store the default context of the cls
        self._default_context = None
        self.default_context = default_context or cls.get_default_context()

        # seperate dicts to map names and ids to unique objects,
        # stored in a dict mapped to contexts
        self._indices = collections.defaultdict(
            lambda: {
                "names": collections.OrderedDict(),
                "ids": collections.OrderedDict(),
            })

        # register indices for the default context
        self._indices[self.default_context]