def process(self, jobid, item): """The actual processing ``params'' is assumed to be a tuple-like entity: - the file name - the tree name in the file - the variable/expression/expression list of quantities to project - the selection/weighting criteria - the first entry in tree to process - number of entries to process """ import ROOT from ostap.logger.utils import logWarning with logWarning(): import ostap.core.pyrouts import ostap.trees.trees chain = item.chain first = item.first ## last = min ( n_large , first + item.nevents if 0 < item.nevents else n_large ) last = n_large from ostap.trees.trees import _stat_vars_ self.__output = _stat_vars_(chain, self.what, self.cuts, first, last) return self.__output
def process(self, item): """The actual processing ``params'' is assumed to be a tuple-like entity: - the file name - the tree name in the file - the variable/expression/expression list of quantities to project - the selection/weighting criteria - the first entry in tree to process - number of entries to process """ import ROOT from ostap.logger.utils import logWarning with logWarning(): import ostap.core.pyrouts import ostap.trees.trees chain = item.chain first = item.first nevents = item.nevents ## Create the output histogram NB! (why here???) self.output = 0, self.histo.Clone() ## use the regular projection from ostap.trees.trees import _tt_project_ self.output = _tt_project_(chain, self.output[1], self.what, self.cuts, '', nevents, first) del item
def process(self, params): import ROOT tree, fname = params tree = ROOT.TChain(tree) tree.Add(fname) from ostap.logger.logger import logWarning with logWarning(): import ostap.core.pyrouts from ostap.roofit.selectors import SelectorWithVars selector = SelectorWithVars(self.variables, self.selection, silence=True) tree, fname = params tree = ROOT.TChain(tree) tree.Add(fname) tree.process(selector, 1000) self.output = selector.data del selector.data del selector logger.debug('Processed %s chain and filled %d entries ' % (fname, len(self.output)))
def process(self, jobid, item): """The actual processing ``params'' is assumed to be a tuple-like entity: - the file name - the tree name in the file - the variable/expression/expression list of quantities to project - the selection/weighting criteria - the first entry in tree to process - number of entries to process """ import ROOT from ostap.logger.utils import logWarning with logWarning(): import ostap.core.pyrouts import ostap.trees.trees import ostap.histos.histos import ostap.frames.frames from ostap.trees.trees import Chain, Tree input = Chain(name=item.name, files=item.files, first=item.first, nevents=item.nevents) chain = input.chain first = input.first nevents = input.nevents ## use the regular projection from ostap.trees.trees import _tt_project_ ## Create the output histogram NB! (why here???) from ostap.core.core import ROOTCWD with ROOTCWD(): ROOT.gROOT.cd() histo = self.histo.Clone() self.__output = 0, histo from ostap.trees.trees import _tt_project_ self.__output = _tt_project_(tree=chain, histo=histo, what=self.what, cuts=self.cuts, options='', nentries=nevents, firstentry=first) del item return self.__output
def process(self, item): import ROOT from ostap.logger.logger import logWarning with logWarning(): import ostap.core.pyrouts import ostap.trees.trees ## reconstruct chain from the item chain = item.chain ll = len(chain) first = item.first nevents = item.nevents all = 0 == first and (nevents < 0 or ll <= nevents) if self.trivial and all: import ostap.fitting.selectors self.output = chain.make_dataset(self.variables, self.selection, silent=True) return from ostap.fitting.selectors import SelectorWithVars ## use selector selector = SelectorWithVars(self.variables, self.selection, silence=True) args = () if not all: args = nevents, first num = chain.process(selector, *args, shortcut=all and self.trivial) self.output = selector.data, selector.stat if num < 0: logger.warning("Processing status %s" % num) ##del selector.data ##del selector logger.debug('Processed %s and filled %d entries ' % (item, len(self.output))) del item
def process(self, params): """The actual processing ``params'' is assumed to be a tuple-like entity: - the file name - the tree name in the file - the variable/expression/expression list of quantities to project - the selection/weighting criteria - the first entry in tree to process - number of entries to process """ import ROOT from ostap.logger.utils import logWarning with logWarning(): import ostap.core.pyrouts if isinstance(params, str): params = (param, 0, n_large) elif isinstance(params, ROOT.TChainElement): params = (params.GetTitle(), 0, n_large) fname = params[0] ## file name tname = params[1] ## tree name what = params[2] ## variable/expression to project cuts = params[3] if 3 < len(params) else '' ## cuts first = params[4] if 4 < len(params) else 0 ## the first event nentries = params[5] if 5 < len( params) else n_large ## number of events if isinstance(fname, ROOT.TChainElement): fname = fname.GetTitle() chain = ROOT.TChain(tname) chain.Add(fname) ## Create the output histogram NB! (why here???) self.output = 0, self.histo.Clone() ## use the regular projection from ostap.trees.trees import _tt_project_ self.output = _tt_project_(chain, self.output[1], what, cuts, '', nentries, first) del chain