def setUp(self): import maketree, ROOT as r maketree.writeTree() def tchain(name): chain = r.TChain(name) chain.Add("/".join((maketree.filePath(),) + configuration.mainTree())) return chain self.sbaF = supy.wrappedChain(tchain("sbaF"), useSetBranchAddress=False) self.sbaT = supy.wrappedChain(tchain("sbaT"), useSetBranchAddress=True)
def loop(self) : if self.nEventsMax!=0 : chainWrapper = wrappedChain( self.chains[self.mainTree], calculables = self.calculables, useSetBranchAddress = not any([step.requiresNoSetBranchAddress() for step in self.steps]), leavesToBlackList = self.leavesToBlackList, maxArrayLength = configuration.maxArrayLength(), trace = self.trace, cacheSizeMB = configuration.ttreecacheMB(), ) for step in filter(lambda s: (issubclass(type(s),wrappedChain.calculable) and hasattr(s,"source") and hasattr(s.source,"tracedKeys")), self.steps) : step.tracer = step.source step.source.tracedKeys |= step.priorFilters [ all(step(eventVars) for step in self.steps) for eventVars in chainWrapper.entries(self.nEventsMax, self.skip) ] for step in filter(lambda s: s.tracer and s.name in s.tracer.tracedKeys, self.steps) : step.tracer.tracedKeys.remove(step.name) self.recordLeavesAndCalcsUsed( chainWrapper.activeKeys(), chainWrapper.calcDependencies() ) else : self.recordLeavesAndCalcsUsed([], {})
def setUp(self): self.oldErrorIgnoreLevel = r.gErrorIgnoreLevel r.gErrorIgnoreLevel = 9999 # suppress messages about missing/broken # files (purposefully created below) self.treeName = "tree" self.varName = "run" self.runs = [[0, 1, 2, 3], [], [222], [], [444], [], [], [4], [5, 6], [], [], [7, 8]] self.writeTFiles() chain = r.TChain(self.treeName) for iList in range(len(self.runs)): fileName = self.fileName(iList) if iList == 2: toRemove = fileName if iList == 4: toBreak = fileName chain.Add("/".join([fileName, self.treeName])) os.remove(toRemove) # make a file inaccessible os.system("echo 0 > %s" % toBreak) # make a file unreadable self.wc = supy.wrappedChain(chain)