from PandaCore.Utils.root import root from PandaCore.Tools.Misc import * from PandaCore.Utils.load import * import PandaAnalysis.T3.job_utilities as utils from PandaAnalysis.Flat.analysis import * Load('PandaAnalyzer') data_dir = getenv('CMSSW_BASE') + '/src/PandaAnalysis/data/' def fn(input_name, isData, full_path): a = wlnhbb(True) a.inpath = input_name a.outpath = utils.input_to_output(input_name) a.datapath = data_dir a.isData = isData utils.set_year(a, 2017) a.processType = utils.classify_sample(full_path, isData) if a.processType in {root.pa.kTT, root.pa.kH}: a.reclusterGen = True # only turn on if necessary skimmer = root.pa.PandaAnalyzer(a) skimmer.AddPresel(root.pa.VHbbSel()) skimmer.AddPresel(root.pa.TriggerSel()) return utils.run_PandaAnalyzer(skimmer, isData, a.outpath) if __name__ == "__main__": utils.wrapper(fn)
from PandaCore.Tools.Misc import * from PandaCore.Utils.load import * import PandaAnalysis.T3.job_utilities as utils from PandaAnalysis.Flat.analysis import * Load('PandaAnalyzer') data_dir = getenv('CMSSW_BASE') + '/src/PandaAnalysis/data/' def fn(input_name, isData, full_path): # now we instantiate and configure the analyzer a = monotop(True) a.recalcECF = True a.varyJESTotal = True a.mcTriggers = True a.inpath = input_name a.outpath = utils.input_to_output(input_name) a.datapath = data_dir a.isData = isData utils.set_year(a, 2016) a.processType = utils.classify_sample(full_path, isData) skimmer = root.pa.PandaAnalyzer(a) skimmer.AddPresel(root.pa.FatJetSel()) return utils.run_PandaAnalyzer(skimmer, isData, a.outpath) if __name__ == "__main__": utils.wrapper(fn, post_fn=utils.BDTAdder())
return utils.run_PandaAnalyzer(skimmer, isData, a.outpath) def post_fn(): sleep(60) do('du -hs output.root 1>&2') f = root.TFile.Open('output.root') t = f.Get('events') logger.debug('post_fn', 'Tree has %i entries' % (t.GetEntries())) logger.info('post_fn', 'Creating numpy arrays') arr = read_files(['output.root'], branches=None) adj = arr['adj'] x = np.stack([ arr['node' + f] for f in ['Pt', 'Eta', 'Phi', 'E', 'IsFinal', 'IsRoot'] ], axis=-1) jets = np.stack([ arr['jet' + f] for f in ['Tau32', 'Tau21', 'MSD', 'Pt', 'Eta', 'Phi', 'M', 'PdgId'] ], axis=-1) logger.info('post_fn', 'Saving numpy arrays') np.savez_compressed('output.npz', adj=adj, x=x, jets=jets) do('mv -v output.npz output.root') if __name__ == "__main__": utils.wrapper(fn, post_fn=post_fn)
from PandaCore.Utils.root import root from PandaCore.Tools.Misc import * from PandaCore.Utils.load import * import PandaAnalysis.T3.job_utilities as utils from PandaAnalysis.Flat.analysis import * Load('PandaAnalyzer') data_dir = getenv('CMSSW_BASE') + '/src/PandaAnalysis/data/' def fn(input_name, isData, full_path): a = analysis('jes', varyJES=True, rerunJES=True) a.inpath = input_name a.outpath = utils.input_to_output(input_name) a.datapath = data_dir a.isData = isData utils.set_year(a, 2016) a.processType = utils.classify_sample(full_path, isData) skimmer = root.pa.PandaAnalyzer(a) return utils.run_PandaAnalyzer(skimmer, isData, a.outpath) if __name__ == "__main__": utils.wrapper( fn, post_fn=lambda: utils.drop_branches(to_keep=[ 'jotPt*', 'fjPt*', 'mcWeight', 'jotEta', 'npv', 'jotRawPt' ]))