pattern = args.input
if '{sample_name}' not in pattern:
  raise ValueError('No {sample_name} found in pattern %s' % pattern)

input_dir = os.path.dirname(pattern)
if not hdfs.isdir(input_dir):
  raise ValueError('No such input directory: %s' % input_dir)

if args.era == '2017':
  from tthAnalysis.HiggsToTauTau.samples.tthAnalyzeSamples_2017 import samples_2017 as samples
  from tthAnalysis.HiggsToTauTau.analysisSettings import lumi_2017 as lumi
  samples_to_sum = samples_to_sum_2017

  samples_lut = {}
  for sample_key, sample_entry in samples.items():
    if sample_key == 'sum_events': continue
    sample_name = sample_entry['process_name_specific']
    assert(sample_name not in samples_lut)
    samples_lut[sample_name] = sample_key
else:
  raise RuntimeError('Invalid era: %s' % args.era)
if 'sum_events' in samples:
  del samples['sum_events']

# construct a list of samples that cover the same phase space
valid_samples_to_sum = []
valid_samples_to_sum_flat = []
for sample_list in samples_to_sum:
  inclusive_sample = sample_list[0]
  inclusive_xs = -1
Exemple #2
0
from tthAnalysis.HiggsToTauTau.samples.tthAnalyzeSamples_2017 import samples_2017
from tthAnalysis.HiggsToTauTau.samples.tthAnalyzeSamples_2017_BDT import bdt_samples as bdt_samples_common
from tthAnalysis.HiggsToTauTau.samples.stitch import samples_to_stitch_2017
from tthAnalysis.HiggsToTauTau.analysisTools import split_stitched

dy_samples_inclusive, dy_samples_binned = split_stitched(
    samples_to_stitch_2017, 'DY')
wj_samples_inclusive, wj_samples_binned = split_stitched(
    samples_to_stitch_2017, 'W')
bdt_samples = bdt_samples_common + dy_samples_inclusive + dy_samples_binned + wj_samples_inclusive + wj_samples_binned

for sample_name, sample_info in samples_2017.items():
    if sample_name == 'sum_events': continue
    sample_info["use_it"] = sample_info["process_name_specific"] in bdt_samples
Exemple #3
0
  f.Close()
  f_out.Close()

from tthAnalysis.HiggsToTauTau.samples.tthAnalyzeSamples_2017 import samples_2017 as samples

allowed_sample_names = [
  'DYJetsToLL_M-4to50_HT-100to200',
  'DYJetsToLL_M-4to50_HT-100to200_ext1',
  'DYJetsToLL_M-4to50_HT-200to400',
  'DYJetsToLL_M-4to50_HT-200to400_ext1',
  'DYJetsToLL_M-4to50_HT-400to600',
  'DYJetsToLL_M-4to50_HT-400to600_ext1',
  'DYJetsToLL_M-4to50_HT-600toInf',
  'DYJetsToLL_M-10to50',
]
output_dir_base = os.path.expanduser('~/sandbox/project_event_counts')

for sample_key, sample_info in samples.items():
  sample_name = sample_info['process_name_specific']
  if sample_name in allowed_sample_names:
    fp = sample_info['local_paths'][0]['path']
    nof_files = sample_info['nof_files']
    fns = [ os.path.join(fp, '%04d' % (idx // 1000), 'tree_%d.root' % idx) for idx in range(1, nof_files + 1) ]
    output_dir = os.path.join(output_dir_base, sample_name)
    if not os.path.isdir(output_dir):
      os.path.mkdirs(output_dir)
    for fn in fns:
      fn_base = os.path.basename(fn).replace('tree', 'hist')
      fn_out = os.path.join(output_dir, fn_base)
      dump_yields(fn, fn_out)