Esempio n. 1
0
    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([], {})
Esempio n. 2
0
    def branch(self,tree) :
        mal = configuration.maxArrayLength()
        line = "typedef struct {Int_t len;%s} arrays_t;"%(' '.join('  %s a_%s[%d];'%(t,name,mal) for name,(ar,ro,t) in types.items() 
                                                                   if name not in ["bool","char","uchar","ushort","ulong"]))
        r.gROOT.ProcessLine(line)
        arrayAddress = r.arrays_t()
        address = {}

        tree.Branch("len", r.AddressOf(arrayAddress,"len"), "len/I")
        for name,(ar,ro,t) in types.items() :
            address[name] = array.array(ar,[0])
            tree.Branch(name, address[name], "%s/%s"%(name,ro))

            vname = "v_"+name
            address[vname] = r.std.vector(t)()
            tree.Branch(vname, address[vname])

            aname = "a_"+name
            if hasattr(arrayAddress,aname) :
                tree.Branch(aname, r.AddressOf(arrayAddress,aname), "%s[len]/%s"%(aname,ro))

        return address,arrayAddress