Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
import os, sys
from ROOT import gSystem, gROOT, TFile, TCanvas, gPad, TBrowser, TH2F


gROOT.Macro( os.path.expanduser( '~/rootlogon.C' ) )

def loadFWLite():
    gSystem.Load("libFWCoreFWLite")
    gROOT.ProcessLine('FWLiteEnabler::enable();')
    gSystem.Load("libFWCoreFWLite")



def init(events):
    
    events.SetAlias('vertex','recoVertexs_offlinePrimaryVertices__RECO')
    events.SetAlias('pu','recoPFCandidates_pfPileUp__PF2PAT')
    events.SetAlias('nopu','recoPFCandidates_pfNoPileUp__PF2PAT')

    events.SetAlias('tvnopu', 'nopu.obj.vertex()')
    events.SetAlias('tvrhonopu','sqrt(tvnopu.x()*tvnopu.x()+tvnopu.y()*tvnopu.y())')
    
    events.SetAlias('run','EventAuxiliary.id().run()')
    events.SetAlias('lumi','EventAuxiliary.id().luminosityBlock()')

    events.SetAlias('dzpu','pu.obj.vertex().z()-vertex.obj[0].z()')
    events.SetAlias('dznopu','nopu.obj.vertex().z()-vertex.obj[0].z()')

    return events

loadFWLite()

file = TFile( sys.argv[1] )
events = file.Get('Events')
init(events)

events.Draw('dznopu','abs(dznopu)<1')