Пример #1
0
def test_samples():
    for year in 2011, 2012:
        analysis = Analysis(year)
        analysis.normalize(Category_Preselection)
        for sample in analysis.backgrounds + [analysis.higgs_125]:
            for category in (Category_VBF, Category_Boosted):
                for region in ('OS_ISOL', 'OS', 'nOS_ISOL'):
                    if not isinstance(sample, QCD):
                        yield check_partition, sample, category, region
                    yield check_events, analysis, sample, category, region
Пример #2
0
from mva.samples import Higgs
from mva.analysis import Analysis
from mva.categories import Category_VBF
from rootpy.plotting import Hist, Canvas
from rootpy.plotting.utils import draw

ana = Analysis(2012)
clf = ana.get_clf(Category_VBF, load=True)
h = Higgs(2012, mode='gg', systematics=True)
sample = h.get_histfactory_sample(Hist(clf.binning(2012),
                                       color='red',
                                       fillstyle='hollow',
                                       drawstyle='hist',
                                       linewidth=2),
                                  clf,
                                  Category_VBF,
                                  'OS_ISOL',
                                  systematics=True,
                                  mva=True)
hsys = sample.GetHistoSys('QCDscale_ggH3in')

nom = sample.hist.Clone(shallow=True,
                        drawstyle='hist',
                        color='red',
                        fillstyle='hollow',
                        linewidth=2)
up = hsys.high.Clone(shallow=True,
                     drawstyle='hist',
                     color='red',
                     linestyle='dashed',
                     fillstyle='hollow',
Пример #3
0
from rootpy.plotting import Hist
from mva.analysis import Analysis
from mva.categories import Category_VBF
from nose.tools import assert_equal, assert_almost_equal
try:
    from nose.tools import assert_multi_line_equal
except ImportError:
    assert_multi_line_equal = assert_equal
else:
    assert_multi_line_equal.im_class.maxDiff = None


analysis = Analysis(year=2012, systematics=True, use_embedding=True)
analysis.normalize(Category_VBF)


def test_draw():

    for sample in analysis.backgrounds:
        print sample.name

        hist = Hist(30, 0, 250)
        hist_array = hist.Clone()
        field_hist = {'mmc1_mass': hist_array}

        sample.draw_into(hist, 'mmc1_mass', Category_VBF, 'OS_TRK')
        sample.draw_array(field_hist, Category_VBF, 'OS_TRK')

        assert_almost_equal(hist.Integral(), hist_array.Integral(), places=3)

        assert_equal(sorted(hist.systematics.keys()),