Esempio n. 1
0
    def __init__(self, input_tree, options):
        global AnalysisSingleton
        assert not AnalysisSingleton
        AnalysisSingleton = self

        self.release_16 = options.release == "rel16"
        self.project = options.project
        self.specific_events = options.events

        self.last_tree = 0

        self.options = options
        self.original_tree = input_tree
        self.tree_name = input_tree.GetName()
        self.input_tree = egamma_wrap_tree(input_tree, options)
        # Save a few attribute lookups since this is on the critical path
        get_tree = self.input_tree.tree.GetTree
        type(self).root_tree = property(lambda s: get_tree())
        self.info = self.input_tree._selarg

        self.setup_grl(options)
        self.setup_objects()

        self.result_name = options.output
        self.histogram_manager = self.h = None

        self.current_tree = self.current_run = self.previous_run = None

        self.should_dump = False
        self.events_to_dump = []
        self.tasks = []
        self.stopwatch = R.TStopwatch()

        self.initialize_counters()
Esempio n. 2
0
def main():
    minty.init_root()

    from time import time
    
    start = time()
    tt = egamma_wrap_tree(make_chain("PAUReco", ["example-pau.root"]))
    nev = tt.loop(test_ev)
    elapsed = time() - start
    print "Took %.2f seconds to process %i events (%.2f/sec)" % (elapsed, nev, nev/elapsed)
           
    start = time()
    tt = egamma_wrap_tree(make_chain("egamma", ["example-egamma.root"]))
    nev = tt.loop(test_ev)
    elapsed = time() - start
    print "Took %.2f seconds to process %i events (%.2f/sec)" % (elapsed, nev, nev/elapsed)
Esempio n. 3
0
def main():
    class options:
        release = "rel16"
        project = "data11"
        events = None
        output = "output.root"
        grl_path = None
        skip = 0
        limit = 100
        run_specific_output = False
        have_metadata = False
        dump = False

    f = "/scratch/pwaller/data/data11/50/skim.slim/" "user.PeterWaller.002737._00001.outputXYZ.rootXYZ.tgz.root"
    file_name = "test.a4"

    ph = R.TChain("photon")
    ph.Add(f)
    print "Will copy {0} events:", ph.GetEntries()

    tree = egamma_wrap_tree(ph, options)

    with A4WriterStream(open(file_name, "w"), "Event", Event) as a4w:

        def copy(index, event):
            if not index % 100:
                print index
            a4w.write(map_event(event))

        i = tree.loop(copy, hi=5000)

    print "Copied {0} events".format(i)