Ejemplo n.º 1
0
sample = Sample(sample_name, args.path, sample_name, 1,
                '1')  #xsec not used here, so put to 1
Chain = sample.initTree()

#Create output file
output_dir = '/user/lwezenbe/public/ntuples/' + args.year + '/' + args.skim + '_v5wDeepCsvInvMET'
makeDirIfNeeded(output_dir)

output_file = TFile(output_dir + '/' + sample.output + '.root', 'recreate')
output_file.mkdir('blackJackAndHookers')
output_file.cd('blackJackAndHookers')

#Get hcounters
import eventSelection
isData = eventSelection.isData(sample.name)
if not isData: hCounter = sample.getHist('hCounter')
if 'TChi' in sample.name: hCounterSUSY = sample.getHist('hCounterSUSY')

#initialize new tree and delete unused branches
#branches_to_delete = ['HLT', 'Trigger', 'Flag', 'nLhe', 'IP', 'lElectron', 'leptonMva', 'relIso', 'miniIso', 'closestJet', 'lMuon', '_ph', 'HN']
#branches_to_delete = ['HLT_IsoMu22','HLT_MET','HLT_PFMET', 'HLT_PFHT', 'HLT_CaloJet', 'nLhe', 'lMuon', '_ph', 'HN', 'deepTau', 'Flag']
#for branch in branches_to_delete:
#    Chain.SetBranchStatus('*'+branch+'*', 0)

output_tree = Chain.CloneTree(0)

#Add new branches
nl_max = 20
import numpy as np
_ewkLoose = np.full((nl_max), False, dtype=bool)
_ewkTight = np.full((nl_max), False, dtype=bool)