Ejemplo n.º 1
0
    #addAsBranch = True
    addAsBranch = False

    print 'w.getBranches()', w.getBranches()

    if addAsBranch:

        # add all new branches defined in the above module as output
        #  this links the above module with the SampleTree class
        #  which will call the processEvent() during the loop to
        #  fill the output branches
        sampleTree.addOutputBranches(w.getBranches())

        # output files
        sampleTree.addOutputTree(
            '/scratch/berger_p2/testWithWeight_MET_below_250.root',
            cut='MET_Pt<250',
            branches='*')
        sampleTree.addOutputTree(
            '/scratch/berger_p2/testWithWeight_MET_above_250.root',
            cut='MET_Pt>250',
            branches='*')

        # loop over all events!
        sampleTree.process()

    else:
        # process the first event only
        w.processEvent(sampleTree.tree)
        print('weight:', w._b('weight')[0])
        print('weightF:', w._b('weightF')[0])
        print('weightXS:', w._b('weightXS')[0])
Ejemplo n.º 2
0
        '/store/group/phys_higgs/hbb/ntuples/VHbbPostNano/2017/V11/WplusH_HToBB_WToLNu_M125_13TeV_powheg_pythia8/adewit-crab_nano2017_WplusH_HT81/190606_065851/0000/tree_1.root'
    ],
                            treeName='Events',
                            xrootdRedirector="root://eoscms.cern.ch/")
    # initialize module
    w = JetSmearer("2017")
    w.customInit({
        'sampleTree': sampleTree,
        'sample': sample,
        'config': config
    })
    n = 0
    #for event in sampleTree:
    #    w.processEvent(event)
    #    n=n+1
    #    if n==3: break

    sampleTree.addOutputBranches(w.getBranches())

    # output files
    sampleTree.addOutputTree('/scratch/berger_p2/test.root',
                             cut='1',
                             branches='*')

    sampleTree.addCallback('event', w.processEvent)
    sampleTree.addCallback(
        'event', lambda x: False if x.GetReadEntry() > 1000 else True)

    # loop over all events!
    sampleTree.process()