print tree.GetEntries() if sname == snames[0]: if obj == 'muon': treeType = ROOT.kDimuon elif obj == 'electron': treeType = ROOT.kDielectron elif obj == 'met': treeType = ROOT.kSingleElectron elif sname.startswith('sph-'): treeType = ROOT.kDiphoton elif sname.startswith('sel-'): treeType = ROOT.kElectronPhoton elif sname.startswith('smu-'): treeType = ROOT.kMuonPhoton elif sname.startswith('jht-'): treeType = ROOT.kJetHT # suffix = sname[:sname.find('-')] suffix = sname # TEMPORARY st19 = (sample.book == 'filefi/045') outDir = config.histDir + '/trigger' if not os.path.exists(outDir): os.makedirs(outDir) ROOT.skim(tree, treeType, outDir + '/trigger_' + suffix + '_' + obj + '.root', st19, 50000000)
ROOT.gROOT.LoadMacro(thisdir + '/Skimmer.cc+') # available object - sample - skim type configurations configs = { 'photon': {'sph': ROOT.kDiphoton, 'sel': ROOT.kElectronPhoton, 'smu': ROOT.kMuonPhoton, 'jht': ROOT.kJetHT}, 'muon': {'smu': ROOT.kDimuon}, 'electron': {'sel': ROOT.kDielectron}, 'met': {'sel': ROOT.kElectronMET} } tree = ROOT.TChain('events') for sample in samples: try: treeType = configs[obj][sample.name[:sample.name.find('-')]] except KeyError: print 'treeType for', obj, sample.name, 'not found' continue treePath = config.ntuplesDir + '/' + sample.book + '/' + sample.fullname + '/*.root' print sample.name, "adding files from", treePath tree.Add(treePath) print tree.GetEntries(), 'entries' ROOT.skim(tree, treeType, '/tmp/trigger_' + sample.name + '_' + obj + '.root') shutil.move('/tmp/trigger_' + sample.name + '_' + obj + '.root', config.histDir + '/trigger')